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

[PATCH 0/6] implement @{push} shorthand

From
Jeff King <peff@peff.net>
Date
Mar 31, 2015, 17:33 UTC
Message-ID
<20150331173339.GA17732@peff.net>

The basic idea is that in a triangular workflow, it's useful to be able to refer to both @{upstream} and "the place I would push to" with a shorthand. This idea was discussed over a year ago:

  http://thread.gmane.org/gmane.comp.version-control.git/240144/focus=240198

I've found it useful since then, so I decided to clean it up and submit it. This iteration renames it to "@{push}" (rather than "@{publish}"), which is more descriptive. It's rebased, as there were some changes in the area, and it also fixes some bugs in the original (of course, I may also have _introduced_ bugs, as this is largely a rewrite that has not had a year's worth of exercise).

I also took the opportunity to do some more aggressive refactoring of the remote.c code, as there were some bits there that confused me every time I looked at it. I think the result is easier to follow.

  [1/6]: remote.c: drop default_remote_name variable
  [2/6]: remote.c: drop "remote" pointer from "struct branch"
  [3/6]: remote.c: hoist branch.*.remote lookup out of remote_get_1
  [4/6]: remote.c: provide per-branch pushremote name
  [5/6]: sha1_name: refactor upstream_mark
  [6/6]: sha1_name: implement @{push} shorthand

The one thing I _didn't_ do here is refactor the logic in builtin/push.c so what we could reuse it. There's still a switch statement here on push_default. I don't like that, but I spent an hour or so trying to pull out the push.c logic, and it got rather nasty. There are a lot of global variables that get mutated by one-off functions, and it all needs to happen in the right order. It looked like any serious refactoring there is going to have a risk of regressions in push.

So I punted on that. The simplified logic that is here in sha1_name is not too bad, and I feel like we can unify the two at a later date if we want to. And I'd much rather see bug reports like "@{push} doesn't act like git-push" and deal with that, as opposed to "your series breaks push".

-Peff
Next: Jeff King
Message 1 of 18 in “implement @{push} shorthand”
  1. 0/6 implement @{push} shorthandJeff King, Mar 31, 2015
  2. 1/6 remote.c: drop default_remote_name variableJeff King, Mar 31, 2015
  3. Junio C HamanoMar 31, 2015
  4. Jeff KingMar 31, 2015
  5. 2/6 remote.c: drop "remote" pointer from "struct branch"Jeff King, Mar 31, 2015
  6. Junio C HamanoMar 31, 2015
  7. Jeff KingMar 31, 2015
  8. Junio C HamanoMar 31, 2015
  9. 3/6 remote.c: hoist branch.*.remote lookup out of remote_get_1Jeff King, Mar 31, 2015
  10. 4/6 remote.c: provide per-branch pushremote nameJeff King, Mar 31, 2015
  11. Junio C HamanoMar 31, 2015
  12. 5/6 sha1_name: refactor upstream_markJeff King, Mar 31, 2015
  13. 6/6 sha1_name: implement @{push} shorthandJeff King, Mar 31, 2015
  14. Junio C HamanoMar 31, 2015
  15. Jeff KingMar 31, 2015
  16. Junio C HamanoMar 31, 2015
  17. Eric SunshineMar 31, 2015
  18. Jeff KingMar 31, 2015

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.