summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2015-05-30 03:22:52 +0200
committerSage Weil <sage@redhat.com>2015-05-30 03:22:52 +0200
commit8bd27b61cb6c4f86661d8c3090853bd8997d2529 (patch)
tree13bfca74c1ae0570f760db6e193c031e729ba102 /bin
parentbin/git-archive-all.sh (diff)
downloadceph-8bd27b61cb6c4f86661d8c3090853bd8997d2529.tar.xz
ceph-8bd27b61cb6c4f86661d8c3090853bd8997d2529.zip
bin/git-all-archive.sh: add --ignore option
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/git-archive-all.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/git-archive-all.sh b/bin/git-archive-all.sh
index d2cb01900ff..68c31eac497 100755
--- a/bin/git-archive-all.sh
+++ b/bin/git-archive-all.sh
@@ -63,7 +63,7 @@ function usage () {
echo " Prints this usage output and exits."
echo
echo "$PROGRAM [--format <fmt>] [--prefix <path>] [--verbose|-v] [--separate|-s]"
- echo " [--tree-ish|-t <tree-ish>] [output_file]"
+ echo " [--tree-ish|-t <tree-ish>] [--ignore pattern] [output_file]"
echo " Creates an archive for the entire git superproject, and its submodules"
echo " using the passed parameters, described below."
echo
@@ -83,6 +83,9 @@ function usage () {
echo " Defaults to HEAD if not specified. See git archive's documentation for more"
echo " information on what a tree-ish is."
echo
+ echo " If '--ignore' is specified, we will filter out any submodules that"
+ echo " match the specified pattern."
+ echo
echo " If 'output_file' is specified, the resulting archive is created as the"
echo " file named. This parameter is essentially a path that must be writeable."
echo " When combined with '--separate' ('-s') this path must refer to a directory."
@@ -114,6 +117,7 @@ TARCMD=tar
FORMAT=tar
PREFIX=
TREEISH=HEAD
+IGNORE=
# RETURN VALUES/EXIT STATUS CODES
readonly E_BAD_OPTION=254
@@ -145,6 +149,12 @@ while test $# -gt 0; do
shift
;;
+ --ignore )
+ shift
+ IGNORE="$1"
+ shift
+ ;;
+
--version )
version
exit
@@ -207,6 +217,12 @@ find . -mindepth 2 -name '.git' -type d -print | sed -e 's/^\.\///' -e 's/\.git$
# as of version 1.7.8, git places the submodule .git directories under the superprojects .git dir
# the submodules get a .git file that points to their .git dir. we need to find all of these too
find . -mindepth 2 -name '.git' -type f -print | xargs grep -l "gitdir" | sed -e 's/^\.\///' -e 's/\.git$//' >> $TOARCHIVE
+
+if [ -n "$IGNORE" ]; then
+ cat $TOARCHIVE | grep -v $IGNORE > $TOARCHIVE.new
+ mv $TOARCHIVE.new $TOARCHIVE
+fi
+
if [ $VERBOSE -eq 1 ]; then
echo "done"
echo " found:"