{"thread":{"id":"54680","subject":"[PATCH] worktree: fix order of arguments in error message","startedAt":"2020-11-20T15:09:53Z","lastAt":"2020-11-20T16:24:24Z","messageCount":2,"participants":["Matheus Tavares","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"410422","messageId":"1d740e0d4fc08a9f420373c6cd0a554b3b4b1f40.1605883395.git.matheus.bernardino@usp.br","threadId":"54680","inReplyTo":null,"subject":"[PATCH] worktree: fix order of arguments in error message","fromName":"Matheus Tavares","fromEmail":"matheus.bernardino@usp.br","sentAt":"2020-11-20T15:09:39Z","receivedAt":"2020-11-20T15:09:53Z","isPatch":true,"sender":{"key":"matheus.tavb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701583?v=4"},"body":"`git worktree add` (without --force) errors out when given a path\nthat is already registered as a worktree and the path is missing on\ndisk. But the `cmd` and `path` strings are switched on the error\nmessage. Let's fix that.\n\nSigned-off-by: Matheus Tavares <matheus.bernardino@usp.br>\n---\n builtin/worktree.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex ce56fdaaa9..197fd24a55 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -304,9 +304,9 @@ static void check_candidate_path(const char *path,\n \t}\n \n \tif (locked)\n-\t\tdie(_(\"'%s' is a missing but locked worktree;\\nuse '%s -f -f' to override, or 'unlock' and 'prune' or 'remove' to clear\"), cmd, path);\n+\t\tdie(_(\"'%s' is a missing but locked worktree;\\nuse '%s -f -f' to override, or 'unlock' and 'prune' or 'remove' to clear\"), path, cmd);\n \telse\n-\t\tdie(_(\"'%s' is a missing but already registered worktree;\\nuse '%s -f' to override, or 'prune' or 'remove' to clear\"), cmd, path);\n+\t\tdie(_(\"'%s' is a missing but already registered worktree;\\nuse '%s -f' to override, or 'prune' or 'remove' to clear\"), path, cmd);\n }\n \n static int add_worktree(const char *path, const char *refname,\n-- \n2.28.0\n\n"},{"id":"410425","messageId":"CAPig+cS7SEARwoBn25SsxhkvdJfDe56FyVjDGk+sJq2kXfDbjQ@mail.gmail.com","threadId":"54680","inReplyTo":"1d740e0d4fc08a9f420373c6cd0a554b3b4b1f40.1605883395.git.matheus.bernardino@usp.br","subject":"Re: [PATCH] worktree: fix order of arguments in error message","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-11-20T16:24:03Z","receivedAt":"2020-11-20T16:24:24Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Nov 20, 2020 at 10:09 AM Matheus Tavares\n<matheus.bernardino@usp.br> wrote:\n> `git worktree add` (without --force) errors out when given a path\n> that is already registered as a worktree and the path is missing on\n> disk. But the `cmd` and `path` strings are switched on the error\n> message. Let's fix that.\n\nThanks. This problem was introduced quite recently by d179af679b\n(worktree: generalize candidate worktree path validation, 2020-06-10).\n\n> Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>\n> ---\n> -               die(_(\"'%s' is a missing but locked worktree;\\nuse '%s -f -f' to override, or 'unlock' and 'prune' or 'remove' to clear\"), cmd, path);\n> +               die(_(\"'%s' is a missing but locked worktree;\\nuse '%s -f -f' to override, or 'unlock' and 'prune' or 'remove' to clear\"), path, cmd);\n\nThe fix is obviously correct. For what it's worth, this patch is:\n\nReviewed-by: Eric Sunshine <sunshine@sunshineco.com>\n"}]}