# Dubious format-patch options

5 messages from 2008-06-13 to 2008-06-13. Participants: Jon Loeliger, Junio C Hamano, Linus Torvalds, Jeff King.
Thread: https://gitlist.dev/t/13926

## Jon Loeliger, 2008-06-13 01:14

Subject: Dubious format-patch options
Message-ID: <E1K6xrt-00033S-2J@jdl.com>
URL: https://gitlist.dev/e/E1K6xrt-00033S-2J%40jdl.com

```
Git-ites,

Hmmm... There are a ton of dubious options being accepted
by the "git format-patch" command due to it being a skinny
front to "git log".  Like, the -S and pick-axe crew:

Yeah, this is context-less, but my point is that we get
totally different behavior from the -S"string" here:

    $ git log -SC alt~1..HEAD
    commit bca87c386c8868664e64d397108b8e6deda1e574
    Author: Jon Loeliger <jdl@jdl.com>
    Date:   Thu Jun 12 17:57:57 2008 -0500

	C
versus

    $ git format-patch -SC alt~1..HEAD
    0001-C.patch
    0002-D.patch
    0003-Z.patch
    0004-F.patch

Oh yeah.

And --color is a cool thing too.  I mean, I was pleasantly
pleased with:

    $ git format-patch -1 --stdout --color master

But I seriously doubt that we _really_ want to send a
patch that has the embedded escape sequences in it:

    From: Jon Loeliger <jdl@jdl.com>
    Date: Thu, 12 Jun 2008 18:13:10 -0500
    Subject: [PATCH] F

    ---
     fileESC[m |    1 ESC[32m+ESC[m
     1 files changed, 1 insertions(+), 0 deletions(-)ESC[m

    ESC[1mdiff --git a/file b/fileESC[m
    ESC[1mindex 6ac15b9..65f21da 100644ESC[m
    ESC[1m--- a/fileESC[m
    ESC[1m+++ b/fileESC[m
    ESC[36m@@ -5,3 +5,4 @@ D
    ESC[m X
    ESC[m Y
    ESC[m Z
    ESC[mESC[32m+ESC[mESC[32mFESC[m
    -- 
    1.5.6.rc0.46.gd2b3

Oh yeah.  Another Vodka Tonic please while git-send-email that...

jdl

```

## Junio C Hamano, 2008-06-13 02:05

Subject: Re: Dubious format-patch options
Message-ID: <7vzlpqxf6y.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vzlpqxf6y.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <E1K6xrt-00033S-2J@jdl.com>

```
Jon Loeliger <jdl@jdl.com> writes:

> Git-ites,
>
> Hmmm... There are a ton of dubious options being accepted
> by the "git format-patch" command due to it being a skinny
> front to "git log".  Like, the -S and pick-axe crew:
> ...
> Oh yeah.
>
> And --color is a cool thing too.  I mean, I was pleasantly
> pleased with:

Amusing ;-).

```

## Linus Torvalds, 2008-06-13 02:24

Subject: Re: Dubious format-patch options
Message-ID: <alpine.LFD.1.10.0806121923400.2949@woody.linux-foundation.org>
URL: https://gitlist.dev/e/alpine.LFD.1.10.0806121923400.2949%40woody.linux-foundation.org
In-Reply-To: <E1K6xrt-00033S-2J@jdl.com>

```


On Thu, 12 Jun 2008, Jon Loeliger wrote:
> 
>     $ git format-patch -1 --stdout --color master
> 
> But I seriously doubt that we _really_ want to send a
> patch that has the embedded escape sequences in it:

Hey, you asked for it, you got it. I hope you're not complaining.

		Linus

```

## Junio C Hamano, 2008-06-13 03:01

Subject: Re: Dubious format-patch options
Message-ID: <7vtzfyxckm.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vtzfyxckm.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.LFD.1.10.0806121923400.2949@woody.linux-foundation.org>

```
Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Thu, 12 Jun 2008, Jon Loeliger wrote:
>> 
>>     $ git format-patch -1 --stdout --color master
>> 
>> But I seriously doubt that we _really_ want to send a
>> patch that has the embedded escape sequences in it:
>
> Hey, you asked for it, you got it. I hope you're not complaining.

Well, having said and heard all that, coming back to our more serious
selves...

I think being able to do

    $ git -p format-patch --stdout --color -2 HEAD

makes some sense.  Being able to produce an unusable patch by saying

    $ git format-patch --stat old..

at the first glance is of quite dubious value, but even that would make
sense as a good input source for "commit log automailer".

I think I know where Jon is coming from and where he wants to go.  While I
am somewhat sympathetic to the cause of adding some warning or safety
valve to prevent nonsense option combinations from being given, I am not
sure we can draw a line to classify options into black and white.

```

## Jeff King, 2008-06-13 06:33

Subject: Re: Dubious format-patch options
Message-ID: <20080613063337.GE26768@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20080613063337.GE26768%40sigill.intra.peff.net
In-Reply-To: <7vtzfyxckm.fsf@gitster.siamese.dyndns.org>

```
On Thu, Jun 12, 2008 at 08:01:45PM -0700, Junio C Hamano wrote:

> makes some sense.  Being able to produce an unusable patch by saying
> 
>     $ git format-patch --stat old..
> 
> at the first glance is of quite dubious value, but even that would make
> sense as a good input source for "commit log automailer".
> 
> I think I know where Jon is coming from and where he wants to go.  While I
> am somewhat sympathetic to the cause of adding some warning or safety
> valve to prevent nonsense option combinations from being given, I am not
> sure we can draw a line to classify options into black and white.

I am against a safety valve here. For example, I have the following
alias:

  format-patch --pretty=format:%s%n%n%b

which obviously does not generate a valid email, but which I use for
pulling "how about this?" patches directly into existing emails
(otherwise, I have to delete the header cruft myself). Yes, I _could_ do
this with git-log, but format-patch has slightly different command line
semantics. And it most clearly expresses what I want: the patch
submission format, but with the header bits pretty-printed differently.

My point being that this flexibility _is_ useful, and I am not sure it
is worth removing it in favor of people who get confused about why

  git format-patch --pretty=format:%s%n%n%b origin | git send-email

doesn't work.

-Peff

```
