• Jonathan Nieder's avatar
    tests: check error message from run_command · c0f19bf3
    Jonathan Nieder authored
    In git versions starting at v1.7.5-rc0~29^2 until v1.7.5-rc3~2 (Revert
    "run-command: prettify -D_FORTIFY_SOURCE workaround", 2011-04-18)
    fixed it, the run_command facility would write a truncated error
    message when the command is present but cannot be executed for some
    other reason.  For example, if I add a 'hello' command to git:
    
    	$ echo 'echo hello' >git-hello
    	$ chmod +x git-hello
    	$ PATH=.:$PATH git hello
    	hello
    
    and make it non-executable, this is what I normally get:
    
    	$ chmod -x git-hello
    	$ git hello
    	fatal: cannot exec 'git-hello': Permission denied
    
    But with the problematic versions, we get disturbing output:
    
    	$ PATH=.:$PATH git hello
    	fatal: $
    
    Add some tests to make sure it doesn't happen again.
    
    The hello-script used in these tests uses cat instead of echo because
    on Windows the bash spawned by git converts LF to CRLF in text written
    by echo while the bash running tests does not, causing the test to
    fail if "echo" is used.  Thanks to Hannes for noticing.
    Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
    Improved-by: default avatarJohannes Sixt <j6t@kdbg.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    c0f19bf3
test-run-command.c 840 Bytes