diff --git a/bin/git-bulk b/bin/git-bulk index 1b54e20d..4c9ec533 100755 --- a/bin/git-bulk +++ b/bin/git-bulk @@ -9,12 +9,13 @@ guardedmode=false singlemode=false allwsmode=false quiet=false +no_follow_symlinks=false # # print usage message # usage() { - echo 1>&2 "usage: git bulk [-q|--quiet] [-g] ([-a]|[-w ]) " + echo 1>&2 "usage: git bulk [--no-follow-symlinks] [-q|--quiet] [-g] ([-a]|[-w ]) " echo 1>&2 " git bulk --addworkspace (--from )" echo 1>&2 " git bulk --removeworkspace " echo 1>&2 " git bulk --addcurrent " @@ -146,7 +147,15 @@ function executBulkOp () { local actual=$PWD [ "${quiet?}" != "true" ] && echo 1>&2 "Executing bulk operation in workspace ${inverse}$actual${reset}" - allGitFolders=( $(eval find -L . -name ".git" 2>/dev/null) ) + # build `find` flags depending on command-line options + local find_flags=() + if [[ "$no_follow_symlinks" == true ]]; then + find_flags+=(-P) + else + find_flags+=(-L) + fi + # find all git repositories under the workspace on which we want to operate + readarray allGitFolders < <(find "${find_flags[@]}" . -name ".git" 2>/dev/null) for line in "${allGitFolders[@]}"; do local gitrepodir=${line::${#line}-5} # cut the .git part of find results to have the root git directory of that repository @@ -172,6 +181,8 @@ while [ "${#}" -ge 1 ] ; do butilcommand="${1:2}" && break ;; --removeworkspace|--addcurrent|--addworkspace) butilcommand="${1:2}" && wsname="$2" && wsdir="$3" && if [ "$4" == "--from" ]; then source="$5"; fi && break ;; + --no-follow-symlinks) + no_follow_symlinks=true ;; -a) allwsmode=true ;; -g) diff --git a/man/git-bulk.1 b/man/git-bulk.1 index 1266608c..f959574a 100644 --- a/man/git-bulk.1 +++ b/man/git-bulk.1 @@ -1,10 +1,10 @@ .\" generated with Ronn-NG/v0.9.1 .\" http://github.com/apjanke/ronn-ng/tree/0.9.1 -.TH "GIT\-BULK" "1" "September 2024" "" "Git Extras" +.TH "GIT\-BULK" "1" "February 2025" "" "Git Extras" .SH "NAME" \fBgit\-bulk\fR \- Run git commands on multiple repositories .SH "SYNOPSIS" -\fBgit\-bulk\fR [\-g] ([\-a]|[\-w +\fBgit\-bulk\fR [\-g] [\-\-no\-follow\-symlinks] ([\-a]|[\-w .br \fBgit\-bulk\fR \-\-addworkspace .br @@ -33,6 +33,10 @@ Run a git command on all workspaces and their repositories\. .P Ask the user for confirmation on every execution\. .P +\-\-no\-follow\-symlinks +.P +Do not traverse symbolic links under the workspace when searching for git repositories\. +.P \-w .P Run the git command on the specified workspace\. The workspace must be registered\. diff --git a/man/git-bulk.html b/man/git-bulk.html index de121b14..bb3fef36 100644 --- a/man/git-bulk.html +++ b/man/git-bulk.html @@ -77,7 +77,7 @@

NAME

SYNOPSIS

-

git-bulk [-g] ([-a]|[-w ])
+

git-bulk [-g] [--no-follow-symlinks] ([-a]|[-w ])
git-bulk --addworkspace (--from )
git-bulk --removeworkspace <ws-name>
git-bulk --addcurrent <ws-name>
@@ -105,6 +105,10 @@

OPTIONS

Ask the user for confirmation on every execution.

+

--no-follow-symlinks

+ +

Do not traverse symbolic links under the workspace when searching for git repositories.

+

-w <ws-name>

Run the git command on the specified workspace. The workspace must be registered.

@@ -196,7 +200,7 @@

SEE ALSO

  1. -
  2. September 2024
  3. +
  4. February 2025
  5. git-bulk(1)
diff --git a/man/git-bulk.md b/man/git-bulk.md index 80edda48..1cea8e31 100644 --- a/man/git-bulk.md +++ b/man/git-bulk.md @@ -3,7 +3,7 @@ git-bulk(1) -- Run git commands on multiple repositories ## SYNOPSIS -`git-bulk` [-g] ([-a]|[-w <ws-name>]) <git command>
+`git-bulk` [-g] [--no-follow-symlinks] ([-a]|[-w <ws-name>]) <git command>
`git-bulk` --addworkspace <ws-name> <ws-root-directory> (--from <URL or file>)
`git-bulk` --removeworkspace <ws-name>
`git-bulk` --addcurrent <ws-name>
@@ -28,6 +28,10 @@ git bulk adds convenient support for operations that you want to execute on mult Ask the user for confirmation on every execution. + --no-follow-symlinks + + Do not traverse symbolic links under the workspace when searching for git repositories. + -w <ws-name> Run the git command on the specified workspace. The workspace must be registered. diff --git a/man/index.txt b/man/index.txt index c4c71681..5e98b173 100644 --- a/man/index.txt +++ b/man/index.txt @@ -12,8 +12,8 @@ git-clear-soft(1) git-clear-soft git-clear(1) git-clear git-coauthor(1) git-coauthor git-commits-since(1) git-commits-since -git-contrib(1) git-contrib git-continue(1) git-continue +git-contrib(1) git-contrib git-count(1) git-count git-cp(1) git-cp git-create-branch(1) git-create-branch