Open lorenzwalthert opened 4 years ago
That's a good idea. Right now we only show the main branch log, indeed, and not the merged branches.
Yes. I think think by default the command should show what its cli equivalent shows. Because this is unexpected for me and I am not sure I understand the rationale behind it.
Will look into this for the next version, but if you need a quick solution right now, below an example how to lookup the commits from a merged branch:
git_merged_branch_log <- function(commit){
parents <- git_commit_info(commit)$parents
if(length(parents) == 1)
return(NULL)
start_at <- git_merge_find_base(parents[1], parents[2])
sublog <- git_log(parents[2])
len <- which(sublog$commit == start_at)
utils::head(sublog, len-1)
}
# Show merge branches for 10 latest commits
main <- git_log()
lapply(main$commit[1:10], git_merged_branch_log)
Thanks @jeroen. What I am after finally is the equivalent of $ git log
, but I just need the hashes, so I already resolved this with system2('git', c('rev-list', 'HEAD'), stdout = TRUE)
. I know that's probably not the nice way but until the next release, I'll use this. Thanks again.
It seems only merge commits and commits made directly to the branch are shown in version 1.0.1 - those merged into the current branch via a merge are omitted. Here is the log of https://github.com/r-lib/styler via the git RStudio panel and
gert::git_log()
. Is there a way to also show these commits?