Thread (24 messages) flat view 24 messages, 4 authors, 2021-11-10

Re: [PATCH v5 4/4] branch: Protect branches checked out in all worktrees

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-11-10 04:11:22

On Tue, Nov 09 2021, Anders Kaseorg wrote:
quoted hunk ↗ jump to hunk
[...]
 	if (!validate_branchname(name, ref))
 		return 0;
@@ -208,9 +208,11 @@ int validate_new_branchname(const char *name, struct strbuf *ref, int force)
 		die(_("A branch named '%s' already exists."),
 		    ref->buf + strlen("refs/heads/"));
 
-	head = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
-	if (!is_bare_repository() && head && !strcmp(head, ref->buf))
-		die(_("Cannot force update the current branch."));
+	wt = find_shared_symref("HEAD", ref->buf);
+	if (wt && !wt->is_bare)
+		die(_("Cannot force update the branch '%s'"
die() etc. messages should start with lower-case. See CodingGuidelines.

Here you're changing an existing die() message, but since it's something
translators will need to re-do let's fix it while we're at it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help