kumquat-buildroot/support
Yann E. MORIN 80d8bc6e46 download/git: ensure we can checkout repos with submodule conversions
When a git tree has had sub-dir <-> sub-module conversions, or has had
submodules added or removed over the course of time, checking out a
changeset across those conversions/additions/removals may leave
untracked files, or may fail because of a conflict of type.

So, before we checkout the new changeset, we forcibly remove the
submodules. The new set of submodules, if any, will be restored later.

Ideally, we would use a native git command: git submodule deinit --all.
However, that was only introduced in git 1.8.3 which, while not being
recent by modern standards, is still too old for some enterprise-grade
distributions (RHEL6 only has git-1.7.1).

So, instead, we just use git submodule foreach, to rm -rf the submodules
directory.

Again, we would ideally use 'cd $toplevel && rm -rf $path', but
$toplevel was only introduced in git 1.7.2. $path has always been there.

So, instead, we just cd back one level, and remove the basename of the
directory.

Eventually, we need to get rid of now-empty and untracked directories,
that were parents of a removed submodule. For example. ./foo/bar/ was a
submodule, so ./foo/bar/ was removed, which left ./foo/ around.

Yet again, recent-ish git versions would have removed it during the
forced checkout, but old-ish versions (e.g. 1.7.1) do not remove it with
the forced checkout.

Instead we rely on the already used forced-forced clean of directories,
untracked, and ignored content, to really get rid of extra stuff we are
not interested in.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Tested-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-05-01 21:22:28 +02:00
..
config-fragments support/config-fragments/autobuild: update ARC pre-built toolchain 2018-04-22 12:28:41 +02:00
dependencies check-host-tar.sh: bump minimum tar version to 1.27 for reproducible tar files with long paths 2018-04-02 14:46:52 +02:00
docker support/dockerfile: install flake8 2018-03-13 22:32:36 +01:00
download download/git: ensure we can checkout repos with submodule conversions 2018-05-01 21:22:28 +02:00
gnuconfig
kconfig merge_config.sh: add br2-external support 2018-01-29 14:54:42 +01:00
legal-info
libtool
misc Update for 2018.02 2018-03-04 22:28:34 +01:00
scripts support/scripts: drop xorg-release script 2018-04-27 22:50:36 +02:00
testing support/testing: set $USER in rust tests 2018-04-29 09:57:32 +02:00