@@ -46,7 +46,7 @@ def test_cloned_repo_object(self, local_dir):
4646 # ![2-test_cloned_repo_object]
4747
4848 # [3-test_cloned_repo_object]
49- add_file = [f" { update_file } " ] # relative path from git root
49+ add_file = [update_file ] # relative path from git root
5050 repo .index .add (add_file ) # notice the add function requires a list of paths
5151 # ![3-test_cloned_repo_object]
5252
@@ -56,15 +56,15 @@ def test_cloned_repo_object(self, local_dir):
5656 # ![4-test_cloned_repo_object]
5757
5858 # [5-test_cloned_repo_object]
59- file = 'dir1/file2.txt' # relative path from git root
60- repo .iter_commits (all = True , max_count = 10 , paths = file ) # gets the last 10 commits from all branches
59+ # relative path from git root
60+ repo .iter_commits (all = True , max_count = 10 , paths = update_file ) # gets the last 10 commits from all branches
6161
6262 # Outputs: <generator object Commit._iter_from_process_or_stream at 0x7fb66c186cf0>
6363
6464 # ![5-test_cloned_repo_object]
6565
6666 # [6-test_cloned_repo_object]
67- commits_for_file_generator = repo .iter_commits (all = True , max_count = 10 , paths = file )
67+ commits_for_file_generator = repo .iter_commits (all = True , max_count = 10 , paths = update_file )
6868 commits_for_file = [c for c in commits_for_file_generator ]
6969 commits_for_file
7070
@@ -76,8 +76,7 @@ def test_cloned_repo_object(self, local_dir):
7676 # [7-test_cloned_repo_object]
7777 # We'll create a file5.txt
7878
79- file5 = f'{ local_dir } /file5.txt'
80- with open (file5 , 'w' ) as f :
79+ with open (f'{ local_dir } /file5.txt' , 'w' ) as f :
8180 f .write ('file5 version 1' )
8281 # ![7-test_cloned_repo_object]
8382
@@ -89,8 +88,8 @@ def test_cloned_repo_object(self, local_dir):
8988 # Modified files
9089 # [9-test_cloned_repo_object]
9190 # Lets modify one of our tracked files
92- file3 = f' { local_dir } /Downloads/file3.txt'
93- with open (file3 , 'w' ) as f :
91+
92+ with open (f' { local_dir } /Downloads/ file3.txt' , 'w' ) as f :
9493 f .write ('file3 version 2' ) # overwrite file 3
9594 # ![9-test_cloned_repo_object]
9695
0 commit comments