{"thread":{"id":"6116","subject":"Errors when updating an old git.git repository","startedAt":"2006-12-26T14:49:28Z","lastAt":"2006-12-27T00:58:58Z","messageCount":7,"participants":["Hannu Koivisto","Lars Hjemli","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"30302","messageId":"87d566ww3r.fsf@trews52.bothi.fi","threadId":"6116","inReplyTo":null,"subject":"Errors when updating an old git.git repository","fromName":"Hannu Koivisto","fromEmail":"azure@iki.fi","sentAt":"2006-12-26T14:49:28Z","receivedAt":"2006-12-26T14:49:28Z","isPatch":false,"sender":{"key":"azure@iki.fi","avatar":null},"body":"Greetings,\n\nI just did \"git-clone git://git.kernel.org/pub/scm/git/git.git\".\ngit-pull in the resulting repository gives \"Already up-to-date.\"\nand \"git-pull --tags\" does the same.  Just what I'd expect.\n\nBefore I did that, I had an old (several months) git.git repository\nlaying on the hard drive and I updated it with \"git pull\".  It\ncomplained something tag related and I tried again with \"git pull\n--tags\".  Now I'm in a situation where \"git-pull --tags\" gives \"No\nchanges.\" but plain \"git-pull\" gives me this:\n\n-------------------------------------------------------------------\nremote: Generating pack...\nremote: Done counting 293 objects.\nremote: Result has 214 objects.\nremote: Deltifying 214 objects.\nremote: 14/214) done14) done\nUnpacking 214 objects\nremote: Total 214, written 214 (delta 156), reused 181 (delta 123)\n 100% (214/214) done\nerror: no such remote ref refs/heads/jc/bind\nerror: no such remote ref refs/heads/jc/bind-2\nerror: no such remote ref refs/heads/gb/diffdelta\n* refs/heads/pu: not updating to non-fast forward branch 'pu' of git://git.kernel.org/pub/scm/git/git\n  old...new: 0c9951a...f959571\nAlready up-to-date.\n-------------------------------------------------------------------\n\nIf I run either git-pull or \"git-pull --tags\" again, I get the same\nresults.\n\nSince updating a freshly cloned repository doesn't result to such\nan odd behaviour, I assume this old repository is broken somehow.\nIf someone wants to inspect it, I can make it available via web.\n\nI'm using git 1.4.4.3 on Debian GNU/Linux.\n\n-- \nHannu\n"},{"id":"30304","messageId":"8c5c35580612260737vae2669dkac6a81fe863484d4@mail.gmail.com","threadId":"6116","inReplyTo":"87d566ww3r.fsf@trews52.bothi.fi","subject":"Re: Errors when updating an old git.git repository","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2006-12-26T15:37:43Z","receivedAt":"2006-12-26T15:37:43Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On 12/26/06, Hannu Koivisto <azure@iki.fi> wrote:\n> error: no such remote ref refs/heads/jc/bind\n> error: no such remote ref refs/heads/jc/bind-2\n> error: no such remote ref refs/heads/gb/diffdelta\n\nI guess you have some branch references in the file\n.git/remotes/origin that shouldn't be there, so you can just remove\nthe lines that mention  'jc/bind', 'jc/bind-2' and 'gb/diffdelta' from\nthat file.\n\n> * refs/heads/pu: not updating to non-fast forward branch 'pu' of git://git.kernel.org/pub/scm/git/git\n>   old...new: 0c9951a...f959571\n\nThe pu branch is rebased all the time so it needs a '+' in\n.git/remotes/origin to be automatically updated, like this:\n\nPull: +pu:pu\n\n(or you can run 'git pull -f' to force the update)\n\n-- \nlarsh\n"},{"id":"30311","messageId":"87ac1awjh0.fsf@trews52.bothi.fi","threadId":"6116","inReplyTo":"8c5c35580612260737vae2669dkac6a81fe863484d4@mail.gmail.com","subject":"Re: Errors when updating an old git.git repository","fromName":"Hannu Koivisto","fromEmail":"azure@iki.fi","sentAt":"2006-12-26T19:22:19Z","receivedAt":"2006-12-26T19:22:19Z","isPatch":false,"sender":{"key":"azure@iki.fi","avatar":null},"body":"\"Lars Hjemli\" <hjemli@gmail.com> writes:\n\n> On 12/26/06, Hannu Koivisto <azure@iki.fi> wrote:\n\n> I guess you have some branch references in the file\n> .git/remotes/origin that shouldn't be there, so you can just remove\n> the lines that mention  'jc/bind', 'jc/bind-2' and 'gb/diffdelta' from\n> that file.\n\nThanks, but I don't need to fix the repository since a clean clone\nworks, I just wanted to report it so that git can be fixed, if\npossible.\n\n>> * refs/heads/pu: not updating to non-fast forward branch 'pu' of git://git.kernel.org/pub/scm/git/git\n>>   old...new: 0c9951a...f959571\n>\n> The pu branch is rebased all the time so it needs a '+' in\n> .git/remotes/origin to be automatically updated, like this:\n>\n> Pull: +pu:pu\n>\n> (or you can run 'git pull -f' to force the update)\n\nI ran 'git pull -f' and it gave me this:\n\n-------------------------------------------------------------------\nremote: Generating pack...\nremote: Done counting 293 objects.\nremote: Result has 214 objects.\nremote: Deltifying 214 objects.\nremote:  100% (214/214) done\nUnpacking 214 objects\nremote: Total 214, written 214 (delta 156), reused 181 (delta 123)\n 100% (214/214) done\nerror: no such remote ref refs/heads/jc/bind\nerror: no such remote ref refs/heads/jc/bind-2\nerror: no such remote ref refs/heads/gb/diffdelta\n* refs/heads/pu: forcing update to non-fast forward branch 'pu' of git://git.kernel.org/pub/scm/git/git\n  old...new: 0c9951a...f959571\n* refs/heads/man: fast forward to branch 'man' of git://git.kernel.org/pub/scm/git/git\n  old..new: 55beec2..da0e8b5\n* refs/heads/todo: fast forward to branch 'todo' of git://git.kernel.org/pub/scm/git/git\n  old..new: a94df75..32e72b6\n* refs/heads/next: fast forward to branch 'next' of git://git.kernel.org/pub/scm/git/git\n  old..new: 50dae10..9c0d79d\n* refs/heads/html: fast forward to branch 'html' of git://git.kernel.org/pub/scm/git/git\n  old..new: 30e1db1..d793de5\nFetch failure: git://git.kernel.org/pub/scm/git/git.git\nAlready up-to-date.\n-------------------------------------------------------------------\n\nNow further 'git pull's also display \"Fetch failure:\ngit://git.kernel.org/pub/scm/git/git.git\".  It no longer mentions\nthe 'pu' branch, though.\n\n-- \nHannu\n"},{"id":"30315","messageId":"Pine.LNX.4.63.0612262350070.19693@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6116","inReplyTo":"87ac1awjh0.fsf@trews52.bothi.fi","subject":"Re: Errors when updating an old git.git repository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-12-26T22:54:19Z","receivedAt":"2006-12-26T22:54:19Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 26 Dec 2006, Hannu Koivisto wrote:\n\n> \"Lars Hjemli\" <hjemli@gmail.com> writes:\n> \n> > On 12/26/06, Hannu Koivisto <azure@iki.fi> wrote:\n> \n> > I guess you have some branch references in the file\n> > .git/remotes/origin that shouldn't be there, so you can just remove\n> > the lines that mention  'jc/bind', 'jc/bind-2' and 'gb/diffdelta' from\n> > that file.\n> \n> Thanks, but I don't need to fix the repository since a clean clone \n> works, I just wanted to report it so that git can be fixed, if possible.\n\nGit works quite as expected here, so there is nothing to fix.\n\n> error: no such remote ref refs/heads/jc/bind\n> error: no such remote ref refs/heads/jc/bind-2\n> error: no such remote ref refs/heads/gb/diffdelta\n\nSince you said it is an older git repository, I guess that in your \n.git/remotes/origin are some lines like this:\n\n\tPull: refs/heads/jc/bind:refs/heads/jc/bind\n\nSo, you _asked_ git to fetch these three branches! By not providing _any_ \nremote, you said: \"look into .git/remotes/origin\". And in that file you \nsaid: \"fetch bind, bind-2 and diffdelta\".\n\nAnd git faithfully reports that it cannot fetch these branches (they are \nno longer there) and errors out.\n\nCiao,\nDscho\n"},{"id":"30319","messageId":"7v1wmmchmc.fsf@assigned-by-dhcp.cox.net","threadId":"6116","inReplyTo":"Pine.LNX.4.63.0612262350070.19693@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Errors when updating an old git.git repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-27T00:22:35Z","receivedAt":"2006-12-27T00:22:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Git works quite as expected here, so there is nothing to fix.\n>\n>> error: no such remote ref refs/heads/jc/bind\n>> error: no such remote ref refs/heads/jc/bind-2\n>> error: no such remote ref refs/heads/gb/diffdelta\n>\n> Since you said it is an older git repository, I guess that in your \n> .git/remotes/origin are some lines like this:\n>\n> \tPull: refs/heads/jc/bind:refs/heads/jc/bind\n>\n> So, you _asked_ git to fetch these three branches!\n\nI think it only half explains the problem.  Maybe my memory is\nfailing, but I do not recall pushing out any of these topic\nbranches, perhaps except jc/bind long time ago.\n\nHow did Hannu end up with these branches, both under his\n$GIT_DIR/refs/heads/ and in $GIT_DIR/remotes/origin or\nremote.origin.fetch in $GIT_DIR/config?\n\nI see identical failure report from ancient time\n\n\thttp://article.gmane.org/gmane.comp.version-control.git/21629\n\nMaybe I did push them out earlier.\n\nHow about doing something like this?  In explain_fetch_failure\nI think we could look at $ls_remote_result and automagically fix\nremotes/$remote_nick or remote.$remote_nick.fetch, but I am lazy\n;-)\n\n-- >8 --\n\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex ffbd44f..361dfa3 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -81,6 +81,7 @@ case \"$#\" in\n esac\n \n remote_nick=\"$1\"\n+datasrc=$(get_data_source \"$1\")\n remote=$(get_remote_url \"$@\")\n refs=\n rref=\n@@ -272,6 +273,21 @@ then\n \tfi\n fi\n \n+explain_fetch_failure () {\n+\twhere=\n+\tcase \"$datasrc\" in\n+\t'') ;;\n+\tconfig) where=\"remotes.$remote_nick.fetch configuration\" ;;\n+\tbranch) where=\".git/branches/$remote_nick file\" ;;\n+\tremotes) where=\".git/remotes/$remote_nick file\" ;;\n+\tesac\n+\tif test \"z$where\" != z\n+\tthen\t\t  \t\n+\t\techo >&2 \"You may have stale remote branches in $where\"\n+\t\techo >&2 \"Remove them if they do not exist anymore.\"\n+\tfi\n+}\n+\n fetch_main () {\n   reflist=\"$1\"\n   refs=\n@@ -325,8 +341,10 @@ fetch_main () {\n \t\t\tbreak\n \t\tdone\n \t  )\n-\t  expr \"z$head\" : \"z$_x40\\$\" >/dev/null ||\n+\t  expr \"z$head\" : \"z$_x40\\$\" >/dev/null || {\n+\t  \texplain_fetch_failure\n \t\tdie \"No such ref $remote_name at $remote\"\n+\t  }\n \t  echo >&2 \"Fetching $remote_name from $remote using $proto\"\n \t  git-http-fetch -v -a \"$head\" \"$remote/\" || exit\n \t  ;;\n@@ -385,6 +403,7 @@ fetch_main () {\n \t  case \"$sha1\" in\n \t  failed)\n \t\t  echo >&2 \"Fetch failure: $remote\"\n+\t\t  explain_fetch_failure\n \t\t  exit 1 ;;\n \t  # special line coming from index-pack with the pack name\n \t  pack)\n"},{"id":"30322","messageId":"877iwew4iw.fsf@trews52.bothi.fi","threadId":"6116","inReplyTo":"Pine.LNX.4.63.0612262350070.19693@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Errors when updating an old git.git repository","fromName":"Hannu Koivisto","fromEmail":"azure@iki.fi","sentAt":"2006-12-27T00:45:11Z","receivedAt":"2006-12-27T00:45:11Z","isPatch":false,"sender":{"key":"azure@iki.fi","avatar":null},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Tue, 26 Dec 2006, Hannu Koivisto wrote:\n>\n> Git works quite as expected here, so there is nothing to fix.\n\nSince the documentation didn't seem to specify what happens when a\nremote branch is deleted (I'm assuming that's the case), _I_ didn't\nexpect it.\n\n>> error: no such remote ref refs/heads/jc/bind\n>> error: no such remote ref refs/heads/jc/bind-2\n>> error: no such remote ref refs/heads/gb/diffdelta\n>\n> Since you said it is an older git repository, I guess that in your \n> .git/remotes/origin are some lines like this:\n>\n> \tPull: refs/heads/jc/bind:refs/heads/jc/bind\n>\n> So, you _asked_ git to fetch these three branches!\n\nWell, that's true from a technical standpoint, but I didn't add\nthose lines to .git/remotes/origin, git did when I cloned the\nrepository.  When one updates tracking branches and a branch has\nbeen deleted in the remote repository, I think it wouldn't be\ninsane to expect git also to remove the line (if not the actual\nbranch).  If that is not desired, I'd rather the message wasn't an\nerror but something along the lines of \"note: remote branch jc/bind\nno longer exists, please update .git/remotes/origin\".  It's bit odd\nto get errors in a situation that (given the assumption) isn't\nerroneous.\n\n-- \nHannu\n"},{"id":"30323","messageId":"7vwt4eb1d9.fsf@assigned-by-dhcp.cox.net","threadId":"6116","inReplyTo":"877iwew4iw.fsf@trews52.bothi.fi","subject":"Re: Errors when updating an old git.git repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-27T00:58:58Z","receivedAt":"2006-12-27T00:58:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hannu Koivisto <azure@iki.fi> writes:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> ...\n>> So, you _asked_ git to fetch these three branches!\n>\n> Well, that's true from a technical standpoint, but I didn't add\n> those lines to .git/remotes/origin, git did when I cloned the\n> repository.  When one updates tracking branches and a branch has\n> been deleted in the remote repository, I think it wouldn't be\n> insane to expect git also to remove the line (if not the actual\n> branch).  If that is not desired, I'd rather the message wasn't an\n> error but something along the lines of \"note: remote branch jc/bind\n> no longer exists, please update .git/remotes/origin\".  It's bit odd\n> to get errors in a situation that (given the assumption) isn't\n> erroneous.\n\nI would be a bit reluctant to remove tracking automagically, but\nI fully agree that a comment like that would be needed.\n\nPatches?\n"}]}