From: Luciano Rocha <luciano@eurotux.com>
To: Junio C Hamano <junio@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-init: treat option `--bare'
Date: Wed, 28 May 2008 19:53:57 +0100 [thread overview]
Message-ID: <20080528185357.GB4431@bit.office.eurotux.com> (raw)
In-Reply-To: <20080528185103.GA4431@bit.office.eurotux.com>
[-- Attachment #1: Type: text/plain, Size: 2684 bytes --]
Currently, passing the `--bare' option to git-init proper doesn't work, and
gives no indication that `git --bare init' would work instead:
$ git init --bare
usage: git-init [-q | --quiet] [--template=<template-directory>] [--shared]
Treat the `--bare' option internally in builtin-init-db.
Also, fix the usage string, synchronising it with the synopsis in the
documentation.
Signed-off-by: Luciano Rocha <strange@nsk.pt>
---
Documentation/git-init.txt | 7 ++++++-
builtin-init-db.c | 9 +++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
Parsing the --bare option correctly (AFAICS) was easier than I expected.
Sorry, forgot the Signed-off-by line.
diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index b17ae84..b48c312 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -8,7 +8,7 @@ git-init - Create an empty git repository or reinitialize an existing one
SYNOPSIS
--------
-'git-init' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
+'git-init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]
OPTIONS
@@ -20,6 +20,11 @@ OPTIONS
Only print error and warning messages, all other output will be suppressed.
+--bare::
+
+Create a bare repository. If GIT_DIR environment is not set, it is set to the
+current working directory.
+
--template=<template_directory>::
Provide the directory from which templates will be used. The default template
diff --git a/builtin-init-db.c b/builtin-init-db.c
index d8bdf92..e23b843 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -364,7 +364,7 @@ static int guess_repository_type(const char *git_dir)
}
static const char init_db_usage[] =
-"git-init [-q | --quiet] [--template=<template-directory>] [--shared]";
+"git-init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]]";
/*
* If you want to, you can share the DB area with any number of branches.
@@ -383,7 +383,12 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
const char *arg = argv[1];
if (!prefixcmp(arg, "--template="))
template_dir = arg+11;
- else if (!strcmp(arg, "--shared"))
+ else if (!strcmp(arg, "--bare")) {
+ static char git_dir[PATH_MAX+1];
+ is_bare_repository_cfg = 1;
+ setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir,
+ sizeof(git_dir)), 0);
+ } else if (!strcmp(arg, "--shared"))
shared_repository = PERM_GROUP;
else if (!prefixcmp(arg, "--shared="))
shared_repository = git_config_perm("arg", arg+9);
--
1.5.6.rc0.41.gabae7.dirty
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-05-28 18:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-19 17:53 bare --init Vs --init bare Luciano Rocha
2008-05-19 19:32 ` Santi Béjar
2008-05-19 20:10 ` Luciano Rocha
2008-05-20 19:48 ` [PATCH] git-init: inform user of `git --bare init' option Luciano Rocha
2008-05-23 6:02 ` Junio C Hamano
2008-05-23 14:24 ` Luciano Rocha
2008-05-28 18:51 ` [PATCH] git-init: treat option `--bare' Luciano Rocha
2008-05-28 18:53 ` Luciano Rocha [this message]
2008-05-29 0:55 ` Junio C Hamano
2008-05-29 9:10 ` Luciano Rocha
2008-05-29 13:51 ` Johannes Schindelin
2008-05-29 18:31 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080528185357.GB4431@bit.office.eurotux.com \
--to=luciano@eurotux.com \
--cc=git@vger.kernel.org \
--cc=junio@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).