Browse files

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 <>
Signed-off-by: Junio C Hamano <>
  • Loading branch information...
1 parent 51bacee commit 4a689afb030c1cd5aa1c141db94bbf9dde42f05e @mjg mjg committed with gitster Dec 14, 2010
Showing with 2 additions and 0 deletions.
  1. +1 −0 Documentation/git-difftool.txt
  2. +1 −0
@@ -64,6 +64,7 @@ with custom merge tool commands and has the same value as `$MERGED`.
Specify a custom command for viewing diffs.
'git-difftool' ignores the configured defaults and runs
`$command $LOCAL $REMOTE` when this option is specified.
+ Additionally, `$BASE` is set in the environment.
@@ -49,6 +49,7 @@ launch_merge_tool () {
if use_ext_cmd; then
+ export BASE
run_merge_tool "$merge_tool"

0 comments on commit 4a689af

Please sign in to comment.