summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-05-20 15:40:29 +0200
committerJunio C Hamano <junkio@cox.net>2006-05-21 02:03:09 -0700
commit698ce6f87e0d6db380f7306e190e8586da184577 (patch)
tree14171dae273827471bea4021a325b4d4a6c2c7d4 /builtin-log.c
parent328b710d800dc3786fe2b8595e5553dc4a4af424 (diff)
downloadgit-698ce6f87e0d6db380f7306e190e8586da184577.tar.gz
fmt-patch: Support --attach
This patch touches a couple of files, because it adds options to print a custom text just after the subject of a commit, and just after the diffstat. [jc: made "many dashes" used as the boundary leader into a single variable, to reduce the possibility of later tweaks to miscount the number of dashes to break it.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 12a6d19203..c8feb0f795 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -183,7 +183,12 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
argv[i + 1]);
output_directory = strdup(argv[i + 1]);
i++;
- } else
+ }
+ else if (!strcmp(argv[i], "--attach"))
+ rev.mime_boundary = git_version_string;
+ else if (!strncmp(argv[i], "--attach=", 9))
+ rev.mime_boundary = argv[i] + 9;
+ else
argv[j++] = argv[i];
}
argc = j;
@@ -224,8 +229,14 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
shown = log_tree_commit(&rev, commit);
free(commit->buffer);
commit->buffer = NULL;
- if (shown)
- printf("-- \n%s\n\n", git_version_string);
+ if (shown) {
+ if (rev.mime_boundary)
+ printf("\n--%s%s--\n\n\n",
+ mime_boundary_leader,
+ rev.mime_boundary);
+ else
+ printf("-- \n%s\n\n", git_version_string);
+ }
if (!use_stdout)
fclose(stdout);
}