Files
zeekay 83a37a3684 the IOM entity does not appear on a public surface
Lux Partners Limited is the Isle of Man company. Lux Industries Inc, a
Delaware C corporation, is the company these sites belong to, so it is the
one they name — in metadata, copyright, and the press items that record who
signed. The fund site names Lux Assets Management LLC, which is its own
company.

Two sentences were rewritten rather than renamed, because a name was doing
work a name cannot do. One claimed an Isle of Man domicile the naming entity
does not have. The other said a company acts on behalf of another; with one
entity left it said a company acts on behalf of itself.

The Isle of Man stays everywhere it is a JURISDICTION the product supports —
the regulatory package, the jurisdiction guides, the compliance tables. Only
this company's own identity changed.
2026-08-28 13:16:04 -07:00

96 lines
2.1 KiB
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package git
import (
"io"
"os"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/transport/http"
)
type Factory interface {
GetRepository(url string, path string, reference plumbing.ReferenceName, auth *http.BasicAuth) (string, error)
GetLastModified(repoPath string, filePath string) (string, error)
}
type RepositoryFactory struct{}
func (f RepositoryFactory) GetRepository(url string, path string, reference plumbing.ReferenceName, auth *http.BasicAuth) (string, error) {
var repo *git.Repository
switch _, err := os.Stat(path); err {
case nil:
// already exists, so we need to check out the latest changes
repo, err = git.PlainOpen(path)
if err != nil {
return "", err
}
worktree, err := repo.Worktree()
if err != nil {
return "", err
}
if err := worktree.Pull(
// TODO use fetch + checkout instead of pull
&git.PullOptions{
RemoteName: "origin",
ReferenceName: reference,
SingleBranch: true,
Auth: auth,
Progress: io.Discard,
},
); err != nil && err != git.NoErrAlreadyUpToDate {
return "", err
}
default:
if os.IsNotExist(err) {
// if we don't have the repo, we need to clone it
repo, err = git.PlainClone(path, false, &git.CloneOptions{
URL: url,
ReferenceName: reference,
SingleBranch: true,
Auth: auth,
Progress: io.Discard,
})
if err != nil {
return "", err
}
} else {
return "", err
}
}
head, err := repo.Head()
if err != nil {
return "", err
}
return head.Hash().String(), nil
}
func (f RepositoryFactory) GetLastModified(repoAbsolutePath string, fileRelativePath string) (string, error) {
repo, err := git.PlainOpen(repoAbsolutePath)
if err != nil {
return "", err
}
itr, err := repo.Log(&git.LogOptions{
PathFilter: func(s string) bool {
return s == fileRelativePath
},
})
if err != nil {
return "", err
}
commit, err := itr.Next()
if err != nil {
return "", err
}
return commit.Hash.String(), nil
}