[RFC] Add a suffix option to git-format-patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I use git quite a bit to track my changes and then use
git-format-patch to generate patches to send on to others.  For the
most part, it works great but I find myself constantly doing:

mv xxxx-foo.txt xxxx-foo.patch

Could we add an option to git-format-patch to use ".patch" as the file
suffix instead of ".txt"?  Something like the below?

josh

diff --git a/builtin-log.c b/builtin-log.c
index a59b4ac..4eb2d32 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -217,6 +217,7 @@ static int git_format_config(const char *var,
const char *value)

static FILE *realstdout = NULL;
static const char *output_directory = NULL;
+static int psuffix = 0;

static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
{
@@ -265,7 +266,11 @@ static void reopen_stdout(struct commit *commit,
int nr, int keep_subject)
		while (filename[len - 1] == '.' || filename[len - 1] == '-')
			len--;
	}
-	strcpy(filename + len, ".txt");
+
+	if (psuffix)
+		strcpy(filename + len, ".patch");
+	else
+		strcpy(filename + len, ".txt");
	fprintf(realstdout, "%s\n", filename);
	freopen(filename, "w", stdout);
}
@@ -436,6 +441,8 @@ int cmd_format_patch(int argc, const char **argv,
const char *prefix)
				die("Need a Message-Id for --in-reply-to");
			in_reply_to = argv[i];
		}
+		else if (!strcmp(argv[i], "--psuffix"))
+			psuffix = 1;
		else
			argv[j++] = argv[i];
	}
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]