git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jacob Keller <jacob.keller@gmail.com>, "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] submodule: correct error message for missing commits.
Date: Wed, 26 Jul 2017 13:56:17 -0700
Message-ID: <CAGZ79kaYQ5Lzz5i_+uLt3wWtid+YvDxXSyw=isaYj3+98X7Mbg@mail.gmail.com> (raw)
In-Reply-To: <xmqqh8xzq6td.fsf@gitster.mtv.corp.google.com>

On Wed, Jul 26, 2017 at 1:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> When a submodule diff should be displayed we currently just add the
>> submodule objects to the main object store and then e.g. walk the
>> revision graph and create a summary for that submodule.
>>
>> It is possible that we are missing the submodule either completely or
>> partially, which we currently differentiate with different error messages
>> depending on whether (1) the whole submodule object store is missing or
>> (2) just the needed for this particular diff. (1) is reported as
>> "not initialized", and (2) is reported as "commits not present".
>>
>> If a submodule is deinit'ed its repository data is still around inside
>> the superproject, such that the diff can still be produced. In that way
>> the error message (1) is misleading as we can have a diff despite the
>> submodule being not initialized.
>
> This is confusing...
>
> So are you saying that if we do "submodule init A && submodule
> update A" followed by "submodule deinit A",

  $ git clone https://gerrit.googlesource.com/gerrit
  $ git show --submodule=log bb798b00bb
  ...
  Submodule plugins/replication ... (not initialized)

  $ git submodule update --init
  $ # a good example of cross repo changes:
  $ git show --submodule=log bb798b00bb
  ...
  Submodule plugins/replication db4aecb2b8...98b7156cee:
  > Stop using WorkQueue#unregisterWorkQueue.
  < PushOne: Remove redundant string concatenation

  $ git submodule deinit -f --all
  $ git show --submodule=log bb798b00bb
  ...
  Submodule plugins/replication db4aecb2b8...98b7156cee:
  > Stop using WorkQueue#unregisterWorkQueue.
  < PushOne: Remove redundant string concatenation

  $ rm -rf .git/modules/*
  $ git show --submodule=log bb798b00bb
  ...
  Submodule plugins/replication ... (not initialized)

> we _could_ show the
> difference for submodule A between two commits in the superproject,
> because we already have the necessary data for the submodule, but we
> _choose_ not to show it because the user told us explicitly that the
> submodule is not interesting?

We _do_ show the submodule as demonstrated by the code sample above
if we possess the objects.

Hence the "not initialized" is not quite technically correct. (After deinit it
is not initialized, but we show nevertheless, so the user perceived
_reason_ why we do not show the submodule is "commits not present".

> That sounds like a very sensible and user-centric behaviour to me,
> and "not initialized" sounds like the right message to give in such
> a case (as opposed to "commits not present"---even the user told us
> they are not interesting, we may have them, so "not present" is not
> just incorrect but irrelevant because that is not the reason why we
> are not showing).

So you are saying we should instead do:

  if (not active)
    message = "not initialized"
  if (problems with object loading)
    message = "commits not present"
  ...

> Or are you saying that even the user told us that the submodule is
> not interesting, if we had "init" it earlier even once, we show the
> difference and with a wrong label?  Showing the difference sounds
> like a bug that is more severe than using a wrong label to me.

I looked through the man pages and they never specify if submodule
activeness affects the superproject diff, so we'd want to change that
so that only active submodules are diffed.

  reply index

Thread overview: 7+ messages in thread (expand / mbox.gz / Atom feed / [top])
2017-07-26 20:08 Stefan Beller
2017-07-26 20:30 ` Junio C Hamano
2017-07-26 20:56   ` Stefan Beller [this message]
2017-07-26 21:10     ` Junio C Hamano
2017-09-26 18:27 Stefan Beller
2017-09-26 23:37 ` Jacob Keller
2017-09-27  0:52 ` Junio C Hamano

Reply instructions:

You may reply publically 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 to all the recipients using the --to, --cc,
  and --in-reply-to switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGZ79kaYQ5Lzz5i_+uLt3wWtid+YvDxXSyw=isaYj3+98X7Mbg@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.keller@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

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox