[sysadmin-bin: 165/168] ciabot.pl: handle parent-less commits
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 165/168] ciabot.pl: handle parent-less commits
- Date: Thu, 24 May 2012 20:05:19 +0000 (UTC)
commit c1739615a089cc84e44cd781fe5e5116a6215981
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Mon Mar 5 15:20:09 2012 -0500
ciabot.pl: handle parent-less commits
If someone pushes a branch containing commits without a parent
(like the import of some new repository), then ciabot.pl would
choke - handle this case.
https://bugzilla.gnome.org/show_bug.cgi?id=666539
ciabot.pl | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/ciabot.pl b/ciabot.pl
index cb19bed..1f93863 100755
--- a/ciabot.pl
+++ b/ciabot.pl
@@ -102,7 +102,7 @@ $alt_local_message_target = "";
### The code itself
-use vars qw ($commit $tree @parent $author $committer);
+use vars qw ($commit $tree @parents $parent $author $committer);
use vars qw ($user $branch $rev @files $logmsg $message $module);
my $line;
@@ -142,7 +142,7 @@ while (defined ($line = <COMMIT>)) {
if ($key eq 'tree') {
$tree = $value;
} elsif ($key eq 'parent') {
- push(@parent, $value);
+ push(@parents, $value);
} elsif ($key eq 'author') {
$author = $value;
} elsif ($key eq 'committer') {
@@ -151,6 +151,11 @@ while (defined ($line = <COMMIT>)) {
}
close COMMIT;
+if (@parents) {
+ $parent = $parents[0];
+} else {
+ $parent = '--root';
+}
open DIFF, "git-diff-tree -r $parent[0] $tree|" or die "git-diff-tree $parent[0] $tree: $!";
while (defined ($line = <DIFF>)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]