We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c5137a commit 82b7899Copy full SHA for 82b7899
src/Elastic.Markdown/IO/GitConfiguration.cs
@@ -29,9 +29,17 @@ public static GitConfiguration Create(IFileSystem fileSystem)
29
if (!gitConfig.Exists)
30
throw new Exception($"{Paths.Root.FullName} is not a git repository.");
31
32
- var head = Read(".git/HEAD").Replace("ref: ", string.Empty);
33
- var gitRef = Read(".git/" + head);
+ var head = Read(".git/HEAD");
+ var gitRef = head;
34
var branch = head.Replace("refs/heads/", string.Empty);
35
+ //not detached HEAD
36
+ if (head.StartsWith("ref:"))
37
+ {
38
+ head = head.Replace("ref: ", string.Empty);
39
+ gitRef = Read(".git/" + head);
40
+ }
41
+ else
42
+ branch = "detached/head";
43
44
var ini = new FileIniDataParser();
45
using var stream = gitConfig.OpenRead();
0 commit comments