mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
Merge branch 'jm/format-patch-no-auto-n-when-k-is-given' into maint
* jm/format-patch-no-auto-n-when-k-is-given: format-patch let -k override a config-specified format.numbered
This commit is contained in:
commit
597a178246
|
@ -755,6 +755,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||||
int cover_letter = 0;
|
int cover_letter = 0;
|
||||||
int boundary_count = 0;
|
int boundary_count = 0;
|
||||||
int no_binary_diff = 0;
|
int no_binary_diff = 0;
|
||||||
|
int numbered_cmdline_opt = 0;
|
||||||
struct commit *origin = NULL, *head = NULL;
|
struct commit *origin = NULL, *head = NULL;
|
||||||
const char *in_reply_to = NULL;
|
const char *in_reply_to = NULL;
|
||||||
struct patch_ids ids;
|
struct patch_ids ids;
|
||||||
|
@ -786,8 +787,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||||
if (!strcmp(argv[i], "--stdout"))
|
if (!strcmp(argv[i], "--stdout"))
|
||||||
use_stdout = 1;
|
use_stdout = 1;
|
||||||
else if (!strcmp(argv[i], "-n") ||
|
else if (!strcmp(argv[i], "-n") ||
|
||||||
!strcmp(argv[i], "--numbered"))
|
!strcmp(argv[i], "--numbered")) {
|
||||||
numbered = 1;
|
numbered = 1;
|
||||||
|
numbered_cmdline_opt = 1;
|
||||||
|
}
|
||||||
else if (!strcmp(argv[i], "-N") ||
|
else if (!strcmp(argv[i], "-N") ||
|
||||||
!strcmp(argv[i], "--no-numbered")) {
|
!strcmp(argv[i], "--no-numbered")) {
|
||||||
numbered = 0;
|
numbered = 0;
|
||||||
|
@ -918,6 +921,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
if (start_number < 0)
|
if (start_number < 0)
|
||||||
start_number = 1;
|
start_number = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If numbered is set solely due to format.numbered in config,
|
||||||
|
* and it would conflict with --keep-subject (-k) from the
|
||||||
|
* command line, reset "numbered".
|
||||||
|
*/
|
||||||
|
if (numbered && keep_subject && !numbered_cmdline_opt)
|
||||||
|
numbered = 0;
|
||||||
|
|
||||||
if (numbered && keep_subject)
|
if (numbered && keep_subject)
|
||||||
die ("-n and -k are mutually exclusive.");
|
die ("-n and -k are mutually exclusive.");
|
||||||
if (keep_subject && subject_prefix)
|
if (keep_subject && subject_prefix)
|
||||||
|
|
|
@ -86,6 +86,13 @@ test_expect_success 'format.numbered && --no-numbered' '
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'format.numbered && --keep-subject' '
|
||||||
|
|
||||||
|
git format-patch --keep-subject --stdout HEAD^ >patch4a &&
|
||||||
|
grep "^Subject: Third" patch4a
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'format.numbered = auto' '
|
test_expect_success 'format.numbered = auto' '
|
||||||
|
|
||||||
git config format.numbered auto
|
git config format.numbered auto
|
||||||
|
|
Loading…
Reference in a new issue