Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  git-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY
  clone --branch: refuse to clone if upstream repo is empty
  • Loading branch information
Junio C Hamano committed Oct 15, 2013
2 parents 6fb0216 + 3991e91 commit 9768648
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Documentation/git-prune-packed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SYNOPSIS

DESCRIPTION
-----------
This program searches the `$GIT_OBJECT_DIR` for all objects that currently
This program searches the `$GIT_OBJECT_DIRECTORY` for all objects that currently
exist in a pack file as well as the independent object directories.

All such extra objects are removed.
Expand Down
4 changes: 4 additions & 0 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
our_head_points_at = remote_head_points_at;
}
else {
if (option_branch)
die(_("Remote branch %s not found in upstream %s"),
option_branch, option_origin);

warning(_("You appear to have cloned an empty repository."));
mapped_refs = NULL;
our_head_points_at = NULL;
Expand Down
8 changes: 7 additions & 1 deletion t/t5706-clone-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ test_expect_success 'setup' '
echo one >file && git add file && git commit -m one &&
git checkout -b two &&
echo two >file && git add file && git commit -m two &&
git checkout master)
git checkout master) &&
mkdir empty &&
(cd empty && git init)
'

test_expect_success 'vanilla clone chooses HEAD' '
Expand Down Expand Up @@ -61,4 +63,8 @@ test_expect_success 'clone -b with bogus branch' '
test_must_fail git clone -b bogus parent clone-bogus
'

test_expect_success 'clone -b not allowed with empty repos' '
test_must_fail git clone -b branch empty clone-branch-empty
'

test_done

0 comments on commit 9768648

Please sign in to comment.