[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    GIT_EXTERNAL_DIFF ignored after unstashing conflicts
From:       Bruno Haible <bruno () clisp ! org>
Date:       2007-09-30 19:18:39
Message-ID: 200709302118.39406.bruno () clisp ! org
[Download RAW message or body]

Hi,

"git diff" ignores the GIT_EXTERNAL_DIFF variable in a particular situation:
when there are conflicts after "git stash apply".

To reproduce:
  - Set environment variable GIT_EXTERNAL_DIFF to point to the attached
    script.
  - Make a clean gnulib checkout, 1 day old.
  - Add a entry to the top of the ChangeLog.
  - $ git pull
    fails due a conflict.
  - $ git stash
  - $ git pull
  - $ git stash apply
  - $ git-diff | cat
    yields:
diff --cc ChangeLog
index 443ad76,991c26b..0000000
--- a/ChangeLog
+++ b/ChangeLog
@@@ -1,7 -1,6 +1,11 @@@
  2007-09-30  Bruno Haible  <bruno@clisp.org>
  
++<<<<<<< Updated upstream:ChangeLog
 +      * tests/test-getaddrinfo.c (AF_UNSPEC): Provide a fallback definition.
 +      Needed on BeOS.
++=======
+       * Some other changes.
++>>>>>>> Stashed changes:ChangeLog
  
  2007-09-30  Bruno Haible  <bruno@clisp.org>
  

The script has not been called (witness: the echo command at its line 2).

Can it be called, like in the case of "git-diff --cached"?

Bruno

["my-diff-for-git" (application/x-shellscript)]

#!/bin/sh
echo "my-diff-for-git $@"
path="$1"
old_file="$2"
old_hex="$3"
old_filemode="$4"
new_file="$5"
new_hex="$6"
new_filemode="$7"

if test -n "$2" && test -n "$3" && test -n "$4" && test -n "$5" && test -n "$6" && test -n "$7"; then

  if test "$old_filemode" != "$new_filemode"; then
    echo "Changing permissions from $old_filemode to $new_filemode" || exit 1
  fi

  if test -f "$path".orig; then
    mv -f "$path".orig "$path".orig~~~
  fi
  ln -sf "$old_file" "$path".orig

  if test "$path" != "$new_file"; then
    if test -f "$path"; then
      mv -f "$path" "$path"~~~
    fi
    ln -sf "$new_file" "$path"
  fi

  diff -c3 "$path".orig "$path"
  err=$?

  if test "$path" != "$new_file"; then
    rm -f "$path"
    if test -f "$path"~~~; then
      mv -f "$path"~~~ "$path"
    fi
  fi

  rm -f "$path".orig
  if test -f "$path".orig~~~; then
    mv -f "$path".orig~~~ "$path".orig
  fi

  test $err = 2 && exit 1
  exit 0

else

  git-diff-files --cc "$path"

fi

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic