Re: Syntax check via update hook?

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

 



Jeff King <peff@xxxxxxxx> writes:

> That sounds like a reasonable goal. In the hook itself, you can do one
> of:

>   2. Check out the whole tree to a temp directory and run your full
>      syntax check there. The simplest way would be by using "git
>      archive" to generate the tree. You can make this a bit more
>      efficient by keeping the temp directory between runs and using
>      git to just update the changed files. Off the top of my head, that
>      would look something like:
>
>         $ cat <<EOF >.git/hooks/update
>         #!/bin/sh
>         GIT_INDEX_FILE=/path/to/tempdir/index; export GIT_INDEX_FILE
>         cd /path/to/tempdir/tree &&
>         mkdir -p tree &&
>         git read-tree "$3" &&
>         git checkout-index &&
>         your_syntax_check
>         EOF
>         $ chmod +x .git/hooks/update

Thanks for helping! :)

Unfortunately we don't quite get it.  Can you flesh out your example a
bit and explain the concepts involved?  We're relative git newbies.  We
tried reading the man pages to the commands you use to no avail.  One
big stumbling block seems to be how we create/set-up tempdir.  Is that
supposed to be a pre-created git checkout, or created via git-archive,
or .. ?

Also, we actually just want to check the syntax of the files that were
changed in the commit, not the whole tree.  Will your method give us
access to the path names of the files that changed?

Thanks again!

--
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]