Skip to content

Commit 7b680d3

Browse files
pcloudsgitster
authored andcommitted
log: use commit-slab in prepare_bases() instead of commit->util
It's done so that commit->util can be removed. See more explanation in the commit that removes commit->util. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 44cecbf commit 7b680d3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

builtin/log.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "mailmap.h"
2929
#include "gpg-interface.h"
3030
#include "progress.h"
31+
#include "commit-slab.h"
3132

3233
#define MAIL_DEFAULT_WRAP 72
3334

@@ -1340,6 +1341,8 @@ static struct commit *get_base_commit(const char *base_commit,
13401341
return base;
13411342
}
13421343

1344+
define_commit_slab(commit_base, int);
1345+
13431346
static void prepare_bases(struct base_tree_info *bases,
13441347
struct commit *base,
13451348
struct commit **list,
@@ -1348,11 +1351,13 @@ static void prepare_bases(struct base_tree_info *bases,
13481351
struct commit *commit;
13491352
struct rev_info revs;
13501353
struct diff_options diffopt;
1354+
struct commit_base commit_base;
13511355
int i;
13521356

13531357
if (!base)
13541358
return;
13551359

1360+
init_commit_base(&commit_base);
13561361
diff_setup(&diffopt);
13571362
diffopt.flags.recursive = 1;
13581363
diff_setup_done(&diffopt);
@@ -1365,7 +1370,7 @@ static void prepare_bases(struct base_tree_info *bases,
13651370
for (i = 0; i < total; i++) {
13661371
list[i]->object.flags &= ~UNINTERESTING;
13671372
add_pending_object(&revs, &list[i]->object, "rev_list");
1368-
list[i]->util = (void *)1;
1373+
*commit_base_at(&commit_base, list[i]) = 1;
13691374
}
13701375
base->object.flags |= UNINTERESTING;
13711376
add_pending_object(&revs, &base->object, "base");
@@ -1379,7 +1384,7 @@ static void prepare_bases(struct base_tree_info *bases,
13791384
while ((commit = get_revision(&revs)) != NULL) {
13801385
struct object_id oid;
13811386
struct object_id *patch_id;
1382-
if (commit->util)
1387+
if (*commit_base_at(&commit_base, commit))
13831388
continue;
13841389
if (commit_patch_id(commit, &diffopt, &oid, 0))
13851390
die(_("cannot get patch id"));
@@ -1388,6 +1393,7 @@ static void prepare_bases(struct base_tree_info *bases,
13881393
oidcpy(patch_id, &oid);
13891394
bases->nr_patch_id++;
13901395
}
1396+
clear_commit_base(&commit_base);
13911397
}
13921398

13931399
static void print_bases(struct base_tree_info *bases, FILE *file)

0 commit comments

Comments
 (0)