Commit f1bf60d10a22f5990303b68967a6cbffab2c5f04

Stefan Sperling 2022-07-03T11:27:02

rename got.conf(5) fetch-all-branches to fetch_all_branches for consistency Existing configuration files will keep working for now since the old name with dashes is still recognized by the config parser.

diff --git a/got/got.1 b/got/got.1
index d2db3f1..d73ed0c 100644
--- a/got/got.1
+++ b/got/got.1
@@ -211,7 +211,7 @@ are as follows:
 Fetch all branches from the remote repository's
 .Dq refs/heads/
 reference namespace and set
-.Cm fetch-all-branches
+.Cm fetch_all_branches
 in the cloned repository's
 .Xr got.conf 5
 file for future use by
diff --git a/got/got.c b/got/got.c
index 6feb1c3..75efd58 100644
--- a/got/got.c
+++ b/got/got.c
@@ -1345,7 +1345,7 @@ create_gotconfig(const char *proto, const char *host, const char *port,
 	    branches ? branches : "", branches ? "}\n" : "", 
 	    refs ? "\treference { " : "", refs ? refs : "", refs ? "}\n" : "", 
 	    mirror_references ? "\tmirror-references yes\n" : "",
-	    fetch_all_branches ? "\tfetch-all-branches yes\n" : "") == -1) {
+	    fetch_all_branches ? "\tfetch_all_branches yes\n" : "") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto done;
 	}
diff --git a/got/got.conf.5 b/got/got.conf.5
index 8fde4b1..d529aa6 100644
--- a/got/got.conf.5
+++ b/got/got.conf.5
@@ -120,7 +120,7 @@ and
 command lines with the
 .Fl b
 option.
-.It Ic fetch-all-branches Ar yes | no
+.It Ic fetch_all_branches Ar yes | no
 This option controls whether
 .Cm got fetch
 will fetch all branches from the remote repository by default.
diff --git a/libexec/got-read-gotconfig/parse.y b/libexec/got-read-gotconfig/parse.y
index 85fc623..61a08c3 100644
--- a/libexec/got-read-gotconfig/parse.y
+++ b/libexec/got-read-gotconfig/parse.y
@@ -368,7 +368,8 @@ lookup(char *s)
 		{"author",		AUTHOR},
 		{"branch",		BRANCH},
 		{"fetch",		FETCH},
-		{"fetch-all-branches",	FETCH_ALL_BRANCHES},
+		{"fetch-all-branches",	FETCH_ALL_BRANCHES}, /* deprecated */
+		{"fetch_all_branches",	FETCH_ALL_BRANCHES},
 		{"mirror-references",	MIRROR_REFERENCES},
 		{"port",		PORT},
 		{"protocol",		PROTOCOL},
diff --git a/regress/cmdline/clone.sh b/regress/cmdline/clone.sh
index e6353f2..192edf2 100755
--- a/regress/cmdline/clone.sh
+++ b/regress/cmdline/clone.sh
@@ -276,7 +276,7 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	fetch-all-branches yes
+	fetch_all_branches yes
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
@@ -422,7 +422,7 @@ remote "origin" {
 	protocol ssh
 	repository "$testroot/repo"
 	mirror-references yes
-	fetch-all-branches yes
+	fetch_all_branches yes
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected