Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1da7444

Browse files
committed
test_remote: fixed test which assumed existance of local master tracking branch, it will now create it if necessary
1 parent d2ff582 commit 1da7444

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/git/test_remote.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,13 @@ def _test_push_and_pull(self,remote, rw_repo, remote_repo):
240240
lhead = rw_repo.head
241241
lindex = rw_repo.index
242242
# assure we are on master and it is checked out where the remote is
243-
lhead.reference = rw_repo.heads.master
243+
try:
244+
lhead.reference = rw_repo.heads.master
245+
except AttributeError:
246+
# if the author is on a non-master branch, the clones might not have
247+
# a local master yet. We simply create it
248+
lhead.reference = rw_repo.create_head('master')
249+
# END master handling
244250
lhead.reset(remote.refs.master, working_tree=True)
245251

246252
# push without spec should fail ( without further configuration )

0 commit comments

Comments
 (0)