From: Jacob Keller <jacob.e.keller@intel.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Stefan Beller <stefanbeller@gmail.com>, Jeff King <peff@peff.net>,
Johannes Sixt <j6t@kdbg.org>,
Jacob Keller <jacob.keller@gmail.com>
Subject: [PATCH v7 4/7] submodule: allow do_submodule_path to work if given gitdir directly
Date: Wed, 17 Aug 2016 17:51:28 -0700 [thread overview]
Message-ID: <20160818005131.31600-5-jacob.e.keller@intel.com> (raw)
In-Reply-To: <20160818005131.31600-1-jacob.e.keller@intel.com>
From: Jacob Keller <jacob.keller@gmail.com>
Currently, do_submodule_path relies on read_gitfile, which will die() if
it can't read from the specified gitfile. Unfortunately, this means that
do_submodule_path will not work when given the path to a submodule which
is checked out directly, such as a newly added submodule which you
cloned and then "git submodule add". Instead, replace the call with
resolve_gitdir. This first checks to see if we've been given a gitdir
already.
Because resolve_gitdir may return the same buffer it was passed, we have
to check for this case as well, since strbuf_reset() will not work as
expected here, and indeed is not necessary.
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
---
path.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/path.c b/path.c
index 17551c483476..d1af029152a2 100644
--- a/path.c
+++ b/path.c
@@ -477,8 +477,8 @@ static void do_submodule_path(struct strbuf *buf, const char *path,
strbuf_complete(buf, '/');
strbuf_addstr(buf, ".git");
- git_dir = read_gitfile(buf->buf);
- if (git_dir) {
+ git_dir = resolve_gitdir(buf->buf);
+ if (git_dir && git_dir != buf->buf) {
strbuf_reset(buf);
strbuf_addstr(buf, git_dir);
}
--
2.10.0.rc0.217.g609f9e8.dirty
next prev parent reply other threads:[~2016-08-18 0:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 0:51 [PATCH v7 0/7] implement inline submodule diff format Jacob Keller
2016-08-18 0:51 ` [PATCH v7 1/7] diff.c: remove output_prefix_length field Jacob Keller
2016-08-18 0:51 ` [PATCH v7 2/7] graph: add support for --line-prefix on all graph-aware output Jacob Keller
2016-08-18 17:56 ` Stefan Beller
2016-08-18 18:26 ` Jacob Keller
2016-08-18 18:29 ` Jacob Keller
2016-08-18 0:51 ` [PATCH v7 3/7] diff: prepare for additional submodule formats Jacob Keller
2016-08-18 18:03 ` Stefan Beller
2016-08-18 0:51 ` Jacob Keller [this message]
2016-08-18 18:06 ` [PATCH v7 4/7] submodule: allow do_submodule_path to work if given gitdir directly Stefan Beller
2016-08-18 18:46 ` Junio C Hamano
2016-08-18 18:50 ` Jacob Keller
2016-08-18 0:51 ` [PATCH v7 5/7] submodule: correct output of submodule log format Jacob Keller
2016-08-18 18:25 ` Stefan Beller
2016-08-18 18:34 ` Jacob Keller
2016-08-18 0:51 ` [PATCH v7 6/7] submodule: refactor show_submodule_summary with helper function Jacob Keller
2016-08-18 7:00 ` David Aguilar
2016-08-18 7:37 ` Jacob Keller
2016-08-18 19:04 ` Stefan Beller
2016-08-18 20:24 ` Jacob Keller
2016-08-18 20:39 ` Stefan Beller
2016-08-18 20:44 ` Jacob Keller
2016-08-18 20:49 ` Junio C Hamano
2016-08-18 21:08 ` Jacob Keller
2016-08-18 0:51 ` [PATCH v7 7/7] diff: teach diff to display submodule difference with an inline diff Jacob Keller
2016-08-18 19:47 ` Stefan Beller
2016-08-18 20:13 ` Jacob Keller
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=20160818005131.31600-5-jacob.e.keller@intel.com \
--to=jacob.e.keller@intel.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=jacob.keller@gmail.com \
--cc=peff@peff.net \
--cc=stefanbeller@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.