Skip to content

Commit

Permalink
git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'
Browse files Browse the repository at this point in the history
A custom diffing utility can be specified for the 'p4 diff' command by
setting the P4DIFF environment variable.  However when using a custom
diffing utility such as 'vimdiff' passing options like -du can cause
unexpected behavior.

Since the goal is to generate a unified diff of the changes and attach
them to the bottom of the p4 submit log we should unset P4DIFF if it
has been set in order to generate the diff properly.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
  • Loading branch information
Shawn Bohrer authored and Simon Hausmann committed Mar 13, 2008
1 parent 8ff45f2 commit 67abd41
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@ class P4Submit(Command):

if self.interactive:
submitTemplate = self.prepareLogMessage(template, logMessage)
if os.environ.has_key("P4DIFF"):
del(os.environ["P4DIFF"])
diff = read_pipe("p4 diff -du ...")

for newFile in filesToAdd:
Expand Down

0 comments on commit 67abd41

Please sign in to comment.