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

Re: [PATCH/RFCv4 1/2] git-rebase -i: add command "drop" to remove a commit

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 3, 2015, 18:02 UTC
Message-ID
<xmqq8uc0y8jw.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1433331859-24832-1-git-send-email-remi.galan-alfonso@ensimag.grenoble-inp.fr>
Galan Rémi  <remi.galan-alfonso@ensimag.grenoble-inp.fr> writes:
Show 21 quoted lines
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index dc3133f..869cc60 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -152,6 +152,7 @@ Commands:
>   s, squash = use commit, but meld into previous commit
>   f, fixup = like "squash", but discard this commit's log message
>   x, exec = run command (the rest of the line) using shell
> + d, drop = remove commit
>  
>  These lines can be re-ordered; they are executed from top to bottom.
>  
> @@ -508,6 +509,23 @@ do_next () {
>  	"$comment_char"*|''|noop)
>  		mark_action_done
>  		;;
> +	drop|d)
> +		if test -z $sha1
> +		then
> +			warn "Missing SHA-1 in 'drop' command."
> +			die "Please fix this using 'git rebase --edit-todo'."

Is this a sensible piece of advice, though? The user edited the line away and it does not have the commit object name anymore. How does she "fix" it in the editor? The same puzzlement applies to the other message.

> +		sha1_verif="$(git rev-parse --verify --quiet $sha1^{commit})"
> +		if test -z $sha1_verif

As you are not using the returned string at all, instead of wasting a shell variable, it would be better to decide to come into this block by using the exit status from rev-parse (it exits with non-zero status upon failure).

Show 10 quoted lines
> +		then
> +			warn "'$sha1' is not a SHA-1 or does not represent" \
> +				"a commit in 'drop' command."
> +			die "Please fix this using 'git rebase --edit-todo'."
> +		fi
> +
> +		mark_action_done
> +		;;
>  	pick|p)
>  		comment_for_reflog pick
Previous: Remi Galan AlfonsoNext: Remi Galan Alfonso
Message 10 of 11 in “git-rebase -i: add command "drop" to remove a commit”
  1. 1/2 git-rebase -i: add command "drop" to remove a commitGalan Rémi, Jun 3, 2015
  2. 2/2 git rebase -i: warn about removed commitsGalan Rémi, Jun 3, 2015
  3. Remi Galan AlfonsoJun 3, 2015
  4. Matthieu MoyJun 3, 2015
  5. Remi Galan AlfonsoJun 3, 2015
  6. Matthieu MoyJun 3, 2015
  7. Eric SunshineJun 3, 2015
  8. Remi Galan AlfonsoJun 3, 2015
  9. Remi Galan AlfonsoJun 6, 2015
  10. Junio C HamanoJun 3, 2015
  11. Remi Galan AlfonsoJun 3, 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.