[PATCH v8 7/7] bisect: support --update-ref <ref>

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

 



Adds sugar to allow --update-ref=<ref> to be expressed as
--update-ref <ref> instead.

Suggested-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
Signed-off-by: Jon Seymour <jon.seymour@xxxxxxxxx>
---
 git-bisect.sh               |   13 +++++++++++--
 t/t6030-bisect-porcelain.sh |   16 ++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 24ac859..ec70cd2 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -79,8 +79,17 @@ bisect_start() {
 		shift; break ;;
 	    --no-checkout)
 		BISECT_UPDATE_REF=HEAD; shift ;;
-	    --update-ref=*)
-		BISECT_UPDATE_REF=${arg#--update-ref=}; shift ;;
+	    --update-ref*)
+		case "$#,$arg" in
+		*,*=*)
+			BISECT_UPDATE_REF=`expr "z$1" : 'z-[^=]*=\(.*\)'`
+		;;
+		1,*)
+			usage ;;
+		*)
+			BISECT_UPDATE_REF="$2";	shift ;;
+		esac
+		shift ;;
 	    --*)
 		die "$(eval_gettext "unrecognised option: '\$arg'")" ;;
 	    *)
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 69d77fa..fa4366f 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -705,6 +705,22 @@ test_expect_success 'bisect: --no-checkout --update-ref=CURSOR - check HEAD is u
 	check_same broken $BROKEN
 '
 
+test_expect_success 'bisect: --no-checkout --update-ref CURSOR' '
+	git bisect reset &&
+	git checkout broken &&
+	BROKEN=$(git rev-parse broken) &&
+	git bisect start broken BROKEN_HASH4 --no-checkout --update-ref CURSOR &&
+	check_same CURSOR BROKEN_HASH6 &&
+	test "refs/heads/broken" = "$(git rev-parse --symbolic-full-name HEAD)"
+'
+
+test_expect_success 'bisect: --no-checkout --update-ref -> fails' '
+	git bisect reset &&
+	git checkout broken &&
+	BROKEN=$(git rev-parse broken) &&
+	test_must_fail git bisect start broken BROKEN_HASH4 --no-checkout --update-ref
+'
+
 test_expect_success 'bisect: demonstrate identification of damage boundary' "
 	git bisect reset &&
 	git checkout broken &&
-- 
1.7.6.391.g168d0.dirty

--
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]