From: Junio C Hamano Date: Tue, 31 Jul 2018 17:40:43 GMT Subject: Re: [PATCH v2 06/10] push doc: correct lies about how push refspecs work Message-ID: In-Reply-To: <20180731130718.25222-7-avarab@gmail.com> Ævar Arnfjörð Bjarmason writes: > The is often the name of the branch you would want to push, but > -it can be any arbitrary "SHA-1 expression", such as `master~4` or > -`HEAD` (see linkgit:gitrevisions[7]). > +it can be any arbitrary expression to a commit, such as `master~4` or > +`HEAD` (see linkgit:gitrevisions[7]). It can also refer to tag > +objects, trees or blobs if the is outside of `refs/heads/*`. "It can also refer to..." is a good addition, but do you really want to make it part of this series to change/deprecate "SHA-1 expression" (which would certainly involve discussion on "then what to call them instead, now we are trying to refrain from saying SHA-1?")? > +on the remote side. Whether this is allowed depends on where in > +`refs/*` the reference lives. The `refs/heads/*` namespace will > +only accept commit objects, and then only they can be > +fast-forwarded. The `refs/tags/*` namespace will accept any kind of > +object, and any changes to them and others types of objects will be > +rejected. Finally, it's possible to push any type of object to any > +namespace outside of `refs/{tags,heads}/*`, All sound correct. > but these will be treated > +as branches for the purposes of whether `--force` is required, even in > +the case where a tag object is pushed. I am not sure what "will be treated as branches" exactly means. Does it mean "as if they were in refs/heads/* hierarchy?" Or something else? > That tag object will be > +overwritten by another tag object (or commit!) without `--force` if > +the new tag happens to point to a commit that's a fast-forward of the > +commit it replaces. Yup, and that is something we want to fix with a later part of this series. > +By having the optional leading `+` to a refspec (or using `--force` > +command line option) you can tell Git to update the ref even if > +it is not allowed by its respective namespace clobbering rules (e.g., > +it is not a fast-forward. in the case of `refs/heads/*` updates). This gives an impression that with "--force" you can put non-commit inside refs/heads/* hierarchy. Is that correct (if so we probably would want to fix that behaviour)? > +This > +does *not* attempt to merge into . See EXAMPLES below for > +details. That is not wrong per-se, but would normal people expect a merge to happen upon pushing on the other side, I wonder? Thanks for cleaning up our longstanding mess.