Skip to content

Commit

Permalink
grow: disambiguate branches and pathspec when checking out branches
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davvid committed Mar 10, 2024
1 parent 12aaaa0 commit 45cb4d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmds/grow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 45cb4d6

Please sign in to comment.