git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Stefan Beller <stefanbeller@gmail.com>, Jeff King <peff@peff.net>,
	Johannes Sixt <j6t@kdbg.org>
Subject: Re: [PATCH v9 0/8] submodule show inline diff
Date: Fri, 19 Aug 2016 23:16:13 -0700	[thread overview]
Message-ID: <CA+P7+xoazoY49cXMghVQmCd=X-aEj6xCTqQqr69zciFZAqmw_Q@mail.gmail.com> (raw)
In-Reply-To: <CAGZ79kZqkHO58kUvP772jfTUgyYXxYuDkgGB1sOTYYQ6nLCP4A@mail.gmail.com>

On Fri, Aug 19, 2016 at 5:02 PM, Stefan Beller <sbeller@google.com> wrote:
> On Fri, Aug 19, 2016 at 4:34 PM, Jacob Keller <jacob.e.keller@intel.com> wrote:
>> -               strbuf_git_path(buf, "%s/%s", "modules", path);
>> +               /*
>> +                * Lookup the submodule name from the config. If that fails
>> +                * fall back to assuming the path is the name.
>> +                */
>> +               submodule_config = submodule_from_path(null_sha1, path);
>
> In case you need to reroll: I'd got with just "sub" as the name for
> the config object
> (that seems to be used all the time and is shorter)
>

Sure.

>
>> +               if (submodule_config)
>> +                       strbuf_git_path(buf, "%s/%s", "modules",
>> +                                       submodule_config->name);
>> +               else
>
> I do not think we want to assume the path as the name for the fallback, though.
>

I couldn't think of anything better to do.... There is no error return
flow, so just... leave it as is maybe?

> If `submodule_config == NULL` then
> a) the path/name doesn't exist in the given version.
>     (If null_sha1 is given, HEAD + working tree is assumed, whereas
>     you could also check for a specific commit of the superproject
>     with another sha1)

I can't check for a specific version here because there is no
mechanism to pass in the value we'd check it in... Maybe I need a
separate function for that to check the specific sha1 instead of using
nullsha1? But.. no I don't think that makes sense, we use the current
working tree to get the submodule and then lookup old references in
it... but if we checked an old tree it might be in the wrong path
which does us no good because the name no longer matches? Hmmm

>
> b) or the submodule config cache was not initialized
>    (missing call to gitmodules_config())
>
> c) There is no c) [at least I never came across another reason for a
> NULL return here]
>
> Using the path as the fallback is errorprone (e.g. to b. in the future
> and then you get the wrong submodule repository which is shaded by
> assuming the path and it is hard to debug later or write forward looking
> tests for that now)

Sure, but if it doesn't exist we just fail.. so what should I put in
the string? just leave it empty? The function doesn't have an error
return at the moment.

>
> Thanks,
> Stefan

  reply	other threads:[~2016-08-20  6:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19 23:34 [PATCH v9 0/8] submodule show inline diff Jacob Keller
2016-08-19 23:34 ` [PATCH v9 1/8] cache: add empty_tree_oid object and helper function Jacob Keller
2016-08-19 23:34 ` [PATCH v9 2/8] diff.c: remove output_prefix_length field Jacob Keller
2016-08-19 23:34 ` [PATCH v9 3/8] graph: add support for --line-prefix on all graph-aware output Jacob Keller
2016-08-19 23:34 ` [PATCH v9 4/8] diff: prepare for additional submodule formats Jacob Keller
2016-08-19 23:34 ` [PATCH v9 5/8] submodule: allow add_submodule_odb to work even if path is not checked out Jacob Keller
2016-08-19 23:34 ` [PATCH v9 6/8] submodule: convert show_submodule_summary to use struct object_id * Jacob Keller
2016-08-19 23:34 ` [PATCH v9 7/8] submodule: refactor show_submodule_summary with helper function Jacob Keller
2016-08-19 23:34 ` [PATCH v9 8/8] diff: teach diff to display submodule difference with an inline diff Jacob Keller
2016-08-20  0:02 ` [PATCH v9 0/8] submodule show " Stefan Beller
2016-08-20  6:16   ` Jacob Keller [this message]
2016-08-22 17:43     ` Stefan Beller

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+P7+xoazoY49cXMghVQmCd=X-aEj6xCTqQqr69zciFZAqmw_Q@mail.gmail.com' \
    --to=jacob.keller@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jacob.e.keller@intel.com \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).