* Cleaning projects with submodules
@ 2015-04-25 21:36 Simon Richter
2015-04-27 12:47 ` Heiko Voigt
0 siblings, 1 reply; 2+ messages in thread
From: Simon Richter @ 2015-04-25 21:36 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 788 bytes --]
Hi,
I'm trying to set up a continuous integration build for Boost, which
uses massive amounts of submodules, and keep running into problems when
running "git clean" in the toplevel project.
When I switch to a version where a submodule has been removed (e.g. an
earlier version), "git clean -dx" will not remove the submodule's
directory, because it has its own .git directory. Using a single -f
flag, the process fails (because directories containing .git directories
are no longer skipped), and using -ff removes all submodules (which is
overkill).
Is there a good way to clean a project, leaving valid submodules in
place (these are then switched to the new tip and cleaned in separate
commands) while removing submodules that are no longer referenced?
Simon
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Cleaning projects with submodules
2015-04-25 21:36 Cleaning projects with submodules Simon Richter
@ 2015-04-27 12:47 ` Heiko Voigt
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Voigt @ 2015-04-27 12:47 UTC (permalink / raw)
To: Simon Richter; +Cc: git
Hi,
On Sat, Apr 25, 2015 at 11:36:25PM +0200, Simon Richter wrote:
> I'm trying to set up a continuous integration build for Boost, which
> uses massive amounts of submodules, and keep running into problems when
> running "git clean" in the toplevel project.
>
> When I switch to a version where a submodule has been removed (e.g. an
> earlier version), "git clean -dx" will not remove the submodule's
> directory, because it has its own .git directory. Using a single -f
> flag, the process fails (because directories containing .git directories
> are no longer skipped), and using -ff removes all submodules (which is
> overkill).
>
> Is there a good way to clean a project, leaving valid submodules in
> place (these are then switched to the new tip and cleaned in separate
> commands) while removing submodules that are no longer referenced?
Unfortunately there is no really nice way for that yet. Safely removing
submodule ist still under development.
Here is a snippet that I used on a CI server for this purpose:
git status --porcelain | grep "^?? " | sed -e 's/^?? //' | \
while read i; do
rm -rf "$i"
done
It does a little more, since it unconditionally removes all untracked files
that are not ignored.
Cheers Heiko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-27 12:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-25 21:36 Cleaning projects with submodules Simon Richter
2015-04-27 12:47 ` Heiko Voigt
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).