From: Junio C Hamano <gitster@pobox.com>
To: Fredrik Gustafsson <iveqy@iveqy.com>
Cc: git@vger.kernel.org, jens.lehmann@web.de, hvoigt@hvoigt.net
Subject: Re: [PATCH v2 1/2] rev-parse: add option --is-well-formed-git-dir [path]
Date: Thu, 11 Aug 2011 16:34:42 -0700 [thread overview]
Message-ID: <7v62m3plnx.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 1312831022-12868-2-git-send-email-iveqy@iveqy.com
Fredrik Gustafsson <iveqy@iveqy.com> writes:
> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
> index 4c19f84..82342b3 100644
> --- a/builtin/rev-parse.c
> +++ b/builtin/rev-parse.c
> @@ -455,6 +455,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
> unsigned char sha1[20];
> const char *name = NULL;
>
> + if (argc > 2 && !strcmp(argv[1], "--is-well-formed-git-dir")) {
> + const char *gitdir = resolve_gitdir(argv[2]);
> + if(!gitdir)
(style) SP immediately after "if".
> + die("not a gitdir");
die("not a gitdir '%s'", argv[2]) perhaps?
> + puts(gitdir);
> + return 0;
> + }
> +
> if (argc > 1 && !strcmp("--parseopt", argv[1]))
> return cmd_parseopt(argc - 1, argv + 1, prefix);
When adding a new element to existing list of other similar things, I
would prefer to see it added at the end (in this case, just before "-h",
which is kind of special), unless there is a good justification not to
(e.g. the list is sorted alphabetically).
> diff --git a/setup.c b/setup.c
> index 5ea5502..15bc305 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -808,3 +808,10 @@ const char *setup_git_directory(void)
> {
> return setup_git_directory_gently(NULL);
> }
> +
> +const char *resolve_gitdir(const char *suspect)
> +{
> + if(is_git_directory(suspect))
(style) SP immediately after "if".
next prev parent reply other threads:[~2011-08-11 23:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-08 19:17 [PATCH v2 0/2] submodule: move gitdir into superproject Fredrik Gustafsson
2011-08-08 19:17 ` [PATCH v2 1/2] rev-parse: add option --is-well-formed-git-dir [path] Fredrik Gustafsson
2011-08-11 23:34 ` Junio C Hamano [this message]
2011-08-08 19:17 ` [PATCH v2 2/2] Move git-dir for submodules Fredrik Gustafsson
2011-08-08 20:44 ` Heiko Voigt
2011-08-08 21:34 ` Junio C Hamano
2011-08-09 18:23 ` Heiko Voigt
2011-08-11 23:34 ` 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=7v62m3plnx.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
--cc=iveqy@iveqy.com \
--cc=jens.lehmann@web.de \
/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).