@@ -688,6 +688,20 @@ int generation_numbers_enabled(struct repository *r)
return !!first_generation;
}
+int corrected_commit_dates_enabled(struct repository *r)
+{
+ struct commit_graph *g;
+ if (!prepare_commit_graph(r))
+ return 0;
+
+ g = r->objects->commit_graph;
+
+ if (!g->num_commits)
+ return 0;
+
+ return !!g->chunk_generation_data;
+}
+
static void close_commit_graph_one(struct commit_graph *g)
{
if (!g)
@@ -89,6 +89,12 @@ struct commit_graph *parse_commit_graph(void *graph_map, size_t graph_size);
*/
int generation_numbers_enabled(struct repository *r);
+/*
+ * Return 1 if and only if the repository has a commit-graph
+ * file and generation data chunk has been written for the file.
+ */
+int corrected_commit_dates_enabled(struct repository *r);
+
enum commit_graph_write_flags {
COMMIT_GRAPH_WRITE_APPEND = (1 << 0),
COMMIT_GRAPH_WRITE_PROGRESS = (1 << 1),
@@ -39,7 +39,7 @@ static struct commit_list *paint_down_to_common(struct repository *r,
int i;
timestamp_t last_gen = GENERATION_NUMBER_INFINITY;
- if (!min_generation)
+ if (!min_generation && !corrected_commit_dates_enabled(r))
queue.compare = compare_commits_by_commit_date;
one->object.flags |= PARENT1;
@@ -15,6 +15,8 @@ GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
export GIT_COMMITTER_DATE
test_expect_success 'setup tests' '
+ GIT_TEST_COMMIT_GRAPH=0 &&
+ export GIT_TEST_COMMIT_GRAPH &&
echo 1 >a1 &&
git add a1 &&
GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 &&
@@ -66,7 +68,7 @@ test_expect_success 'setup tests' '
'
test_expect_success 'combined merge conflicts' '
- test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git merge -m final G
+ test_must_fail git merge -m final G
'
test_expect_success 'result contains a conflict' '