|
|
@ -147,13 +147,21 @@ func (s *server) updateBase() error {
|
|
|
|
return runGitCommand(s.matrixDocCloneURL, []string{"fetch"})
|
|
|
|
return runGitCommand(s.matrixDocCloneURL, []string{"fetch"})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *server) knowsAbout(sha string) bool {
|
|
|
|
|
|
|
|
s.mu.Lock()
|
|
|
|
|
|
|
|
defer s.mu.Unlock()
|
|
|
|
|
|
|
|
return runGitCommand(s.matrixDocCloneURL, []string{"cat-file", "-e", sha + "^{commit}"}) == nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// generateAt generates spec from repo at sha.
|
|
|
|
// generateAt generates spec from repo at sha.
|
|
|
|
// Returns the path where the generation was done.
|
|
|
|
// Returns the path where the generation was done.
|
|
|
|
func (s *server) generateAt(sha string) (dst string, err error) {
|
|
|
|
func (s *server) generateAt(sha string) (dst string, err error) {
|
|
|
|
|
|
|
|
if !s.knowsAbout(sha) {
|
|
|
|
err = s.updateBase()
|
|
|
|
err = s.updateBase()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
s.mu.Lock()
|
|
|
|
s.mu.Lock()
|
|
|
|
dst, err = gitClone(s.matrixDocCloneURL, true)
|
|
|
|
dst, err = gitClone(s.matrixDocCloneURL, true)
|
|
|
|
s.mu.Unlock()
|
|
|
|
s.mu.Unlock()
|
|
|
|