git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/1] .gitattributes: ensure t/oid-info/* has eol=lf

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 11, 2018, 20:35 UTC
Message-ID
<pull.98.git.gitgitgadget@gmail.com>

I noticed that our CI builds (see [1] for an example) were returning success much faster than they did before Git v2.20.0. Turns out that there was a test script failure involving the new test hash logic.

error: bug in the test script: bad hash algorithm make[1]: *** [Makefile:56: t0000-basic.sh] Error 1 make[1]: *** Waiting for unfinished jobs....

The reason this passed was because we were running this command in our build:

make GIT_TEST_OPTS=--quiet -j 10 -C t || make GIT_TEST_OPTS=\"-i -v -x\" -k -C t failed

The first make failed, but the test script did not record any failed tests and hence the second command succeeded.

The test bug relates to this function added by 2c02b110d "t: add test functions to translate hash-related values":

+# Load key-value pairs from stdin suitable for use with test_oid.  Blank lines
+# and lines starting with "#" are ignored.  Keys must be shell identifier
+# characters.
+#
+# Examples:
+# rawsz sha1:20
+# rawsz sha256:32
+test_oid_cache () {
+       local tag rest k v &&
+
+       { test -n "$test_hash_algo" || test_detect_hash; } &&
+       while read tag rest
+       do
+               case $tag in
+               \#*)
+                       continue;;
+               ?*)
+                       # non-empty
+                       ;;
+               *)
+                       # blank line
+                       continue;;
+               esac &&
+
+               k="${rest%:*}" &&
+               v="${rest#*:}" &&
+
+               if ! expr "$k" : '[a-z0-9][a-z0-9]*$' >/dev/null
+               then
+                       error 'bug in the test script: bad hash algorithm'
+               fi &&
+               eval "test_oid_${k}_$tag=\"\$v\""
+       done
+}

The verbose output included these values. Note how '\r' appears in the variable values.

++ test_oid_init ++ test -n '' ++ test_detect_hash ++ test_hash_algo=sha1 ++ test_oid_cache ++ local tag rest k v ++ test -n sha1 ++ read tag rest ++ case $tag in ++ k=sha1 ++ v=$'20\r' ++ expr sha1 : '[a-z0-9][a-z0-9]*$' ++ eval 'test_oid_sha1_rawsz="$v"' +++ test_oid_sha1_rawsz=$'20\r' ++ read tag rest ++ case $tag in ++ k=sha256 ++ v=$'32\r' ++ expr sha256 : '[a-z0-9][a-z0-9]*$' ++ eval 'test_oid_sha256_rawsz="$v"' +++ test_oid_sha256_rawsz=$'32\r' ++ read tag rest ++ case $tag in ++ k= ++ v= ++ expr '' : '[a-z0-9][a-z0-9]*$'

[1] https://gvfs.visualstudio.com/ci/_build/results?buildId=4815
Derrick Stolee (1):
  .gitattributes: ensure t/oid-info/* has eol=lf
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)
base-commit: 5d826e972970a784bd7a7bdf587512510097b8c7
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-98%2Fderrickstolee%2Ftest-oid-fix-windows-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-98/derrickstolee/test-oid-fix-windows-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/98
-- 
gitgitgadget
Next: Derrick Stolee via GitGitGadget
Message 1 of 16 in “.gitattributes: ensure t/oid-info/* has eol=lf”
  1. 0/1 .gitattributes: ensure t/oid-info/* has eol=lfDerrick Stolee via GitGitGadget, Dec 11, 2018
  2. 1/1 .gitattributes: ensure t/oid-info/* has eol=lfDerrick Stolee via GitGitGadget, Dec 11, 2018
  3. SZEDER GáborDec 12, 2018
  4. Johannes SchindelinDec 13, 2018
  5. SZEDER GáborDec 13, 2018
  6. Johannes SchindelinDec 13, 2018
  7. Junio C HamanoDec 12, 2018
  8. 0/2 Add more eol=lf to .gitattributesDerrick Stolee via GitGitGadget, Dec 12, 2018
  9. 1/2 .gitattributes: ensure t/oid-info/* has eol=lfDerrick Stolee via GitGitGadget, Dec 12, 2018
  10. Junio C HamanoDec 13, 2018
  11. Derrick StoleeDec 13, 2018
  12. Junio C HamanoDec 14, 2018
  13. brian m. carlsonDec 14, 2018
  14. Johannes SchindelinDec 14, 2018
  15. 2/2 t4256: mark support files as LF-onlyJohannes Schindelin via GitGitGadget, Dec 12, 2018
  16. Junio C HamanoDec 13, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.