Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3621c06

Browse files
committed
Add tests for .git-file.
1 parent5991698 commit3621c06

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

‎git/test/fixtures/git_file

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gitdir: ./.real

‎git/test/test_repo.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,23 @@ def test_repo_odbtype(self):
594594
target_type=GitCmdObjectDB
595595
assertisinstance(self.rorepo.odb,target_type)
596596

597+
@with_rw_repo('HEAD')
598+
deftest_git_file(self,rwrepo):
599+
# Move the .git directory to another location and create the .git file.
600+
real_path_abs=os.path.abspath(join_path_native(rwrepo.working_tree_dir,'.real'))
601+
os.rename(rwrepo.git_dir,real_path_abs)
602+
git_file_path=join_path_native(rwrepo.working_tree_dir,'.git')
603+
open(git_file_path,'wb').write(fixture('git_file'))
604+
605+
# Create a repo and make sure it's pointing to the relocated .git directory.
606+
git_file_repo=Repo(rwrepo.working_tree_dir)
607+
assertos.path.abspath(git_file_repo.git_dir)==real_path_abs
608+
609+
# Test using an absolute gitdir path in the .git file.
610+
open(git_file_path,'wb').write('gitdir: %s\n'%real_path_abs)
611+
git_file_repo=Repo(rwrepo.working_tree_dir)
612+
assertos.path.abspath(git_file_repo.git_dir)==real_path_abs
613+
597614
deftest_submodules(self):
598615
assertlen(self.rorepo.submodules)==1# non-recursive
599616
assertlen(list(self.rorepo.iter_submodules()))>=2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp