From: Junio C Hamano <gitster@pobox.com>
To: David Aguilar <davvid@gmail.com>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
Christophe Macabiau <christophemacabiau@gmail.com>,
Git ML <git@vger.kernel.org>
Subject: Re: [PATCH] difftool: handle changing symlinks in dir-diff mode
Date: Mon, 13 Mar 2017 12:02:40 -0700 [thread overview]
Message-ID: <xmqqh92xrodr.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170313175640.14106-1-davvid@gmail.com> (David Aguilar's message of "Mon, 13 Mar 2017 10:56:40 -0700")
David Aguilar <davvid@gmail.com> writes:
> - if (S_ISLNK(lmode)) {
> + if (S_ISLNK(lmode) && !is_null_oid(&loid)) {
> char *content = read_sha1_file(loid.hash, &type, &size);
> add_left_or_right(&symlinks2, src_path, content, 0);
> free(content);
> }
>
> - if (S_ISLNK(rmode)) {
> + if (S_ISLNK(rmode) && !is_null_oid(&roid)) {
> char *content = read_sha1_file(roid.hash, &type, &size);
> add_left_or_right(&symlinks2, dst_path, content, 1);
> free(content);
On this part I didn't comment in my previous message, but what is
the implication of omitting add-left-or-right and not registering
this symbolic link modified in the working tree to the symlinks2
table?
I am wondering if these should be more like
if (S_ISLNK(lmode) {
char *content = get_symlink(src_path, &loid);
add_left_or_right(&symlinks2, src_path, content, 0);
free(content);
}
with get_symlink() helper that does
- if the object name is not 0{40}, read from the object store
- if the object name is 0{40}, that means we need to read the real
contents from the working tree file, so do the "readlink(2) if
symbolic link is supported, otherwise open/read/close the stub
file sitting there" thing.
Similary to the right hand side tree.
Discarding "content" after reading feels wasteful, as that is the
information we would be using when populating the rstate and lstaten
working trees later in the loop, but that would probably need a
larger surgery to the code to optimize, I would imagine.
next prev parent reply other threads:[~2017-03-13 19:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 11:47 fatal error when diffing changed symlinks Christophe Macabiau
2017-02-24 17:53 ` Junio C Hamano
2017-02-24 19:51 ` Junio C Hamano
2017-02-24 20:35 ` Jeff King
2017-02-25 12:36 ` Johannes Schindelin
2017-03-07 18:16 ` Junio C Hamano
2017-03-07 22:34 ` Johannes Schindelin
2017-03-13 17:56 ` [PATCH] difftool: handle changing symlinks in dir-diff mode David Aguilar
2017-03-13 18:32 ` Junio C Hamano
2017-03-13 21:04 ` Johannes Schindelin
2017-03-13 21:27 ` Johannes Schindelin
2017-03-13 21:33 ` Junio C Hamano
2017-03-14 2:20 ` David Aguilar
2017-03-14 5:52 ` Junio C Hamano
2017-03-14 4:13 ` Junio C Hamano
2017-03-13 19:02 ` Junio C Hamano [this message]
2017-03-13 21:36 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh92xrodr.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=christophemacabiau@gmail.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.