git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 6/8] push: test that <src> doesn't DWYM if <dst> is unqualified

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 29, 2018, 05:19 UTC
Message-ID
<xmqqr2g949fa.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181026230741.23321-7-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@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?

Show 18 quoted lines
> +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.

Show 12 quoted lines
> +		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
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 30 of 53 in “add an advice on unqualified <dst> push”
  1. 0/2 add an advice on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 10, 2018
  2. 1/2 i18n: remote.c: mark error(...) messages for translationÆvar Arnfjörð Bjarmason, Oct 10, 2018
  3. Jeff KingOct 10, 2018
  4. 2/2 push: add an advice on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 10, 2018
  5. Jeff KingOct 10, 2018
  6. Ævar Arnfjörð BjarmasonOct 10, 2018
  7. Jeff KingOct 11, 2018
  8. Junio C HamanoOct 11, 2018
  9. Ævar Arnfjörð BjarmasonOct 26, 2018
  10. Junio C HamanoOct 29, 2018
  11. Junio C HamanoOct 29, 2018
  12. 0/7 fixes for unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 26, 2018
  13. 0/8 fixes for unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 26, 2018
  14. Jeff KingNov 2, 2018
  15. 0/7 fixes for unqualified <dst> pushÆvar Arnfjörð Bjarmason, Nov 13, 2018
  16. Junio C HamanoNov 14, 2018
  17. 1/7 remote.c: add braces in anticipation of a follow-up changeÆvar Arnfjörð Bjarmason, Nov 13, 2018
  18. 2/7 i18n: remote.c: mark error(...) messages for translationÆvar Arnfjörð Bjarmason, Nov 13, 2018
  19. 3/7 push: improve the error shown on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Nov 13, 2018
  20. 4/7 push: move unqualified refname error into a functionÆvar Arnfjörð Bjarmason, Nov 13, 2018
  21. 5/7 push: add an advice on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Nov 13, 2018
  22. 6/7 push: test that <src> doesn't DWYM if <dst> is unqualifiedÆvar Arnfjörð Bjarmason, Nov 13, 2018
  23. 7/7 push doc: document the DWYM behavior pushing to unqualified <dst>Ævar Arnfjörð Bjarmason, Nov 13, 2018
  24. 1/8 remote.c: add braces in anticipation of a follow-up changeÆvar Arnfjörð Bjarmason, Oct 26, 2018
  25. 2/8 i18n: remote.c: mark error(...) messages for translationÆvar Arnfjörð Bjarmason, Oct 26, 2018
  26. 3/8 push: improve the error shown on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 26, 2018
  27. Junio C HamanoOct 29, 2018
  28. 4/8 push: move unqualified refname error into a functionÆvar Arnfjörð Bjarmason, Oct 26, 2018
  29. 6/8 push: test that <src> doesn't DWYM if <dst> is unqualifiedÆvar Arnfjörð Bjarmason, Oct 26, 2018
  30. Junio C HamanoOct 29, 2018
  31. 5/8 push: add an advice on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 26, 2018
  32. Junio C HamanoOct 29, 2018
  33. Jeff KingNov 2, 2018
  34. 7/8 push: add DWYM support for "git push refs/remotes/...:<dst>"Ævar Arnfjörð Bjarmason, Oct 26, 2018
  35. Junio C HamanoOct 29, 2018
  36. Ævar Arnfjörð BjarmasonOct 29, 2018
  37. Junio C HamanoNov 1, 2018
  38. Ævar Arnfjörð BjarmasonNov 5, 2018
  39. Junio C HamanoNov 5, 2018
  40. Junio C HamanoOct 29, 2018
  41. Junio C HamanoOct 29, 2018
  42. Ævar Arnfjörð BjarmasonOct 29, 2018
  43. 8/8 push doc: document the DWYM behavior pushing to unqualified <dst>Ævar Arnfjörð Bjarmason, Oct 26, 2018
  44. 1/7 remote.c: add braces in anticipation of a follow-up changeÆvar Arnfjörð Bjarmason, Oct 26, 2018
  45. Stefan BellerOct 26, 2018
  46. 2/7 i18n: remote.c: mark error(...) messages for translationÆvar Arnfjörð Bjarmason, Oct 26, 2018
  47. 3/7 push: improve the error shown on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 26, 2018
  48. 5/7 push: add an advice on unqualified <dst> pushÆvar Arnfjörð Bjarmason, Oct 26, 2018
  49. 6/7 push: test that <src> doesn't DWYM if <dst> is unqualifiedÆvar Arnfjörð Bjarmason, Oct 26, 2018
  50. 7/7 push: add DWYM support for "git push refs/remotes/...:<dst>"Ævar Arnfjörð Bjarmason, Oct 26, 2018
  51. 4/7 push: move unqualified refname error into a functionÆvar Arnfjörð Bjarmason, Oct 26, 2018
  52. Junio C HamanoOct 10, 2018
  53. Jeff KingOct 11, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.