diff mbox series

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

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

Commit Message

Emily Shaffer June 26, 2019, 11:50 p.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>
Change-Id: I7ce2f3e8a77c42001293637ae209087afec4ce2c
---
 builtin/walken.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Eric Sunshine June 27, 2019, 5:22 a.m. UTC | #1
On Wed, Jun 26, 2019 at 7:51 PM Emily Shaffer <emilyshaffer@google.com> wrote:
> Order the revision walk by author or commit dates, to demonstrate how to

s/,//

> 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>
Emily Shaffer June 27, 2019, 10:12 p.m. UTC | #2
On Thu, Jun 27, 2019 at 01:22:10AM -0400, Eric Sunshine wrote:
> On Wed, Jun 26, 2019 at 7:51 PM Emily Shaffer <emilyshaffer@google.com> wrote:
> > Order the revision walk by author or commit dates, to demonstrate how to
> 
> s/,//

Done.
diff mbox series

Patch

diff --git a/builtin/walken.c b/builtin/walken.c
index da2d197914..6cc451324a 100644
--- a/builtin/walken.c
+++ b/builtin/walken.c
@@ -69,6 +69,13 @@  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;
+
+	/* Toggle between these and observe the difference. */
+	rev->sort_order = REV_SORT_BY_COMMIT_DATE;
+	/* rev->sort_order = REV_SORT_BY_AUTHOR_DATE; */
 }
 
 /*