[sysadmin-bin: 112/168] gnome-post-receive-email: Handle initial push
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 112/168] gnome-post-receive-email: Handle initial push
- Date: Thu, 24 May 2012 20:00:52 +0000 (UTC)
commit ab95168af631d46b1d9e339cc368a1ab8ca5bada
Author: Todd Zullinger <tmz pobox com>
Date: Wed Jul 22 13:22:11 2009 -0400
gnome-post-receive-email: Handle initial push
Commit fe7b408 (Don't show commits since the beginning of time for
branch creation) introduced a check which uses the parent of the first
commit we're interested in showing. If this hook is enabled when the
initial push is made to the repository, that commit has no parent and
the call to git rev-list yields an error (and 128 return code). This
prevents that by checking that the parent of first_detailed_commit is a
valid ref before using it.
gnome-post-receive-email | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gnome-post-receive-email b/gnome-post-receive-email
index 577229f..2950832 100755
--- a/gnome-post-receive-email
+++ b/gnome-post-receive-email
@@ -236,9 +236,15 @@ class BranchChange(RefChange):
# branch creation was processed first.
#
if len(detailed_commits) > 0:
- first_detailed_commit = detailed_commits[-1]
- self.added_commits = rev_list_commits(first_detailed_commit + "^.." + self.newrev)
- self.added_commits.reverse()
+ # Verify parent of first detailed commit is valid. On initial push, it is not.
+ parent = detailed_commits[-1] + "^"
+ try:
+ validref = git.rev_parse(parent, _quiet=True)
+ except CalledProcessError:
+ self.added_commits = []
+ else:
+ self.added_commits = rev_list_commits(parent + ".." + self.newrev)
+ self.added_commits.reverse()
else:
self.added_commits = []
self.removed_commits = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]