From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Wed, 12 Aug 2015 11:54:42 +0100 Subject: [PATCH] contrib/hooks: add sample post-receive hook using agefile In-Reply-To: <54999479.3000308@hupie.com> References: <54998703.5090901@hupie.com> <20141223154828.GB9188@serenity.lan> <54999479.3000308@hupie.com> Message-ID: <20150812105442.GH30507@serenity.lan> Jason, did you decide not to apply this or was it just lost in the noise? [Thread starts here: http://article.gmane.org/gmane.comp.version-control.cgit/2258 ] On Tue, Dec 23, 2014 at 05:12:41PM +0100, Ferry Huberts wrote: > On 23/12/14 16:48, John Keeping wrote: > > On Tue, Dec 23, 2014 at 04:15:15PM +0100, Ferry Huberts wrote: > >> > >> > >> On 23/12/14 15:40, John Keeping wrote: > >>> +agefile="$(git rev-parse --git-dir)"/info/web/last-modified > >> > >> use $GIT_DIR here instead of rev-parse > > > > githooks(5) doesn't guarantee that GIT_DIR will be set and the fact that > > it currently is seems to be an artifact of how old versions of Git work > > ([0]). > > > > I'd prefer to stick with rev-parse, which is what the example hooks in > > git.git use. > > > > [0] http://permalink.gmane.org/gmane.comp.version-control.git/136276 > > > > Ok with me. > I did check the man pages and they seem to say that GITDIR is set. > Well, whatever :-) > > >>> + > >>> +mkdir -p "$(dirname "$agefile")" && > >>> +git for-each-ref \ > >>> + --sort=-authordate --count=1 \ > >>> + --format='%(authordate:iso8601)' \ > >>> + >"$agefile"