Re: Arguments to git hooks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 07, 2012 at 12:48:35AM +0530, jaseem abid wrote:
> On Mon, May 7, 2012 at 12:42 AM, Marcus Karlsson <mk@xxxxxxxxxx> wrote:
> > As far as I can see that's the only argument that git-commit passes on
> > to the commit-msg hook. Can't you just call something like git-status
> > from the hook or do you need the information passed specifically as an
> > argument?
> 
> I can always get last commit from `.git/COMMIT_EDITMSG'` - a fixed
> file. Isn't passing that as an argument a bit pointless?

That's a good question. I don't know. If someone else knows the reason I
sure would like to find out.

> I want files I tried to commit specifically passed in as an argument.

There are many different reasons to use hooks. If everything that a hook
could potentially need was passed to it as an argument then a lot of
data would often end up unused. Better to supply as little as possible
and only do more work when it's actually needed.

> Are you suggesting me to run some plumbing command, parse the result
> and get the required data ? Is there an easier way to get this done?

I wouldn't go as deep as the plumbing, I think git status --porcelain
should work just fine, the output is fairly easy to parse.

	Marcus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]