From 45cb4d6808ba5de59bceaa1e320ef69088da99d9 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 10 Mar 2024 13:14:31 -0700 Subject: [PATCH] grow: disambiguate branches and pathspec when checking out branches Use the "--" end-of-options marker to make it clear to "git" that we want to checkout a branch when a directory or file exists with the same name. --- src/cmds/grow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmds/grow.rs b/src/cmds/grow.rs index d533bb9e..00aace84 100644 --- a/src/cmds/grow.rs +++ b/src/cmds/grow.rs @@ -426,7 +426,7 @@ fn update_tree_from_context( // Checkout the configured branch if we are creating the repository initially. if checkout && !branch.is_empty() && tree.branches.contains_key(branch) { - let command = ["git", "checkout", branch]; + let command = ["git", "checkout", branch, "--"]; let exec = cmd::exec_in_dir(&command, path); let status = cmd::status(exec); if status != errors::EX_OK {