vendor/libgit2/src/checkout.c in rugged-0.25.0b5 vs vendor/libgit2/src/checkout.c in rugged-0.25.0b6

- old
+ new

@@ -24,10 +24,11 @@ #include "repository.h" #include "index.h" #include "filter.h" #include "blob.h" #include "diff.h" +#include "diff_generate.h" #include "pathspec.h" #include "buf_text.h" #include "diff_xdiff.h" #include "path.h" #include "attr.h" @@ -2428,11 +2429,16 @@ &data->can_symlink, repo, GIT_CVAR_SYMLINKS)) < 0) goto cleanup; 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; giterr_clear(); }