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

Re: Expected Behavior?

From
Petr Baudis <pasky@suse.cz>
Date
Nov 8, 2005, 09:56 UTC
Message-ID
<20051108095600.GA1431@pasky.or.cz>
In-Reply-To
<7vwtjjllw4.fsf@assigned-by-dhcp.cox.net>

Dear diary, on Tue, Nov 08, 2005 at 07:00:11AM CET, I got a letter where Junio C Hamano <junkio@cox.net> told me that...

Show 10 quoted lines
> Nobody complained so far about this, probably because two side
> adding different versions is rare enough.  And the reasoning
> behind the current behaviour is probably because the tool cannot
> automerge them sensibly anyway.  Leaving the SHA1 in index file
> might probably be easier to clean up by hand (e.g. see ls-files
> --unmerged, and cut&paste the desired SHA1 to 'git-cat-file
> blob' command line, or something silly like that).  But if we
> were to go that route, adding --stage=[123] flag so that the
> user can say 'git-checkout-index --stage=3 file3'might have
> helped a bit more.
#
# Added in both (different in each).
#
".$id1$id2")
        #echo "Adding $file"
        filev="$file"
        while [ -e "$filev~1" ] || [ -e "$filev~2" ]; do
                filev="$filev~"
        done
        error "File $file added in both branches, but different in each!"
        error "Conflicting versions saved as '$filev~1' and '$filev~2'."
        git-update-index --add --cacheinfo "$mode1" "$id1" "$file" &&
                git-checkout-index -u -f -- "$file" &&
                mv "$file" "$filev~1" ||
                error "Cannot create '$filev~1'"
        git-update-index --add --cacheinfo "$mode2" "$id2" "$file" &&
                git-checkout-index -u -f -- "$file" &&
                mv "$file" "$filev~2" ||
                error "Cannot create '$filev~2'"
        exit 1
        ;;

is what Cogito's automerger does. It ain't very pretty, but it works. :-) (At least it seems to.) I yet need to add some conflicts tracking to Cogito to prevent accidental checking in of conflicts.

Show 8 quoted lines
> We could instead use the attached patch to get the behaviour you
> are expecting.  I have a feeling that the result from this might
> be a little more intuitive and easier to resolve by hand than
> the current one.  Although we may end up unresolvable mess in
> file3 if either side is binary, in that case the user can still
> sift through 'diff-tree A B file3' output to find out the
> relevant SHA1 to recover the blobs from both sides by hand
> anyway.  Does anybody have strong opinion on this?
I think having
	<<<<<
	file1
	=====
	file2
	>>>>>

is an awful PITA to resolve, especially when the files actually are similar. Running some vimdiff (or just diff and possibly applying either way) on two separate files is much more convenient.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 28 in “Re: Expected Behavior?”
  1. Jon LoeligerNov 8, 2005
  2. Junio C HamanoNov 8, 2005
  3. Petr BaudisNov 8, 2005
  4. merge-one-file: use common as base, instead of emptiness.Junio C Hamano, Nov 10, 2005
  5. Petr BaudisNov 10, 2005
  6. Junio C HamanoNov 10, 2005
  7. Petr BaudisNov 10, 2005
  8. Fredrik KuivinenNov 8, 2005
  9. Junio C HamanoNov 8, 2005
  10. Fredrik KuivinenNov 8, 2005
  11. Junio C HamanoNov 9, 2005
  12. Fredrik KuivinenNov 9, 2005
  13. merge-recursive: Fix support for branch names containing slashesFredrik Kuivinen, Nov 9, 2005
  14. Petr BaudisNov 10, 2005
  15. Junio C HamanoNov 10, 2005
  16. Petr BaudisNov 10, 2005
  17. Petr BaudisNov 9, 2005
  18. Martin LanghoffNov 9, 2005
  19. Petr BaudisNov 9, 2005
  20. Martin LanghoffNov 9, 2005
  21. Petr BaudisNov 9, 2005
  22. Martin LanghoffNov 10, 2005
  23. Petr BaudisNov 10, 2005
  24. Martin LanghoffNov 10, 2005
  25. Petr BaudisNov 10, 2005
  26. Junio C HamanoNov 9, 2005
  27. Petr BaudisNov 9, 2005
  28. Junio C HamanoNov 10, 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.