tweak implementation of separate send {} and fetch {} conf blocks Tweak man page. Factor out repeated code in if/else branches in send_gotconfig_remotes(). ok stsp@
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
diff --git a/got/got.conf.5 b/got/got.conf.5
index 7b400d1..fdf7526 100644
--- a/got/got.conf.5
+++ b/got/got.conf.5
@@ -112,7 +112,7 @@ Specify one or more branches which
.Cm got fetch
and
.Cm got send
-should fetch and send from the remote repository by default.
+should fetch from and send to the remote repository by default.
The list of branches specified here can be overridden at the
.Cm got fetch
and
diff --git a/libexec/got-read-gotconfig/got-read-gotconfig.c b/libexec/got-read-gotconfig/got-read-gotconfig.c
index 87b6e32..3eb4560 100644
--- a/libexec/got-read-gotconfig/got-read-gotconfig.c
+++ b/libexec/got-read-gotconfig/got-read-gotconfig.c
@@ -255,32 +255,22 @@ send_gotconfig_remotes(struct imsgbuf *ibuf,
struct node_ref *ref;
int nfetch_branches = 0, nsend_branches = 0, nfetch_refs = 0;
- if (repo->fetch_config && repo->fetch_config->branch) {
+ if (repo->fetch_config && repo->fetch_config->branch)
branch = repo->fetch_config->branch;
- while (branch) {
- branch = branch->next;
- nfetch_branches++;
- }
- } else {
+ else
branch = repo->branch;
- while (branch) {
- branch = branch->next;
- nfetch_branches++;
- }
+ while (branch) {
+ branch = branch->next;
+ nfetch_branches++;
}
- if (repo->send_config && repo->send_config->branch) {
+ if (repo->send_config && repo->send_config->branch)
branch = repo->send_config->branch;
- while (branch) {
- branch = branch->next;
- nsend_branches++;
- }
- } else {
+ else
branch = repo->branch;
- while (branch) {
- branch = branch->next;
- nsend_branches++;
- }
+ while (branch) {
+ branch = branch->next;
+ nsend_branches++;
}
ref = repo->fetch_ref;
@@ -354,44 +344,26 @@ send_gotconfig_remotes(struct imsgbuf *ibuf,
free(send_url);
send_url = NULL;
- if (repo->fetch_config && repo->fetch_config->branch) {
+ if (repo->fetch_config && repo->fetch_config->branch)
branch = repo->fetch_config->branch;
- while (branch) {
- err = send_gotconfig_str(ibuf,
- branch->branch_name);
- if (err)
- break;
- branch = branch->next;
- }
- } else {
+ else
branch = repo->branch;
- while (branch) {
- err = send_gotconfig_str(ibuf,
- branch->branch_name);
- if (err)
- break;
- branch = branch->next;
- }
+ while (branch) {
+ err = send_gotconfig_str(ibuf, branch->branch_name);
+ if (err)
+ break;
+ branch = branch->next;
}
- if (repo->send_config && repo->send_config->branch) {
+ if (repo->send_config && repo->send_config->branch)
branch = repo->send_config->branch;
- while (branch) {
- err = send_gotconfig_str(ibuf,
- branch->branch_name);
- if (err)
- break;
- branch = branch->next;
- }
- } else {
+ else
branch = repo->branch;
- while (branch) {
- err = send_gotconfig_str(ibuf,
- branch->branch_name);
- if (err)
- break;
- branch = branch->next;
- }
+ while (branch) {
+ err = send_gotconfig_str(ibuf, branch->branch_name);
+ if (err)
+ break;
+ branch = branch->next;
}
ref = repo->fetch_ref;