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.
2 parents efafdca + 5f4ee57 commit 43f46d6Copy full SHA for 43f46d6
worktree.c
@@ -50,9 +50,9 @@ static struct worktree *get_main_worktree(void)
50
struct strbuf worktree_path = STRBUF_INIT;
51
52
strbuf_add_absolute_path(&worktree_path, get_git_common_dir());
53
- strbuf_strip_suffix(&worktree_path, "/.");
54
- if (!strbuf_strip_suffix(&worktree_path, "/.git"))
55
+ if (!strbuf_strip_suffix(&worktree_path, "/.git/.") && /* in .git */
+ !strbuf_strip_suffix(&worktree_path, "/.git")) /* in worktree */
+ strbuf_strip_suffix(&worktree_path, "/."); /* in bare repo */
56
57
worktree = xcalloc(1, sizeof(*worktree));
58
worktree->path = strbuf_detach(&worktree_path, NULL);
0 commit comments