From: john at keeping.me.uk (John Keeping)
Subject: [PATCH v1 1/1] tests: add Git submodule version consistency test
Date: Tue, 19 Mar 2013 11:26:52 +0000 [thread overview]
Message-ID: <20130319112651.GC2283@serenity.lan> (raw)
In-Reply-To: <514847B5.10407@hupie.com>
On Tue, Mar 19, 2013 at 12:10:45PM +0100, Ferry Huberts wrote:
>
>
> On 19/03/13 11:43, John Keeping wrote:
> > On Tue, Mar 19, 2013 at 01:01:45AM +0100, Ferry Huberts wrote:
> >> From: Ferry Huberts <ferry.huberts at pelagic.nl>
> >>
> >> To ensure the versions are in sync
> > I like the idea of this, but I think we should be able to get away with
> > something much simpler like this:
> >
> > run_test 'Git versions are consistent' '
> > ( cd ../git && git describe || echo "No submodule!" ) >tmp/sm_version &&
> > sed -n -e "/^GIT_VER[ ]*=/ {
> > s/^GIT_VER[ ]*=[ ]*//
> > p
> > }" >tmp/make_version &&
> > diff -u tmp/sm_version tmp/make_version
> > '
> >
>
>
> Did you test this?
> Because the submodule SHA points to the commit, not to the tag.
That's why I use "git describe" which will work in this scenario. Of
course, this doesn't check the submodule version that's committed, just
what is checked out in ./git, but thinking about it I'm not sure if
that's actually a bad thing because it will let the tests run even when
someone is checking a Git update and it will point out a not-up-to-date
submodule anyway.
What I did miss is stripping the initial "v" from the version returned
by git-describe, so I think it can be made more robust by doing this
(tested this time, so I've also fixed "tmp -> trash" and missing
argument to sed):
run_test 'Git versions are consistent' '
(
cd ../git &&
git describe --match "v[0-9]*" || echo "No submodule!"
) | sed -e "s/^v//" >trash/sm_version &&
sed -n -e "/^GIT_VER[ ]*=/ {
s/^GIT_VER[ ]*=[ ]*//
p
}" ../Makefile >trash/make_version &&
diff -u trash/sm_version trash/make_version
'
John
next prev parent reply other threads:[~2013-03-19 11:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 0:01 mailings
2013-03-19 10:43 ` john
2013-03-19 11:10 ` mailings
2013-03-19 11:26 ` john [this message]
2013-03-19 20:00 ` john
2013-03-19 20:22 ` mailings
2013-03-19 20:33 ` john
2013-03-19 20:45 ` mailings
2013-03-20 20:09 ` Jason
2013-03-20 20:13 ` mailings
2013-03-20 20:15 ` Jason
2013-03-20 20:18 ` mailings
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=20130319112651.GC2283@serenity.lan \
--to=cgit@lists.zx2c4.com \
/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;
as well as URLs for NNTP newsgroup(s).