Skip to content

Commit 602a283

Browse files
jacob-kellergitster
authored andcommitted
submodule: convert show_submodule_summary to use struct object_id *
Since we're going to be changing this function in a future patch, lets go ahead and convert this to use object_id now. Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 99b43a6 commit 602a283

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2307,7 +2307,7 @@ static void builtin_diff(const char *name_a,
23072307
const char *add = diff_get_color_opt(o, DIFF_FILE_NEW);
23082308
show_submodule_summary(o->file, one->path ? one->path : two->path,
23092309
line_prefix,
2310-
one->oid.hash, two->oid.hash,
2310+
&one->oid, &two->oid,
23112311
two->dirty_submodule,
23122312
meta, del, add, reset);
23132313
return;

submodule.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,
337337

338338
void show_submodule_summary(FILE *f, const char *path,
339339
const char *line_prefix,
340-
unsigned char one[20], unsigned char two[20],
340+
struct object_id *one, struct object_id *two,
341341
unsigned dirty_submodule, const char *meta,
342342
const char *del, const char *add, const char *reset)
343343
{
@@ -347,14 +347,14 @@ void show_submodule_summary(FILE *f, const char *path,
347347
struct strbuf sb = STRBUF_INIT;
348348
int fast_forward = 0, fast_backward = 0;
349349

350-
if (is_null_sha1(two))
350+
if (is_null_oid(two))
351351
message = "(submodule deleted)";
352352
else if (add_submodule_odb(path))
353353
message = "(not initialized)";
354-
else if (is_null_sha1(one))
354+
else if (is_null_oid(one))
355355
message = "(new submodule)";
356-
else if (!(left = lookup_commit_reference(one)) ||
357-
!(right = lookup_commit_reference(two)))
356+
else if (!(left = lookup_commit_reference(one->hash)) ||
357+
!(right = lookup_commit_reference(two->hash)))
358358
message = "(commits not present)";
359359
else if (prepare_submodule_summary(&rev, path, left, right,
360360
&fast_forward, &fast_backward))
@@ -367,16 +367,16 @@ void show_submodule_summary(FILE *f, const char *path,
367367
fprintf(f, "%sSubmodule %s contains modified content\n",
368368
line_prefix, path);
369369

370-
if (!hashcmp(one, two)) {
370+
if (!oidcmp(one, two)) {
371371
strbuf_release(&sb);
372372
return;
373373
}
374374

375375
strbuf_addf(&sb, "%s%sSubmodule %s %s..", line_prefix, meta, path,
376-
find_unique_abbrev(one, DEFAULT_ABBREV));
376+
find_unique_abbrev(one->hash, DEFAULT_ABBREV));
377377
if (!fast_backward && !fast_forward)
378378
strbuf_addch(&sb, '.');
379-
strbuf_addf(&sb, "%s", find_unique_abbrev(two, DEFAULT_ABBREV));
379+
strbuf_addf(&sb, "%s", find_unique_abbrev(two->hash, DEFAULT_ABBREV));
380380
if (message)
381381
strbuf_addf(&sb, " %s%s\n", message, reset);
382382
else

submodule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy
4343
void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);
4444
void show_submodule_summary(FILE *f, const char *path,
4545
const char *line_prefix,
46-
unsigned char one[20], unsigned char two[20],
46+
struct object_id *one, struct object_id *two,
4747
unsigned dirty_submodule, const char *meta,
4848
const char *del, const char *add, const char *reset);
4949
void set_config_fetch_recurse_submodules(int value);

0 commit comments

Comments
 (0)