feat(git-bulk): add new option to not follow hidden directories (#1195)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled

* feat(git-bulk): add --no-follow-hidden flag

* docs(git-bulk): add --no-follow-hidden description

* docs(man): make ronn

* docs(git-bulk): put --no-follow-hidden at right place in usage()

* refactor(git-bulk): logic optimization

Remove unnecessary subshell

Co-authored-by: Edwin Kofler <edwin@kofler.dev>

* fix(git-bulk): bad test operator

With the Bash' regexp matching operator `=~`, we need to use the Bash
conditional expression evaluation command `[[ ]]`.

* docs(completion.zsh): add --no-follow-hidden and --no-follow-symlink

---------

Co-authored-by: Pierre Ayoub <pierre.ayoub@protonmail.com>
Co-authored-by: Edwin Kofler <edwin@kofler.dev>
This commit is contained in:
Pierre Ayoub 2025-03-05 03:39:41 +01:00 committed by GitHub
parent a841845d9a
commit 18d1017325
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 5 deletions

View file

@ -10,12 +10,13 @@ singlemode=false
allwsmode=false
quiet=false
no_follow_symlinks=false
no_follow_hidden=false
#
# print usage message
#
usage() {
echo 1>&2 "usage: git bulk [--no-follow-symlinks] [-q|--quiet] [-g] ([-a]|[-w <ws-name>]) <git command>"
echo 1>&2 "usage: git bulk [--no-follow-symlinks] [--no-follow-hidden] [-q|--quiet] [-g] ([-a]|[-w <ws-name>]) <git command>"
echo 1>&2 " git bulk --addworkspace <ws-name> <ws-root-directory> (--from <URL or file>)"
echo 1>&2 " git bulk --removeworkspace <ws-name>"
echo 1>&2 " git bulk --addcurrent <ws-name>"
@ -172,7 +173,10 @@ function executBulkOp () {
cd "$gitrepodir" || exit 1 # into git repo location
local curdir=$PWD
local leadingpath=${curdir#"${actual}"}
guardedExecution "$@"
# do not execute if we do not want to consider a ".git" directory under a hidden directory
if [ $no_follow_hidden = false ] || ! [[ "$leadingpath" =~ "/." ]]; then
guardedExecution "$@"
fi
cd "$rwsdir" || exit 1 # back to origin location of last find command
done
done
@ -193,6 +197,8 @@ while [ "${#}" -ge 1 ] ; do
butilcommand="${1:2}" && wsname="$2" && wsdir="$3" && if [ "$4" == "--from" ]; then source="$5"; fi && break ;;
--no-follow-symlinks)
no_follow_symlinks=true ;;
--no-follow-hidden)
no_follow_hidden=true ;;
-a)
allwsmode=true ;;
-g)

View file

@ -135,6 +135,8 @@ _git-bulk() {
'-g[Ask the user for confirmation on every execution (guarded mode).]' \
'-w[Run the git command on the specified workspace.]:workspace-name:__gitex_workspace_names' \
'-q[Suppress bulk output about current execution (quiet mode).]' \
'--no-follow-symlinks[Do not traverse symbolic links when searching for git repositories.]' \
'--no-follow-hidden[Do not traverse hidden directories when searching for git repositories.]' \
'--addworkspace[Register a workspace for bulk operations.]' \
'--removeworkspace[Remove the specified workspace.]:workspace-name:__gitex_workspace_names' \
'--addcurrent[Adds the current directory as workspace to git bulk operations]' \

View file

@ -4,7 +4,7 @@
.SH "NAME"
\fBgit\-bulk\fR \- Run git commands on multiple repositories
.SH "SYNOPSIS"
\fBgit\-bulk\fR [\-g] [\-\-no\-follow\-symlinks] ([\-a]|[\-w
\fBgit\-bulk\fR [\-g] [\-\-no\-follow\-symlinks] [\-\-no\-follow\-hidden] ([\-a]|[\-w
.br
\fBgit\-bulk\fR \-\-addworkspace
.br
@ -37,6 +37,10 @@ Ask the user for confirmation on every execution\.
.P
Do not traverse symbolic links under the workspace when searching for git repositories\.
.P
\-\-no\-follow\-hidden
.P
Do not traverse hidden (dotted) directories under the workspace when searching for git repositories\.
.P
\-w <ws\-name>
.P
Run the git command on the specified workspace\. The workspace must be registered\.

View file

@ -78,7 +78,7 @@
</p>
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p><code>git-bulk</code> [-g] [--no-follow-symlinks] ([-a]|[-w <ws-name>]) <git command> </git></ws-name><br>
<p><code>git-bulk</code> [-g] [--no-follow-symlinks] [--no-follow-hidden] ([-a]|[-w <ws-name>]) <git command> </git></ws-name><br>
<code>git-bulk</code> --addworkspace <ws-name> <ws-root-directory> (--from <url or file>) </url></ws-root-directory></ws-name><br>
<code>git-bulk</code> --removeworkspace &lt;ws-name&gt; <br>
<code>git-bulk</code> --addcurrent &lt;ws-name&gt; <br>
@ -110,6 +110,10 @@
<p>Do not traverse symbolic links under the workspace when searching for git repositories.</p>
<p>--no-follow-hidden</p>
<p>Do not traverse hidden (dotted) directories under the workspace when searching for git repositories.</p>
<p>-w &lt;ws-name&gt;</p>
<p>Run the git command on the specified workspace. The workspace must be registered.</p>

View file

@ -3,7 +3,7 @@ git-bulk(1) -- Run git commands on multiple repositories
## SYNOPSIS
`git-bulk` [-g] [--no-follow-symlinks] ([-a]|[-w &lt;ws-name&gt;]) &lt;git command&gt; <br/>
`git-bulk` [-g] [--no-follow-symlinks] [--no-follow-hidden] ([-a]|[-w &lt;ws-name&gt;]) &lt;git command&gt; <br/>
`git-bulk` --addworkspace &lt;ws-name&gt; &lt;ws-root-directory&gt; (--from &lt;URL or file&gt;) <br/>
`git-bulk` --removeworkspace &lt;ws-name&gt; <br/>
`git-bulk` --addcurrent &lt;ws-name&gt; <br/>
@ -32,6 +32,10 @@ git bulk adds convenient support for operations that you want to execute on mult
Do not traverse symbolic links under the workspace when searching for git repositories.
--no-follow-hidden
Do not traverse hidden (dotted) directories under the workspace when searching for git repositories.
-w &lt;ws-name&gt;
Run the git command on the specified workspace. The workspace must be registered.