Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Reimplement git filesystem charset handling

Make use of the new encoding handling implemented in the
`PyGit.Storage`. So now Trac should always get pathnames as unicode
objects.

A new TracIni option `git_fs_encoding` can be used to change the
default utf8 encoding.

This implementation assumes `from_unicode(to_unicode(.))` to be an
identity function.
  • Loading branch information...
commit 35171676ba04bd1d6e4eb01f493864fdc94a8607 1 parent b93a90d
Herbert Valerio Riedel authored

Showing 1 changed file with 9 additions and 2 deletions. Show diff stats Hide diff stats

  1. +9 2 tracext/git/git_fs.py
11 tracext/git/git_fs.py
@@ -163,6 +163,9 @@ def get_link_resolvers(self):
163 163 "use git-committer-author timestamp instead of git-author timestamp"
164 164 " as changeset timestamp")
165 165
  166 + _git_fs_encoding = Option('git', 'git_fs_encoding', 'utf-8',
  167 + "define charset encoding of paths within git repository")
  168 +
166 169 _git_bin = PathOption('git', 'git_bin', '/usr/bin/git',
167 170 "path to git executable (relative to trac project folder!)")
168 171
@@ -215,6 +218,7 @@ def rlookup_uid(_):
215 218 repos = GitRepository(dir, params, self.log,
216 219 persistent_cache=self._persistent_cache,
217 220 git_bin=self._git_bin,
  221 + git_fs_encoding=self._git_fs_encoding,
218 222 shortrev_len=self._shortrev_len,
219 223 rlookup_uid=rlookup_uid,
220 224 use_committer_id=self._use_committer_id,
@@ -317,6 +321,7 @@ class GitRepository(Repository):
317 321 def __init__(self, path, params, log,
318 322 persistent_cache=False,
319 323 git_bin='git',
  324 + git_fs_encoding='utf-8',
320 325 shortrev_len=7,
321 326 rlookup_uid=lambda _: None,
322 327 use_committer_id=False,
@@ -331,7 +336,9 @@ def __init__(self, path, params, log,
331 336 self._use_committer_time = use_committer_time
332 337 self._use_committer_id = use_committer_id
333 338
334   - self.git = PyGIT.StorageFactory(path, log, not persistent_cache, git_bin=git_bin).getInstance()
  339 + self.git = PyGIT.StorageFactory(path, log, not persistent_cache,
  340 + git_bin=git_bin,
  341 + git_fs_encoding=git_fs_encoding).getInstance()
335 342
336 343 Repository.__init__(self, "git:"+path, self.params, log)
337 344
@@ -632,7 +639,7 @@ def get_changes(self):
632 639
633 640 paths_seen.add(path)
634 641
635   - yield (to_unicode(path), kind, action, to_unicode(p_path), p_rev)
  642 + yield path, kind, action, p_path, p_rev
636 643
637 644
638 645 def get_branches(self):

0 comments on commit 3517167

Please sign in to comment.
Something went wrong with that request. Please try again.