summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shallow.c3
-rwxr-xr-xt/t5500-fetch-pack.sh11
2 files changed, 14 insertions, 0 deletions
diff --git a/shallow.c b/shallow.c
index 2abebeb..79439a8 100644
--- a/shallow.c
+++ b/shallow.c
@@ -191,6 +191,9 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
die("revision walk setup failed");
traverse_commit_list(&revs, show_commit, NULL, &not_shallow_list);
+ if (!not_shallow_list)
+ die("no commits selected for shallow requests");
+
/* Mark all reachable commits as NOT_SHALLOW */
for (p = not_shallow_list; p; p = p->next)
p->item->object.flags |= not_shallow_flag;
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index d4f4351..8390c0a 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -711,6 +711,17 @@ test_expect_success 'fetch shallow since ...' '
test_cmp expected actual
'
+test_expect_success 'clone shallow since selects no commits' '
+ test_create_repo shallow-since-the-future &&
+ (
+ cd shallow-since-the-future &&
+ GIT_COMMITTER_DATE="100000000 +0700" git commit --allow-empty -m one &&
+ GIT_COMMITTER_DATE="200000000 +0700" git commit --allow-empty -m two &&
+ GIT_COMMITTER_DATE="300000000 +0700" git commit --allow-empty -m three &&
+ test_must_fail git clone --shallow-since "900000000 +0700" "file://$(pwd)/." ../shallow111
+ )
+'
+
test_expect_success 'shallow clone exclude tag two' '
test_create_repo shallow-exclude &&
(