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

Re: [PATCH] git-am: suggest what to do with superfluous patches

From
Junio C Hamano <gitster@pobox.com>
Date
May 31, 2010, 19:31 UTC
Message-ID
<7vwrujzx3t.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100530101926.3bac34c8jk@jk.gs@perceptron>
Jan Krüger <jk@jk.gs> writes:
Show 15 quoted lines
> Particularly in the context of rebase, conflicts frequently occur
> because the change in the patch to be applied was made obsolete by new
> upstream commits. In this case, solving the conflict effectively means
> skipping the patch. However, it's not always readily apparent that the
> patch needs to be skipped, and when people solve the conflict and try
> git rebase --continue, they get confronted with a message of
>
>   No changes - did you forget to use 'git add'?
>
> That's not very helpful if you did actually stage your changes and they
> happen to turn the patch into a no-op. This extends the message to point
> out what's going on.
>
> Signed-off-by: Jan Krüger <jk@jk.gs>
> ---

I think this is a change in a good direction; we _might_ want to allow this squelched with "advice.*" configuration, but my gut feeling is that it wouldn't probably matter much, as it is rather rare to trigger this.

Show 10 quoted lines
> diff --git a/git-am.sh b/git-am.sh
> index 87ffae2..43ea52c 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -726,6 +726,8 @@ do
>  		resolved=
>  		git diff-index --quiet --cached HEAD -- && {
>  			echo "No changes - did you forget to use 'git add'?"
> +			echo "If there is nothing left to stage, chances are that something else"
> +			echo "already introduced the same changes; you might want to skip this patch."

The exact wording I'd let people to fight out, but I think this is probably better than Ramkumar's one that says "if you dropped". The user may not know that he is doing an equivalent of dropping as a side effect of the new base that had accepted the same change, and your message nudges the reader to realize that.

Previous: Jeff KingNext: Ramkumar Ramachandra
Message 10 of 12 in “rebase --continue confusion”
  1. Dale RowleyMay 30, 2010
  2. Tim VisherMay 30, 2010
  3. skillzero@gmail.comMay 31, 2010
  4. Eli BarzilayJun 6, 2010
  5. Jeff KingJun 6, 2010
  6. Eli BarzilayJun 6, 2010
  7. Jeff KingJun 6, 2010
  8. Eli BarzilayJun 6, 2010
  9. Jeff KingJun 7, 2010
  10. Junio C HamanoMay 31, 2010
  11. Ramkumar RamachandraMay 31, 2010
  12. Jan KrügerMay 31, 2010

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.