summaryrefslogtreecommitdiff
path: root/notes-merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-09-17 20:53:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-17 20:53:57 (GMT)
commit769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3 (patch)
tree524c7d9759fb9deae7b82581aa28fc8bc38265f6 /notes-merge.c
parentd88949d86eddb62acbc85c16c97587db043d05b1 (diff)
parentd9f62dfa0ddc31bdad93054acca9fd42ca781f7f (diff)
downloadgit-769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3.zip
git-769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3.tar.gz
git-769af0fd9ea0b4de172b51ae4b9ea41b57c02fd3.tar.bz2
Merge branch 'jk/cocci'
spatch transformation to replace boolean uses of !hashcmp() to newly introduced oideq() is added, and applied, to regain performance lost due to support of multiple hash algorithms. * jk/cocci: show_dirstat: simplify same-content check read-cache: use oideq() in ce_compare functions convert hashmap comparison functions to oideq() convert "hashcmp() != 0" to "!hasheq()" convert "oidcmp() != 0" to "!oideq()" convert "hashcmp() == 0" to hasheq() convert "oidcmp() == 0" to oideq() introduce hasheq() and oideq() coccinelle: use <...> for function exclusion
Diffstat (limited to 'notes-merge.c')
-rw-r--r--notes-merge.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/notes-merge.c b/notes-merge.c
index 12dfdf6..5764e2b 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -152,7 +152,7 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
mp = find_notes_merge_pair_pos(changes, len, &obj, 1, &occupied);
if (occupied) {
/* We've found an addition/deletion pair */
- assert(!oidcmp(&mp->obj, &obj));
+ assert(oideq(&mp->obj, &obj));
if (is_null_oid(&p->one->oid)) { /* addition */
assert(is_null_oid(&mp->remote));
oidcpy(&mp->remote, &p->two->oid);
@@ -219,7 +219,7 @@ static void diff_tree_local(struct notes_merge_options *o,
continue;
}
- assert(!oidcmp(&mp->obj, &obj));
+ assert(oideq(&mp->obj, &obj));
if (is_null_oid(&p->two->oid)) { /* deletion */
/*
* Either this is a true deletion (1), or it is part
@@ -230,7 +230,7 @@ static void diff_tree_local(struct notes_merge_options *o,
* (3) mp->local is uninitialized; set it to null_sha1
* (will be overwritten by following addition)
*/
- if (!oidcmp(&mp->local, &uninitialized))
+ if (oideq(&mp->local, &uninitialized))
oidclr(&mp->local);
} else if (is_null_oid(&p->one->oid)) { /* addition */
/*
@@ -242,7 +242,7 @@ static void diff_tree_local(struct notes_merge_options *o,
* (3) mp->local is null_sha1; set to p->two->sha1
*/
assert(is_null_oid(&mp->local) ||
- !oidcmp(&mp->local, &uninitialized));
+ oideq(&mp->local, &uninitialized));
oidcpy(&mp->local, &p->two->oid);
} else { /* modification */
/*
@@ -250,8 +250,8 @@ static void diff_tree_local(struct notes_merge_options *o,
* match mp->base, and mp->local shall be uninitialized.
* Set mp->local to p->two->sha1.
*/
- assert(!oidcmp(&p->one->oid, &mp->base));
- assert(!oidcmp(&mp->local, &uninitialized));
+ assert(oideq(&p->one->oid, &mp->base));
+ assert(oideq(&mp->local, &uninitialized));
oidcpy(&mp->local, &p->two->oid);
}
trace_printf("\t\tStored local change for %s: %.7s -> %.7s\n",
@@ -481,14 +481,14 @@ static int merge_changes(struct notes_merge_options *o,
oid_to_hex(&p->local),
oid_to_hex(&p->remote));
- if (!oidcmp(&p->base, &p->remote)) {
+ if (oideq(&p->base, &p->remote)) {
/* no remote change; nothing to do */
trace_printf("\t\t\tskipping (no remote change)\n");
- } else if (!oidcmp(&p->local, &p->remote)) {
+ } else if (oideq(&p->local, &p->remote)) {
/* same change in local and remote; nothing to do */
trace_printf("\t\t\tskipping (local == remote)\n");
- } else if (!oidcmp(&p->local, &uninitialized) ||
- !oidcmp(&p->local, &p->base)) {
+ } else if (oideq(&p->local, &uninitialized) ||
+ oideq(&p->local, &p->base)) {
/* no local change; adopt remote change */
trace_printf("\t\t\tno local change, adopted remote\n");
if (add_note(t, &p->obj, &p->remote,
@@ -622,14 +622,14 @@ int notes_merge(struct notes_merge_options *o,
oid_to_hex(&local->object.oid),
oid_to_hex(base_oid));
- if (!oidcmp(&remote->object.oid, base_oid)) {
+ if (oideq(&remote->object.oid, base_oid)) {
/* Already merged; result == local commit */
if (o->verbosity >= 2)
printf("Already up to date!\n");
oidcpy(result_oid, &local->object.oid);
goto found_result;
}
- if (!oidcmp(&local->object.oid, base_oid)) {
+ if (oideq(&local->object.oid, base_oid)) {
/* Fast-forward; result == remote commit */
if (o->verbosity >= 2)
printf("Fast-forward\n");