Re: [PATCH v2 1/2] diff --no-index: follow symlinks
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 13, 2017, 23:37 UTC
- Message-ID
- <xmqqk29yedkv.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170113102021.6054-2-dennis@kaarsemaker.net>
Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
Show 6 quoted lines
> Git's diff machinery does not follow symlinks, which makes sense as git > itself also does not, but stores the symlink destination. > > In --no-index mode however, it is useful for diff to to follow symlinks, > matching the behaviour of ordinary diff. A new --no-dereference (name > copied from diff) option has been added to disable this behaviour.
If you add a --no-dereference option, --dereference option should also be there, so that "--no-dereference" earlier on the command line (perhaps coming from a configured alias) can be countermanded.
While I am not opposed to giving an optional feature to treat a symlink as if it is a regular file with the contents of its link target, I am not enthused that this patch tries to make that the default behaviour. We are not matching the behaviour of ordinary diff anyway [*1*].
It probably makes more sense for our first step to introduce this feature that is only enabled when "--dereference" option is given. Making it the default for "--no-index" case should be discussed as a separate step.
[Footnote]
*1* E.g. "git diff --no-index dirA/ dirB/" does not say "Only in dirA: file". It also recurses into subdirectories of dirA/ and dirB/ without the --recursive option.