From 15beaaa3d1f6b555900446deb5e376b4f806d734 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 5 Nov 2019 17:07:23 +0000 Subject: Fix spelling errors in code comments Reported-by: Jens Schleusener Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- contrib/coccinelle/commit.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/coccinelle') diff --git a/contrib/coccinelle/commit.cocci b/contrib/coccinelle/commit.cocci index d03453341e..778e4704f6 100644 --- a/contrib/coccinelle/commit.cocci +++ b/contrib/coccinelle/commit.cocci @@ -20,7 +20,7 @@ expression s; + set_commit_tree(c, s) ...>} -// These excluded functions must access c->maybe_tree direcly. +// These excluded functions must access c->maybe_tree directly. // Note that if c->maybe_tree is written somewhere outside of these // functions, then the recommended transformation will be bogus with // repo_get_commit_tree() on the LHS. -- cgit v1.2.3 From aa6d7f93edc39361c926e1748fbee3b4243808f8 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 11 Nov 2019 04:04:11 -0500 Subject: hex: drop sha1_to_hex_r() There are no callers left; everybody uses oid_to_hex_r() or hash_to_hex_algop_r(). This used to actually be the underlying implementation for oid_to_hex_r(), but that's no longer the case since 47edb64997 (hex: introduce functions to print arbitrary hashes, 2018-11-14). Let's get rid of it to de-clutter and to make sure nobody uses it. Likewise we can drop the coccinelle rules that mention it, since the compiler will make it quite clear that the code does not work. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- contrib/coccinelle/object_id.cocci | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'contrib/coccinelle') diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci index 3e536a9834..6c0d21d8e2 100644 --- a/contrib/coccinelle/object_id.cocci +++ b/contrib/coccinelle/object_id.cocci @@ -25,23 +25,6 @@ struct object_id *OIDPTR; + oid_to_hex(OIDPTR) ...>} -@@ -expression E; -struct object_id OID; -@@ -- sha1_to_hex_r(E, OID.hash) -+ oid_to_hex_r(E, &OID) - -@@ -identifier f != oid_to_hex_r; -expression E; -struct object_id *OIDPTR; -@@ - f(...) {<... -- sha1_to_hex_r(E, OIDPTR->hash) -+ oid_to_hex_r(E, OIDPTR) - ...>} - @@ struct object_id OID; @@ -- cgit v1.2.3 From b19f3fe9dd1a0c00fb8b30df9896912727f2eea2 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 11 Nov 2019 04:04:18 -0500 Subject: hex: drop sha1_to_hex() There's only a single caller left of sha1_to_hex(), since everybody that has an object name in "unsigned char[]" now uses hash_to_hex() instead. This case is in the sha1dc wrapper, where we print a hex sha1 when we find a collision. This one will always be sha1, regardless of the current hash algorithm, so we can't use hash_to_hex() here. In practice we'd probably not be running sha1 at all if it isn't the current algorithm, but it's possible we might still occasionally need to compute a sha1 in a post-sha256 world. Since sha1_to_hex() is just a wrapper for hash_to_hex_algop(), let's call that ourselves. There's value in getting rid of the sha1-specific wrapper to de-clutter the global namespace, and to make sure nobody uses it (and as with sha1_to_hex_r() in the previous patch, we'll drop the coccinelle transformations, too). The sha1_to_hex() function is mentioned in a comment; we can easily swap that out for oid_to_hex() to give a better example. Also update the comment that was left stale when we added "struct object_id *" as a way to name an object and added functions to convert it to hex. The function is also mentioned in some test vectors in t4100, but that's not runnable code, so there's no point in trying to clean it up. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- contrib/coccinelle/object_id.cocci | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'contrib/coccinelle') diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci index 6c0d21d8e2..ddf4f22bd7 100644 --- a/contrib/coccinelle/object_id.cocci +++ b/contrib/coccinelle/object_id.cocci @@ -10,21 +10,6 @@ struct object_id *OIDPTR; - is_null_sha1(OIDPTR->hash) + is_null_oid(OIDPTR) -@@ -struct object_id OID; -@@ -- sha1_to_hex(OID.hash) -+ oid_to_hex(&OID) - -@@ -identifier f != oid_to_hex; -struct object_id *OIDPTR; -@@ - f(...) {<... -- sha1_to_hex(OIDPTR->hash) -+ oid_to_hex(OIDPTR) - ...>} - @@ struct object_id OID; @@ -- cgit v1.2.3