From c66fbd5019a2b8b6452166868b33ce426f93d96f Mon Sep 17 00:00:00 2001
From: Sam Bishop <Sam.Bishop@blackboard.com>
Date: Wed, 18 Mar 2015 15:26:48 -0400
Subject: [PATCH] Git-p4 rebase command will now honor perforce client spec.

When specifiying a client spec while cloning a perforce repo
the name of the client spec will now be saved in the .git/config
file, so that it may be referenced later when doing a git p4 rebase.
---
 git-p4.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/git-p4.py b/git-p4.py
index ff132b2..f4f242a 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1807,6 +1807,7 @@ class View(object):
         self.client_prefix = "//%s/" % client_name
         # cache results of "p4 where" to lookup client file locations
         self.client_spec_path_cache = {}
+        self.client_name = client_name
 
     def append(self, view_line):
         """Parse a view line, splitting it into depot and client
@@ -2787,6 +2788,7 @@ class P4Sync(Command, P4UserMap):
         else:
             if gitConfigBool("git-p4.useclientspec"):
                 self.useClientSpec = True
+                os.environ['P4CLIENT'] = gitConfig("git-p4.clientSpecName")
         if self.useClientSpec:
             self.clientSpecDirs = getClientSpec()
 
@@ -3177,6 +3179,7 @@ class P4Clone(P4Sync):
         # auto-set this variable if invoked with --use-client-spec
         if self.useClientSpec_from_options:
             system("git config --bool git-p4.useclientspec true")
+            system(["git", "config", "--add", "git-p4.clientSpecName", self.clientSpecDirs.client_name])
 
         return True
 
-- 
1.9.3 (Apple Git-50)

