google / zoekt

Fast trigram based code search
1.69k stars 113 forks source link

gitindex.CloneRepo results in error with git v2.21.0 #81

Closed ezkl closed 5 years ago

ezkl commented 5 years ago

Setting remote.origin.fetch to +refs/heads/*:refs/heads/* during the clone in gitindex.CloneRepo() results in an error with git v2.21.0 (released recently.)

The most straightforward way I was able to reproduce was to install both versions of git (v2.21.0 and v2.20.1) and git clone directly:

#!/usr/bin/env bash

set -x

git2.21 clone --bare --progress \
  --config "remote.origin.fetch=+refs/heads/*:refs/heads/*" \
  https://github.com/google/zoekt.git \
  /tmp/zoekt-git2.21.git

echo "status: $?"

git2.20 clone --bare --progress \
  --config "remote.origin.fetch=+refs/heads/*:refs/heads/*" \
  https://github.com/google/zoekt.git \
  /tmp/zoekt-git2.20.git

echo "status: $?"
+ git2.21 clone --bare --progress --config 'remote.origin.fetch=+refs/heads/*:refs/heads/*' https://github.com/google/zoekt.git /tmp/zoekt-git2.21.git
Cloning into bare repository '/tmp/zoekt-git2.21.git'...
remote: Enumerating objects: 155, done.
remote: Counting objects: 100% (155/155), done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 3498 (delta 78), reused 117 (delta 75), pack-reused 3343
Receiving objects: 100% (3498/3498), 1014.99 KiB | 6.26 MiB/s, done.
Resolving deltas: 100% (2293/2293), done.
fatal: multiple updates for ref 'refs/heads/master' not allowed
+ echo 'status: 128'
status: 128
+ git2.20 clone --bare --progress --config 'remote.origin.fetch=+refs/heads/*:refs/heads/*' https://github.com/google/zoekt.git /tmp/zoekt-git2.20.git
Cloning into bare repository '/tmp/zoekt-git2.20.git'...
remote: Enumerating objects: 155, done.
remote: Counting objects: 100% (155/155), done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 3498 (delta 78), reused 117 (delta 75), pack-reused 3343
Receiving objects: 100% (3498/3498), 1014.99 KiB | 6.15 MiB/s, done.
Resolving deltas: 100% (2293/2293), done.
+ echo 'status: 0'
status: 0

I was able to reproduce on both macOS 10.12 and Ubuntu 16.04. A superficial scan of recent changes to git makes me think that https://github.com/git/git/commit/515be8338237c1f0f98ff826ba98f50d1dff5517 may be the change that introduced the problem, but I haven't verified.

hanwen commented 5 years ago

thanks for the report; I can confirm this. The commit indeed looks like a probable culprit.

hanwen commented 5 years ago

I sent a mail to the git@ list.

keegancsmith commented 5 years ago

Link to git issue/thread https://public-inbox.org/git/CAFQ2z_O7rupGS4rntiUwJCHUj3bO0U88bVAToveEo_uU0Eu96w@mail.gmail.com/