Skip to content

Commit fc06be3

Browse files
bk2204gitster
authored andcommitted
builtin/receive-pack: replace sha1_to_hex
Since sha1_to_hex is limited to SHA-1, replace it with hash_to_hex. Rename several variables to indicate that they can contain any hash. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 69fa337 commit fc06be3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

builtin/receive-pack.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp)
466466
strbuf_release(&buf);
467467

468468
/* RFC 2104 5. HMAC-SHA1-80 */
469-
strbuf_addf(&buf, "%"PRItime"-%.*s", stamp, (int)the_hash_algo->hexsz, sha1_to_hex(hash));
469+
strbuf_addf(&buf, "%"PRItime"-%.*s", stamp, (int)the_hash_algo->hexsz, hash_to_hex(hash));
470470
return strbuf_detach(&buf, NULL);
471471
}
472472

@@ -968,7 +968,7 @@ static const char *push_to_deploy(unsigned char *sha1,
968968
if (run_command(&child))
969969
return "Working directory has staged changes";
970970

971-
read_tree[3] = sha1_to_hex(sha1);
971+
read_tree[3] = hash_to_hex(sha1);
972972
child_process_init(&child);
973973
child.argv = read_tree;
974974
child.env = env->argv;
@@ -985,13 +985,13 @@ static const char *push_to_deploy(unsigned char *sha1,
985985

986986
static const char *push_to_checkout_hook = "push-to-checkout";
987987

988-
static const char *push_to_checkout(unsigned char *sha1,
988+
static const char *push_to_checkout(unsigned char *hash,
989989
struct argv_array *env,
990990
const char *work_tree)
991991
{
992992
argv_array_pushf(env, "GIT_WORK_TREE=%s", absolute_path(work_tree));
993993
if (run_hook_le(env->argv, push_to_checkout_hook,
994-
sha1_to_hex(sha1), NULL))
994+
hash_to_hex(hash), NULL))
995995
return "push-to-checkout hook declined";
996996
else
997997
return NULL;

0 commit comments

Comments
 (0)