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

Re: [PATCH] Automerge fix

From
Petr Baudis <pasky@ucw.cz>
Date
Apr 19, 2005, 02:57 UTC
Message-ID
<20050419025726.GA5554@pasky.ji.cz>
In-Reply-To
<Pine.LNX.4.58.0504181945400.15725@ppc970.osdl.org>

Dear diary, on Tue, Apr 19, 2005 at 04:48:09AM CEST, I got a letter where Linus Torvalds <torvalds@osdl.org> told me that...

Show 23 quoted lines
> > git-merge-one-file-script: 7ebf5dac4c69043cd2ff89bf7ee552152802f8d1
> > --- a/git-merge-one-file-script
> > +++ b/git-merge-one-file-script
> > @@ -43,7 +43,7 @@ case "${1:-.}${2:-.}${3:-.}" in
> >  	orig=$(unpack-file $1)
> >  	src1=$(unpack-file $2)
> >  	src2=$(unpack-file $3)
> > -	merge "$src2" "$orig" "$src1" || echo Leaving conflict merge in $src2 && exit 1
> > +	merge "$src2" "$orig" "$src1" || (echo Leaving conflict merge in $src2 && exit 1)
> >  	cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
> 
> What's the right way?
> 
> Maybe
> 
> 	if merge "$src2" "$orig" "$src1"
> 	then 
> 		cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
> 	fi
> 	echo Leaving conflict merge in $src2
> 	exit 1
> 
> would work?
Possibly. Or changing () to {} as suggested by Edgar Toernig.
FWIW, my fragment of this code now looks like:
        ret=0
        if ! merge "$src2" "$orig" "$src1"; then
                echo Conflicting merge!
                cat "$src2" >"$4"
                ret=1
        elif ! cat "$src2" >"$4" && update-cache --add -- "$4"; then
                echo "Choosing $src2 -> $4 failed"
                ret=1
        fi
        rm "$orig" "$src1" "$src2"
        exit $ret
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Previous: Linus TorvaldsNext: Junio C Hamano
Message 3 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.