]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule: avoid hard-coded constants
authorbrian m. carlson <sandals@crustytoothpaste.net>
Tue, 19 Feb 2019 00:04:59 +0000 (00:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Apr 2019 02:57:37 +0000 (11:57 +0900)
Instead of using hard-coded 40-based constants, express these values in
terms of the_hash_algo and GIT_MAX_HEXSZ.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c
submodule.c

index 6c40c61c4728d9224006768599d7bf2ded744bb1..6126773a7bfbd21ef38471d69d36b262e50a4050 100644 (file)
@@ -1122,7 +1122,7 @@ static int find_first_merges(struct repository *repo,
        struct commit *commit;
        int contains_another;
 
-       char merged_revision[42];
+       char merged_revision[GIT_MAX_HEXSZ + 2];
        const char *rev_args[] = { "rev-list", "--merges", "--ancestry-path",
                                   "--all", merged_revision, NULL };
        struct rev_info revs;
index 21cf50ca15e124edb67b4aa76ae87577816eb1a5..150d95589949addfe06af32564748e5b4f1346c6 100644 (file)
@@ -994,7 +994,7 @@ static int submodule_needs_pushing(struct repository *r,
                if (start_command(&cp))
                        die("Could not run 'git rev-list <commits> --not --remotes -n 1' command in submodule %s",
                                        path);
-               if (strbuf_read(&buf, cp.out, 41))
+               if (strbuf_read(&buf, cp.out, the_hash_algo->hexsz + 1))
                        needs_pushing = 1;
                finish_command(&cp);
                close(cp.out);