From: Jon Seymour <jon.seymour@gmail.com>
To: git@vger.kernel.org
Cc: torvalds@osdl.org, jon.seymour@gmail.com
Subject: [RESUBMITTED PATCH 1/2] Add --topo-order flag to git-rev-list [rev2]
Date: Sat, 02 Jul 2005 18:39:40 +1000 [thread overview]
Message-ID: <20050702083940.19107.qmail@blackcubes.dyndns.org> (raw)
Added a --topo-order flag to git-rev-list.
When this flag is specified, git-rev-list sorts its output
in topological order. That is:
a is reachable from b ==> ord(b) < ord(a)
This ordering invariant is weaker than the --merge-order invariant
but should be sufficient for tools just as gitk that only
need the minimum guarantee provided by --topo-order.
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
Note: this patch assumes that my previous patch series that introduces
sort_in_topological_order() to commit.c has been applied.
A subsequent patch to gitk will make gitk use --topo-order instead
of --merge-order.
[rev2]
* this patch rescues the --topo-order patch that I withdrew
by recognizing that if limit_list is called, sort_commit_list
does not do a chronological sort
* ensures limit_list is called whenever a topological sort is
is required
* removed excess braces
---
rev-list.c | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
de8a7f7120581ae60b7e882b15b9099a6fce55dd
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -16,7 +16,7 @@ static const char rev_list_usage[] =
" --min-age=epoch\n"
" --header\n"
" --pretty\n"
- " --bisect\n"
+ " --bisect\n"
" --merge-order [ --show-breaks ]";
static int tag_objects = 0;
@@ -32,6 +32,7 @@ static int max_count = -1;
static enum cmit_fmt commit_format = CMIT_FMT_RAW;
static int merge_order = 0;
static int show_breaks = 0;
+static int topo_order=0;
static int stop_traversal = 0;
static int bisect_by_cut_option = 0;
@@ -373,11 +374,15 @@ int main(int argc, char **argv)
blob_objects = 1;
continue;
}
- if (!strncmp(arg, "--merge-order", 13)) {
+ if (!strcmp(arg, "--merge-order")) {
merge_order = 1;
continue;
}
- if (!strncmp(arg, "--show-breaks", 13)) {
+ if (!strcmp(arg, "--topo-order")) {
+ topo_order = 1;
+ continue;
+ }
+ if (!strcmp(arg, "--show-breaks")) {
show_breaks = 1;
continue;
}
@@ -396,14 +401,22 @@ int main(int argc, char **argv)
}
if (!merge_order) {
- if (limited)
+ if (limited || topo_order || bisect_by_cut_option) {
+ /*
+ * two expected side effects of calling
+ * limit_list are:
+ * * resulting list contains all the items to process
+ * * show_commit_list won't do a chronological
+ * sort
+ */
list = limit_list(list);
- if (!bisect_by_cut_option)
- show_commit_list(list);
- else {
+ }
+ if (bisect_by_cut_option || topo_order)
sort_in_topological_order(&list);
+ if (bisect_by_cut_option)
show_commit(bisect_by_cut(list));
- }
+ else
+ show_commit_list(list);
} else {
if (sort_list_in_merge_order(list, &process_commit)) {
die("merge order sort failed\n");
------------
reply other threads:[~2005-07-02 8:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050702083940.19107.qmail@blackcubes.dyndns.org \
--to=jon.seymour@gmail.com \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox