git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Add a suffix option to git-format-patch
@ 2007-01-17 13:10 Josh Boyer
  2007-01-17 13:49 ` Johannes Schindelin
  2007-01-17 15:43 ` [RFC] Add a suffix option to git-format-patch David Kågedal
  0 siblings, 2 replies; 59+ messages in thread
From: Josh Boyer @ 2007-01-17 13:10 UTC (permalink / raw)
  To: Git Mailing List

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];
 	}

^ permalink raw reply related	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2007-01-19 10:11 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-17 13:10 [RFC] Add a suffix option to git-format-patch Josh Boyer
2007-01-17 13:49 ` Johannes Schindelin
2007-01-17 14:50   ` Josh Boyer
2007-01-17 16:39   ` Horst H. von Brand
2007-01-17 19:18   ` [PATCH] Introduce 'git-format-patch --suffix=patch' Junio C Hamano
2007-01-17 19:20     ` Andy Whitcroft
2007-01-17 19:27       ` Junio C Hamano
2007-01-17 19:51         ` Brian Gernhardt
2007-01-17 19:57           ` Junio C Hamano
2007-01-17 20:08             ` Brian Gernhardt
2007-01-17 20:22     ` [PATCH] Make format-patch --suffix="" not add any suffix Brian Gernhardt
2007-01-18  1:11     ` [PATCH] Introduce 'git-format-patch --suffix=patch' Johannes Schindelin
2007-01-17 15:43 ` [RFC] Add a suffix option to git-format-patch David Kågedal
2007-01-17 16:57   ` Andreas Ericsson
2007-01-17 17:05     ` Johannes Schindelin
2007-01-17 17:33   ` Junio C Hamano
2007-01-17 18:15     ` David Kågedal
2007-01-17 20:18     ` Josh Boyer
2007-01-17 20:20       ` Josh Boyer
     [not found]       ` <7vsle9p8pg.fsf@assigned-by-dhcp.cox.net>
2007-01-18  0:06         ` [PATCH/POLL] git-format-patch: the default suffix is now .patch, not .txt Junio C Hamano
2007-01-18  1:06           ` Johannes Schindelin
2007-01-18  7:59           ` Alex Riesen
2007-01-18  8:06             ` Shawn O. Pearce
2007-01-18  8:18               ` Alex Riesen
2007-01-18  9:10                 ` Junio C Hamano
2007-01-18  9:21                   ` Alex Riesen
2007-01-18  8:43             ` Junio C Hamano
2007-01-18  9:35               ` Alex Riesen
2007-01-18 11:52                 ` Josh Boyer
2007-01-18 13:33                   ` Johannes Schindelin
2007-01-18 13:46                     ` Alex Riesen
2007-01-18 13:40                   ` Alex Riesen
2007-01-18 14:10                     ` Andreas Ericsson
2007-01-18 14:15                       ` Johannes Schindelin
2007-01-18 14:41                       ` Alex Riesen
2007-01-18 14:49                         ` Johannes Schindelin
2007-01-18 14:53                           ` Alex Riesen
2007-01-18 15:16                             ` Johannes Schindelin
2007-01-18 15:37                               ` Alex Riesen
2007-01-18 15:42                                 ` Josh Boyer
2007-01-18 20:03                                   ` Johannes Schindelin
2007-01-18 20:12                                     ` Josh Boyer
2007-01-18 15:26                         ` Shawn O. Pearce
2007-01-18 15:52                           ` Alex Riesen
2007-01-18 19:29                             ` Steven Grimm
2007-01-18 19:57                               ` Johannes Schindelin
2007-01-18 16:09                           ` Johannes Sixt
2007-01-19 10:11                         ` Jakub Narebski
2007-01-18 15:42                     ` Shawn O. Pearce
2007-01-18 16:05                       ` Alex Riesen
2007-01-18 16:29                       ` Andreas Ericsson
2007-01-18 16:51                         ` Shawn O. Pearce
2007-01-18 17:03                           ` Andreas Ericsson
2007-01-18 19:30                           ` Martin Langhoff
2007-01-18 19:19                         ` Martin Langhoff
2007-01-18 12:40               ` Andreas Ericsson
2007-01-18 15:10                 ` Lukas Sandström
2007-01-18 15:29                 ` Brian Gernhardt
2007-01-18  9:57             ` Alexandre Julliard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).