git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philip Oakley <philipoakley@iee.org>
To: GitList <git@vger.kernel.org>
Subject: [RFC/PATCH 1/2] test git version string
Date: Sun, 14 Apr 2013 15:27:25 +0100	[thread overview]
Message-ID: <1365949646-1988-2-git-send-email-philipoakley@iee.org> (raw)
In-Reply-To: <1365949646-1988-1-git-send-email-philipoakley@iee.org>

The git version string is used in the wild, and in git gui,
for capability checking purposes. Test the string format
and version X.Y.Z number.

The version string shall be:
* a single line
* less that 80 characters
* start with `git version `
* with a following numeric X.Y.Z version.

The remaining characters are undefined.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---

Should this be applied to t0000, or another test file?
Should the version string be always limited to one line?
Should the maximum string length be <80 characters?
Is egrep OK, or should I use grep with a longer BRE?

 t/t0000-basic.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index cefe33d..052afca 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -610,4 +610,12 @@ test_expect_success 'very long name in the index handled sanely' '
 	test $len = 4098
 '
 
+test_expect_success 'git version string X.Y.Z' '
+	git --version >verstring &&
+	test_line_count =  1 verstring &&
+	len=$(wc -c verstring | sed "s/[^0-9]//g") &&
+	test $len -lt  80 &&
+	egrep -q "^git version [0-9]+\.[0-9]+\.[0-9]+.*" verstring
+'
+
 test_done
-- 
1.8.1.msysgit.1

  reply	other threads:[~2013-04-14 14:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 14:27 [RFC/PATCH 0/2] Test the Git version string Philip Oakley
2013-04-14 14:27 ` Philip Oakley [this message]
2013-04-14 14:27 ` [RFC/PATCH 2/2] Doc: State the exact git " Philip Oakley
2013-04-14 19:22 ` [RFC/PATCH 0/2] Test the Git " Junio C Hamano
2013-04-14 21:26   ` Philip Oakley
2013-04-15  1:39     ` Junio C Hamano
2013-04-16  7:25       ` Philip Oakley
2013-04-16 18:12         ` Junio C Hamano
2013-04-16 18:24           ` David Aguilar
2013-04-16 19:02             ` Junio C Hamano
2013-04-16 21:22           ` Philip Oakley

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=1365949646-1988-2-git-send-email-philipoakley@iee.org \
    --to=philipoakley@iee.org \
    --cc=git@vger.kernel.org \
    /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).