Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > Git works quite as expected here, so there is nothing to fix. > >> error: no such remote ref refs/heads/jc/bind >> error: no such remote ref refs/heads/jc/bind-2 >> error: no such remote ref refs/heads/gb/diffdelta > > Since you said it is an older git repository, I guess that in your > .git/remotes/origin are some lines like this: > > Pull: refs/heads/jc/bind:refs/heads/jc/bind > > So, you _asked_ git to fetch these three branches! I think it only half explains the problem. Maybe my memory is failing, but I do not recall pushing out any of these topic branches, perhaps except jc/bind long time ago. How did Hannu end up with these branches, both under his $GIT_DIR/refs/heads/ and in $GIT_DIR/remotes/origin or remote.origin.fetch in $GIT_DIR/config? I see identical failure report from ancient time http://article.gmane.org/gmane.comp.version-control.git/21629 Maybe I did push them out earlier. How about doing something like this? In explain_fetch_failure I think we could look at $ls_remote_result and automagically fix remotes/$remote_nick or remote.$remote_nick.fetch, but I am lazy ;-) -- >8 -- diff --git a/git-fetch.sh b/git-fetch.sh index ffbd44f..361dfa3 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -81,6 +81,7 @@ case "$#" in esac remote_nick="$1" +datasrc=$(get_data_source "$1") remote=$(get_remote_url "$@") refs= rref= @@ -272,6 +273,21 @@ then fi fi +explain_fetch_failure () { + where= + case "$datasrc" in + '') ;; + config) where="remotes.$remote_nick.fetch configuration" ;; + branch) where=".git/branches/$remote_nick file" ;; + remotes) where=".git/remotes/$remote_nick file" ;; + esac + if test "z$where" != z + then + echo >&2 "You may have stale remote branches in $where" + echo >&2 "Remove them if they do not exist anymore." + fi +} + fetch_main () { reflist="$1" refs= @@ -325,8 +341,10 @@ fetch_main () { break done ) - expr "z$head" : "z$_x40\$" >/dev/null || + expr "z$head" : "z$_x40\$" >/dev/null || { + explain_fetch_failure die "No such ref $remote_name at $remote" + } echo >&2 "Fetching $remote_name from $remote using $proto" git-http-fetch -v -a "$head" "$remote/" || exit ;; @@ -385,6 +403,7 @@ fetch_main () { case "$sha1" in failed) echo >&2 "Fetch failure: $remote" + explain_fetch_failure exit 1 ;; # special line coming from index-pack with the pack name pack) - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html