summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-05-08 20:06:06 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-08 20:06:06 -0700
commitca1a5eeead00b1caa2274fe011bb3d7de0bdffb2 (patch)
treeb7ef1c173838d4132244ca12624c3f5fb6dd1427
parent4c4d3ac746922886ba75d0aa1114c6ad96788c1a (diff)
parentcfd9c27708509457f572373bd8f4eb25dd4a6715 (diff)
downloadgit-ca1a5eeead00b1caa2274fe011bb3d7de0bdffb2.tar.gz
Merge branch 'dm/cherry-pick-s'
* dm/cherry-pick-s: Allow cherry-pick (and revert) to add signoff line
-rw-r--r--Documentation/git-cherry-pick.txt5
-rw-r--r--Documentation/git-revert.txt5
-rw-r--r--builtin-revert.c20
3 files changed, 23 insertions, 7 deletions
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index f0beb412e6..ca048f46f6 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -7,7 +7,7 @@ git-cherry-pick - Apply the change introduced by an existing commit
SYNOPSIS
--------
-'git-cherry-pick' [--edit] [-n] [-m parent-number] [-x] <commit>
+'git-cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] <commit>
DESCRIPTION
-----------
@@ -64,6 +64,9 @@ OPTIONS
This is useful when cherry-picking more than one commits'
effect to your working tree in a row.
+-s|--signoff::
+ Add Signed-off-by line at the end of the commit message.
+
Author
------
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 93e20f7752..13ceabbcc8 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -7,7 +7,7 @@ git-revert - Revert an existing commit
SYNOPSIS
--------
-'git-revert' [--edit | --no-edit] [-n] [-m parent-number] <commit>
+'git-revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>
DESCRIPTION
-----------
@@ -51,6 +51,9 @@ OPTIONS
This is useful when reverting more than one commits'
effect to your working tree in a row.
+-s|--signoff::
+ Add Signed-off-by line at the end of the commit message.
+
Author
------
diff --git a/builtin-revert.c b/builtin-revert.c
index 607a2f0337..2b57525d72 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -33,7 +33,7 @@ static const char * const cherry_pick_usage[] = {
NULL
};
-static int edit, no_replay, no_commit, mainline;
+static int edit, no_replay, no_commit, mainline, signoff;
static enum { REVERT, CHERRY_PICK } action;
static struct commit *commit;
@@ -53,6 +53,7 @@ static void parse_args(int argc, const char **argv)
OPT_BOOLEAN('e', "edit", &edit, "edit the commit message"),
OPT_BOOLEAN('x', NULL, &no_replay, "append commit name when cherry-picking"),
OPT_BOOLEAN('r', NULL, &noop, "no-op (backward compatibility)"),
+ OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
OPT_INTEGER('m', "mainline", &mainline, "parent number"),
OPT_END(),
};
@@ -404,10 +405,19 @@ static int revert_or_cherry_pick(int argc, const char **argv)
*/
if (!no_commit) {
- if (edit)
- return execl_git_cmd("commit", "-n", NULL);
- else
- return execl_git_cmd("commit", "-n", "-F", defmsg, NULL);
+ /* 6 is max possible length of our args array including NULL */
+ const char *args[6];
+ int i = 0;
+ args[i++] = "commit";
+ args[i++] = "-n";
+ if (signoff)
+ args[i++] = "-s";
+ if (!edit) {
+ args[i++] = "-F";
+ args[i++] = defmsg;
+ }
+ args[i] = NULL;
+ return execv_git_cmd(args);
}
free(reencoded_message);