Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Documentation/git-difftool.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ with custom merge tool commands and has the same value as `$MERGED`.
the working tree.
+
Specifying `--no-symlinks` instructs `git difftool` to create copies
instead. `--no-symlinks` is the default on Windows.
instead. The default follows `core.symlinks`. If unset, native Windows
builds default to copies unless `MSYS=winsymlinks:nativestrict` is set;
other builds default to symlinks.

`-x <command>`::
`--extcmd=<command>`::
Expand Down
3 changes: 1 addition & 2 deletions builtin/difftool.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ static int difftool_config(const char *var, const char *value,
}
if (!strcmp(var, "core.symlinks")) {
dt_options->has_symlinks = git_config_bool(var, value);
return 0;
}

return git_default_config(var, value, ctx, cb);
Expand Down Expand Up @@ -734,7 +733,7 @@ int cmd_difftool(int argc,
int use_gui_tool = -1, dir_diff = 0, prompt = -1, tool_help = 0, no_index = 0;
static char *difftool_cmd = NULL, *extcmd = NULL;
struct difftool_options dt_options = {
.has_symlinks = 1,
.has_symlinks = platform_has_symlinks(),
.symlinks = 1,
.trust_exit_code = 0
};
Expand Down
14 changes: 14 additions & 0 deletions t/t7800-difftool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,20 @@ test_expect_success SYMLINKS 'difftool --dir-diff --symlinks without unstaged ch
test_cmp expect actual
'

test_expect_success MINGW,SYMLINKS 'difftool honors core.symlinks on Windows' '
test_config difftool.test-tool.cmd "test -L \"\$REMOTE/file\"" &&
MSYS= git -c core.symlinks=true difftool --dir-diff \
--tool=test-tool --trust-exit-code branch HEAD
'

test_expect_success MINGW 'difftool defaults to copies on Windows' '
test_unconfig core.symlinks &&
test_config difftool.test-tool.cmd \
"test -f \"\$REMOTE/file\" && test ! -L \"\$REMOTE/file\"" &&
MSYS= git difftool --dir-diff --tool=test-tool --trust-exit-code \
branch HEAD
'

write_script modify-right-file <<\EOF
echo "modified content" >"$2/file"
EOF
Expand Down
Loading