Merge branch 'nd/commit-util-to-slab'
The in-core "commit" object had an all-purpose "void *util" field, which was tricky to use especially in library-ish part of the code. All of the existing uses of the field has been migrated to a more dedicated "commit-slab" mechanism and the field is eliminated. * nd/commit-util-to-slab: commit.h: delete 'util' field in struct commit merge: use commit-slab in merge remote desc instead of commit->util log: use commit-slab in prepare_bases() instead of commit->util show-branch: note about its object flags usage show-branch: use commit-slab for commit-name instead of commit->util name-rev: use commit-slab for rev-name instead of commit->util bisect.c: use commit-slab for commit weight instead of commit->util revision.c: use commit-slab for show_source sequencer.c: use commit-slab to associate todo items to commits sequencer.c: use commit-slab to mark seen commits shallow.c: use commit-slab for commit depth instead of commit->util describe: use commit-slab for commit names instead of commit->util blame: use commit-slab for blame suspects instead of commit->util commit-slab: support shared commit-slab commit-slab.h: code split
This commit is contained in:
@ -28,6 +28,7 @@
|
||||
#include "mailmap.h"
|
||||
#include "gpg-interface.h"
|
||||
#include "progress.h"
|
||||
#include "commit-slab.h"
|
||||
|
||||
#define MAIL_DEFAULT_WRAP 72
|
||||
|
||||
@ -148,6 +149,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
|
||||
static struct string_list decorate_refs_include = STRING_LIST_INIT_NODUP;
|
||||
struct decoration_filter decoration_filter = {&decorate_refs_include,
|
||||
&decorate_refs_exclude};
|
||||
static struct revision_sources revision_sources;
|
||||
|
||||
const struct option builtin_log_options[] = {
|
||||
OPT__QUIET(&quiet, N_("suppress diff output")),
|
||||
@ -194,8 +196,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
|
||||
rev->diffopt.filter || rev->diffopt.flags.follow_renames)
|
||||
rev->always_show_header = 0;
|
||||
|
||||
if (source)
|
||||
rev->show_source = 1;
|
||||
if (source) {
|
||||
init_revision_sources(&revision_sources);
|
||||
rev->sources = &revision_sources;
|
||||
}
|
||||
|
||||
if (mailmap) {
|
||||
rev->mailmap = xcalloc(1, sizeof(struct string_list));
|
||||
@ -1337,6 +1341,8 @@ static struct commit *get_base_commit(const char *base_commit,
|
||||
return base;
|
||||
}
|
||||
|
||||
define_commit_slab(commit_base, int);
|
||||
|
||||
static void prepare_bases(struct base_tree_info *bases,
|
||||
struct commit *base,
|
||||
struct commit **list,
|
||||
@ -1345,11 +1351,13 @@ static void prepare_bases(struct base_tree_info *bases,
|
||||
struct commit *commit;
|
||||
struct rev_info revs;
|
||||
struct diff_options diffopt;
|
||||
struct commit_base commit_base;
|
||||
int i;
|
||||
|
||||
if (!base)
|
||||
return;
|
||||
|
||||
init_commit_base(&commit_base);
|
||||
diff_setup(&diffopt);
|
||||
diffopt.flags.recursive = 1;
|
||||
diff_setup_done(&diffopt);
|
||||
@ -1362,7 +1370,7 @@ static void prepare_bases(struct base_tree_info *bases,
|
||||
for (i = 0; i < total; i++) {
|
||||
list[i]->object.flags &= ~UNINTERESTING;
|
||||
add_pending_object(&revs, &list[i]->object, "rev_list");
|
||||
list[i]->util = (void *)1;
|
||||
*commit_base_at(&commit_base, list[i]) = 1;
|
||||
}
|
||||
base->object.flags |= UNINTERESTING;
|
||||
add_pending_object(&revs, &base->object, "base");
|
||||
@ -1376,7 +1384,7 @@ static void prepare_bases(struct base_tree_info *bases,
|
||||
while ((commit = get_revision(&revs)) != NULL) {
|
||||
struct object_id oid;
|
||||
struct object_id *patch_id;
|
||||
if (commit->util)
|
||||
if (*commit_base_at(&commit_base, commit))
|
||||
continue;
|
||||
if (commit_patch_id(commit, &diffopt, &oid, 0))
|
||||
die(_("cannot get patch id"));
|
||||
@ -1385,6 +1393,7 @@ static void prepare_bases(struct base_tree_info *bases,
|
||||
oidcpy(patch_id, &oid);
|
||||
bases->nr_patch_id++;
|
||||
}
|
||||
clear_commit_base(&commit_base);
|
||||
}
|
||||
|
||||
static void print_bases(struct base_tree_info *bases, FILE *file)
|
||||
|
Reference in New Issue
Block a user