Commit 26e6f38e73535ec12ae2ba9e4f78cd6f41b14c63

Stefan Sperling 2022-07-03T11:32:59

rename got.conf(5) mirror-references to mirror_references 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.c b/got/got.c
index 75efd58..78d2132 100644
--- a/got/got.c
+++ b/got/got.c
@@ -1344,7 +1344,7 @@ create_gotconfig(const char *proto, const char *host, const char *port,
 	    remote_repo_path, branches ? "\tbranch { " : "",
 	    branches ? branches : "", branches ? "}\n" : "", 
 	    refs ? "\treference { " : "", refs ? refs : "", refs ? "}\n" : "", 
-	    mirror_references ? "\tmirror-references yes\n" : "",
+	    mirror_references ? "\tmirror_references yes\n" : "",
 	    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 d529aa6..5827c26 100644
--- a/got/got.conf.5
+++ b/got/got.conf.5
@@ -151,7 +151,7 @@ In any case, references in the
 .Dq refs/tags/
 namespace will always be fetched and mapped directly to local references
 in the same namespace.
-.It Ic mirror-references Ar yes | no
+.It Ic mirror_references Ar yes | no
 This option controls the behaviour of
 .Cm got fetch
 when updating references.
@@ -239,7 +239,7 @@ remote "origin" {
 	repository "openbsd/src"
 	server git@github.com
 	protocol git+ssh
-	mirror-references yes
+	mirror_references yes
 }
 .Ed
 .Pp
diff --git a/libexec/got-read-gotconfig/parse.y b/libexec/got-read-gotconfig/parse.y
index 61a08c3..75ffe68 100644
--- a/libexec/got-read-gotconfig/parse.y
+++ b/libexec/got-read-gotconfig/parse.y
@@ -370,7 +370,8 @@ lookup(char *s)
 		{"fetch",		FETCH},
 		{"fetch-all-branches",	FETCH_ALL_BRANCHES}, /* deprecated */
 		{"fetch_all_branches",	FETCH_ALL_BRANCHES},
-		{"mirror-references",	MIRROR_REFERENCES},
+		{"mirror-references",	MIRROR_REFERENCES}, /* deprecated */
+		{"mirror_references",	MIRROR_REFERENCES},
 		{"port",		PORT},
 		{"protocol",		PROTOCOL},
 		{"reference",		REFERENCE},
diff --git a/regress/cmdline/clone.sh b/regress/cmdline/clone.sh
index 192edf2..35d7c0b 100755
--- a/regress/cmdline/clone.sh
+++ b/regress/cmdline/clone.sh
@@ -349,7 +349,7 @@ remote "origin" {
 	protocol ssh
 	repository "$testroot/repo"
 	branch { "master" }
-	mirror-references yes
+	mirror_references yes
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
@@ -421,7 +421,7 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	mirror-references yes
+	mirror_references yes
 	fetch_all_branches yes
 }
 EOF
@@ -649,7 +649,7 @@ remote "origin" {
 	repository "$testroot/repo"
 	branch { "master" }
 	reference { "hoo" }
-	mirror-references yes
+	mirror_references yes
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected