aboutsummaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorGeorge Vanburgh <gvanburgh@bloomberg.net>2017-01-25 09:17:29 +0000
committerJunio C Hamano <gitster@pobox.com>2017-01-30 09:05:09 -0800
commitc3c2b057767c037b32a276e14bf563383ce82e39 (patch)
tree68cb8213a3128a9ab810b19c2cd9a874f8426e31 /git-p4.py
parentad36dc8b4b165bf9eb3576b42a241164e312d48c (diff)
downloadgit-c3c2b057767c037b32a276e14bf563383ce82e39.tar.gz
git-c3c2b057767c037b32a276e14bf563383ce82e39.tar.xz
git-p4: fix git-p4.mapUser on Windows
When running git-p4 on Windows, with multiple git-p4.mapUser entries in git config - no user mappings are applied to the generated repository. Reproduction Steps: 1. Add multiple git-p4.mapUser entries to git config on a Windows machine 2. Attempt to clone a p4 repository None of the user mappings will be applied. This issue is actually caused by gitConfigList, using split(os.linesep) to convert the output of git config --get-all into a list. On Windows, os.linesep is equal to '\r\n' - however git.exe returns configuration with a line seperator of '\n'. This leads to the list returned by gitConfigList containing only one element - which contains the full output of git config --get-all in string form, which causes problems for the code introduced to getUserMapFromPerforceServer in 10d08a149d ("git-p4: map a P4 user to Git author name and email address", 2016-03-01) This issue should be caught by the test introduced in 10d08a1, however would require running on Windows to reproduce. Using splitlines solves this issue, by splitting config on all typical delimiters ('\n', '\r\n' etc.) Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-p4.py b/git-p4.py
index f427bf629..b66f68bdb 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -656,7 +656,7 @@ def gitConfigInt(key):
def gitConfigList(key):
if not _gitConfig.has_key(key):
s = read_pipe(["git", "config", "--get-all", key], ignore_error=True)
- _gitConfig[key] = s.strip().split(os.linesep)
+ _gitConfig[key] = s.strip().splitlines()
if _gitConfig[key] == ['']:
_gitConfig[key] = []
return _gitConfig[key]