git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Handle "git show" output correctly.

From
Peter Jones <pjones@redhat.com>
Date
Sep 12, 2012, 18:00 UTC
Message-ID
<1347472823.12986.3.camel@eddie.install.bos.redhat.com>
In-Reply-To
<vpqpq5rz1ua.fsf@bauges.imag.fr>
On Wed, 2012-09-12 at 17:40 +0200, Matthieu Moy wrote:
Show 14 quoted lines
> 
> How does this react to multi-line subject, e.g
> 
> This should be the
> subject line.
> 
> And this is the body.
> 
> ?
> 
> git format-patch will merge the lines in a single Subject: header, and
> your version seems to take only the first line.
> 
> A test showing this would be welcome. 

An updated patch to fix this will be my next mail. It's not as succinct as it once was, but such is life.

The two attached commits to this message can be used as a test case. Basically, do (in any repo)

git am 0001* 0002* git show > foo.patch git reset HEAD^ --hard git am foo.patch git show # check the output here git format-patch -1 # check 0001-bar-bar-bar-this-is-a-very-very-long-line-I-am-tired.patch # here.

It winds up merging the subject lines before the rest of git-am does - I couldn't get it to work if I preserved the newline; for some reason I always get a second newline and that's /more/ wrong.

-- 
  Peter


>From f7521f88731f9fc696dcd8e32de58cc9d98ed892 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 12 Sep 2012 13:17:11 -0400
Subject: [PATCH 1/2] this is an example with a very long subject line which
 is completely unreasonable and nevertheless a thing.

It also has other stuff here.
---
 foo | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 foo

diff --git a/foo b/foo
new file mode 100644
index 0000000..fa5ef85
--- /dev/null
+++ b/foo
@@ -0,0 +1 @@
+    za za za
-- 
1.7.11.4



>From bc471f2b89ada6e6ddf35b5ec2538242b5639836 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 12 Sep 2012 13:39:56 -0400
Subject: [PATCH 2/2] bar bar bar this is a very very long line I am tired of
 this game and it is quite annoying.

this is really annoying.  I hate perl.
    zonk.

yes.
    no.
---
 foo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/foo b/foo
index fa5ef85..3b572f4 100644
--- a/foo
+++ b/foo
@@ -1 +1,2 @@
     za za za
+    bar bar bar
-- 
1.7.11.4
Previous: Matthieu MoyNext: Peter Jones
Message 11 of 21 in “Handle "git show" output correctly.”
  1. Handle "git show" output correctly.Peter Jones, Sep 12, 2012
  2. Handle "git show" output correctly.Peter Jones, Sep 12, 2012
  3. Matthieu MoySep 12, 2012
  4. [git-am] Handle "git show" output correctlyPeter Jones, Sep 12, 2012
  5. Matthieu MoySep 12, 2012
  6. Junio C HamanoSep 12, 2012
  7. Peter JonesSep 12, 2012
  8. Junio C HamanoSep 12, 2012
  9. Handle "git show" output correctly.Peter Jones, Sep 12, 2012
  10. Matthieu MoySep 12, 2012
  11. Peter JonesSep 12, 2012
  12. git-am: Handle "git show" output correctlyPeter Jones, Sep 12, 2012
  13. Junio C HamanoSep 12, 2012
  14. Peter JonesSep 12, 2012
  15. git-am: Handle "git show" output correctlyPeter Jones, Sep 12, 2012
  16. Junio C HamanoSep 12, 2012
  17. Dan JohnsonSep 12, 2012
  18. Junio C HamanoSep 12, 2012
  19. Dan JohnsonSep 12, 2012
  20. Junio C HamanoSep 12, 2012
  21. Andreas EricssonSep 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.