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 <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jacob Keller committed
Aug 31, 2016 at 16:27 UTC
602a283afb225ea094f4582e02e94cfd7f5cabf0
3 files changed
+10
-10
diff.c
+1
-1
@@ -2307,7 +2307,7 @@ static void builtin_diff(const char *name_a,
2307
const char *add = diff_get_color_opt(o, DIFF_FILE_NEW);
2308
show_submodule_summary(o->file, one->path ? one->path : two->path,
2309
line_prefix,
2310
- one->oid.hash, two->oid.hash,
2310
+ &one->oid, &two->oid,
2311
two->dirty_submodule,
2312
meta, del, add, reset);
2313
return;
submodule.c
+8
-8
@@ -337,7 +337,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,
337
338
void show_submodule_summary(FILE *f, const char *path,
339
const char *line_prefix,
340
- unsigned char one[20], unsigned char two[20],
340
+ struct object_id *one, struct object_id *two,
341
unsigned dirty_submodule, const char *meta,
342
const char *del, const char *add, const char *reset)
343
{
@@ -347,14 +347,14 @@ void show_submodule_summary(FILE *f, const char *path,
347
struct strbuf sb = STRBUF_INIT;
348
int fast_forward = 0, fast_backward = 0;
349
350
- if (is_null_sha1(two))
350
+ if (is_null_oid(two))
351
message = "(submodule deleted)";
352
else if (add_submodule_odb(path))
353
message = "(not initialized)";
354
- else if (is_null_sha1(one))
354
+ else if (is_null_oid(one))
355
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)))
358
message = "(commits not present)";
359
else if (prepare_submodule_summary(&rev, path, left, right,
360
&fast_forward, &fast_backward))
@@ -367,16 +367,16 @@ void show_submodule_summary(FILE *f, const char *path,
367
fprintf(f, "%sSubmodule %s contains modified content\n",
368
line_prefix, path);
369
370
- if (!hashcmp(one, two)) {
370
+ if (!oidcmp(one, two)) {
371
strbuf_release(&sb);
372
return;
373
}
374
375
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));
377
if (!fast_backward && !fast_forward)
378
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));
380
if (message)
381
strbuf_addf(&sb, " %s%s\n", message, reset);
382
else
submodule.h
+1
-1
@@ -43,7 +43,7 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy
43
void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);
44
void show_submodule_summary(FILE *f, const char *path,
45
const char *line_prefix,
46
- unsigned char one[20], unsigned char two[20],
46
+ struct object_id *one, struct object_id *two,
47
unsigned dirty_submodule, const char *meta,
48
const char *del, const char *add, const char *reset);
49
void set_config_fetch_recurse_submodules(int value);