proj/gagit:main commit in: /
MichaŠGórny <[email protected]> Wed, 05 Aug 2026 10:31:51 +0000 (UTC)
| Newsgroups | gmane.linux.gentoo.cvs |
|---|---|
| Message-ID | <1785925908.29533ac1269ef4dff1e6bea6ffef07e61d102b57.mgorny@gentoo> |
commit: 29533ac1269ef4dff1e6bea6ffef07e61d102b57
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 5 10:26:35 2026 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Aug 5 10:31:48 2026 +0000
URL: https://gitweb.gentoo.org/proj/gagit.git/commit/?id=29533ac1
Introduce a --dry-run mode
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
gagit | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/gagit b/gagit
index 1c1ad9c..862d1ee 100755
--- a/gagit
+++ b/gagit
@@ -11,6 +11,7 @@ die() {
edo() {
echo "+ ${@@Q}" >&2
+ [[ ${DRY_RUN} ]] && return
"${@}"
local ret=${?}
[[ ${ret} -ne 0 ]] && die "Command failed with exit status ${?}"
@@ -32,6 +33,7 @@ print_help() {
echo " Override the editor used (default: \${EDITOR})"
echo " -o TOPIC, --topic TOPIC"
echo " Specify the topic to use (default: branch name)"
+ echo " -n, --dry-run Print the git commands without executing them"
echo " -r REMOTE, --remote REMOTE"
echo " Specify the Codeberg remote name"
echo " (default: search for codeberg.org SSH URL)"
@@ -88,6 +90,7 @@ fj_b64() {
main() {
local description=
+ local DRY_RUN=
local editor=
local remote=
local target=
@@ -126,6 +129,9 @@ main() {
--editor=*)
editor=${1#*=}
;;
+ -n|--dry-run)
+ DRY_RUN=1
+ ;;
-r|--remote)
[[ ${#} -gt 1 ]] || die "${0}: missing argument to ${1}"
remote=${2}
@@ -186,6 +192,10 @@ main() {
# set defaults
: "${editor:=${EDITOR:-vim}}"
+ if [[ ${DRY_RUN} ]]; then
+ echo "Running in dry-run mode, no modifying git calls will be executed" >&2
+ fi
+
if [[ -z ${remote} ]]; then
remote=$(find_remote)
fi
@@ -217,7 +227,7 @@ main() {
# Please edit this file to set the new pull request title and description.
# All lines starting with '#' will be discarded.
# An empty description will abort creating the PR.
- # ${branch} -> ${remote}/${target}
+ # ${branch} -> ${remote}/${target}${DRY_RUN:+ (dry run)}
# Put a single line title below.
# "WIP:" creates a draft. Remove it to skip draft stage.