From 4903161fb8c74bc583b21d7ffe7abaf223df4253 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 30 Oct 2006 15:29:53 -0800 Subject: [PATCH 1/5] Surround "#define DEBUG 0" with "#ifndef DEBUG..#endif" Otherwise "make CFLAGS=-DDEBUG=1" is cumbersome to run. Signed-off-by: Junio C Hamano --- blame.c | 5 +++++ cache-tree.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/blame.c b/blame.c index 8cfd5d94c..3e227d271 100644 --- a/blame.c +++ b/blame.c @@ -18,7 +18,9 @@ #include "revision.h" #include "xdiff-interface.h" +#ifndef DEBUG #define DEBUG 0 +#endif static const char blame_usage[] = "git-blame [-c] [-l] [-t] [-S ] [--] file [commit]\n" " -c, --compatibility Use the same output mode as git-annotate (Default: off)\n" @@ -232,6 +234,9 @@ static void print_map(struct commit *cmit, struct commit *other) util2->num_lines ? util->num_lines : util2->num_lines; int num; + if (print_map == NULL) + ; /* to avoid "unused function" warning */ + for (i = 0; i < max; i++) { printf("i: %d ", i); num = -1; diff --git a/cache-tree.c b/cache-tree.c index d388848dd..a80326289 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -2,7 +2,9 @@ #include "tree.h" #include "cache-tree.h" +#ifndef DEBUG #define DEBUG 0 +#endif struct cache_tree *cache_tree(void) { From 8d63d95f297446fe110ea76d350ae15676e2ed54 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 30 Oct 2006 16:07:54 -0800 Subject: [PATCH 2/5] quote.c: ensure the same quoting across platforms. We read a byte from "char *" and compared it with ' ' to decide if it needs quoting to protect textual output. With a platform where char is unsigned char that would give different result. Signed-off-by: Junio C Hamano --- quote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quote.c b/quote.c index e3a4d4aef..dc5c0a771 100644 --- a/quote.c +++ b/quote.c @@ -209,7 +209,7 @@ static int quote_c_style_counted(const char *name, int namelen, if (!ch) break; if ((ch < ' ') || (ch == '"') || (ch == '\\') || - (ch == 0177)) { + (ch >= 0177)) { needquote = 1; switch (ch) { case '\a': EMITQ(); ch = 'a'; break; From 173a9cbe7031bc3574b3f41cb2d2375cf959ff2a Mon Sep 17 00:00:00 2001 From: Edgar Toernig Date: Mon, 30 Oct 2006 17:39:17 -0800 Subject: [PATCH 3/5] Use memmove instead of memcpy for overlapping areas Signed-off-by: Junio C Hamano --- imap-send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imap-send.c b/imap-send.c index 16804ab28..a6a65680e 100644 --- a/imap-send.c +++ b/imap-send.c @@ -272,7 +272,7 @@ buffer_gets( buffer_t * b, char **s ) n = b->bytes - start; if (n) - memcpy( b->buf, b->buf + start, n ); + memmove(b->buf, b->buf + start, n); b->offset -= start; b->bytes = n; start = 0; From 744f498522d2255cf0ce967298c3d87b4727d1a4 Mon Sep 17 00:00:00 2001 From: Jan Harkes Date: Mon, 30 Oct 2006 20:37:49 -0500 Subject: [PATCH 4/5] Continue traversal when rev-list --unpacked finds a packed commit. When getting the list of all unpacked objects by walking the commit history, we would stop traversal whenever we hit a packed commit. However the fact that we found a packed commit does not guarantee that all previous commits are also packed. As a result the commit walkers did not show all reachable unpacked objects. Signed-off-by: Jan Harkes Signed-off-by: Junio C Hamano --- revision.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/revision.c b/revision.c index 93f25130a..89e6c6f93 100644 --- a/revision.c +++ b/revision.c @@ -418,9 +418,6 @@ static void limit_list(struct rev_info *revs) if (revs->max_age != -1 && (commit->date < revs->max_age)) obj->flags |= UNINTERESTING; - if (revs->unpacked && - has_sha1_pack(obj->sha1, revs->ignore_packed)) - obj->flags |= UNINTERESTING; add_parents_to_list(revs, commit, &list); if (obj->flags & UNINTERESTING) { mark_parents_uninteresting(commit); @@ -1142,17 +1139,18 @@ struct commit *get_revision(struct rev_info *revs) * that we'd otherwise have done in limit_list(). */ if (!revs->limited) { - if ((revs->unpacked && - has_sha1_pack(commit->object.sha1, - revs->ignore_packed)) || - (revs->max_age != -1 && - (commit->date < revs->max_age))) + if (revs->max_age != -1 && + (commit->date < revs->max_age)) continue; add_parents_to_list(revs, commit, &revs->commits); } if (commit->object.flags & SHOWN) continue; + if (revs->unpacked && has_sha1_pack(commit->object.sha1, + revs->ignore_packed)) + continue; + /* We want to show boundary commits only when their * children are shown. When path-limiter is in effect, * rewrite_parents() drops some commits from getting shown, From 9dad9d2e5b322835c87e1653268d892a95ee0f1f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 30 Oct 2006 18:58:03 -0800 Subject: [PATCH 5/5] revision traversal: --unpacked does not limit commit list anymore. This is needed to gain smaller latency back. Signed-off-by: Junio C Hamano --- revision.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revision.c b/revision.c index 89e6c6f93..36cdfcd1a 100644 --- a/revision.c +++ b/revision.c @@ -1007,7 +1007,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch add_pending_object(revs, object, def); } - if (revs->topo_order || revs->unpacked) + if (revs->topo_order) revs->limited = 1; if (revs->prune_data) {