Skip to content

Commit 7d457c8

Browse files
Merge pull request #114 from redkyn/bug/clone-branch
BUG: git clone does not like being passed a list of branches
2 parents fa72930 + c88661d commit 7d457c8

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Devel
22

3+
- Fixed `get` failing to clone new repos with error `Remote branch ['master'] not found in upstream origin`
4+
35
## 1.1.0
46

57
- Warn when an assignment is already open for a student when running `open`

assigner/baserepo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,11 @@ def pull(self, branch):
190190

191191
self.repo.remote().pull(branch)
192192

193-
def clone_to(self, dir_name, branch=None):
193+
def clone_to(self, dir_name, branch):
194194
logging.debug("Cloning %s...", self.ssh_url)
195195
try:
196196
if branch:
197-
self._repo = git.Repo.clone_from(self.ssh_url, dir_name,
198-
branch=branch)
197+
self._repo = git.Repo.clone_from(self.ssh_url, dir_name)
199198
for b in branch:
200199
self._repo.create_head(b, "origin/{}".format(b))
201200

assigner/commands/get.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ def get(conf, args):
100100
username, b)
101101
logging.warning(" (use --force to overwrite)")
102102

103-
# Check out first branch specified; this is probably what people expect
104-
# If there's just one branch, it's already checked out by the loop above
105-
if len(branch) > 1:
106-
repo.get_head(branch[0]).checkout()
107-
108103
except NoSuchPathError:
109104
logging.debug("Local repo does not exist; cloning...")
110105
repo.clone_to(repo_dir, branch)
111106
output.add_row([row, sec, sid, name, "Cloned a new copy"])
112107

108+
# Check out first branch specified; this is probably what people expect
109+
# If there's just one branch, it's already checked out by the loop above
110+
if len(branch) > 1:
111+
repo.get_head(branch[0]).checkout()
112+
113113
except RepoError as e:
114114
logging.warning(e)
115115
except HTTPError as e:

0 commit comments

Comments
 (0)