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

[PATCH] t4038: add tests for "diff --cc --raw <trees>"

From
John Keeping <john@keeping.me.uk>
Date
Feb 5, 2013, 20:25 UTC
Message-ID
<20130205202558.GX1342@serenity.lan>
In-Reply-To
<7vip696i3v.fsf@alter.siamese.dyndns.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
---
On Sun, Feb 03, 2013 at 04:24:52PM -0800, Junio C Hamano wrote:
Show 5 quoted lines
>                             Ideally it should also have test cases
> to show "git diff --cc --raw blob1 blob2...blob$n" for n=4 and n=40
> (or any two values clearly below and above the old hardcoded limit)
> behave sensibly, exposing the old breakage, which I'll leave as a
> LHF (low-hanging-fruit).  Hint, hint...
Hint taken ;-)

git-diff uses a different code path for blobs, so I've had to use trees to trigger this. The last test fails without jc/combine-diff-many-parents and passes with it.

 t/t4038-diff-combined.sh | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
index 40277c7..a0701bc 100755
--- a/t/t4038-diff-combined.sh
+++ b/t/t4038-diff-combined.sh
@@ -89,4 +89,33 @@ test_expect_success 'diagnose truncated file' '
 	grep "diff --cc file" out
 '
 
+test_expect_success 'setup for --cc --raw' '
+	blob=$(echo file |git hash-object --stdin -w) &&
+	base_tree=$(echo "100644 blob $blob	file" | git mktree) &&
+	trees= &&
+	for i in `test_seq 1 40`
+	do
+		blob=$(echo file$i |git hash-object --stdin -w) &&
+		trees="$trees $(echo "100644 blob $blob	file" |git mktree)"
+	done
+'
+
+test_expect_success 'check --cc --raw with four trees' '
+	four_trees=$(echo "$trees" |awk -e "{
+		print \$1
+		print \$2
+		print \$3
+		print \$4
+	}") &&
+	git diff --cc --raw $four_trees $base_tree >out &&
+	# Check for four leading colons in the output:
+	grep "^::::[^:]" out
+'
+
+test_expect_success 'check --cc --raw with forty trees' '
+	git diff --cc --raw $trees $base_tree >out &&
+	# Check for forty leading colons in the output:
+	grep "^::::::::::::::::::::::::::::::::::::::::[^:]" out
+'
+
 test_done
-- 
1.8.1.2
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 20 in “Make Git compile warning-free with Clang”
  1. 0/3 Make Git compile warning-free with ClangJohn Keeping, Feb 3, 2013
  2. 1/3 fix clang -Wtautological-compare with unsigned enumJohn Keeping, Feb 3, 2013
  3. Jonathan NiederFeb 3, 2013
  4. 2/3 combine-diff: suppress a clang warningJohn Keeping, Feb 3, 2013
  5. Tay Ray ChuanFeb 3, 2013
  6. John KeepingFeb 3, 2013
  7. Junio C HamanoFeb 3, 2013
  8. John KeepingFeb 3, 2013
  9. Junio C HamanoFeb 3, 2013
  10. John KeepingFeb 3, 2013
  11. Junio C HamanoFeb 4, 2013
  12. t4038: add tests for "diff --cc --raw <trees>"John Keeping, Feb 5, 2013
  13. Junio C HamanoFeb 5, 2013
  14. t4038: add tests for "diff --cc --raw <trees>"John Keeping, Feb 5, 2013
  15. Junio C HamanoFeb 5, 2013
  16. Miles BaderFeb 7, 2013
  17. John KeepingFeb 7, 2013
  18. 3/3 builtin/apply: tighten (dis)similarity index parsingJohn Keeping, Feb 3, 2013
  19. Junio C HamanoFeb 3, 2013
  20. Antoine PelisseFeb 3, 2013

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.