git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: "Git List" <git@vger.kernel.org>, "Jeff King" <peff@peff.net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH v3 6/6] clone: add tests for cloning with empty path
Date: Tue, 4 Aug 2015 14:37:51 -0400	[thread overview]
Message-ID: <CAPig+cT1utggwL_E2+Mmp7LqscywhrWx_Dr0XOSbTJU5oq7NLQ@mail.gmail.com> (raw)
In-Reply-To: <1438687797-14254-7-git-send-email-ps@pks.im>

On Tue, Aug 4, 2015 at 7:29 AM, Patrick Steinhardt <ps@pks.im> wrote:
> Test behavior of `git clone` when working with an empty path
> component. This may be the case when cloning a file system's root
> directory or from a remote server's root.

A few minor, mostly style-related, comments below...

> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> diff --git a/t/t1509-root-worktree.sh b/t/t1509-root-worktree.sh
> index 553a3f6..d521ca3 100755
> --- a/t/t1509-root-worktree.sh
> +++ b/t/t1509-root-worktree.sh
> @@ -237,6 +237,49 @@ test_foobar_foobar
>
>  test_expect_success 'cleanup' 'rm -rf /.git'
>
> +say "clone .git at root without reponame"
> +
> +test_expect_success 'go to /' 'cd /'
> +test_expect_success 'setup' '
> +       echo "Initialized empty Git repository in /.git/" > expected &&
> +       git init > result &&
> +       test_cmp expected result
> +'
> +
> +test_clone_expect_dir() {
> +       URL="$1"
> +       DIR="$2"

It would be nice for the &&-chain to be intact for these two lines, as
well, since you never know where someone may insert code in the
future. If code is inserted above or between these lines, and the code
fails, its failure will go unnoticed due to the broken &&-chain.

> +       cat <<-EOF >expected &&

In this codebase, it's customary to say:

    cat >expected <<-EOF &&

> +               Cloning into '$DIR'...
> +               warning: You appear to have cloned an empty repository.
> +               EOF

In this codebase, it's customary to place the content and EOF at the
same indentation level as the opening 'cat <<EOF'.

> +       git clone "$URL" >result 2>&1 &&
> +       rm -rf "$DIR" &&
> +       test_cmp expected result
> +}
> +
> +test_expect_success 'go to /clones' 'mkdir /clones && cd /clones'
> +test_expect_success 'simple clone of /' '
> +       cat <<-EOF >expected &&

Since you don't expect any variable interpolation in this case, you
can telegraph that intent more clearly via:

    cat >expected <<-\EOF &&

> +               fatal: No directory name could be guessed.
> +               Please specify a directory on the command line
> +               EOF
> +       test_expect_code 128 git clone / >result 2>&1 &&
> +       test_cmp expected result'
> +
> +test_expect_success 'clone with file://host/' '
> +       test_clone_expect_dir file://127.0.0.1/ 127.0.0.1'
> +test_expect_success 'clone with file://user@host/' '
> +       test_clone_expect_dir file://user@127.0.0.1/ 127.0.0.1'
> +test_expect_success 'clone with file://user:password@host/' '
> +       test_clone_expect_dir file://user:password@127.0.0.1/ 127.0.0.1'
> +test_expect_success 'clone with file://host:port/' '
> +       test_clone_expect_dir file://127.0.0.1:9999/ 127.0.0.1'
> +test_expect_success 'clone with file://user:password@host:port' '
> +       test_clone_expect_dir file://user:password@127.0.0.1:9999/ 127.0.0.1'
> +
> +test_expect_success 'cleanup' 'rm -rf /.git /clones'
> +
>  say "auto bare gitdir"
>
>  # DESTROYYYYY!!!!!
> --
> 2.5.0

  reply	other threads:[~2015-08-04 18:37 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 11:48 [PATCH] clone: fix repo name when cloning a server's root Patrick Steinhardt
2015-07-27 12:51 ` Duy Nguyen
2015-07-27 12:59   ` Patrick Steinhardt
2015-07-27 14:29   ` Junio C Hamano
2015-07-29 15:51 ` [PATCH v2 0/6] " Patrick Steinhardt
2015-07-29 15:51   ` [PATCH v2 1/6] tests: fix broken && chains in t1509-root-worktree Patrick Steinhardt
2015-07-29 15:51   ` [PATCH v2 2/6] tests: fix cleanup after tests " Patrick Steinhardt
2015-07-29 15:51   ` [PATCH v2 3/6] connect: expose parse_connect_url() Patrick Steinhardt
2015-07-29 15:51   ` [PATCH v2 4/6] connect: move error check to caller of parse_connect_url Patrick Steinhardt
2015-07-29 20:32     ` Eric Sunshine
2015-07-30 12:19       ` Patrick Steinhardt
2015-07-29 15:51   ` [PATCH v2 5/6] clone: fix hostname parsing when guessing dir Patrick Steinhardt
2015-07-29 17:42     ` Junio C Hamano
2015-07-30 12:18       ` Patrick Steinhardt
2015-07-30 16:30         ` Junio C Hamano
2015-07-30 16:53           ` Junio C Hamano
2015-08-03  8:34             ` Patrick Steinhardt
2015-08-03 16:37               ` Jeff King
2015-08-03 19:43                 ` Junio C Hamano
2015-07-29 15:51   ` [PATCH v2 6/6] clone: add tests for cloning with empty path Patrick Steinhardt
2015-07-30 18:18     ` Eric Sunshine
2015-07-31  0:58       ` Junio C Hamano
2015-07-31  8:45         ` Patrick Steinhardt
2015-08-04 11:29 ` [PATCH v3 0/6] fix repo name when cloning a server's root Patrick Steinhardt
2015-08-04 11:29   ` [PATCH v3 1/6] tests: fix broken && chains in t1509-root-worktree Patrick Steinhardt
2015-08-04 11:29   ` [PATCH v3 2/6] tests: fix cleanup after tests " Patrick Steinhardt
2015-08-04 11:29   ` [PATCH v3 3/6] clone: do not include authentication data in guessed dir Patrick Steinhardt
2015-08-04 11:29   ` [PATCH v3 4/6] clone: do not use port number as dir name Patrick Steinhardt
2015-08-04 11:29   ` [PATCH v3 5/6] clone: abort if no dir name could be guessed Patrick Steinhardt
2015-08-04 11:29   ` [PATCH v3 6/6] clone: add tests for cloning with empty path Patrick Steinhardt
2015-08-04 18:37     ` Eric Sunshine [this message]
2015-08-05 17:34   ` [PATCH v3 0/6] fix repo name when cloning a server's root Junio C Hamano
2015-08-05 21:19     ` Jeff King
2015-08-06  7:22       ` Torsten Bögershausen
2015-08-06  8:00         ` Junio C Hamano
2015-08-05 10:06 ` [PATCH v4 0/3] " Patrick Steinhardt
2015-08-05 10:06   ` [PATCH v4 1/3] clone: do not include authentication data in guessed dir Patrick Steinhardt
2015-08-05 17:43     ` Junio C Hamano
2015-08-05 19:36       ` Junio C Hamano
2015-08-05 19:41         ` Junio C Hamano
2015-08-06  9:47           ` Patrick Steinhardt
2015-08-07 20:45             ` Junio C Hamano
2015-08-08 17:37               ` Patrick Steinhardt
2015-08-05 10:06   ` [PATCH v4 2/3] clone: do not use port number as dir name Patrick Steinhardt
2015-08-05 10:06   ` [PATCH v4 3/3] clone: abort if no dir name could be guessed Patrick Steinhardt
2015-08-05 17:44     ` Junio C Hamano
2015-08-10 15:48 ` [PATCH v5 0/5] Improve guessing of repository names Patrick Steinhardt
2015-08-10 15:48   ` [PATCH v5 1/5] clone: add tests for output directory Patrick Steinhardt
2015-08-10 15:48   ` [PATCH v5 2/5] clone: use computed length in guess_dir_name Patrick Steinhardt
2015-08-10 15:48   ` [PATCH v5 3/5] clone: do not include authentication data in guessed dir Patrick Steinhardt
2015-08-10 15:48   ` [PATCH v5 4/5] clone: do not use port number as dir name Patrick Steinhardt
2015-08-10 15:48   ` [PATCH v5 5/5] clone: abort if no dir name could be guessed Patrick Steinhardt
2015-08-10 18:07   ` [PATCH v5 0/5] Improve guessing of repository names Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPig+cT1utggwL_E2+Mmp7LqscywhrWx_Dr0XOSbTJU5oq7NLQ@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).