git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t7501-commit.sh: Add test case for fixing author in amend commit.
@ 2007-11-05  3:42 Kristian Høgsberg
  2007-11-05 10:24 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Kristian Høgsberg @ 2007-11-05  3:42 UTC (permalink / raw)
  To: gitster; +Cc: git, Kristian Høgsberg

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
 t/t7501-commit.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index b151b51..7a37c13 100644
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -151,6 +151,7 @@ test_expect_success 'partial commit that involves removal (2)' '
 	diff expected current
 
 '
+test_tick
 
 test_expect_success 'partial commit that involves removal (3)' '
 
@@ -163,4 +164,19 @@ test_expect_success 'partial commit that involves removal (3)' '
 
 '
 
+oldtick=$GIT_AUTHOR_DATE
+test_tick
+
+author="The Real Author <someguy@his.email.org>"
+committer="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE"
+
+test_expect_success 'amend commit to fix author' '
+
+	git reset --hard
+	git cat-file -p HEAD | sed -e "s/author.*/author $author $oldtick/" -e "s/committer.*/committer $committer/" > expected &&
+	git commit --amend --author="$author" &&
+	git cat-file -p HEAD > current &&
+	diff expected current
+	
+'
 test_done
-- 
1.5.3.5.1527.g6161-dirty

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

* Re: [PATCH] t7501-commit.sh: Add test case for fixing author in amend commit.
  2007-11-05  3:42 [PATCH] t7501-commit.sh: Add test case for fixing author in amend commit Kristian Høgsberg
@ 2007-11-05 10:24 ` Johannes Schindelin
  2007-11-05 17:17   ` Kristian Høgsberg
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-11-05 10:24 UTC (permalink / raw)
  To: Kristian Høgsberg; +Cc: gitster, git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 713 bytes --]

Hi,

On Sun, 4 Nov 2007, Kristian Høgsberg wrote:

> +test_tick
>  
>  test_expect_success 'partial commit that involves removal (3)' '

We usually put the test_tick into the test case.  IOW

	test_expect_success 'message' '
		test_tick &&
		...

>  '
>  
> +oldtick=$GIT_AUTHOR_DATE
> +test_tick
> +
> +author="The Real Author <someguy@his.email.org>"
> +committer="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE"
> +
> +test_expect_success 'amend commit to fix author' '

Same here.

BTW: is this committer mangling really necessary? I thought only 
GIT_COMMITTER_DATE was relevant.  And that is easily replaced by

	sed -e "s/^\(committer.* \)[0-9][0-9]*$/\1$GIT_COMMITTER_DATE/"

Ciao,
Dscho

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

* [PATCH] t7501-commit.sh: Add test case for fixing author in amend commit.
  2007-11-05 10:24 ` Johannes Schindelin
@ 2007-11-05 17:17   ` Kristian Høgsberg
  2007-11-05 21:23     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Kristian Høgsberg @ 2007-11-05 17:17 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: gitster, git, Kristian Høgsberg

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---

How about this?

 t/t7501-commit.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index b151b51..c5d122f 100644
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -163,4 +163,19 @@ test_expect_success 'partial commit that involves removal (3)' '
 
 '
 
+author="The Real Author <someguy@his.email.org>"
+test_expect_success 'amend commit to fix author' '
+
+	oldtick=$GIT_AUTHOR_DATE &&
+	test_tick &&
+	git reset --hard &&
+	git cat-file -p HEAD |
+	sed -e "s/author.*/author $author $oldtick/" \
+		-e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \
+		expected &&
+	git commit --amend --author="$author" &&
+	git cat-file -p HEAD > current &&
+	diff expected current
+	
+'
 test_done
-- 
1.5.3.4

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

* Re: [PATCH] t7501-commit.sh: Add test case for fixing author in amend commit.
  2007-11-05 17:17   ` Kristian Høgsberg
@ 2007-11-05 21:23     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-11-05 21:23 UTC (permalink / raw)
  To: Kristian Høgsberg; +Cc: Johannes Schindelin, gitster, git

Kristian Høgsberg <krh@redhat.com> writes:

> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
> ---
>
> How about this?

Looks Ok; will queue.

Thanks.

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

end of thread, other threads:[~2007-11-05 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-05  3:42 [PATCH] t7501-commit.sh: Add test case for fixing author in amend commit Kristian Høgsberg
2007-11-05 10:24 ` Johannes Schindelin
2007-11-05 17:17   ` Kristian Høgsberg
2007-11-05 21:23     ` Junio C Hamano

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 NNTP newsgroup(s).