{"thread":{"id":"41616","subject":"Diff filename has trailing tab if filename contains space","startedAt":"2016-03-04T23:50:32Z","lastAt":"2016-03-05T00:32:00Z","messageCount":2,"participants":["乙酸鋰","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"280218","messageId":"CAHtLG6TLAOA0hg897EntOjG1kJsZEmjDshc-yyO9zP27540AAg@mail.gmail.com","threadId":"41616","inReplyTo":null,"subject":"Diff filename has trailing tab if filename contains space","fromName":"乙酸鋰","fromEmail":"ch3cooli@gmail.com","sentAt":"2016-03-04T23:50:32Z","receivedAt":"2016-03-04T23:50:32Z","isPatch":false,"sender":{"key":"ch3cooli@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2804967?v=4"},"body":"Hi,\n\nUsing git 2.7.1\n\nDiff filename has trailing tab if filename contains space\nPlease run below shell script\nand look at the output diff file 1.diff\nThere is trailing tab chars after these lines:\n--- a/8 1/8.txt\n+++ b/8 1/8.txt\n---- b/9 86\n+++ b/9 86\n\n\n\n#!/bin/sh\nset -e\ngit init\n\necho a >> \"normal\"\ngit add \"normal\"\necho y >> \"9 86\"\ngit add \"9 86\" # file name has space\nmkdir x\necho d >> \"x/normal\"\ngit add \"x/normal\"\nmkdir \"8 1\"\necho u >> \"8 1/8.txt\" # directory name has space\necho k >> \"8 1/8.txt\"\ngit add \"8 1/8.txt\"\ngit commit -m \"Initial commit\"\n\necho b >> \"normal\"\ngit add \"normal\"\necho c >> \"9 86\"\ngit add \"9 86\"\necho e >> \"x/normal\"\ngit add \"x/normal\"\necho h >> \"8 1/8.txt\"\ngit add \"8 1/8.txt\"\ngit commit -m \"Edit files\"\ngit diff master~1 > 1.diff\n"},{"id":"280220","messageId":"xmqqa8mdydbz.fsf@gitster.mtv.corp.google.com","threadId":"41616","inReplyTo":"CAHtLG6TLAOA0hg897EntOjG1kJsZEmjDshc-yyO9zP27540AAg@mail.gmail.com","subject":"Re: Diff filename has trailing tab if filename contains space","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-05T00:32:00Z","receivedAt":"2016-03-05T00:32:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"乙酸鋰 <ch3cooli@gmail.com> writes:\n\n> Hi,\n>\n> Using git 2.7.1\n>\n> Diff filename has trailing tab if filename contains space\n\nThanks; that is very much deliberate and has been with us forever.\n\ncommit 1a9eb3b9d50367bee8fe85022684d812816fe531\nAuthor: Junio C Hamano <junkio@cox.net>\nDate:   Fri Sep 22 16:17:58 2006 -0700\n\n    git-diff/git-apply: make diff output a bit friendlier to GNU patch (part 2)\n    \n    Somebody was wondering on #git channel why a git generated diff\n    does not apply with GNU patch when the filename contains a SP.\n    It is because GNU patch expects to find TAB (and trailing timestamp)\n    on ---/+++ (old_name and new_name) lines after the filenames.\n    \n    The \"diff --git\" output format was carefully designed to be\n    compatible with GNU patch where it can, but whitespace\n    characters were always a pain.\n    \n    This adds an extra TAB (but not trailing timestamp) to old_name\n    and new_name lines of git-diff output when the filename has a SP\n    in it.  An earlier patch updated git-apply to prepare for this.\n    \n    Signed-off-by: Junio C Hamano <junkio@cox.net>\n"}]}