diff options
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/fetchers/git.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libstore/fetchers/git.cc b/src/libstore/fetchers/git.cc index 134d44ecd..9276b0993 100644 --- a/src/libstore/fetchers/git.cc +++ b/src/libstore/fetchers/git.cc @@ -217,7 +217,16 @@ struct GitInput : Input /* Check whether this repo has any commits. There are probably better ways to do this. */ - bool haveCommits = !readDirectory(actualUrl + "/.git/refs/heads").empty(); + auto gitDir = actualUrl + "/.git"; + auto commonGitDir = chomp(runProgram( + "git", + true, + { "-C", actualUrl, "rev-parse", "--git-common-dir" } + )); + if (commonGitDir != ".git") + gitDir = commonGitDir; + + bool haveCommits = !readDirectory(gitDir + "/refs/heads").empty(); try { if (haveCommits) { |