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

[PATCH 0/3] rebase: fix bug in --fork-point

From
ATAlex Torok <alext9@gmail.com>
Date
Dec 5, 2019, 22:53 UTC
Message-ID
<20191205225322.5529-1-alext9@gmail.com>

git rebase --fork-point with a short branch ref name (without refs/heads/ prefix) for the upstream will not use the fork point between the upstream and the branch.

If git rebase --forkpoint is used with a full ref on the upstream (refs/heads/branchName), the fork point between the branch and upstream is correctly used.

This bug was introduced in 2.20.0 with the c implementation of rebase. I was able to reproduce it on next and master.

The code path for rebase with --fork-point and a user-provided upstream does not use a DWIM method to look up the full ref name. This leads to get_fork_point returning a null pointer and rebase using the upstream itself instead of the fork point between the upstream and branch.

I looked in other places that call get_fork_point and found that in handle_fork_point of builtin/merge_base.c, dwim_ref is used to find the full ref name before calling get_fork_point.

I initially based this change off of maint, but then saw that there were some tests added for rebase --fork-point on master, so I rebased onto there to build off of those tests, but I'm not sure if that was the "right" thing to do.

Alex Torok (3):
  rebase: add test for rebase --fork-point with short upstream
  rebase: refactor dwim_ref_or_die from merge-base.c
  rebase: fix rebase to use full ref to find fork-point
 builtin/merge-base.c         |  9 +--------
 builtin/rebase.c             |  4 +++-
 refs.c                       | 14 ++++++++++++++
 refs.h                       |  1 +
 t/t3431-rebase-fork-point.sh |  1 +
 5 files changed, 20 insertions(+), 9 deletions(-)
-- 
2.17.1
Next: Alex Torok
Message 1 of 23 in “rebase: fix bug in --fork-point”
  1. 0/3 rebase: fix bug in --fork-pointAlex Torok, Dec 5, 2019
  2. 1/3 rebase: add test for rebase --fork-point with short upstreamAlex Torok, Dec 5, 2019
  3. Junio C HamanoDec 5, 2019
  4. Alex TorokDec 5, 2019
  5. 2/3 rebase: refactor dwim_ref_or_die from merge-base.cAlex Torok, Dec 5, 2019
  6. 3/3 rebase: fix rebase to use full ref to find fork-pointAlex Torok, Dec 5, 2019
  7. 0/2 rebase: fix bug in --fork-pointAlex Torok, Dec 5, 2019
  8. 1/2 rebase: refactor dwim_ref_or_die from merge-base.cAlex Torok, Dec 5, 2019
  9. Denton LiuDec 6, 2019
  10. Alex TorokDec 6, 2019
  11. 2/2 rebase: find --fork-point with full refAlex Torok, Dec 5, 2019
  12. Denton LiuDec 6, 2019
  13. Phillip WoodDec 6, 2019
  14. Alex TorokDec 6, 2019
  15. Denton LiuDec 6, 2019
  16. Phillip WoodDec 6, 2019
  17. 0/1 rebase: fix --fork-point with short ref upstreamAlex Torok, Dec 9, 2019
  18. 1/1 rebase: fix --fork-point with short refnameAlex Torok, Dec 9, 2019
  19. Junio C HamanoDec 9, 2019
  20. Alex TorokDec 11, 2019
  21. Denton LiuDec 11, 2019
  22. Eric SunshineDec 11, 2019
  23. Junio C HamanoFeb 11, 2020

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.