]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
Keep a copy of the script that we use for sending git diff emails.
authorJeff Squyres <jsquyres@cisco.com>
Wed, 8 Jan 2014 23:09:46 +0000 (18:09 -0500)
committerJeff Squyres <jsquyres@cisco.com>
Wed, 8 Jan 2014 23:09:46 +0000 (18:09 -0500)
contrib/git/README.txt [new file with mode: 0644]
contrib/git/github-send-commit-mails.pl [new file with mode: 0755]

diff --git a/contrib/git/README.txt b/contrib/git/README.txt
new file mode 100644 (file)
index 0000000..70f5339
--- /dev/null
@@ -0,0 +1,10 @@
+Github doesn't send good diff emails, so we do it ourselves.
+
+On mtt.open-mpi.org, we have a git clone from github.  We then also
+have a local naked git clone that has a post-receive hook that sends
+diff emails.
+
+So via cron, we git pull from github, and then git push to the local
+naked git repo, which then triggers sending the emails.
+
+It's not perfect, but it seems to be good enough.
diff --git a/contrib/git/github-send-commit-mails.pl b/contrib/git/github-send-commit-mails.pl
new file mode 100755 (executable)
index 0000000..e908a30
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env perl
+
+use strict;
+
+use Cwd;
+
+die "Must specify location of source git repo"
+    if ($#ARGV < 0);
+
+sub doit {
+    my ($cmd) = shift;
+
+    my $rc;
+    my $outfile = "/tmp/github-send-email-tmp.$$";
+    unlink($outfile);
+    $rc = system("$cmd >$outfile 2>&1");
+    if (0 != $rc) {
+        print "Command failed: $cmd
+Output:\n";
+        open(IN, $outfile);
+        print $_
+            while (<IN>);
+        close(IN);
+        die "Aborting";
+    }
+    unlink($outfile);
+}
+
+foreach my $src_repo (@ARGV) {
+    die "Specified location of source git repo is invalid"
+        if (! -d $src_repo);
+    chdir($src_repo);
+    die "Could not chdir to $src_repo"
+        if (getcwd() != $src_repo);
+
+    doit("/u/mpiteam/git/local/bin/git fetch");
+    doit("/u/mpiteam/git/local/bin/git push email");
+}
+