#include "commit-slab.h"
#include "dir.h"
#include "cache-tree.h"
+#include "bisect.h"
volatile show_early_output_fn_t show_early_output;
+static const char *term_bad;
+static const char *term_good;
+
char *path_name(const struct name_path *path, const char *name)
{
const struct name_path *p;
parent = parent->next;
if (p)
p->object.flags |= UNINTERESTING;
- if (parse_commit(p) < 0)
+ if (parse_commit_gently(p, 1) < 0)
continue;
if (p->parents)
mark_parents_uninteresting(p);
for (parent = commit->parents; parent; parent = parent->next) {
struct commit *p = parent->item;
- if (parse_commit(p) < 0)
+ if (parse_commit_gently(p, revs->ignore_missing_links) < 0)
return -1;
if (revs->show_source && !p->util)
p->util = commit->util;
return 0;
}
-static int handle_one_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static int handle_one_ref(const char *path, const struct object_id *oid,
+ int flag, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
struct object *object;
if (ref_excluded(cb->all_revs->ref_excludes, path))
return 0;
- object = get_reference(cb->all_revs, path, sha1, cb->all_flags);
+ object = get_reference(cb->all_revs, path, oid->hash, cb->all_flags);
add_rev_cmdline(cb->all_revs, object, path, REV_CMD_REF, cb->all_flags);
- add_pending_sha1(cb->all_revs, path, sha1, cb->all_flags);
+ add_pending_sha1(cb->all_revs, path, oid->hash, cb->all_flags);
return 0;
}
int (*for_each)(const char *, each_ref_fn, void *))
{
struct all_refs_cb cb;
- struct each_ref_fn_sha1_adapter wrapped_handle_one_ref =
- {handle_one_ref, &cb};
-
init_all_refs_cb(&cb, revs, flags);
- for_each(submodule, each_ref_fn_adapter, &wrapped_handle_one_ref);
+ for_each(submodule, handle_one_ref, &cb);
}
static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
return 0;
}
-static int handle_one_reflog(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static int handle_one_reflog(const char *path, const struct object_id *oid,
+ int flag, void *cb_data)
{
struct all_refs_cb *cb = cb_data;
cb->warned_bad_reflog = 0;
void add_reflogs_to_pending(struct rev_info *revs, unsigned flags)
{
struct all_refs_cb cb;
- struct each_ref_fn_sha1_adapter wrapped_handle_one_reflog =
- {handle_one_reflog, &cb};
cb.all_revs = revs;
cb.all_flags = flags;
- for_each_reflog(each_ref_fn_adapter, &wrapped_handle_one_reflog);
+ for_each_reflog(handle_one_reflog, &cb);
}
static void add_cache_tree(struct cache_tree *it, struct rev_info *revs,
ctx->argc -= n;
}
+static int for_each_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data, const char *term) {
+ struct strbuf bisect_refs = STRBUF_INIT;
+ int status;
+ strbuf_addf(&bisect_refs, "refs/bisect/%s", term);
+ status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, cb_data);
+ strbuf_release(&bisect_refs);
+ return status;
+}
+
static int for_each_bad_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data)
{
- return for_each_ref_in_submodule(submodule, "refs/bisect/bad", fn, cb_data);
+ return for_each_bisect_ref(submodule, fn, cb_data, term_bad);
}
static int for_each_good_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data)
{
- return for_each_ref_in_submodule(submodule, "refs/bisect/good", fn, cb_data);
+ return for_each_bisect_ref(submodule, fn, cb_data, term_good);
}
static int handle_revision_pseudo_opt(const char *submodule,
handle_refs(submodule, revs, *flags, for_each_branch_ref_submodule);
clear_ref_exclusion(&revs->ref_excludes);
} else if (!strcmp(arg, "--bisect")) {
+ read_bisect_terms(&term_bad, &term_good);
handle_refs(submodule, revs, *flags, for_each_bad_bisect_ref);
handle_refs(submodule, revs, *flags ^ (UNINTERESTING | BOTTOM), for_each_good_bisect_ref);
revs->bisect = 1;
clear_ref_exclusion(&revs->ref_excludes);
} else if ((argcount = parse_long_opt("glob", argv, &optarg))) {
struct all_refs_cb cb;
- struct each_ref_fn_sha1_adapter wrapped_handle_one_ref =
- {handle_one_ref, &cb};
-
init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref(each_ref_fn_adapter, optarg, &wrapped_handle_one_ref);
+ for_each_glob_ref(handle_one_ref, optarg, &cb);
clear_ref_exclusion(&revs->ref_excludes);
return argcount;
} else if ((argcount = parse_long_opt("exclude", argv, &optarg))) {
return argcount;
} else if (starts_with(arg, "--branches=")) {
struct all_refs_cb cb;
- struct each_ref_fn_sha1_adapter wrapped_handle_one_ref =
- {handle_one_ref, &cb};
-
init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(each_ref_fn_adapter, arg + 11, "refs/heads/",
- &wrapped_handle_one_ref);
+ for_each_glob_ref_in(handle_one_ref, arg + 11, "refs/heads/", &cb);
clear_ref_exclusion(&revs->ref_excludes);
} else if (starts_with(arg, "--tags=")) {
struct all_refs_cb cb;
- struct each_ref_fn_sha1_adapter wrapped_handle_one_ref =
- {handle_one_ref, &cb};
-
init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(each_ref_fn_adapter, arg + 7, "refs/tags/",
- &wrapped_handle_one_ref);
+ for_each_glob_ref_in(handle_one_ref, arg + 7, "refs/tags/", &cb);
clear_ref_exclusion(&revs->ref_excludes);
} else if (starts_with(arg, "--remotes=")) {
struct all_refs_cb cb;
- struct each_ref_fn_sha1_adapter wrapped_handle_one_ref =
- {handle_one_ref, &cb};
-
init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(each_ref_fn_adapter, arg + 10, "refs/remotes/",
- &wrapped_handle_one_ref);
+ for_each_glob_ref_in(handle_one_ref, arg + 10, "refs/remotes/", &cb);
clear_ref_exclusion(&revs->ref_excludes);
} else if (!strcmp(arg, "--reflog")) {
add_reflogs_to_pending(revs, *flags);