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

Re: Ambiguous sha-1 during a rebase

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Apr 14, 2016, 09:09 UTC
Message-ID
<vpqr3e8wo99.fsf@anie.imag.fr>
In-Reply-To
<20160413225234.GA21602@glandium.org>
Mike Hommey <mh@glandium.org> writes:
Show 9 quoted lines
> On Wed, Apr 13, 2016 at 03:42:44PM -0700, Junio C Hamano wrote:
>> Mike Hommey <mh@glandium.org> writes:
>> 
>> > Should git-rebase use full sha-1s under the hood to avoid these type of
>> > races?
>> 
>> It already should be doing so since Aug 2013, IIRC.
>
> I'm using 2.8.1. Would there have been a regression?

I guess you managed to get into a corner-case which isn't managed properly. With my git version 2.8.1.53.g7ee34ab, I just checked the normal use-case:

$ git rebase -i HEAD^^
The editor pops up with short sha1. I insert a "exec false" like this:
,----[ git-rebase-todo ]
| pick 0c722f9 foo
| exec false
| pick 6305d56 commited
`----
The execution goes on like this:
  Executing: false
  Execution failed: false
  You can fix the problem, and then run
  
          git rebase --continue
  
And I can check:

$ cat .git/rebase-merge/git-rebase-todo pick 6305d56f7218b6f04451bab3ff27adb80dd6dad4 commited ...

I suspect you did:

$ git rebase -i # editor pops up # switch to another terminal and fetch from elsewhere # close editor

Then only, git turns short sha1s into long ones, and does not have the information to resolve ambiguities.

We could save a map (short -> long) before poping the editor and use this map in priority when normalizing the todo-list to use long sha1s, but we currently don't.

But I'm tempted to say that you just went very, very unlucky, and it's not worth fixing ...

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Mike HommeyNext: Mike Hommey
Message 4 of 8 in “Ambiguous sha-1 during a rebase”
  1. Mike HommeyApr 13, 2016
  2. Junio C HamanoApr 13, 2016
  3. Mike HommeyApr 13, 2016
  4. Matthieu MoyApr 14, 2016
  5. Mike HommeyApr 14, 2016
  6. Matthieu MoyApr 14, 2016
  7. Remi Galan AlfonsoApr 14, 2016
  8. Johannes SchindelinApr 14, 2016

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.