From b090c8ce1c7d09a757157c51ba2214f26c3c2a1f Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 5 Aug 2016 12:50:18 +0000 Subject: Make morphcacheserver use rev-list -1 too Change-Id: I0e42ee2fa7545aadd8483ffd9f23ebeaf1d8f2c9 --- morphcacheserver/repocache.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/morphcacheserver/repocache.py b/morphcacheserver/repocache.py index d45cf86a..3a2d3489 100644 --- a/morphcacheserver/repocache.py +++ b/morphcacheserver/repocache.py @@ -65,7 +65,7 @@ class RepoCache(object): if (not self.direct_mode and not ref.startswith('refs/origin/')): ref = 'refs/origin/' + ref - sha1 = self._rev_parse(repo_dir, ref) + sha1 = self._rev_list_1(repo_dir, ref) return sha1, self._tree_from_commit(repo_dir, sha1) except cliapp.AppException: @@ -89,7 +89,7 @@ class RepoCache(object): if not os.path.exists(repo_dir): raise RepositoryNotFoundError(repo_url) try: - sha1 = self._rev_parse(repo_dir, ref) + sha1 = self._rev_list_1(repo_dir, ref) except BaseException: raise InvalidReferenceError(repo_url, ref) @@ -108,7 +108,7 @@ class RepoCache(object): raise RepositoryNotFoundError(repo_url) try: - sha1 = self._rev_parse(repo_dir, ref) + sha1 = self._rev_list_1(repo_dir, ref) except BaseException: raise InvalidReferenceError(repo_url, ref) @@ -140,8 +140,8 @@ class RepoCache(object): transl = lambda x: x if x in valid_chars else '_' return ''.join([transl(x) for x in url]) - def _rev_parse(self, repo_dir, ref): - return self.app.runcmd(['git', 'rev-parse', '--verify', ref], + def _rev_list_1(self, repo_dir, ref): + return self.app.runcmd(['git', 'rev-list', '-1', ref], cwd=repo_dir)[0:40] def _cat_file(self, repo_dir, sha1, filename): -- cgit v1.2.1