ISSUE #166 Update GetDiffStat functionality #171
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will close #166 by updating GetDiffStat functionality.
Specifically we update the GetDiffStat functionality so that now users
can add in a slice of strings named Fields in the DiffStatOptions.
Using this option users can exclude or only include certain parts
of the JSON response. For example if you don't want lines_added
or lines_removed from the values/DiffStat JSON response object
then you would assign
DiffStatOptions.Fields = []string{"-values.lines_removed", "-values.lines_added"}
and if you wanted just lines_added you would instead do
DiffStatOptions.Fields = []string{"values.lines_added"}
.Note, currently, given how the json decoding is although we remove the
specified fields from the JSON response, they get unmarshalled as zero
values for the corresponding DiffStatRes fields.
Also, a test was added, but we should probably improve it by testing
whether or not what we removed/selected is present accordingly.