Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
fetch-pack: factor out is_unmatched_ref()
author
René Scharfe
<l.s.r@web.de>
Thu, 4 Oct 2018 15:09:06 +0000
(17:09 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 4 Oct 2018 18:12:13 +0000
(11:12 -0700)
Move the code to determine if a request is unmatched to its own little
helper. This allows us to reuse it in a subsequent patch.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch-pack.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
fe8321e
)
diff --git
a/fetch-pack.c
b/fetch-pack.c
index 75047a4b2a491e805f7c500dc804e78a8538bfa2..3b317952f0367d1e3c70a96cb4079649645af8e5 100644
(file)
--- a/
fetch-pack.c
+++ b/
fetch-pack.c
@@
-543,6
+543,16
@@
static int tip_oids_contain(struct oidset *tip_oids,
return oidset_contains(tip_oids, id);
}
return oidset_contains(tip_oids, id);
}
+static int is_unmatched_ref(const struct ref *ref)
+{
+ struct object_id oid;
+ const char *p;
+ return ref->match_status == REF_NOT_MATCHED &&
+ !parse_oid_hex(ref->name, &oid, &p) &&
+ *p == '\0' &&
+ oideq(&oid, &ref->old_oid);
+}
+
static void filter_refs(struct fetch_pack_args *args,
struct ref **refs,
struct ref **sought, int nr_sought)
static void filter_refs(struct fetch_pack_args *args,
struct ref **refs,
struct ref **sought, int nr_sought)
@@
-591,15
+601,8
@@
static void filter_refs(struct fetch_pack_args *args,
/* Append unmatched requests to the list */
for (i = 0; i < nr_sought; i++) {
/* Append unmatched requests to the list */
for (i = 0; i < nr_sought; i++) {
- struct object_id oid;
- const char *p;
-
ref = sought[i];
ref = sought[i];
- if (ref->match_status != REF_NOT_MATCHED)
- continue;
- if (parse_oid_hex(ref->name, &oid, &p) ||
- *p != '\0' ||
- !oideq(&oid, &ref->old_oid))
+ if (!is_unmatched_ref(ref))
continue;
if ((allow_unadvertised_object_request &
continue;
if ((allow_unadvertised_object_request &