Re: resolve (merge) problems

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: resolve (merge) problems

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:14

Luben Tuikov [off-list ref] writes:
quoted hunk
--- Junio C Hamano <junkio@cox.net> wrote:
quoted
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"
 	;;

Re: resolve (merge) problems

From: Luben Tuikov <hidden>
Date: 2016-06-15 22:42:14

--- Junio C Hamano <junkio@cox.net> wrote:
However, there is a bug recently introduced in the
merge-one-file script.  
Ok, if your patch below resolves the bug (please see my
other email just posted) please submit it.  (I'm hitting
this bug everytime there's a file deleted from the
kernel tree and I try to merge.)

Thanks,
   Luben

quoted hunk
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"
 	;;



-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help