Re: can I remove or move a tag in a remote repository?

Subsystems: the rest

2 messages, 2 authors, 2016-08-11 · open the first message on its own page

Re: can I remove or move a tag in a remote repository?

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:37:10

Jim Meyering [off-list ref] writes:
Here's the problem:
When I try to push the new tags, git-push fails:

  $ git-push -f --tags ssh+git://git.sv.gnu.org/srv/git/coreutils master:refs/heads/master
  updating 'refs/tags/cvs-head'
    from 2fd3fd29a8b40be695bc2327c8cd3bd33e521100
    to   db18f53ffb221e9957124d8af81c11a7e350ac3b
  ...
  Total 1, written 1 (delta 0), reused 0 (delta 0)
  Unpacking 1 objects
  error: denying non-fast forward; you should pull first

I get the same error also when using --force.
I think this is due to overeager receive.denyNonFastForwards
configuration setting at the repository you are pushing into.

I _think_ what receive-pack does in this case is totally wrong.
It should either:

 (1) deny overwriting existing tags -- tags are meant to be
     immutable so it should not allow them to be "updated"
     regardless of fast-forwardness, or

 (2) allow overwriting things under refs/tags/ without any
     fast-forward checking.  After all, a tag could point at a
     tree or a blob, and there is no fast-forwardness among
     trees.

The client side check in "git fetch" takes the latter viewpoint,
and I think we should be consistent with it.

Johannes, what do you think?  Does the following patch look sane
to you?

---
diff --git a/receive-pack.c b/receive-pack.c
index 1a141dc..6c3de47 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -120,7 +120,7 @@ static int update(struct command *cmd)
 			     "but I can't find it!", new_hex);
 	}
 	if (deny_non_fast_forwards && !is_null_sha1(new_sha1) &&
-	    !is_null_sha1(old_sha1)) {
+	    !is_null_sha1(old_sha1) && !strncmp(name, "refs/heads/", 11)) {
 		struct commit *old_commit, *new_commit;
 		struct commit_list *bases, *ent;
 

Re: can I remove or move a tag in a remote repository?

From: Johannes Schindelin <hidden>
Date: 2016-08-11 20:27:02

Hi,

On Tue, 28 Nov 2006, Junio C Hamano wrote:
Jim Meyering [off-list ref] writes:
quoted
Here's the problem:
When I try to push the new tags, git-push fails:

  $ git-push -f --tags ssh+git://git.sv.gnu.org/srv/git/coreutils master:refs/heads/master
  updating 'refs/tags/cvs-head'
    from 2fd3fd29a8b40be695bc2327c8cd3bd33e521100
    to   db18f53ffb221e9957124d8af81c11a7e350ac3b
  ...
  Total 1, written 1 (delta 0), reused 0 (delta 0)
  Unpacking 1 objects
  error: denying non-fast forward; you should pull first

I get the same error also when using --force.
I think this is due to overeager receive.denyNonFastForwards
configuration setting at the repository you are pushing into.

I _think_ what receive-pack does in this case is totally wrong.
It should either:

 (1) deny overwriting existing tags -- tags are meant to be
     immutable so it should not allow them to be "updated"
     regardless of fast-forwardness, or

 (2) allow overwriting things under refs/tags/ without any
     fast-forward checking.  After all, a tag could point at a
     tree or a blob, and there is no fast-forwardness among
     trees.

The client side check in "git fetch" takes the latter viewpoint,
and I think we should be consistent with it.

Johannes, what do you think?  Does the following patch look sane
to you?
It does if you agree that (2) is correct.

But I don't agree. cvs-head really should be a head IMHO, not a tag, 
because cvs-head really tracks a branch.

I also think that git-fetch silently updating tags is wrong. Rather, it 
should warn that the tags are different. But I've been wrong before.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help