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.14af36c595aab03771c5ed04858de5de0fba769b.mgorny@gentoo>
commit:     14af36c595aab03771c5ed04858de5de0fba769b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 10:30:48 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=14af36c5

Check for git checkout early

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 gagit | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gagit b/gagit
index 862d1ee..b23340b 100755
--- a/gagit
+++ b/gagit
@@ -196,6 +196,10 @@ main() {
 		echo "Running in dry-run mode, no modifying git calls will be executed" >&2
 	fi
 
+	if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) != true ]]; then
+		die "gagit needs to be run inside a git checkout"
+	fi
+
 	if [[ -z ${remote} ]]; then
 		remote=$(find_remote)
 	fi