Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #12 branches with / in it are cut-off #13

Merged
merged 1 commit into from
May 15, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions git.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import std.path : baseName, buildPath, relativePath;
import std.process; // : A whole lotta stuff
import std.range : empty, front, back;
import std.stdio : File;
import std.string : startsWith, strip;
import std.string : startsWith, strip, countchars, chompPrefix;

import time;
import vcs;
Expand Down Expand Up @@ -144,8 +144,12 @@ string getHead(string repoRoot, Duration allottedTime)

// If we're on a branch head, .git/HEAD will look like
// ref: refs/heads/<branch>
if (headSHA.startsWith("ref:"))
return headSHA.baseName;
if (headSHA.startsWith("ref:")) {
if (headSHA.countchars("/") == 2)
return headSHA.baseName;
else
return headSHA.chompPrefix("ref: refs/heads/");
}

// Otherwise let's go rummaging through the refs to find something
immutable refsPath = buildPath(repoRoot, ".git", "refs");
Expand Down