Skip to content

Commit 0d5d929

Browse files
committed
Merge branch 'jk/clone-allow-bare-and-o-together' into maint-2.38
"git clone" did not like to see the "--bare" and the "--origin" options used together without a good reason. * jk/clone-allow-bare-and-o-together: clone: allow "--bare" with "-o"
2 parents 665d7e0 + 3b910d6 commit 0d5d929

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

builtin/clone.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
931931
option_bare = 1;
932932

933933
if (option_bare) {
934-
if (option_origin)
935-
die(_("options '%s' and '%s %s' cannot be used together"),
936-
"--bare", "--origin", option_origin);
937934
if (real_git_dir)
938935
die(_("options '%s' and '%s' cannot be used together"), "--bare", "--separate-git-dir");
939936
option_no_checkout = 1;

t/t5606-clone-options.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ test_expect_success 'rejects invalid -o/--origin' '
4242
4343
'
4444

45-
test_expect_success 'disallows --bare with --origin' '
45+
test_expect_success 'clone --bare -o' '
4646
47-
test_must_fail git clone -o foo --bare parent clone-bare-o 2>err &&
48-
test_debug "cat err" &&
49-
test_i18ngrep -e "options .--bare. and .--origin foo. cannot be used together" err
47+
git clone -o foo --bare parent clone-bare-o &&
48+
(cd parent && pwd) >expect &&
49+
git -C clone-bare-o config remote.foo.url >actual &&
50+
test_cmp expect actual
5051
5152
'
5253

0 commit comments

Comments
 (0)