git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Stefan Beller <sbeller@google.com>, git@vger.kernel.org
Subject: Re: [PATCH] submodule: spell out API of submodule_move_head
Date: Tue, 10 Oct 2017 09:42:33 +0900	[thread overview]
Message-ID: <xmqqmv4zrfye.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171010002731.GM19555@aiede.mtv.corp.google.com> (Jonathan Nieder's message of "Mon, 9 Oct 2017 17:27:31 -0700")

Jonathan Nieder <jrnieder@gmail.com> writes:

>> This is not a new issue (the removed comment did not mention this at
>> all), but is it correct to say that updates to "index and work tree"
>> was as if we did "git -C $path checkout new" (and of course, HEAD in
>> the $path submodule must be at 'old')?
>
> I don't understand the question.  This comment doesn't say it's like
> "git checkout" --- are you saying it should?

No, I am pointing out that this comment does not say what it's like
clearly enough.  s/is it correct/am I correct/ would have been less
prone to get misunderstood, I guess.

> The function is more like "git read-tree -m -u" (or --reset when
> SUBMODULE_MOVE_HEAD_FORCE is passed) than like "git checkout".

If it behaves like two-tree "read-tree -m -u", I'd say that the best
explanation an average developer would understand is that the update
done to "index and work tree" is like using 'git checkout' to switch
to the branch whose tip is 'new'.

> Perhaps what you are hinting at is that read-tree --recurse-submodules
> is not necessarily the right primitive to implement "git checkout"
> with.  But that's a separate issue from documenting the current
> behavior of the function.

No, you are way too ahead in this discussion.  I was merely saying
that what the comment says was unclear and does not allow me to get
that far due to lack of clear information ;-).

>> What should happen if 'old' does not match reality (i.e. old is NULL
>> but HEAD does point at some commit, old and HEAD are different,
>> etc.)?  Should the call be aborted?
>
> No.

... and that is because?

When does it make sense to do a two-tree "read-tree -m -u" giving
the 'old' that is very different from the real 'old' tree-ish that
corresponds to where your index started at?


  reply	other threads:[~2017-10-10  0:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 22:06 [PATCH] submodule: spell out API of submodule_move_head Stefan Beller
2017-10-09 22:22 ` Jonathan Nieder
2017-10-10  0:16 ` Junio C Hamano
2017-10-10  0:27   ` Jonathan Nieder
2017-10-10  0:42     ` Junio C Hamano [this message]
2017-10-10  0:55       ` Jonathan Nieder
2017-10-10  1:06         ` 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

  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=xmqqmv4zrfye.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=sbeller@google.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).