git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] commit -c/-C/--amend: take over authorship and restamp time with --claim
@ 2009-10-31  3:08 Erick Mattos
  2009-10-31 21:24 ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Erick Mattos @ 2009-10-31  3:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Erick Mattos

When we use one of the options above we are normally trying to do mainly
two things: one is using the source as a template and second is to
recreate a commit with corrections.

When they are used, the authorship and timestamp recorded in the newly
created commit is always taken from the original commit.  And they
should not when we are using it as a template.

The new --claim option is meant to solve this need by regenerating the
timestamp and setting as new author the committer or the one specified
on --author option.

Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
---
 Documentation/git-commit.txt |   10 +++++++---
 builtin-commit.c             |    7 ++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 0578a40..96248ab 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git commit' [-a | --interactive] [-s] [-v] [-u<mode>] [--amend] [--dry-run]
-	   [(-c | -C) <commit>] [-F <file> | -m <msg>]
+	   [(-c | -C) <commit>] [-F <file> | -m <msg>] [--claim]
 	   [--allow-empty] [--no-verify] [-e] [--author=<author>]
 	   [--cleanup=<mode>] [--] [[-i | -o ]<file>...]
 
@@ -61,14 +61,18 @@ OPTIONS
 -C <commit>::
 --reuse-message=<commit>::
 	Take an existing commit object, and reuse the log message
-	and the authorship information (including the timestamp)
-	when creating the commit.
+	and the authorship information when creating the commit.
 
 -c <commit>::
 --reedit-message=<commit>::
 	Like '-C', but with '-c' the editor is invoked, so that
 	the user can further edit the commit message.
 
+--claim::
+	When used with -C/-c/--amend options the committer takes over
+	the cloned commit authorship and renew the timestamp thus using
+	only the commit message from the source.
+
 -F <file>::
 --file=<file>::
 	Take the commit message from the given file.  Use '-' to
diff --git a/builtin-commit.c b/builtin-commit.c
index c395cbf..33922df 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -51,7 +51,7 @@ static const char *template_file;
 static char *edit_message, *use_message;
 static char *author_name, *author_email, *author_date;
 static int all, edit_flag, also, interactive, only, amend, signoff;
-static int quiet, verbose, no_verify, allow_empty, dry_run;
+static int quiet, verbose, no_verify, allow_empty, dry_run, claim;
 static char *untracked_files_arg;
 /*
  * The default commit message cleanup mode will remove the lines
@@ -91,8 +91,9 @@ static struct option builtin_commit_options[] = {
 	OPT_FILENAME('F', "file", &logfile, "read log from file"),
 	OPT_STRING(0, "author", &force_author, "AUTHOR", "override author for commit"),
 	OPT_CALLBACK('m', "message", &message, "MESSAGE", "specify commit message", opt_parse_m),
-	OPT_STRING('c', "reedit-message", &edit_message, "COMMIT", "reuse and edit message from specified commit "),
+	OPT_STRING('c', "reedit-message", &edit_message, "COMMIT", "reuse and edit message from specified commit"),
 	OPT_STRING('C', "reuse-message", &use_message, "COMMIT", "reuse message from specified commit"),
+	OPT_BOOLEAN(0, "claim", &claim, "take over cloned commit authorship and renew timestamp"),
 	OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
 	OPT_FILENAME('t', "template", &template_file, "use specified template file"),
 	OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"),
@@ -381,7 +382,7 @@ static void determine_author_info(void)
 	email = getenv("GIT_AUTHOR_EMAIL");
 	date = getenv("GIT_AUTHOR_DATE");
 
-	if (use_message) {
+	if (use_message && !claim) {
 		const char *a, *lb, *rb, *eol;
 
 		a = strstr(use_message_buffer, "\nauthor ");
-- 
1.6.5.2.102.g0a733

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

end of thread, other threads:[~2009-11-03 16:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-31  3:08 [PATCH] commit -c/-C/--amend: take over authorship and restamp time with --claim Erick Mattos
2009-10-31 21:24 ` Junio C Hamano
2009-11-01 18:19   ` [PATCH v2] " Erick Mattos
2009-11-01 18:45     ` [PATCH] commit -c/-C/--amend: acquire " Erick Mattos
2009-11-01 20:02       ` Junio C Hamano
2009-11-01 20:57         ` Erick Mattos
2009-11-02  0:47           ` Junio C Hamano
2009-11-02  0:54             ` Erick Mattos
2009-11-02  2:58               ` Junio C Hamano
2009-11-02  3:07                 ` Junio C Hamano
2009-11-03 16:39                   ` Erick Mattos
2009-11-01 23:14         ` Erick Mattos
2009-11-02  0:44           ` [PATCH] commit -c/-C/--amend: reset timestamp and authorship to committer with --mine Erick Mattos

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).