git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Konstantin Tokarev <annulen@yandex.ru>
To: Junio C Hamano <gitster@pobox.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [Feature request] "Hooks" for git log
Date: Thu, 12 Mar 2020 22:08:20 +0300	[thread overview]
Message-ID: <79741584039971@myt6-4d759d962265.qloud-c.yandex.net> (raw)
In-Reply-To: <xmqqo8t1flin.fsf@gitster.c.googlers.com>



12.03.2020, 21:58, "Junio C Hamano" <gitster@pobox.com>:
> Konstantin Tokarev <annulen@yandex.ru> writes:
>
>>  I think it would be very useful if git log provided new option named e.g.
>>  --hook or --script, which would take script path as an argument.
>>  git log would follow it's normal way of operation, applying other filtering
>>  options it was given, however intstead of printing info on commit that
>>  matches filters, it invokes script with commit hash as an argument.
>>  Script can do whatever it needs with hash, including any git operations,
>>  can print commit info to log if needed, or print something else, or keep
>>  silence. If script returns non-zero, parent git log command terminates,
>>  otherwise it continues.
>
> You do not need a hook for that, no?
>
>  $ git log --format='%H' ...your other options here... |
>    while read commit
>    do
>         ... your "hook" that checks the $commit to see if
>         ... it is "interesting" and shows or discard or whatever
>         ... it does comes here
>    done

When pager is in use, git log loads commits lazily when you scroll down.
I find this feature rather crucial for working with any long history, and
I don't see how to achieve this with pipe.


-- 
Regards,
Konstantin


  reply	other threads:[~2020-03-12 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 15:06 [Feature request] "Hooks" for git log Konstantin Tokarev
2020-03-12 16:21 ` Konstantin Tokarev
2020-03-12 18:58 ` Junio C Hamano
2020-03-12 19:08   ` Konstantin Tokarev [this message]
2020-03-12 19:24     ` Konstantin Tokarev
2020-03-12 19:31       ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79741584039971@myt6-4d759d962265.qloud-c.yandex.net \
    --to=annulen@yandex.ru \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).