Re: [PATCHv2 1/2] rebase -i: optimize the creation of the todo file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 9, 2012 at 12:52 AM, Dominique Quatravaux <domq@xxxxxxxxxx> wrote:
> Instead of obtaining short SHA1's from "git rev-list" and hitting the repository
> once more with "git rev-parse" for the full-size SHA1's, obtain both short and
> long SHA1's from "git log" at once.
> ---
>  git-rebase--interactive.sh |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 5812222..e408e94 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -774,17 +774,16 @@ else
>        revisions=$onto...$orig_head
>        shortrevisions=$shorthead
>  fi
> -git rev-list $merges_option --pretty=oneline --abbrev-commit \
> +git rev-list $merges_option --format="%m%H %h %s" --abbrev-commit \
>        --abbrev=7 --reverse --left-right --topo-order \
>        $revisions | \
>        sed -n "s/^>//p" |
> -while read -r shortsha1 rest
> +while read -r sha1 shortsha1 rest
>  do
>        if test t != "$preserve_merges"
>        then
>                printf '%s\n' "pick $shortsha1 $rest" >> "$todo"
>        else
> -               sha1=$(git rev-parse $shortsha1)
>                if test -z "$rebase_root"
>                then
>                        preserve=t
> --
> 1.7.7.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Ack. Yay, less forking.

I do notice however that the output being fed to sed expands like so:

  commit >634a5f265ad729b91266de65272e2b5a35d05b1c
  >634a5f265ad729b91266de65272e2b5a35d05b1c 634a5f2 INSTALL: warn [...]
  commit >828ea97de486c1693d6e4f2c7347acb50235a85d
  >828ea97de486c1693d6e4f2c7347acb50235a85d 828ea97 Git 1.7.9

Maybe the format spec and sed command could use a little tuning.

--
David Barr
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]