From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] revert/cherry-pick: allow starting from dirty work tree.
Date: Tue, 13 Nov 2007 17:05:23 -0800 [thread overview]
Message-ID: <7vy7d1prfw.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0711132154370.4362@racer.site> (Johannes Schindelin's message of "Tue, 13 Nov 2007 23:37:34 +0000 (GMT)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> But the more fundamental question is: should we eventually have a mode in
> cherry-pick (or for that matter, apply!) which can change the submodule?
> And if so, how to go about it?
I think that would be handled in exactly the same way as
switching between two branches that bind different commits at
the submodule path.
Your work tree and index knows commit X is at the path, an
operation wants to have commit Y at the path as its result.
What's next?
It does not make much difference what that "an operation" is.
It can be apply, cherry-pick, revert, merge, or branch
switching. I think they can and should follow the same rules.
The most important rule is not to lose local changes, be they in
the index or in the work tree. So "an operation" would error
out if the index does not match HEAD at such a path, and the
work tree does not match the index.
The implementation of "work tree does not match the index" is
different when you are talking about a regular blob vs a
submodule. For a blob you know what we do. For a submodule, I
would imagine that we would check if both the index matches the
HEAD and the work tree matches the index in the submodule
(this would go recursively).
And after making sure we won't lose local changes, we switch the
submodule directory from commit X to commit Y. Most likely
detaching the HEAD with "cd sub && git checkout Y^0" or
something like that.
Then probably there will be an option added to loosen that "work
tree matches the index" check and uses "-m" option to the
checkout in the submodule directory.
More tricky is what to do with a submodule that would disappear,
though. For that, we would want .git/subprojects/foo.git/ trick
we have discussed in the past or something similar.
prev parent reply other threads:[~2007-11-14 1:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-13 21:16 [PATCH] revert/cherry-pick: allow starting from dirty work tree Junio C Hamano
2007-11-13 23:37 ` Johannes Schindelin
2007-11-14 0:21 ` Jakub Narebski
2007-11-14 1:05 ` Junio C Hamano [this message]
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=7vy7d1prfw.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
/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.