aboutsummaryrefslogtreecommitdiff
path: root/builtin/worktree.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r--builtin/worktree.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 4035b1cb06..4fd6f7575f 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -692,25 +692,8 @@ static int can_use_local_refs(const struct add_opts *opts)
if (refs_head_ref(get_main_ref_store(the_repository), first_valid_ref, NULL)) {
return 1;
} else if (refs_for_each_branch_ref(get_main_ref_store(the_repository), first_valid_ref, NULL)) {
- if (!opts->quiet) {
- struct strbuf path = STRBUF_INIT;
- struct strbuf contents = STRBUF_INIT;
- char *wt_gitdir = get_worktree_git_dir(NULL);
-
- strbuf_add_real_path(&path, wt_gitdir);
- strbuf_addstr(&path, "/HEAD");
- strbuf_read_file(&contents, path.buf, 64);
- strbuf_stripspace(&contents, NULL);
- strbuf_strip_suffix(&contents, "\n");
-
- warning(_("HEAD points to an invalid (or orphaned) reference.\n"
- "HEAD path: '%s'\n"
- "HEAD contents: '%s'"),
- path.buf, contents.buf);
- strbuf_release(&path);
- strbuf_release(&contents);
- free(wt_gitdir);
- }
+ if (!opts->quiet)
+ warning(_("HEAD points to an invalid (or orphaned) reference.\n"));
return 1;
}
return 0;