[RFC/PATCH 0/2] Test the Git version string

DORMANTno replies

3 messages, 1 author, 2016-06-15 · open the first message on its own page

[RFC/PATCH 0/2] Test the Git version string

From: Philip Oakley <hidden>
Date: 2016-06-15 22:56:49

In $gmane/217004 I was noted that the git version string is used
in the wild for confirming which git version is in use.

This patch series seeks to add tests for the version string format
and document it.

The key questions to be answered are:
* should the test be inside t0000, or somewhere else?
* should the version string be limited to one line, <80 characters?
* how to format the asciidoc of the ERE.

Philip Oakley (2):
  test git version string
  Doc: State the exact git version string

 Documentation/git.txt | 4 ++++
 t/t0000-basic.sh      | 8 ++++++++
 2 files changed, 12 insertions(+)

-- 
1.8.1.msysgit.1

[RFC/PATCH 1/2] test git version string

From: Philip Oakley <hidden>
Date: 2016-06-15 22:56:49

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

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

[RFC/PATCH 2/2] Doc: State the exact git version string

From: Philip Oakley <hidden>
Date: 2016-06-15 22:56:49

Provide the regular expression that matches the
'git --version' strings.

Scripts in the wild, including 'git gui', check the git version.

Signed-off-by: Philip Oakley <redacted>
---

Should the string be described by a regular expression?

How to format the regular expression for asciidocs - it doesn't
get made correctly - I'm not sure what special magic incantation
is needed here.

 Documentation/git.txt | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 7efaa59..627e462 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -365,6 +365,10 @@ OPTIONS
 -------
 --version::
 	Prints the Git suite version that the 'git' program came from.
+	The version string is a single line that matches the extended
+	regular expression
+	'^git version [0-9]+\.[0-9]+\.[0-9]+.*'
+	and is less than 80 characters.
 
 --help::
 	Prints the synopsis and a list of the most commonly used
-- 
1.8.1.msysgit.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help