Commit Diff


commit - ea2c9c36aa409c447e37aed9c75777adb9e36274
commit + 02a5c5d00338c9549f6a399391841bd8219d91cf
blob - cd6dc8e50f799c6392612e374795bd9522d1ddad
blob + e2ca64cf2ca617ca42a53d36ba06816d803f28af
--- got/got.1
+++ got/got.1
@@ -62,17 +62,6 @@ The commands for
 .Nm
 are as follows:
 .Bl -tag -width checkout
-.It Cm init Ar repository-path
-Create a new empty repository at the specified
-.Ar repository-path .
-.Pp
-After
-.Cm got init ,
-the
-.Cm got import
-command must be used to populate the empty repository before
-.Cm got checkout
-can be used.
 .Tg im
 .It Cm import Oo Fl b Ar branch Oc Oo Fl m Ar message Oc Oo Fl r Ar repository-path Oc Oo Fl I Ar pattern Oc Ar directory
 .Dl Pq alias: Cm im
@@ -2813,7 +2802,7 @@ a new Git repository could be created and populated wi
 e.g. from a temporary CVS checkout located at
 .Pa /tmp/src :
 .Pp
-.Dl $ got init /var/git/src.git
+.Dl $ gotadmin init /var/git/src.git
 .Dl $ got import -r /var/git/src.git -I CVS -I obj /tmp/src
 .Pp
 Check out a work tree from the Git repository to /usr/src:
blob - 9717fc7faffb1106359f3eec7ef28e588f78a06d
blob + 423824ab575879d09fe670bf4a98d4735d474f45
--- got/got.c
+++ got/got.c
@@ -90,7 +90,6 @@ struct got_cmd {
 };
 
 __dead static void	usage(int, int);
-__dead static void	usage_init(void);
 __dead static void	usage_import(void);
 __dead static void	usage_clone(void);
 __dead static void	usage_fetch(void);
@@ -121,7 +120,6 @@ __dead static void	usage_unstage(void);
 __dead static void	usage_cat(void);
 __dead static void	usage_info(void);
 
-static const struct got_error*		cmd_init(int, char *[]);
 static const struct got_error*		cmd_import(int, char *[]);
 static const struct got_error*		cmd_clone(int, char *[]);
 static const struct got_error*		cmd_fetch(int, char *[]);
@@ -153,7 +151,6 @@ static const struct got_error*		cmd_cat(int, char *[])
 static const struct got_error*		cmd_info(int, char *[]);
 
 static const struct got_cmd got_commands[] = {
-	{ "init",	cmd_init,	usage_init,	"" },
 	{ "import",	cmd_import,	usage_import,	"im" },
 	{ "clone",	cmd_clone,	usage_clone,	"cl" },
 	{ "fetch",	cmd_fetch,	usage_fetch,	"fe" },
@@ -345,59 +342,6 @@ apply_unveil(const char *repo_path, int repo_read_only
 		return got_error_from_errno("unveil");
 
 	return NULL;
-}
-
-__dead static void
-usage_init(void)
-{
-	fprintf(stderr, "usage: %s init repository-path\n", getprogname());
-	exit(1);
-}
-
-static const struct got_error *
-cmd_init(int argc, char *argv[])
-{
-	const struct got_error *error = NULL;
-	char *repo_path = NULL;
-	int ch;
-
-	while ((ch = getopt(argc, argv, "")) != -1) {
-		switch (ch) {
-		default:
-			usage_init();
-			/* NOTREACHED */
-		}
-	}
-
-	argc -= optind;
-	argv += optind;
-
-#ifndef PROFILE
-	if (pledge("stdio rpath wpath cpath unveil", NULL) == -1)
-		err(1, "pledge");
-#endif
-	if (argc != 1)
-		usage_init();
-
-	repo_path = strdup(argv[0]);
-	if (repo_path == NULL)
-		return got_error_from_errno("strdup");
-
-	got_path_strip_trailing_slashes(repo_path);
-
-	error = got_path_mkdir(repo_path);
-	if (error &&
-	    !(error->code == GOT_ERR_ERRNO && errno == EEXIST))
-		goto done;
-
-	error = apply_unveil(repo_path, 0, NULL);
-	if (error)
-		goto done;
-
-	error = got_repo_init(repo_path);
-done:
-	free(repo_path);
-	return error;
 }
 
 __dead static void
blob - 80fd9074549181f88fa96e0b7e0ee1063bec0780
blob + 6bf525c6b6eb1e12a47eb54d15ca3f317e29b05e
--- gotadmin/gotadmin.1
+++ gotadmin/gotadmin.1
@@ -53,6 +53,17 @@ The commands for
 .Nm
 are as follows:
 .Bl -tag -width checkout
+.It Cm init Ar repository-path
+Create a new empty repository at the specified
+.Ar repository-path .
+.Pp
+After
+.Cm gotadmin init ,
+the
+.Cm got import
+command must be used to populate the empty repository before
+.Cm got checkout
+can be used.
 .It Cm info Oo Fl r Ar repository-path Oc
 Display information about a repository.
 This includes some configuration settings from
blob - d2e712fec877f56e6a3e85c0e93d10cc4ce1a702
blob + f4d2b3013d6751cf1612acb25b8552e3910f05f5
--- gotadmin/gotadmin.c
+++ gotadmin/gotadmin.c
@@ -79,12 +79,14 @@ struct gotadmin_cmd {
 };
 
 __dead static void	usage(int, int);
+__dead static void	usage_init(void);
 __dead static void	usage_info(void);
 __dead static void	usage_pack(void);
 __dead static void	usage_indexpack(void);
 __dead static void	usage_listpack(void);
 __dead static void	usage_cleanup(void);
 
+static const struct got_error*		cmd_init(int, char *[]);
 static const struct got_error*		cmd_info(int, char *[]);
 static const struct got_error*		cmd_pack(int, char *[]);
 static const struct got_error*		cmd_indexpack(int, char *[]);
@@ -92,6 +94,7 @@ static const struct got_error*		cmd_listpack(int, char
 static const struct got_error*		cmd_cleanup(int, char *[]);
 
 static const struct gotadmin_cmd gotadmin_commands[] = {
+	{ "init",	cmd_init,	usage_init,	"" },
 	{ "info",	cmd_info,	usage_info,	"" },
 	{ "pack",	cmd_pack,	usage_pack,	"" },
 	{ "indexpack",	cmd_indexpack,	usage_indexpack,"ix" },
@@ -263,6 +266,59 @@ done:
 		got_worktree_close(worktree);
 	free(cwd);
 	return err;
+}
+
+__dead static void
+usage_init(void)
+{
+	fprintf(stderr, "usage: %s init repository-path\n", getprogname());
+	exit(1);
+}
+
+static const struct got_error *
+cmd_init(int argc, char *argv[])
+{
+	const struct got_error *error = NULL;
+	char *repo_path = NULL;
+	int ch;
+
+	while ((ch = getopt(argc, argv, "")) != -1) {
+		switch (ch) {
+		default:
+			usage_init();
+			/* NOTREACHED */
+		}
+	}
+
+	argc -= optind;
+	argv += optind;
+
+#ifndef PROFILE
+	if (pledge("stdio rpath wpath cpath unveil", NULL) == -1)
+		err(1, "pledge");
+#endif
+	if (argc != 1)
+		usage_init();
+
+	repo_path = strdup(argv[0]);
+	if (repo_path == NULL)
+		return got_error_from_errno("strdup");
+
+	got_path_strip_trailing_slashes(repo_path);
+
+	error = got_path_mkdir(repo_path);
+	if (error &&
+	    !(error->code == GOT_ERR_ERRNO && errno == EEXIST))
+		goto done;
+
+	error = apply_unveil(repo_path, 0);
+	if (error)
+		goto done;
+
+	error = got_repo_init(repo_path);
+done:
+	free(repo_path);
+	return error;
 }
 
 static const struct got_error *
blob - 920610e37ab899c23ebcb98ee645c7044a456669
blob + 71d20c61b9666f8571b8996f1bb477f6e01a3c1f
--- regress/cmdline/import.sh
+++ regress/cmdline/import.sh
@@ -20,7 +20,7 @@ test_import_basic() {
 	local testname=import_basic
 	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
-	got init $testroot/repo
+	gotadmin init $testroot/repo
 
 	mkdir $testroot/tree
 	make_test_tree $testroot/tree
@@ -176,7 +176,7 @@ test_import_ignores() {
 	local testname=import_ignores
 	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
-	got init $testroot/repo
+	gotadmin init $testroot/repo
 
 	mkdir $testroot/tree
 	make_test_tree $testroot/tree
@@ -206,7 +206,7 @@ test_import_empty_dir() {
 	local testname=import_empty_dir
 	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
-	got init $testroot/repo
+	gotadmin init $testroot/repo
 
 	mkdir $testroot/tree
 	mkdir -p $testroot/tree/empty $testroot/tree/notempty
@@ -249,7 +249,7 @@ test_import_symlink() {
 	local testname=import_symlink
 	local testroot=`mktemp -d "$GOT_TEST_ROOT/got-test-$testname-XXXXXXXX"`
 
-	got init $testroot/repo
+	gotadmin init $testroot/repo
 
 	mkdir $testroot/tree
 	echo 'this is file alpha' > $testroot/tree/alpha
blob - f322b4b27c50f6f8a96b7c8322063b329f68c34c
blob + fc218eff521a465dc36ca25aad4973aa104fbb4c
--- regress/cmdline/log.sh
+++ regress/cmdline/log.sh
@@ -670,7 +670,7 @@ test_log_in_worktree_different_repo() {
 	git_commit $testroot/repo -m "adding the test tree"
 	local head_commit=`git_show_head $testroot/repo`
 
-	got init $testroot/other-repo
+	gotadmin init $testroot/other-repo
 	mkdir -p $testroot/tree
 	make_test_tree $testroot/tree
 	got import -mm -b foo -r $testroot/other-repo $testroot/tree >/dev/null
blob - 6125dc59b54701f50aa1248b7a9260c6ee5e9dca
blob + 9b68f290f9a1292250e21ea6a0e37961d6e9179c
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
@@ -1204,7 +1204,7 @@ test_send_to_empty_repo() {
 	local testurl=ssh://127.0.0.1/$testroot
 	local commit_id=`git_show_head $testroot/repo`
 
-	got init $testroot/repo2
+	gotadmin init $testroot/repo2
 
 	ret=$?
 	if [ $ret -ne 0 ]; then
@@ -1240,7 +1240,7 @@ EOF
 		return 1
 	fi
 
-	# XXX Workaround: We cannot give the target for HEAD to 'got init'
+	# XXX Workaround: We cannot give the target for HEAD to 'gotadmin init'
 	got ref -r $testroot/repo2 -s refs/heads/master HEAD
 
 	got ref -l -r $testroot/repo > $testroot/stdout