git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-init: inform user of `git --bare init' option

From
LRLuciano Rocha <luciano@eurotux.com>
Date
May 20, 2008, 19:48 UTC
Message-ID
<20080520194850.GB19226@bit.office.eurotux.com>
In-Reply-To
<20080519175313.GA17305@bit.office.eurotux.com>
Creation of a bare repository isn't consistent:

$ git init --bare usage: git-init [-q | --quiet] [--template=<template-directory>] [--shared] $ git --bare init Initialized empty Git repository in ...

Document the second option, and show an error informing of it if the user calls `git-init' with a `--bare' option.

Signed-off-by: Luciano Rocha <strange@nsk.pt>
---
 Documentation/git-init.txt |    2 ++
 builtin-init-db.c          |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index b17ae84..bb87e58 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -84,6 +84,8 @@ Running `git-init` in an existing repository is safe. It will not overwrite
 things that are already there. The primary reason for rerunning `git-init`
 is to pick up newly added templates.
 
+For creating a bare repository, use the form `git --bare init`.
+
 Note that `git-init` is the same as `git-init-db`.  The command
 was primarily meant to initialize the object database, but over
 time it has become responsible for setting up the other aspects
diff --git a/builtin-init-db.c b/builtin-init-db.c
index a76f5d3..65454b1 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -334,6 +334,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 			template_dir = arg+11;
 		else if (!strcmp(arg, "--shared"))
 			shared_repository = PERM_GROUP;
+		else if (!strcmp(arg, "--bare"))
+			die("Run `git --bare init' instead to create a bare repository");
 		else if (!prefixcmp(arg, "--shared="))
 			shared_repository = git_config_perm("arg", arg+9);
 		else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet"))
-- 
1.5.5.1.317.ge7bcb.dirty
Previous: Luciano RochaNext: Junio C Hamano
Message 4 of 12 in “bare --init Vs --init bare”
  1. Luciano RochaMay 19, 2008
  2. Santi BéjarMay 19, 2008
  3. Luciano RochaMay 19, 2008
  4. git-init: inform user of `git --bare init' optionLuciano Rocha, May 20, 2008
  5. Junio C HamanoMay 23, 2008
  6. Luciano RochaMay 23, 2008
  7. git-init: treat option `--bare'Luciano Rocha, May 28, 2008
  8. Luciano RochaMay 28, 2008
  9. Junio C HamanoMay 29, 2008
  10. Luciano RochaMay 29, 2008
  11. Johannes SchindelinMay 29, 2008
  12. Junio C HamanoMay 29, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.