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

Re: Diff filename has trailing tab if filename contains space

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 5, 2016, 00:32 UTC
Message-ID
<xmqqa8mdydbz.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAHtLG6TLAOA0hg897EntOjG1kJsZEmjDshc-yyO9zP27540AAg@mail.gmail.com>
乙酸鋰 <ch3cooli@gmail.com> writes:
Show 5 quoted lines
> Hi,
>
> Using git 2.7.1
>
> Diff filename has trailing tab if filename contains space
Thanks; that is very much deliberate and has been with us forever.
commit 1a9eb3b9d50367bee8fe85022684d812816fe531
Author: Junio C Hamano <junkio@cox.net>
Date:   Fri Sep 22 16:17:58 2006 -0700
    git-diff/git-apply: make diff output a bit friendlier to GNU patch (part 2)
    
    Somebody was wondering on #git channel why a git generated diff
    does not apply with GNU patch when the filename contains a SP.
    It is because GNU patch expects to find TAB (and trailing timestamp)
    on ---/+++ (old_name and new_name) lines after the filenames.
    
    The "diff --git" output format was carefully designed to be
    compatible with GNU patch where it can, but whitespace
    characters were always a pain.
    
    This adds an extra TAB (but not trailing timestamp) to old_name
    and new_name lines of git-diff output when the filename has a SP
    in it.  An earlier patch updated git-apply to prepare for this.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Previous: 乙酸鋰
Message 2 of 2 in “Diff filename has trailing tab if filename contains space”
  1. 乙酸鋰Mar 4, 2016
  2. Junio C HamanoMar 5, 2016

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.