MCPcopy Create free account
hub / github.com/git/git / check_non_tip

Function check_non_tip

upload-pack.c:792–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

790}
791
792static void check_non_tip(struct upload_pack_data *data)
793{
794 int i;
795
796 /*
797 * In the normal in-process case without
798 * uploadpack.allowReachableSHA1InWant,
799 * non-tip requests can never happen.
800 */
801 if (!data->stateless_rpc && !(data->allow_uor & ALLOW_REACHABLE_SHA1))
802 goto error;
803 if (!has_unreachable(&data->want_obj, data->allow_uor))
804 /* All the non-tip ones are ancestors of what we advertised */
805 return;
806
807error:
808 /* Pick one of them (we know there at least is one) */
809 for (i = 0; i < data->want_obj.nr; i++) {
810 struct object *o = data->want_obj.objects[i].item;
811 if (!is_our_ref(o, data->allow_uor)) {
812 error("git upload-pack: not our ref %s",
813 oid_to_hex(&o->oid));
814 packet_writer_error(&data->writer,
815 "upload-pack: not our ref %s",
816 oid_to_hex(&o->oid));
817 exit(128);
818 }
819 }
820}
821
822static void send_shallow(struct upload_pack_data *data,
823 struct commit_list *result)

Callers 1

receive_needsFunction · 0.85

Calls 5

has_unreachableFunction · 0.85
is_our_refFunction · 0.85
errorFunction · 0.85
oid_to_hexFunction · 0.85
packet_writer_errorFunction · 0.85

Tested by

no test coverage detected