git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: aborted 'git fetch' leaves workspace unusable

From
Sstephen_leake@stephe-leake.org <stephen_leake@stephe-leake.org>
Date
Dec 31, 2013, 08:19 UTC
Message-ID
<32eeea08963ec4438f97ff9ef6553a75@stephe-leake.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> stephen_leake@stephe-leake.org writes:
> 
>> That left the workspace unusable:
>> 
>> - .git/FETCH_HEAD is empty
>> 
>>     that causes 'git rev-parse FETCH_HEAD' to fail with a confusing
>>     error message.
> 
> This is not limited to your Cygwin environment.  I can see that we
> leave an empty file there after a failed fetch with
> 
> 	$ git fetch ssh://no.such.place/
> 
> But I would not call it leaving "the workspace unusable".  If you
> ask "git rev-parse" "What is in FETCH_HEAD?", you would get "that is
> not even a revision", which is what you would get.

Yes, and I also discovered that FETCH_HEAD is not present after a clone. So in general I need to be tolerant of an empty/missing FETCH_HEAD (I'm actually working on an Emacs front end for git).

However, in this case, even running the fetch was a mistake; I would have prefered that it leave FETCH_HEAD in its previous state. Is there any way to reconstruct it? refs/heads/master was untouched, but I don't know how to find the fetched head.

Show 10 quoted lines
>> - 'git fetch' just hangs after outputting:
>> 
>> remote: Counting objects: 15, done.
>> remote: Compressing objects: 100% (8/8), done.
>> remote: Total 9 (delta 5), reused 0 (delta 0)
> 
> This looks more serious, but I suspect it is totally unrelated to
> your previous fetch failing and leaving FETCH_HEAD there.  Is this
> "'git fetch' hangs" reproduce in a clean clone _without_ first
> encountering the failure (due to the forgotton "ssh-add")?

no, the clone worked (so the network is up, the server is up), and a subsequent 'git fetch' did not hang. Although there was also nothing to fetch.

I'll have to wait until there is something to fetch, and see if I can reproduce the bug. Or set up a git server and test branch - not high enough on my priority list.

-- -- Stephe

Next: Junio C Hamano
Message 1 of 4 in “Re: aborted 'git fetch' leaves workspace unusable”
  1. stephen_leake@stephe-leake.orgDec 31, 2013
  2. Junio C HamanoJan 2, 2014
  3. Stephen LeakeJan 3, 2014
  4. Junio C HamanoJan 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.