diff mbox series

[RFC,08/13] walken: demonstrate various topographical sorts

Message ID 20190607010811.52944-9-emilyshaffer@google.com (mailing list archive)
State New, archived
Headers show
Series example implementation of revwalk tutorial | expand

Commit Message

Emily Shaffer June 7, 2019, 1:08 a.m. UTC
Order the revision walk by author or commit dates, to demonstrate how to
apply topo_sort to a revision walk.

While following the tutorial, new contributors are guided to run a walk
with each sort and compare the results.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
 builtin/walken.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/builtin/walken.c b/builtin/walken.c
index 6c0f4e7b7a..716d31f04e 100644
--- a/builtin/walken.c
+++ b/builtin/walken.c
@@ -61,6 +61,11 @@  static void final_rev_info_setup(int argc, const char **argv, const char *prefix
 	
 	/* add the HEAD to pending so we can start */
 	add_head_to_pending(rev);
+	
+	/* Let's play with the sort order. */
+	rev->topo_order = 1;
+	rev->sort_order = REV_SORT_BY_COMMIT_DATE;
+	/* rev->sort_order = REV_SORT_BY_AUTHOR_DATE; */
 }
 
 /*