summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2016-06-17 15:45:55 +0200
committerGitHub <noreply@github.com>2016-06-17 15:45:55 +0200
commit69c71f2917fede843789e783ab6fe0fcda68753a (patch)
tree0a098b7356b880033239ab82b4fc9924e1216212 /src
parent3e9830d7bc29f214ec2420eed2bf7de4c02720da (diff)
parentbb0bd71ab4f404509aefa3be923916e886c9d25d (diff)
downloadlibgit2-69c71f2917fede843789e783ab6fe0fcda68753a.tar.gz
Merge pull request #3823 from libgit2/ethomson/checkout_no_index
checkout: use empty baseline when no index file exists
Diffstat (limited to 'src')
-rw-r--r--src/checkout.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/checkout.c b/src/checkout.c
index b3e95dff8..f39c341d4 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -2430,8 +2430,13 @@ static int checkout_data_init(
if (!data->opts.baseline && !data->opts.baseline_index) {
data->opts_free_baseline = true;
+ error = 0;
- error = checkout_lookup_head_tree(&data->opts.baseline, repo);
+ /* if we don't have an index, this is an initial checkout and
+ * should be against an empty baseline
+ */
+ if (data->index->on_disk)
+ error = checkout_lookup_head_tree(&data->opts.baseline, repo);
if (error == GIT_EUNBORNBRANCH) {
error = 0;