Re: [PATCH 1/4 v2] Allow detached form (e.g. "-S foo" instead of "-Sfoo") for diff options

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

 



Matthieu Moy wrote:

>  5 files changed, 90 insertions(+), 16 deletions(-)
>  create mode 100644 t/t4013/diff.log_-S_F_master

Well, I like it, though I’m obviously biased.

> --- /dev/null
> +++ b/t/t4013/diff.log_-S_F_master
> @@ -0,0 +1,7 @@
> +$ git log -S F master
> +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0

Note to self: a nice mini-series might be to blur these out.

> +++ b/t/t4202-log.sh
> @@ -101,11 +101,16 @@ test_expect_success 'oneline' '
>  test_expect_success 'diff-filter=A' '
>  
>  	actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) &&
> +	actual_detached=$(git log --pretty="format:%s" --diff-filter A HEAD) &&
>  	expect=$(echo fifth ; echo fourth ; echo third ; echo initial) &&
>  	test "$actual" = "$expect" || {
>  		echo Oops
>  		echo "Actual: $actual"
>  		false
> +	} &&
> +	test "$actual" = "$actual_detached" || {
> +		echo Oops. Detached form broken
> +		echo "Actual_detached: $actual_detached"
>  	}

You left out the crucial "false"! :)

Below is an add-on patch to use a more readable style.  With
or without that change:

Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>

Thanks.

diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 3352935..36870c5 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -100,18 +100,11 @@ test_expect_success 'oneline' '
 
 test_expect_success 'diff-filter=A' '
 
-	actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) &&
-	actual_detached=$(git log --pretty="format:%s" --diff-filter A HEAD) &&
-	expect=$(echo fifth ; echo fourth ; echo third ; echo initial) &&
-	test "$actual" = "$expect" || {
-		echo Oops
-		echo "Actual: $actual"
-		false
-	} &&
-	test "$actual" = "$actual_detached" || {
-		echo Oops. Detached form broken
-		echo "Actual_detached: $actual_detached"
-	}
+	git log --pretty="format:%s" --diff-filter=A HEAD > actual &&
+	git log --pretty="format:%s" --diff-filter A HEAD > actual-detached &&
+	printf "fifth\nfourth\nthird\ninitial" > expect &&
+	test_cmp expect actual &&
+	test_cmp expect actual-detached
 
 '
 
-- 
--
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]