Re: [GSoC][PATCH v4 4/4] credential-cache: add tests for XDG functionality

From: Devin Lehmacher <hidden>
Date: 2017-03-16 21:04:21

quoted
quoted
+test_expect_success 'credential-cache --socket option overrides default location' '
+ test_when_finished "rm -rf \"$HOME\"/dir/" &&
+ check approve "cache --socket \"$HOME/dir/socket\"" <<-\EOF &&
+ protocol=https
+ host=example.com
+ username=store-user
+ password=store-pass
+ EOF
+ test -S "$HOME/dir/socket" &&
+ git credential-cache exit
+'
This is almost right, except:

  - the "exit" needs to be told which socket to use

  - we should do the "exit" even when the test fails early (so in
    test_when_finished)

  - the test_when_finished block will interpolate $HOME when setting up
    the block, which will break if it contains double-quotes or other
    special characters. It should use \$HOME.

    I suspect the "check" invocation needs to do so as well, though it
    is even trickier (we shove it into a single-quoted "-c" argument).

    I think you could get by in both cases with relative paths.
Using a relative path won't work since `git credential-cache --socket`
only accepts absolute paths. It shouldn't be too hard to escape the
string though.

-Devin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help