From: Mugdha Pattnaik <mugdhapattnaik@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Mugdha Pattnaik via GitGitGadget" <gitgitgadget@gmail.com>,
git@vger.kernel.org, "Bagas Sanjaya" <bagasdotme@gmail.com>,
"Atharva Raykar" <raykar.ath@gmail.com>,
"Christian Couder" <christian.couder@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH v6] submodule: absorb git dir instead of dying on deinit
Date: Wed, 17 Nov 2021 11:25:06 +0530 [thread overview]
Message-ID: <CAA4dvxixLKAQeLTUnLFvnwrAzQg2w0zqH7gCUqYLXjf=SAP-wA@mail.gmail.com> (raw)
In-Reply-To: <xmqqy25o9bie.fsf@gitster.g>
On Wed, Nov 17, 2021 at 12:24 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Mugdha Pattnaik <mugdhapattnaik@gmail.com> writes:
>
> >> OK. That sounds like an improvement, albeit possibly an overly
> >> cautious one, as a casual "deinit" user will get an error as before
> >> without "--force", which may or may not be a good thing. Requiring
> >> "--force" means it is safer by default by not changing the on-disk
> >> data. But requiring "--force" also means we end up training users
> >> to say "--force" when it shouldn't have to be.
> >> ...
> >> Does "git submodule" currently reject a "deinit" request due to some
> >> _other_ conditions or safety concerns and require the "--force"
> >> option to continue? Requiring the "--force" option to resolve ".git
> >> is a directory, and the user wants to make it absorbed" means that
> >> the user will be _forced_ to bypass these _other_ safety valves only
> >> to save the submodule repository from destruction when running
> >> "deinit", which may not be a good trade-off between the safety
> >> requirements of these _other_ conditions, if exists, and the one we
> >> are dealing with.
> >
> > This is definitely a situation we want to avoid. How about we try to run
> > a check for uncommitted local modifications first?
>
> I am not sure if I follow. If we stop (ab)using "--force" for the
> situation (i.e. where today's "deinit" would die because .git needs
> to be absorbed first), then the user would not have to say "--force"
> which may override other safety valve. You'd check if .git needs to
> be absorbed, make it absorbed as needed while reporting the fact
> that you did so, and then let the existing "deinit" code to take
> over. If there are other safety checks that needs "--force" to be
> overridden, that is handled (presumably) correctly by the existing
> code, no? So other than "do we need absorbing, and if so do it for
> the user" check, I do not think you'd need to add any new "we try to
> run a check for ..." at all.
Yes, I understand why "--force" should not be used. The reason why I
suggested the check for local modifications is because I thought we
should warn users that they have local modifications before we absorb
the gitdir. But I see now that this is okay, considering deinit would
die in such a situation anyway, and users would not lose their work.
The only side-effect of running deinit despite users having local
modifications, would be that the gitdir of the submodule has been
absorbed and that should be okay.
--
Mugdha
next prev parent reply other threads:[~2021-11-17 5:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 18:33 [PATCH] submodule: absorb git dir instead of dying on deinit Mugdha Pattnaik via GitGitGadget
2021-08-27 6:03 ` [PATCH v2] " Mugdha Pattnaik via GitGitGadget
2021-08-27 13:20 ` Atharva Raykar
2021-08-27 17:28 ` Junio C Hamano
2021-08-27 18:10 ` [PATCH v3] " Mugdha Pattnaik via GitGitGadget
2021-08-27 18:51 ` [PATCH v4] " Mugdha Pattnaik via GitGitGadget
2021-09-28 7:30 ` Christian Couder
2021-09-28 9:53 ` Ævar Arnfjörð Bjarmason
2021-10-06 11:45 ` Mugdha Pattnaik
2021-10-06 12:02 ` [PATCH v5] " Mugdha Pattnaik via GitGitGadget
2021-10-06 12:24 ` [PATCH v6] " Mugdha Pattnaik via GitGitGadget
2021-10-07 19:41 ` Junio C Hamano
2021-11-16 18:20 ` Mugdha Pattnaik
2021-11-16 18:54 ` Junio C Hamano
2021-11-17 5:55 ` Mugdha Pattnaik [this message]
2021-11-19 10:56 ` [PATCH v7] " Mugdha Pattnaik via GitGitGadget
2021-08-27 7:51 ` [PATCH] " Bagas Sanjaya
2021-08-27 13:13 ` Mugdha Pattnaik
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='CAA4dvxixLKAQeLTUnLFvnwrAzQg2w0zqH7gCUqYLXjf=SAP-wA@mail.gmail.com' \
--to=mugdhapattnaik@gmail.com \
--cc=avarab@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=raykar.ath@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).