Skip to content

Commit

Permalink
Merge branch 'jk/clone-allow-bare-and-o-together' into maint-2.38
Browse files Browse the repository at this point in the history
"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"
  • Loading branch information
gitster committed Oct 26, 2022
2 parents 665d7e0 + 3b910d6 commit 0d5d929
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 0 additions & 3 deletions builtin/clone.c
Expand Up @@ -931,9 +931,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
option_bare = 1;

if (option_bare) {
if (option_origin)
die(_("options '%s' and '%s %s' cannot be used together"),
"--bare", "--origin", option_origin);
if (real_git_dir)
die(_("options '%s' and '%s' cannot be used together"), "--bare", "--separate-git-dir");
option_no_checkout = 1;
Expand Down
9 changes: 5 additions & 4 deletions t/t5606-clone-options.sh
Expand Up @@ -42,11 +42,12 @@ test_expect_success 'rejects invalid -o/--origin' '
'

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

Expand Down

0 comments on commit 0d5d929

Please sign in to comment.