pq-rpm: unbreak patch generation if end point is a tree object
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 10 Feb 2015 12:19:58 +0000 (14:19 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Mar 2015 08:07:47 +0000 (10:07 +0200)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/scripts/pq_rpm.py

index 9572790e1d8a3269646f25cb5f7c7b0f88e4d6e9..09d332e522b92b1adb13f2e8169b2b318556e7a4 100755 (executable)
@@ -85,12 +85,12 @@ def generate_patches(repo, start, squash, end, outdir, options):
             raise GbpError('Invalid treeish object %s' % treeish)
 
     start_sha1 = repo.rev_parse("%s^0" % start)
-    try:
-        end_commit = end
-    except GitRepositoryError:
-        # In case of plain tree-ish objects, assume current branch head is the
-        # last commit
+    # In case of plain tree-ish objects, assume current branch head is the
+    # last commit
+    if repo.get_obj_type(end) == 'tree':
         end_commit = "HEAD"
+    else:
+        end_commit = end
     end_commit_sha1 = repo.rev_parse("%s^0" % end_commit)
 
     start_sha1 = repo.rev_parse("%s^0" % start)