From: Nanako Shiraishi <nanako3@lavabit.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git list <git@vger.kernel.org>,
Christian MICHON <christian.michon@gmail.com>
Subject: Re: how to force a commit date matching info from a mbox ?
Date: Fri, 23 Jan 2009 17:26:46 +0900 [thread overview]
Message-ID: <20090123172646.6117@nanako3.lavabit.com> (raw)
In-Reply-To: <7vwscm1nic.fsf@gitster.siamese.dyndns.org>
Quoting Junio C Hamano <gitster@pobox.com>:
> Nanako Shiraishi <nanako3@lavabit.com> writes:
>
>> Quoting Junio C Hamano <gitster@pobox.com>:
>>
>>> Perhaps something like this totally untested patch.
>>
>> You have test scripts already, but you say it is untested?
>
> Correct. I did not run that new test, let alone existing ones ;-)
I applied your patch and run the test suite, including the new one, and they passed.
I tried to write a new option I said that I wanted in my previous message. Here is a patch.
--->8---
Subject: [PATCH] git-am: Add --ignore-date option
This new option makes the command ignore the date header field recorded in
the format-patch output. The commits will have the timestamp when they
are created instead.
You can work a lot in one day to accumulate many changes, but apply and
push to the public repository only some of them at the end of the first
day. Then next day you can spend all your working hours reading comics or
chatting with your coworkers, and apply your remaining patches from the
previous day using this option to pretend that you have been working at
the end of the day.
Signed-off-by: しらいしななこ <nanako3@lavabit.com>
---
git-am.sh | 12 +++++++++++-
t/t4150-am.sh | 9 +++++++++
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index e96071d..eb88d90 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -24,6 +24,7 @@ r,resolved to be used after a patch failure
skip skip the current patch
abort restore the original branch and abort the patching operation.
committer-date-is-author-date lie about committer date
+ignore-date use current timestamp for author date
rebasing (internal use for git-rebase)"
. git-sh-setup
@@ -135,6 +136,7 @@ sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
resolvemsg= resume=
git_apply_opt=
committer_date_is_author_date=
+ignore_date=
while test $# != 0
do
@@ -172,6 +174,8 @@ do
git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
--committer-date-is-author-date)
committer_date_is_author_date=t ;;
+ --ignore-date)
+ ignore_date=t ;;
--)
shift; break ;;
*)
@@ -379,7 +383,13 @@ do
GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$dotest/info")"
GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$dotest/info")"
- GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$dotest/info")"
+ case "$ignore_date" in
+ t)
+ GIT_AUTHOR_DATE="$(date -R)"
+ ;;
+ '')
+ GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$dotest/info")"
+ esac
if test -z "$GIT_AUTHOR_EMAIL"
then
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 8d3fb00..5ecf456 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -277,4 +277,13 @@ test_expect_success 'am without --committer-date-is-author-date' '
test "$at" != "$ct"
'
+test_expect_success 'am --ignore-date' '
+ git checkout first &&
+ test_tick &&
+ git am --ignore-date patch1 &&
+ git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
+ at=$(sed -ne "/^author /s/.*> //p" head1) &&
+ echo "$at" | grep "+0000"
+'
+
test_done
--
1.6.1.224.gb56c7
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
next prev parent reply other threads:[~2009-01-23 8:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-22 22:41 how to force a commit date matching info from a mbox ? Christian MICHON
2009-01-23 0:14 ` Junio C Hamano
2009-01-23 0:45 ` Nanako Shiraishi
2009-01-23 7:37 ` Junio C Hamano
2009-01-23 8:26 ` Nanako Shiraishi [this message]
2009-01-23 9:39 ` Junio C Hamano
2009-01-23 22:29 ` Jeff King
2009-01-24 0:34 ` Johannes Schindelin
2009-01-24 0:52 ` Jeff King
2009-01-24 1:43 ` Johannes Schindelin
2009-01-24 2:35 ` Jeff King
2009-01-23 9:52 ` Nanako Shiraishi
2009-01-23 17:27 ` Junio C Hamano
2009-01-23 12:38 ` [PATCH] git-am: Add --ignore-date option Johannes Schindelin
2009-01-23 13:17 ` Adeodato Simó
2009-01-23 8:08 ` how to force a commit date matching info from a mbox ? Christian MICHON
2009-01-23 8:51 ` Christian MICHON
2009-01-23 0:21 ` Johannes Schindelin
2009-01-23 8:07 ` Christian MICHON
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=20090123172646.6117@nanako3.lavabit.com \
--to=nanako3@lavabit.com \
--cc=christian.michon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.