{"thread":{"id":"41851","subject":"Warning about conflict markers - undocumented 'diff --check' feature & suggestion","startedAt":"2016-03-28T22:44:06Z","lastAt":"2016-03-29T18:59:45Z","messageCount":6,"participants":["Ori Avtalion","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"282005","messageId":"CALgdb5JuoYpHAPxTY2cHdbkcPUjKtsWQ_DY5rBrw-YKCwj2yvw@mail.gmail.com","threadId":"41851","inReplyTo":null,"subject":"Warning about conflict markers - undocumented 'diff --check' feature & suggestion","fromName":"Ori Avtalion","fromEmail":"ori@avtalion.name","sentAt":"2016-03-28T22:44:06Z","receivedAt":"2016-03-28T22:44:06Z","isPatch":false,"sender":{"key":"ori@avtalion.name","avatar":"https://avatars.githubusercontent.com/u/28355?v=4"},"body":"A bug report and a suggestion:\n\n`git diff --check` has been warning about conflict markers since 2008:\nhttps://marc.info/?l=git&m=122398500726634&w=2\n\nThis is an undocumented feature. The current documentation for the\nflag only mentions \"whitespace errors\".\n\nThis check will also be useful in `git add`, to prevent accidental\nstaging of conflict markers.\nPerhaps it could be included, if not by default, then at least with a\nconfiguration setting.\n\nThoughts? Is this perhaps an existing feature that I'm missing? :)\n\n-Ori\n"},{"id":"282006","messageId":"xmqqd1qe1a2i.fsf@gitster.mtv.corp.google.com","threadId":"41851","inReplyTo":"CALgdb5JuoYpHAPxTY2cHdbkcPUjKtsWQ_DY5rBrw-YKCwj2yvw@mail.gmail.com","subject":"Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-28T23:01:25Z","receivedAt":"2016-03-28T23:01:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ori Avtalion <ori@avtalion.name> writes:\n\n> A bug report and a suggestion:\n>\n> `git diff --check` has been warning about conflict markers since 2008:\n> https://marc.info/?l=git&m=122398500726634&w=2\n>\n> This is an undocumented feature. The current documentation for the\n> flag only mentions \"whitespace errors\".\n\nThanks for digging (even though I do not think the message you\nquoted has much to do with this).\n\n04954043 (diff --check: detect leftover conflict markers,\n2008-06-26) was the change that added this check to the \"check\nwhitespace breakage\" codepath, which forgot to update the\ndocumentation.\n\nAnd when 4f830390 (Documentation: git diff --check respects\ncore.whitespace, 2011-06-22) rewrote the paragraph, it again didn't\nremember to update it to match the reality.\n\nCare to try a patch?\n"},{"id":"282040","messageId":"CALgdb5+E7_CT2e9WFBd9GhiFuc_B7+bpC9tjDfR+-QiTGeoP+A@mail.gmail.com","threadId":"41851","inReplyTo":"xmqqd1qe1a2i.fsf@gitster.mtv.corp.google.com","subject":"Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion","fromName":"Ori Avtalion","fromEmail":"ori@avtalion.name","sentAt":"2016-03-29T11:19:47Z","receivedAt":"2016-03-29T11:19:47Z","isPatch":false,"sender":{"key":"ori@avtalion.name","avatar":"https://avatars.githubusercontent.com/u/28355?v=4"},"body":"On Tue, Mar 29, 2016 at 2:01 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ori Avtalion <ori@avtalion.name> writes:\n>\n> Thanks for digging (even though I do not think the message you\n> quoted has much to do with this).\n\nOops, you are correct! I had several tabs open digging through the archives and\npicked the wrong one :)\n\n> Care to try a patch?\n\nYes. Will submit one soon.\nIf my change introduces a few words that exceed asciidoc's ~72-char line width,\nshould I reformat the entire paragraph? (thus making it had to identify what\nchanged exactly)\n\nAny thoughts on adding similar functionality to \"git add\"?\n"},{"id":"282078","messageId":"xmqqvb45xhw1.fsf@gitster.mtv.corp.google.com","threadId":"41851","inReplyTo":"CALgdb5+E7_CT2e9WFBd9GhiFuc_B7+bpC9tjDfR+-QiTGeoP+A@mail.gmail.com","subject":"Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-29T18:23:42Z","receivedAt":"2016-03-29T18:23:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ori Avtalion <ori@avtalion.name> writes:\n\n> If my change introduces a few words that exceed asciidoc's ~72-char line width,\n> should I reformat the entire paragraph? (thus making it had to identify what\n> changed exactly)\n\nYou should try to minimize the damage, but shouldn't go overboard ;-)\n\n> Any thoughts on adding similar functionality to \"git add\"?\n\nI am not sure what \"similar functionality\" you are imagining.\n\n\"git add\" does not show any changes, it just does what it was told\nto do.  If the user is unsure, s/he should make it the habit to\ncheck what s/he is doing with \"git diff\".\n"},{"id":"282079","messageId":"CALgdb5LS9EgqaBsm6vEWfQz-BZE=xH42fFdF5-eg-XyNsRBYkA@mail.gmail.com","threadId":"41851","inReplyTo":"xmqqvb45xhw1.fsf@gitster.mtv.corp.google.com","subject":"Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion","fromName":"Ori Avtalion","fromEmail":"ori@avtalion.name","sentAt":"2016-03-29T18:27:47Z","receivedAt":"2016-03-29T18:27:47Z","isPatch":false,"sender":{"key":"ori@avtalion.name","avatar":"https://avatars.githubusercontent.com/u/28355?v=4"},"body":"On Tue, Mar 29, 2016 at 9:23 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ori Avtalion <ori@avtalion.name> writes:\n> I am not sure what \"similar functionality\" you are imagining.\n>\n> \"git add\" does not show any changes, it just does what it was told\n> to do.  If the user is unsure, s/he should make it the habit to\n> check what s/he is doing with \"git diff\".\n\nI was thinking of an off-by-default setting where git-add outright\nrefuses to stage changes that do not pass \"diff --check\".\nI understand if that's a big deviation from the spirit of the tool,\nand perhaps not a good idea.\n"},{"id":"282085","messageId":"1459277985-5776-1-git-send-email-ori@avtalion.name","threadId":"41851","inReplyTo":"xmqqd1qe1a2i.fsf@gitster.mtv.corp.google.com","subject":"[PATCH] Documentation: git diff --check detects conflict markers","fromName":"Ori Avtalion","fromEmail":"ori@avtalion.name","sentAt":"2016-03-29T18:59:45Z","receivedAt":"2016-03-29T18:59:45Z","isPatch":true,"sender":{"key":"ori@avtalion.name","avatar":"https://avatars.githubusercontent.com/u/28355?v=4"},"body":"Signed-off-by: Ori Avtalion <ori@avtalion.name>\n---\n Documentation/diff-options.txt | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 306b7e3..32f48ed 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -286,8 +286,8 @@ endif::git-format-patch[]\n \n ifndef::git-format-patch[]\n --check::\n-\tWarn if changes introduce whitespace errors.  What are\n-\tconsidered whitespace errors is controlled by `core.whitespace`\n+\tWarn if changes introduce conflict markers or whitespace errors.\n+\tWhat are considered whitespace errors is controlled by `core.whitespace`\n \tconfiguration.  By default, trailing whitespaces (including\n \tlines that solely consist of whitespaces) and a space character\n \tthat is immediately followed by a tab character inside the\n-- \n2.5.0\n"}]}