From: Konstantin Tokarev Date: Thu, 12 Mar 2020 19:24:22 GMT Subject: Re: [Feature request] "Hooks" for git log Message-ID: <87951584041001@myt5-5e0e3f348369.qloud-c.yandex.net> In-Reply-To: <79741584039971@myt6-4d759d962265.qloud-c.yandex.net> 12.03.2020, 22:08, "Konstantin Tokarev" : > 12.03.2020, 21:58, "Junio C Hamano" : >>  Konstantin Tokarev 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. Nvm, passing to less -R makes it pause when needed. I've never realized it was that simple. -- Regards, Konstantin