Signed-off-by: Elijah Newren <new...@gmail.com>
---
 git-merge-resolve.sh        | 12 ++++++++++--
 t/t6043-merge-index-only.sh |  4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/git-merge-resolve.sh b/git-merge-resolve.sh
index c9da747..ed4a25b 100755
--- a/git-merge-resolve.sh
+++ b/git-merge-resolve.sh
@@ -5,6 +5,14 @@
 #
 # Resolve two trees, using enhanced multi-base read-tree.
 
+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
@@ -38,14 +46,14 @@ then
 fi
 
 git update-index -q --refresh
-git read-tree -u -m --aggressive $bases $head $remotes || exit 2
+git read-tree $read_tree_update -m --aggressive $bases $head $remotes || exit 2
 echo "Trying simple merge."
 if result_tree=$(git write-tree 2>/dev/null)
 then
        exit 0
 else
        echo "Simple merge failed, trying Automatic merge."
-       if git-merge-index -o git-merge-one-file -a
+       if git-merge-index -o git-merge-one-file $index_only -a
        then
                exit 0
        else
diff --git a/t/t6043-merge-index-only.sh b/t/t6043-merge-index-only.sh
index cb860f2..c0a553b 100755
--- a/t/t6043-merge-index-only.sh
+++ b/t/t6043-merge-index-only.sh
@@ -299,7 +299,7 @@ test_expect_failure '--index-only w/ resolve, trivial, 
bare' '
        )
 '
 
-test_expect_failure '--index-only w/ resolve, non-trivial, non-bare' '
+test_expect_success '--index-only w/ resolve, non-trivial, non-bare' '
        git reset --hard &&
        git checkout B^0 &&
 
@@ -314,7 +314,7 @@ test_expect_failure '--index-only w/ resolve, non-trivial, 
non-bare' '
        test ! -f d
 '
 
-test_expect_failure '--index-only w/ resolve, non-trivial, bare' '
+test_expect_success '--index-only w/ resolve, non-trivial, 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to