forked from lix-project/lix
Set 'ref' properly for local trees
This commit is contained in:
parent
fa467de090
commit
e2213d77a2
1 changed files with 6 additions and 1 deletions
|
@ -23,6 +23,11 @@ static Path getCacheInfoPathFor(const std::string & name, const Hash & rev)
|
|||
return cacheDir + "/" + linkName + ".link";
|
||||
}
|
||||
|
||||
static std::string readHead(const Path & path)
|
||||
{
|
||||
return chomp(runProgram("git", true, { "-C", path, "rev-parse", "--abbrev-ref", "HEAD" }));
|
||||
}
|
||||
|
||||
static void cacheGitInfo(
|
||||
Store & store,
|
||||
const std::string & name,
|
||||
|
@ -268,7 +273,7 @@ struct GitInput : Input
|
|||
}
|
||||
}
|
||||
|
||||
if (!input->ref) input->ref = isLocal ? "HEAD" : "master";
|
||||
if (!input->ref) input->ref = isLocal ? readHead(actualUrl) : "master";
|
||||
|
||||
Path repoDir;
|
||||
|
||||
|
|
Loading…
Reference in a new issue