[RFC PATCH v2 08/13] walken: demonstrate various topographical sorts
- From
Emily Shaffer <emilyshaffer@google.com>
- Date
- Jun 26, 2019, 23:50 UTC
- Message-ID
- <20190626235032.177551-9-emilyshaffer@google.com>
- In-Reply-To
- <20190626235032.177551-1-emilyshaffer@google.com>
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(+)
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; */ } /*
-- 2.22.0.410.gd8fdbe21b5-goog