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

Commit791765c

Browse files
committed
Removed repo tests which for some reason left the 'repos' directory around, replaced them by a real test which actually executes code, and puts everything into the tmp directory
1 parent160081b commit791765c

File tree

2 files changed

+19
-41
lines changed

2 files changed

+19
-41
lines changed

‎lib/git/repo.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,12 @@ def clone(self, path, **kwargs):
669669
path=prev_path
670670
# END reset previous working dir
671671
# END bad windows handling
672-
returnRepo(path,odbt=odbt)
672+
673+
# our git command could have a different working dir than our actual
674+
# environment, hence we prepend its working dir if required
675+
ifnotos.path.isabs(path)andself.git.working_dir:
676+
path=os.path.join(self.git._working_dir,path)
677+
returnRepo(os.path.abspath(path),odbt=odbt)
673678

674679

675680
defarchive(self,ostream,treeish=None,prefix=None,**kwargs):

‎test/git/test_repo.py‎

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,20 @@ def test_init(self):
131131
assertos.path.isdir(r.git_dir)
132132

133133
self._test_empty_repo(r)
134+
135+
# test clone
136+
clone_path=path+"_clone"
137+
rc=r.clone(clone_path)
138+
self._test_empty_repo(rc)
139+
134140
shutil.rmtree(git_dir_abs)
141+
try:
142+
shutil.rmtree(clone_path)
143+
exceptOSError:
144+
# when relative paths are used, the clone may actually be inside
145+
# of the parent directory
146+
pass
147+
# END exception handling
135148
# END for each path
136149

137150
os.makedirs(git_dir_rela)
@@ -151,46 +164,6 @@ def test_init(self):
151164
deftest_bare_property(self):
152165
self.rorepo.bare
153166

154-
@patch_object(Repo,'__init__')
155-
@patch_object(Git,'_call_process')
156-
deftest_init_with_options(self,git,repo):
157-
git.return_value=True
158-
repo.return_value=None
159-
160-
r=Repo.init("repos/foo/bar.git",**{'bare' :True,'template':"/baz/sweet"})
161-
assertisinstance(r,Repo)
162-
163-
assert_true(git.called)
164-
assert_true(repo.called)
165-
166-
@patch_object(Repo,'__init__')
167-
@patch_object(Git,'_call_process')
168-
deftest_clone(self,git,repo):
169-
git.return_value=None
170-
repo.return_value=None
171-
172-
self.rorepo.clone("repos/foo/bar.git")
173-
174-
assert_true(git.called)
175-
path=os.path.join(absolute_project_path(),'.git')
176-
assert_equal(git.call_args, (('clone',path,'repos/foo/bar.git'), {}))
177-
assert_true(repo.called)
178-
179-
@patch_object(Repo,'__init__')
180-
@patch_object(Git,'_call_process')
181-
deftest_clone_with_options(self,git,repo):
182-
git.return_value=None
183-
repo.return_value=None
184-
185-
self.rorepo.clone("repos/foo/bar.git",**{'template':'/awesome'})
186-
187-
assert_true(git.called)
188-
path=os.path.join(absolute_project_path(),'.git')
189-
assert_equal(git.call_args, (('clone',path,'repos/foo/bar.git'),
190-
{'template':'/awesome'}))
191-
assert_true(repo.called)
192-
193-
194167
deftest_daemon_export(self):
195168
orig_val=self.rorepo.daemon_export
196169
self.rorepo.daemon_export=notorig_val

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp