commit - 83592549c4d0fd93b998c76efe6d1cb9286d4e8b
commit + e0380e3dfa71712eaaf9642b4d86b53e6a986653
blob - d3ce58fd68ab0a1ef9be75ee3b113fb0080db8db
blob + e074f7da3728404dc7163c7f239e256bf44a522c
--- got/got.1
+++ got/got.1
.Cm got fetch
is invoked in a work tree then this work tree's current branch will be
fetched, too, provided it is present on the server.
+If no branches to fetch can be found in
+.Xr got.conf 5
+or via a work tree, or said branches are not found on the server, a branch
+resolved via the remote repository's HEAD reference will be fetched.
This default behaviour can be overridden with the
.Fl a
and
.Fl b
options.
-If no branches to fetch can be found in
-.Xr got.conf 5 ,
-on the command line, or via a work tree, a branch resolved via the remote
-repository's HEAD reference will be fetched.
.Pp
New changes will be stored in a separate pack file downloaded from the server.
Optionally, separate pack files stored in the repository can be combined with
blob - f053979f01ffaadce2c978878c3af4f2ef4eedd4
blob + 79910ef42000853ea31476a0e47ed20dbc3e848f
--- got/got.c
+++ got/got.c
error = got_fetch_pack(&pack_hash, &refs, &symrefs,
GOT_FETCH_DEFAULT_REMOTE_NAME, mirror_references,
fetch_all_branches, &wanted_branches, &wanted_refs,
- list_refs_only, verbosity, fetchfd, repo, NULL,
+ list_refs_only, verbosity, fetchfd, repo, NULL, 0,
fetch_progress, &fpa);
if (error)
goto done;
fpa.create_configs = 0;
fpa.configs_created = 0;
memset(&fpa.config_info, 0, sizeof(fpa.config_info));
+
error = got_fetch_pack(&pack_hash, &refs, &symrefs, remote->name,
remote->mirror_references, fetch_all_branches, &wanted_branches,
&wanted_refs, list_refs_only, verbosity, fetchfd, repo,
- worktree_branch, fetch_progress, &fpa);
+ worktree_branch, have_bflag, fetch_progress, &fpa);
if (error)
goto done;
blob - 5703d1fbe97e2c2bfcb5c6c2095c9653f5ee5e6e
blob + 5768c9157c81ca12b00f65491c540dd712c37e6a
--- include/got_fetch.h
+++ include/got_fetch.h
const struct got_error *got_fetch_pack(struct got_object_id **,
struct got_pathlist_head *, struct got_pathlist_head *, const char *,
int, int, struct got_pathlist_head *, struct got_pathlist_head *,
- int, int, int, struct got_repository *, const char *,
+ int, int, int, struct got_repository *, const char *, int,
got_fetch_progress_cb, void *);
blob - 4cadde3092a29609981dff3db1aad0b08875380e
blob + 73ed35339b4c3021292f47b81c2520f2536af426
--- lib/fetch.c
+++ lib/fetch.c
struct got_pathlist_head *wanted_branches,
struct got_pathlist_head *wanted_refs, int list_refs_only, int verbosity,
int fetchfd, struct got_repository *repo, const char *worktree_refname,
- got_fetch_progress_cb progress_cb, void *progress_arg)
+ int no_head, got_fetch_progress_cb progress_cb, void *progress_arg)
{
size_t i;
int imsg_fetchfds[2], imsg_idxfds[2];
}
err = got_privsep_send_fetch_req(&fetchibuf, nfetchfd, &have_refs,
fetch_all_branches, wanted_branches, wanted_refs,
- list_refs_only, worktree_refname, verbosity);
+ list_refs_only, worktree_refname, no_head, verbosity);
if (err != NULL)
goto done;
nfetchfd = -1;
blob - 40dbc2d915c4a0d0065b664aad76b865d627813f
blob + 5adda2b85b825cc1927ee67a7c03bbbf144a6626
--- lib/got_lib_privsep.h
+++ lib/got_lib_privsep.h
/* Structure for GOT_IMSG_FETCH_REQUEST data. */
struct got_imsg_fetch_request {
+ int no_head;
int fetch_all_branches;
int list_refs_only;
int verbosity;
int *, int *, struct imsgbuf *ibuf);
const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int,
struct got_pathlist_head *, int, struct got_pathlist_head *,
- struct got_pathlist_head *, int, const char *, int);
+ struct got_pathlist_head *, int, const char *, int, int);
const struct got_error *got_privsep_send_fetch_outfd(struct imsgbuf *, int);
const struct got_error *got_privsep_recv_fetch_progress(int *,
struct got_object_id **, char **, struct got_pathlist_head *, char **,
blob - fff73bb7371e7714cf0740195901c3c7c95c0ffb
blob + 811f1787162ba966c2922b56b9fee4b74c3878c9
--- lib/privsep.c
+++ lib/privsep.c
struct got_pathlist_head *have_refs, int fetch_all_branches,
struct got_pathlist_head *wanted_branches,
struct got_pathlist_head *wanted_refs, int list_refs_only,
- const char *worktree_branch, int verbosity)
+ const char *worktree_branch, int no_head, int verbosity)
{
const struct got_error *err = NULL;
struct ibuf *wbuf;
return got_error_from_errno("imsg_create FETCH_HAVE_REF");
memset(&fetchreq, 0, sizeof(fetchreq));
+ fetchreq.no_head = no_head;
fetchreq.fetch_all_branches = fetch_all_branches;
fetchreq.list_refs_only = list_refs_only;
fetchreq.verbosity = verbosity;
blob - 6bb936e82376abc57ffcb9ed87cb250d34fc093b
blob + 72ec828892106ec52dc3a4eed6848781d9aa4f01
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
struct got_pathlist_head *have_refs, int fetch_all_branches,
struct got_pathlist_head *wanted_branches,
struct got_pathlist_head *wanted_refs, int list_refs_only,
- const char *worktree_branch, struct imsgbuf *ibuf)
+ const char *worktree_branch, int no_head, struct imsgbuf *ibuf)
{
const struct got_error *err = NULL;
char buf[GOT_PKT_MAX];
if (list_refs_only)
goto done;
- if (!found_branch && default_branch && default_id_str &&
+ if (!found_branch && !no_head && default_branch && default_id_str &&
strncmp(default_branch, "refs/heads/", 11) == 0) {
err = fetch_ref(ibuf, have_refs, &have[nref],
&want[nref], default_branch, default_id_str);
err = fetch_pack(fetchfd, packfd, pack_sha1, &have_refs,
fetch_req.fetch_all_branches, &wanted_branches,
&wanted_refs, fetch_req.list_refs_only,
- worktree_branch, &ibuf);
+ worktree_branch, fetch_req.no_head, &ibuf);
done:
free(worktree_branch);
got_pathlist_free(&have_refs, GOT_PATHLIST_FREE_ALL);