coccinelle: apply object_id Coccinelle transformations
Apply the set of semantic patches from contrib/coccinelle to convert some leftover places using struct object_id's hash member to instead use the wrapper functions that take struct object_id natively. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Jun 24, 2016 at 23:09 UTC
c368dde9245fa3d50b7e01e1ff4f9e5c12c718da
3 files changed
+9
-10
bisect.c
+1
-1
@@ -754,7 +754,7 @@ static void handle_bad_merge_base(void)
754
static void handle_skipped_merge_base(const unsigned char *mb)
755
{
756
char *mb_hex = sha1_to_hex(mb);
757
- char *bad_hex = sha1_to_hex(current_bad_oid->hash);
757
+ char *bad_hex = oid_to_hex(current_bad_oid);
758
char *good_hex = join_sha1_array_hex(&good_revs, ' ');
759
760
warning("the merge base between %s and [%s] "
builtin/merge.c
+6
-7
@@ -501,7 +501,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
501
if (ref_exists(truname.buf)) {
502
strbuf_addf(msg,
503
"%s\t\tbranch '%s'%s of .\n",
504
- sha1_to_hex(remote_head->object.oid.hash),
504
+ oid_to_hex(&remote_head->object.oid),
505
truname.buf + 11,
506
(early ? " (early part)" : ""));
507
strbuf_release(&truname);
@@ -515,7 +515,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
515
desc = merge_remote_util(remote_head);
516
if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
517
strbuf_addf(msg, "%s\t\t%s '%s'\n",
518
- sha1_to_hex(desc->obj->oid.hash),
518
+ oid_to_hex(&desc->obj->oid),
519
typename(desc->obj->type),
520
remote);
521
goto cleanup;
@@ -523,7 +523,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
523
}
524
525
strbuf_addf(msg, "%s\t\tcommit '%s'\n",
526
- sha1_to_hex(remote_head->object.oid.hash), remote);
526
+ oid_to_hex(&remote_head->object.oid), remote);
527
cleanup:
528
strbuf_release(&buf);
529
strbuf_release(&bname);
@@ -1366,7 +1366,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1366
for (p = remoteheads; p; p = p->next) {
1367
struct commit *commit = p->item;
1368
strbuf_addf(&buf, "GITHEAD_%s",
1369
- sha1_to_hex(commit->object.oid.hash));
1369
+ oid_to_hex(&commit->object.oid));
1370
setenv(buf.buf, merge_remote_util(commit)->name, 1);
1371
strbuf_reset(&buf);
1372
if (fast_forward != FF_ONLY &&
@@ -1425,7 +1425,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1425
goto done;
1426
} else if (fast_forward != FF_NO && !remoteheads->next &&
1427
!common->next &&
1428
- !hashcmp(common->item->object.oid.hash, head_commit->object.oid.hash)) {
1428
+ !oidcmp(&common->item->object.oid, &head_commit->object.oid)) {
1429
/* Again the most common case of merging one remote. */
1430
struct strbuf msg = STRBUF_INIT;
1431
struct commit *commit;
@@ -1499,8 +1499,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1499
* HEAD^^" would be missed.
1500
*/
1501
common_one = get_merge_bases(head_commit, j->item);
1502
- if (hashcmp(common_one->item->object.oid.hash,
1503
- j->item->object.oid.hash)) {
1502
+ if (oidcmp(&common_one->item->object.oid, &j->item->object.oid)) {
1503
up_to_date = 0;
1504
break;
1505
}
refs/files-backend.c
+2
-2
@@ -1725,14 +1725,14 @@ static int verify_lock(struct ref_lock *lock,
1725
errno = save_errno;
1726
return -1;
1727
} else {
1728
- hashclr(lock->old_oid.hash);
1728
+ oidclr(&lock->old_oid);
1729
return 0;
1730
}
1731
}
1732
if (old_sha1 && hashcmp(lock->old_oid.hash, old_sha1)) {
1733
strbuf_addf(err, "ref %s is at %s but expected %s",
1734
lock->ref_name,
1735
- sha1_to_hex(lock->old_oid.hash),
1735
+ oid_to_hex(&lock->old_oid),
1736
sha1_to_hex(old_sha1));
1737
errno = EBUSY;
1738
return -1;