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

Re: [PATCH 6/6] am --abort: keep unrelated commits on unborn branch

From
Paul Tan <pyokagan@gmail.com>
Date
Jun 9, 2015, 08:54 UTC
Message-ID
<CACRoPnT4CcJxQtTCzbOVRhHmN4MvzBx1S6x53CRuwFF9e+N4SQ@mail.gmail.com>
In-Reply-To
<xmqq4mmi9cwb.fsf@gitster.dls.corp.google.com>
On Tue, Jun 9, 2015 at 4:13 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Paul Tan <pyokagan@gmail.com> writes:
>
>> Since 7b3b7e3 (am --abort: keep unrelated commits since the last failure
>> and warn, 2010-12-21), git-am would refuse to rewind HEAD if commits
>> were made since the last git-am failure. This check was implemented in
>> safe_to_abort(), which checked to see if HEAD's hash matched the
>> abort-safety file.
>>
>> However, this check was skipped if the abort-safety file was empty,
>> which can happen if git-am failed while on an unborn branch.
>
> Shouldn't we then be checking that the HEAD is still unborn if this
> file is found and says that there was no history in the beginning,
> in order to give the "am on top of unborn" workflow the same degree
> of safety?
We do already check to see if the HEAD is still unborn:
        abort_safety=$(cat "$dotest/abort-safety")
        if test "z$(git rev-parse --verify -q HEAD)" = "z$abort_safety"
        then
            return 0
        fi
        gettextln "You seem to have moved HEAD since the last 'am' failure.
    Not rewinding to ORIG_HEAD" >&2

If HEAD is unborn, then git rev-parse will not print anything, so we would be comparing an empty string to an empty string.

Thanks, Paul

Previous: Junio C HamanoNext: Stefan Beller
Message 12 of 13 in “am --skip/--abort: improve index/worktree cleanup”
  1. 0/6 am --skip/--abort: improve index/worktree cleanupPaul Tan, Jun 6, 2015
  2. 1/6 am --skip: revert changes introduced by failed 3way mergePaul Tan, Jun 6, 2015
  3. 2/6 am -3: support 3way merge on unborn branchPaul Tan, Jun 6, 2015
  4. 3/6 am --skip: support skipping while on unborn branchPaul Tan, Jun 6, 2015
  5. 4/6 am --abort: revert changes introduced by failed 3way mergePaul Tan, Jun 6, 2015
  6. Junio C HamanoJun 8, 2015
  7. 5/6 am --abort: support aborting to unborn branchPaul Tan, Jun 6, 2015
  8. Junio C HamanoJun 8, 2015
  9. Paul TanJun 9, 2015
  10. 6/6 am --abort: keep unrelated commits on unborn branchPaul Tan, Jun 6, 2015
  11. Junio C HamanoJun 8, 2015
  12. Paul TanJun 9, 2015
  13. Stefan BellerJun 8, 2015

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.