You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
git.iter_commits() cannot specify both a branch and commits between two revisions("reva....revb") #1111
Did you try something like len(list(r.iter_commits('HEAD~20..HEAD')))? That worked as expected for me.
Maybe the documentation could be updated to explicitly mention that case if it works for you too - a PR would then be very welcome.
The refspec HEAD~20..HEAD means all commits between the 20th ancestor of the currently checked out one (HEAD~20), and the currently checked out one (HEAD). HEAD may as well be branch, meaning that branch1..branch2 will work similarly.
Now it would be interesting to find out what happens if branch1 is not an ancestor of branch2.
As this capability is documented, too, I don't see a need to keep this open any longer. If there is trouble with this nonetheless, please let me know in the comments.
Activity
Byron commentedon Jan 23, 2021
Did you try something like
len(list(r.iter_commits('HEAD~20..HEAD')))? That worked as expected for me.Maybe the documentation could be updated to explicitly mention that case if it works for you too - a PR would then be very welcome.
socratesgorilla commentedon Jan 26, 2021
It doesn't let you specify a branch, as far as I can tell.
Byron commentedon Jan 27, 2021
The refspec
HEAD~20..HEADmeans all commits between the 20th ancestor of the currently checked out one (HEAD~20), and the currently checked out one (HEAD).HEADmay as well bebranch, meaning thatbranch1..branch2will work similarly.Now it would be interesting to find out what happens if
branch1is not an ancestor ofbranch2.As this capability is documented, too, I don't see a need to keep this open any longer. If there is trouble with this nonetheless, please let me know in the comments.