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

Re: [BUG] rebase should desambiguate abbreviated hashes before starting

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 27, 2013, 17:16 UTC
Message-ID
<7vhagjtqy1.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vppv7trls.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 24 quoted lines
> It could be something as simple like this (not tested).
>
>  git-rebase--interactive.sh | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index f953d8d..6766b44 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -678,6 +678,23 @@ skip_unnecessary_picks () {
>  	die "Could not skip unnecessary pick commands"
>  }
>  
> +# expand shortened commit object name to the full form
> +expand_todo_commit_names () {
> +	while read -r command rest
> +	do
> +		case "$command" in
> +		'#'*)
> +			;;
> +		*)
> +			sha1=$(git rev-parse --verify --quiet ${rest%% *})
> +			rest="$sha1 ${rest#* }"
> +			;;

In case somebody wants to polish it to a real patch, this part should at least be:

		case "$command" in
		'#'* | exec)
			# Be careful for oddball commands like 'exec'
			# that do not have a short-SHA-1 at the beginning
			# of $rest.
			;;
		*)
			sha1=$(git rev-parse --verify --quiet ${rest%% *}) &&
			rest="$sha1 ${rest#* }"
			;;
Previous: Junio C Hamano
Message 6 of 6 in “[BUG] rebase should desambiguate abbreviated hashes before starting”
  1. Yann DirsonJun 27, 2013
  2. DavidJun 27, 2013
  3. Matthieu MoyJun 27, 2013
  4. DavidJun 27, 2013
  5. Junio C HamanoJun 27, 2013
  6. Junio C HamanoJun 27, 2013

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.