Permalink
Browse files

Use HEAD as the rev when rev=None. Closes: #5612

  • Loading branch information...
pacopablo committed Aug 27, 2009
1 parent de4a69b commit 8c295406c91521f962864b85ced4a762080f4b82
Showing with 4 additions and 2 deletions.
  1. +2 −1 tracext/git/PyGIT.py
  2. +2 −1 tracext/git/git_fs.py
View
@@ -481,7 +481,7 @@ def get_tags(self):
return [e.strip() for e in self.repo.tag("-l").splitlines()]
def ls_tree(self, rev, path=""):
- rev = str(rev) # paranoia
+ rev = rev and str(rev) or 'HEAD' # paranoia
if path.startswith('/'):
path = path[1:]
@@ -646,6 +646,7 @@ def diff_tree(self, tree1, tree2, path="", find_renames=False):
# diff-tree returns records with the following structure:
# :<old-mode> <new-mode> <old-sha> <new-sha> <change> NUL <old-path> NUL [ <new-path> NUL ]
+ path = path.strip("/")
diff_tree_args = ["-z", "-r"]
if find_renames:
diff_tree_args.append("-M")
View
@@ -192,7 +192,7 @@ def get_oldest_rev(self):
return self.git.oldest_rev()
def normalize_path(self, path):
- return path and path.strip('/') or ''
+ return path and path.strip('/') or '/'
def normalize_rev(self, rev):
if not rev:
@@ -278,6 +278,7 @@ def __init__(self, git, path, rev, log, ls_tree_info=None):
self.fs_sha = None # points to either tree or blobs
self.fs_perm = None
self.fs_size = None
+ rev = rev and str(rev) or 'HEAD'
kind = Node.DIRECTORY
p = path.strip('/')

0 comments on commit 8c29540

Please sign in to comment.