allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [07/13] allura git commit: [#7837] ticket:736 Fix filenames with whitespaces and/or unicode
Date Thu, 05 Mar 2015 10:35:34 GMT
[#7837] ticket:736 Fix filenames with whitespaces and/or unicode


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/5115e753
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/5115e753
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/5115e753

Branch: refs/heads/ib/7837
Commit: 5115e7533e0850a5509dff1ecaa3f9dc0dc15121
Parents: 7cb590b
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Mar 3 10:06:55 2015 +0000
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Wed Mar 4 16:58:38 2015 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/5115e753/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 4d8ffc1..7f5847a 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -570,11 +570,14 @@ class GitImplementation(M.RepositoryImplementation):
             # show tree entry itself as well as subtrees (Commit.added_paths
             # relies on this)
             '-t',
+            '-z',  # don't escape filenames and use \x00 as fields delimiter
             commit_id)
-        files = files.splitlines()
-        total = len(files)
-        for f in files[start:end]:
-            status, name = f.split('\t', 1)
+        files = files.split('\x00')[:-1]
+        # files = ['A', 'filename', 'D', 'another filename', ...]
+        total = len(files) / 2
+        for i in range(1, len(files), 2):
+            status = files[i-1]
+            name = h.really_unicode(files[i])
             if status == 'A':
                 added.append(name)
             elif status == 'D':


Mime
View raw message