git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Configuring a third-party git hook
@ 2014-03-19 11:16 Chris Angelico
  2014-03-20 12:53 ` Kevin
  2014-03-20 16:53 ` Junio C Hamano
  0 siblings, 2 replies; 14+ messages in thread
From: Chris Angelico @ 2014-03-19 11:16 UTC (permalink / raw)
  To: git

I have a bit of a weird question. Poking around with Google searches
hasn't come up with any results, so I'm asking here :)

Short version: What's the most appropriate way to configure a git hook?

Long version: I have a git hook (handles prepare-commit-msg and
commit-msg) and part of what it does can search 'git log' for a single
file. It doesn't really care about the full history, and wants to be
reasonably fast (as the user is waiting for it). It's just a
convenience, so correctness isn't a huge issue. The easiest way to
keep it moving through quickly is to limit the search:

$ git log ...other options... HEAD~100 some-file.pike

The problem with this is that it doesn't work if HEAD doesn't have 100
great-great-...-grandparents - plus, it's way too specific a number to
hard-code. I might want it different on different repos (and the
script is shared, and is available for other people to use).

Now, if this were something in git core, I'd expect to set that value
of 100 with 'git config', but this is my own script. Is it right to
use 'git config' for something that isn't controlled by the core code
of git? I've tentatively used "git config rosuav.log-search.limit"
(with 0 or absence meaning "omit the argument" ie search the whole
history), and am wondering if that's a really really bad idea.

Here's the script in question:
https://github.com/Rosuav/shed/blob/master/githook.pike#L36

Two parts to the question, then. Firstly, is it acceptable to use 'git
config' for a hook like this? And secondly, either: Is there a naming
convention to follow? or, what alternative would you recommend?

Thanks in advance for any ideas/tips!

ChrisA

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-03-21 18:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-19 11:16 Configuring a third-party git hook Chris Angelico
2014-03-20 12:53 ` Kevin
2014-03-20 16:51   ` Chris Angelico
2014-03-20 23:38     ` Jeff King
2014-03-20 23:46       ` Chris Angelico
2014-03-21  3:43         ` Jeff King
2014-03-21  4:07           ` Chris Angelico
2014-03-21 17:31             ` Junio C Hamano
2014-03-21 17:48               ` Chris Angelico
2014-03-21 18:15               ` Jeff King
2014-03-21 18:53                 ` Junio C Hamano
2014-03-21 18:54                 ` Junio C Hamano
2014-03-20 16:53 ` Junio C Hamano
2014-03-20 17:10   ` Chris Angelico

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 NNTP newsgroup(s).