Skip to content

Commit

Permalink
Rework git log parsing and truncating (thomiceli#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomiceli committed Apr 26, 2024
1 parent 6a8759e commit 785d89d
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 91 deletions.
4 changes: 3 additions & 1 deletion internal/git/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var (
)

const truncateLimit = 2 << 18
const diffSize = 2 << 12
const maxFilesPerDiffCommit = 10

type RevisionNotFoundError struct{}

Expand Down Expand Up @@ -313,7 +315,7 @@ func GetLog(user string, gist string, skip int) ([]*Commit, error) {
}
}(cmd)

return parseLog(stdout, truncateLimit), err
return parseLog(stdout, maxFilesPerDiffCommit, diffSize)
}

func CloneTmp(user string, gist string, gistTmpId string, email string, remove bool) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/git/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ like Opengist actually`,

require.Contains(t, commits[0].Files, File{
Filename: "my_other_file.txt",
OldFilename: "",
OldFilename: "my_other_file.txt",
Content: `@@ -1,2 +1,2 @@
I really
-hate Opengist
Expand Down
Loading

0 comments on commit 785d89d

Please sign in to comment.