commands: verify locks on all pushed refs
This commit is contained in:
parent
645998d262
commit
9064b637c2
@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/git-lfs/git-lfs/lfsapi"
|
"github.com/git-lfs/git-lfs/lfsapi"
|
||||||
"github.com/git-lfs/git-lfs/locking"
|
"github.com/git-lfs/git-lfs/locking"
|
||||||
"github.com/git-lfs/git-lfs/tq"
|
"github.com/git-lfs/git-lfs/tq"
|
||||||
"github.com/rubyist/tracerx"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type verifyState byte
|
type verifyState byte
|
||||||
@ -23,12 +22,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func verifyLocksForUpdates(lv *lockVerifier, updates []*refUpdate) {
|
func verifyLocksForUpdates(lv *lockVerifier, updates []*refUpdate) {
|
||||||
lv.Verify(cfg.RemoteRefName())
|
for _, update := range updates {
|
||||||
/*
|
lv.Verify(update.Right().Name)
|
||||||
for _, update := range updates {
|
}
|
||||||
lv.Verify(update.Right().Name)
|
|
||||||
}
|
|
||||||
// */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// lockVerifier verifies locked files before updating one or more refs.
|
// lockVerifier verifies locked files before updating one or more refs.
|
||||||
@ -53,7 +49,6 @@ func (lv *lockVerifier) Verify(ref string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tracerx.Printf("LOCK VERIFY %q", ref)
|
|
||||||
lockClient := newLockClient()
|
lockClient := newLockClient()
|
||||||
ours, theirs, err := lockClient.VerifiableLocks(ref, 0)
|
ours, theirs, err := lockClient.VerifiableLocks(ref, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -166,35 +166,6 @@ func (c *Configuration) CurrentRef() *git.Ref {
|
|||||||
return c.ref
|
return c.ref
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) RemoteRef() *git.Ref {
|
|
||||||
r := c.CurrentRef()
|
|
||||||
|
|
||||||
c.loading.Lock()
|
|
||||||
defer c.loading.Unlock()
|
|
||||||
|
|
||||||
if c.remoteRef != nil {
|
|
||||||
return c.remoteRef
|
|
||||||
}
|
|
||||||
|
|
||||||
if r != nil {
|
|
||||||
merge, _ := c.Git.Get(fmt.Sprintf("branch.%s.merge", r.Name))
|
|
||||||
if len(merge) > 0 {
|
|
||||||
c.remoteRef = git.ParseRef(merge, "")
|
|
||||||
} else {
|
|
||||||
c.remoteRef = r
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.remoteRef
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Configuration) RemoteRefName() string {
|
|
||||||
if r := c.RemoteRef(); r != nil {
|
|
||||||
return r.Name
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Configuration) IsDefaultRemote() bool {
|
func (c *Configuration) IsDefaultRemote() bool {
|
||||||
return c.Remote() == defaultRemote
|
return c.Remote() == defaultRemote
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user