[RFC/PATCH 18/18] git-merge-octopus.sh: support --index-only option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
---
 git-merge-octopus.sh        | 14 +++++++++++---
 t/t6043-merge-index-only.sh |  4 ++--
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/git-merge-octopus.sh b/git-merge-octopus.sh
index a1d7702..e7915dc 100755
--- a/git-merge-octopus.sh
+++ b/git-merge-octopus.sh
@@ -13,6 +13,14 @@ die () {
     exit 1
 }
 
+read_tree_update="-u"
+index_only=
+if test "$1" = "--index-only"; then
+	read_tree_update="-i"
+	index_only="--index-only"
+	shift
+fi
+
 # The first parameters up to -- are merge bases; the rest are heads.
 bases= head= remotes= sep_seen=
 for arg
@@ -89,7 +97,7 @@ do
 		# We still need to count this as part of the parent set.
 
 		echo "Fast-forwarding to: $pretty_name"
-		git read-tree -u -m $head $SHA1 || exit
+		git read-tree $read_tree_update -m $head $SHA1 || exit
 		MRC=$SHA1 MRT=$(git write-tree)
 		continue
 	fi
@@ -97,12 +105,12 @@ do
 	NON_FF_MERGE=1
 
 	echo "Trying simple merge with $pretty_name"
-	git read-tree -u -m --aggressive  $common $MRT $SHA1 || exit 2
+	git read-tree $read_tree_update -m --aggressive  $common $MRT $SHA1 || exit 2
 	next=$(git write-tree 2>/dev/null)
 	if test $? -ne 0
 	then
 		echo "Simple merge did not work, trying automatic merge."
-		git-merge-index -o git-merge-one-file -a ||
+		git-merge-index -o git-merge-one-file $index_only -a ||
 		OCTOPUS_FAILURE=1
 		next=$(git write-tree 2>/dev/null)
 	fi
diff --git a/t/t6043-merge-index-only.sh b/t/t6043-merge-index-only.sh
index c0a553b..080e03d 100755
--- a/t/t6043-merge-index-only.sh
+++ b/t/t6043-merge-index-only.sh
@@ -333,7 +333,7 @@ test_expect_success '--index-only w/ resolve, non-trivial, bare' '
 	)
 '
 
-test_expect_failure '--index-only octopus, non-bare' '
+test_expect_success '--index-only octopus, non-bare' '
 	git reset --hard &&
 	git checkout B^0 &&
 
@@ -351,7 +351,7 @@ test_expect_failure '--index-only octopus, non-bare' '
 	test ! -f d
 '
 
-test_expect_failure '--index-only octopus, bare' '
+test_expect_success '--index-only octopus, bare' '
 	rm -rf bare.clone &&
 	git clone --bare . bare.clone &&
 	(cd bare.clone &&
-- 
2.8.0.18.gc685494

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]