Ævar Arnfjörð Bjarmason  <ava...@gmail.com> writes:

> Add a test asserting that "git push origin <src>:<dst>" where <src> is
> a branch, tag, tree or blob in refs/remotes/* doesn't DWYM when <dst>
> is unqualified. This has never worked, but there's been no test for
> this behavior.

"has never worked" sounded as if there is a breakage, but that is
not what meant here.  We didn't DWIM overly agressively (which would
have led us to possibly push into a wrong place) and correctly
rejected the push instead, right?

> +test_expect_success 'refs/remotes/* <src> refspec and unqualified <dst> DWIM 
> and advice' '
> +     (
> +             cd two &&
> +             git tag -a -m "Some tag" some-tag master &&
> +             git update-ref refs/trees/my-head-tree HEAD^{tree} &&
> +             git update-ref refs/blobs/my-file-blob HEAD:file
> +     ) &&
> +     (
> +             cd test &&
> +             git config --add remote.two.fetch 
> "+refs/tags/*:refs/remotes/two-tags/*" &&
> +             git config --add remote.two.fetch 
> "+refs/trees/*:refs/remotes/two-trees/*" &&
> +             git config --add remote.two.fetch 
> "+refs/blobs/*:refs/remotes/two-blobs/*" &&
> +             git fetch --no-tags two &&
> +
> +             test_must_fail git push origin refs/remotes/two/another:dst 
> 2>err &&
> +             test_i18ngrep "error: The destination you" err &&
> +
> +             test_must_fail git push origin 
> refs/remotes/two-tags/some-tag:dst-tag 2>err &&

This made me go "Huh?  some-tag is one tag; what is the other tag in
two-tags/ hierarchy?"  I think you meant by "two-tags" a hierarchy
to store tags taken from the remote "two"; calling it "tags-from-two"
may have avoided such a confusion.

> +             test_i18ngrep "error: The destination you" err &&
> +
> +             test_must_fail git push origin 
> refs/remotes/two-trees/my-head-tree:dst-tree 2>err &&
> +             test_i18ngrep "error: The destination you" err &&
> +
> +             test_must_fail git push origin 
> refs/remotes/two-blobs/my-file-blob:dst-blob 2>err &&
> +             test_i18ngrep "error: The destination you" err
> +     )
> +'
> +
>  
>  test_done

Reply via email to