diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-04-22 15:01:27 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-22 23:09:37 +0200 |
commit | d3b9ac07eb44974bb619d71fc6c81c9f2036b96c (patch) | |
tree | ff18f60eb58addac7e2a2008d4d9f1aa43ad3b30 /builtin/branch.c | |
parent | worktree.c: store "id" instead of "git_dir" (diff) | |
download | git-d3b9ac07eb44974bb619d71fc6c81c9f2036b96c.tar.xz git-d3b9ac07eb44974bb619d71fc6c81c9f2036b96c.zip |
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>
Diffstat (limited to 'builtin/branch.c')
-rw-r--r-- | builtin/branch.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/branch.c b/builtin/branch.c index 0adba629d2..bcde87d8e7 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -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; } |