diff options
author | Thomas Rast <tr@thomasrast.ch> | 2014-02-16 17:52:34 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-18 12:06:08 -0800 |
commit | aba4727281612c3e24914691727e11e1f44a9aac (patch) | |
tree | 046c974c9f70052cd9b29a7e18b2310eede101f6 /diff.c | |
parent | 2f93541d88fadd1ff5307d81c2c8921ee3eea058 (diff) | |
download | git-aba4727281612c3e24914691727e11e1f44a9aac.tar.gz |
diff: do not reuse_worktree_file for submodulestr/diff-submodule-no-reuse-worktree
The GIT_EXTERNAL_DIFF calling code attempts to reuse existing worktree
files for the worktree side of diffs, for performance reasons.
However, that code also tries to do the same with submodules. This
results in calls to $GIT_EXTERNAL_DIFF where the old-file is a file of
the form "Submodule commit $sha1", but the new-file is a directory in
the worktree.
Fix it by never reusing a worktree "file" in the submodule case.
Reported-by: Grégory Pakosz <gregory.pakosz@gmail.com>
Signed-off-by: Thomas Rast <tr@thomasrast.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2842,8 +2842,9 @@ static struct diff_tempfile *prepare_temp_file(const char *name, remove_tempfile_installed = 1; } - if (!one->sha1_valid || - reuse_worktree_file(name, one->sha1, 1)) { + if (!S_ISGITLINK(one->mode) && + (!one->sha1_valid || + reuse_worktree_file(name, one->sha1, 1))) { struct stat st; if (lstat(name, &st) < 0) { if (errno == ENOENT) |