]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule: convert show_submodule_summary to use struct object_id *
authorJacob Keller <jacob.keller@gmail.com>
Wed, 31 Aug 2016 23:27:23 +0000 (16:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Sep 2016 01:07:10 +0000 (18:07 -0700)
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>
diff.c
submodule.c
submodule.h

diff --git a/diff.c b/diff.c
index 1380bbe250ad333a68f267a2fa3e345233fd0e1b..a74e6e06dfb6dba3af802a1c747e23d2b7e0f8fd 100644 (file)
--- a/diff.c
+++ b/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);
                show_submodule_summary(o->file, one->path ? one->path : two->path,
                                line_prefix,
-                               one->oid.hash, two->oid.hash,
+                               &one->oid, &two->oid,
                                two->dirty_submodule,
                                meta, del, add, reset);
                return;
index 6096cf428be72289c193eff82ba318c16c58ccee..7cb236b0a108a5e87f75b0be12e998897b8017a1 100644 (file)
@@ -337,7 +337,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,
 
 void show_submodule_summary(FILE *f, const char *path,
                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,
                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;
        int fast_forward = 0, fast_backward = 0;
 
-       if (is_null_sha1(two))
+       if (is_null_oid(two))
                message = "(submodule deleted)";
        else if (add_submodule_odb(path))
                message = "(not initialized)";
-       else if (is_null_sha1(one))
+       else if (is_null_oid(one))
                message = "(new submodule)";
-       else if (!(left = lookup_commit_reference(one)) ||
-                !(right = lookup_commit_reference(two)))
+       else if (!(left = lookup_commit_reference(one->hash)) ||
+                !(right = lookup_commit_reference(two->hash)))
                message = "(commits not present)";
        else if (prepare_submodule_summary(&rev, path, left, right,
                                           &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",
                        line_prefix, path);
 
-       if (!hashcmp(one, two)) {
+       if (!oidcmp(one, two)) {
                strbuf_release(&sb);
                return;
        }
 
        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)
                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)
                strbuf_addf(&sb, " %s%s\n", message, reset);
        else
index 2af9390998194c7d51a3e23b14723574d6696926..d83df57e24ff310d734655fe995fdf0cfef9564c 100644 (file)
@@ -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 show_submodule_summary(FILE *f, const char *path,
                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,
                const char *del, const char *add, const char *reset);
 void set_config_fetch_recurse_submodules(int value);