git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
@ 2009-02-08  3:26 Jeremy White
  2009-02-08  5:10 ` Boyd Stephen Smith Jr.
  2009-02-10  1:41 ` Junio C Hamano
  0 siblings, 2 replies; 14+ messages in thread
From: Jeremy White @ 2009-02-08  3:26 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]


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(-)



[-- Attachment #2: 7ed4bdd60ca12e71e1438defefbf83075b39a60b.diff --]
[-- Type: text/x-patch, Size: 1864 bytes --]

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..c79895c 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 *default_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 && *value)
+			default_attach = xstrdup(value);
+		else
+			default_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 (default_attach) {
+		rev.mime_boundary = default_attach;
+		rev.no_inline = 1;
+	}
+
 	/*
 	 * Parse the arguments before setup_revisions(), or something
 	 * like "git format-patch -o a123 HEAD^.." may fail; a123 is


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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-08  3:26 Jeremy White
@ 2009-02-08  5:10 ` Boyd Stephen Smith Jr.
  2009-02-08 16:01   ` Jeremy White
  2009-02-10  1:41 ` Junio C Hamano
  1 sibling, 1 reply; 14+ messages in thread
From: Boyd Stephen Smith Jr. @ 2009-02-08  5:10 UTC (permalink / raw)
  To: Jeremy White; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

For a minor style issue, see my reply to your original patch.

Also, please read Documentation/SubmittingPatches.  Particularly, the third 
point under the "Patch" heading on the first page.  Also, since you appear to 
sympathize with Thunderbird users you might want to read the "Thunderbird" 
section, and either improve it or petition the developers to make the 
application more amenable to users needs in this case.
-- 
Boyd Stephen Smith Jr.                   ,= ,-_-. =.
bss@iguanasuicide.net                   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy         `-'(. .)`-'
http://iguanasuicide.net/                    \_/


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-08  5:10 ` Boyd Stephen Smith Jr.
@ 2009-02-08 16:01   ` Jeremy White
  2009-02-08 17:28     ` Johannes Schindelin
  0 siblings, 1 reply; 14+ messages in thread
From: Jeremy White @ 2009-02-08 16:01 UTC (permalink / raw)
  To: Boyd Stephen Smith Jr.; +Cc: git

Boyd Stephen Smith Jr. wrote:
> For a minor style issue, see my reply to your original patch.

Sure, thanks.

> 
> Also, please read Documentation/SubmittingPatches.  Particularly, the third 
> point under the "Patch" heading on the first page.  Also, since you appear to 
> sympathize with Thunderbird users you might want to read the "Thunderbird" 
> section, and either improve it or petition the developers to make the 
> application more amenable to users needs in this case.

Sorry about that; I allowed my pleasure at the cuteness of using my own
patch to send the patch override the requested courtesy of this list.

As an aside, there is a long (and discouraging) read about the issue
with Thunderbird here:
  https://bugzilla.mozilla.org/show_bug.cgi?id=141983

Essentially, the problem is well understood - Thunderbird uses
format=flowed by default, which is what mangles the patches.  The author
of the relevant code is unmoved by arguments that the default should
switch, and no one has yet been willing to create a simpler UI for
switching the setting.

Cheers,

Jeremy

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-08 16:01   ` Jeremy White
@ 2009-02-08 17:28     ` Johannes Schindelin
  2009-02-09 12:34       ` Michael J Gruber
  0 siblings, 1 reply; 14+ messages in thread
From: Johannes Schindelin @ 2009-02-08 17:28 UTC (permalink / raw)
  To: Jeremy White; +Cc: Boyd Stephen Smith Jr., git, mozeditor, ben.bucksch

Hi,

On Sun, 8 Feb 2009, Jeremy White wrote:

> As an aside, there is a long (and discouraging) read about the issue
> with Thunderbird here:
>   https://bugzilla.mozilla.org/show_bug.cgi?id=141983
> 
> Essentially, the problem is well understood - Thunderbird uses
> format=flowed by default, which is what mangles the patches.  The author
> of the relevant code is unmoved by arguments that the default should
> switch, and no one has yet been willing to create a simpler UI for
> switching the setting.

I guess I'll start discouraging use of Thunderbird from now on.  Seems 
that not even the opposition of a guy named Andrew Morton was clue bat 
enough.

Ciao,
Dscho

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-08 17:28     ` Johannes Schindelin
@ 2009-02-09 12:34       ` Michael J Gruber
  2009-02-09 13:25         ` Ben Bucksch
  0 siblings, 1 reply; 14+ messages in thread
From: Michael J Gruber @ 2009-02-09 12:34 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Jeremy White, Boyd Stephen Smith Jr., git, mozeditor, ben.bucksch

Johannes Schindelin venit, vidit, dixit 08.02.2009 18:28:
> Hi,
> 
> On Sun, 8 Feb 2009, Jeremy White wrote:
> 
>> As an aside, there is a long (and discouraging) read about the issue
>> with Thunderbird here:
>>   https://bugzilla.mozilla.org/show_bug.cgi?id=141983
>>
>> Essentially, the problem is well understood - Thunderbird uses
>> format=flowed by default, which is what mangles the patches.  The author
>> of the relevant code is unmoved by arguments that the default should
>> switch, and no one has yet been willing to create a simpler UI for
>> switching the setting.
> 
> I guess I'll start discouraging use of Thunderbird from now on. 

...specifically for patch submission, please ;)
I'm a TB user who compiles the beast and writes extensions for it, and
yet I found git-send-email the more reliable and practical solution for
sending out patches. Put yourself in bcc and you'll have a copy in TB's
inbox or another folder (use filters).

> Seems 
> that not even the opposition of a guy named Andrew Morton was clue bat 
> enough.

<sarcasm style="reality: exaggerated;">
Isn't that some Linux guy? How would he matter for Mozilla? Does he even
know how to send HTML mail...
</sarcasm>

Michael

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-09 12:34       ` Michael J Gruber
@ 2009-02-09 13:25         ` Ben Bucksch
  2009-02-09 13:36           ` Johannes Schindelin
  0 siblings, 1 reply; 14+ messages in thread
From: Ben Bucksch @ 2009-02-09 13:25 UTC (permalink / raw)
  To: Michael J Gruber
  Cc: Johannes Schindelin, Jeremy White, Boyd Stephen Smith Jr., git,
	mozeditor

On 09.02.2009 13:34, Michael J Gruber wrote:
> Johannes Schindelin venit, vidit, dixit 08.02.2009 18:28:
>    
>> On Sun, 8 Feb 2009, Jeremy White wrote
>>> Essentially, the problem is well understood - Thunderbird uses
>>> format=flowed by default, which is what mangles the patches.
>>>        
>> I guess I'll start discouraging use of Thunderbird from now on.

Or you could just publish:
1. Prefs | Advanced | General | Config Editor...
2. "mailnews.send_plaintext_flowed" = false

The defaults should be best for the average user, not the rare 
programmer, who has no problem changing prefs.

f=f helps the normal user (and more importantly his recipient) by 
properly flowing text, which allows me to read with line lengths which 
are comfortable to read for me. It harms only in rare cases where 
line-endings are very important, *but* are not explicitly marked so. I 
think you can switch to "preformat" in the HTML editor and it would 
work, because we then know it's not flowing text, but I haven't tried 
it, because I attach such documents as txt / diff files.

As inline attachments, they'll show up inline in the msg viewer as well 
(which means I can read and copy&paste them), but are clearly separated 
from the body (which is assumed to be human-created natural language 
text), avoiding the problem mentioned here, and can easily be saved as 
file, opened in an external app etc.. I don't know why you didn't choose 
that way, but I assume you had your reasons. Just as we had our reasons 
for choosing f=f.

> I found git-send-email the more reliable and practical solution for 
> sending out patches. Put yourself in bcc and you'll have a copy in 
> TB's inbox or another folder (use filters).

Yup, I think that's the best way - git is using email only as protocol, 
so it's good to have special clients to that, as it's a really special use.

> <sarcasm style="reality: exaggerated;">
> Isn't that some Linux guy? How would he matter for Mozilla? Does he even
> know how to send HTML mail...
> </sarcasm>
>    
I don't think it's a matter of clue, it's a matter of background and 
attitude.

Ben

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig  for git-format-patch.
  2009-02-09 13:25         ` Ben Bucksch
@ 2009-02-09 13:36           ` Johannes Schindelin
  2009-02-09 13:50             ` Michael J Gruber
  2009-02-09 13:52             ` Ben Bucksch
  0 siblings, 2 replies; 14+ messages in thread
From: Johannes Schindelin @ 2009-02-09 13:36 UTC (permalink / raw)
  To: Ben Bucksch; +Cc: Michael J Gruber, Jeremy White, Boyd Stephen Smith Jr., git

Hi,

On Mon, 9 Feb 2009, Ben Bucksch wrote:

> On 09.02.2009 13:34, Michael J Gruber wrote:
> > Johannes Schindelin venit, vidit, dixit 08.02.2009 18:28:
> >    
> > > On Sun, 8 Feb 2009, Jeremy White wrote
> > > > Essentially, the problem is well understood - Thunderbird uses
> > > > format=flowed by default, which is what mangles the patches.
> > > >        
> > > I guess I'll start discouraging use of Thunderbird from now on.
> 
> Or you could just publish:
> 1. Prefs | Advanced | General | Config Editor...
> 2. "mailnews.send_plaintext_flowed" = false

Ah.  Mhm...

> As inline attachments, they'll show up inline in the msg viewer as well 

... which is a moot point, as the responder has to do extra work to quote 
the stuff.  Definitely not my type of friendliness.

> > I found git-send-email the more reliable and practical solution for 
> > sending out patches. Put yourself in bcc and you'll have a copy in 
> > TB's inbox or another folder (use filters).
> 
> Yup, I think that's the best way - git is using email only as protocol, so
> it's good to have special clients to that, as it's a really special use.

Aha.  And putting extra comments in (manually) does not count.  'cause I 
do not see send-email allowing that.

> > <sarcasm style="reality: exaggerated;">
> > Isn't that some Linux guy? How would he matter for Mozilla? Does he even
> > know how to send HTML mail...
> > </sarcasm>
> >    
>
> I don't think it's a matter of clue, it's a matter of background and 
> attitude.

Yeah, I think my background dictates that I stay by my word and recommend 
other mailers than Thunderbird.

It is one thing to be nice to the "average" user, but another one to be 
unfriendly to the people making the internet revolution possible.

Ciao,
Dscho

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-09 13:36           ` Johannes Schindelin
@ 2009-02-09 13:50             ` Michael J Gruber
  2009-02-09 14:39               ` Boyd Stephen Smith Jr.
  2009-02-09 13:52             ` Ben Bucksch
  1 sibling, 1 reply; 14+ messages in thread
From: Michael J Gruber @ 2009-02-09 13:50 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Ben Bucksch, Jeremy White, Boyd Stephen Smith Jr., git

Johannes Schindelin venit, vidit, dixit 09.02.2009 14:36:
> Hi,
> 
> On Mon, 9 Feb 2009, Ben Bucksch wrote:
> 
>> On 09.02.2009 13:34, Michael J Gruber wrote:
>>> Johannes Schindelin venit, vidit, dixit 08.02.2009 18:28:
>>>    
>>>> On Sun, 8 Feb 2009, Jeremy White wrote
>>>>> Essentially, the problem is well understood - Thunderbird uses
>>>>> format=flowed by default, which is what mangles the patches.
>>>>>        
>>>> I guess I'll start discouraging use of Thunderbird from now on.
>> Or you could just publish:
>> 1. Prefs | Advanced | General | Config Editor...
>> 2. "mailnews.send_plaintext_flowed" = false
> 
> Ah.  Mhm...
> 
>> As inline attachments, they'll show up inline in the msg viewer as well 
> 
> ... which is a moot point, as the responder has to do extra work to quote 
> the stuff.  Definitely not my type of friendliness.
> 
>>> I found git-send-email the more reliable and practical solution for 
>>> sending out patches. Put yourself in bcc and you'll have a copy in 
>>> TB's inbox or another folder (use filters).
>> Yup, I think that's the best way - git is using email only as protocol, so
>> it's good to have special clients to that, as it's a really special use.
> 
> Aha.  And putting extra comments in (manually) does not count.  'cause I 
> do not see send-email allowing that.

There is this useful thingy called "vim" which lets you edit the 00*
files... Come on, Dscho ;)

>>> <sarcasm style="reality: exaggerated;">
>>> Isn't that some Linux guy? How would he matter for Mozilla? Does he even
>>> know how to send HTML mail...
>>> </sarcasm>
>>>    
>> I don't think it's a matter of clue, it's a matter of background and 
>> attitude.
> 
> Yeah, I think my background dictates that I stay by my word and recommend 
> other mailers than Thunderbird.
> 
> It is one thing to be nice to the "average" user, but another one to be 
> unfriendly to the people making the internet revolution possible.

I think Ben made it clear why "format flowed" is the default, and there
are numerous posts in the TB/moz community which make it clear why they
spell it "format flawed".  The default will not change.

I thought about writing an extension which let's you change the config
on a per message basis. (You can already do it per folder using mnenhy,
I suppose.) But then I still have to navigate from TB to my repo and
include the output of git-format-patch, or dump it to an mbox (or upload
to an imap drafts folder).

So, even with f-f issues out of the way I would find git-send-email
(+vim) to be the right tool for the job. Which is why I use it, for
sending patches by e-mail, not for corresponding by e-mail.

So, let's be peaceful, and talk about Mozilla's choice of hg instead ;)
[No, please don't!]

Michael

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-09 13:36           ` Johannes Schindelin
  2009-02-09 13:50             ` Michael J Gruber
@ 2009-02-09 13:52             ` Ben Bucksch
  2009-02-09 14:49               ` Johannes Schindelin
  1 sibling, 1 reply; 14+ messages in thread
From: Ben Bucksch @ 2009-02-09 13:52 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Michael J Gruber, Jeremy White, Boyd Stephen Smith Jr., git

On 09.02.2009 14:36, Johannes Schindelin wrote:
> On Mon, 9 Feb 2009, Ben Bucksch wrote:
>    
>> Or you could just publish:
>> 1. Prefs | Advanced | General | Config Editor...
>> 2. "mailnews.send_plaintext_flowed" = false
>>      
> Ah.  Mhm...
>    
>> As inline attachments, they'll show up inline in the msg viewer as well
>>      
> ... which is a moot point, as the responder has to do extra work to quote
> the stuff.  Definitely not my type of friendliness.

In newer Thunderbirds, you can mark / select a text, and when you hit 
reply, it (and only that) will be quoted - called selective quote. You 
can press Ctrl-A (for Select All) before hitting reply, and the inline 
attachment will be included in the quote.

> I stay by my word and recommend other mailers than Thunderbird.
>    

Please be sure to also cite the pref change I mentioned above as 
alternative.

<diversion>
> It is one thing to be nice to the "average" user, but another one to be
> unfriendly to the people making the internet revolution possible.
>    
Hey now!

I hope you realize that Netscape / Mozilla had a really important role 
in making the Internet popular in the public in the first place (the 
alternatives were AOL and CompuServe back then), and that Mozilla is 
*the* most-used Open Source application. In fact, Firefox' market share 
on Windows made a large contribution to Linux, by convincing web sites 
authors to not assume IE, which is a big reason why Linux is usable at 
all. Imagine the web or email was only usable with IE or Outlook...
</diversion>

I use Linux myself everywhere, and recommend it to many people, and I 
think it's technically excellent.

BTW: I want to use this occasion to thank all you Linux programmers for 
your awesome, technically superiour work. Thanks a lot, and keep it up! :-)

Ben

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-09 13:50             ` Michael J Gruber
@ 2009-02-09 14:39               ` Boyd Stephen Smith Jr.
  0 siblings, 0 replies; 14+ messages in thread
From: Boyd Stephen Smith Jr. @ 2009-02-09 14:39 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Johannes Schindelin, Ben Bucksch, Jeremy White, git

[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]

On Monday 09 February 2009 07:50:09 Michael J Gruber wrote:
> Johannes Schindelin venit, vidit, dixit 09.02.2009 14:36:
> > On Mon, 9 Feb 2009, Ben Bucksch wrote:
> >> On 09.02.2009 13:34, Michael J Gruber wrote:
> >>> Johannes Schindelin venit, vidit, dixit 08.02.2009 18:28:
> >>>> On Sun, 8 Feb 2009, Jeremy White wrote
> >>>>> Essentially, the problem is well understood - Thunderbird uses
> >>>>> format=flowed by default, which is what mangles the patches.
> >>>> I guess I'll start discouraging use of Thunderbird from now on.
> >> Or you could just publish:
> >> 1. Prefs | Advanced | General | Config Editor...
> >> 2. "mailnews.send_plaintext_flowed" = false
> > Ah.  Mhm...
> >> I don't think it's a matter of clue, it's a matter of background and
> >> attitude.
> > Yeah, I think my background dictates that I stay by my word and recommend
> > other mailers than Thunderbird.
> I think Ben made it clear why "format flowed" is the default.
> The default will not change.

For the record, KMail does f=f by default, too.  And I think any client that 
doesn't do format=flowed by default it probably doing a disservice to it's 
users.  Luckily, in KMail it is easy to turn off for a particular message with 
"Options -> Word Wrap" in the composer window.  I think you can turn it off 
globally, but patches aren't a big enough part of my workflow that I've 
investigated it too much.
-- 
Boyd Stephen Smith Jr.                   ,= ,-_-. =.
bss@iguanasuicide.net                   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy         `-'(. .)`-'
http://iguanasuicide.net/                    \_/



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig  for git-format-patch.
  2009-02-09 13:52             ` Ben Bucksch
@ 2009-02-09 14:49               ` Johannes Schindelin
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Schindelin @ 2009-02-09 14:49 UTC (permalink / raw)
  To: Ben Bucksch; +Cc: Michael J Gruber, Jeremy White, Boyd Stephen Smith Jr., git

Hi,

On Mon, 9 Feb 2009, Ben Bucksch wrote:

> In newer Thunderbirds, you can mark / select a text, and when you hit reply,
> it (and only that) will be quoted - called selective quote.

Which would require the _recipient_ to choose Thunderbird, newer ones, as 
their mail program.

Hey, it is a free world, I like Firefox, for example, and you would have 
to rip it out of my dead, cold hands.

I just do not care for Thunderbird, I started using pine a long time 
ago, too long to change now, but that is just my choice, I guess.

It's just for that really important workflow -- sending patches as easily 
commentable text that still works as input to GNU patch or git-apply -- 
that I will recommend against using Thunderbird, as there are other 
mailers which can do it without much clickety-click.

BTW in contrast to other people, I do not feel insulted that you chose Hg 
for Mozilla; as I said, it is a free world (as long as we can keep it that 
way, at least).

Ciao,
Dscho

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-08  3:26 Jeremy White
  2009-02-08  5:10 ` Boyd Stephen Smith Jr.
@ 2009-02-10  1:41 ` Junio C Hamano
  1 sibling, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2009-02-10  1:41 UTC (permalink / raw)
  To: Jeremy White; +Cc: git

Jeremy White <jwhite@codeweavers.com> writes:

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

Once you added this configuration, if you ever wanted to defeat it for a
single invocation, how would you do so?  Edit the configuration file
again?

Not that I am objecting to the patch, as I am unlikely to have such a
configuration, but are there people who need to send attachment sometimes
but not other times?  They can say --attach from the command line without
adding the configuraiton if they send their patch non-attached more often
than as an attachment, but if they most of the time need to attach but
sometimes need to send in-line, they do not have an easy way to do so.

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

* [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
@ 2009-02-12 15:51 Jeremy White
  2009-02-12 21:01 ` Junio C Hamano
  0 siblings, 1 reply; 14+ messages in thread
From: Jeremy White @ 2009-02-12 15:51 UTC (permalink / raw)
  To: git

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
---

This v2 patch reflects a concern from Junio that you could
not temporarily override the configuration setting.


 Documentation/git-format-patch.txt |   11 +++++++++--
 builtin-log.c                      |   19 +++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 11a7d77..f89f73c 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -10,7 +10,8 @@ SYNOPSIS
 --------
 [verse]
 'git format-patch' [-k] [-o <dir> | --stdout] [--thread]
-		   [--attach[=<boundary>] | --inline[=<boundary>]]
+		   [--attach[=<boundary>] | --inline[=<boundary>] |
+		     [--noattach]]
 		   [-s | --signoff] [<common diff options>]
 		   [-n | --numbered | -N | --no-numbered]
 		   [--start-number <n>] [--numbered-files]
@@ -117,6 +118,10 @@ include::diff-options.txt[]
 	which is the commit message and the patch itself in the
 	second part, with "Content-Disposition: attachment".
 
+--noattach::
+	Disable the creation of an attachment, overriding the
+	configuration setting.
+
 --inline[=<boundary>]::
 	Create multipart/mixed attachment, the first part of
 	which is the commit message and the patch itself in the
@@ -174,7 +179,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 +189,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..991543a 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 *default_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 && *value)
+			default_attach = xstrdup(value);
+		else
+			default_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 (default_attach) {
+		rev.mime_boundary = default_attach;
+		rev.no_inline = 1;
+	}
+
 	/*
 	 * Parse the arguments before setup_revisions(), or something
 	 * like "git format-patch -o a123 HEAD^.." may fail; a123 is
@@ -849,6 +864,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 			rev.mime_boundary = argv[i] + 9;
 			rev.no_inline = 1;
 		}
+		else if (!strcmp(argv[i], "--noattach")) {
+			rev.mime_boundary = NULL;
+			rev.no_inline = 0;
+		}
 		else if (!strcmp(argv[i], "--inline")) {
 			rev.mime_boundary = git_version_string;
 			rev.no_inline = 0;
-- 
1.6.2.rc0.57.g4ab7.dirty

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

* Re: [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch.
  2009-02-12 15:51 [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch Jeremy White
@ 2009-02-12 21:01 ` Junio C Hamano
  0 siblings, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2009-02-12 21:01 UTC (permalink / raw)
  To: Jeremy White; +Cc: git

Jeremy White <jwhite@codeweavers.com> writes:

> diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
> index 11a7d77..f89f73c 100644
> --- a/Documentation/git-format-patch.txt
> +++ b/Documentation/git-format-patch.txt
> @@ -10,7 +10,8 @@ SYNOPSIS
>  --------
>  [verse]
>  'git format-patch' [-k] [-o <dir> | --stdout] [--thread]
> -		   [--attach[=<boundary>] | --inline[=<boundary>]]
> +		   [--attach[=<boundary>] | --inline[=<boundary>] |
> +		     [--noattach]]

Hmph, don't we usually do this with --no-attach?  Especially when
format-patch starts using parse_options, I suspect that would be how the
API gives negated options natively.

If there are no other issues people find in this patch, I'll amend it to
use dash between no and attach and apply (hence no need to resend).

Thanks.

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

end of thread, other threads:[~2009-02-12 21:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-12 15:51 [PATCH v2] Enable setting attach as the default in .gitconfig for git-format-patch Jeremy White
2009-02-12 21:01 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2009-02-08  3:26 Jeremy White
2009-02-08  5:10 ` Boyd Stephen Smith Jr.
2009-02-08 16:01   ` Jeremy White
2009-02-08 17:28     ` Johannes Schindelin
2009-02-09 12:34       ` Michael J Gruber
2009-02-09 13:25         ` Ben Bucksch
2009-02-09 13:36           ` Johannes Schindelin
2009-02-09 13:50             ` Michael J Gruber
2009-02-09 14:39               ` Boyd Stephen Smith Jr.
2009-02-09 13:52             ` Ben Bucksch
2009-02-09 14:49               ` Johannes Schindelin
2009-02-10  1:41 ` Junio C Hamano

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).