Revert "Merge branch 'yn/worktree-add-no-dwim-with-b' into next"
This reverts commitnext9d682832cd, reversing changes made tobb96050841to take yet another reroll.
parent
b6c8351461
commit
08866a6d13
|
|
@ -898,18 +898,16 @@ static int add(int ac, const char **av, const char *prefix,
|
|||
/* DWIM: Infer --orphan when repo has no refs. */
|
||||
opts.orphan = (!s) && dwim_orphan(&opts, !!opt_track, 1);
|
||||
} else if (ac == 2) {
|
||||
if (!new_branch) {
|
||||
struct object_id oid;
|
||||
struct commit *commit;
|
||||
char *remote;
|
||||
struct object_id oid;
|
||||
struct commit *commit;
|
||||
char *remote;
|
||||
|
||||
commit = lookup_commit_reference_by_name(branch);
|
||||
if (!commit) {
|
||||
remote = unique_tracking_name(branch, &oid, NULL);
|
||||
if (remote) {
|
||||
new_branch = branch;
|
||||
branch = new_branch_to_free = remote;
|
||||
}
|
||||
commit = lookup_commit_reference_by_name(branch);
|
||||
if (!commit) {
|
||||
remote = unique_tracking_name(branch, &oid, NULL);
|
||||
if (remote) {
|
||||
new_branch = branch;
|
||||
branch = new_branch_to_free = remote;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -621,16 +621,6 @@ test_expect_success '"add" <path> <branch> dwims' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success '"add" <path> <branch> does not dwim with -b' '
|
||||
test_when_finished rm -rf repo_upstream repo_dwim wt &&
|
||||
setup_remote_repo repo_upstream repo_dwim &&
|
||||
(
|
||||
cd repo_dwim &&
|
||||
test_must_fail git worktree add -b branch ../wt foo 2>actual &&
|
||||
test_grep "^fatal: invalid reference: foo" actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success '"add" <path> <branch> dwims with checkout.defaultRemote' '
|
||||
test_when_finished rm -rf repo_upstream repo_dwim foo &&
|
||||
setup_remote_repo repo_upstream repo_dwim &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue