File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -626,13 +626,13 @@ Repository_merge(Repository *self, PyObject *py_oid)
626626}
627627
628628PyDoc_STRVAR (Repository_walk__doc__ ,
629- "walk(oid, sort_mode) -> iterator\n"
629+ "walk(oid[ , sort_mode] ) -> iterator\n"
630630 "\n"
631631 "Generator that traverses the history starting from the given commit.\n"
632632 "The following types of sorting could be used to control traversing\n"
633633 "direction:\n"
634634 "\n"
635- "* GIT_SORT_NONE. This is the default sorting for new walkers\n"
635+ "* GIT_SORT_NONE. This is the default sorting for new walkers. \n"
636636 " Sort the repository contents in no particular ordering\n"
637637 "* GIT_SORT_TOPOLOGICAL. Sort the repository contents in topological order\n"
638638 " (parents before children); this sorting mode can be combined with\n"
@@ -656,13 +656,13 @@ PyObject *
656656Repository_walk (Repository * self , PyObject * args )
657657{
658658 PyObject * value ;
659- unsigned int sort ;
659+ unsigned int sort = GIT_SORT_NONE ;
660660 int err ;
661661 git_oid oid ;
662662 git_revwalk * walk ;
663663 Walker * py_walker ;
664664
665- if (!PyArg_ParseTuple (args , "OI " , & value , & sort ))
665+ if (!PyArg_ParseTuple (args , "O|I " , & value , & sort ))
666666 return NULL ;
667667
668668 err = git_revwalk_new (& walk , self -> repo );
Original file line number Diff line number Diff line change 3131from __future__ import unicode_literals
3232import unittest
3333
34- from pygit2 import GIT_SORT_TIME , GIT_SORT_REVERSE
34+ from pygit2 import GIT_SORT_NONE , GIT_SORT_TIME , GIT_SORT_REVERSE
3535from . import utils
3636
3737
@@ -107,5 +107,13 @@ def test_simplify_first_parent(self):
107107 walker .simplify_first_parent ()
108108 self .assertEqual (len (list (walker )), 3 )
109109
110+ def test_default_sorting (self ):
111+ walker = self .repo .walk (log [0 ], GIT_SORT_NONE )
112+ list1 = list ([x .id for x in walker ])
113+ walker = self .repo .walk (log [0 ])
114+ list2 = list ([x .id for x in walker ])
115+
116+ self .assertEqual (list1 , list2 )
117+
110118if __name__ == '__main__' :
111119 unittest .main ()
You can’t perform that action at this time.
0 commit comments