I get a missing branch(?) when performing 'status', bug in hits or a local configuration problem? TIA, Robert
>gits status
gits unexpected status output (missing branch): at /usr/local/bin/gits line 2720.
- OS-X 10.9.2
- gitslave via homebrew (brew install gitslave)
- gits --version
- gits version 2.0.2
- git version 1.9.0
- This is perl 5, version 16, subversion 2 (v5.16.2) built for darwin-thread-multi
(with 3 registered patches, see perl -V for more detail)
git version 1.8.5.2 (Apple Git-48) and UP no longer prints status messages with a leading '# '. So the regex on line 2720 fails. You can comment it out or fix the regex and the problem will go away.
Last edit: justin stofle 2014-03-11
Thanks! I just commented it out as I do not really work with detached HEADs (Not sure when else you would not be on a branch...).
I guess when I pulled/installed the 2.0.2 git from "brew install git --HEAD" I did not notice the change in the status output...
Just found the same issue with "gits detach" and on branch checkouts.
I pulled/installed the head of gitslave from the repo to see if the issue still exists, there are more areas, but here are some of the areas that I came across:
Last edit: Robert N/SushiHangover 2014-03-11
I was able to fix this by commenting out lines 2715-2718 and changing the regex on line 2720 to s/^(?:# )?(?:On branch |Not currently on any branch.)(.+)?\n?//
Lines 2714 through 2720 now look like this:
my ($premove);
#while ($msg =~ s/(^[^#].*\n)//)
#{
# $premove .= $1;
#}
die "gits unexpected status output (missing branch): $msg" unless ($msg =~ s/^(?:# )?(?:On branch |Not currently on any branch.)(.+)?\n?//);
Last edit: justin stofle 2014-03-11
Thanks Justin.
I pulled the latest code, applied your change to multiple areas... Status, attach, detach all seem to be fine...
-R
Hi folks,
While gits definitely needs to be overhauled for the change in "git status" output introduced in 1.8.5, for the time being we can ask git to continue to give us the old-style output. When one looks closely at the gits code, it becomes (almost painfully) apparent that the hash-mark prefix is expected in many, many regexps, not just those mentioned in the previous patch offerings. The following patch, simply makes gits ask git to give us the old-syle status output whenever such is relevant.
diff --git a/gits b/gits
index 202bb32..c2582c5 100755
--- a/gits
+++ b/gits
@@ -59,7 +59,7 @@ my ($returncode) = 0;
my $pagination;
delete($ENV{'GIT_DIR'});
our($fromcheckout);
-our($git) = 'git';
+our($git) = 'git -c status.displayCommentPrefix=true';
# Some people are stupid enough to set CDPATH and that screws up the formatting
delete($ENV{'CDPATH'});
Applied the patch in this gitslave fork:
https://github.com/joelpurra/gitslave/commit/4c602f89d91b20aa8e9e834bc92f611fdcff7c4a
https://github.com/joelpurra/gitslave
Thanks!
If you're using
brewon Mac OS X, I've added the gitslave fork to a custom tap. The above fix is included in this fork.The tap is so that
brewcan keep track of updates to the fork.