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

Re: [PATCH] rerere: record (or avoid misrecording) resolved, skipped or aborted rebase/am

From
Junio C Hamano <junkio@cox.net>
Date
Dec 9, 2006, 20:08 UTC
Message-ID
<7vbqmcbzn2.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<1165613397460-git-send-email-normalperson@yhbt.net>

I looked at your previous 5-patch series but will replace with this updated 2-patch series.

The rerere command started its life as a mere helper for Porcelains, but with 'status' and 'diff', you are making it somewhat Porcelain-ish. I still have not decided myself, but I think we probably would want to treat this as a Porcelain and give a bit of usability to it, so what I've committed has two changes from your version:

 (1) 'diff' without @ARGV defaults to '-u';
 (2) running rerere with unknown sub command die()s instead of
     silently exiting with 0.

The difference between your previous 5-patch series and this round raises an interesting issue.

You used to have a safety valve in git-commit to prevent users from running it while rebase/am is in progress, which I imagine would be a common mistake.

There are three commands in git suite that a user would use to eventually make new commits, out of something other than what was edited and prepared in the working tree, that can stop in the middle.

 (1) git-am is used to make new commits from e-mailed patches,
     and stops in the middle when a patch does not apply.
     "git-am --resolved/--skip" are the ways to continue.
 (2) git-rebase is used to rewrite the history of a branch, and
     stops in the middle when a patch does not apply or merge
     conflicts.  "git-rebase --continue/--skip/--abort" are
     possible exits [*1*].
 (3) git-pull/git-merge are used to make merge commits with
     another branch, and stops in the middle when it conflicts.
     Possible exits are "git commit" or "git reset".

Now, I am not going to propose to fix this inconsistency and forbid use of "git commit" to resolve "git-merge" (instead, the user would say "git-merge --resolved/--abort"). As the workflow goes, these are very different operations and the user is often well aware which workflow is in progress; having different commands for different exit route is fine.

But in order to implement the safety valve like you did cleanly, we should first have an enumeration of states (the above is a subset --- there is the "base state" in which you are working towards a commit based on HEAD, which is obviously concluded with a "git commit", and "bisect in progress") and make it easy for commands to communicate what state the working tree is in. That would also help 'git-explain'.

[Footnote]

*1* Resuming rebase was much worse before Sean updated it with commit 031321c6 to hide that it uses git-am as its backend, which is purely its implementation detail.

Previous: Eric Wong
Message 7 of 7 in “Re: [PATCH 1/5] rerere: avoid misrecording on a skipped or aborted rebase/am”
  1. Junio C HamanoDec 8, 2006
  2. Eric WongDec 8, 2006
  3. rerere: add clear, diff, and status commandsEric Wong, Dec 8, 2006
  4. rerere: record (or avoid misrecording) resolved, skipped or aborted rebase/amEric Wong, Dec 8, 2006
  5. Jakub NarebskiDec 8, 2006
  6. Eric WongDec 8, 2006
  7. Junio C HamanoDec 9, 2006

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.