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

t3404 static check of bad SHA-1 failure

From
Armin Kunaschik <megabreit@googlemail.com>
Date
May 13, 2016, 16:09 UTC
Message-ID
<CALR6jEiH6oxq=KXfz1pqOue9VKnkp=S8zNqC4OFmbuhRFFxoMw@mail.gmail.com>
Hello,

in t3404 test 91 - static check of bad SHA-1 fails (with ksh) with a syntax error in git-rebase. git-rebase[6]: test: argument expected

Reason is, again, a test -z without quotes in git-rebase--interactive:
*** ../git-rebase--interactive.orig     Tue May 10 17:36:59 2016
--- ../git-rebase--interactive  Fri May 13 17:57:27 2016
***************
*** 870,876 ****
                badsha=1
        else
                sha1_verif="$(git rev-parse --verify --quiet $1^{commit})"
!               if test -z $sha1_verif
                then
                        badsha=1
                fi
--- 870,876 ----
                badsha=1
        else
                sha1_verif="$(git rev-parse --verify --quiet $1^{commit})"
!               if test -z "$sha1_verif"
                then
                        badsha=1
                fi

Maybe it would be a good idea, to quote the test -z $1 in the same function check_commit_sha too. The test completes successfully without it, but since it's an user option, I think it should be quoted. Then there would be no more unquoted test -z anymore :-)

Armin
Next: Jeff King
Message 1 of 19 in “t3404 static check of bad SHA-1 failure”
  1. Armin KunaschikMay 13, 2016
  2. Jeff KingMay 13, 2016
  3. Junio C HamanoMay 13, 2016
  4. Jeff KingMay 13, 2016
  5. Jeff KingMay 13, 2016
  6. Junio C HamanoMay 13, 2016
  7. 0/6 test -z/-n quoting fix + misc cleanupsJeff King, May 13, 2016
  8. 1/6 t/lib-git-svn: drop $remote_git_svn and $git_svn_idJeff King, May 13, 2016
  9. 2/6 t9100,t3419: enclose all test code in single-quotesJeff King, May 13, 2016
  10. 3/6 t9107: use "return 1" instead of "exit 1"Jeff King, May 13, 2016
  11. Eric WongMay 13, 2016
  12. Eric SunshineMay 13, 2016
  13. Jeff KingMay 13, 2016
  14. Junio C HamanoMay 14, 2016
  15. Jeff KingMay 14, 2016
  16. 4/6 t9107: switch inverted single/double quotes in testJeff King, May 13, 2016
  17. 5/6 t9103: modernize test styleJeff King, May 13, 2016
  18. 6/6 always quote shell arguments to test -z/-nJeff King, May 13, 2016
  19. Junio C HamanoMay 13, 2016

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.