Re: [RFC] single-level refs vs push --all/--mirror

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Robin H. Johnson" <robbat2@xxxxxxxxxx> writes:

> I didn't see response from Jeff King, so I'm wondering good next steps
> here.
>
> I'm esp. surprised that git-stash ends up using single-level refs when
> git-check-ref-format(1) says they aren't valid.

They aren't valid name to be used as regular branches, tags, etc.,
but as an implementation detail of stash, "refs/stash" is perfectly
good.  There is nothing to "fix".  You cannot and you do not want to
pretend "stash" is yet another ref in the first place.

You can "transfer" refs/stash by pushing the commit to an arbitrary
ref with a regular "three level" name, like so:

   $ git push there refs/stash:refs/my/stash

but it wouldn't be of much use to begin with.

The thing is, the "list of random quick changes stashed away" is not
something stored in the "stash" ref.  These list entries are stored
as reflog entries for the stash ref, which is *never* transferred
over the network.  So, if the higher level issue you want to address
is to allow "stash" to be shared across repositories, none of these
5 choices you listed at the end of your message helps all that much.

The single-level refs are the least of your problems.

Instead, you'd probably want to reimplement "stash" as a set of
normal refs, whose current value only matters, e.g. refs/stash/0
may be the oldest stash, refs/stash/1 is the next one, refs/stash/2
is yet another new one, etc., and have UIs like "git stash list" 
list them in a new way that is different from the current reflog
based implementation, and "git stash pop/apply" take them, e.g.

   $ git stash list
   stash/0: WIP on main: cd3e606211 Git 2.34
   stash/4: WIP on maint: Merge branch 'vd/pthread-setspecific-g11-fix' into maint
   $ git stash apply stash/0

And at that point you'd have refs/stash/* as an intermediate
hierarchy, with another level of real refs hanging there, so you can
transfer them just like refs/tags/* all you want.

> I think Git should change git-stash and start issuing warnings to users
> for single-level refs.

No, single-level refs is perfectly fine, as long as you are using
the current Git and using these refs locally.  The problem arises
only when you start wanting to share stash across repositories, and
it is not from the levels of the refname hierarchy but from the fact
that stash is implemented in terms of reflog mechanism that is not
shared across repositories.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux