# [PATCH] Enable setting attach in .gitconfig for git-format-patch.

4 messages from 2009-02-07 to 2009-02-08. Participants: Jeremy White, Johannes Schindelin, Boyd Stephen Smith Jr..
Thread: https://gitlist.dev/t/17639

## Jeremy White, 2009-02-07 21:56

Subject: [PATCH] Enable setting attach in .gitconfig for git-format-patch.
Message-ID: <498E038F.3090704@codeweavers.com>
URL: https://gitlist.dev/e/498E038F.3090704%40codeweavers.com

```
In an attempt to keep us Thunderbird users from embarrassing ourselves.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
---
  Documentation/git-format-patch.txt |    4 +++-
  builtin-log.c                      |   15 +++++++++++++++
  2 files changed, 18 insertions(+), 1 deletions(-)




diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 11a7d77..2e8e94e 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -174,7 +174,8 @@ CONFIGURATION
 -------------
 You can specify extra mail header lines to be added to each message
 in the repository configuration, new defaults for the subject prefix
-and file suffix, and number patches when outputting more than one.
+and file suffix, control attachements, and number patches when outputting
+more than one.
 
 ------------
 [format]
@@ -183,6 +184,7 @@ and file suffix, and number patches when outputting more than one.
 	suffix = .txt
 	numbered = auto
 	cc = <email>
+	attach [ = mime-boundary-string ]
 ------------
 
 
diff --git a/builtin-log.c b/builtin-log.c
index 2ae39af..1a8adde 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -428,6 +428,8 @@ static const char *fmt_patch_suffix = ".patch";
 static int numbered = 0;
 static int auto_number = 1;
 
+static char *extra_attach = NULL;
+
 static char **extra_hdr;
 static int extra_hdr_nr;
 static int extra_hdr_alloc;
@@ -488,6 +490,14 @@ static int git_format_config(const char *var, const char *value, void *cb)
 		auto_number = auto_number && numbered;
 		return 0;
 	}
+	if (!strcmp(var, "format.attach")) {
+		if (value && strlen(value) > 0)
+			extra_attach = xstrdup(value);
+		else
+			extra_attach = xstrdup(git_version_string);
+		return 0;
+	}
+
 
 	return git_log_config(var, value, cb);
 }
@@ -787,6 +797,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
 	rev.subject_prefix = fmt_patch_subject_prefix;
 
+	if (extra_attach) {
+		rev.mime_boundary = extra_attach;
+		rev.no_inline = 1;
+	}
+
 	/*
 	 * Parse the arguments before setup_revisions(), or something
 	 * like "git format-patch -o a123 HEAD^.." may fail; a123 is


```

## Johannes Schindelin, 2009-02-07 22:45

Subject: Re: [PATCH] Enable setting attach in .gitconfig for git-format-patch.
Message-ID: <alpine.DEB.1.00.0902072344350.10279@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0902072344350.10279%40pacific.mpi-cbg.de
In-Reply-To: <498E038F.3090704@codeweavers.com>

```
Hi,

On Sat, 7 Feb 2009, Jeremy White wrote:

> In an attempt to keep us Thunderbird users from embarrassing ourselves.
> 
> Signed-off-by: Jeremy White <jwhite@codeweavers.com>
> ---
>  Documentation/git-format-patch.txt |    4 +++-
>  builtin-log.c                      |   15 +++++++++++++++
>  2 files changed, 18 insertions(+), 1 deletions(-)

Pity.  You attached the patch.  So I do not quote the part where you use a 
strlen() > 0 which would better be a *value.  But it would be nice to fix 
the issue.

Ciao,
Dscho

```

## Jeremy White, 2009-02-08 03:24

Subject: Re: [PATCH] Enable setting attach in .gitconfig for git-format-patch.
Message-ID: <498E507A.8080200@codeweavers.com>
URL: https://gitlist.dev/e/498E507A.8080200%40codeweavers.com
In-Reply-To: <alpine.DEB.1.00.0902072344350.10279@pacific.mpi-cbg.de>

```
> Pity.  You attached the patch.  So I do not quote the part where you use a 
> strlen() > 0 which would better be a *value.  But it would be nice to fix 
> the issue.

That's a good point; I'll resend. Thanks for the review.

Cheers,

Jeremy

```

## Boyd Stephen Smith Jr., 2009-02-08 04:50

Subject: Re: [PATCH] Enable setting attach in .gitconfig for git-format-patch.
Message-ID: <200902072250.53902.bss@iguanasuicide.net>
URL: https://gitlist.dev/e/200902072250.53902.bss%40iguanasuicide.net
In-Reply-To: <498E038F.3090704@codeweavers.com>

```
On Saturday 07 February 2009 15:56:31 Jeremy White wrote:
> +static char *extra_attach = NULL;

The initializer is just noise here, yes?  If the " = NULL" is not needed, we 
generally drop it.
-- 
Boyd Stephen Smith Jr.                   ,= ,-_-. =.
bss@iguanasuicide.net                   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy         `-'(. .)`-'
http://iguanasuicide.net/                    \_/


```
