]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/clone-allow-bare-and-o-together'
authorJunio C Hamano <gitster@pobox.com>
Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Oct 2022 17:08:39 +0000 (10:08 -0700)
"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"

builtin/clone.c
t/t5606-clone-options.sh

index d269d6fec68ce409cac6e659d8e78e602b1ce4b8..ed8d44bb6ab72857508824958f6857ca4b0cff64 100644 (file)
@@ -929,9 +929,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;
index f6bb02ab947c1de61484e95e0f4a6228a16da103..cf221e92c4d97e852f1bdefbf61f6caded87aff2 100755 (executable)
@@ -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
 
 '