git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/5] "log --author-date-order" follow-up
@ 2013-06-21 18:49 Junio C Hamano
  2013-06-21 18:49 ` [PATCH 1/5] t/lib-t6000: style fixes Junio C Hamano
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-21 18:49 UTC (permalink / raw
  To: git; +Cc: Elliott Cable, Jeff King

Complete the series to teach "--author-date-order" to the commands
in the log family by adding some tests.

We did not have explicit tests for --date-order, so the third patch
in this series adds one while at it.

Junio C Hamano (5):
  t/lib-t6000: style fixes
  topology tests: teach a helper to take abbreviated timestamps
  t6003: add --date-order test
  topology tests: teach a helper to set author dates as well
  t6003: add --author-date-order test

 t/lib-t6000.sh                 | 104 ++++++++++++++++++++++-------------------
 t/t6002-rev-list-bisect.sh     |  84 ++++++++++++++++-----------------
 t/t6003-rev-list-topo-order.sh | 101 +++++++++++++++++++++++++++------------
 3 files changed, 169 insertions(+), 120 deletions(-)

-- 
1.8.3.1-682-g924db96

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] t/lib-t6000: style fixes
  2013-06-21 18:49 [PATCH 0/5] "log --author-date-order" follow-up Junio C Hamano
@ 2013-06-21 18:49 ` Junio C Hamano
  2013-06-21 18:49 ` [PATCH 2/5] topology tests: teach a helper to take abbreviated timestamps Junio C Hamano
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-21 18:49 UTC (permalink / raw
  To: git; +Cc: Elliott Cable, Jeff King

Mostly fixes to initial indentation with 8-SP (they should be HT)
and wrapping long lines.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/lib-t6000.sh | 87 +++++++++++++++++++++++++++-------------------------------
 1 file changed, 40 insertions(+), 47 deletions(-)

diff --git a/t/lib-t6000.sh b/t/lib-t6000.sh
index ea25dd8..102d567 100644
--- a/t/lib-t6000.sh
+++ b/t/lib-t6000.sh
@@ -1,55 +1,50 @@
 : included from 6002 and others
 
-[ -d .git/refs/tags ] || mkdir -p .git/refs/tags
+mkdir -p .git/refs/tags
 
-:> sed.script
+>sed.script
 
-# Answer the sha1 has associated with the tag. The tag must exist in .git or .git/refs/tags
-tag()
-{
+# Answer the sha1 has associated with the tag. The tag must exist in .git/refs/tags
+tag () {
 	_tag=$1
-	[ -f .git/refs/tags/$_tag ] || error "tag: \"$_tag\" does not exist"
-	cat .git/refs/tags/$_tag
+	test -f ".git/refs/tags/$_tag" || error "tag: \"$_tag\" does not exist"
+	cat ".git/refs/tags/$_tag"
 }
 
 # Generate a commit using the text specified to make it unique and the tree
 # named by the tag specified.
-unique_commit()
-{
+unique_commit () {
 	_text=$1
-        _tree=$2
+	_tree=$2
 	shift 2
-	echo $_text | git commit-tree $(tag $_tree) "$@"
+	echo "$_text" | git commit-tree $(tag "$_tree") "$@"
 }
 
 # Save the output of a command into the tag specified. Prepend
 # a substitution script for the tag onto the front of sed.script
-save_tag()
-{
+save_tag () {
 	_tag=$1
-	[ -n "$_tag" ] || error "usage: save_tag tag commit-args ..."
+	test -n "$_tag" || error "usage: save_tag tag commit-args ..."
 	shift 1
-	"$@" >.git/refs/tags/$_tag
+	"$@" >".git/refs/tags/$_tag"
 
-        echo "s/$(tag $_tag)/$_tag/g" > sed.script.tmp
-	cat sed.script >> sed.script.tmp
+	echo "s/$(tag $_tag)/$_tag/g" >sed.script.tmp
+	cat sed.script >>sed.script.tmp
 	rm sed.script
 	mv sed.script.tmp sed.script
 }
 
 # Replace unhelpful sha1 hashses with their symbolic equivalents
-entag()
-{
+entag () {
 	sed -f sed.script
 }
 
 # Execute a command after first saving, then setting the GIT_AUTHOR_EMAIL
 # tag to a specified value. Restore the original value on return.
-as_author()
-{
+as_author () {
 	_author=$1
 	shift 1
-        _save=$GIT_AUTHOR_EMAIL
+	_save=$GIT_AUTHOR_EMAIL
 
 	GIT_AUTHOR_EMAIL="$_author"
 	export GIT_AUTHOR_EMAIL
@@ -63,45 +58,41 @@ as_author()
 	fi
 }
 
-commit_date()
-{
-        _commit=$1
-	git cat-file commit $_commit | sed -n "s/^committer .*> \([0-9]*\) .*/\1/p"
+commit_date () {
+	_commit=$1
+	git cat-file commit $_commit |
+	sed -n "s/^committer .*> \([0-9]*\) .*/\1/p"
 }
 
-on_committer_date()
-{
-    _date=$1
-    shift 1
-    GIT_COMMITTER_DATE="$_date"
-    export GIT_COMMITTER_DATE
-    "$@"
-    unset GIT_COMMITTER_DATE
+on_committer_date () {
+	_date=$1
+	shift 1
+	GIT_COMMITTER_DATE="$_date"
+	export GIT_COMMITTER_DATE
+	"$@"
+	unset GIT_COMMITTER_DATE
 }
 
 # Execute a command and suppress any error output.
-hide_error()
-{
+hide_error () {
 	"$@" 2>/dev/null
 }
 
-check_output()
-{
+check_output () {
 	_name=$1
 	shift 1
-	if eval "$*" | entag > $_name.actual
+	if eval "$*" | entag >"$_name.actual"
 	then
-		test_cmp $_name.expected $_name.actual
+		test_cmp "$_name.expected" "$_name.actual"
 	else
-		return 1;
+		return 1
 	fi
 }
 
 # Turn a reasonable test description into a reasonable test name.
 # All alphanums translated into -'s which are then compressed and stripped
 # from front and back.
-name_from_description()
-{
+name_from_description () {
 	perl -pe '
 		s/[^A-Za-z0-9.]/-/g;
 		s/-+/-/g;
@@ -119,9 +110,11 @@ name_from_description()
 test_output_expect_success()
 {
 	_description=$1
-        _test=$2
-        [ $# -eq 2 ] || error "usage: test_output_expect_success description test <<EOF ... EOF"
-        _name=$(echo $_description | name_from_description)
-	cat > $_name.expected
+	_test=$2
+	test $# -eq 2 ||
+	error "usage: test_output_expect_success description test <<EOF ... EOF"
+
+	_name=$(echo $_description | name_from_description)
+	cat >"$_name.expected"
 	test_expect_success "$_description" "check_output $_name \"$_test\""
 }
-- 
1.8.3.1-682-g924db96

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] topology tests: teach a helper to take abbreviated timestamps
  2013-06-21 18:49 [PATCH 0/5] "log --author-date-order" follow-up Junio C Hamano
  2013-06-21 18:49 ` [PATCH 1/5] t/lib-t6000: style fixes Junio C Hamano
@ 2013-06-21 18:49 ` Junio C Hamano
  2013-06-21 18:49 ` [PATCH 3/5] t6003: add --date-order test Junio C Hamano
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-21 18:49 UTC (permalink / raw
  To: git; +Cc: Elliott Cable, Jeff King

The on_committer_date helper in t/lib-t6000 is used in t6002 and
t6003 with timestamps on a single day within a single minute
(i.e. 1971-08-16 00:00) and the tests repeat this over and over.

The actual value of the timestamp, however, does not matter very
much; only their relative ordering does.

Introduce another helper to expand only the suffix of the timestamp
to a full timestamp to make the lines shorter, and use it in this
helper.  Also, because all the commits in the test are made with
specific GIT_COMMITTER_DATE, stop unsetting it at the end of the
helper.

We'll be specifying the author timestamp to these test commits in a
later patch, which will be helped with this change.

Also remove a test that was commented-out from t6003; it used to
test a commit with the same parent listed twice, which was allowed
by mistake but was fixed long time ago.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/lib-t6000.sh                 | 17 +++++++--
 t/t6002-rev-list-bisect.sh     | 84 +++++++++++++++++++++---------------------
 t/t6003-rev-list-topo-order.sh | 57 +++++++++++++---------------
 3 files changed, 81 insertions(+), 77 deletions(-)

diff --git a/t/lib-t6000.sh b/t/lib-t6000.sh
index 102d567..e2c3615 100644
--- a/t/lib-t6000.sh
+++ b/t/lib-t6000.sh
@@ -64,13 +64,22 @@ commit_date () {
 	sed -n "s/^committer .*> \([0-9]*\) .*/\1/p"
 }
 
+# Assign the value of fake date to a variable, but
+# allow fairly common "1971-08-16 00:00" to be omittd
+assign_fake_date () {
+	case "$2" in
+	??:??:??)	eval "$1='1971-08-16 $2'" ;;
+	??:??)		eval "$1='1971-08-16 00:$2'" ;;
+	??)		eval "$1='1971-08-16 00:00:$2'" ;;
+	*)		eval "$1='$2'" ;;
+	esac
+}
+
 on_committer_date () {
-	_date=$1
-	shift 1
-	GIT_COMMITTER_DATE="$_date"
+	assign_fake_date GIT_COMMITTER_DATE "$1"
 	export GIT_COMMITTER_DATE
+	shift 1
 	"$@"
-	unset GIT_COMMITTER_DATE
 }
 
 # Execute a command and suppress any error output.
diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
index fb07536..43ad772 100755
--- a/t/t6002-rev-list-bisect.sh
+++ b/t/t6002-rev-list-bisect.sh
@@ -39,25 +39,25 @@ test_bisection_diff()
 date >path0
 git update-index --add path0
 save_tag tree git write-tree
-on_committer_date "1971-08-16 00:00:00" hide_error save_tag root unique_commit root tree
-on_committer_date "1971-08-16 00:00:01" save_tag l0 unique_commit l0 tree -p root
-on_committer_date "1971-08-16 00:00:02" save_tag l1 unique_commit l1 tree -p l0
-on_committer_date "1971-08-16 00:00:03" save_tag l2 unique_commit l2 tree -p l1
-on_committer_date "1971-08-16 00:00:04" save_tag a0 unique_commit a0 tree -p l2
-on_committer_date "1971-08-16 00:00:05" save_tag a1 unique_commit a1 tree -p a0
-on_committer_date "1971-08-16 00:00:06" save_tag b1 unique_commit b1 tree -p a0
-on_committer_date "1971-08-16 00:00:07" save_tag c1 unique_commit c1 tree -p b1
-on_committer_date "1971-08-16 00:00:08" save_tag b2 unique_commit b2 tree -p b1
-on_committer_date "1971-08-16 00:00:09" save_tag b3 unique_commit b2 tree -p b2
-on_committer_date "1971-08-16 00:00:10" save_tag c2 unique_commit c2 tree -p c1 -p b2
-on_committer_date "1971-08-16 00:00:11" save_tag c3 unique_commit c3 tree -p c2
-on_committer_date "1971-08-16 00:00:12" save_tag a2 unique_commit a2 tree -p a1
-on_committer_date "1971-08-16 00:00:13" save_tag a3 unique_commit a3 tree -p a2
-on_committer_date "1971-08-16 00:00:14" save_tag b4 unique_commit b4 tree -p b3 -p a3
-on_committer_date "1971-08-16 00:00:15" save_tag a4 unique_commit a4 tree -p a3 -p b4 -p c3
-on_committer_date "1971-08-16 00:00:16" save_tag l3 unique_commit l3 tree -p a4
-on_committer_date "1971-08-16 00:00:17" save_tag l4 unique_commit l4 tree -p l3
-on_committer_date "1971-08-16 00:00:18" save_tag l5 unique_commit l5 tree -p l4
+on_committer_date "00:00" hide_error save_tag root unique_commit root tree
+on_committer_date "00:01" save_tag l0 unique_commit l0 tree -p root
+on_committer_date "00:02" save_tag l1 unique_commit l1 tree -p l0
+on_committer_date "00:03" save_tag l2 unique_commit l2 tree -p l1
+on_committer_date "00:04" save_tag a0 unique_commit a0 tree -p l2
+on_committer_date "00:05" save_tag a1 unique_commit a1 tree -p a0
+on_committer_date "00:06" save_tag b1 unique_commit b1 tree -p a0
+on_committer_date "00:07" save_tag c1 unique_commit c1 tree -p b1
+on_committer_date "00:08" save_tag b2 unique_commit b2 tree -p b1
+on_committer_date "00:09" save_tag b3 unique_commit b2 tree -p b2
+on_committer_date "00:10" save_tag c2 unique_commit c2 tree -p c1 -p b2
+on_committer_date "00:11" save_tag c3 unique_commit c3 tree -p c2
+on_committer_date "00:12" save_tag a2 unique_commit a2 tree -p a1
+on_committer_date "00:13" save_tag a3 unique_commit a3 tree -p a2
+on_committer_date "00:14" save_tag b4 unique_commit b4 tree -p b3 -p a3
+on_committer_date "00:15" save_tag a4 unique_commit a4 tree -p a3 -p b4 -p c3
+on_committer_date "00:16" save_tag l3 unique_commit l3 tree -p a4
+on_committer_date "00:17" save_tag l4 unique_commit l4 tree -p l3
+on_committer_date "00:18" save_tag l5 unique_commit l5 tree -p l4
 git update-ref HEAD $(tag l5)
 
 
@@ -90,29 +90,29 @@ git update-ref HEAD $(tag l5)
 #     F
 
 
-on_committer_date "1971-08-16 00:00:00" hide_error save_tag F unique_commit F tree
-on_committer_date "1971-08-16 00:00:01" save_tag e8 unique_commit e8 tree -p F
-on_committer_date "1971-08-16 00:00:02" save_tag e7 unique_commit e7 tree -p e8
-on_committer_date "1971-08-16 00:00:03" save_tag e6 unique_commit e6 tree -p e7
-on_committer_date "1971-08-16 00:00:04" save_tag e5 unique_commit e5 tree -p e6
-on_committer_date "1971-08-16 00:00:05" save_tag f4 unique_commit f4 tree -p F
-on_committer_date "1971-08-16 00:00:06" save_tag f3 unique_commit f3 tree -p f4
-on_committer_date "1971-08-16 00:00:07" save_tag f2 unique_commit f2 tree -p f3
-on_committer_date "1971-08-16 00:00:08" save_tag f1 unique_commit f1 tree -p f2
-on_committer_date "1971-08-16 00:00:09" save_tag e4 unique_commit e4 tree -p e5
-on_committer_date "1971-08-16 00:00:10" save_tag e3 unique_commit e3 tree -p e4
-on_committer_date "1971-08-16 00:00:11" save_tag e2 unique_commit e2 tree -p e3
-on_committer_date "1971-08-16 00:00:12" save_tag e1 unique_commit e1 tree -p e2
-on_committer_date "1971-08-16 00:00:13" save_tag E unique_commit E tree -p e1 -p f1
-
-on_committer_date "1971-08-16 00:00:00" hide_error save_tag U unique_commit U tree
-on_committer_date "1971-08-16 00:00:01" save_tag u0 unique_commit u0 tree -p U
-on_committer_date "1971-08-16 00:00:01" save_tag u1 unique_commit u1 tree -p u0
-on_committer_date "1971-08-16 00:00:02" save_tag u2 unique_commit u2 tree -p u0
-on_committer_date "1971-08-16 00:00:03" save_tag u3 unique_commit u3 tree -p u0
-on_committer_date "1971-08-16 00:00:04" save_tag u4 unique_commit u4 tree -p u0
-on_committer_date "1971-08-16 00:00:05" save_tag u5 unique_commit u5 tree -p u0
-on_committer_date "1971-08-16 00:00:06" save_tag V unique_commit V tree -p u1 -p u2 -p u3 -p u4 -p u5
+on_committer_date "00:00" hide_error save_tag F unique_commit F tree
+on_committer_date "00:01" save_tag e8 unique_commit e8 tree -p F
+on_committer_date "00:02" save_tag e7 unique_commit e7 tree -p e8
+on_committer_date "00:03" save_tag e6 unique_commit e6 tree -p e7
+on_committer_date "00:04" save_tag e5 unique_commit e5 tree -p e6
+on_committer_date "00:05" save_tag f4 unique_commit f4 tree -p F
+on_committer_date "00:06" save_tag f3 unique_commit f3 tree -p f4
+on_committer_date "00:07" save_tag f2 unique_commit f2 tree -p f3
+on_committer_date "00:08" save_tag f1 unique_commit f1 tree -p f2
+on_committer_date "00:09" save_tag e4 unique_commit e4 tree -p e5
+on_committer_date "00:10" save_tag e3 unique_commit e3 tree -p e4
+on_committer_date "00:11" save_tag e2 unique_commit e2 tree -p e3
+on_committer_date "00:12" save_tag e1 unique_commit e1 tree -p e2
+on_committer_date "00:13" save_tag E unique_commit E tree -p e1 -p f1
+
+on_committer_date "00:00" hide_error save_tag U unique_commit U tree
+on_committer_date "00:01" save_tag u0 unique_commit u0 tree -p U
+on_committer_date "00:01" save_tag u1 unique_commit u1 tree -p u0
+on_committer_date "00:02" save_tag u2 unique_commit u2 tree -p u0
+on_committer_date "00:03" save_tag u3 unique_commit u3 tree -p u0
+on_committer_date "00:04" save_tag u4 unique_commit u4 tree -p u0
+on_committer_date "00:05" save_tag u5 unique_commit u5 tree -p u0
+on_committer_date "00:06" save_tag V unique_commit V tree -p u1 -p u2 -p u3 -p u4 -p u5
 
 test_sequence()
 {
diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index e4c52b0..bb66b8b 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -16,39 +16,34 @@ list_duplicates()
 date >path0
 git update-index --add path0
 save_tag tree git write-tree
-on_committer_date "1971-08-16 00:00:00" hide_error save_tag root unique_commit root tree
-on_committer_date "1971-08-16 00:00:01" save_tag l0 unique_commit l0 tree -p root
-on_committer_date "1971-08-16 00:00:02" save_tag l1 unique_commit l1 tree -p l0
-on_committer_date "1971-08-16 00:00:03" save_tag l2 unique_commit l2 tree -p l1
-on_committer_date "1971-08-16 00:00:04" save_tag a0 unique_commit a0 tree -p l2
-on_committer_date "1971-08-16 00:00:05" save_tag a1 unique_commit a1 tree -p a0
-on_committer_date "1971-08-16 00:00:06" save_tag b1 unique_commit b1 tree -p a0
-on_committer_date "1971-08-16 00:00:07" save_tag c1 unique_commit c1 tree -p b1
-on_committer_date "1971-08-16 00:00:08" as_author foobar@example.com save_tag b2 unique_commit b2 tree -p b1
-on_committer_date "1971-08-16 00:00:09" save_tag b3 unique_commit b3 tree -p b2
-on_committer_date "1971-08-16 00:00:10" save_tag c2 unique_commit c2 tree -p c1 -p b2
-on_committer_date "1971-08-16 00:00:11" save_tag c3 unique_commit c3 tree -p c2
-on_committer_date "1971-08-16 00:00:12" save_tag a2 unique_commit a2 tree -p a1
-on_committer_date "1971-08-16 00:00:13" save_tag a3 unique_commit a3 tree -p a2
-on_committer_date "1971-08-16 00:00:14" save_tag b4 unique_commit b4 tree -p b3 -p a3
-on_committer_date "1971-08-16 00:00:15" save_tag a4 unique_commit a4 tree -p a3 -p b4 -p c3
-on_committer_date "1971-08-16 00:00:16" save_tag l3 unique_commit l3 tree -p a4
-on_committer_date "1971-08-16 00:00:17" save_tag l4 unique_commit l4 tree -p l3
-on_committer_date "1971-08-16 00:00:18" save_tag l5 unique_commit l5 tree -p l4
-on_committer_date "1971-08-16 00:00:19" save_tag m1 unique_commit m1 tree -p a4 -p c3
-on_committer_date "1971-08-16 00:00:20" save_tag m2 unique_commit m2 tree -p c3 -p a4
-on_committer_date "1971-08-16 00:00:21" hide_error save_tag alt_root unique_commit alt_root tree
-on_committer_date "1971-08-16 00:00:22" save_tag r0 unique_commit r0 tree -p alt_root
-on_committer_date "1971-08-16 00:00:23" save_tag r1 unique_commit r1 tree -p r0
-on_committer_date "1971-08-16 00:00:24" save_tag l5r1 unique_commit l5r1 tree -p l5 -p r1
-on_committer_date "1971-08-16 00:00:25" save_tag r1l5 unique_commit r1l5 tree -p r1 -p l5
+on_committer_date "00:00" hide_error save_tag root unique_commit root tree
+on_committer_date "00:01" save_tag l0 unique_commit l0 tree -p root
+on_committer_date "00:02" save_tag l1 unique_commit l1 tree -p l0
+on_committer_date "00:03" save_tag l2 unique_commit l2 tree -p l1
+on_committer_date "00:04" save_tag a0 unique_commit a0 tree -p l2
+on_committer_date "00:05" save_tag a1 unique_commit a1 tree -p a0
+on_committer_date "00:06" save_tag b1 unique_commit b1 tree -p a0
+on_committer_date "00:07" save_tag c1 unique_commit c1 tree -p b1
+on_committer_date "00:08" as_author foobar@example.com save_tag b2 unique_commit b2 tree -p b1
+on_committer_date "00:09" save_tag b3 unique_commit b3 tree -p b2
+on_committer_date "00:10" save_tag c2 unique_commit c2 tree -p c1 -p b2
+on_committer_date "00:11" save_tag c3 unique_commit c3 tree -p c2
+on_committer_date "00:12" save_tag a2 unique_commit a2 tree -p a1
+on_committer_date "00:13" save_tag a3 unique_commit a3 tree -p a2
+on_committer_date "00:14" save_tag b4 unique_commit b4 tree -p b3 -p a3
+on_committer_date "00:15" save_tag a4 unique_commit a4 tree -p a3 -p b4 -p c3
+on_committer_date "00:16" save_tag l3 unique_commit l3 tree -p a4
+on_committer_date "00:17" save_tag l4 unique_commit l4 tree -p l3
+on_committer_date "00:18" save_tag l5 unique_commit l5 tree -p l4
+on_committer_date "00:19" save_tag m1 unique_commit m1 tree -p a4 -p c3
+on_committer_date "00:20" save_tag m2 unique_commit m2 tree -p c3 -p a4
+on_committer_date "00:21" hide_error save_tag alt_root unique_commit alt_root tree
+on_committer_date "00:22" save_tag r0 unique_commit r0 tree -p alt_root
+on_committer_date "00:23" save_tag r1 unique_commit r1 tree -p r0
+on_committer_date "00:24" save_tag l5r1 unique_commit l5r1 tree -p l5 -p r1
+on_committer_date "00:25" save_tag r1l5 unique_commit r1l5 tree -p r1 -p l5
 
 
-#
-# note: as of 20/6, it isn't possible to create duplicate parents, so this
-# can't be tested.
-#
-#on_committer_date "1971-08-16 00:00:20" save_tag m3 unique_commit m3 tree -p c3 -p a4 -p c3
 hide_error save_tag e1 as_author e@example.com unique_commit e1 tree
 save_tag e2 as_author e@example.com unique_commit e2 tree -p e1
 save_tag f1 as_author f@example.com unique_commit f1 tree -p e1
-- 
1.8.3.1-682-g924db96

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] t6003: add --date-order test
  2013-06-21 18:49 [PATCH 0/5] "log --author-date-order" follow-up Junio C Hamano
  2013-06-21 18:49 ` [PATCH 1/5] t/lib-t6000: style fixes Junio C Hamano
  2013-06-21 18:49 ` [PATCH 2/5] topology tests: teach a helper to take abbreviated timestamps Junio C Hamano
@ 2013-06-21 18:49 ` Junio C Hamano
  2013-06-21 18:49 ` [PATCH 4/5] topology tests: teach a helper to set author dates as well Junio C Hamano
  2013-06-21 18:49 ` [PATCH 5/5] t6003: add --author-date-order test Junio C Hamano
  4 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-21 18:49 UTC (permalink / raw
  To: git; +Cc: Elliott Cable, Jeff King

The "--date-order" output is a slight twist of "--topo-order" in
that commits from parallel histories are shown in their committer
date order without an attempt to clump commits from a single line
of history together like --topo-order does.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t6003-rev-list-topo-order.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index bb66b8b..0e3b7e1 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -100,6 +100,28 @@ l0
 root
 EOF
 
+test_output_expect_success 'simple date order' 'git rev-list --date-order  HEAD' <<EOF
+l5
+l4
+l3
+a4
+b4
+a3
+a2
+c3
+c2
+b3
+b2
+c1
+b1
+a1
+a0
+l2
+l1
+l0
+root
+EOF
+
 test_output_expect_success 'two diamonds topo order (g6)' 'git rev-list --topo-order  g4' <<EOF
 g4
 h2
-- 
1.8.3.1-682-g924db96

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] topology tests: teach a helper to set author dates as well
  2013-06-21 18:49 [PATCH 0/5] "log --author-date-order" follow-up Junio C Hamano
                   ` (2 preceding siblings ...)
  2013-06-21 18:49 ` [PATCH 3/5] t6003: add --date-order test Junio C Hamano
@ 2013-06-21 18:49 ` Junio C Hamano
  2013-06-21 18:49 ` [PATCH 5/5] t6003: add --author-date-order test Junio C Hamano
  4 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-21 18:49 UTC (permalink / raw
  To: git; +Cc: Elliott Cable, Jeff King

Introduce on_dates helper that is similar to on_committer_date but
also sets the author date, not just the committer date.

At this step, just set the same timestamp to the author date as the
committer date, as no test looks at author date yet.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/lib-t6000.sh                 |  8 +++++++
 t/t6003-rev-list-topo-order.sh | 52 +++++++++++++++++++++---------------------
 2 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/t/lib-t6000.sh b/t/lib-t6000.sh
index e2c3615..4ffd901 100644
--- a/t/lib-t6000.sh
+++ b/t/lib-t6000.sh
@@ -82,6 +82,14 @@ on_committer_date () {
 	"$@"
 }
 
+on_dates () {
+	assign_fake_date GIT_COMMITTER_DATE "$1"
+	assign_fake_date GIT_AUTHOR_DATE "$2"
+	export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+	shift 2
+	"$@"
+}
+
 # Execute a command and suppress any error output.
 hide_error () {
 	"$@" 2>/dev/null
diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index 0e3b7e1..77bf2ca 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -16,32 +16,32 @@ list_duplicates()
 date >path0
 git update-index --add path0
 save_tag tree git write-tree
-on_committer_date "00:00" hide_error save_tag root unique_commit root tree
-on_committer_date "00:01" save_tag l0 unique_commit l0 tree -p root
-on_committer_date "00:02" save_tag l1 unique_commit l1 tree -p l0
-on_committer_date "00:03" save_tag l2 unique_commit l2 tree -p l1
-on_committer_date "00:04" save_tag a0 unique_commit a0 tree -p l2
-on_committer_date "00:05" save_tag a1 unique_commit a1 tree -p a0
-on_committer_date "00:06" save_tag b1 unique_commit b1 tree -p a0
-on_committer_date "00:07" save_tag c1 unique_commit c1 tree -p b1
-on_committer_date "00:08" as_author foobar@example.com save_tag b2 unique_commit b2 tree -p b1
-on_committer_date "00:09" save_tag b3 unique_commit b3 tree -p b2
-on_committer_date "00:10" save_tag c2 unique_commit c2 tree -p c1 -p b2
-on_committer_date "00:11" save_tag c3 unique_commit c3 tree -p c2
-on_committer_date "00:12" save_tag a2 unique_commit a2 tree -p a1
-on_committer_date "00:13" save_tag a3 unique_commit a3 tree -p a2
-on_committer_date "00:14" save_tag b4 unique_commit b4 tree -p b3 -p a3
-on_committer_date "00:15" save_tag a4 unique_commit a4 tree -p a3 -p b4 -p c3
-on_committer_date "00:16" save_tag l3 unique_commit l3 tree -p a4
-on_committer_date "00:17" save_tag l4 unique_commit l4 tree -p l3
-on_committer_date "00:18" save_tag l5 unique_commit l5 tree -p l4
-on_committer_date "00:19" save_tag m1 unique_commit m1 tree -p a4 -p c3
-on_committer_date "00:20" save_tag m2 unique_commit m2 tree -p c3 -p a4
-on_committer_date "00:21" hide_error save_tag alt_root unique_commit alt_root tree
-on_committer_date "00:22" save_tag r0 unique_commit r0 tree -p alt_root
-on_committer_date "00:23" save_tag r1 unique_commit r1 tree -p r0
-on_committer_date "00:24" save_tag l5r1 unique_commit l5r1 tree -p l5 -p r1
-on_committer_date "00:25" save_tag r1l5 unique_commit r1l5 tree -p r1 -p l5
+on_dates "00:00" "00:00" hide_error save_tag root unique_commit root tree
+on_dates "00:01" "00:01" save_tag l0 unique_commit l0 tree -p root
+on_dates "00:02" "00:02" save_tag l1 unique_commit l1 tree -p l0
+on_dates "00:03" "00:03" save_tag l2 unique_commit l2 tree -p l1
+on_dates "00:04" "00:04" save_tag a0 unique_commit a0 tree -p l2
+on_dates "00:05" "00:05" save_tag a1 unique_commit a1 tree -p a0
+on_dates "00:06" "00:06" save_tag b1 unique_commit b1 tree -p a0
+on_dates "00:07" "00:07" save_tag c1 unique_commit c1 tree -p b1
+on_dates "00:08" "00:08" as_author foobar@example.com save_tag b2 unique_commit b2 tree -p b1
+on_dates "00:09" "00:09" save_tag b3 unique_commit b3 tree -p b2
+on_dates "00:10" "00:10" save_tag c2 unique_commit c2 tree -p c1 -p b2
+on_dates "00:11" "00:11" save_tag c3 unique_commit c3 tree -p c2
+on_dates "00:12" "00:12" save_tag a2 unique_commit a2 tree -p a1
+on_dates "00:13" "00:13" save_tag a3 unique_commit a3 tree -p a2
+on_dates "00:14" "00:14" save_tag b4 unique_commit b4 tree -p b3 -p a3
+on_dates "00:15" "00:15" save_tag a4 unique_commit a4 tree -p a3 -p b4 -p c3
+on_dates "00:16" "00:16" save_tag l3 unique_commit l3 tree -p a4
+on_dates "00:17" "00:17" save_tag l4 unique_commit l4 tree -p l3
+on_dates "00:18" "00:18" save_tag l5 unique_commit l5 tree -p l4
+on_dates "00:19" "00:19" save_tag m1 unique_commit m1 tree -p a4 -p c3
+on_dates "00:20" "00:20" save_tag m2 unique_commit m2 tree -p c3 -p a4
+on_dates "00:21" "00:21" hide_error save_tag alt_root unique_commit alt_root tree
+on_dates "00:22" "00:22" save_tag r0 unique_commit r0 tree -p alt_root
+on_dates "00:23" "00:23" save_tag r1 unique_commit r1 tree -p r0
+on_dates "00:24" "00:24" save_tag l5r1 unique_commit l5r1 tree -p l5 -p r1
+on_dates "00:25" "00:25" save_tag r1l5 unique_commit r1l5 tree -p r1 -p l5
 
 
 hide_error save_tag e1 as_author e@example.com unique_commit e1 tree
-- 
1.8.3.1-682-g924db96

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] t6003: add --author-date-order test
  2013-06-21 18:49 [PATCH 0/5] "log --author-date-order" follow-up Junio C Hamano
                   ` (3 preceding siblings ...)
  2013-06-21 18:49 ` [PATCH 4/5] topology tests: teach a helper to set author dates as well Junio C Hamano
@ 2013-06-21 18:49 ` Junio C Hamano
  4 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2013-06-21 18:49 UTC (permalink / raw
  To: git; +Cc: Elliott Cable, Jeff King

Tweak the --topo/date-order test vector a bit and mark the author
dates of two commits (a2 and a3) earlier than their own committer
dates, making them much older than other commits that are made on
parallel branches to simulate the case where a long running topic
was rebased recently.

They will show up as recent in the --date-order output due to their
timestamps, but they appear a lot later in the --author-date-order
output, even though their committer timestamp says otherwise.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t6003-rev-list-topo-order.sh | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index 77bf2ca..24d1836 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -28,8 +28,8 @@ on_dates "00:08" "00:08" as_author foobar@example.com save_tag b2 unique_commit
 on_dates "00:09" "00:09" save_tag b3 unique_commit b3 tree -p b2
 on_dates "00:10" "00:10" save_tag c2 unique_commit c2 tree -p c1 -p b2
 on_dates "00:11" "00:11" save_tag c3 unique_commit c3 tree -p c2
-on_dates "00:12" "00:12" save_tag a2 unique_commit a2 tree -p a1
-on_dates "00:13" "00:13" save_tag a3 unique_commit a3 tree -p a2
+on_dates "00:12" "00:00" save_tag a2 unique_commit a2 tree -p a1
+on_dates "00:13" "00:01" save_tag a3 unique_commit a3 tree -p a2
 on_dates "00:14" "00:14" save_tag b4 unique_commit b4 tree -p b3 -p a3
 on_dates "00:15" "00:15" save_tag a4 unique_commit a4 tree -p a3 -p b4 -p c3
 on_dates "00:16" "00:16" save_tag l3 unique_commit l3 tree -p a4
@@ -122,6 +122,28 @@ l0
 root
 EOF
 
+test_output_expect_success 'simple author-date order' 'git rev-list --author-date-order  HEAD' <<EOF
+l5
+l4
+l3
+a4
+b4
+c3
+c2
+b3
+b2
+c1
+b1
+a3
+a2
+a1
+a0
+l2
+l1
+l0
+root
+EOF
+
 test_output_expect_success 'two diamonds topo order (g6)' 'git rev-list --topo-order  g4' <<EOF
 g4
 h2
-- 
1.8.3.1-682-g924db96

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-21 18:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21 18:49 [PATCH 0/5] "log --author-date-order" follow-up Junio C Hamano
2013-06-21 18:49 ` [PATCH 1/5] t/lib-t6000: style fixes Junio C Hamano
2013-06-21 18:49 ` [PATCH 2/5] topology tests: teach a helper to take abbreviated timestamps Junio C Hamano
2013-06-21 18:49 ` [PATCH 3/5] t6003: add --date-order test Junio C Hamano
2013-06-21 18:49 ` [PATCH 4/5] topology tests: teach a helper to set author dates as well Junio C Hamano
2013-06-21 18:49 ` [PATCH 5/5] t6003: add --author-date-order test Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).