Commit graph

37 commits

Author SHA1 Message Date
Edwin Kofler 3ddc315a76
Format comparisons, functions, and redirections to be consistent (#1201)
* Format comparisons and functions to be consistent

* Add `checkstyle.py` script and add check to CI

* Fix Ruff lints
2025-06-06 11:10:50 +08:00
Pierre Ayoub 18d1017325
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>
2025-03-05 10:39:41 +08:00
Pierre Ayoub 8eed5f49ad
feat(git-bulk): add new option to no follow symlinks (#1194)
* feat(git-bulk): add --no-follow-symlinks flag

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

* docs(man): make ronn

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

* fix(git-bulk): use readarray for find command

1. Use `readarray` such that we can handle paths with spaces
2. Remove the unnecessary `eval`
2025-02-27 14:18:16 +08:00
Pierre Ayoub 8ce63003c0
fix(git-bulk): fix workspace selection when cd fails (#1197)
* fix(git-bulk): fix workspace selection when cd fails

`cd` may fails for multiple reasons:
- mistake when editing `.gitconfig` manually
- previously existing workspace that have been removed
- ...

Currently, if `cd` fails, the `BulkOp` continue its execution ... in the
workspace defined in a higher directory that where the user, despite the
user specified a specific workspace (`-w`).

The user should be noticed of a failed `cd` (this is really not expected
for a valid configuration) and the operations should stop to not execute
something unexpected.

* fix(git-bulk): replace weak eval for better variable substitution

Get rid of poor `eval` syntax because they are vulnerable to command
injection, which may have unexpected side effects.

However, they enabled a useful feature: using environment variable
(*e.g.*, defined in a `.bashrc`) inside the `.gitconfig` to use dynamic
paths as  `bulk` workspaces.

As such, I keep this feature possible by using the Bash's ${!VAR}
syntax, which allows to get the value of one variable using the name of
a another variable. However, arbitrary command injection is not possible
anymore.

* fix(git-bulk): missing check about empty environnement variable

* style(git-bulk): typo

* docs(Commands.md): git-bulk env var feature

* docs(man/git-bulk): git-bulk env var feature

* docs(man/git-bulk): mention .gitconfig for config storage

* style(man/git-bulk): typo

* docs(man/git-bulk): run make/ronn for .1 and .html
2025-02-26 12:33:16 +08:00
Pierre Ayoub 1a9b0c2ab4
fix(git-bulk): quiet find errors by default (#1196)
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
2025-02-20 15:47:27 +08:00
Pierre Ayoub 82cc37d0f5
fix(git-bulk): fix a bad integer expression (#1198)
Fix a logic error inside the `allowedargcount()` function. This function
may be called with one or two arguments. However, no default values are
assigned to `$1` and `$2` that are used inside a numerical comparison.
Therefore, when using a bad number of arguments for the following lines:

```
listall|purge) allowedargcount 1;;
addcurrent|removeworkspace) allowedargcount 2;;
```

Then, we would get the error `[: : integer expression expected`. To fix
this, we assign the 0 default value to `$1` and `$2`, such that we
trigger the error message destined to the user without any integer error
when there is a bad number of argument and that the function is called
with only 1 argument instead of 2.
2025-02-20 15:41:42 +08:00
Edwin Kofler e793f8979b
fix: Move improvements via ShellCheck (#1075) 2023-09-22 11:57:48 +08:00
Jobin Kurian d7fb4495f1
I have made two improvements to the git-bulk: (#1054)
* I have made two improvements to the git-bulk:
1. Previously, if the "repository.txt" file did not end with a blank line, only three out of four repositories were cloned. This limitation has been fixed.
2. Now, there is support for cloning repositories into custom folder names when using the "repository.txt" file.

* Corrected the code indentation.

* removed the extra condition to check is the line was empty or not.

* Updated the comment for the new changes in the code.

---------

Co-authored-by: Jobin Kurian <jobin.kurian@netcorecloud.com>
2023-07-07 11:08:23 +08:00
Edwin Kofler b372bab52a
chore: Improve Bash variously (#1032) 2023-02-21 10:03:56 +08:00
Edwin Kofler 75d0dbff6d
chore: Various Bash improvements (#1029) 2023-02-03 09:41:36 +08:00
Günther Grill e4e7310c49
Make the bulk output slimmer (#1020)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2023-01-20 18:18:10 +08:00
Edwin Kofler 4611b24320
chore: Fix more Bash inconsistencies (#1021) 2023-01-20 18:17:49 +08:00
Günther Grill 04eb5c04e6
Repo status overview (#1017)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2023-01-13 13:43:03 +08:00
Edwin Kofler 35100b4e6f
chore: Improve quoting and builtin usage (#1015) 2023-01-04 08:58:31 +08:00
Günther Grill aea25d2d4b
Fix quiet mode of the bulk command (#1014)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2022-12-28 09:11:53 +08:00
Günther Grill 7c4152ce83
Allow to run git-extras within git-bulk (#1008)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
Fix https://github.com/tj/git-extras/issues/1007
2022-12-07 13:58:18 +08:00
spacewander e3c8359e4e git-bulk: previous refactor redirected $PWD to stderr by mistake
Fix #986
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-07-19 14:37:33 +08:00
Jack O. Wasey c036c9cc22 quiet option, errors to stderr 2022-03-17 13:25:02 -04:00
spacewander 9683fb6510 feat: pass origin argument down to git execution 2020-09-24 09:40:43 +08:00
spacewander 2067d26276 git-bulk: support cloning from a relative path 2019-12-21 13:35:59 +08:00
spacewander eb33c9bf5a git-bulk: don't disappoint shellcheck 2019-12-20 18:21:29 +08:00
Roshak Zarhoun 16bb0df9f9 add repositories to workspace from source (#804)
* make addworkspace clone multiple repositories into ws from list of URLs in a file

* extend usage

* check if source is file or URL

* update Commands.md

* checked allwedargcount function

* resolved merge conflicts and change requests

* update manuals

* change the order of error and usage in allwedargcount()

* improve URL matcher. include also SSH protocol
2019-12-10 21:57:32 +08:00
roxchgt 45647fdab3 fix bug in allowedargcount() to not execute command if wrong args count 2019-12-01 11:33:59 +08:00
Paul Wise 1a414f5512
Fix typos
Suggested-by: codespell
Suggested-by: spellintian
2019-09-05 12:41:38 +08:00
Stu Feldt 3730339067 Adding support for symlink directories in bulk command 2018-12-10 11:07:49 -06:00
spacewander 4d885acda0 fix various typos 2017-06-18 20:22:11 +08:00
Niklas Schlimm fe39ac8af2 Corrected repository location print out and docs ws-root-directory absolute path 2017-03-30 19:31:32 +02:00
Niklas Schlimm ca62bdcfe6 Codereview Spacewander - whitespaces in workspace locations 2017-03-29 17:34:39 +02:00
Niklas Schlimm 7263b6c611 Review from spacewander 2017-03-28 21:52:21 +02:00
Niklas Schlimm 02dc8b5b21 Better behaviour in non workspace directories 2017-03-17 17:33:53 +01:00
Niklas Schlimm d3cccebbd2 Current workspace is default target of bulk operations 2017-03-17 17:13:15 +01:00
Niklas Schlimm 9260fd92bf Even shorter 2017-03-13 21:06:50 +01:00
Niklas Schlimm 5957544dee Code refactor 2017-03-12 16:15:09 +01:00
Niklas Schlimm 9263aec739 bug fix in single ws mode 2017-03-08 20:26:44 +01:00
Niklas Schlimm 1cc77481bd code formatting 2017-03-08 20:11:26 +01:00
Niklas Schlimm 534c72b91f Fix in git-bulk head 2017-03-08 19:58:34 +01:00
Niklas Schlimm 57c0eb776c New Command git-bulk initial commit 2017-03-08 19:50:36 +01:00