git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] bisect: Honor log.date
@ 2024-03-30 23:10 Peter Krefting
  2024-03-31  2:14 ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Krefting @ 2024-03-30 23:10 UTC (permalink / raw)
  To: git, Osipov, Michael (IN IT IN)

When bisect finds the target commit to display, it calls git diff-tree
to do so. This is a plumbing command that is not affected by the user's
log.date setting. Switch to instead use "git show", which does honor
it.

Reported-by: Michael Osipov <michael.osipov@innomotics.com>
Signed-off-By: Peter Krefting <peter@softwolves.pp.se>
---
  bisect.c | 25 ++++++++++---------------
  1 file changed, 10 insertions(+), 15 deletions(-)

This version also uses "--stat" which produces an output more like the 
one from the diff-tree utility.

GitHub's test run reports a single failed test (7300), but this passes 
when I try it locally: 
https://github.com/nafmo/git-l10n-sv/commit/2f27ae64064edc5c2570f1c9ea121f3f1a7283d7

diff --git a/bisect.c b/bisect.c
index 8487f8cd1b..3d0100b165 100644
--- a/bisect.c
+++ b/bisect.c
@@ -959,23 +959,18 @@ static enum bisect_error check_good_are_ancestors_of_bad(struct repository *r,
  }

  /*
- * This does "git diff-tree --pretty COMMIT" without one fork+exec.
+ * Runs "git show" to display a commit
   */
-static void show_diff_tree(struct repository *r,
-			   const char *prefix,
-			   struct commit *commit)
+static void show_commit(struct commit *commit)
  {
-	const char *argv[] = {
-		"diff-tree", "--pretty", "--stat", "--summary", "--cc", NULL
-	};
-	struct rev_info opt;
+	struct child_process show = CHILD_PROCESS_INIT;

-	git_config(git_diff_ui_config, NULL);
-	repo_init_revisions(r, &opt, prefix);
-
-	setup_revisions(ARRAY_SIZE(argv) - 1, argv, &opt, NULL);
-	log_tree_commit(&opt, commit);
-	release_revisions(&opt);
+	strvec_pushl(&show.args, "show", "--pretty=medium", "--stat", "--no-abbrev-commit", "--no-patch",
+		     oid_to_hex(&commit->object.oid), NULL);
+	show.git_cmd = 1;
+	if (run_command(&show))
+		die(_("unable to start 'show' for object '%s'"),
+		    oid_to_hex(&commit->object.oid));
  }

  /*
@@ -1092,7 +1087,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
  		printf("%s is the first %s commit\n", oid_to_hex(bisect_rev),
  			term_bad);

-		show_diff_tree(r, prefix, revs.commits->item);
+		show_commit(revs.commits->item);
  		/*
  		 * This means the bisection process succeeded.
  		 * Using BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND (-10)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-04-20 17:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-30 23:10 [PATCH v2] bisect: Honor log.date Peter Krefting
2024-03-31  2:14 ` Junio C Hamano
2024-03-31 17:10   ` Peter Krefting
2024-03-31 22:58     ` Junio C Hamano
2024-04-01  2:32       ` Jeff King
2024-04-01 15:50         ` Peter Krefting
2024-04-01 16:32           ` Jeff King
2024-04-01 17:03             ` Junio C Hamano
2024-04-03  1:27               ` Jeff King
2024-04-16 11:01         ` Christian Couder
2024-04-16 15:42           ` Junio C Hamano
2024-04-16 19:53             ` Peter Krefting
2024-04-20 17:13               ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).