Re: [PATCH] difftool: handle changing symlinks in dir-diff mode
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 13, 2017, 21:33 UTC
- Message-ID
- <xmqqinncrhey.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <alpine.DEB.2.20.1703132204410.3767@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 13 quoted lines
>> > + if (strbuf_readlink(&link, ce->name, ce_namelen(ce)) == 0) {
>> > + strbuf_add(&path, state->base_dir, state->base_dir_len);
>> > + strbuf_add(&path, ce->name, ce_namelen(ce));
>> > +
>> > + write_file_buf(path.buf, link.buf, link.len);
>>
>> This does "write content into symlink stand-in file", but why?
>
> From the commit message:
>
> > Detect the null object ID for symlinks in dir-diff so that
> > difftool can prepare temporary files that matches how git
> > handles symlinks.Yes I read what the proposed log message said, and noticed that symbolic link is _always_ written as a regular file.
I was questioning why. I know Git falls back to such behaviour when the filesystem does not support symbolic links. "Why do so unconditionally, even when the filesystem does?" was the question.
> The obvious connection: when core.symlinks = false, Git already falls back > to writing plain files with the link target as contents. This function > does the same, for the same motivation: it is the best we can do in this > case.
And that "obvious connection" does not answer the question.