Re: [PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-30 Thread David Aguilar
On Thu, Oct 29, 2015 at 11:19:01AM -0700, Junio C Hamano wrote: > Junio C Hamano writes: > > > So I think it is fine to return $use=0 for any symbolic link from > > use_wt_file. Anything you do there will be replaced by the loop > > over %symlink that appears later in the

Re: [PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-30 Thread Junio C Hamano
David Aguilar writes: >> +if (-l "$workdir/$file" || ! -e _) { >> return (0, $null_sha1); >> } > > The "-e _" shorthand caught my eye ~ I didn't know perl could do that! > Nice. > > Underline is barely mentioned in perlvar, but it's obvious what > (I

Re: [PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-29 Thread Junio C Hamano
David Aguilar writes: > Right. At first I thought I could revise the commit message to > make it clearer that we simply want to skip all symlinks, since > it never makes sense to reuse a worktree symlinks, but looking > at the tests and implementation makes me realize that

Re: [PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-29 Thread Junio C Hamano
Junio C Hamano writes: > So I think it is fine to return $use=0 for any symbolic link from > use_wt_file. Anything you do there will be replaced by the loop > over %symlink that appears later in the caller. The caller discards > $wt_sha1 when $use=0 is returned, so the

Re: [PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-28 Thread David Aguilar
On Tue, Oct 27, 2015 at 03:24:49PM -0700, Junio C Hamano wrote: > David Aguilar writes: > > > difftool's dir-diff should never reuse a symlink, regardless of > > what it points to. Tighten use_wt_file() so that it rejects all > > symlinks. > > > > Helped-by: Junio C Hamano

Re: [PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-27 Thread Junio C Hamano
David Aguilar writes: > difftool's dir-diff should never reuse a symlink, regardless of > what it points to. Tighten use_wt_file() so that it rejects all > symlinks. > > Helped-by: Junio C Hamano > Signed-off-by: David Aguilar > ---

Re: [PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-27 Thread Junio C Hamano
David Aguilar writes: > - if (! -f "$workdir/$file") { > - return (0, $null_sha1); > + my $workfile = "$workdir/$file"; > + if (-f $workfile && ! -l $workfile) { I still don't know if return (0, $null) is the right thing to do, but in any case, I find

[PATCH] difftool: avoid symlinks when reusing worktree files

2015-10-27 Thread David Aguilar
difftool's dir-diff should never reuse a symlink, regardless of what it points to. Tighten use_wt_file() so that it rejects all symlinks. Helped-by: Junio C Hamano Signed-off-by: David Aguilar --- git-difftool.perl | 12 ++-- 1 file changed, 6