[PATCH v2 2/4] Add format.coverauto boolean

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

 



If set to true, format-patch behaves like it had been started
using the --cover-letter option.

An exception is if it is called using the --stdout option,
which disables format.coverauto, because users of --stdout
(like git-rebase.sh) usually are not interested in
cover letters at all.

If you do want it anyway, you can use:
  % git format-patch --stdout --cover-letter

Signed-off-by: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
---
 builtin-log.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 157c8cf..52c0d47 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -483,6 +483,10 @@ static int git_format_config(const char *var, const char *value, void *cb)
 	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
 		return 0;
 	}
+	if (!strcmp(var, "format.coverauto")) {
+		cover_letter = git_config_bool(var, value);;
+		return 0;
+	}
 	if (!strcmp(var, "format.coverletter")) {
 		cover_letter_len = git_config_int(var, value);
 		return 0;
@@ -789,9 +793,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 	 * possibly a valid SHA1.
 	 */
 	for (i = 1, j = 1; i < argc; i++) {
-		if (!strcmp(argv[i], "--stdout"))
+		if (!strcmp(argv[i], "--stdout")) {
 			use_stdout = 1;
-		else if (!strcmp(argv[i], "-n") ||
+			cover_letter = 0;
+		} else if (!strcmp(argv[i], "-n") ||
 				!strcmp(argv[i], "--numbered"))
 			numbered = 1;
 		else if (!strcmp(argv[i], "-N") ||
-- 
1.6.2.2.446.gfbdc0

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