Skip to content

Commit

Permalink
Mergetool generating blank files (1.5.3)
Browse files Browse the repository at this point in the history
When mergetool is run from a subdirectory, "ls-files -u" nicely
limits the output to conflicted files in that directory, but
we need to give the full path to cat-file plumbing to grab the
contents of stages.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Junio C Hamano authored and Theodore Ts'o committed Sep 29, 2007
1 parent 26b2800 commit 769f398
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions git-mergetool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ USAGE='[--tool=tool] [file to merge] ...'
SUBDIRECTORY_OK=Yes
. git-sh-setup
require_work_tree
prefix=$(git rev-parse --show-prefix)

# Returns true if the mode reflects a symlink
is_symlink () {
Expand Down Expand Up @@ -162,9 +163,9 @@ merge_file () {
local_mode=`git ls-files -u -- "$path" | awk '{if ($3==2) print $1;}'`
remote_mode=`git ls-files -u -- "$path" | awk '{if ($3==3) print $1;}'`

base_present && git cat-file blob ":1:$path" > "$BASE" 2>/dev/null
local_present && git cat-file blob ":2:$path" > "$LOCAL" 2>/dev/null
remote_present && git cat-file blob ":3:$path" > "$REMOTE" 2>/dev/null
base_present && git cat-file blob ":1:$prefix$path" >"$BASE" 2>/dev/null
local_present && git cat-file blob ":2:$prefix$path" >"$LOCAL" 2>/dev/null
remote_present && git cat-file blob ":3:$prefix$path" >"$REMOTE" 2>/dev/null

if test -z "$local_mode" -o -z "$remote_mode"; then
echo "Deleted merge conflict for '$path':"
Expand Down

0 comments on commit 769f398

Please sign in to comment.