Merge branch 'js/rebase-am'
[gitweb.git] / builtin / checkout.c
index 6fadf412e830ba4aeaa8d2940fd9a7aab9bd8fa5..9f8f3466f66d8845a60719cc608375b71679d4b4 100644 (file)
@@ -592,6 +592,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;
 }