@@ -57,14 +57,14 @@ def test_cloned_repo_object(self, local_dir):
57
57
58
58
# [5-test_cloned_repo_object]
59
59
file = 'dir1/file2.txt' # relative path from git root
60
- repo .iter_commits ('-- all' , max_count = 100 , paths = file )
60
+ repo .iter_commits (all = True , max_count = 10 , paths = file ) # gets the last 10 commits from all branches
61
61
62
62
# Outputs: <generator object Commit._iter_from_process_or_stream at 0x7fb66c186cf0>
63
63
64
64
# ![5-test_cloned_repo_object]
65
65
66
66
# [6-test_cloned_repo_object]
67
- commits_for_file_generator = repo .iter_commits ('-- all' , max_count = 100 , paths = file )
67
+ commits_for_file_generator = repo .iter_commits (all = True , max_count = 10 , paths = file )
68
68
commits_for_file = [c for c in commits_for_file_generator ]
69
69
commits_for_file
70
70
@@ -95,7 +95,8 @@ def test_cloned_repo_object(self, local_dir):
95
95
# ![9-test_cloned_repo_object]
96
96
97
97
# [10-test_cloned_repo_object]
98
- repo .index .diff (None )
98
+ repo .index .diff (None ) # compares staging area to working directory
99
+ repo .index .diff (repo .head .commit ) # compares staging area to last commit
99
100
# Output: [<git.diff.Diff object at 0x7fb66c076e50>,
100
101
# <git.diff.Diff object at 0x7fb66c076ca0>]
101
102
# ![10-test_cloned_repo_object]
@@ -118,7 +119,7 @@ def test_cloned_repo_object(self, local_dir):
118
119
119
120
# Previous commit tree
120
121
# [13-test_cloned_repo_object]
121
- prev_commits = [c for c in repo .iter_commits ('-- all' , max_count = 10 )]
122
+ prev_commits = [c for c in repo .iter_commits (all = True , max_count = 10 )] # last 10 commits from all branches
122
123
tree = prev_commits [0 ].tree
123
124
# ![13-test_cloned_repo_object]
124
125
0 commit comments