diff options
author | nfnty <git@nfnty.se> | 2015-10-16 09:07:10 +0200 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2016-02-08 04:43:04 +0100 |
commit | bfbb84ff426810590be5e10f625a7f14ac75a3b2 (patch) | |
tree | 81b29cf721d6b03ef88131e129aa94c6c121e3aa | |
parent | 92ed0b31b775dfa25bf417520c830273142a185e (diff) | |
download | ranger-bfbb84ff426810590be5e10f625a7f14ac75a3b2.tar.gz |
VCS: Escape special characters in git summary
-rw-r--r-- | ranger/ext/vcs/git.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py index 0a091064..214fe63e 100644 --- a/ranger/ext/vcs/git.py +++ b/ranger/ext/vcs/git.py @@ -66,7 +66,7 @@ class Git(Vcs): """Gets a list of dicts containing revision info, for the revisions matching refspec""" args = [ '--no-pager', 'log', - '--pretty={"short": "%h", "revid": "%H", "author": "%an", "date": %ct, "summary": "%s"}' + '--pretty={%x00short%x00: %x00%h%x00, %x00revid%x00: %x00%H%x00, %x00author%x00: %x00%an <%ae>%x00, %x00date%x00: %ct, %x00summary%x00: %x00%s%x00}' ] if refspec: args += ['-1', refspec] @@ -76,7 +76,8 @@ class Git(Vcs): args += ['--'] + filelist log = [] - for line in self._git(args, catchout=True).splitlines(): + for line in self._git(args, catchout=True)\ + .replace('\\', '\\\\').replace('"', '\\"').replace('\x00', '"').splitlines(): line = json.loads(line) line['date'] = datetime.fromtimestamp(line['date']) log.append(line) |