Download raw body.
make got fetch default to work tree's current branch
I thought I'd check the recent todo updates before zzz and noticed stsp's new 'got fetch' item. I'm not entirely sure, but it seems to be as simple as this: if in a work tree and -b is not specified, make the work tree's current branch the wanted branch. A potential downside to this behaviour is that, if in a branch that is not on the remote, fetch will now fail where previously it would succeed. diffstat /home/mark/src/got M got/got.1 | 4+ 2- M got/got.c | 6+ 0- 2 files changed, 10 insertions(+), 2 deletions(-) diff /home/mark/src/got commit - d627976f5ceada12169aa74630bbc0fd9ce071b7 path + /home/mark/src/got blob - fdb4ef70a58be2c0ebaee1bc320ee9ba9a5c82fe file + got/got.1 --- got/got.1 +++ got/got.1 @@ -396,8 +396,10 @@ If this option is not specified, a branch resolved via reference namespace. This option may be specified multiple times to build a list of branches to fetch. -If this option is not specified, a branch resolved via the remote -repository's HEAD reference will be fetched. +If this option is not specified, the work tree's current branch +will be fetched if invoked within a work tree, +otherwise a branch resolved via the remote repository's HEAD reference +will be fetched. Cannot be used together with the .Fl a option. blob - 29a58f762f6daee7971bdeac8f303124c5d6f1f2 file + got/got.c --- got/got.c +++ got/got.c @@ -2443,6 +2443,12 @@ cmd_fetch(int argc, char *argv[]) } } } + if (TAILQ_EMPTY(&wanted_branches)) { + error = got_pathlist_append(&wanted_branches, + got_worktree_get_head_ref_name(worktree), NULL); + if (error) + goto done; + } } if (remote == NULL) { repo_conf = got_repo_get_gotconfig(repo); -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
make got fetch default to work tree's current branch