🌐 AI搜索 & 代理 主页
blob: 6775d265175748d2fccd2b9571c864a6ec091f20 [file] [log] [blame]
Daniel Barkalow2d4177c2007-09-11 03:03:001#ifndef FETCH_PACK_H
2#define FETCH_PACK_H
3
Michael Haggerty8bee93d2012-09-09 06:19:404#include "string-list.h"
Brandon Williams685fbd32018-03-15 17:31:285#include "protocol.h"
Jeff Hostetler640d8b72017-12-08 15:58:406#include "list-objects-filter-options.h"
Jonathan Tan9c1e6572021-05-04 21:16:017#include "oidset.h"
Michael Haggerty8bee93d2012-09-09 06:19:408
brian m. carlson910650d2017-03-31 01:40:009struct oid_array;
Nguyễn Thái Ngọc Duybeea4152013-12-05 13:02:3910
Jonathan Nieder9cba13c2011-03-16 07:08:3411struct fetch_pack_args {
Daniel Barkalow2d4177c2007-09-11 03:03:0012 const char *uploadpack;
Daniel Barkalow2d4177c2007-09-11 03:03:0013 int unpacklimit;
Daniel Barkalow2d4177c2007-09-11 03:03:0014 int depth;
Nguyễn Thái Ngọc Duy508ea882016-06-12 10:53:5915 const char *deepen_since;
Nguyễn Thái Ngọc Duya45a2602016-06-12 10:54:0416 const struct string_list *deepen_not;
Jeff Hostetler640d8b72017-12-08 15:58:4017 struct list_objects_filter_options filter_options;
Brandon Williams5e3548e2018-04-23 22:46:2418 const struct string_list *server_options;
Jonathan Tan3390e422018-07-02 22:39:4419
20 /*
21 * If not NULL, during packfile negotiation, fetch-pack will send "have"
22 * lines only with these tips and their ancestors.
23 */
24 const struct oid_array *negotiation_tips;
25
Nguyễn Thái Ngọc Duycccf74e2016-06-12 10:54:0926 unsigned deepen_relative:1;
Nguyễn Thái Ngọc Duyf6486f02013-12-05 13:02:3827 unsigned quiet:1;
28 unsigned keep_pack:1;
29 unsigned lock_pack:1;
30 unsigned use_thin_pack:1;
31 unsigned fetch_all:1;
32 unsigned stdin_refs:1;
Junio C Hamano92251b12014-01-17 20:21:1433 unsigned diag_url:1;
Nguyễn Thái Ngọc Duyf6486f02013-12-05 13:02:3834 unsigned verbose:1;
35 unsigned no_progress:1;
36 unsigned include_tag:1;
37 unsigned stateless_rpc:1;
38 unsigned check_self_contained_and_connected:1;
39 unsigned self_contained_and_connected:1;
Nguyễn Thái Ngọc Duybeea4152013-12-05 13:02:3940 unsigned cloning:1;
Nguyễn Thái Ngọc Duy48d25ca2013-12-05 13:02:4241 unsigned update_shallow:1;
Li Linchao4fe788b2021-04-01 10:46:5942 unsigned reject_shallow_remote:1;
Nguyễn Thái Ngọc Duy79891cb2016-06-12 10:53:5643 unsigned deepen:1;
Robert Coup4dfd0922022-03-28 14:02:0644 unsigned refetch:1;
Jonathan Tan42d418d2020-08-17 19:48:1845
46 /*
47 * Indicate that the remote of this request is a promisor remote. The
48 * pack received does not need all referred-to objects to be present in
49 * the local object store, and fetch-pack will store the pack received
50 * together with a ".promisor" file indicating that the aforementioned
51 * pack is a promisor pack.
52 */
Jonathan Tan88e2f9e2017-12-05 16:58:4953 unsigned from_promisor:1;
54
55 /*
Jonathan Tancf1e7c02018-07-02 22:08:4356 * Because fetch_pack() overwrites the shallow file upon a
57 * successful deepening non-clone fetch, if this struct
58 * specifies such a fetch, fetch_pack() needs to perform a
59 * connectivity check before deciding if a fetch is successful
60 * (and overwriting the shallow file). fetch_pack() sets this
61 * field to 1 if such a connectivity check was performed.
62 *
63 * This is different from check_self_contained_and_connected
64 * in that the former allows existing objects in the
65 * repository to satisfy connectivity needs, whereas the
66 * latter doesn't.
67 */
68 unsigned connectivity_checked:1;
Daniel Barkalow2d4177c2007-09-11 03:03:0069};
70
Michael Haggerty4ba15992012-09-09 06:19:4371/*
Junio C Hamanof2db8542013-01-29 22:02:1572 * sought represents remote references that should be updated from.
73 * On return, the names that were found on the remote will have been
74 * marked as such.
Michael Haggerty4ba15992012-09-09 06:19:4375 */
Shawn O. Pearcefa740522007-09-19 04:49:3576struct ref *fetch_pack(struct fetch_pack_args *args,
Jeff King0f804b02019-03-20 08:16:1477 int fd[],
Michael Haggerty63c69452012-09-09 06:19:3978 const struct ref *ref,
Junio C Hamanof2db8542013-01-29 22:02:1579 struct ref **sought,
80 int nr_sought,
brian m. carlson910650d2017-03-31 01:40:0081 struct oid_array *shallow,
Jonathan Tan9da69a62020-06-10 20:57:2282 struct string_list *pack_lockfiles,
Brandon Williams685fbd32018-03-15 17:31:2883 enum protocol_version version);
Daniel Barkalow2d4177c2007-09-11 03:03:0084
Matt McCutchene860d962017-02-22 16:01:2285/*
Jonathan Tan9c1e6572021-05-04 21:16:0186 * Execute the --negotiate-only mode of "git fetch", adding all known common
87 * commits to acked_commits.
88 *
89 * In the capability advertisement that has happened prior to invoking this
90 * function, the "wait-for-done" capability must be present.
91 */
92void negotiate_using_fetch(const struct oid_array *negotiation_tips,
93 const struct string_list *server_options,
94 int stateless_rpc,
95 int fd[],
96 struct oidset *acked_commits);
97
98/*
Matt McCutchene860d962017-02-22 16:01:2299 * Print an appropriate error message for each sought ref that wasn't
100 * matched. Return 0 if all sought refs were matched, otherwise 1.
101 */
102int report_unmatched_refs(struct ref **sought, int nr_sought);
103
Daniel Barkalow2d4177c2007-09-11 03:03:00104#endif