From: Junio C Hamano <gitster@pobox.com>
To: Thomas Gummerer <t.gummerer@gmail.com>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Eric Sunshine" <sunshine@sunshineco.com>
Subject: Re: [PATCH v4 2/4] worktree: add --[no-]track option to the add subcommand
Date: Fri, 24 Nov 2017 15:57:04 +0900 [thread overview]
Message-ID: <xmqqa7zcnozj.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171122223020.2780-3-t.gummerer@gmail.com> (Thomas Gummerer's message of "Wed, 22 Nov 2017 22:30:18 +0000")
Thomas Gummerer <t.gummerer@gmail.com> writes:
> diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
> index b5c47ac602..53042ce565 100755
> --- a/t/t2025-worktree-add.sh
> +++ b/t/t2025-worktree-add.sh
> @@ -313,5 +313,60 @@ test_expect_success 'checkout a branch under bisect' '
> test_expect_success 'rename a branch under bisect not allowed' '
> test_must_fail git branch -M under-bisect bisect-with-new-name
> '
> +# Is branch "refs/heads/$1" set to pull from "$2/$3"?
> +test_branch_upstream () {
> + printf "%s\n" "$2" "refs/heads/$3" >expect.upstream &&
> + {
> + git config "branch.$1.remote" &&
> + git config "branch.$1.merge"
> + } >actual.upstream &&
> + test_cmp expect.upstream actual.upstream
> +}
OK.
> +test_expect_success '--track sets up tracking' '
> + test_when_finished rm -rf track &&
> + git worktree add --track -b track track master &&
> + git config "branch.track.merge" &&
> + (
> + test_branch_upstream track . master
> + )
> +'
Is this "git config" necessary, or is it a remnant of a debugging
session? It is tested in the helper that branch.track.merge is set
to something, and otherwise the helper would fail the same way as
this standalnoe "git config" would, no?
> +# setup remote repository $1 and repository $2 with $1 set up as
> +# remote. The remote has two branches, master and foo.
> +setup_remote_repo () {
> + git init $1 &&
> + (
> + cd $1 &&
> + test_commit $1_master &&
> + git checkout -b foo &&
> + test_commit upstream_foo
> + ) &&
> + git init $2 &&
> + (
> + cd $2 &&
> + test_commit $2_master &&
> + git remote add $1 ../$1 &&
> + git config remote.$1.fetch \
> + "refs/heads/*:refs/remotes/$1/*" &&
> + git fetch --all
> + )
> +}
> +
> +test_expect_success '--no-track avoids setting up tracking' '
> + test_when_finished rm -rf repo_upstream repo_local foo &&
> + setup_remote_repo repo_upstream repo_local &&
> + (
> + cd repo_local &&
> + git worktree add --no-track -b foo ../foo repo_upstream/foo
> + ) &&
> + (
> + cd foo &&
> + ! test_branch_upstream foo repo_upstream foo &&
It is true that this test helper must yield failure. But what you
expect probably is more than that, no? For example, the test helper
would fail even if branch.foo.remote is set to the upstream as long
as branch.foo.merge is not set to point at their foo, but what you
really want to make sure is that neither configuration variable is
set.
> + git rev-parse repo_upstream/foo >expect &&
> + git rev-parse foo >actual &&
> + test_cmp expect actual
> + )
> +'
>
> test_done
next prev parent reply other threads:[~2017-11-24 6:57 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailto:20171118224706.13810-1-t.gummerer@gmail.com>
2017-11-22 22:30 ` [PATCH v4 0/4] make git worktree add dwim more Thomas Gummerer
2017-11-22 22:30 ` [PATCH v4 1/4] checkout: factor out functions to new lib file Thomas Gummerer
2017-11-24 6:47 ` Junio C Hamano
2017-11-22 22:30 ` [PATCH v4 2/4] worktree: add --[no-]track option to the add subcommand Thomas Gummerer
2017-11-24 6:57 ` Junio C Hamano [this message]
2017-11-25 16:58 ` Thomas Gummerer
2017-11-22 22:30 ` [PATCH v4 3/4] worktree: make add <path> <branch> dwim Thomas Gummerer
2017-11-24 6:59 ` Junio C Hamano
2017-11-22 22:30 ` [PATCH v4 4/4] worktree: make add <path> dwim Thomas Gummerer
2017-11-24 7:11 ` Junio C Hamano
2017-11-25 17:50 ` Thomas Gummerer
2017-11-25 18:26 ` Paul Smith
2017-11-25 20:06 ` Thomas Gummerer
2017-11-25 20:39 ` Randall S. Becker
2017-11-25 21:48 ` Thomas Gummerer
2017-11-25 23:11 ` Paul Smith
2017-11-26 3:35 ` Junio C Hamano
2017-11-26 11:37 ` Thomas Gummerer
2017-11-26 19:43 ` [PATCH v5 0/6] make git worktree add dwim more Thomas Gummerer
2017-11-26 19:43 ` [PATCH v5 1/6] checkout: factor out functions to new lib file Thomas Gummerer
2017-11-26 19:43 ` [PATCH v5 2/6] worktree: add can be created from any commit-ish Thomas Gummerer
2017-11-26 19:43 ` [PATCH v5 3/6] worktree: add --[no-]track option to the add subcommand Thomas Gummerer
2017-11-26 19:43 ` [PATCH v5 4/6] worktree: make add <path> <branch> dwim Thomas Gummerer
2017-11-26 19:43 ` [PATCH v5 5/6] worktree: add --guess-remote flag to add subcommand Thomas Gummerer
2017-11-27 6:36 ` Junio C Hamano
2017-11-27 20:56 ` Thomas Gummerer
2017-11-26 19:43 ` [PATCH v5 6/6] add worktree.guessRemote config option Thomas Gummerer
2017-11-27 6:45 ` Junio C Hamano
2017-11-27 20:59 ` Thomas Gummerer
2017-11-29 20:04 ` [PATCH v6 0/6] make git worktree add dwim more Thomas Gummerer
2017-11-29 20:04 ` [PATCH v6 1/6] checkout: factor out functions to new lib file Thomas Gummerer
2017-11-29 20:04 ` [PATCH v6 2/6] worktree: add can be created from any commit-ish Thomas Gummerer
2017-11-29 20:04 ` [PATCH v6 3/6] worktree: add --[no-]track option to the add subcommand Thomas Gummerer
2017-11-29 20:04 ` [PATCH v6 4/6] worktree: make add <path> <branch> dwim Thomas Gummerer
2017-11-29 20:04 ` [PATCH v6 5/6] worktree: add --guess-remote flag to add subcommand Thomas Gummerer
2017-11-29 20:04 ` [PATCH v6 6/6] add worktree.guessRemote config option Thomas Gummerer
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=xmqqa7zcnozj.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=sunshine@sunshineco.com \
--cc=t.gummerer@gmail.com \
/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).