From: Patrick Steinhardt <ps@pks.im>
To: Jens Lehmann <Jens.Lehmann@web.de>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
git@vger.kernel.org, Heiko Voigt <hvoigt@hvoigt.net>
Subject: Re: [RFC] git submodule purge
Date: Thu, 26 Mar 2015 14:30:52 +0100 [thread overview]
Message-ID: <20150326133052.GA382@pks-pc.localdomain> (raw)
In-Reply-To: <551310EF.8050700@web.de>
[-- Attachment #1: Type: text/plain, Size: 3440 bytes --]
On Wed, Mar 25, 2015 at 08:47:59PM +0100, Jens Lehmann wrote:
> Am 25.03.2015 um 10:06 schrieb Patrick Steinhardt:
> > On Mon, Mar 23, 2015 at 10:32:27PM +0100, Jens Lehmann wrote:
> >> Am 17.03.2015 um 08:56 schrieb Patrick Steinhardt:
[snip]
> >> Hmm, cmd_deinit() seems to cope with submodules removed by the
> >> user just fine (as long as they are still present in the index).
> >> To me it feels natural to extend deinit to remove the repo from
> >> .git/modules too when --purge is given (as long as no unpushed
> >> commits are present or -f is given).
> >>
> >>> `git gc` feels saner in that regard, but I don't think it would
> >>> be easy to spot for users as this command is in general not used
> >>> very frequently by them. One could argue though that it does not
> >>> need to be discoverable.
> >>
> >> The error message of "git submodule deinit --purge" for a
> >> submodule that isn't recorded in the index anymore could point
> >> the user to the appropriate gc command. But how do we tell gc
> >> which submodule it should purge? "--purge=<submodule-name>"
> >> maybe?
> >
> > This might work, but at least the option would need to provide a
> > hint to the user that it has something to do with submodules. So
> > if the feature was implemented by `git gc` I'd rather name the
> > parameter "--purge-submodule=<submodule-name>" which in my
> > opinion clearly states its intention, even though it is longer to
> > type. But with working bash-completion this should be non-issue,
> > especially as this command would not need to be run frequently.
>
> Agreed.
>
> > That said, I think by now I agree with the common (?) opinion
> > that the command is best placed in `git submodule deinit --purge`
> > and I will likely implement it there.
>
> Me thinks that makes sense. But be aware that this will only work
> for those submodules that are still present in the current index.
>
> > Optionally I could
> > implement `git gc --purge-submodule=<submodule-name>` as a second
> > way to access the feature so that we have a way of purging them
> > without using the submodules-interface. I doubt though that this
> > will provide much of a benefit as the user still has to be aware
> > that he is working with submodules as he has to provide the
> > `--purge-submodule` option, so there is not much to be gained by
> > this.
>
> Hmm, I still believe cleaning up a submodule repo which is already
> deinited makes sense. Using 'rm -rf .git/modules/<submodulename>'
> will work just fine, but is missing any safeguards. The deinit
> command takes submodule paths, not submodule names. So it looks
> to me like 'git gc --purge-submodule=<submodule-name>' would make
> sense here (and this command should check that the submodule has
> already been deinited and fail otherwise telling the user so).
Ah, okay. I thought your intention was to provide `git gc
--purge-sm` _instead_ of `git sm deinit --purge`. Guess it makes
sense to have both available for the different use cases
(explicitly removing a submodule vs removing unreferenced ones).
I guess one could even provide another option
`--purge-submodules` in addition to `--purge-sm=<smname>` that
will remove all deinitialized submodules without local commits.
Maybe its desirable to have a `--dry-run` flag as well that would
print which repositories would be deleted by `--purge-sms`.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-03-26 13:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-16 13:44 [RFC] git submodule purge Patrick Steinhardt
2015-03-16 15:55 ` Junio C Hamano
2015-03-17 8:18 ` Patrick Steinhardt
2015-03-17 8:25 ` Fredrik Gustafsson
2015-03-16 20:03 ` Jonathan Nieder
2015-03-17 7:56 ` Patrick Steinhardt
2015-03-23 21:32 ` Jens Lehmann
2015-03-25 9:06 ` Patrick Steinhardt
2015-03-25 19:47 ` Jens Lehmann
2015-03-26 13:30 ` Patrick Steinhardt [this message]
2015-03-26 21:48 ` Jens Lehmann
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=20150326133052.GA382@pks-pc.localdomain \
--to=ps@pks.im \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
--cc=jrnieder@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.
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 NNTP newsgroup(s).