From 85bb1ca14fceb299bc688a926fcafe6011dcaf9a Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 28 Feb 2019 02:24:11 +0300 Subject: [PATCH] Refactor: Factor out run-recursive --- fsck-recursive | 6 +----- gc-not-packed-recursive | 6 +----- run-recursive | 7 +++++++ set-commit-date-recursive | 8 +------- 4 files changed, 10 insertions(+), 17 deletions(-) create mode 100755 run-recursive diff --git a/fsck-recursive b/fsck-recursive index 3e47bd2..43d6136 100755 --- a/fsck-recursive +++ b/fsck-recursive @@ -1,8 +1,4 @@ #! /bin/sh prog_dir="`dirname \"$0\"`" && -"$prog_dir"/fsck && - -if [ -f .gitmodules ]; then - exec git submodule foreach "$prog_dir"/fsck -fi +exec "$prog_dir"/run-recursive "$prog_dir"/fsck diff --git a/gc-not-packed-recursive b/gc-not-packed-recursive index ca17043..8d47871 100755 --- a/gc-not-packed-recursive +++ b/gc-not-packed-recursive @@ -1,8 +1,4 @@ #! /bin/sh prog_dir="`dirname \"$0\"`" && -"$prog_dir"/gc-not-packed && - -if [ -f .gitmodules ]; then - exec git submodule foreach "$prog_dir"/gc-not-packed -fi +exec "$prog_dir"/run-recursive "$prog_dir"/gc-not-packed diff --git a/run-recursive b/run-recursive new file mode 100755 index 0000000..401ed27 --- /dev/null +++ b/run-recursive @@ -0,0 +1,7 @@ +#! /bin/sh + +"$@" && + +if [ -f .gitmodules ]; then + exec git submodule foreach "$@" +fi diff --git a/set-commit-date-recursive b/set-commit-date-recursive index 2caa688..fd6852c 100755 --- a/set-commit-date-recursive +++ b/set-commit-date-recursive @@ -1,10 +1,4 @@ #! /bin/sh -# Call set-commit-date on the repo and all submodules - prog_dir="`dirname \"$0\"`" && -"$prog_dir"/set-commit-date.py && \ - -if [ -f .gitmodules ]; then - exec git submodule foreach "$prog_dir"/set-commit-date.py -fi +exec "$prog_dir"/run-recursive "$prog_dir"/set-commit-date.py -- 2.39.2