[Xcb] [PATCH] autogen.sh: verify that git submodules are initialized
Josh Triplett
josh at joshtriplett.org
Fri Oct 26 16:15:35 PDT 2012
On Fri, Oct 26, 2012 at 10:00:24PM +0200, Michael Stapelberg wrote:
> Josh Triplett <josh at joshtriplett.org> writes:
> > The existence of .gitmodules does not guarantee a git checkout; a
> > tarred-up source tree or a snapshot from gitweb or git archive could
> > contain that file. You might try [ -d .git ] && [ -r .gitmodules ], or
> > similar.
> Good point, I changed that.
Thanks!
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -6,6 +6,22 @@ test -z "$srcdir" && srcdir=.
> ORIGDIR=`pwd`
> cd $srcdir
>
> +# If this is a git checkout, verify that the submodules are initialized,
> +# otherwise autotools will just fail with an unhelpful error message.
> +if [ -d ".git" ] && [ -r ".gitmodules" ]
> +then
> + # If git is not in PATH, this will not return 0, thus not keeping us
> + # from building. Since the message is worthless when git is not
> + # installed, this is what we want.
> + git submodule status 2>/dev/null | grep -q '^-'
> + if [ $? -eq 0 ]
Minor nit: rather than testing the return value, you can directly put
the command in the if.
</bikeshed>
Looks good otherwise.
- Josh Triplett
More information about the Xcb
mailing list