push: test that <src> doesn't DWYM if <dst> is unqualified
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 been the case, but there haven't been any tests for this behavior. Seef88395ac23
("Renaming push.", 2005-08-03),bb9fca80ce
("git-push: Update description of refspecs and add examples", 2007-06-09) andf8aae12034
("push: allow unqualified dest refspecs to DWIM", 2008-04-23) which are most relevant commits that have changed or documented the behavior of the DWYM feature in the past. These tests were originally meant to lead up to a patch that made refs/remotes/* on the LHS imply refs/heads/* on the RHS, see [1]. That patch proved controversial and may not ever land in git.git, but we should have the tests that remind us what the current behavior is in case it's ever changed. 1. https://public-inbox.org/git/20181026230741.23321-8-avarab@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
dd8dd300c6
commit
bf70636fd7
@ -1249,5 +1249,32 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'refs/remotes/* <src> refspec and unqualified <dst> DWIM and advice' '
|
||||
(
|
||||
cd two &&
|
||||
git tag -a -m "Some tag" my-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/tags-from-two/*" &&
|
||||
git config --add remote.two.fetch "+refs/trees/*:refs/remotes/trees-from-two/*" &&
|
||||
git config --add remote.two.fetch "+refs/blobs/*:refs/remotes/blobs-from-two/*" &&
|
||||
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/tags-from-two/my-tag:dst-tag 2>err &&
|
||||
test_i18ngrep "error: The destination you" err &&
|
||||
|
||||
test_must_fail git push origin refs/remotes/trees-from-two/my-head-tree:dst-tree 2>err &&
|
||||
test_i18ngrep "error: The destination you" err &&
|
||||
|
||||
test_must_fail git push origin refs/remotes/blobs-from-two/my-file-blob:dst-blob 2>err &&
|
||||
test_i18ngrep "error: The destination you" err
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user