summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2aa73a8)
raw | patch | inline | side by side (parent: 2aa73a8)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 17 Jan 2007 19:12:03 +0000 (11:12 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 17 Jan 2007 20:03:26 +0000 (12:03 -0800) |
The default can also be changed with "format.suffix" configuration.
Leaving it empty would not add any suffix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Leaving it empty would not add any suffix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-format-patch.txt | patch | blob | history | |
builtin-log.c | patch | blob | history |
index 67425dc0359ee9774200e1a2e12913d570117e7c..23acb47528fc2e3beafe4d85a26152cb718b3e72 100644 (file)
[verse]
'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [--thread]
[-s | --signoff] [--diff-options] [--start-number <n>]
- [--in-reply-to=Message-Id]
+ [--in-reply-to=Message-Id] [--suffix=.<sfx>]
<since>[..<until>]
DESCRIPTION
reply to the given Message-Id, which avoids breaking threads to
provide a new patch series.
+--suffix=.<sfx>::
+ Instead of using `.txt` as the suffix for generated
+ filenames, use specifed suffix. A common alternative is
+ `--suffix=.patch`.
++
+Note that you would need to include the leading dot `.` if you
+want a filename like `0001-description-of-my-change.patch`, and
+the first letter does not have to be a dot. Leaving it empty would
+not add any suffix.
+
CONFIGURATION
-------------
You can specify extra mail header lines to be added to each
[format]
headers = "Organization: git-foo\n"
+You can specify default suffix used:
+
+[format]
+ suffix = .patch
+
EXAMPLES
--------
diff --git a/builtin-log.c b/builtin-log.c
index a59b4acef1bc45f07f15e10c0501aa23de3eed7d..7397a5af07c1bd1889d5c0bc2959060401f48829 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
static char *extra_headers = NULL;
static int extra_headers_size = 0;
+static const char *fmt_patch_suffix = ".txt";
static int git_format_config(const char *var, const char *value)
{
strcat(extra_headers, value);
return 0;
}
+ if (!strcmp(var, "format.suffix")) {
+ if (!value)
+ die("format.suffix without value");
+ fmt_patch_suffix = xstrdup(value);
+ return 0;
+ }
if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
return 0;
}
char filename[1024];
char *sol;
int len = 0;
+ int suffix_len = strlen(fmt_patch_suffix) + 10; /* ., NUL and slop */
if (output_directory) {
- strlcpy(filename, output_directory, 1010);
+ strlcpy(filename, output_directory, 1000);
len = strlen(filename);
if (filename[len - 1] != '/')
filename[len++] = '/';
}
}
- for (j = 0; len < 1024 - 6 && sol[j] && sol[j] != '\n'; j++) {
+ for (j = 0;
+ len < sizeof(filename) - suffix_len &&
+ sol[j] && sol[j] != '\n';
+ j++) {
if (istitlechar(sol[j])) {
if (space) {
filename[len++] = '-';
while (filename[len - 1] == '.' || filename[len - 1] == '-')
len--;
}
- strcpy(filename + len, ".txt");
+ strcpy(filename + len, fmt_patch_suffix);
fprintf(realstdout, "%s\n", filename);
freopen(filename, "w", stdout);
}
die("Need a Message-Id for --in-reply-to");
in_reply_to = argv[i];
}
+ else if (!strncmp(argv[i], "--suffix=", 9))
+ fmt_patch_suffix = argv[i] + 9;
else
argv[j++] = argv[i];
}