From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Wink Saville" <wink@saville.com>,
"Jacob Keller" <jacob.keller@gmail.com>,
"Bryan Turner" <bturner@atlassian.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Jeff King" <peff@peff.net>
Subject: Re: [PATCH 8/8] fetch: stop clobbering existing tags without --force
Date: Tue, 08 May 2018 14:37:53 +0900 [thread overview]
Message-ID: <xmqqvabylnbi.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180429202100.32353-9-avarab@gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Sun, 29 Apr 2018 20:21:00 +0000")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> > Tags need not be pointing at commits so there is no way to
> > guarantee "fast-forward" anyway.
The observation the above statement makes is not incorrect per-se,
but it does not justify "anything goes". "nothing is allowed unless
forced" is equally a logical consequence of the observation.
> That comment and the rest of the history of "fetch" shows that the
> "+" (--force) part of refpecs was only conceived for branch updates,
> while tags have accepted any changes from upstream unconditionally and
> clobbered the local tag object. Changing this behavior has been
> discussed as early as 2011[1].
Thanks for a pointer. We didn't keep reflog on tags as we wanted
tags to be fixed points and made --tags a refspec without leading
'+' because we didn't want this local clobbering. I'd say it is
just a buggy implementation, and we should just implement a simple
rule "refs/tags/* is never updated unless forced".
> I the current behavior doesn't make sense, it easily results in local
s/I the/To me, the/, or s/I the/The/.
> tags accidentally being clobbered. Ideally we'd namespace our tags
> per-remote, but as with my 97716d217c ("fetch: add a --prune-tags
> option and fetch.pruneTags config", 2018-02-09) it's easier to work
> around the current implementation than to fix the root cause,
I do not think they are the same problem.
You can have refs/remote/$name/v1.0 and have look-up rules to peek
at various places in refs/* hierarchy for v1.0, and you may have
*solved* the "oops I overwrote and the meaning of v1.0 suddenly
changed" issue, but if you fetched to a location in refs/* that has
higher precedence, then "oops, the meaning of v1.0 suddenly changed"
issue itself is *not* solved at all.
> so this
> implements suggestion #1 from [1], "fetch" now only clobbers the tag
> if either "+" is provided as part of the refspec, or if "--force" is
> provided on the command-line.
Good. Regardless of the issue of separate namespace that is
overlayed at the look-up time, this makes tons of sense.
> diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
> index 8631e365f4..5b4fc36866 100644
> --- a/Documentation/fetch-options.txt
> +++ b/Documentation/fetch-options.txt
> @@ -49,11 +49,16 @@ endif::git-pull[]
>
> -f::
> --force::
> - When 'git fetch' is used with `<rbranch>:<lbranch>`
> - refspec, it refuses to update the local branch
> - `<lbranch>` unless the remote branch `<rbranch>` it
> - fetches is a descendant of `<lbranch>`. This option
> - overrides that check.
> + When 'git fetch' is used with `<src>:<dst>` refspec it might
Nice to see attention to the detail here. s/might/may/, I would
say, though.
> + refuse to update the local branch as discussed
> diff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt
> index c579793af5..672e8bc1c0 100644
> --- a/Documentation/pull-fetch-param.txt
> +++ b/Documentation/pull-fetch-param.txt
> @@ -32,12 +32,22 @@ name.
> `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`;
> it requests fetching everything up to the given tag.
> +
> -The remote ref that matches <src>
> -is fetched, and if <dst> is not empty string, the local
> -ref that matches it is fast-forwarded using <src>.
> -If the optional plus `+` is used, the local ref
> -is updated even if it does not result in a fast-forward
> -update.
> +The remote ref that matches <src> is fetched, and if <dst> is not
> +empty string, an attempt is made to update the local ref that matches
> +it.
> ++
> +Whether that update is allowed is confusingly not the inverse of
> +whether a server will accept a push as described in the `<refspec>...`
> +section of linkgit:git-push[1]. If it's a commit under `refs/heads/*`
> +only fast-forwards are allowed,
Perhaps correct. It is unclear what happens when it is fetching
non-commit to refs/heads/* in the above sentence.
> but unlike what linkgit:git-push[1]
> +will accept clobbering any ref pointing to blobs, trees etc. in any
> +other namespace will be accepted, but commits in any ref
> +namespace. ...
I cannot quite parse this.
> +... Those apply the same fast-forward rule.
Who are "Those"? refs/poo/*?
> +... An exception to
> +this is that as of Git version 2.18 any object under `refs/tags/*` is
> +protected from updates.
OK.
> +If the optional plus `+` is used, the local ref is updated if the
Tighten "is used" to claify that you are talking about the '+'
prefix that signals a forced push/fetch. We do not want to hear
from people who complain their "git fetch origin master+" does not
work.
> - OPT__FORCE(&force, N_("force overwrite of local branch"), 0),
> + OPT__FORCE(&force, N_("force overwrite of local reference"), 0),
Good. This is long overdue.
next prev parent reply other threads:[~2018-05-08 5:37 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 19:57 Fetching tags overwrites existing tags Wink Saville
2018-04-24 23:48 ` Jacob Keller
2018-04-25 0:52 ` Junio C Hamano
2018-04-25 1:29 ` Jacob Keller
2018-04-25 1:31 ` Wink Saville
2018-04-26 19:39 ` Wink Saville
2018-04-26 22:50 ` Junio C Hamano
2018-04-26 23:24 ` Junio C Hamano
2018-04-27 18:50 ` [RFC PATCH v2] Teach remote add the --prefix-tags option Wink Saville
2018-04-27 19:08 ` Fetching tags overwrites existing tags Wink Saville
2018-04-27 19:13 ` Bryan Turner
2018-05-04 15:56 ` Jacob Keller
2018-04-28 7:26 ` Jacob Keller
2018-04-28 18:27 ` [RFC PATCH v3] Teach remote add the --remote-tags option Wink Saville
2018-04-28 19:00 ` Wink Saville
2018-04-28 21:27 ` Wink Saville
2018-05-01 16:59 ` [RFC PATCH v4 0/3] Optional sub hierarchy for remote tags Wink Saville
2018-05-01 19:24 ` Ævar Arnfjörð Bjarmason
2018-05-01 19:45 ` Jacob Keller
2018-05-01 20:34 ` Wink Saville
2018-05-01 23:24 ` Junio C Hamano
2018-05-02 0:08 ` Jacob Keller
2018-05-01 23:28 ` Junio C Hamano
2018-05-01 16:59 ` [RFC PATCH v4 1/3] Teach remote add the --remote-tags option Wink Saville
2018-05-01 18:50 ` Ævar Arnfjörð Bjarmason
2018-05-08 10:26 ` Kaartic Sivaraam
2018-05-01 16:59 ` [RFC PATCH v4 2/3] Teach tag to list remote-tags Wink Saville
2018-05-01 16:59 ` [RFC PATCH v4 3/3] Test git remote add -f --remote-tags Wink Saville
2018-04-27 19:46 ` Fetching tags overwrites existing tags Ævar Arnfjörð Bjarmason
2018-04-29 20:20 ` [PATCH 0/8] "git fetch" should not clobber existing tags without --force Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 00/10] " Ævar Arnfjörð Bjarmason
2018-08-13 19:22 ` [PATCH v3 0/7] Prep for " Ævar Arnfjörð Bjarmason
2018-08-13 20:29 ` Junio C Hamano
2018-08-13 20:37 ` Ævar Arnfjörð Bjarmason
2018-08-30 20:12 ` [PATCH v4 0/6] " Ævar Arnfjörð Bjarmason
2018-08-31 20:09 ` [PATCH v5 0/9] git " Ævar Arnfjörð Bjarmason
2018-08-31 20:09 ` [PATCH v5 1/9] fetch: change "branch" to "reference" in --force -h output Ævar Arnfjörð Bjarmason
2018-08-31 20:09 ` [PATCH v5 2/9] push tests: make use of unused $1 in test description Ævar Arnfjörð Bjarmason
2018-08-31 21:07 ` Junio C Hamano
2018-08-31 22:02 ` Ævar Arnfjörð Bjarmason
2018-08-31 20:09 ` [PATCH v5 3/9] push tests: use spaces in interpolated string Ævar Arnfjörð Bjarmason
2018-08-31 20:09 ` [PATCH v5 4/9] fetch tests: add a test for clobbering tag behavior Ævar Arnfjörð Bjarmason
2018-08-31 20:10 ` [PATCH v5 5/9] push doc: remove confusing mention of remote merger Ævar Arnfjörð Bjarmason
2018-08-31 20:10 ` [PATCH v5 6/9] push doc: move mention of "tag <tag>" later in the prose Ævar Arnfjörð Bjarmason
2018-08-31 20:10 ` [PATCH v5 7/9] push doc: correct lies about how push refspecs work Ævar Arnfjörð Bjarmason
2018-08-31 20:10 ` [PATCH v5 8/9] fetch: document local ref updates with/without --force Ævar Arnfjörð Bjarmason
2018-08-31 20:10 ` [PATCH v5 9/9] fetch: stop clobbering existing tags without --force Ævar Arnfjörð Bjarmason
2018-08-30 20:12 ` [PATCH v4 1/6] fetch: change "branch" to "reference" in --force -h output Ævar Arnfjörð Bjarmason
2018-08-30 20:12 ` [PATCH v4 2/6] push tests: correct quoting in interpolated string Ævar Arnfjörð Bjarmason
2018-08-30 21:20 ` Junio C Hamano
2018-08-30 20:12 ` [PATCH v4 3/6] fetch tests: add a test for clobbering tag behavior Ævar Arnfjörð Bjarmason
2018-08-30 21:22 ` Junio C Hamano
2018-08-30 20:12 ` [PATCH v4 4/6] push doc: correct lies about how push refspecs work Ævar Arnfjörð Bjarmason
2018-08-30 21:31 ` Junio C Hamano
2018-08-30 22:34 ` Ævar Arnfjörð Bjarmason
2018-08-31 16:24 ` Junio C Hamano
2018-08-31 16:35 ` Ævar Arnfjörð Bjarmason
2018-08-30 20:12 ` [PATCH v4 5/6] fetch: document local ref updates with/without --force Ævar Arnfjörð Bjarmason
2018-08-30 20:12 ` [PATCH v4 6/6] fetch: stop clobbering existing tags without --force Ævar Arnfjörð Bjarmason
2018-08-30 21:43 ` Junio C Hamano
2018-08-13 19:22 ` [PATCH v3 1/7] fetch tests: change "Tag" test tag to "testTag" Ævar Arnfjörð Bjarmason
2018-08-13 19:22 ` [PATCH v3 2/7] push tests: remove redundant 'git push' invocation Ævar Arnfjörð Bjarmason
2018-08-13 19:22 ` [PATCH v3 3/7] push tests: fix logic error in "push" test assertion Ævar Arnfjörð Bjarmason
2018-08-13 19:22 ` [PATCH v3 4/7] push tests: add more testing for forced tag pushing Ævar Arnfjörð Bjarmason
2018-08-13 19:22 ` [PATCH v3 5/7] push tests: assert re-pushing annotated tags Ævar Arnfjörð Bjarmason
2018-08-13 19:22 ` [PATCH v3 6/7] fetch tests: correct a comment "remove it" -> "remove them" Ævar Arnfjörð Bjarmason
2018-08-13 19:22 ` [PATCH v3 7/7] pull doc: fix a long-standing grammar error Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 01/10] fetch tests: change "Tag" test tag to "testTag" Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 02/10] push tests: remove redundant 'git push' invocation Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 03/10] push tests: fix logic error in "push" test assertion Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 04/10] push tests: add more testing for forced tag pushing Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 05/10] push tests: assert re-pushing annotated tags Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 06/10] push doc: correct lies about how push refspecs work Ævar Arnfjörð Bjarmason
2018-07-31 17:40 ` Junio C Hamano
2018-08-30 14:52 ` Ævar Arnfjörð Bjarmason
2018-08-30 15:23 ` Junio C Hamano
2018-08-30 16:59 ` Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 07/10] fetch tests: correct a comment "remove it" -> "remove them" Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 08/10] fetch tests: add a test clobbering tag behavior Ævar Arnfjörð Bjarmason
2018-07-31 17:48 ` Junio C Hamano
2018-07-31 13:07 ` [PATCH v2 09/10] pull doc: fix a long-standing grammar error Ævar Arnfjörð Bjarmason
2018-07-31 13:07 ` [PATCH v2 10/10] fetch: stop clobbering existing tags without --force Ævar Arnfjörð Bjarmason
2018-07-31 18:03 ` Junio C Hamano
2018-04-29 20:20 ` [PATCH 1/8] push tests: remove redundant 'git push' invocation Ævar Arnfjörð Bjarmason
2018-04-29 20:20 ` [PATCH 2/8] push tests: fix logic error in "push" test assertion Ævar Arnfjörð Bjarmason
2018-04-29 20:20 ` [PATCH 3/8] push tests: add more testing for forced tag pushing Ævar Arnfjörð Bjarmason
2018-05-07 10:09 ` Kaartic Sivaraam
2018-05-08 2:35 ` Junio C Hamano
2018-05-08 3:19 ` Junio C Hamano
2018-05-08 9:52 ` Kaartic Sivaraam
2018-05-08 10:19 ` Kaartic Sivaraam
2018-04-29 20:20 ` [PATCH 4/8] push tests: assert re-pushing annotated tags Ævar Arnfjörð Bjarmason
2018-05-08 4:30 ` Junio C Hamano
2018-05-08 14:05 ` SZEDER Gábor
2018-04-29 20:20 ` [PATCH 5/8] push doc: correct lies about how push refspecs work Ævar Arnfjörð Bjarmason
2018-05-08 5:14 ` Junio C Hamano
2018-04-29 20:20 ` [PATCH 6/8] fetch tests: correct a comment "remove it" -> "remove them" Ævar Arnfjörð Bjarmason
2018-04-29 20:20 ` [PATCH 7/8] fetch tests: add a test clobbering tag behavior Ævar Arnfjörð Bjarmason
2018-04-29 20:21 ` [PATCH 8/8] fetch: stop clobbering existing tags without --force Ævar Arnfjörð Bjarmason
2018-05-08 5:37 ` Junio C Hamano [this message]
2018-05-01 17:11 ` Fetching tags overwrites existing tags Wink Saville
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=xmqqvabylnbi.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=bturner@atlassian.com \
--cc=git@vger.kernel.org \
--cc=jacob.keller@gmail.com \
--cc=peff@peff.net \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wink@saville.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).