diff options
| author | Edward Thomson <ethomson@github.com> | 2016-06-15 15:47:28 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-06-15 15:47:28 -0500 |
| commit | bb0bd71ab4f404509aefa3be923916e886c9d25d (patch) | |
| tree | 4c78ae017a7090f3d4af25c2641e673fcc737ae8 /src/checkout.c | |
| parent | abb6f72aaacd4edb4131d1bdb8d0965bd189ee82 (diff) | |
| download | libgit2-bb0bd71ab4f404509aefa3be923916e886c9d25d.tar.gz | |
checkout: use empty baseline when no indexethomson/checkout_no_index
When no index file exists and a baseline is not explicitly provided, use
an empty baseline instead of trying to load `HEAD`.
Diffstat (limited to 'src/checkout.c')
| -rw-r--r-- | src/checkout.c | 7 |
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; |
