]> git.phdru.name Git - git-scripts.git/commitdiff
Feat: Split scripts into 3: run in one repo, recursive, in all
authorOleg Broytman <phd@phdru.name>
Thu, 28 Feb 2019 00:53:03 +0000 (03:53 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 28 Feb 2019 00:53:03 +0000 (03:53 +0300)
28 files changed:
edit-description
edit-description-recursive [new file with mode: 0755]
edit-description-repos [new file with mode: 0755]
fix-config
fix-config-recursive [new file with mode: 0755]
fix-config-repos [new file with mode: 0755]
ls-assumed
ls-assumed-recursive [new file with mode: 0755]
ls-assumed-repos [new file with mode: 0755]
ls-branches
ls-branches-recursive [new file with mode: 0755]
ls-branches-repos [new file with mode: 0755]
ls-dirty
ls-dirty-recursive [new file with mode: 0755]
ls-dirty-repos [new file with mode: 0755]
ls-no-description
ls-no-description-recursive [new file with mode: 0755]
ls-no-description-repos [new file with mode: 0755]
ls-remotes
ls-remotes-recursive [new file with mode: 0755]
ls-remotes-repos [new file with mode: 0755]
ls-stash
ls-stash-recursive [new file with mode: 0755]
ls-stash-repos [new file with mode: 0755]
ls-status
ls-status-recursive [new file with mode: 0755]
ls-status-repos [new file with mode: 0755]
run-recursive

index 3311bb9cd50269698547a2757e8e2940c2eccd14..1e7605e817e6281e6811afc3d7cc942a1859c54b 100755 (executable)
@@ -1,5 +1,8 @@
 #! /bin/sh
 
-exec "`dirname \"$0\"`"/do-all \
-   'test "`cat $g/description`" = "Unnamed repository; edit this file '"'"description"'"' to name the repository." &&
-   `git var GIT_EDITOR` "$g"/description < /dev/tty'
+g="`git rev-parse --git-dir`" &&
+
+if [ "`cat $g/description`" = "Unnamed repository; edit this file 'description' to name the repository." ]
+then
+   exec `git var GIT_EDITOR` "$g"/description < /dev/tty
+fi
diff --git a/edit-description-recursive b/edit-description-recursive
new file mode 100755 (executable)
index 0000000..d9e57f3
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/edit-description
diff --git a/edit-description-repos b/edit-description-repos
new file mode 100755 (executable)
index 0000000..7c78af4
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+exec "$prog_dir"/do-all \
+   'echo "----- $d -----" && cd "$d" &&' \
+   '"$prog_dir"/edit-description-recursive || exit 1'
index 9aa748a15f0c2478eaec1dcb816dc590a206eb92..f7d4cdaf35c7171eac083217217ea6ee22bbcc77 100755 (executable)
@@ -1,2 +1,4 @@
 #! /bin/sh
-exec "`dirname \"$0\"`"/do-all 'chmod a-x $g/config'
+
+g="`git rev-parse --git-dir`" &&
+exec chmod a-x "$g"/config
diff --git a/fix-config-recursive b/fix-config-recursive
new file mode 100755 (executable)
index 0000000..afbe197
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/fix-config
diff --git a/fix-config-repos b/fix-config-repos
new file mode 100755 (executable)
index 0000000..7a6d69f
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+exec "$prog_dir"/do-all \
+   'echo "----- $d -----" && cd "$d" &&' \
+   '"$prog_dir"/fix-config-recursive || exit 1'
index bfbfdc35cd9ff066fa73fb0adfcfaf05ea4fd1e3..7f7a4079e7a5b932b20562ce49bb073db5959fb3 100755 (executable)
@@ -1,5 +1,8 @@
 #! /bin/sh
 
-exec "`dirname \"$0\"`"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'test -n "`git ls-files -v | grep ^[a-z]`" && echo "$d"'
+d="`git rev-parse --show-toplevel`" &&
+g="`git rev-parse --git-dir`" &&
+
+if [ -n "$d" ]; then
+   if [ -n "`git ls-files -v | grep ^[a-z]`" ]; then echo "$d"; fi
+fi
diff --git a/ls-assumed-recursive b/ls-assumed-recursive
new file mode 100755 (executable)
index 0000000..d9161dc
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/ls-assumed
diff --git a/ls-assumed-repos b/ls-assumed-repos
new file mode 100755 (executable)
index 0000000..c3d177f
--- /dev/null
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+exec "$prog_dir"/do-all 'cd "$d" && "$prog_dir"/ls-assumed-recursive || exit 1'
index 1fa0ae5b533183c30c9055b8fbec407d6bc29cf3..80cdaef30259dac3803b779bb9772318c9badfef 100755 (executable)
@@ -1,10 +1,2 @@
 #! /bin/sh
-
-if [ "$1" = "-v" ]; then
-   verbose="--verbose"
-fi
-export verbose
-
-exec "`dirname \"$0\"`"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'echo "----- $d -----"; git branch --all $verbose'
+echo "----- `pwd` -----" && exec git branch --all $verbose
diff --git a/ls-branches-recursive b/ls-branches-recursive
new file mode 100755 (executable)
index 0000000..7c6bab2
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/ls-branches
diff --git a/ls-branches-repos b/ls-branches-repos
new file mode 100755 (executable)
index 0000000..737a0a3
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+if [ "$1" = "-v" ]; then
+   verbose="--verbose"
+fi
+export verbose
+
+exec "$prog_dir"/do-all 'cd "$d" && "$prog_dir"/ls-branches-recursive || exit 1'
index 109296e3bba74901197151ebc53c4ee526c8f5d4..77cad68b9f80f0917d24b02bfed54dd3d0952285 100755 (executable)
--- a/ls-dirty
+++ b/ls-dirty
@@ -1,5 +1,10 @@
 #! /bin/sh
 
-exec "`dirname \"$0\"`"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'test -n "`git ls-files --deleted --modified --others --unmerged --killed --exclude-standard --directory --no-empty-directory`" && echo "$d"'
+d="`git rev-parse --show-toplevel`" &&
+
+if [ -n "$d" ]; then
+   if [ -n "`git ls-files --deleted --modified --others --unmerged --killed --exclude-standard --directory --no-empty-directory`" ]
+   then
+      echo "$d"
+   fi
+fi
diff --git a/ls-dirty-recursive b/ls-dirty-recursive
new file mode 100755 (executable)
index 0000000..b4f4931
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/ls-dirty
diff --git a/ls-dirty-repos b/ls-dirty-repos
new file mode 100755 (executable)
index 0000000..fa9df2f
--- /dev/null
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+exec "$prog_dir"/do-all 'cd "$d" && "$prog_dir"/ls-dirty-recursive || exit 1'
index 0966ffb1db35edcd3e9c0f1c4a0fb83ffbbec0f5..81ddb61b85032b9441aa0845dc8294be9305ed45 100755 (executable)
@@ -1,4 +1,8 @@
 #! /bin/sh
 
-exec "`dirname \"$0\"`"/do-all \
-   'test "`cat $g/description`" = "Unnamed repository; edit this file '"'"description"'"' to name the repository." && echo "$d"'
+g="`git rev-parse --git-dir`" &&
+
+if [ "`cat $g/description`" = "Unnamed repository; edit this file 'description' to name the repository." ]
+then
+   echo "$g"
+fi
diff --git a/ls-no-description-recursive b/ls-no-description-recursive
new file mode 100755 (executable)
index 0000000..c1d11a6
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/ls-no-description
diff --git a/ls-no-description-repos b/ls-no-description-repos
new file mode 100755 (executable)
index 0000000..76c689b
--- /dev/null
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+exec "$prog_dir"/do-all 'cd "$d" && "$prog_dir"/ls-no-description-recursive || exit 1'
index 5371f6f7d1a34f10b10c9c63230e83961a0e08b3..542306ab73383e5da457ef9fcee36f44cf635b05 100755 (executable)
@@ -1,10 +1,2 @@
 #! /bin/sh
-
-if [ "$1" = "-v" ]; then
-   verbose="--verbose"
-fi
-export verbose
-
-exec "`dirname \"$0\"`"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'echo "----- $d -----"; git remote $verbose'
+echo "----- `pwd` -----"; exec git remote $verbose
diff --git a/ls-remotes-recursive b/ls-remotes-recursive
new file mode 100755 (executable)
index 0000000..df3a199
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/ls-remotes
diff --git a/ls-remotes-repos b/ls-remotes-repos
new file mode 100755 (executable)
index 0000000..966989f
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+if [ "$1" = "-v" ]; then
+   verbose="--verbose"
+fi
+export verbose
+
+exec "$prog_dir"/do-all 'cd "$d" && "$prog_dir"/ls-remotes-recursive || exit 1'
index 93af80db0d3e9e1ec0d1a2f4347b2a013b06f39b..193350820193a6c3b374c90f028a61bd6c0bdf0b 100755 (executable)
--- a/ls-stash
+++ b/ls-stash
@@ -1,5 +1,7 @@
 #! /bin/sh
 
-exec "`dirname \"$0\"`"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'test -n "`git stash list`" && echo "$d"'
+d="`git rev-parse --show-toplevel`" &&
+
+if [ -n "$d" ]; then
+   if [ -n "`git stash list`" ]; then echo "$d"; fi
+fi
diff --git a/ls-stash-recursive b/ls-stash-recursive
new file mode 100755 (executable)
index 0000000..64984e8
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/ls-stash
diff --git a/ls-stash-repos b/ls-stash-repos
new file mode 100755 (executable)
index 0000000..9e057ba
--- /dev/null
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+exec "$prog_dir"/do-all 'cd "$d" && "$prog_dir"/ls-stash-recursive || exit 1'
index 6892f2bdb05a6690916084ccace547bdf755b1ba..5d3808392d8233b223a82b0c556ae1520386551d 100755 (executable)
--- a/ls-status
+++ b/ls-status
@@ -1,9 +1,12 @@
 #! /bin/sh
 
-cd "`dirname \"$0\"`" &&
-prog_dir="`pwd`" &&
-export prog_dir
+d="`git rev-parse --show-toplevel`" &&
 
-exec "$prog_dir"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'test -n "`"$prog_dir"/git-status.sh --short`" && echo "$d"'
+if [ -n "$d" ]; then
+   cd "`dirname \"$0\"`" &&
+   prog_dir="`pwd`" &&
+   export prog_dir &&
+   cd "$d" &&
+
+   if [ -n "`"$prog_dir"/git-status.sh --short`" ]; then echo "$d"; fi
+fi
diff --git a/ls-status-recursive b/ls-status-recursive
new file mode 100755 (executable)
index 0000000..825d276
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+prog_dir="`dirname \"$0\"`" &&
+exec "$prog_dir"/run-recursive "$prog_dir"/ls-status
diff --git a/ls-status-repos b/ls-status-repos
new file mode 100755 (executable)
index 0000000..349cee7
--- /dev/null
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+export prog_dir
+
+exec "$prog_dir"/do-all 'cd "$d" && "$prog_dir"/ls-status-recursive || exit 1'
index 401ed2775ef5fe1baacfbf17c693a084cdcdf508..35992939c5b5993cda830df0ad09da9e887865bc 100755 (executable)
@@ -3,5 +3,5 @@
 "$@" &&
 
 if [ -f .gitmodules ]; then
-   exec git submodule foreach "$@"
+   exec git submodule foreach --quiet --recursive "$@"
 fi