git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Atousa Duprat <atousa.p@gmail.com>
Cc: Animi Vulpis <animi.vulpis@gmail.com>, git@vger.kernel.org
Subject: Re: [Bug] git branch -v has problems with carriage returns
Date: Sat, 20 May 2017 08:48:46 +0200	[thread overview]
Message-ID: <3d02b958-5f72-9676-bce9-afca962c07df@kdbg.org> (raw)
In-Reply-To: <CA+izobvwRCwGEtpCbey=gFbCh9sHBb5xB1i1LpMG0JCUy0O2mQ@mail.gmail.com>

Am 19.05.2017 um 23:55 schrieb Atousa Duprat:
> I have tried to repro this issue but git goes out of its way to store
> the commit messages using unix end-of-line format.
> I think that git itself cannot create a repo exhibiting this problem.

Here is a recipe to reproduce the error:

   git init
   git commit --allow-empty -m initial
   git branch crlf $(printf '%s\r\n' subject '' line3_long line4 |
        git commit-tree HEAD:)

The reason for the "bug" is obviously that a line having CR in addition 
to LF is not "an empty line". Consequently, the second line is not 
treated as a separator between subject and body, whereupon Git 
concatenates all lines into one large subject line. This strips the LFs 
but leaves the CRs in tact, which, when printed on a terminal move the 
cursor to the beginning of the line, so that text after the CRs 
overwrites what is already in the terminal.

This is just to give you a head start. I'm not going to look into this.

-- Hannes

>> If I do `git branch -v` with such a subject line somehow the third and
>> second line get combined before the hash. Example:
>>
>> $ git branch -v
>> See merge request !XXXX temp space 84e18d22fd Merge branch
>> 'feature-XXX' into 'develop'
>> # <begins with third line> <ending of seconds line (if longer than
>> third)> <commit hash (correct)> <subject line (correct)>
>>
>> Before git v2.13.0 `git branch -v` worked completely normal.

  parent reply	other threads:[~2017-05-20  6:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 23:22 [Bug] git branch -v has problems with carriage returns Animi Vulpis
     [not found] ` <CA+izobutP-JY84RGG-JbPA5twbckL1uVwxknBRLVTuGG0MEJcg@mail.gmail.com>
     [not found]   ` <CA+izobuSKtoQzNJuvuisjh7h3FF=nbt8u-hOHfdeFp8ZjgZF+Q@mail.gmail.com>
     [not found]     ` <591f6844.82dcca0a.451e5.8f76.GMRIR@mx.google.com>
2017-05-19 21:51       ` Delivery Status Notification (Failure) Atousa Duprat
2017-05-19 21:55 ` [Bug] git branch -v has problems with carriage returns Atousa Duprat
2017-05-19 23:20   ` Animi Vulpis
2017-05-20  6:48   ` Johannes Sixt [this message]
2017-05-31  5:32     ` Atousa Duprat
2017-05-31 20:58       ` Stefan Beller
2017-06-01  1:31       ` Junio C Hamano
2017-05-21 13:42   ` [PATCH] ref-filter: treat CRLF as same as LF in find_subpos DOAN Tran Cong Danh
2017-05-22  1:19     ` Junio C Hamano
2017-05-22 11:29       ` DOAN Tran Cong Danh
2017-05-22 20:12       ` Jeff King
2017-05-23  1:49         ` Junio C Hamano
2017-05-23  2:01         ` Junio C Hamano
2017-05-23  3:01           ` Junio C Hamano
2017-05-21 14:10 ` DOAN Tran Cong Danh
2017-05-22 14:57   ` [PATCH v2] ref-filter: trim end whitespace in subject DOAN Tran Cong Danh
2017-05-22 17:10     ` [PATCH v3] " DOAN Tran Cong Danh
2017-05-22 19:47       ` Johannes Sixt
2017-05-22 19:53         ` Jeff King
2017-05-22 20:19           ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d02b958-5f72-9676-bce9-afca962c07df@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=animi.vulpis@gmail.com \
    --cc=atousa.p@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).