"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Kurt Mosiejczuk <kurt@cranky.work>
Subject:
Updated patch for default "main" branch for newly created repositories
To:
gameoftrees <gameoftrees@openbsd.org>
Date:
Fri, 8 Nov 2019 18:11:51 +0200

Download raw body.

Thread
Sorry. I've been a bit busy getting ready for a hackathon.

I believe this eliminates contradictions in the examples in the man page
(which do clone an existing repository) and makes sure regression tests
all still pass.

--Kurt

diff --git a/got/got.1 b/got/got.1
index 4567602..84fbdf4 100644
--- a/got/got.1
+++ b/got/got.1
@@ -109,9 +109,9 @@ are as follows:
 Create the specified
 .Ar branch
 instead of creating the default branch
-.Dq master .
+.Dq main .
 Use of this option is required if the
-.Dq master
+.Dq main
 branch already exists.
 .It Fl m Ar message
 Use the specified log message when creating the new commit.
diff --git a/got/got.c b/got/got.c
index a6420b5..9d1c786 100644
--- a/got/got.c
+++ b/got/got.c
@@ -574,7 +574,7 @@ cmd_import(int argc, char *argv[])
 	const struct got_error *error = NULL;
 	char *path_dir = NULL, *repo_path = NULL, *logmsg = NULL;
 	char *gitconfig_path = NULL, *editor = NULL, *author = NULL;
-	const char *branch_name = "master";
+	const char *branch_name = "main";
 	char *refname = NULL, *id_str = NULL, *logmsg_path = NULL;
 	struct got_repository *repo = NULL;
 	struct got_reference *branch_ref = NULL, *head_ref = NULL;
diff --git a/lib/repository.c b/lib/repository.c
index 22355c1..23d2de6 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -1015,7 +1015,7 @@ got_repo_init(const char *repo_path)
 	};
 	const char *description_str = "Unnamed repository; "
 	    "edit this file 'description' to name the repository.";
-	const char *headref_str = "ref: refs/heads/master";
+	const char *headref_str = "ref: refs/heads/main";
 	const char *gitconfig_str = "[core]\n"
 	    "\trepositoryformatversion = 0\n"
 	    "\tfilemode = true\n"
diff --git a/regress/cmdline/import.sh b/regress/cmdline/import.sh
index a7b1c1d..a5da67c 100755
--- a/regress/cmdline/import.sh
+++ b/regress/cmdline/import.sh
@@ -38,7 +38,7 @@ function test_import_basic {
 	echo "A  $testroot/tree/epsilon/zeta" >> $testroot/stdout.expected
 	echo "A  $testroot/tree/alpha" >> $testroot/stdout.expected
 	echo "A  $testroot/tree/beta" >> $testroot/stdout.expected
-	echo "Created branch refs/heads/master with commit $head_commit" \
+	echo "Created branch refs/heads/main with commit $head_commit" \
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -60,7 +60,7 @@ function test_import_basic {
 
 	echo "-----------------------------------------------" \
 		> $testroot/stdout.expected
-	echo "commit $head_commit (master)" >> $testroot/stdout.expected
+	echo "commit $head_commit (main)" >> $testroot/stdout.expected
 	echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
 	echo " " >> $testroot/stdout.expected
 	echo " init" >> $testroot/stdout.expected
@@ -142,7 +142,7 @@ function test_import_requires_new_branch {
 	mkdir $testroot/tree
 	make_test_tree $testroot/tree
 
-	got import -m 'init' -r $testroot/repo $testroot/tree \
+	got import -b master -m 'init' -r $testroot/repo $testroot/tree \
 		> $testroot/stdout 2> $testroot/stderr
 	ret="$?"
 	if [ "$ret" == "0" ]; then
@@ -187,7 +187,7 @@ function test_import_ignores {
 
 	local head_commit=`git_show_head $testroot/repo`
 	echo "A  $testroot/tree/beta" >> $testroot/stdout.expected
-	echo "Created branch refs/heads/master with commit $head_commit" \
+	echo "Created branch refs/heads/main with commit $head_commit" \
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -217,7 +217,7 @@ function test_import_empty_dir {
 
 	local head_commit=`git_show_head $testroot/repo`
 	echo "A  $testroot/tree/notempty/alpha" >> $testroot/stdout.expected
-	echo "Created branch refs/heads/master with commit $head_commit" \
+	echo "Created branch refs/heads/main with commit $head_commit" \
 		>> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout