mirror of
https://github.com/git/git.git
synced 2024-10-28 21:07:52 +01:00
Merge branch 'wk/pull-signoff'
"git pull" has been taught to accept "--[no-]signoff" option and pass it down to "git merge". * wk/pull-signoff: pull: pass --signoff/--no-signoff to "git merge"
This commit is contained in:
commit
fb4cd88ad4
4 changed files with 61 additions and 8 deletions
|
@ -64,14 +64,6 @@ OPTIONS
|
||||||
-------
|
-------
|
||||||
include::merge-options.txt[]
|
include::merge-options.txt[]
|
||||||
|
|
||||||
--signoff::
|
|
||||||
Add Signed-off-by line by the committer at the end of the commit
|
|
||||||
log message. The meaning of a signoff depends on the project,
|
|
||||||
but it typically certifies that committer has
|
|
||||||
the rights to submit this work under the same license and
|
|
||||||
agrees to a Developer Certificate of Origin
|
|
||||||
(see http://developercertificate.org/ for more information).
|
|
||||||
|
|
||||||
-m <msg>::
|
-m <msg>::
|
||||||
Set the commit message to be used for the merge commit (in
|
Set the commit message to be used for the merge commit (in
|
||||||
case one is created).
|
case one is created).
|
||||||
|
|
|
@ -57,6 +57,16 @@ set to `no` at the beginning of them.
|
||||||
With --no-log do not list one-line descriptions from the
|
With --no-log do not list one-line descriptions from the
|
||||||
actual commits being merged.
|
actual commits being merged.
|
||||||
|
|
||||||
|
--signoff::
|
||||||
|
--no-signoff::
|
||||||
|
Add Signed-off-by line by the committer at the end of the commit
|
||||||
|
log message. The meaning of a signoff depends on the project,
|
||||||
|
but it typically certifies that committer has
|
||||||
|
the rights to submit this work under the same license and
|
||||||
|
agrees to a Developer Certificate of Origin
|
||||||
|
(see http://developercertificate.org/ for more information).
|
||||||
|
+
|
||||||
|
With --no-signoff do not add a Signed-off-by line.
|
||||||
|
|
||||||
--stat::
|
--stat::
|
||||||
-n::
|
-n::
|
||||||
|
|
|
@ -86,6 +86,7 @@ static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
|
||||||
static enum rebase_type opt_rebase = -1;
|
static enum rebase_type opt_rebase = -1;
|
||||||
static char *opt_diffstat;
|
static char *opt_diffstat;
|
||||||
static char *opt_log;
|
static char *opt_log;
|
||||||
|
static char *opt_signoff;
|
||||||
static char *opt_squash;
|
static char *opt_squash;
|
||||||
static char *opt_commit;
|
static char *opt_commit;
|
||||||
static char *opt_edit;
|
static char *opt_edit;
|
||||||
|
@ -142,6 +143,9 @@ static struct option pull_options[] = {
|
||||||
OPT_PASSTHRU(0, "log", &opt_log, N_("n"),
|
OPT_PASSTHRU(0, "log", &opt_log, N_("n"),
|
||||||
N_("add (at most <n>) entries from shortlog to merge commit message"),
|
N_("add (at most <n>) entries from shortlog to merge commit message"),
|
||||||
PARSE_OPT_OPTARG),
|
PARSE_OPT_OPTARG),
|
||||||
|
OPT_PASSTHRU(0, "signoff", &opt_signoff, NULL,
|
||||||
|
N_("add Signed-off-by:"),
|
||||||
|
PARSE_OPT_OPTARG),
|
||||||
OPT_PASSTHRU(0, "squash", &opt_squash, NULL,
|
OPT_PASSTHRU(0, "squash", &opt_squash, NULL,
|
||||||
N_("create a single commit instead of doing a merge"),
|
N_("create a single commit instead of doing a merge"),
|
||||||
PARSE_OPT_NOARG),
|
PARSE_OPT_NOARG),
|
||||||
|
@ -594,6 +598,8 @@ static int run_merge(void)
|
||||||
argv_array_push(&args, opt_diffstat);
|
argv_array_push(&args, opt_diffstat);
|
||||||
if (opt_log)
|
if (opt_log)
|
||||||
argv_array_push(&args, opt_log);
|
argv_array_push(&args, opt_log);
|
||||||
|
if (opt_signoff)
|
||||||
|
argv_array_push(&args, opt_signoff);
|
||||||
if (opt_squash)
|
if (opt_squash)
|
||||||
argv_array_push(&args, opt_squash);
|
argv_array_push(&args, opt_squash);
|
||||||
if (opt_commit)
|
if (opt_commit)
|
||||||
|
|
|
@ -165,4 +165,49 @@ test_expect_success 'git pull --allow-unrelated-histories' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git pull does not add a sign-off line' '
|
||||||
|
test_when_finished "rm -fr src dst actual" &&
|
||||||
|
git init src &&
|
||||||
|
test_commit -C src one &&
|
||||||
|
git clone src dst &&
|
||||||
|
test_commit -C src two &&
|
||||||
|
git -C dst pull --no-ff &&
|
||||||
|
git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
|
||||||
|
test_must_be_empty actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git pull --no-signoff does not add sign-off line' '
|
||||||
|
test_when_finished "rm -fr src dst actual" &&
|
||||||
|
git init src &&
|
||||||
|
test_commit -C src one &&
|
||||||
|
git clone src dst &&
|
||||||
|
test_commit -C src two &&
|
||||||
|
git -C dst pull --no-signoff --no-ff &&
|
||||||
|
git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
|
||||||
|
test_must_be_empty actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git pull --signoff add a sign-off line' '
|
||||||
|
test_when_finished "rm -fr src dst expected actual" &&
|
||||||
|
echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected &&
|
||||||
|
git init src &&
|
||||||
|
test_commit -C src one &&
|
||||||
|
git clone src dst &&
|
||||||
|
test_commit -C src two &&
|
||||||
|
git -C dst pull --signoff --no-ff &&
|
||||||
|
git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git pull --no-signoff flag cancels --signoff flag' '
|
||||||
|
test_when_finished "rm -fr src dst actual" &&
|
||||||
|
git init src &&
|
||||||
|
test_commit -C src one &&
|
||||||
|
git clone src dst &&
|
||||||
|
test_commit -C src two &&
|
||||||
|
git -C dst pull --signoff --no-signoff --no-ff &&
|
||||||
|
git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
|
||||||
|
test_must_be_empty actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue