Subject: Re: [PATCH v3 1/4] Documentation/git-bundle.txt: mention full backup example

From: Junio C Hamano <[email-masked]>
Date: Wed, 13 Nov 2024 07:58:03 +0900

"Kristoffer Haugsbakk" <[email-masked]> writes:

> Maybe it’s possible but I kind of want to say “okay just pop your
> stashes and make regular commits/branches”.

That requires _more_ than recording the value of the ref for stash,
as data for the Nth stash is recorded as the Nth reflog entry for
that ref, and the reflog data is not what fetch/push/clone/bundle
commands make available.

> I’m not sure how to formulate that.  Seems clumsy:
>
>      refs are included in the bundle (also `refs/stash` but that
>      particular one won't be included in e.g. a clone):
>
> Would it be too drastic to use a footnote?

I am not sure what you want to refer to with "that particular one",
but the value of refs/stash does get recorded, and making a mirror
clone out of the resulting bundle does give refs/stash with the
value of the refs/stash in the original repository where the bundle
was taken from.  So refs/stash _does_ get included.  What is not
included is the reflog data for that ref (or any other ref, for that
matter).

Because the ref value is transferred via fetch/push/clone/bundle but
the reflog (i.e. past values of a ref) data is *not*, "git stash
show stash@{4}" is not something you can recreate in the copy of a
repository, whether you create the copy with "clone" or "bundle +
clone".  The story is the same for other refs, and stash is not that
special in this regard.  "git show master@{yesterday}" in a freshly
created copy would give something entirely different from what you
would get in the original repository you mirror-cloned or took a
bundle from.

You'd need "cp -r" for that.