summaryrefslogtreecommitdiff
path: root/tools/mailinfo.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-17 05:18:27 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-08-17 05:22:35 (GMT)
commit6bff6a60680ef402f614abae8189c2cb198cfa49 (patch)
treea78ad829aefcc7ae100fe9b6547ee3f0cb0b5738 /tools/mailinfo.c
parent9577e7e3db2299febdc17539478bba38874d4120 (diff)
downloadgit-6bff6a60680ef402f614abae8189c2cb198cfa49.zip
git-6bff6a60680ef402f614abae8189c2cb198cfa49.tar.gz
git-6bff6a60680ef402f614abae8189c2cb198cfa49.tar.bz2
Teach applymbox to keep the Subject: line.
This corresponds to the -k flag to git format-patch --mbox option. The option should probably not be used when applying a real e-mail patch, but is needed when format-patch and applymbox pair is used for cherrypicking. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'tools/mailinfo.c')
-rw-r--r--tools/mailinfo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/mailinfo.c b/tools/mailinfo.c
index fb2ea2b..a36123a 100644
--- a/tools/mailinfo.c
+++ b/tools/mailinfo.c
@@ -9,6 +9,7 @@
static FILE *cmitmsg, *patchfile;
+static int keep_subject = 0;
static char line[1000];
static char date[1000];
static char name[1000];
@@ -101,6 +102,8 @@ static void check_line(char *line, int len)
static char * cleanup_subject(char *subject)
{
+ if (keep_subject)
+ return subject;
for (;;) {
char *p;
int len, remove;
@@ -242,8 +245,20 @@ static void usage(void)
exit(1);
}
+static const char mailinfo_usage[] =
+"git-mailinfo [-k] msg patch <mail >info";
int main(int argc, char ** argv)
{
+ while (1 < argc && argv[1][0] == '-') {
+ if (!strcmp(argv[1], "-k"))
+ keep_subject = 1;
+ else {
+ fprintf(stderr, "usage: %s\n", mailinfo_usage);
+ exit(1);
+ }
+ argc--; argv++;
+ }
+
if (argc != 3)
usage();
cmitmsg = fopen(argv[1], "w");