aboutsummaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-05-31 15:11:49 -0700
committerJunio C Hamano <junkio@cox.net>2006-05-31 15:11:49 -0700
commitcf2251b60460e651a5e00afe9ef7c427ad296711 (patch)
tree6bcc3bd800305035ba84e657d3e027de131e93eb /builtin-log.c
parent1361fa3e49717de9588e6d925073eb6885cedaa3 (diff)
downloadgit-cf2251b60460e651a5e00afe9ef7c427ad296711.tar.gz
git-cf2251b60460e651a5e00afe9ef7c427ad296711.tar.xz
format-patch --signoff
This resurrects --signoff option to format-patch. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/builtin-log.c b/builtin-log.c
index db1912a05..ac4822dea 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -150,6 +150,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
int numbered = 0;
int start_number = -1;
int keep_subject = 0;
+ char *add_signoff = NULL;
init_revisions(&rev);
rev.commit_format = CMIT_FMT_EMAIL;
@@ -179,11 +180,13 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
if (i == argc)
die("Need a number for --start-number");
start_number = strtol(argv[i], NULL, 10);
- } else if (!strcmp(argv[i], "-k") ||
+ }
+ else if (!strcmp(argv[i], "-k") ||
!strcmp(argv[i], "--keep-subject")) {
keep_subject = 1;
rev.total = -1;
- } else if (!strcmp(argv[i], "-o")) {
+ }
+ else if (!strcmp(argv[i], "-o")) {
if (argc < 3)
die ("Which directory?");
if (mkdir(argv[i + 1], 0777) < 0 && errno != EEXIST)
@@ -192,6 +195,16 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
output_directory = strdup(argv[i + 1]);
i++;
}
+ else if (!strcmp(argv[i], "--signoff") ||
+ !strcmp(argv[i], "-s")) {
+ const char *committer = git_committer_info(1);
+ const char *endpos = strchr(committer, '>');
+ if (!endpos)
+ die("bogos committer info %s\n", committer);
+ add_signoff = xmalloc(endpos - committer + 2);
+ memcpy(add_signoff, committer, endpos - committer + 1);
+ add_signoff[endpos - committer + 1] = 0;
+ }
else if (!strcmp(argv[i], "--attach"))
rev.mime_boundary = git_version_string;
else if (!strncmp(argv[i], "--attach=", 9))
@@ -230,6 +243,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
total = nr;
if (numbered)
rev.total = total + start_number - 1;
+ rev.add_signoff = add_signoff;
while (0 <= --nr) {
int shown;
commit = list[nr];