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

Re: resolve (merge) problems

From
Junio C Hamano <junkio@cox.net>
Date
Dec 2, 2005, 00:58 UTC
Message-ID
<7vhd9sb9ie.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051202000715.8100.qmail@web31810.mail.mud.yahoo.com>
Luben Tuikov <ltuikov@yahoo.com> writes:
Show 14 quoted lines
> --- Junio C Hamano <junkio@cox.net> wrote:
>> Easier to read is:
>> 
>> 	$ git-diff-files --name-status
>
> Ok this is what it shows:
>
> $git-diff-files --name-status
> U       arch/arm/configs/poodle_defconfig
> D       arch/arm/configs/poodle_defconfig
> U       drivers/atm/atmdev_init.c
> D       drivers/atm/atmdev_init.c
>
> Unmerged and deleted?  Is this correct?

Yes, the first lets you notice it is unmerged, and the second says the file does not remain in the working tree.

However, there is a bug recently introduced in the merge-one-file script.

Although the conflict resolution procedure I described applies if you really had a real conflicting merge, I suspect your merge should not have failed in the first place.

        case "${1:-.}${2:-.}${3:-.}" in
        #
        # Deleted in both or deleted in one and unchanged in the other
        #
        "$1.." | "$1.$1" | "$1$1.")
                if [ "$2" ]; then
                        echo "Removing $4"
                fi
                if test -f "$4"; then
                        rm -f -- "$4" &&
                        rmdir -p "$(expr "$4" : '\(.*\)/')" 2>/dev/null
                fi &&
                        exec git-update-index --remove -- "$4"
                ;;

The faliure code from "rmdir -p" leaks up and makes git-update-index to be skipped. Here is a fix.

-- >8 -- [PATCH] merge-one-file fix

9ae2172aed289f2706a0e88288909fa47eddd7e7 used "rmdir -p" carelessly, causing the "git-update-index --remove" to be skipped.

---
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index 739a072..9a049f4 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -26,7 +26,7 @@ case "${1:-.}${2:-.}${3:-.}" in
 	fi
 	if test -f "$4"; then
 		rm -f -- "$4" &&
-		rmdir -p "$(expr "$4" : '\(.*\)/')" 2>/dev/null
+		rmdir -p "$(expr "$4" : '\(.*\)/')" 2>/dev/null || :
 	fi &&
 		exec git-update-index --remove -- "$4"
 	;;
Previous: Luben TuikovNext: Luben Tuikov
Message 4 of 11 in “resolve (merge) problems”
  1. Luben TuikovDec 1, 2005
  2. Junio C HamanoDec 1, 2005
  3. Luben TuikovDec 2, 2005
  4. Junio C HamanoDec 2, 2005
  5. Luben TuikovDec 2, 2005
  6. Junio C HamanoDec 2, 2005
  7. Luben TuikovDec 2, 2005
  8. Junio C HamanoDec 2, 2005
  9. Luben TuikovDec 2, 2005
  10. Linus TorvaldsDec 2, 2005
  11. Luben TuikovDec 2, 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.