rename 'got init' and 'got import' default branch to "main"; patch by kmos@
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
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