diff --git a/knotserver/git/git.go b/knotserver/git/git.go index a66d370b..45568d57 100644 --- a/knotserver/git/git.go +++ b/knotserver/git/git.go @@ -308,7 +308,7 @@ func (g *GitRepo) LastCommitForPath(path string) (*types.LastCommitInfo, error) } cacheMu.RUnlock() - cmd := exec.Command("git", "-C", g.path, "log", "-1", "--format=%H %ct", "--", path) + cmd := exec.Command("git", "-C", g.path, "log", g.h.String(), "-1", "--format=%H %ct", "--", path) var out bytes.Buffer cmd.Stdout = &out diff --git a/knotserver/git/tree.go b/knotserver/git/tree.go index 1c7f8c49..4ad99745 100644 --- a/knotserver/git/tree.go +++ b/knotserver/git/tree.go @@ -2,6 +2,7 @@ package git import ( "fmt" + "time" "github.com/go-git/go-git/v5/plumbing/object" "tangled.sh/tangled.sh/core/types" @@ -56,7 +57,13 @@ func (g *GitRepo) makeNiceTree(t *object.Tree, parent string) []types.NiceTree { lastCommit, err := g.LastCommitForPath(fpath) if err != nil { fmt.Println("error getting last commit time:", err) - continue + // We don't want to skip the file, so worst case lets just + // populate it with "defaults". + lastCommit = &types.LastCommitInfo{ + Hash: g.h, + Message: "", + When: time.Now(), + } } nts = append(nts, types.NiceTree{