mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
feat(git-bulk): add new option to not follow hidden directories (#1195)
* 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:
parent
a841845d9a
commit
18d1017325
10
bin/git-bulk
10
bin/git-bulk
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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]' \
|
||||
|
|
|
|||
|
|
@ -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\.
|
||||
|
|
|
|||
|
|
@ -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 <ws-name> <br>
|
||||
<code>git-bulk</code> --addcurrent <ws-name> <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 <ws-name></p>
|
||||
|
||||
<p>Run the git command on the specified workspace. The workspace must be registered.</p>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ git-bulk(1) -- Run git commands on multiple repositories
|
|||
|
||||
## SYNOPSIS
|
||||
|
||||
`git-bulk` [-g] [--no-follow-symlinks] ([-a]|[-w <ws-name>]) <git command> <br/>
|
||||
`git-bulk` [-g] [--no-follow-symlinks] [--no-follow-hidden] ([-a]|[-w <ws-name>]) <git command> <br/>
|
||||
`git-bulk` --addworkspace <ws-name> <ws-root-directory> (--from <URL or file>) <br/>
|
||||
`git-bulk` --removeworkspace <ws-name> <br/>
|
||||
`git-bulk` --addcurrent <ws-name> <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 <ws-name>
|
||||
|
||||
Run the git command on the specified workspace. The workspace must be registered.
|
||||
|
|
|
|||
Loading…
Reference in a new issue