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

change push's refspec behavior to match rev-parse

From
Steffen Prohaska <prohaska@zib.de>
Date
Oct 14, 2007, 08:54 UTC
Message-ID
<11923520851713-git-send-email-prohaska@zib.de>

This patch series addresses recent complaints about the behavior of push/send-pack when expanding short refspecs. The overall idea is to change push's handling of refspecs to match the behavior of rev-parse.

The old way of matching short refspecs in push is often unexpected as discussed in [1]. Now "git push <ref>" resolves ref the same way as rev-parse.

[1] http://marc.info/?l=git&m=119224567631084&w=2

A related question is how to push only the current branch [2]. Now "git push HEAD" is supported to push the current head if a matching remote ref exists.

[2] http://marc.info/?l=git&m=119089831513994&w=2
A summary of the patch series follows below.
    Steffen
 builtin-rev-parse.c   |   27 ++++++++++++-------
 cache.h               |    2 +
 remote.c              |   23 ++++++++++------
 sha1_name.c           |   51 ++++++++++++++++++++++++++++--------
 t/t5516-fetch-push.sh |   68 ++++++++++++++++++++++++++++++++++++++++++++++--
 5 files changed, 138 insertions(+), 33 deletions(-)
 [PATCH 1/6] push, send-pack: fix test if remote branch exists for colon-less refspec
	This is a bug fix that should go to maint. All following patches modifying
        the push test script require this.
 [PATCH 2/6] add get_sha1_with_real_ref() returning full name of ref on demand
	Is required by 3/6 and 4/6
 [PATCH 3/6] rev-parse: teach "git rev-parse --symbolic" to print the full ref name
	A bit off-topic. It demonstrates the use of get_sha1_with_real_ref.
 [PATCH 4/6] push, send-pack: support pushing HEAD to real ref name
	Requires 1/6.
 [PATCH 5/6] add ref_cmp_full_short() comparing full ref name with a short name
 [PATCH 6/6] push, send-pack: use same rules as git-rev-parse to resolve refspecs
	Requires 1/6.
	Note, an updated documentation is not yet included. I like to first wait for
	comments.
Next: Steffen Prohaska
Message 1 of 12 in “change push's refspec behavior to match rev-parse”
  1. Steffen ProhaskaOct 14, 2007
  2. 1/6 push, send-pack: fix test if remote branch exists for colon-less refspecSteffen Prohaska, Oct 14, 2007
  3. 2/6 add get_sha1_with_real_ref() returning full name of ref on demandSteffen Prohaska, Oct 14, 2007
  4. 3/6 rev-parse: teach "git rev-parse --symbolic" to print the full ref nameSteffen Prohaska, Oct 14, 2007
  5. 4/6 push, send-pack: support pushing HEAD to real ref nameSteffen Prohaska, Oct 14, 2007
  6. 5/6 add ref_cmp_full_short() comparing full ref name with a short nameSteffen Prohaska, Oct 14, 2007
  7. 6/6 push, send-pack: use same rules as git-rev-parse to resolve refspecsSteffen Prohaska, Oct 14, 2007
  8. 4/6 push, send-pack: support pushing HEAD to real ref nameSteffen Prohaska, Oct 14, 2007
  9. Johannes SchindelinOct 14, 2007
  10. Steffen ProhaskaOct 14, 2007
  11. 1/6 push, send-pack: fix test if remote branch exists for colon-less refspecSteffen Prohaska, Oct 14, 2007
  12. Steffen ProhaskaOct 14, 2007

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.