Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Peart <benpeart@microsoft.com>2019-01-23 23:02:01 +0300
committerJunio C Hamano <gitster@pobox.com>2019-01-24 00:22:48 +0300
commit8424bfd45b291a56594f0289dc6af22e900a1d88 (patch)
tree4e8e0559842cd13484b45cf2ba098bbfc74c680e /builtin
parent91e3d7ca9b0194575c1fdbb82b74bef4eb8357a1 (diff)
checkout: fix regression in checkout -b on intitial checkout
When doing a 'checkout -b' do a full checkout including updating the working tree when doing the initial checkout. As the new test involves an filesystem access, do it later in the sequence to give chance to other cheaper tests to leave early. This fixes the regression in behavior caused by fa655d8411 (checkout: optimize "git checkout -b <new_branch>", 2018-08-16). Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 21bac3a561d..99b873d3cd4 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -566,6 +566,14 @@ static int skip_merge_working_tree(const struct checkout_opts *opts,
* Remaining variables are not checkout options but used to track state
*/
+ /*
+ * Do the merge if this is the initial checkout. We cannot use
+ * is_cache_unborn() here because the index hasn't been loaded yet
+ * so cache_nr and timestamp.sec are always zero.
+ */
+ if (!file_exists(get_index_file()))
+ return 0;
+
return 1;
}