Merge pull request #7910 from jsquyres/pr/mr-clean-for-submodules
Trivial helper script to git clean submodules
Этот коммит содержится в:
Коммит
27d30f3d17
32
contrib/git-clean.sh
Исполняемый файл
32
contrib/git-clean.sh
Исполняемый файл
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
|
||||||
|
# $COPYRIGHT$
|
||||||
|
#
|
||||||
|
# Additional copyrights may follow
|
||||||
|
#
|
||||||
|
# $HEADER$
|
||||||
|
#
|
||||||
|
# Trivial helper script to git clean a tree and all of its submodules.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Top git dir
|
||||||
|
root=$(git rev-parse --show-toplevel)
|
||||||
|
cd $root
|
||||||
|
|
||||||
|
# Clean the top-level dir
|
||||||
|
echo "=== Cleaning top-level git directory"
|
||||||
|
git clean -dfx .
|
||||||
|
|
||||||
|
submodule_dirs=$(git submodule status | awk '{print $2}')
|
||||||
|
if test -z "$submodule_dirs"; then
|
||||||
|
echo "No submodules to clean"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for dir in $submodule_dirs; do
|
||||||
|
echo "=== Cleaning submodule: $dir"
|
||||||
|
cd $dir
|
||||||
|
git clean -dfx .
|
||||||
|
cd $root
|
||||||
|
done
|
Загрузка…
x
Ссылка в новой задаче
Block a user