Add function to get commit diff/patch #589
Labels
No Label
has/backport
has/pull
in progress
invalid
kind/breaking
kind/bug
kind/build
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/refactor
kind/security
kind/testing
kind/translation
kind/ui
need/backport
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/go-sdk#589
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Gusted/go-sdk:add-commit-diff-patch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I wonder if two funcs would make sense.
One for diff, one for patch?
Functions aren't that big, so should be alright.
I think it should be one func
similar to:
https://gitea.com/gitea/go-sdk/src/branch/master/gitea/pull.go#L275-L283
you can also reuse the const's and make the type public ...
We'd just moved away from using a generic function. I think making the function names more explicit is a good API design.
I think the difference is that the "generic" func is non-exported in the PR case.
I'm not against that approach, mostly I think the exported funcs being explicitly named is the design choice.
Whether those exported funcs call a generic non-exported func or not is 50/50 for me since there's only a handful of lines.
I remain approving of this PR, but would also approve a non-exported generic func that the other two invoke.
@ -116,0 +124,4 @@
return nil, nil, err
}
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/git/commits/%s.diff", user, repo, commitID), nil, nil)
@ -116,0 +137,4 @@
return nil, nil, err
}
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/git/commits/%s.patch", user, repo, commitID), nil, nil)
☝️ with this if there will be some refactor any time, code lookup will work
Could you eloborate on this? Why should we use a argument for a constant string?