From: Junio C Hamano <gitster@pobox.com>
To: Sam Vilain <sam.vilain@catalyst.net.nz>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] templates: make example pre-commit hook verify submodule commits exist
Date: Sun, 03 May 2009 22:27:50 -0700 [thread overview]
Message-ID: <7vzldt4euh.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <E1M0oxK-0002uG-RT@mail1.catalyst.net.nz> (Sam Vilain's message of "Mon\, 4 May 2009 15\:32\:29 +1200")
Sam Vilain <sam.vilain@catalyst.net.nz> writes:
> With submodules it can be quite easy to end up with a situation where the
> version in the supermodule doesn't exist in the submodule. Add to the
> example pre-commit hook a script which checks before every commit whether
> the submodule commit is likely to exist at the URL defined in the
> .gitmodules file.
>
> Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
> ---
> This should be useful for those using submodules. Perhaps it should also
> have an equivalent in the 'git submodule' command.
If I am a developer who is not interested in any of the submodules in the
project at all (i.e. I do not have any submodule checked out), my commits
will never touch any of the submodules. In such a case, I shouldn't be
forced to fetch/clone the submodule nor have a checkout.
Which means...
> +# first, check that all submodule commits are available by a remote
> +# which has the same URL as the one they are listed in.
> +if [ -n "$GIT_WORK_TREE" ]
> +then
> + cd "$GIT_WORK_TREE"
> +fi
> +
> +git ls-tree $(git write-tree) | grep commit |
> +while read mode type sha1 submodule
> +do
... the input fed to this while look utterly wrong. At least, you should
be checking *new* commit that is introduced to the tree with this commit.
I didn't read the body of the while loop; no matter what it does, if its
input is wrong, its end result cannot be correct.
prev parent reply other threads:[~2009-05-04 5:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-04 3:32 [PATCH] templates: make example pre-commit hook verify submodule commits exist Sam Vilain
2009-05-04 5:27 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vzldt4euh.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=sam.vilain@catalyst.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox