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>
This commit is contained in:
parent
99b43a61f2
commit
602a283afb
2
diff.c
2
diff.c
@ -2307,7 +2307,7 @@ static void builtin_diff(const char *name_a,
|
|||||||
const char *add = diff_get_color_opt(o, DIFF_FILE_NEW);
|
const char *add = diff_get_color_opt(o, DIFF_FILE_NEW);
|
||||||
show_submodule_summary(o->file, one->path ? one->path : two->path,
|
show_submodule_summary(o->file, one->path ? one->path : two->path,
|
||||||
line_prefix,
|
line_prefix,
|
||||||
one->oid.hash, two->oid.hash,
|
&one->oid, &two->oid,
|
||||||
two->dirty_submodule,
|
two->dirty_submodule,
|
||||||
meta, del, add, reset);
|
meta, del, add, reset);
|
||||||
return;
|
return;
|
||||||
|
16
submodule.c
16
submodule.c
@ -337,7 +337,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,
|
|||||||
|
|
||||||
void show_submodule_summary(FILE *f, const char *path,
|
void show_submodule_summary(FILE *f, const char *path,
|
||||||
const char *line_prefix,
|
const char *line_prefix,
|
||||||
unsigned char one[20], unsigned char two[20],
|
struct object_id *one, struct object_id *two,
|
||||||
unsigned dirty_submodule, const char *meta,
|
unsigned dirty_submodule, const char *meta,
|
||||||
const char *del, const char *add, const char *reset)
|
const char *del, const char *add, const char *reset)
|
||||||
{
|
{
|
||||||
@ -347,14 +347,14 @@ void show_submodule_summary(FILE *f, const char *path,
|
|||||||
struct strbuf sb = STRBUF_INIT;
|
struct strbuf sb = STRBUF_INIT;
|
||||||
int fast_forward = 0, fast_backward = 0;
|
int fast_forward = 0, fast_backward = 0;
|
||||||
|
|
||||||
if (is_null_sha1(two))
|
if (is_null_oid(two))
|
||||||
message = "(submodule deleted)";
|
message = "(submodule deleted)";
|
||||||
else if (add_submodule_odb(path))
|
else if (add_submodule_odb(path))
|
||||||
message = "(not initialized)";
|
message = "(not initialized)";
|
||||||
else if (is_null_sha1(one))
|
else if (is_null_oid(one))
|
||||||
message = "(new submodule)";
|
message = "(new submodule)";
|
||||||
else if (!(left = lookup_commit_reference(one)) ||
|
else if (!(left = lookup_commit_reference(one->hash)) ||
|
||||||
!(right = lookup_commit_reference(two)))
|
!(right = lookup_commit_reference(two->hash)))
|
||||||
message = "(commits not present)";
|
message = "(commits not present)";
|
||||||
else if (prepare_submodule_summary(&rev, path, left, right,
|
else if (prepare_submodule_summary(&rev, path, left, right,
|
||||||
&fast_forward, &fast_backward))
|
&fast_forward, &fast_backward))
|
||||||
@ -367,16 +367,16 @@ void show_submodule_summary(FILE *f, const char *path,
|
|||||||
fprintf(f, "%sSubmodule %s contains modified content\n",
|
fprintf(f, "%sSubmodule %s contains modified content\n",
|
||||||
line_prefix, path);
|
line_prefix, path);
|
||||||
|
|
||||||
if (!hashcmp(one, two)) {
|
if (!oidcmp(one, two)) {
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addf(&sb, "%s%sSubmodule %s %s..", line_prefix, meta, path,
|
strbuf_addf(&sb, "%s%sSubmodule %s %s..", line_prefix, meta, path,
|
||||||
find_unique_abbrev(one, DEFAULT_ABBREV));
|
find_unique_abbrev(one->hash, DEFAULT_ABBREV));
|
||||||
if (!fast_backward && !fast_forward)
|
if (!fast_backward && !fast_forward)
|
||||||
strbuf_addch(&sb, '.');
|
strbuf_addch(&sb, '.');
|
||||||
strbuf_addf(&sb, "%s", find_unique_abbrev(two, DEFAULT_ABBREV));
|
strbuf_addf(&sb, "%s", find_unique_abbrev(two->hash, DEFAULT_ABBREV));
|
||||||
if (message)
|
if (message)
|
||||||
strbuf_addf(&sb, " %s%s\n", message, reset);
|
strbuf_addf(&sb, " %s%s\n", message, reset);
|
||||||
else
|
else
|
||||||
|
@ -43,7 +43,7 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy
|
|||||||
void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);
|
void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);
|
||||||
void show_submodule_summary(FILE *f, const char *path,
|
void show_submodule_summary(FILE *f, const char *path,
|
||||||
const char *line_prefix,
|
const char *line_prefix,
|
||||||
unsigned char one[20], unsigned char two[20],
|
struct object_id *one, struct object_id *two,
|
||||||
unsigned dirty_submodule, const char *meta,
|
unsigned dirty_submodule, const char *meta,
|
||||||
const char *del, const char *add, const char *reset);
|
const char *del, const char *add, const char *reset);
|
||||||
void set_config_fetch_recurse_submodules(int value);
|
void set_config_fetch_recurse_submodules(int value);
|
||||||
|
Loading…
Reference in New Issue
Block a user