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#* }"
;;