grep: optionally recurse into submodules
[gitweb.git] / worktree.c
index 5acfe4cd64967d86462f3958433f3d2f844ead51..c90e0139855bd39343f262c557fd57daaa14650b 100644 (file)
@@ -255,7 +255,7 @@ struct worktree *find_worktree(struct worktree **list,
                return wt;
 
        arg = prefix_filename(prefix, strlen(prefix), arg);
-       path = xstrdup(real_path(arg));
+       path = real_pathdup(arg);
        for (; *list; list++)
                if (!fspathcmp(path, real_path((*list)->path)))
                        break;
@@ -345,6 +345,8 @@ const struct worktree *find_shared_symref(const char *symref,
 
        for (i = 0; worktrees[i]; i++) {
                struct worktree *wt = worktrees[i];
+               if (wt->is_bare)
+                       continue;
 
                if (wt->is_detached && !strcmp(symref, "HEAD")) {
                        if (is_worktree_being_rebased(wt, target)) {