Commit Diff


commit - 520b3b00a2f77f07e9851c742bbd58fd82093dc6
commit + 795b1c60ba54eac7730d5367a72bf12ef0e73613
blob - d7cb0dbf7b3b8a617fc9d6ef910d8cc6f0a13613
blob + e67002a26d62e31e74091ab92c3ca85aa97329a4
--- got/got.c
+++ got/got.c
@@ -1395,15 +1395,21 @@ create_gotconfig(const char *proto, const char *host, 
 	    "\tprotocol %s\n"
 	    "%s%s%s"
 	    "\trepository \"%s\"\n"
+	    "%s"
 	    "%s%s%s"
+	    "%s"
 	    "%s%s%s"
 	    "%s"
 	    "%s"
 	    "}\n",
 	    GOT_FETCH_DEFAULT_REMOTE_NAME, host, proto,
 	    port ? "\tport " : "", port ? port : "", port ? "\n" : "",
-	    remote_repo_path, branches ? "\tbranch { " : "",
-	    branches ? branches : "", branches ? "}\n" : "",
+	    remote_repo_path,
+	    branches ? "\tfetch {\n" : "",
+	    branches ? "\t\tbranch { " : "",
+	    branches ? branches : "",
+	    branches ? "}\n" : "",
+	    branches ? "\t}\n" : "",
 	    refs ? "\treference { " : "", refs ? refs : "", refs ? "}\n" : "",
 	    mirror_references ? "\tmirror_references yes\n" : "",
 	    fetch_all_branches ? "\tfetch_all_branches yes\n" : "") == -1) {
blob - 184a0cab35d28783c255c1494d78b1695189a105
blob + e9daec23e99eaee20166b09dfb7ebbde29181db1
--- regress/cmdline/clone.sh
+++ regress/cmdline/clone.sh
@@ -95,7 +95,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "master" }
+	fetch {
+		branch { "master" }
+	}
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
@@ -226,7 +228,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "foo" }
+	fetch {
+		branch { "foo" }
+	}
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
@@ -375,7 +379,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "master" }
+	fetch {
+		branch { "master" }
+	}
 	mirror_references yes
 }
 EOF
@@ -525,7 +531,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "master" }
+	fetch {
+		branch { "master" }
+	}
 	reference { "hoo" }
 }
 EOF
@@ -601,7 +609,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "foo" }
+	fetch {
+		branch { "foo" }
+	}
 	reference { "hoo/boo/zoo" }
 }
 EOF
@@ -674,7 +684,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "master" }
+	fetch {
+		branch { "master" }
+	}
 	reference { "hoo" }
 	mirror_references yes
 }
@@ -748,7 +760,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "bar" "foo" }
+	fetch {
+		branch { "bar" "foo" }
+	}
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
@@ -830,7 +844,9 @@ remote "origin" {
 	server 127.0.0.1
 	protocol ssh
 	repository "$testroot/repo"
-	branch { "foo" }
+	fetch {
+		branch { "foo" }
+	}
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
@@ -975,7 +991,9 @@ remote "origin" {
 	protocol http
 	port $GOT_TEST_HTTP_PORT
 	repository "/repo"
-	branch { "master" }
+	fetch {
+		branch { "master" }
+	}
 }
 EOF
 	cmp -s $testroot/repo-clone/got.conf $testroot/got.conf.expected
blob - 9bda4d3b425e3cfc1eaf1893388d1c2ad82c2065
blob + aac6a219e2b443b516724c8444a2c326b6bdcf49
--- regress/cmdline/fetch.sh
+++ regress/cmdline/fetch.sh
@@ -485,9 +485,11 @@ test_fetch_all() {
 
 	# remove default branch from got.conf, fetch all branches
 	ed -s $testroot/repo-clone/got.conf <<-EOF
+	/fetch {/d
 	/branch {/c
 	fetch_all_branches yes
 	.
+	/}/d
 	w
 	EOF