aboutsummaryrefslogtreecommitdiffstats
path: root/revision.c
diff options
context:
space:
mode:
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/revision.c b/revision.c
index 212ca0de27..6ba8f67054 100644
--- a/revision.c
+++ b/revision.c
@@ -50,8 +50,6 @@
#include "parse-options.h"
#include "wildmatch.h"
-volatile show_early_output_fn_t show_early_output;
-
static char *term_bad;
static char *term_good;
@@ -673,12 +671,17 @@ static void trace2_bloom_filter_statistics_atexit(void)
static int forbid_bloom_filters(struct pathspec *spec)
{
- if (spec->has_wildcard)
- return 1;
- if (spec->magic & ~PATHSPEC_LITERAL)
+ unsigned int allowed_magic =
+ PATHSPEC_FROMTOP |
+ PATHSPEC_MAXDEPTH |
+ PATHSPEC_LITERAL |
+ PATHSPEC_GLOB |
+ PATHSPEC_ATTR;
+
+ if (spec->magic & ~allowed_magic)
return 1;
for (size_t nr = 0; nr < spec->nr; nr++)
- if (spec->items[nr].magic & ~PATHSPEC_LITERAL)
+ if (spec->items[nr].magic & ~allowed_magic)
return 1;
return 0;
@@ -693,23 +696,34 @@ static int convert_pathspec_to_bloom_keyvec(struct bloom_keyvec **out,
char *path_alloc = NULL;
const char *path;
size_t len;
- int res = 0;
+ int res = -1;
+ len = pi->nowildcard_len;
+ if (len != pi->len) {
+ /*
+ * for path like "dir/file*", nowildcard part would be
+ * "dir/file", but only "dir" should be used for the
+ * bloom filter.
+ */
+ while (len > 0 && pi->match[len - 1] != '/')
+ len--;
+ }
/* remove single trailing slash from path, if needed */
- if (pi->len > 0 && pi->match[pi->len - 1] == '/') {
- path_alloc = xmemdupz(pi->match, pi->len - 1);
+ if (len > 0 && pi->match[len - 1] == '/')
+ len--;
+
+ if (!len)
+ goto cleanup;
+
+ if (len != pi->len) {
+ path_alloc = xmemdupz(pi->match, len);
path = path_alloc;
} else
path = pi->match;
- len = strlen(path);
- if (!len) {
- res = -1;
- goto cleanup;
- }
-
*out = bloom_keyvec_new(path, len, settings);
+ res = 0;
cleanup:
free(path_alloc);
return res;
@@ -1473,7 +1487,6 @@ static int limit_list(struct rev_info *revs)
while (original_list) {
struct commit *commit = pop_commit(&original_list);
struct object *obj = &commit->object;
- show_early_output_fn_t show;
if (commit == interesting_cache)
interesting_cache = NULL;
@@ -1497,13 +1510,6 @@ static int limit_list(struct rev_info *revs)
continue;
date = commit->date;
p = &commit_list_insert(commit, p)->next;
-
- show = show_early_output;
- if (!show)
- continue;
-
- show(revs, newlist);
- show_early_output = NULL;
}
if (revs->cherry_pick || revs->cherry_mark)
cherry_pick_list(newlist, revs);
@@ -1630,7 +1636,7 @@ void exclude_hidden_refs(struct ref_exclusions *exclusions, const char *section)
cb.exclusions = exclusions;
cb.section = section;
- git_config(hide_refs_config, &cb);
+ repo_config(the_repository, hide_refs_config, &cb);
}
struct all_refs_cb {
@@ -1699,7 +1705,8 @@ static void handle_one_reflog_commit(struct object_id *oid, void *cb_data)
}
}
-static int handle_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
+static int handle_one_reflog_ent(const char *refname UNUSED,
+ struct object_id *ooid, struct object_id *noid,
const char *email UNUSED,
timestamp_t timestamp UNUSED,
int tz UNUSED,
@@ -2437,13 +2444,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
} else if (!strcmp(arg, "--author-date-order")) {
revs->sort_order = REV_SORT_BY_AUTHOR_DATE;
revs->topo_order = 1;
- } else if (!strcmp(arg, "--early-output")) {
- revs->early_output = 100;
- revs->topo_order = 1;
- } else if (skip_prefix(arg, "--early-output=", &optarg)) {
- if (strtoul_ui(optarg, 10, &revs->early_output) < 0)
- die("'%s': not a non-negative integer", optarg);
- revs->topo_order = 1;
} else if (!strcmp(arg, "--parents")) {
revs->rewrite_parents = 1;
revs->print_parents = 1;