Erik de Castro Lopo wrote: > Simon Peyton-Jones wrote: > > > I'd done that (repeatedly). BUT, as has often happened before, I'd > > forgotten > > that my tree was on a different branch, and pulling of course has no effect > > on > > the branch. Rats. Note to self: whenever anything odd happens, check you > > are on 'master'. > > Better yet, the sync-all script should detect whether it is on master and > error out (with a decent error message) if not. > > That way you (and I and others) don't have to remember this particular failure > mode. > > My Perl coding skills are rather rusty, but I'll have a go at this.
Attached is a patch that checks that the current branch is master and bails if it isn't. If no one sees anything obviously wrong with this I'll push it. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
>From d692f589357337bcc0b9f618306249a1f9ec3c12 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo <er...@mega-nerd.com> Date: Sun, 4 Aug 2013 11:56:16 +1000 Subject: [PATCH] sync-all : Bail out if not on master branch. --- sync-all | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sync-all b/sync-all index fc629df..6497b95 100755 --- a/sync-all +++ b/sync-all @@ -551,6 +551,17 @@ sub gitall { unlink "resume"; } +sub assertCurrentBranchIsMaster { + my $branch = `git symbolic-ref HEAD` ; + $branch =~ s/refs\/heads\/// ; + $branch =~ s/\n// ; + + if ($branch !~ /master/) { + die "\nError: You are currently on branch '$branch'.\n" + . "Switch back to master to run 'sync-all'.\n\n" + } +} + sub help { my $exit = shift; @@ -889,6 +900,7 @@ sub main { } BEGIN { + assertCurrentBranchIsMaster(); $initial_working_directory = getcwd(); } -- 1.8.4.rc1
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs