Skip to content

Commit 4a689af

Browse files
Michael J Grubergitster
authored andcommitted
difftool: provide basename to external tools
Currently, only configured diff helpers get the basename of the file being compared. Tools specified with "git difftool -x" only get the names of temporary files for the different versions. Export BASE so that an external tool can read the name from the environment. Rather than using a third argument, this avoids breaking existing scripts which may somewhat carelessly be using "$@" rather than "$1" "$2". Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 51bacee commit 4a689af

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Documentation/git-difftool.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ with custom merge tool commands and has the same value as `$MERGED`.
6464
Specify a custom command for viewing diffs.
6565
'git-difftool' ignores the configured defaults and runs
6666
`$command $LOCAL $REMOTE` when this option is specified.
67+
Additionally, `$BASE` is set in the environment.
6768

6869
-g::
6970
--gui::

git-difftool--helper.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ launch_merge_tool () {
4949
fi
5050

5151
if use_ext_cmd; then
52+
export BASE
5253
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
5354
else
5455
run_merge_tool "$merge_tool"

0 commit comments

Comments
 (0)