Skip to content

Commit 805c555

Browse files
authored
Merge pull request #977 from betatim/support-main-and-master
[MRG] Remove reference to `master` branch from CLI doc
2 parents 035574b + 1ebb4b5 commit 805c555

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

repo2docker/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def get_argparser():
9696
argparser.add_argument(
9797
"--ref",
9898
help=(
99-
"If building a git url, which reference to check out. " "E.g., `master`."
99+
"Reference to build instead of default reference. For example"
100+
" branch name or commit for a Git repository."
100101
),
101102
)
102103

repo2docker/contentproviders/git.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,18 @@ def fetch(self, spec, output_dir, yield_output=False):
4747
self.log.error(
4848
"Failed to check out ref %s", ref, extra=dict(phase="failed")
4949
)
50-
raise ValueError("Failed to check out ref {}".format(ref))
50+
if ref == "master":
51+
msg = (
52+
"Failed to check out the 'master' branch. "
53+
"Maybe the default branch is not named 'master' "
54+
"for this repository.\n\nTry not explicitly "
55+
"specifying `--ref`."
56+
)
57+
else:
58+
msg = "Failed to check out ref {}".format(ref)
59+
raise ValueError(msg)
5160
# We don't need to explicitly checkout things as the reset will
52-
# take of that. If the hash is resolved above, we should be
61+
# take care of that. If the hash is resolved above, we should be
5362
# able to reset to it
5463
for line in execute_cmd(
5564
["git", "reset", "--hard", hash], cwd=output_dir, capture=yield_output

0 commit comments

Comments
 (0)