Implement --shortstat option for git_log function
Implement option to show additions and deletions in commit as we can perform with
git log --shortstat
So with gert it can be done with something like
gert::git_log(repo = ".", shortstat = TRUE)
Maybe you can create something yourself from looking up the diff/patch for each commit
df <- gert::git_log(max=10)
df$shortstat <- lapply(df$commit, function(id){
patch <- gert::git_diff_patch(id)
# do something with stats
})
Yes, it is working walkaround for problem, but is there libgit2 limitations? This walkaround recipe needs further parsing for diff output. Or is it package architecture decision?
We could probably do it using libgit2, but it adds more overhead. What do you need this for?
I have added a new function git_commit_stats for you: https://github.com/r-lib/gert/commit/d4b28083f07eecebda3a395a4c582c93d5caa663. You can install the new version from https://ropensci.r-universe.dev/gert
So you can do e.g.:
library(gert)
logs <- git_log(max=10)
stats <- lapply(logs$commit, git_commit_stats)
Thanks a lot!!! I am trying to analyze commits, who are just fixing typos in comments and who are writing code but maybe without any comments etc...
One more question -- is it possible to get all commits from all branches like git log --all with gert::git_log() function?
One more question -- is it possible to get all commits from all branches like git log --all with gert::git_log() function?
No not yet, we just recursively walk to the parent commits right now, without considering branches. It's been on the todo list to implement something better but I haven't gotten to it.