From a3552aba55b9ed2860b8eb0581c73fc0e996369d Mon Sep 17 00:00:00 2001 From: Ralf Thielow Date: Fri, 11 Oct 2013 18:49:02 +0200 Subject: clone --branch: refuse to clone if upstream repo is empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 920b691 (clone: refuse to clone if --branch points to bogus ref) we refuse to clone with option "-b" if the specified branch does not exist in the (non-empty) upstream. If the upstream repository is empty, the branch doesn't exist, either. So refuse the clone too. Reported-by: Robert Mitwicki Signed-off-by: Ralf Thielow Acked-by: Nguyễn Thái Ngọc Duy Signed-off-by: Jonathan Nieder diff --git a/builtin/clone.c b/builtin/clone.c index 430307b..21ad9f9 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -946,6 +946,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; diff --git a/t/t5706-clone-branch.sh b/t/t5706-clone-branch.sh index 56be67e..6e7a7be 100755 --- a/t/t5706-clone-branch.sh +++ b/t/t5706-clone-branch.sh @@ -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' ' @@ -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 -- cgit v0.10.2-6-g49f6 From 3991e91063bb701d8ba12199b993a8f121f27f04 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Mon, 23 Sep 2013 21:19:19 +0200 Subject: git-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY git-prune-packed operates on GIT_OBJECT_DIRECTORY, not GIT_OBJECT_DIR. Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano diff --git a/Documentation/git-prune-packed.txt b/Documentation/git-prune-packed.txt index 80dc022..6738055 100644 --- a/Documentation/git-prune-packed.txt +++ b/Documentation/git-prune-packed.txt @@ -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. -- cgit v0.10.2-6-g49f6