Re: git-format-patch possible regressions
- From
- Marco Costalba <mcostalba@gmail.com>
- Date
- May 27, 2006, 09:12 UTC
- Message-ID
- <e5bfff550605270212n267661rd0463a301cbe1b95@mail.gmail.com>
- In-Reply-To
- <7v4pzdqpit.fsf@assigned-by-dhcp.cox.net>
On 5/26/06, Junio C Hamano <junkio@cox.net> wrote:
Show 6 quoted lines
> > What Johannes and I were discussing was the other number -- the > total in the series. IOW, y in "[PATCH x/y]". OTOH, the number > used for disambiguation you care about is x, which is made > adjustable with --start-number patch. >
New --start-number patch says:
"Since the "a..b c..d" syntax is interpreted as "b ^a d ^c" as other range-ish commands, if you want to format a..b and then c..d and end up with files consecutively numbered, the second run needs to be able to tell the command what number to start from.
This does not imply --numbered (which gives [PATCH n/m] to the subject)."
Actually it seems that --numbered is needed anyway.
$ git-format-patch HEAD^..HEAD 0000-git-format-patch-start-number-n.txt $ git-format-patch --start-number=7 HEAD^..HEAD 0000-git-format-patch-start-number-n.txt $ git-format-patch --numbered --start-number=7 HEAD^..HEAD 0007-git-format-patch-start-number-n.txt
But with numbered also the patch subject is changed with added [PATCH n/m] that is not needed.
Also mutually exclusive check is not performed git-format-patch -n -k HEAD^..HEAD 0001-git-format-patch-start-number-n.txt
This patch should fix all.
Subject: [PATCH] Let git-format-patch --start-number option to work also without --numbered
While there also fix the check for mutually exclusive -n and -k option
Signed-off-by: Marco Costalba <mcostalba@gmail.com> --- builtin-log.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c index 71f4ff9..c35733f 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -148,7 +148,7 @@ int cmd_format_patch(int argc, const cha int nr = 0, total, i, j; int use_stdout = 0; int numbered = 0; - int start_number = -1; + int start_number = 0; int keep_subject = 0; init_revisions(&rev); @@ -201,9 +201,9 @@ int cmd_format_patch(int argc, const cha } argc = j; - if (numbered && start_number < 0) + if (numbered && start_number == 0) start_number = 1; - if (numbered && keep_subject < 0) + if (numbered && keep_subject) die ("-n and -k are mutually exclusive."); argc = setup_revisions(argc, argv, &rev, "HEAD"); @@ -233,7 +233,7 @@ int cmd_format_patch(int argc, const cha while (0 <= --nr) { int shown; commit = list[nr]; - rev.nr = rev.total - nr; + rev.nr = start_number + total - nr - 1; if (!use_stdout) reopen_stdout(commit, rev.nr, keep_subject); shown = log_tree_commit(&rev, commit);
-- 1.3.3.gfa0f-dirty