Re: [PATCH] Documentation/diff-options.txt: unify options

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Documentation/diff-options.txt: unify options

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:50

Thanks.

jidanni@jidanni.org writes:
(You were right about my previous patch being bad.
At least git-am gives an error message when fed
http://article.gmane.org/gmane.comp.version-control.git/104017/raw
git-apply however does nothing and returns 0! Must be a bug.)
OK, here's a better patch:

Signed-off-by: jidanni <redacted>
---
That commentary above your S-o-b is not a proper commit log message, but
I'll come up with something and apply.

$ wget http://article.gmane.org/gmane.comp.version-control.git/104017/raw
$ git apply raw
error: diff-options.txt: No such file or directory
$ echo $?
1

Even if you hand munge the "raw" file to have proper prefix, it will
refuse to apply a context-free diff.

$ git apply raw-edited
error: patch failed: Documentation/diff-options.txt:26
error: Documentation/diff-options.txt: patch does not apply
$ echo $?
1     

This is to avoid applying the patch only by line number without context;
see the last paragraph of [off-list ref] for
the explanation.

Upon a very rare case where you are absolutely sure that your copy is what the
patch is based on and that it is safe to applying a context-free patch
only by line number, you can give --unidiff-zero option to git-apply to
countermand this safety measure, but a patch posted on the public mailing
list for open source development rarely falls into that category.

git apply didn't catch error? [was Re: [PATCH] Documentation/diff-options.txt: unify options]

From: <hidden>
Date: 2016-06-15 22:45:50

JCH> $ wget http://article.gmane.org/gmane.comp.version-control.git/104017/raw
JCH> $ git apply raw
JCH> error: diff-options.txt: No such file or directory
JCH> $ echo $?
JCH> 1
$ cd Documentation
$ git apply ../raw
$ echo $?
0
So then one thinks "why of course, the changes we already applied."
However if one makes some sneaky changes:
$ diff ../raw.original raw
46c46
< index 5721548..b05503a 100644
---
index 6721548..c05503a 100644
70c70
< +-w::
---
+-w::ZZZZZZZZZZZZZZZZZZ
One gets the same $?=0. git apply should scream instead of silently
returning 0 and doing nothing. git version 1.6.0.6.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help