git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* Possible bug: --shallow-since and old branches
@ 2020-09-08 19:58 Tao Klerks
  0 siblings, 0 replies; only message in thread
From: Tao Klerks @ 2020-09-08 19:58 UTC (permalink / raw)
  To: git

Hi folks,

I've encountered very strange behavior when fetching a repo with
--shallow-since, where I get many more commits than I expect in the
repo, and specifically when I count commits by branch I see old
branches where *every* commit is beyond the specified date threshold.

I found a thread from 2018 in which something like this is discussed
(https://public-inbox.org/git/20180522194854.GA29564@inner.h.apk.li/),
but I haven't completely understood the thread. It seems to address
the specific "repo would be empty" concern, but not necessarily the
more general "I'm getting branches I shouldn't be getting"
concern/case...?

I can confirm that if I move my --shallow-since date to one that
"intersects" the lifetime of a branch I am unexpectedly getting, then
all of a sudden I only get those commits I expected on that branch.

I can also confirm that in a recent version of git (since 2.16 I
think), if I set my refspec so *only* a "too old" branch matches, then
I get the "fatal: no commits selected for shallow requests" error
that's expected. But if my refspec *also* matches a branch that *does*
have commits newer than the threshold, then I get the correct (newer)
commits of that recently-active branch, and *all* commits of the
too-old branch that otherwise correctly refuses to fetch on its own.

I *thought* I would be able get what I would have expected from a
"--shallow-since" clone by:
 * Initializing a new repo
 * Adding the remote
 * Removing the default fetch refspec
 * Iterating remote heads, checking their commit dates, and adding
those valid/recent heads explicitly to the fetch refspec
 * Doing a fetch with  "--shallow-since"

... however, I seem to have assumed some magic there: getting the
"most recent commit date" for a remote ref apparently requires
fetching it (to a depth of 1 at least) first??

Is the behavior I'm seeing "as designed" for branches with no recent
commits, or is there a problem somewhere?

Best regards,
Tao

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-08 19:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 19:58 Possible bug: --shallow-since and old branches Tao Klerks

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git