From 2d4003516e1b53fe0395978ea88dc3f725313dbb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 14 2014 17:26:13 +0000 Subject: Fix two bugs in view_file - Try retrieving the commit using the identifier provided - Set the correct branchname according to commit retrieved --- diff --git a/progit/app.py b/progit/app.py index 54de86b..9d412e9 100644 --- a/progit/app.py +++ b/progit/app.py @@ -158,12 +158,13 @@ def view_file(repo, identifier, filename): branch = repo_obj.lookup_branch(identifier) commit = branch.get_object() else: - branchname = 'master' try: - commit = repo_obj.get(commitid) + commit = repo_obj.get(identifier) + branchname = identifier except ValueError: # If it's not a commit id then it's part of the filename commit = repo_obj[repo_obj.head.target] + branchname = 'master' def __get_file_in_tree(tree, filepath): ''' Retrieve the entry corresponding to the provided filename in a