diff options
Diffstat (limited to 'src/clone.c')
-rw-r--r-- | src/clone.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/clone.c b/src/clone.c index 00e39d3b5..71931664c 100644 --- a/src/clone.c +++ b/src/clone.c @@ -290,6 +290,19 @@ static bool path_is_okay(const char *path) return true; } +static bool should_checkout( + git_repository *repo, + bool is_bare, + git_checkout_opts *opts) +{ + if (is_bare) + return false; + + if (!opts) + return false; + + return !git_repository_head_orphan(repo); +} static int clone_internal( git_repository **out, @@ -298,7 +311,7 @@ static int clone_internal( git_indexer_stats *fetch_stats, git_indexer_stats *checkout_stats, git_checkout_opts *checkout_opts, - int is_bare) + bool is_bare) { int retcode = GIT_ERROR; git_repository *repo = NULL; @@ -321,7 +334,7 @@ static int clone_internal( } } - if (!retcode && !is_bare && !git_repository_head_orphan(repo)) + if (!retcode && should_checkout(repo, is_bare, checkout_opts)) retcode = git_checkout_head(*out, checkout_opts, checkout_stats); return retcode; |