{"thread":{"id":"1726","subject":"[PATCH] Make sure the diff machinery outputs \"\\ No newline ...\" in english","startedAt":"2005-09-04T18:17:24Z","lastAt":"2005-09-06T20:05:49Z","messageCount":5,"participants":["Fredrik Kuivinen","Junio C Hamano","Linus Torvalds","Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"8059","messageId":"20050904181724.GA23525@c165.ib.student.liu.se","threadId":"1726","inReplyTo":null,"subject":"[PATCH] Make sure the diff machinery outputs \"\\ No newline ...\" in english","fromName":"Fredrik Kuivinen","fromEmail":"freku045@student.liu.se","sentAt":"2005-09-04T18:17:24Z","receivedAt":"2005-09-04T18:17:24Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"In non-english locales diff(1) do sometimes output \"\\ No newline at end of\nfile\" in some other language. Set LC_ALL to C before execing diff to avoid\nthis behaviour.\n\nSigned-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\n\n---\n\n diff.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\neb6261334d65c3134d9dd822fd64e33ed8ad2dfc\ndiff --git a/diff.c b/diff.c\n--- a/diff.c\n+++ b/diff.c\n@@ -207,6 +207,7 @@ static void builtin_diff(const char *nam\n \t\t}\n \t}\n \tfflush(NULL);\n+\tputenv(\"LC_ALL=C\");\n \texeclp(\"/bin/sh\",\"sh\", \"-c\", cmd, NULL);\n }\n \n"},{"id":"8062","messageId":"7vd5nohdp3.fsf@assigned-by-dhcp.cox.net","threadId":"1726","inReplyTo":"20050904181724.GA23525@c165.ib.student.liu.se","subject":"Re: [PATCH] Make sure the diff machinery outputs \"\\ No newline ...\" in english","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-04T18:48:08Z","receivedAt":"2005-09-04T18:48:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fredrik Kuivinen <freku045@student.liu.se> writes:\n\n> In non-english locales diff(1) do sometimes output \"\\ No newline at end of\n> file\" in some other language. Set LC_ALL to C before execing diff to avoid\n> this behaviour.\n>\n> Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n\nI was thinking about this when I was examining your other patch.\n\nWhat else, other than the incomplete line marker (and timestamp\noutput it uses by default, which we disable by passing explicit\n-L flags), are affected by locale in diff output?\n\nEspecially, if the diff output is more readable for human\nconsumers (i.e. reviewers) without making it harder to use to\nmachine consumers (i.e. patch or git-apply) when generated under\na locale that is 'native' to the data, this patch robs from\nusers the possibility of doing so.\n\nIOW, in a Swedes-only project that tracks a document in Swedish,\nit _might_ be friendlier and more useful to the users if allowed\ngenerating diffs under sv_SE locale, as long as such a diff does\nnot make the processing by patch and git-apply more difficult\n(which your other patch already solved for git-apply).\n"},{"id":"8084","messageId":"20050905060149.GB1875@c165.ib.student.liu.se","threadId":"1726","inReplyTo":"7vd5nohdp3.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Make sure the diff machinery outputs \"\\ No newline ...\" in english","fromName":"Fredrik Kuivinen","fromEmail":"freku045@student.liu.se","sentAt":"2005-09-05T06:01:49Z","receivedAt":"2005-09-05T06:01:49Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"On Sun, Sep 04, 2005 at 11:48:08AM -0700, Junio C Hamano wrote:\n> Fredrik Kuivinen <freku045@student.liu.se> writes:\n> \n> > In non-english locales diff(1) do sometimes output \"\\ No newline at end of\n> > file\" in some other language. Set LC_ALL to C before execing diff to avoid\n> > this behaviour.\n> >\n> > Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>\n> \n> I was thinking about this when I was examining your other patch.\n> \n> What else, other than the incomplete line marker (and timestamp\n> output it uses by default, which we disable by passing explicit\n> -L flags), are affected by locale in diff output?\n\nAfter a quick look through the diff source I didn't find anything\nelse. It's quite possible that I haved missed something though. Most\nof the translated messages are related to error reporting, which I\nguess might be nice to have in the user specified language.\n\n> Especially, if the diff output is more readable for human\n> consumers (i.e. reviewers) without making it harder to use to\n> machine consumers (i.e. patch or git-apply) when generated under\n> a locale that is 'native' to the data, this patch robs from\n> users the possibility of doing so.\n> \n> IOW, in a Swedes-only project that tracks a document in Swedish,\n> it _might_ be friendlier and more useful to the users if allowed\n> generating diffs under sv_SE locale, as long as such a diff does\n> not make the processing by patch and git-apply more difficult\n> (which your other patch already solved for git-apply).\n\nI agree that it's kind of evil to remove the option of generating the\noutput in some other language.\n\nAnother possibility is to set LC_MESSAGES to C instead. If we go this\nway the user can override it by setting LC_ALL. The difference is that\nin most configurations the user has to make an active choice to get\nthe 'native' language output and english will be the default.\n\n- Fredrik\n"},{"id":"8093","messageId":"Pine.LNX.4.58.0509050849500.3568@evo.osdl.org","threadId":"1726","inReplyTo":"20050905060149.GB1875@c165.ib.student.liu.se","subject":"Re: [PATCH] Make sure the diff machinery outputs \"\\ No newline ...\" in english","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-09-05T15:52:34Z","receivedAt":"2005-09-05T15:52:34Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 5 Sep 2005, Fredrik Kuivinen wrote:\n> \n> After a quick look through the diff source I didn't find anything\n> else. It's quite possible that I haved missed something though. Most\n> of the translated messages are related to error reporting, which I\n> guess might be nice to have in the user specified language.\n\nIs it possible that we could integrate the \"diff\" algorithm into git, and \nget rid of the dependency on an external GNU diff? It would also make the \nportability problems go away (ie old diff's being broken).\n\nIt would also potentially speed up the normal built-in diff a lot, since\nwe wouldn't have to execute a whole other program to generate a diff, just\ncall a helper function the way we do for xdiff..\n\nUnreasonable?\n\n\t\tLinus\n"},{"id":"8136","messageId":"Pine.LNX.4.63.0509061534560.23242@iabervon.org","threadId":"1726","inReplyTo":"Pine.LNX.4.58.0509050849500.3568@evo.osdl.org","subject":"Re: [PATCH] Make sure the diff machinery outputs \"\\ No newline ...\" in english","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-09-06T20:05:49Z","receivedAt":"2005-09-06T20:05:49Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 5 Sep 2005, Linus Torvalds wrote:\n\n> On Mon, 5 Sep 2005, Fredrik Kuivinen wrote:\n> > \n> > After a quick look through the diff source I didn't find anything\n> > else. It's quite possible that I haved missed something though. Most\n> > of the translated messages are related to error reporting, which I\n> > guess might be nice to have in the user specified language.\n> \n> Is it possible that we could integrate the \"diff\" algorithm into git, and \n> get rid of the dependency on an external GNU diff? It would also make the \n> portability problems go away (ie old diff's being broken).\n> \n> It would also potentially speed up the normal built-in diff a lot, since\n> we wouldn't have to execute a whole other program to generate a diff, just\n> call a helper function the way we do for xdiff..\n> \n> Unreasonable?\n\nThe algorithm actually used by GNU diff is pretty complicated, and I don't \nreally understand the actual implementation, which evidentally has a few \nimportant refinements over the original paper.\n\nI've written my own diff, mainly to try a different algorithm, and it \nseems to work, but the code isn't yet appropriate to submit. This \nalgorithm also has the advantage that it can identify moved sections and \nis less interested in interleaving a removed function with a new function \nto provide the shortest possible diff. I expect that I could get it to \nwork if I put in a day on it; it's mostly writing a hashtable \nimplementation for non-NULL-terminated string-keyed hash tables.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"}]}