Skip to content

Commit

Permalink
do not log a bunch of `Failed to get the last modified timestamp from…
Browse files Browse the repository at this point in the history
… Git for the file` messages if init git repository failed (#4018)
  • Loading branch information
dimaMachina authored Jan 23, 2025
1 parent 695e428 commit b2f2458
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-fishes-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextra": patch
---

do not log a bunch of `Failed to get the last modified timestamp from Git for the file` messages if init git repository failed
7 changes: 4 additions & 3 deletions packages/nextra/src/server/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ ${locales
async function getLastCommitTime(
filePath: string
): Promise<number | undefined> {
if (!repository) {
// Skip since we already logged logger.warn('Init git repository failed')
return
}
const relativePath = path.relative(GIT_ROOT, filePath)
try {
if (!repository) {
throw new Error('Init git repository failed')
}
return await repository.getFileLatestModifiedDateAsync(relativePath)
} catch {
logger.warn(
Expand Down

0 comments on commit b2f2458

Please sign in to comment.