Browse Source

Merge branch 'es/worktree-code-cleanup'

Code cleanup.

* es/worktree-code-cleanup:
  worktree: avoid dead-code in conditional
maint
Junio C Hamano 5 years ago
parent
commit
43f46d6da5
  1. 6
      worktree.c

6
worktree.c

@ -50,9 +50,9 @@ static struct worktree *get_main_worktree(void) @@ -50,9 +50,9 @@ static struct worktree *get_main_worktree(void)
struct strbuf worktree_path = STRBUF_INIT;

strbuf_add_absolute_path(&worktree_path, get_git_common_dir());
strbuf_strip_suffix(&worktree_path, "/.");
if (!strbuf_strip_suffix(&worktree_path, "/.git"))
strbuf_strip_suffix(&worktree_path, "/.");
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 */

worktree = xcalloc(1, sizeof(*worktree));
worktree->path = strbuf_detach(&worktree_path, NULL);

Loading…
Cancel
Save