@@ -597,9 +597,6 @@ def test_get_changed_files_shallow_clone(git_repo, tmp_path, default_git_branch)
597597
598598
599599def test_get_changed_files_with_null_base_revision (repo ):
600- if repo .tool == "git" :
601- pytest .xfail ()
602-
603600 second_file = os .path .join (repo .path , "second_file" )
604601 with open (second_file , "w" ) as f :
605602 f .write ("second file content" )
@@ -614,3 +611,40 @@ def test_get_changed_files_with_null_base_revision(repo):
614611 )
615612
616613 assert isinstance (changed_files , list )
614+ # When base is NULL_REVISION, we should get all files from the beginning
615+ # of history up to head_rev. This includes both the initial "first_file"
616+ # and the newly added "second_file".
617+ assert "first_file" in changed_files
618+ assert "second_file" in changed_files
619+
620+
621+ def test_get_changed_files_with_null_base_revision_shallow_clone (
622+ git_repo , tmp_path , default_git_branch
623+ ):
624+ tmp_repo = Path (git_repo )
625+
626+ (tmp_repo / "file1.txt" ).write_text ("content 1" )
627+ (tmp_repo / "file2.txt" ).write_text ("content 2" )
628+ subprocess .check_call (["git" , "add" , "." ], cwd = tmp_repo )
629+ subprocess .check_call (["git" , "commit" , "-m" , "Add files" ], cwd = tmp_repo )
630+
631+ commit_hash = subprocess .check_output (
632+ ["git" , "rev-parse" , "HEAD" ], cwd = tmp_repo , text = True
633+ ).strip ()
634+
635+ shallow_path = tmp_path / "shallow_null_test"
636+ subprocess .check_call (
637+ ["git" , "clone" , "--depth=1" , f"file://{ tmp_repo } " , str (shallow_path )],
638+ cwd = tmp_path ,
639+ )
640+
641+ shallow_repo = get_repository (str (shallow_path ))
642+ assert shallow_repo .is_shallow
643+
644+ changed_files = shallow_repo .get_changed_files (
645+ "AMD" , "all" , rev = commit_hash , base = Repository .NULL_REVISION
646+ )
647+
648+ assert "first_file" in changed_files
649+ assert "file1.txt" in changed_files
650+ assert "file2.txt" in changed_files
0 commit comments