From: Eric Sunshine <sunshine@sunshineco.com>
To: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: Git List <git@vger.kernel.org>,
Jonathan Nieder <jrnieder@gmail.com>, Jeff King <peff@peff.net>,
Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH] fetch: add --no-update-remote-refs
Date: Fri, 17 Jan 2020 11:23:06 -0500 [thread overview]
Message-ID: <CAPig+cTK86FPm1kk-P=dvegu+FTzV3k5Z12Etz_jpE=JdyztDQ@mail.gmail.com> (raw)
In-Reply-To: <pull.532.git.1579274939431.gitgitgadget@gmail.com>
On Fri, Jan 17, 2020 at 10:29 AM Derrick Stolee via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
> @@ -174,6 +174,30 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
> +test_expect_success 'fetch --no-update-remote-refs keeps existing refs' '
> + cd "$TRASH_DIRECTORY" &&
Why does the prologue of this test use `cd "$TRASH_DIRECTORY"` when
all the other tests use `cd "$D"`?
> + git clone "$D" remote-refs &&
> + git -C remote-refs rev-parse remotes/origin/master >old &&
> + git -C remote-refs update-ref refs/remotes/origin/master master~1 &&
> + git -C remote-refs rev-parse remotes/origin/master >new &&
> + git -C remote-refs fetch --no-update-remote-refs origin &&
> + git -C remote-refs rev-parse remotes/origin/master >actual &&
> + test_cmp new actual &&
> + git -C remote-refs fetch origin &&
> + git -C remote-refs rev-parse remotes/origin/master >actual &&
> + test_cmp old actual
> +'
I wouldn't expect a re-roll just for this (nor do I insist upon such a
change), but this is one of those cases when -C hurts, rather than
helps, readability, due to the amount of noise it adds to nearly every
line of the test. Using a subshell makes for less noisy code:
git clone "$D" remote-refs &&
(
cd remote-refs &&
git rev-parse remotes/origin/master >old &&
git update-ref refs/remotes/origin/master master~1 &&
git rev-parse remotes/origin/master >new &&
git fetch --no-update-remote-refs origin &&
git rev-parse remotes/origin/master >actual &&
test_cmp new actual &&
git fetch origin &&
git rev-parse remotes/origin/master >actual &&
test_cmp old actual
)
> +test_expect_success 'fetch --no-update-remote-refs --prune with refspec' '
> + git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master &&
> + git -C remote-refs update-ref refs/hidden/foo/otherbranch master &&
> + git -C remote-refs fetch --prune --no-update-remote-refs origin +refs/heads/*:refs/hidden/* &&
> + git -C remote-refs rev-parse remotes/origin/foo/otherbranch &&
> + test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch &&
> + git -C remote-refs fetch --prune --no-update-remote-refs origin &&
> + test_must_fail git -C remote-refs rev-parse remotes/origin/foo/otherbranch
> +'
Ditto.
next prev parent reply other threads:[~2020-01-17 16:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 15:28 [PATCH] fetch: add --no-update-remote-refs Derrick Stolee via GitGitGadget
2020-01-17 16:23 ` Eric Sunshine [this message]
2020-01-17 19:13 ` Junio C Hamano
2020-01-17 19:26 ` Jeff King
2020-01-20 14:44 ` Derrick Stolee
2020-01-17 19:20 ` Jeff King
2020-01-21 0:57 ` Derrick Stolee
2020-01-21 1:38 ` [PATCH v2] fetch: document and test --refmap="" Derrick Stolee via GitGitGadget
2020-01-21 16:24 ` Jeff King
2020-01-21 18:01 ` Derrick Stolee
2020-01-21 19:06 ` Jeff King
2020-01-21 18:22 ` Junio C Hamano
2020-01-21 18:24 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cTK86FPm1kk-P=dvegu+FTzV3k5Z12Etz_jpE=JdyztDQ@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).