Merge branch 'dm/cherry-pick-s'
* dm/cherry-pick-s: Allow cherry-pick (and revert) to add signoff line
This commit is contained in:
commit
ca1a5eeead
@ -7,7 +7,7 @@ git-cherry-pick - Apply the change introduced by an existing commit
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git-cherry-pick' [--edit] [-n] [-m parent-number] [-x] <commit>
|
'git-cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] <commit>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
@ -64,6 +64,9 @@ OPTIONS
|
|||||||
This is useful when cherry-picking more than one commits'
|
This is useful when cherry-picking more than one commits'
|
||||||
effect to your working tree in a row.
|
effect to your working tree in a row.
|
||||||
|
|
||||||
|
-s|--signoff::
|
||||||
|
Add Signed-off-by line at the end of the commit message.
|
||||||
|
|
||||||
|
|
||||||
Author
|
Author
|
||||||
------
|
------
|
||||||
|
@ -7,7 +7,7 @@ git-revert - Revert an existing commit
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git-revert' [--edit | --no-edit] [-n] [-m parent-number] <commit>
|
'git-revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
@ -51,6 +51,9 @@ OPTIONS
|
|||||||
This is useful when reverting more than one commits'
|
This is useful when reverting more than one commits'
|
||||||
effect to your working tree in a row.
|
effect to your working tree in a row.
|
||||||
|
|
||||||
|
-s|--signoff::
|
||||||
|
Add Signed-off-by line at the end of the commit message.
|
||||||
|
|
||||||
|
|
||||||
Author
|
Author
|
||||||
------
|
------
|
||||||
|
@ -33,7 +33,7 @@ static const char * const cherry_pick_usage[] = {
|
|||||||
NULL
|
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 enum { REVERT, CHERRY_PICK } action;
|
||||||
static struct commit *commit;
|
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('e', "edit", &edit, "edit the commit message"),
|
||||||
OPT_BOOLEAN('x', NULL, &no_replay, "append commit name when cherry-picking"),
|
OPT_BOOLEAN('x', NULL, &no_replay, "append commit name when cherry-picking"),
|
||||||
OPT_BOOLEAN('r', NULL, &noop, "no-op (backward compatibility)"),
|
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_INTEGER('m', "mainline", &mainline, "parent number"),
|
||||||
OPT_END(),
|
OPT_END(),
|
||||||
};
|
};
|
||||||
@ -404,10 +405,19 @@ static int revert_or_cherry_pick(int argc, const char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!no_commit) {
|
if (!no_commit) {
|
||||||
if (edit)
|
/* 6 is max possible length of our args array including NULL */
|
||||||
return execl_git_cmd("commit", "-n", NULL);
|
const char *args[6];
|
||||||
else
|
int i = 0;
|
||||||
return execl_git_cmd("commit", "-n", "-F", defmsg, NULL);
|
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);
|
free(reencoded_message);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user