summaryrefslogtreecommitdiff
path: root/contrib/coccinelle
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2019-01-07 03:37:54 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-01-08 09:41:06 -0800
commit98374a07c98d1acc200c423b87495365a59cce0b (patch)
tree5d13cd44abc62bd17672bd00a7e8c28a198f5346 /contrib/coccinelle
parentsha1-file: convert pass-through functions to object_id (diff)
downloadtgif-98374a07c98d1acc200c423b87495365a59cce0b.tar.xz
convert has_sha1_file() callers to has_object_file()
The only remaining callers of has_sha1_file() actually have an object_id already. They can use the "object" variant, rather than dereferencing the hash themselves. The code changes here were completely generated by the included coccinelle patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/coccinelle')
-rw-r--r--contrib/coccinelle/object_id.cocci32
1 files changed, 32 insertions, 0 deletions
diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci
index 6a7cf3e02d..73886ae583 100644
--- a/contrib/coccinelle/object_id.cocci
+++ b/contrib/coccinelle/object_id.cocci
@@ -147,3 +147,35 @@ expression E1, E2;
- hashcmp(E1, E2) != 0
+ !hasheq(E1, E2)
...>}
+
+@@
+struct object_id OID;
+@@
+- has_sha1_file(OID.hash)
++ has_object_file(&OID)
+
+@@
+identifier f != has_object_file;
+struct object_id *OIDPTR;
+@@
+ f(...) {<...
+- has_sha1_file(OIDPTR->hash)
++ has_object_file(OIDPTR)
+ ...>}
+
+@@
+struct object_id OID;
+expression E;
+@@
+- has_sha1_file_with_flags(OID.hash, E)
++ has_object_file_with_flags(&OID, E)
+
+@@
+identifier f != has_object_file_with_flags;
+struct object_id *OIDPTR;
+expression E;
+@@
+ f(...) {<...
+- has_sha1_file_with_flags(OIDPTR->hash, E)
++ has_object_file_with_flags(OIDPTR, E)
+ ...>}