From: Theodore Ts'o <tytso@mit.edu>
To: jsipek@cs.sunysb.edu
Cc: git@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] Use patch file's modtime as the git author and commiter date
Date: Sun, 11 Feb 2007 18:24:35 -0500 [thread overview]
Message-ID: <11712362751442-git-send-email-tytso@mit.edu> (raw)
By using the same author and committer date, it keeps the git commit
id's stable if the patches haven't changed. Otherwise, repeated
invocations of "guilt pop -a; guilt push -a" will create new commit's
with different commit dates, creating a lot of garbage commits that
won't disappear for a LONG time, even after running "git-gc --prune",
thanks to the reflog in git 1.5.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
guilt | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/guilt b/guilt
index ced441b..7cb52c4 100755
--- a/guilt
+++ b/guilt
@@ -248,6 +248,10 @@ function push_patch
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
fi
+ local backup_author_date="$GIT_AUTHOR_DATE"
+ local backup_committer_date="$GIT_COMMITTER_DATE"
+ export GIT_AUTHOR_DATE=`stat -c %y $p`
+ export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
# commit
local treeish=`git-write-tree`
@@ -271,6 +275,16 @@ function push_patch
unset GIT_AUTHOR_EMAIL
fi
fi
+ if [ ! -z "$backup_author_date" ]; then
+ export GIT_AUTHOR_DATE="$backup_author_date"
+ else
+ unset GIT_AUTHOR_DATE
+ fi
+ if [ ! -z "$backup_committer_date" ]; then
+ export GIT_COMMITTER_DATE="$backup_committer_date"
+ else
+ unset GIT_COMMITTER_DATE
+ fi
rm -f /tmp/guilt.msg.$$ /tmp/guilt.log.$$
--
1.5.0.rc4.2.g4249
next reply other threads:[~2007-02-12 0:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-11 23:24 Theodore Ts'o [this message]
2007-02-12 6:57 ` [PATCH] Use patch file's modtime as the git author and commiter date Josef Sipek
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=11712362751442-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=git@vger.kernel.org \
--cc=jsipek@cs.sunysb.edu \
/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 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).