[commit: ghc] master: sync-all : Warn on 'pull' operation if not on master branch. (968998e)

Erik de Castro erikd at ghc.haskell.org
Mon Aug 5 03:23:55 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/968998e69a745e38a47f4771a3244008f19ebc4a

>---------------------------------------------------------------

commit 968998e69a745e38a47f4771a3244008f19ebc4a
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Mon Aug 5 11:22:04 2013 +1000

    sync-all : Warn on 'pull' operation if not on master branch.

>---------------------------------------------------------------

 sync-all |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sync-all b/sync-all
index fc629df..00d14bb 100755
--- a/sync-all
+++ b/sync-all
@@ -551,6 +551,18 @@ sub gitall {
     unlink "resume";
 }
 
+sub checkCurrentBranchIsMaster {
+    my $branch = `git symbolic-ref HEAD`;
+    $branch =~ s/refs\/heads\///;
+    $branch =~ s/\n//;
+
+    if ($branch !~ /master/) {
+        print "\nWarning: You trying to 'pull' while on branch '$branch'.\n"
+            . "Updates to this script will happen on the master branch which\n"
+            . "means the version on this branch may be out of date.\n\n";
+    }
+}
+
 sub help
 {
         my $exit = shift;
@@ -889,6 +901,9 @@ sub main {
 }
 
 BEGIN {
+    if ("pull" ~~ @ARGV) {
+        checkCurrentBranchIsMaster();
+    }
     $initial_working_directory = getcwd();
 }
 






More information about the ghc-commits mailing list