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

Re: RFC: Adding an option to log-like commands to call an external command for each revision

From
Mark Lodato <lodatom@gmail.com>
Date
Sep 11, 2010, 17:09 UTC
Message-ID
<AANLkTikmCA2Cidz1UEDGH5j94_HucvJPGj27g8p_pcEi@mail.gmail.com>
In-Reply-To
<AANLkTi=WokEQMDc92SoWXPJW67dy0q79WW9RajrBHRx3@mail.gmail.com>

On Sat, Sep 11, 2010 at 11:56 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 15 quoted lines
> `On Mon, Aug 30, 2010 at 03:08, Jeff King <peff@peff.net> wrote:
>> I think it is not very Unix-y. We already have many ways to to call a
>> command once per commit, including:
>>
>>  - for i in `git rev-list "$@"`; do git show $i; done
>>
>>  - git rev-list "$@" | xargs -n 1 git show
>>
>>  - git log -z "$@" | perl -0ne 'open(LESS, "|less"); print LESS'
>>
>> [snip]
>
> Yeah, it's not very Unixy, I just find it so useful that I thought
> there might be interest in adding it to Git. It's easily in the list
> of top 5 git commands that I use.

I also find myself wanting to walk through commits in a particular order. In my case, I don't want to run a command per commit, but instead I want to check them out a la "git bisect." Let's pretend such a command is called "git walk". In in my case, I would run:

    git walk start --reverse 49ea7b8..e1ef3c1
    <compile, test, ...>
    git walk next
    <compile, test, ...>
    git walk next
    <...>
    git walk reset
In Ævar's case, he would just want:
    git walk start --reverse 49ea7b8..e1ef3c
    git walk run git show
    git walk reset
Or perhaps a shortcut:
    git walk start --reverse 49ea7b8..e1ef3c --run git show

There is already a simple implementation by August Lilleaas [1], but it would be nice to re-use the git-bisect machinery.

Mark
[1] http://github.com/augustl/binbin/blob/master/git-walk
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 5 of 9 in “RFC: Adding an option to log-like commands to call an external command for each revision”
  1. Ævar Arnfjörð BjarmasonAug 29, 2010
  2. Jonathan NiederAug 29, 2010
  3. Jeff KingAug 30, 2010
  4. Ævar Arnfjörð BjarmasonSep 11, 2010
  5. Mark LodatoSep 11, 2010
  6. Ævar Arnfjörð BjarmasonSep 11, 2010
  7. Artur SkawinaSep 11, 2010
  8. Junio C HamanoSep 12, 2010
  9. Ævar Arnfjörð BjarmasonSep 12, 2010

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.