diff --git a/main.go b/main.go index 66ce44f..f0c3965 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,10 @@ func commit( commitmu.Lock() defer commitmu.Unlock() + if _, err := tree.Add(padfile); err != nil { + return plumbing.ZeroHash, fmt.Errorf("Failed to stage %s: %w", padfile, err) + } + commit, err := tree.Commit( fmt.Sprintf("Updated %s from %s", padfile, url), &git.CommitOptions{ @@ -85,10 +89,6 @@ func update( return plumbing.ZeroHash, fmt.Errorf("No changes recorded for %s", url) } - if _, err = tree.Add(padfile); err != nil { - return plumbing.ZeroHash, fmt.Errorf("Failed to stage %s: %w", padfile, err) - } - return commit(tree, padfile, url) }