* Warning about conflict markers - undocumented 'diff --check' feature & suggestion
@ 2016-03-28 22:44 Ori Avtalion
2016-03-28 23:01 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Ori Avtalion @ 2016-03-28 22:44 UTC (permalink / raw)
To: git
A bug report and a suggestion:
`git diff --check` has been warning about conflict markers since 2008:
https://marc.info/?l=git&m=122398500726634&w=2
This is an undocumented feature. The current documentation for the
flag only mentions "whitespace errors".
This check will also be useful in `git add`, to prevent accidental
staging of conflict markers.
Perhaps it could be included, if not by default, then at least with a
configuration setting.
Thoughts? Is this perhaps an existing feature that I'm missing? :)
-Ori
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion
2016-03-28 22:44 Warning about conflict markers - undocumented 'diff --check' feature & suggestion Ori Avtalion
@ 2016-03-28 23:01 ` Junio C Hamano
2016-03-29 11:19 ` Ori Avtalion
2016-03-29 18:59 ` [PATCH] Documentation: git diff --check detects conflict markers Ori Avtalion
0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2016-03-28 23:01 UTC (permalink / raw)
To: Ori Avtalion; +Cc: git
Ori Avtalion <ori@avtalion.name> writes:
> A bug report and a suggestion:
>
> `git diff --check` has been warning about conflict markers since 2008:
> https://marc.info/?l=git&m=122398500726634&w=2
>
> This is an undocumented feature. The current documentation for the
> flag only mentions "whitespace errors".
Thanks for digging (even though I do not think the message you
quoted has much to do with this).
04954043 (diff --check: detect leftover conflict markers,
2008-06-26) was the change that added this check to the "check
whitespace breakage" codepath, which forgot to update the
documentation.
And when 4f830390 (Documentation: git diff --check respects
core.whitespace, 2011-06-22) rewrote the paragraph, it again didn't
remember to update it to match the reality.
Care to try a patch?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion
2016-03-28 23:01 ` Junio C Hamano
@ 2016-03-29 11:19 ` Ori Avtalion
2016-03-29 18:23 ` Junio C Hamano
2016-03-29 18:59 ` [PATCH] Documentation: git diff --check detects conflict markers Ori Avtalion
1 sibling, 1 reply; 6+ messages in thread
From: Ori Avtalion @ 2016-03-29 11:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, Mar 29, 2016 at 2:01 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Ori Avtalion <ori@avtalion.name> writes:
>
> Thanks for digging (even though I do not think the message you
> quoted has much to do with this).
Oops, you are correct! I had several tabs open digging through the archives and
picked the wrong one :)
> Care to try a patch?
Yes. Will submit one soon.
If my change introduces a few words that exceed asciidoc's ~72-char line width,
should I reformat the entire paragraph? (thus making it had to identify what
changed exactly)
Any thoughts on adding similar functionality to "git add"?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion
2016-03-29 11:19 ` Ori Avtalion
@ 2016-03-29 18:23 ` Junio C Hamano
2016-03-29 18:27 ` Ori Avtalion
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2016-03-29 18:23 UTC (permalink / raw)
To: Ori Avtalion; +Cc: git
Ori Avtalion <ori@avtalion.name> writes:
> If my change introduces a few words that exceed asciidoc's ~72-char line width,
> should I reformat the entire paragraph? (thus making it had to identify what
> changed exactly)
You should try to minimize the damage, but shouldn't go overboard ;-)
> Any thoughts on adding similar functionality to "git add"?
I am not sure what "similar functionality" you are imagining.
"git add" does not show any changes, it just does what it was told
to do. If the user is unsure, s/he should make it the habit to
check what s/he is doing with "git diff".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Warning about conflict markers - undocumented 'diff --check' feature & suggestion
2016-03-29 18:23 ` Junio C Hamano
@ 2016-03-29 18:27 ` Ori Avtalion
0 siblings, 0 replies; 6+ messages in thread
From: Ori Avtalion @ 2016-03-29 18:27 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, Mar 29, 2016 at 9:23 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ori Avtalion <ori@avtalion.name> writes:
> I am not sure what "similar functionality" you are imagining.
>
> "git add" does not show any changes, it just does what it was told
> to do. If the user is unsure, s/he should make it the habit to
> check what s/he is doing with "git diff".
I was thinking of an off-by-default setting where git-add outright
refuses to stage changes that do not pass "diff --check".
I understand if that's a big deviation from the spirit of the tool,
and perhaps not a good idea.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Documentation: git diff --check detects conflict markers
2016-03-28 23:01 ` Junio C Hamano
2016-03-29 11:19 ` Ori Avtalion
@ 2016-03-29 18:59 ` Ori Avtalion
1 sibling, 0 replies; 6+ messages in thread
From: Ori Avtalion @ 2016-03-29 18:59 UTC (permalink / raw)
To: git; +Cc: Ori Avtalion
Signed-off-by: Ori Avtalion <ori@avtalion.name>
---
Documentation/diff-options.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 306b7e3..32f48ed 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -286,8 +286,8 @@ endif::git-format-patch[]
ifndef::git-format-patch[]
--check::
- Warn if changes introduce whitespace errors. What are
- considered whitespace errors is controlled by `core.whitespace`
+ Warn if changes introduce conflict markers or whitespace errors.
+ What are considered whitespace errors is controlled by `core.whitespace`
configuration. By default, trailing whitespaces (including
lines that solely consist of whitespaces) and a space character
that is immediately followed by a tab character inside the
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-29 19:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-28 22:44 Warning about conflict markers - undocumented 'diff --check' feature & suggestion Ori Avtalion
2016-03-28 23:01 ` Junio C Hamano
2016-03-29 11:19 ` Ori Avtalion
2016-03-29 18:23 ` Junio C Hamano
2016-03-29 18:27 ` Ori Avtalion
2016-03-29 18:59 ` [PATCH] Documentation: git diff --check detects conflict markers Ori Avtalion
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.