]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/worktree.c
worktree: factor out repeated string literal
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 8 Jun 2020 06:23:49 +0000 (02:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 Jun 2020 20:31:27 +0000 (13:31 -0700)
commitc9b77f2cea2f0b4ee34d1d7a25cd1ebed767caf4
treee98a6d1be1cee5ce86270ae5117f11d10dd2bf5d
parentaf6b65d45ef179ed52087e80cb089f6b2349f4ec
worktree: factor out repeated string literal

For each worktree removed by "git worktree prune", it reports the reason
for the removal. All reasons share the common prefix "Removing
worktrees/%s:". As new removal reasons are added, this prefix needs to
be duplicated, which is error-prone and potentially cumbersome.
Therefore, factor out the common prefix.

Although this change seems to increase the "sentence lego quotient", it
should be reasonably safe, as the reason for removal is a distinct
clause, not strictly related to the prefix. Moreover, the "worktrees" in
"Removing worktrees/%s:" is a path literal which ought not be localized,
so by factoring it out, we can more easily avoid exposing that path
fragment to translators.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c