proj/gagit:main commit in: /
MichaŠGórny <[email protected]> Mon, 03 Aug 2026 13:59:38 +0000 (UTC)
| Newsgroups | gmane.linux.gentoo.cvs |
|---|---|
| Message-ID | <1785765566.53a8329f701d90d54ee99da53a0099d72405e840.mgorny@gentoo> |
commit: 53a8329f701d90d54ee99da53a0099d72405e840
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 3 13:42:58 2026 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 3 13:59:26 2026 +0000
URL: https://gitweb.gentoo.org/proj/gagit.git/commit/?id=53a8329f
Implement finding codeberg remote
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
gagit | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/gagit b/gagit
index c77319a..96042fa 100755
--- a/gagit
+++ b/gagit
@@ -33,8 +33,17 @@ print_help() {
}
find_remote() {
- # TODO
- echo origin
+ local remotes=() r url
+ mapfile -t remotes < <(git remote)
+ # prefer [codeberg, upstream, origin], fall back to all branches
+ for r in codeberg upstream origin "${remotes[@]}"; do
+ url=$(git remote get-url "${r}")
+ case ${url} in
+ *ssh://[email protected]/*|[email protected]:*)
+ echo "${r}"
+ break
+ esac
+ done
}
find_target_branch() {
@@ -100,6 +109,7 @@ main() {
: "${editor:=${EDITOR:-vim}}"
local remote=$(find_remote)
+ [[ -z ${remote} ]] && die "Codeberg remote not found"
echo "Codeberg remote: ${remote}" >&2
local branch=$(git rev-parse --abbrev-ref HEAD)