{"thread":{"id":"16889","subject":"[PATCH] Documentation/diff-options.txt: unify options","startedAt":"2008-12-27T20:12:50Z","lastAt":"2008-12-30T00:02:35Z","messageCount":8,"participants":["jidanni@jidanni.org","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"98806","messageId":"E1LGfY3-0001pM-S9@jidanni.org","threadId":"16889","inReplyTo":null,"subject":"[PATCH] Documentation/diff-options.txt: unify options","fromName":"","fromEmail":"jidanni@jidanni.org","sentAt":"2008-12-27T20:12:50Z","receivedAt":"2008-12-27T20:12:50Z","isPatch":true,"sender":{"key":"jidanni@jidanni.org","avatar":"https://gravatar.com/avatar/36568d4af4c8d3e71627ef3b8c8d00e39065b12f29676cccd38ced75e68fa2a6?d=mp&s=160"},"body":"\nSigned-off-by: jidanni <jidanni@jidanni.org>\n\ndiff --git a/diff-options.txt b/diff-options.txt\nindex 5721548..b05503a 100644\n--- a/diff-options.txt\n+++ b/diff-options.txt\n@@ -21,0 +22 @@ ifndef::git-format-patch[]\n+-u::\n@@ -26,3 +26,0 @@ endif::git-format-patch[]\n--u::\n-\tSynonym for \"-p\".\n-\n@@ -30,2 +27,0 @@ endif::git-format-patch[]\n-\tShorthand for \"--unified=<n>\".\n-\n@@ -189,0 +186 @@ endif::git-format-patch[]\n+-a::\n@@ -193,3 +189,0 @@ endif::git-format-patch[]\n--a::\n-\tShorthand for \"--text\".\n-\n@@ -198,0 +193 @@ endif::git-format-patch[]\n+-b::\n@@ -204,3 +199 @@ endif::git-format-patch[]\n--b::\n-\tShorthand for \"--ignore-space-change\".\n-\n+-w::\n@@ -212,3 +204,0 @@ endif::git-format-patch[]\n--w::\n-\tShorthand for \"--ignore-all-space\".\n-\n-- \n1.5.6.5\n"},{"id":"98813","messageId":"7vfxk9cm6w.fsf@gitster.siamese.dyndns.org","threadId":"16889","inReplyTo":"E1LGfY3-0001pM-S9@jidanni.org","subject":"Re: [PATCH] Documentation/diff-options.txt: unify options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-27T22:01:11Z","receivedAt":"2008-12-27T22:01:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"jidanni@jidanni.org writes:\n\n> Signed-off-by: jidanni <jidanni@jidanni.org>\n>\n> diff --git a/diff-options.txt b/diff-options.txt\n> index 5721548..b05503a 100644\n> --- a/diff-options.txt\n> +++ b/diff-options.txt\n> @@ -21,0 +22 @@ ifndef::git-format-patch[]\n> +-u::\n> @@ -26,3 +26,0 @@ endif::git-format-patch[]\n> --u::\n> -\tSynonym for \"-p\".\n> -\n\nSorry, but this patch is very unusual in that it lacks any context lines,\nwhich makes it impossible to review.\n"},{"id":"98814","messageId":"87lju1jmp9.fsf@jidanni.org","threadId":"16889","inReplyTo":"7vfxk9cm6w.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Documentation/diff-options.txt: unify options","fromName":"","fromEmail":"jidanni@jidanni.org","sentAt":"2008-12-27T22:08:18Z","receivedAt":"2008-12-27T22:08:18Z","isPatch":true,"sender":{"key":"jidanni@jidanni.org","avatar":"https://gravatar.com/avatar/36568d4af4c8d3e71627ef3b8c8d00e39065b12f29676cccd38ced75e68fa2a6?d=mp&s=160"},"body":"JCH> Sorry, but this patch is very unusual in that it lacks any context lines,\nJCH> which makes it impossible to review.\n\nTrust me, I tried it with the default context lines and it was just\nthe same hard reading. OK, next time I send patches for other files, I\nwill always use the default and forget about saving bytes.\n"},{"id":"98830","messageId":"7vvdt4aj0e.fsf@gitster.siamese.dyndns.org","threadId":"16889","inReplyTo":"87lju1jmp9.fsf@jidanni.org","subject":"Re: [PATCH] Documentation/diff-options.txt: unify options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-28T06:52:49Z","receivedAt":"2008-12-28T06:52:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"jidanni@jidanni.org writes:\n\n> JCH> Sorry, but this patch is very unusual in that it lacks any context lines,\n> JCH> which makes it impossible to review.\n>\n> Trust me, I tried it with the default context lines and it was just\n> the same hard reading.\n\nNonsense.\n\nHere is a snippet from your patch.\n\n        diff --git a/diff-options.txt b/diff-options.txt\n        index 5721548..b05503a 100644\n        --- a/diff-options.txt\n        +++ b/diff-options.txt\n        @@ -21,0 +22 @@ ifndef::git-format-patch[]\n        +-u::\n        @@ -26,3 +26,0 @@ endif::git-format-patch[]\n        --u::\n        -\tSynonym for \"-p\".\n        -\n\nThe only thing anybody can guess without looking at the original (that is\nwhat \"sending a patch without context\" means) is that you moved \"-u::\" to\nsomewhere else, and stripped of its description.  There is absolutely no\nclue to judge if the new home to \"-u::\" is an appropriate place.\n\nIn a normal patch with context, the same hunk would have looked like this:\n\n        diff --git i/Documentation/diff-options.txt w/Documentation/diff-options.txt\n        index c62b45c..c4ca0a9 100644\n        --- i/Documentation/diff-options.txt\n        +++ w/Documentation/diff-options.txt\n        @@ -19,16 +19,12 @@ endif::git-format-patch[]\n\n         ifndef::git-format-patch[]\n         -p::\n        +-u::\n                Generate patch (see section on generating patches).\n                {git-diff? This is the default.}\n         endif::git-format-patch[]\n\n        --u::\n        -\tSynonym for \"-p\".\n        -\n         -U<n>::\n        -\tShorthand for \"--unified=<n>\".\n        -\n         --unified=<n>::\n\nPresented this way, it is much more clear what is going on, as there is no\nneed to go back to the original and see if the new location for \"-u::\"\nmakes sense (and I think it does, but that is something I can say after\napplying the patch and reviewing the result, because the patch itself is\nnot reviewable).\n\nIf you find yours just as easy to read as the one with context, your patch\nreading ability far exceeds mine, and I'd refuse to read your patches in\nthe future to preserve my sanity.\n\nThere is another issue that should be obvious to people who deal with\npatches every day.  The context-free patch you sent can be applied *ONLY*\nafter locating the *EXACT* preimage of the file you used to produce your\npatch.  Before your patch is reviewed, other people may have already\nmodified the same file, perhaps introducing a few new lines at the top of\nthe file, and then what?  Your first hunk tells us that you would want to\ninsert a line with \"-u::\" at line #21, but the context does not match\nanymore when your patch is reviewed.\n"},{"id":"98863","messageId":"8763l331l6.fsf@jidanni.org","threadId":"16889","inReplyTo":"7vvdt4aj0e.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Documentation/diff-options.txt: unify options","fromName":"","fromEmail":"jidanni@jidanni.org","sentAt":"2008-12-29T07:03:17Z","receivedAt":"2008-12-29T07:03:17Z","isPatch":true,"sender":{"key":"jidanni@jidanni.org","avatar":"https://gravatar.com/avatar/36568d4af4c8d3e71627ef3b8c8d00e39065b12f29676cccd38ced75e68fa2a6?d=mp&s=160"},"body":"(You were right about my previous patch being bad.\nAt least git-am gives an error message when fed\nhttp://article.gmane.org/gmane.comp.version-control.git/104017/raw\ngit-apply however does nothing and returns 0! Must be a bug.)\nOK, here's a better patch:\n\nSigned-off-by: jidanni <jidanni@jidanni.org>\n---\n Documentation/diff-options.txt |   18 ++++--------------\n 1 files changed, 4 insertions(+), 14 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex c62b45c..b432d25 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -19,16 +19,12 @@ endif::git-format-patch[]\n \n ifndef::git-format-patch[]\n -p::\n+-u::\n \tGenerate patch (see section on generating patches).\n \t{git-diff? This is the default.}\n endif::git-format-patch[]\n \n--u::\n-\tSynonym for \"-p\".\n-\n -U<n>::\n-\tShorthand for \"--unified=<n>\".\n-\n --unified=<n>::\n \tGenerate diffs with <n> lines of context instead of\n \tthe usual three. Implies \"-p\".\n@@ -190,31 +186,25 @@ endif::git-format-patch[]\n \tcan name which subdirectory to make the output relative\n \tto by giving a <path> as an argument.\n \n+-a::\n --text::\n \tTreat all files as text.\n \n--a::\n-\tShorthand for \"--text\".\n-\n --ignore-space-at-eol::\n \tIgnore changes in whitespace at EOL.\n \n+-b::\n --ignore-space-change::\n \tIgnore changes in amount of whitespace.  This ignores whitespace\n \tat line end, and considers all other sequences of one or\n \tmore whitespace characters to be equivalent.\n \n--b::\n-\tShorthand for \"--ignore-space-change\".\n-\n+-w::\n --ignore-all-space::\n \tIgnore whitespace when comparing lines.  This ignores\n \tdifferences even if one line has whitespace where the other\n \tline has none.\n \n--w::\n-\tShorthand for \"--ignore-all-space\".\n-\n --exit-code::\n \tMake the program exit with codes similar to diff(1).\n \tThat is, it exits with 1 if there were differences and\n-- \n1.5.6.5\n"},{"id":"98870","messageId":"7vabafe5ai.fsf@gitster.siamese.dyndns.org","threadId":"16889","inReplyTo":"8763l331l6.fsf@jidanni.org","subject":"Re: [PATCH] Documentation/diff-options.txt: unify options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-29T08:47:49Z","receivedAt":"2008-12-29T08:47:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n\njidanni@jidanni.org writes:\n\n> (You were right about my previous patch being bad.\n> At least git-am gives an error message when fed\n> http://article.gmane.org/gmane.comp.version-control.git/104017/raw\n> git-apply however does nothing and returns 0! Must be a bug.)\n> OK, here's a better patch:\n>\n> Signed-off-by: jidanni <jidanni@jidanni.org>\n\n> ---\n\nThat commentary above your S-o-b is not a proper commit log message, but\nI'll come up with something and apply.\n\n$ wget http://article.gmane.org/gmane.comp.version-control.git/104017/raw\n$ git apply raw\nerror: diff-options.txt: No such file or directory\n$ echo $?\n1\n\nEven if you hand munge the \"raw\" file to have proper prefix, it will\nrefuse to apply a context-free diff.\n\n$ git apply raw-edited\nerror: patch failed: Documentation/diff-options.txt:26\nerror: Documentation/diff-options.txt: patch does not apply\n$ echo $?\n1     \n\nThis is to avoid applying the patch only by line number without context;\nsee the last paragraph of <7vvdt4aj0e.fsf@gitster.siamese.dyndns.org> for\nthe explanation.\n\nUpon a very rare case where you are absolutely sure that your copy is what the\npatch is based on and that it is safe to applying a context-free patch\nonly by line number, you can give --unidiff-zero option to git-apply to\ncountermand this safety measure, but a patch posted on the public mailing\nlist for open source development rarely falls into that category.\n"},{"id":"98876","messageId":"7vwsdjcpoo.fsf@gitster.siamese.dyndns.org","threadId":"16889","inReplyTo":"7vabafe5ai.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Documentation/diff-options.txt: unify options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-29T09:10:15Z","receivedAt":"2008-12-29T09:10:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> That commentary above your S-o-b is not a proper commit log message, but\n> I'll come up with something and apply.\n\nHere is what I came up with and applied.\n\n    Documentation/diff-options.txt: unify options\n    \n    Instead of listing short option (e.g. \"-U<n>\") as a shorthand for its\n    longer counterpart (e.g. \"--unified=<n>\"), list the synonyms together.  It\n    saves one indirection to find what the reader wants.\n    \n    Signed-off-by: jidanni <jidanni@jidanni.org>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nThanks.\n"},{"id":"98928","messageId":"87r63q34ys.fsf_-_@jidanni.org","threadId":"16889","inReplyTo":"7vabafe5ai.fsf@gitster.siamese.dyndns.org","subject":"git apply didn't catch error? [was Re: [PATCH] Documentation/diff-options.txt: unify options]","fromName":"","fromEmail":"jidanni@jidanni.org","sentAt":"2008-12-30T00:02:35Z","receivedAt":"2008-12-30T00:02:35Z","isPatch":true,"sender":{"key":"jidanni@jidanni.org","avatar":"https://gravatar.com/avatar/36568d4af4c8d3e71627ef3b8c8d00e39065b12f29676cccd38ced75e68fa2a6?d=mp&s=160"},"body":"JCH> $ wget http://article.gmane.org/gmane.comp.version-control.git/104017/raw\nJCH> $ git apply raw\nJCH> error: diff-options.txt: No such file or directory\nJCH> $ echo $?\nJCH> 1\n$ cd Documentation\n$ git apply ../raw\n$ echo $?\n0\nSo then one thinks \"why of course, the changes we already applied.\"\nHowever if one makes some sneaky changes:\n$ diff ../raw.original raw\n46c46\n< index 5721548..b05503a 100644\n---\n> index 6721548..c05503a 100644\n70c70\n< +-w::\n---\n> +-w::ZZZZZZZZZZZZZZZZZZ\nOne gets the same $?=0. git apply should scream instead of silently\nreturning 0 and doing nothing. git version 1.6.0.6.\n"}]}