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

Re: [PATCH/RFCv4 2/2] git rebase -i: warn about removed commits

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jun 3, 2015, 17:38 UTC
Message-ID
<vpq1thsbsko.fsf@anie.imag.fr>
In-Reply-To
<1433331859-24832-2-git-send-email-remi.galan-alfonso@ensimag.grenoble-inp.fr>
Galan Rémi <remi.galan-alfonso@ensimag.grenoble-inp.fr> writes:
> Check if commits were removed (i.e. a line was deleted) and print
> warnings or abort git rebase depending on the value of the
> configuration variable rebase.missingCommits.
Spelled missingCommitsCheck everywhere else.
> +rebase.missingCommitsCheck::
> +	If set to "warn" print warnings about removed commits in
If set to warn, print (comma). Here and below
> +	interactive mode. If set to "error" print the warnings and
> +	abort the rebase. If set to "ignore" no checking is
> +	done. "ignore" by default.
Show 5 quoted lines
> +# Print the list of the SHA-1 of the commits
> +# from a todo list in a file.
> +# $1: todo-file, $2: outfile
> +todo_list_to_sha_list () {
> +	git stripspace --strip-comments <"$1" | while read -r command sha1 rest
I'd split the line in two:
	git stripspace --strip-comments <"$1" |
	while read -r command sha1 rest
Show 10 quoted lines
> +	do
> +		case $command in
> +		x|"exec")
> +			;;
> +		*)
> +			printf "%s\n" "$sha1"
> +			;;
> +		esac
> +	done >"$2"
> +}

You're using $1 and $2 only to redirect input and output. I would find it more elegant to write todo_list_to_sha_list as a filter, and do the redirection in the call site (to keep the option of using todo_list_to_sha_list in a pipe).

> +check_commits
You're not really checking commits, but rather the todo-list.
> +Use git --config rebase.missingCommitsCheck to change the level of warnings (ignore, warn, error).
Long line. Please, wrap the message to <80 columns.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Remi Galan AlfonsoNext: Remi Galan Alfonso
Message 4 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.