OSDN Git Service

difftool: fix dir-diff index creation when in a subdirectory
authorDavid Aguilar <davvid@gmail.com>
Wed, 7 Dec 2016 10:16:08 +0000 (02:16 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Dec 2016 18:28:00 +0000 (10:28 -0800)
commit853e10c19755669bd4695b1d9fd81f3278466727
treea3c1ee83cc6444cea3de3fc272b03165359f65d3
parent0202c411edc25940cc381bf317badcdf67670be4
difftool: fix dir-diff index creation when in a subdirectory

9ec26e7977 (difftool: fix argument handling in subdirs, 2016-07-18)
corrected how path arguments are handled in a subdirectory, but
it introduced a regression in how entries outside of the
subdirectory are handled by dir-diff.

When preparing the right-side of the diff we only include the
changed paths in the temporary area.

The left side of the diff is constructed from a temporary
index that is built from the same set of changed files, but it
was being constructed from within the subdirectory.  This is a
problem because the indexed paths are toplevel-relative, and
thus they were not getting added to the index.

Teach difftool to chdir to the toplevel of the repository before
preparing its temporary indexes.  This ensures that all of the
toplevel-relative paths are valid.

Add test cases to more thoroughly exercise this scenario.

Reported-by: Frank Becker <fb@mooflu.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-difftool.perl
t/t7800-difftool.sh