* pre-commit hook
@ 2009-02-20 9:11 bill lam
2009-02-20 16:25 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: bill lam @ 2009-02-20 9:11 UTC (permalink / raw)
To: git
The pre-commit hooks as follows.
10 # This is slightly modified from Andrew Morton's Perfect Patch.
11 # Lines you introduce should not have trailing whitespace.
12 # Also check for an indentation that has SP before a TAB.
13
14 if git-rev-parse --verify HEAD 2>/dev/null
15 then
16 git-diff-index -p -M --cached HEAD --
17 else
18 # NEEDSWORK: we should produce a diff with an empty tree here
19 # if we want to do the same verification for the initial import.
20 :
21 fi |
22 perl -e '
Will it also include binary files and thus corrupt data? And
"git-rev-parse" should already deprecated.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩232 孟浩然 春曉
春眠不覺曉 處處聞啼鳥 夜來風雨聲 花落知多少
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: pre-commit hook
2009-02-20 9:11 pre-commit hook bill lam
@ 2009-02-20 16:25 ` Junio C Hamano
2009-02-21 3:57 ` bill lam
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2009-02-20 16:25 UTC (permalink / raw)
To: bill lam; +Cc: git
bill lam <cbill.lam@gmail.com> writes:
> The pre-commit hooks as follows.
>
> 10 # This is slightly modified from Andrew Morton's Perfect Patch.
> 11 # Lines you introduce should not have trailing whitespace.
That's a sample hook from an ancient version of git. We do not ship that
version anymore since late last June. You should be able to replace it
with the version shipped with v1.6.0 or later if your git is recent
enough.
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git-rev-parse --verify HEAD 2>/dev/null
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
exec git diff-index --check --cached $against --
Perhaps a time to upgrade? People should be running at least 1.6.0 these
days ;-).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: pre-commit hook
2009-02-20 16:25 ` Junio C Hamano
@ 2009-02-21 3:57 ` bill lam
2009-02-21 11:28 ` Michael J Gruber
0 siblings, 1 reply; 7+ messages in thread
From: bill lam @ 2009-02-21 3:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Fri, 20 Feb 2009, Junio C Hamano wrote:
> if git-rev-parse --verify HEAD 2>/dev/null
Isn't git-rev-parse (and all git-??? ) was deprecated in 1.6.2 ?
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩311 無名氏 雜詩
盡寒食雨草萋萋 著麥苗風柳映堤 等是有家歸未得 杜鵑休向耳邊啼
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: pre-commit hook
2009-02-21 3:57 ` bill lam
@ 2009-02-21 11:28 ` Michael J Gruber
2009-02-22 10:58 ` bill lam
0 siblings, 1 reply; 7+ messages in thread
From: Michael J Gruber @ 2009-02-21 11:28 UTC (permalink / raw)
To: Junio C Hamano, git, bill lam
bill lam venit, vidit, dixit 21.02.2009 04:57:
> On Fri, 20 Feb 2009, Junio C Hamano wrote:
>> if git-rev-parse --verify HEAD 2>/dev/null
>
> Isn't git-rev-parse (and all git-??? ) was deprecated in 1.6.2 ?
>
It's OK in hooks because the path is set appropriately there.
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: pre-commit hook
2009-02-21 11:28 ` Michael J Gruber
@ 2009-02-22 10:58 ` bill lam
2009-02-22 11:17 ` Sverre Rabbelier
0 siblings, 1 reply; 7+ messages in thread
From: bill lam @ 2009-02-22 10:58 UTC (permalink / raw)
To: Michael J Gruber; +Cc: Junio C Hamano, git
On Sat, 21 Feb 2009, Michael J Gruber wrote:
> > Isn't git-rev-parse (and all git-??? ) was deprecated in 1.6.2 ?
> >
>
> It's OK in hooks because the path is set appropriately there.
I make and install with prefix=/usr/bin , however I can only find git
inside /usr/bin; other git-???? are missing although they are built.
"which git-rev-parse" return nothing but "git rev-parse" can work.
Where are these git commands stored and how does the git locate them ?
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩169 僧皎然 尋陸鴻漸不遇
移家雖帶郭 野徑入桑麻 近種籬邊菊 秋來未著花
扣門無犬吠 欲去問西家 報到山中去 歸來每日斜
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: pre-commit hook
2009-02-22 10:58 ` bill lam
@ 2009-02-22 11:17 ` Sverre Rabbelier
2009-02-22 14:13 ` bill lam
0 siblings, 1 reply; 7+ messages in thread
From: Sverre Rabbelier @ 2009-02-22 11:17 UTC (permalink / raw)
To: Michael J Gruber, Junio C Hamano, git
2009/2/22 bill lam <cbill.lam@gmail.com>:
> I make and install with prefix=/usr/bin , however I can only find git
> inside /usr/bin; other git-???? are missing although they are built.
> "which git-rev-parse" return nothing but "git rev-parse" can work.
> Where are these git commands stored and how does the git locate them ?
Have a look at the output of `git --exec-path`.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: pre-commit hook
2009-02-22 11:17 ` Sverre Rabbelier
@ 2009-02-22 14:13 ` bill lam
0 siblings, 0 replies; 7+ messages in thread
From: bill lam @ 2009-02-22 14:13 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Michael J Gruber, Junio C Hamano, git
On Sun, 22 Feb 2009, Sverre Rabbelier wrote:
> Have a look at the output of `git --exec-path`.
Thanks, Sverre.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩021 王昌齡 同從弟南齋翫月憶山陰崔少府
高臥南齋時 開帷月初吐 清輝淡水木 演漾在窗戶 苒苒幾盈虛 澄澄變今古
美人清江畔 是夜越吟苦 千里其如何 微風吹蘭杜
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-02-22 14:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-20 9:11 pre-commit hook bill lam
2009-02-20 16:25 ` Junio C Hamano
2009-02-21 3:57 ` bill lam
2009-02-21 11:28 ` Michael J Gruber
2009-02-22 10:58 ` bill lam
2009-02-22 11:17 ` Sverre Rabbelier
2009-02-22 14:13 ` bill lam
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).