From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Jean-Marie Lemetayer <jeanmarie.lemetayer@gmail.com>,
git@vger.kernel.org
Subject: Re: [RFC] new subcommand: git sync
Date: Fri, 26 Feb 2021 14:31:36 -0800 [thread overview]
Message-ID: <xmqq35xisbp3.fsf@gitster.g> (raw)
In-Reply-To: <87tupy7sx6.fsf@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Fri, 26 Feb 2021 16:25:09 +0100")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> B.t.w. you can probably speed up & simplify your script a lot by making
> use of IFS="" in the shell and not calling N for-each-ref commands when
> it seems to me that one invocation would do. Just dump the N fields you
> need split on some token, and split on that token in your loop.
A hidden gem in for-each-ref is its ability to quote the placeholder
values in a language specific way, and that is to allow the --format
to generate a script that can be eval'ed. E.g.
$ git for-each-ref --shell \
--format='doit %(authorname) %(subject)' refs/heads/ab/\* |
head -n 3
doit 'Ævar Arnfjörð Bjarmason' 'branch: show "HEAD detached" first ...'
doit 'Ævar Arnfjörð Bjarmason' 'CoC: update to version 2.0 + local ...'
doit 'Ævar Arnfjörð Bjarmason' 'config.mak.uname: remove unused NEE...'
so that you can prepare
doit () {
person=$1 subject=$2
... do things on the branch data ...
}
beforehand and then eval the output from the script you wrote with
"git for-each-ref".
next prev parent reply other threads:[~2021-02-26 22:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 9:08 [RFC] new subcommand: git sync Jean-Marie Lemetayer
2021-02-26 15:25 ` Ævar Arnfjörð Bjarmason
2021-02-26 16:42 ` Randall S. Becker
2021-03-01 9:48 ` Jean-Marie Lemetayer
2021-03-01 13:55 ` Randall S. Becker
2021-02-26 22:31 ` Junio C Hamano [this message]
2021-02-26 23:20 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq35xisbp3.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jeanmarie.lemetayer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.