All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Will Palmer <wmpalmer@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: jn/shortlog
Date: Mon, 3 May 2010 20:56:35 -0500	[thread overview]
Message-ID: <20100504015635.GA7258@progeny.tock> (raw)
In-Reply-To: <20100504002526.GA7061@progeny.tock>

Jonathan Nieder wrote:
> Will Palmer wrote:

>> Haven't been able to reproduce here (just running make -m4 in a
>> while-loop all night) Any specific tests failing?
>
> In t4201-shortlog.sh:
> 
> --- expect.template     2010-05-04 00:17:41.609754167 +0000
> +++ log.predictable     2010-05-04 00:17:41.613754428 +0000
> @@ -1,10 +0,0 @@
[etc]

So apparently shortlog does not default to HEAD when stdin is not a
tty.

Possible fixes:

 - document the current unfriendly behavior
 - default to HEAD when input is empty

Jonathan

-- 8< --
Subject: t4200 (rerere): guard setup with test_expect_success

Ensure that GIT_SKIP_TESTS='t4200.*' actually suppresses all of t4200.

Also quote some stray dollar signs and test the result from some
git config invocations.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t4200-rerere.sh |  189 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 106 insertions(+), 83 deletions(-)

diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 70856d0..d9b87c9 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -56,23 +56,27 @@ test_expect_success 'conflicting merge' '
 	git reset --hard &&
 	mkdir .git/rr-cache &&
 	git config --unset rerere.enabled &&
-	test_must_fail git merge first
+	test_must_fail git merge first &&
+	sha1=$(perl -pe "s/	.*//" .git/MERGE_RR) &&
+	rr=.git/rr-cache/$sha1
 '
 
-sha1=$(perl -pe 's/	.*//' .git/MERGE_RR)
-rr=.git/rr-cache/$sha1
-test_expect_success 'recorded preimage' "grep ^=======$ $rr/preimage"
+test_expect_success 'recorded preimage' '
+	grep "^=======\$" "$rr/preimage"
+'
 
 test_expect_success 'rerere.enabled works, too' '
 	rm -rf .git/rr-cache &&
 	git config rerere.enabled true &&
 	git reset --hard &&
 	test_must_fail git merge first &&
-	grep ^=======$ $rr/preimage
+	grep "^=======\$" "$rr/preimage"
 '
 
-test_expect_success 'no postimage or thisimage yet' \
-	"test ! -f $rr/postimage -a ! -f $rr/thisimage"
+test_expect_success 'no postimage or thisimage yet' '
+	! test -f "$rr/postimage" &&
+	! test -f "$rr/thisimage"
+'
 
 test_expect_success 'preimage has right number of lines' '
 
@@ -81,56 +85,60 @@ test_expect_success 'preimage has right number of lines' '
 
 '
 
-git show first:a1 > a1
-
-cat > expect << EOF
---- a/a1
-+++ b/a1
-@@ -1,4 +1,4 @@
--Some Title
-+Some title
- ==========
- Whether 'tis nobler in the mind to suffer
- The slings and arrows of outrageous fortune,
-@@ -8,21 +8,11 @@
- The heart-ache and the thousand natural shocks
- That flesh is heir to, 'tis a consummation
- Devoutly to be wish'd.
--<<<<<<<
--Some Title
--==========
--To die! To sleep;
--=======
- Some title
- ==========
- To die, to sleep;
-->>>>>>>
- To sleep: perchance to dream: ay, there's the rub;
- For in that sleep of death what dreams may come
- When we have shuffled off this mortal coil,
- Must give us pause: there's the respect
- That makes calamity of so long life;
--<<<<<<<
--=======
--* END *
-->>>>>>>
-EOF
-git rerere diff > out
-
-test_expect_success 'rerere diff' 'test_cmp expect out'
-
-cat > expect << EOF
-a1
-EOF
-
-git rerere status > out
-
-test_expect_success 'rerere status' 'test_cmp expect out'
+test_expect_success 'rerere diff' "
+	git show first:a1 >a1 &&
+
+	cat >expect <<-\EOF
+	--- a/a1
+	+++ b/a1
+	@@ -1,4 +1,4 @@
+	-Some Title
+	+Some title
+	 ==========
+	 Whether 'tis nobler in the mind to suffer
+	 The slings and arrows of outrageous fortune,
+	@@ -8,21 +8,11 @@
+	 The heart-ache and the thousand natural shocks
+	 That flesh is heir to, 'tis a consummation
+	 Devoutly to be wish'd.
+	-<<<<<<<
+	-Some Title
+	-==========
+	-To die! To sleep;
+	-=======
+	 Some title
+	 ==========
+	 To die, to sleep;
+	->>>>>>>
+	 To sleep: perchance to dream: ay, there's the rub;
+	 For in that sleep of death what dreams may come
+	 When we have shuffled off this mortal coil,
+	 Must give us pause: there's the respect
+	 That makes calamity of so long life;
+	-<<<<<<<
+	-=======
+	-* END *
+	->>>>>>>
+	EOF
+	git rerere diff >out &&
+	test_cmp expect out
+"
+
+test_expect_success 'rerere status' '
+	cat >expect <<-\EOF &&
+	a1
+	EOF
+
+	git rerere status >out &&
+	test_cmp expect out
+'
 
 test_expect_success 'commit succeeds' \
 	"git commit -q -a -m 'prefer first over second'"
 
-test_expect_success 'recorded postimage' "test -f $rr/postimage"
+test_expect_success 'recorded postimage' '
+	test -f "$rr/postimage"
+'
 
 test_expect_success 'another conflicting merge' '
 	git checkout -b third master &&
@@ -139,47 +147,62 @@ test_expect_success 'another conflicting merge' '
 	test_must_fail git pull . first
 '
 
-git show first:a1 | sed 's/To die: t/To die! T/' > expect
-test_expect_success 'rerere kicked in' "! grep ^=======$ a1"
+test_expect_success 'rerere kicked in' '
+	! grep "^=======\$" a1
+'
 
-test_expect_success 'rerere prefers first change' 'test_cmp a1 expect'
+test_expect_success 'rerere prefers first change' '
+	git show first:a1 | sed "s/To die: t/To die! T/" >expect &&
+	test_cmp a1 expect
+'
 
-rm $rr/postimage
-echo "$sha1	a1" | perl -pe 'y/\012/\000/' > .git/MERGE_RR
+test_expect_success 'cleanup' '
+	rm $rr/postimage &&
+	echo "$sha1	a1" |
+		perl -pe "y/\012/\000/" >.git/MERGE_RR
+'
 
 test_expect_success 'rerere clear' 'git rerere clear'
 
 test_expect_success 'clear removed the directory' "test ! -d $rr"
 
-mkdir $rr
-echo Hello > $rr/preimage
-echo World > $rr/postimage
-
-sha2=4000000000000000000000000000000000000000
-rr2=.git/rr-cache/$sha2
-mkdir $rr2
-echo Hello > $rr2/preimage
-
-almost_15_days_ago=$((60-15*86400))
-just_over_15_days_ago=$((-1-15*86400))
-almost_60_days_ago=$((60-60*86400))
-just_over_60_days_ago=$((-1-60*86400))
+test_expect_success 'gc setup' '
+	mkdir "$rr" &&
+	echo Hello >"$rr/preimage" &&
+	echo World >"$rr/postimage" &&
 
-test-chmtime =$almost_60_days_ago $rr/preimage
-test-chmtime =$almost_15_days_ago $rr2/preimage
+	sha2=4000000000000000000000000000000000000000 &&
+	rr2=.git/rr-cache/$sha2 &&
+	mkdir "$rr2" &&
+	echo Hello >"$rr2/preimage" &&
 
-test_expect_success 'garbage collection (part1)' 'git rerere gc'
+	almost_15_days_ago=$((60-15*86400)) &&
+	just_over_15_days_ago=$((-1-15*86400)) &&
+	almost_60_days_ago=$((60-60*86400)) &&
+	just_over_60_days_ago=$((-1-60*86400))
+'
 
-test_expect_success 'young records still live' \
-	"test -f $rr/preimage && test -f $rr2/preimage"
+test_expect_success 'garbage collection (part1)' '
+	test-chmtime "=$almost_60_days_ago" "$rr/preimage" &&
+	test-chmtime "=$almost_15_days_ago" "$rr2/preimage" &&
+	git rerere gc
+'
 
-test-chmtime =$just_over_60_days_ago $rr/preimage
-test-chmtime =$just_over_15_days_ago $rr2/preimage
+test_expect_success 'young records still live' '
+	test -f "$rr/preimage" &&
+	test -f "$rr2/preimage"
+'
 
-test_expect_success 'garbage collection (part2)' 'git rerere gc'
+test_expect_success 'garbage collection (part2)' '
+	test-chmtime "=$just_over_60_days_ago" "$rr/preimage" &&
+	test-chmtime "=$just_over_15_days_ago" "$rr2/preimage" &&
+	git rerere gc
+'
 
-test_expect_success 'old records rest in peace' \
-	"test ! -f $rr/preimage && test ! -f $rr2/preimage"
+test_expect_success 'old records rest in peace' '
+	! test -f "$rr/preimage" &&
+	! test -f "$rr2/preimage"
+'
 
 test_expect_success 'file2 added differently in two branches' '
 	git reset --hard &&
@@ -214,7 +237,7 @@ test_expect_success 'resolution was recorded properly' '
 '
 
 test_expect_success 'rerere.autoupdate' '
-	git config rerere.autoupdate true
+	git config rerere.autoupdate true &&
 	git reset --hard &&
 	git checkout version2 &&
 	test_must_fail git merge fifth &&
@@ -230,7 +253,7 @@ test_expect_success 'merge --rerere-autoupdate' '
 '
 
 test_expect_success 'merge --no-rerere-autoupdate' '
-	git config rerere.autoupdate true
+	git config rerere.autoupdate true &&
 	git reset --hard &&
 	git checkout version2 &&
 	test_must_fail git merge --no-rerere-autoupdate fifth &&
-- 
1.7.1.5.g8d03f

  reply	other threads:[~2010-05-04  1:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-02 16:12 What's cooking in git.git (May 2010, #01; Sun, 2) Junio C Hamano
2010-05-02 20:01 ` Johannes Sixt
2010-05-08 15:13   ` [PATCH 1/2] Have set_try_to_free_routine return the previous routine Johannes Sixt
2010-05-08 15:18     ` [PATCH 2/2] Do not call release_pack_memory in malloc wrappers when GIT_TRACE is used Johannes Sixt
2010-05-03 12:48 ` What's cooking in git.git (May 2010, #01; Sun, 2) Jakub Narebski
2010-05-03 18:54 ` Will Palmer
2010-05-04  0:25   ` jn/shortlog (Re: What's cooking in git.git (May 2010, #01; Sun, 2)) Jonathan Nieder
2010-05-04  1:56     ` Jonathan Nieder [this message]
2010-05-04  2:52       ` [PATCH v2 0/5] jn/shortlog Jonathan Nieder
2010-05-04  2:57         ` [PATCH 1/5] Documentation/shortlog: scripted users should not rely on implicit HEAD Jonathan Nieder
2010-05-04  2:57         ` [PATCH 2/5] t4201 (shortlog): guard setup with test_expect_success Jonathan Nieder
2010-05-04  2:58         ` [PATCH 3/5] t4201 (shortlog): Test output format with multiple authors Jonathan Nieder
2010-05-04  2:59         ` [PATCH 4/5] shortlog: Document and test --format option Jonathan Nieder
2010-05-04  3:18         ` [PATCH 5/5] pretty: Respect --abbrev option Jonathan Nieder
2010-05-04  8:34           ` Jonathan Nieder
2010-05-08 16:43 ` What's cooking in git.git (May 2010, #01; Sun, 2) Clemens Buchacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100504015635.GA7258@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=wmpalmer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.