From: Jon Seymour <jon.seymour@gmail.com>
To: git@vger.kernel.org
Cc: torvalds@osdl.org, jon.seymour@gmail.com
Subject: [PATCH 8/13] Fix handling of duplicates by topological order.
Date: Thu, 07 Jul 2005 02:39:34 +1000 [thread overview]
Message-ID: <20050706163934.9947.qmail@blackcubes.dyndns.org> (raw)
git-rev-list --topo-order HEAD HEAD
caused a segmentation violation.
This has now been fixed.
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
commit.c | 15 +++++++++++----
commit.h | 3 +++
epoch.h | 13 ++++++-------
rev-list.c | 8 ++++----
4 files changed, 24 insertions(+), 15 deletions(-)
60a355172fdf6583465e1c237a3e82af64065332
diff --git a/commit.c b/commit.c
--- a/commit.c
+++ b/commit.c
@@ -374,11 +374,17 @@ void sort_in_topological_order(struct co
struct sort_node * next_nodes;
int count = 0;
- /* determine the size of the list */
- while (next) {
- next = next->next;
- count++;
+ /* determine the size of the list and elide duplicates */
+ while (*pptr) {
+ next=*pptr;
+ if (!(next->item->object.flags & DUPCHECK)) {
+ count++;
+ next->item->object.flags |= DUPCHECK;
+ pptr=&next->next;
+ } else
+ *pptr=next->next;
}
+ pptr=list;
/* allocate an array to help sort the list */
nodes = xcalloc(count, sizeof(*nodes));
/* link the list to the array */
@@ -387,6 +393,7 @@ void sort_in_topological_order(struct co
while (next) {
next_nodes->list_item = next;
next->item->object.util = next_nodes;
+ next->item->object.flags &= ~DUPCHECK;
next_nodes++;
next = next->next;
}
diff --git a/commit.h b/commit.h
--- a/commit.h
+++ b/commit.h
@@ -4,6 +4,9 @@
#include "object.h"
#include "tree.h"
+#define DUPCHECK (1u<<0)
+#define LAST_COMMIT_FLAG (DUPCHECK)
+
struct commit_list {
struct commit *item;
struct commit_list *next;
diff --git a/epoch.h b/epoch.h
--- a/epoch.h
+++ b/epoch.h
@@ -1,6 +1,6 @@
#ifndef EPOCH_H
#define EPOCH_H
-
+#include "commit.h"
// return codes for emitter_func
#define STOP 0
@@ -10,12 +10,11 @@ typedef int (*emitter_func) (struct comm
int sort_list_in_merge_order(struct commit_list *list, emitter_func emitter);
-#define UNINTERESTING (1u<<2)
-#define BOUNDARY (1u<<3)
-#define VISITED (1u<<4)
-#define DISCONTINUITY (1u<<5)
-#define DUPCHECK (1u<<6)
-#define LAST_EPOCH_FLAG (1u<<6)
+#define UNINTERESTING (LAST_COMMIT_FLAG<<1)
+#define BOUNDARY (LAST_COMMIT_FLAG<<2)
+#define VISITED (LAST_COMMIT_FLAG<<3)
+#define DISCONTINUITY (LAST_COMMIT_FLAG<<4)
+#define LAST_EPOCH_FLAG (LAST_COMMIT_FLAG<<4)
#endif /* EPOCH_H */
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -5,10 +5,10 @@
#include "blob.h"
#include "epoch.h"
-#define SEEN (1u << 0)
-#define INTERESTING (1u << 1)
-#define COUNTED (1u << 2)
-#define SHOWN (LAST_EPOCH_FLAG << 2)
+#define SEEN (LAST_EPOCH_FLAG << 1)
+#define INTERESTING (LAST_EPOCH_FLAG << 2)
+#define COUNTED (LAST_EPOCH_FLAG << 3)
+#define SHOWN (LAST_EPOCH_FLAG << 4)
static const char rev_list_usage[] =
"usage: git-rev-list [OPTION] commit-id <commit-id>\n"
------------
reply other threads:[~2005-07-06 16:48 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=20050706163934.9947.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