Debian Codegraph @

lfs/gitscanner_remotes.go

raw symbols SCIP
1 package lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/
2
3 import (
4 "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/"
5 "github.com/git-lfs/git-lfs/v3/toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/"
6 )
7
8 // calcSkippedRefs checks that locally cached versions of remote refs are still
9 // present on the remote before they are used as a 'from' point. If the server
10 // implements garbage collection and a remote branch had been deleted since we
11 // last did 'git fetch --prune', then the objects in that branch may have also
12 // been deleted on the server if unreferenced. If some refs are missing on the
13 // remote, use a more explicit diff command.
14 func calcSkippedRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/calcSkippedRefs().(remote string) []string {
15 cachedRemoteRefs, _ := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.CachedRemoteRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CachedRemoteRefs().(remote)
16
17 // Since CachedRemoteRefs() only returns branches, request that
18 // RemoteRefs() ignore tags and also return only branches.
19 actualRemoteRefs, _ := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.RemoteRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteRefs().(remote, false)
20
21 // The list of remote refs can be very large, so convert them to
22 // a set for faster lookups in the skip calculation loop.
23 actualRemoteRefsSet := toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.NewStringSetscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/NewStringSet().()
24 for _, ref := range actualRemoteRefs {
25 actualRemoteRefsSet.Addscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/StringSet#Add().(ref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.)
26 }
27
28 // Only check for missing refs on remote; if the ref is different it has moved
29 // forward probably, and if not and the ref has changed to a non-descendant
30 // (force push) then that will cause a re-evaluation in a subsequent command.
31 var skippedRefs []string
32 for _, cachedRef := range cachedRemoteRefs {
33 if actualRemoteRefsSet.Containsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/StringSet#Contains().(cachedRef.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.) {
34 skippedRefs = append(skippedRefs, "^"+cachedRef.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.)
35 }
36 }
37 return skippedRefs
38 }