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

Re: [PATCH] Automerge fix

From
Junio C Hamano <junkio@cox.net>
Date
Apr 19, 2005, 05:26 UTC
Message-ID
<7voecbqqv3.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0504181945400.15725@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> What's the right way?
LT> Maybe

LT> if merge "$src2" "$orig" "$src1" LT> then LT> cp "$src2" "$4" && update-cache --add -- "$4" && exit 0 LT> fi LT> echo Leaving conflict merge in $src2 LT> exit 1

LT> would work?
Wouldn't this be more readable, short and sweet?
    merge "$src2" "$orig" "$src1" || {
        echo Leaving conflict merge in $src2 && exit 1
    }
    cp "$src2" "$4" && exec update-cache --add -- "$4"

You did not want subshell so I just changed the () pair to the {} pair, and while I was at it I folded the "&& exit 0" into the last command before it, which should be better. You'd want to know if update-cache --add failed for whatever reason.

Previous: Petr Baudis
Message 4 of 4 in “Automerge fix”
  1. Automerge fixPetr Baudis, Apr 19, 2005
  2. Linus TorvaldsApr 19, 2005
  3. Petr BaudisApr 19, 2005
  4. Junio C HamanoApr 19, 2005

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.