git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'

From
Shawn Bohrer <shawn.bohrer@gmail.com>
Date
Mar 13, 2008, 00:03 UTC
Message-ID
<1205366604-12970-1-git-send-email-shawn.bohrer@gmail.com>

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>
---
 contrib/fast-import/git-p4 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 650ea34..0b46084 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -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:
-- 
1.5.4.3
Next: Shawn Bohrer
Message 1 of 2 in “git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'”
  1. git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'Shawn Bohrer, Mar 13, 2008
  2. git-p4: Use P4EDITOR environment variable when setShawn Bohrer, Mar 13, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.