remote: convert struct push_cas to struct object_id
This gets rid of one use of get_sha1. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Jul 13, 2017 at 23:49 UTC
b8566f8ff9773c1a3a7f47e9b205cd08b2ad6747
2 files changed
+4
-4
remote.c
+3
-3
@@ -2294,8 +2294,8 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i
2294
if (!*colon)
2295
entry->use_tracking = 1;
2296
else if (!colon[1])
2297
- hashclr(entry->expect);
2298
- else if (get_sha1(colon + 1, entry->expect))
2297
+ oidclr(&entry->expect);
2298
+ else if (get_oid(colon + 1, &entry->expect))
2299
return error("cannot parse expected object name '%s'", colon + 1);
2300
return 0;
2301
}
@@ -2342,7 +2342,7 @@ static void apply_cas(struct push_cas_option *cas,
2342
continue;
2343
ref->expect_old_sha1 = 1;
2344
if (!entry->use_tracking)
2345
- hashcpy(ref->old_oid_expect.hash, cas->entry[i].expect);
2345
+ oidcpy(&ref->old_oid_expect, &entry->expect);
2346
else if (remote_tracking(remote, ref->name, &ref->old_oid_expect))
2347
oidclr(&ref->old_oid_expect);
2348
return;
remote.h
+1
-1
@@ -282,7 +282,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
282
struct push_cas_option {
283
unsigned use_tracking_for_rest:1;
284
struct push_cas {
285
- unsigned char expect[20];
285
+ struct object_id expect;
286
unsigned use_tracking:1;
287
char *refname;
288
} *entry;