-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add go wrapper around git diff-tree --raw -r -M #33369
base: main
Are you sure you want to change the base?
Conversation
McRaeAlex
commented
Jan 23, 2025
- Implemented calling git diff-tree
- Ensures wrapper function is called with valid arguments
- Parses output into go struct, using strong typing when possible
a1fb10e
to
bdfd379
Compare
Context for this PR: This was split out of a larger PR I hope to upstream to gitea for showing all files in a file tree at once rather than having a show more button at the bottom. Note that this wouldn't change the behaviour of the files list to the right of the file tree. (Lets have that discussion in the PR which modifies the frontend) |
* Implemented calling git diff-tree * Ensures wrapper function is called with valid arguments * Parses output into go struct, using strong typing when possible
bdfd379
to
da24f58
Compare
return nil, err | ||
} | ||
|
||
cmd := git.NewCommand(ctx, "diff-tree", "--raw", "-r", "--find-renames").AddDynamicArguments(baseCommitID, headCommitID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For pull request files changed page, it needs baseCommitID...headCommitID
. I think it's better to have another parameter to let outside functions decide it.
return baseCommit.ID.String(), headCommit.ID.String(), nil | ||
} | ||
|
||
func parseGitDiffTree(output string) ([]*DiffTreeRecord, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to use rd io.Reader
as the parameter?