git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 29, 2010, 02:00 UTC
Message-ID
<20100729020031.GI29156@dert.cs.uchicago.edu>
In-Reply-To
<1280310062-16793-1-git-send-email-Matthieu.Moy@imag.fr>
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.
Show 5 quoted lines
> --- /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.
Show 16 quoted lines
> +++ 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@gmail.com>
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
 
 '
 
Previous: Matthieu MoyNext: Matthieu Moy
Message 6 of 24 in “Allow detached forms (--option arg) for git log and friends”
  1. 0/4 Allow detached forms (--option arg) for git log and friendsMatthieu Moy, Jul 27, 2010
  2. 1/4 Allow detached form (e.g. "-S foo" instead of "-Sfoo") for diff optionsMatthieu Moy, Jul 27, 2010
  3. Jonathan NiederJul 27, 2010
  4. Matthieu MoyJul 28, 2010
  5. 1/4 Allow detached form (e.g. "-S foo" instead of "-Sfoo") for diff optionsMatthieu Moy, Jul 28, 2010
  6. Jonathan NiederJul 29, 2010
  7. Matthieu MoyJul 29, 2010
  8. Junio C HamanoJul 29, 2010
  9. 2/4 Allow detached form for git diff --stat-name-width and --stat-width.Matthieu Moy, Jul 28, 2010
  10. Jonathan NiederJul 29, 2010
  11. 1/2 diff: split off a function for --stat-* option parsingJonathan Nieder, Jul 29, 2010
  12. 2/2 diff: allow --stat-width n, --stat-name-width nJonathan Nieder, Jul 29, 2010
  13. 3/4 Allow detached form (e.g. "git log --grep foo") in log options.Matthieu Moy, Jul 28, 2010
  14. Ævar Arnfjörð BjarmasonJul 28, 2010
  15. Matthieu MoyJul 28, 2010
  16. Ævar Arnfjörð BjarmasonJul 28, 2010
  17. Matthieu MoyJul 28, 2010
  18. Ævar Arnfjörð BjarmasonJul 28, 2010
  19. Jonathan NiederJul 29, 2010
  20. 4/4 Allow detached form for --glob, --branches, --tags and --remote.Matthieu Moy, Jul 28, 2010
  21. Jonathan NiederJul 29, 2010
  22. 2/4 Allow detached form for git diff --stat-name-width and --stat-width.Matthieu Moy, Jul 27, 2010
  23. 3/4 Allow detached form (e.g. "git log --grep foo") in log options.Matthieu Moy, Jul 27, 2010
  24. 4/4 Allow detached form for --glob, --branches, --tags and --remote.Matthieu Moy, Jul 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.