worktree.c: make find_shared_symref() return struct worktree *
This gives the caller more information and they can answer things like, "is it the main worktree" or "is it the current worktree". The latter question is needed for the "checkout a rebase branch" case later. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
69dfe3b942
commit
d3b9ac07eb
@ -220,12 +220,12 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
|
||||
name = mkpathdup(fmt, bname.buf);
|
||||
|
||||
if (kinds == FILTER_REFS_BRANCHES) {
|
||||
char *worktree = find_shared_symref("HEAD", name);
|
||||
if (worktree) {
|
||||
const struct worktree *wt =
|
||||
find_shared_symref("HEAD", name);
|
||||
if (wt) {
|
||||
error(_("Cannot delete branch '%s' "
|
||||
"checked out at '%s'"),
|
||||
bname.buf, worktree);
|
||||
free(worktree);
|
||||
bname.buf, wt->path);
|
||||
ret = 1;
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user