built-in format-patch: various fixups.
- The --start-number handling introduced breakage in the normal code path. It started numbering at 0 when not --numbered, for example. - When generating one file per patch, we needlessly added an extra blank line in front for second and subsequent files. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
May 26, 2006 at 11:30 UTC
add5c8a562fc0e80ad4eb3d1e2a9f9f47df053a6
1 file changed
+11
-2
builtin-log.c
+11
-2
@@ -201,7 +201,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
201
}
202
argc = j;
203
204
- if (numbered && start_number < 0)
204
+ if (start_number < 0)
205
start_number = 1;
206
if (numbered && keep_subject < 0)
207
die ("-n and -k are mutually exclusive.");
@@ -233,12 +233,21 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
233
while (0 <= --nr) {
234
int shown;
235
commit = list[nr];
236
- rev.nr = rev.total - nr;
236
+ rev.nr = total - nr + (start_number - 1);
237
if (!use_stdout)
238
reopen_stdout(commit, rev.nr, keep_subject);
239
shown = log_tree_commit(&rev, commit);
240
free(commit->buffer);
241
commit->buffer = NULL;
242
+
243
+ /* We put one extra blank line between formatted
244
+ * patches and this flag is used by log-tree code
245
+ * to see if it needs to emit a LF before showing
246
+ * the log; when using one file per patch, we do
247
+ * not want the extra blank line.
248
+ */
249
+ if (!use_stdout)
250
+ rev.shown_one = 0;
251
if (shown) {
252
if (rev.mime_boundary)
253
printf("\n--%s%s--\n\n\n",