Re: [PATCH v4 1/3] clone: do not include authentication data in guessed dir
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 5, 2015, 19:36 UTC
- Message-ID
- <xmqqr3nh34tv.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <xmqqzj253a39.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> Perhaps add > > "test_clone_dir ssh://user:passw@rd@host/ host" > > here? How is this expected to be parsed?
For completeness, here is what I think the end result (together with Peff's series) of the test should look like.
The first hunk is merely style. We could drop 'in "$@"' from there and some people may argue that it would be more obvious, but I think being explict is fine.
As to the second hunk:
- the first batch is for "trailing slash removal" for scp-like syntax;
- the second batch is for "omitting path should default to host" for the same;
- the third batch is for "omitting authentication material" for the same.
Note that ssh://user:passw@rd@host:1234/ and user:passw@rd@host:/ tests fail for the same reason (finding @ should be greedy, I think).
t/t5603-clone-dirname.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/t/t5603-clone-dirname.sh b/t/t5603-clone-dirname.sh index 27dbd6c..4897ea8 100755 --- a/t/t5603-clone-dirname.sh +++ b/t/t5603-clone-dirname.sh @@ -22,7 +22,8 @@ test_clone_dir () { expect=success bare=non-bare clone_opts= - for i in "$@"; do + for i in "$@" + do case "$i" in fail) expect=failure @@ -61,12 +62,23 @@ test_clone_dir ssh://host/foo/ foo test_clone_dir ssh://host/foo.git/ foo test_clone_dir ssh://host/foo/.git/ foo +test_clone_dir host:foo/ foo +test_clone_dir host:foo.git/ foo +test_clone_dir host:foo/.git/ foo + # omitting the path should default to the hostname test_clone_dir ssh://host/ host test_clone_dir ssh://host:1234/ host test_clone_dir ssh://user@host/ host +test_clone_dir host:/ host + +# auth materials should be redacted test_clone_dir ssh://user:password@host/ host test_clone_dir ssh://user:password@host:1234/ host +test_clone_dir ssh://user:passw@rd@host:1234/ host +test_clone_dir user@host:/ host +test_clone_dir user:password@host:/ host +test_clone_dir user:passw@rd@host:/ host # trailing port-like numbers should not be stripped for paths test_clone_dir ssh://user:password@host/test:1234 1234