mirror of
https://github.com/splitsh/lite.git
synced 2024-05-17 21:56:37 +02:00
Move head check for a more aggressive use of cache
This commit is contained in:
parent
cf9970e7ff
commit
ca1a6cef48
|
@ -522,12 +522,18 @@ func (s *state) legacyMessage(rev *git.Commit) string {
|
|||
|
||||
// pushRevs sets the range to split
|
||||
func (s *state) pushRevs(revWalk *git.RevWalk) error {
|
||||
// this is needed as origin might be in the process of being updated by git.FetchOrigin()
|
||||
s.repoMu.Lock()
|
||||
defer s.repoMu.Unlock()
|
||||
|
||||
// find the latest split sha1 if any on origin
|
||||
var start *git.Oid
|
||||
start = s.cache.getHead()
|
||||
if start != nil {
|
||||
s.result.moveHead(s.cache.get(start))
|
||||
// FIXME: CHECK that this is an ancestor of the branch?
|
||||
return revWalk.PushRange(fmt.Sprintf("%s..%s", start, s.originBranch))
|
||||
}
|
||||
|
||||
// find the latest split sha1 if any on origin
|
||||
var err error
|
||||
if s.config.Commit != "" {
|
||||
start, err = git.NewOid(s.config.Commit)
|
||||
|
@ -538,13 +544,6 @@ func (s *state) pushRevs(revWalk *git.RevWalk) error {
|
|||
return revWalk.PushRange(fmt.Sprintf("%s^..%s", start, s.originBranch))
|
||||
}
|
||||
|
||||
start = s.cache.getHead()
|
||||
if start != nil {
|
||||
s.result.moveHead(s.cache.get(start))
|
||||
// FIXME: CHECK that this is an ancestor of the branch?
|
||||
return revWalk.PushRange(fmt.Sprintf("%s..%s", start, s.originBranch))
|
||||
}
|
||||
|
||||
branch, err := s.repo.RevparseSingle(s.originBranch)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue