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

[PATCH 3/3] t4047: whitespace in diff.dirstat and --dirstat

From
DSDragan Simic <dsimic@manjaro.org>
Date
Apr 2, 2024, 00:13 UTC
Message-ID
<09d6260ffb717dd85ce6f041402ed9a5e1cfe039.1712016667.git.dsimic@manjaro.org>
In-Reply-To
<cover.1712016667.git.dsimic@manjaro.org>

Add a few more tests to cover the support for optional placing of additional whitespace characters around the commas in the multi-value, comma-separated values for the "diff.dirstat" configuration option and the "--dirstat" command-line option.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
---
 t/t4047-diff-dirstat.sh | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh
index 7b73462d53d2..715b3579539e 100755
--- a/t/t4047-diff-dirstat.sh
+++ b/t/t4047-diff-dirstat.sh
@@ -707,24 +707,42 @@ test_expect_success '--dirstat-by-file --cumulative' '
 	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
 '
 
-test_expect_success '--dirstat=files,cumulative' '
+test_expect_success '--dirstat=files,cumulative with no spaces' '
 	git diff --dirstat=files,cumulative HEAD^..HEAD >actual_diff_dirstat &&
 	test_cmp expect_diff_dirstat actual_diff_dirstat &&
 	git diff --dirstat=files,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M &&
 	test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
 	git diff --dirstat=files,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
 	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
 '
 
-test_expect_success 'diff.dirstat=cumulative,files' '
+test_expect_success '--dirstat=files,cumulative with spaces' '
+	git diff --dirstat="files, cumulative" HEAD^..HEAD >actual_diff_dirstat &&
+	test_cmp expect_diff_dirstat actual_diff_dirstat &&
+	git diff --dirstat="files , cumulative" -M HEAD^..HEAD >actual_diff_dirstat_M &&
+	test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+	git diff --dirstat=" files , cumulative " -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
+	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
+'
+
+test_expect_success 'diff.dirstat=cumulative,files with no spaces' '
 	git -c diff.dirstat=cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
 	test_cmp expect_diff_dirstat actual_diff_dirstat &&
 	git -c diff.dirstat=cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
 	test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
 	git -c diff.dirstat=cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
 	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
 '
 
+test_expect_success 'diff.dirstat=cumulative,files with spaces' '
+	git -c "diff.dirstat= cumulative,files " diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+	test_cmp expect_diff_dirstat actual_diff_dirstat &&
+	git -c "diff.dirstat= cumulative ,files" diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+	test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+	git -c "diff.dirstat= cumulative , files" diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
+	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
+'
+
 cat <<EOF >expect_diff_dirstat
   27.2% dst/copy/
   27.2% dst/move/
@@ -766,15 +784,24 @@ test_expect_success '--dirstat=files,cumulative,10' '
 	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
 '
 
-test_expect_success 'diff.dirstat=10,cumulative,files' '
+test_expect_success 'diff.dirstat=10,cumulative,files with no spaces' '
 	git -c diff.dirstat=10,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
 	test_cmp expect_diff_dirstat actual_diff_dirstat &&
 	git -c diff.dirstat=10,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
 	test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
 	git -c diff.dirstat=10,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
 	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
 '
 
+test_expect_success 'diff.dirstat=10,cumulative,files with spaces' '
+	git -c "diff.dirstat= 10,cumulative,files " diff --dirstat HEAD^..HEAD >actual_diff_dirstat &&
+	test_cmp expect_diff_dirstat actual_diff_dirstat &&
+	git -c "diff.dirstat=10, cumulative, files" diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M &&
+	test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
+	git -c "diff.dirstat=10 , cumulative , files" diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
+	test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC
+'
+
 cat <<EOF >expect_diff_dirstat
   27.2% dst/copy/
   27.2% dst/move/
Previous: Dragan SimicNext: Dragan Simic
Message 4 of 6 in “Make support for multi-value configuration options more consistent”
  1. 0/3 Make support for multi-value configuration options more consistentDragan Simic, Apr 2, 2024
  2. 2/3 t4015: whitespace in diff.wsErrorHighlight and --ws-error-highlightDragan Simic, Apr 2, 2024
  3. 1/3 diff: support additional whitespace in diff.{dirstat,wsErrorHighlight}Dragan Simic, Apr 2, 2024
  4. 3/3 t4047: whitespace in diff.dirstat and --dirstatDragan Simic, Apr 2, 2024
  5. Dragan SimicApr 2, 2024
  6. Dragan SimicApr 16, 2024

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.