git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] builtin-log.c: Use for_each_revision() helper

From
LCLuiz Fernando N Capitulino <lcapitulino@mandriva.com.br>
Date
Apr 26, 2007, 19:46 UTC
Message-ID
<11776168013249-git-send-email-lcapitulino@mandriva.com.br>
In-Reply-To
<11776168001253-git-send-email-lcapitulino@mandriva.com.br>
Signed-off-by: Luiz Fernando N Capitulino <lcapitulino@mandriva.com.br>
---
 builtin-log.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 38bf52f..705050a 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -79,8 +79,7 @@ static int cmd_log_walk(struct rev_info *rev)
 {
 	struct commit *commit;
 
-	prepare_revision_walk(rev);
-	while ((commit = get_revision(rev)) != NULL) {
+	for_each_revision(commit, rev) {
 		log_tree_commit(rev, commit);
 		if (!rev->reflog_info) {
 			/* we allow cycles in reflog ancestry */
@@ -390,9 +389,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
 	o2->flags ^= UNINTERESTING;
 	add_pending_object(&check_rev, o1, "o1");
 	add_pending_object(&check_rev, o2, "o2");
-	prepare_revision_walk(&check_rev);
 
-	while ((commit = get_revision(&check_rev)) != NULL) {
+	for_each_revision(commit, &check_rev) {
 		/* ignore merges */
 		if (commit->parents && commit->parents->next)
 			continue;
@@ -578,8 +576,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 	if (!use_stdout)
 		realstdout = fdopen(dup(1), "w");
 
-	prepare_revision_walk(&rev);
-	while ((commit = get_revision(&rev)) != NULL) {
+	for_each_revision(commit, &rev) {
 		/* ignore merges */
 		if (commit->parents && commit->parents->next)
 			continue;
@@ -716,8 +713,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 		die("Unknown commit %s", limit);
 
 	/* reverse the list of commits */
-	prepare_revision_walk(&revs);
-	while ((commit = get_revision(&revs)) != NULL) {
+	for_each_revision(commit, &revs) {
 		/* ignore merges */
 		if (commit->parents && commit->parents->next)
 			continue;
-- 
1.5.1.1.320.g1cf2
Previous: Luiz Fernando N CapitulinoNext: Hermes Trismegisto
Message 8 of 15 in “RFC: for_each_revision() helper”
  1. 0/5 RFC: for_each_revision() helperLuiz Fernando N Capitulino, Apr 26, 2007
  2. 1/5 Introduces for_each_revision() helperLuiz Fernando N Capitulino, Apr 26, 2007
  3. Andy WhitcroftApr 26, 2007
  4. Luiz Fernando N. CapitulinoApr 26, 2007
  5. 2/5 builtin-fmt-merge-msg.c: Use for_each_revision() helperLuiz Fernando N Capitulino, Apr 26, 2007
  6. 3/5 reachable.c: Use for_each_revision() helperLuiz Fernando N Capitulino, Apr 26, 2007
  7. 4/5 builtin-shortlog.c: Use for_each_revision() helperLuiz Fernando N Capitulino, Apr 26, 2007
  8. 5/5 builtin-log.c: Use for_each_revision() helperLuiz Fernando N Capitulino, Apr 26, 2007
  9. Hermes TrismegistoApr 26, 2007
  10. Sam RavnborgApr 26, 2007
  11. Luiz Fernando N. CapitulinoApr 26, 2007
  12. Luiz Fernando N. CapitulinoApr 26, 2007
  13. Junio C HamanoApr 26, 2007
  14. Luiz Fernando N. CapitulinoApr 27, 2007
  15. Junio C HamanoApr 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.