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

[PATCH v4 04/15] t6111: allow checking the parents as well

From
Kevin Bracey <kevin@bracey.fi>
Date
May 16, 2013, 15:32 UTC
Message-ID
<1368718361-27859-5-git-send-email-kevin@bracey.fi>
In-Reply-To
<1368718361-27859-1-git-send-email-kevin@bracey.fi>
From: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t6111-rev-list-treesame.sh | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/t/t6111-rev-list-treesame.sh b/t/t6111-rev-list-treesame.sh
index b2bca77..1e4a550 100755
--- a/t/t6111-rev-list-treesame.sh
+++ b/t/t6111-rev-list-treesame.sh
@@ -20,7 +20,7 @@ note () {
 }
 
 unnote () {
-	git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g"
+	git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\))\([ 	]\)|\1\2|g"
 }
 
 test_expect_success setup '
@@ -66,23 +66,34 @@ test_expect_success setup '
 	test_commit M file "Parts 1+2"
 '
 
-FMT='tformat:%P 	%H | %s'
-
 # could we soup this up to optionally check parents? So "(BA)C" would check
 # that C is shown and has parents B A.
 check_outcome () {
 	outcome=$1
 	shift
-	for c in $1
-	do
-		echo "$c"
-	done >expect &&
-	shift &&
+
+	case "$1" in
+	*"("*)
+		FMT="%P	%H | %s"
+		munge_actual="
+			s/^\([^	]*\)	\([^ ]*\) .*/(\1)\2/
+			s/ //g
+			s/()//
+		"
+		;;
+	*)
+		FMT="%H | %s"
+		munge_actual="s/^\([^ ]*\) .*/\1/"
+		;;
+	esac &&
+	printf "%s\n" $1 >expect &&
+	shift
+
 	param="$*" &&
 	test_expect_$outcome "log $param" '
 		git log --format="$FMT" $param |
 		unnote >actual &&
-		sed -e "s/^.*	\([^ ]*\) .*/\1/" >check <actual &&
+		sed -e "$munge_actual" <actual >check &&
 		test_cmp expect check || {
 			cat actual
 			false
@@ -99,6 +110,7 @@ check_result () {
 # shown in normal full-history, as we can't distinguish unless we do a
 # simplification pass. After simplification, D is dropped but G remains.
 check_result 'M L K J I H G F E D C B A'
+check_result '(LH)M (K)L (GJ)K (I)J (G)I (G)H (FE)G (D)F (B)E (BC)D (A)C (A)B A'
 check_result 'M H L K J I G E F D C B A' --topo-order
 check_result 'M L H B A' -- file
 check_result 'M L H B A' --parents -- file
-- 
1.8.3.rc0.28.g4b02ef5
Previous: Kevin BraceyNext: Kevin Bracey
Message 5 of 16 in “History traversal refinements”
  1. 00/15 History traversal refinementsKevin Bracey, May 16, 2013
  2. 01/15 decorate.c: compact table when growingKevin Bracey, May 16, 2013
  3. 02/15 t6019: test file dropped in -s ours mergeKevin Bracey, May 16, 2013
  4. 03/15 t6111: new TREESAME test setKevin Bracey, May 16, 2013
  5. 04/15 t6111: allow checking the parents as wellKevin Bracey, May 16, 2013
  6. 05/15 t6111: add parents to testsKevin Bracey, May 16, 2013
  7. 06/15 rev-list-options.txt: correct TREESAME for PKevin Bracey, May 16, 2013
  8. 07/15 Documentation: avoid "uninteresting"Kevin Bracey, May 16, 2013
  9. 08/15 revision.c: Make --full-history consider more mergesKevin Bracey, May 16, 2013
  10. 09/15 t6012: update test for tweaked full-history traversalKevin Bracey, May 16, 2013
  11. 10/15 simplify-merges: never remove all TREESAME parentsKevin Bracey, May 16, 2013
  12. 11/15 simplify-merges: drop merge from irrelevant side branchKevin Bracey, May 16, 2013
  13. 12/15 revision.c: add BOTTOM flag for commitsKevin Bracey, May 16, 2013
  14. 13/15 revision.c: discount side branches when computing TREESAMEKevin Bracey, May 16, 2013
  15. 14/15 revision.c: don't show all merges for --parentsKevin Bracey, May 16, 2013
  16. 15/15 revision.c: make default history consider bottom commitsKevin Bracey, May 16, 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.