blob: 43ec344d95b40c701b2fc703b4b2b1e3ff72a2d2 [file] [log] [blame]
Daniel Barkalow2d4177c2007-09-10 23:03:00 -04001#ifndef FETCH_PACK_H
2#define FETCH_PACK_H
3
Michael Haggerty8bee93d2012-09-09 08:19:40 +02004#include "string-list.h"
Junio C Hamano47a59182013-07-08 13:56:53 -07005#include "run-command.h"
Brandon Williams685fbd32018-03-15 10:31:28 -07006#include "protocol.h"
Jeff Hostetler640d8b72017-12-08 15:58:40 +00007#include "list-objects-filter-options.h"
Michael Haggerty8bee93d2012-09-09 08:19:40 +02008
brian m. carlson910650d2017-03-31 01:40:00 +00009struct oid_array;
Nguyễn Thái Ngọc Duybeea4152013-12-05 20:02:39 +070010
Jonathan Nieder9cba13c2011-03-16 02:08:34 -050011struct fetch_pack_args {
Daniel Barkalow2d4177c2007-09-10 23:03:00 -040012 const char *uploadpack;
Daniel Barkalow2d4177c2007-09-10 23:03:00 -040013 int unpacklimit;
Daniel Barkalow2d4177c2007-09-10 23:03:00 -040014 int depth;
Nguyễn Thái Ngọc Duy508ea882016-06-12 17:53:59 +070015 const char *deepen_since;
Nguyễn Thái Ngọc Duya45a2602016-06-12 17:54:04 +070016 const struct string_list *deepen_not;
Jeff Hostetler640d8b72017-12-08 15:58:40 +000017 struct list_objects_filter_options filter_options;
Brandon Williams5e3548e2018-04-23 15:46:24 -070018 const struct string_list *server_options;
Jonathan Tan3390e422018-07-02 15:39:44 -070019
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 17:54:09 +070026 unsigned deepen_relative:1;
Nguyễn Thái Ngọc Duyf6486f02013-12-05 20:02:38 +070027 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 12:21:14 -080033 unsigned diag_url:1;
Nguyễn Thái Ngọc Duyf6486f02013-12-05 20:02:38 +070034 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 20:02:39 +070040 unsigned cloning:1;
Nguyễn Thái Ngọc Duy48d25ca2013-12-05 20:02:42 +070041 unsigned update_shallow:1;
Nguyễn Thái Ngọc Duy79891cb2016-06-12 17:53:56 +070042 unsigned deepen:1;
Jonathan Tan88e2f9e2017-12-05 16:58:49 +000043 unsigned from_promisor:1;
44
45 /*
Jonathan Tan4c7f9562018-10-03 16:04:53 -070046 * Attempt to fetch only the wanted objects, and not any objects
47 * referred to by them. Due to protocol limitations, extraneous
48 * objects may still be included. (When fetching non-blob
49 * objects, only blobs are excluded; when fetching a blob, the
50 * blob itself will still be sent. The client does not need to
51 * know whether a wanted object is a blob or not.)
52 *
Jonathan Tan88e2f9e2017-12-05 16:58:49 +000053 * If 1, fetch_pack() will also not modify any object flags.
54 * This allows fetch_pack() to safely be called by any function,
55 * regardless of which object flags it uses (if any).
56 */
57 unsigned no_dependents:1;
Jonathan Tancf1e7c02018-07-02 15:08:43 -070058
59 /*
60 * Because fetch_pack() overwrites the shallow file upon a
61 * successful deepening non-clone fetch, if this struct
62 * specifies such a fetch, fetch_pack() needs to perform a
63 * connectivity check before deciding if a fetch is successful
64 * (and overwriting the shallow file). fetch_pack() sets this
65 * field to 1 if such a connectivity check was performed.
66 *
67 * This is different from check_self_contained_and_connected
68 * in that the former allows existing objects in the
69 * repository to satisfy connectivity needs, whereas the
70 * latter doesn't.
71 */
72 unsigned connectivity_checked:1;
Daniel Barkalow2d4177c2007-09-10 23:03:00 -040073};
74
Michael Haggerty4ba15992012-09-09 08:19:43 +020075/*
Junio C Hamanof2db8542013-01-29 14:02:15 -080076 * sought represents remote references that should be updated from.
77 * On return, the names that were found on the remote will have been
78 * marked as such.
Michael Haggerty4ba15992012-09-09 08:19:43 +020079 */
Shawn O. Pearcefa740522007-09-19 00:49:35 -040080struct ref *fetch_pack(struct fetch_pack_args *args,
Michael Haggerty63c69452012-09-09 08:19:39 +020081 int fd[], struct child_process *conn,
82 const struct ref *ref,
83 const char *dest,
Junio C Hamanof2db8542013-01-29 14:02:15 -080084 struct ref **sought,
85 int nr_sought,
brian m. carlson910650d2017-03-31 01:40:00 +000086 struct oid_array *shallow,
Brandon Williams685fbd32018-03-15 10:31:28 -070087 char **pack_lockfile,
88 enum protocol_version version);
Daniel Barkalow2d4177c2007-09-10 23:03:00 -040089
Matt McCutchene860d962017-02-22 11:01:22 -050090/*
91 * Print an appropriate error message for each sought ref that wasn't
92 * matched. Return 0 if all sought refs were matched, otherwise 1.
93 */
94int report_unmatched_refs(struct ref **sought, int nr_sought);
95
Daniel Barkalow2d4177c2007-09-10 23:03:00 -040096#endif