diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-10-19 23:03:44 +0200 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-10-19 23:03:44 +0200 |
| commit | 21f85ba7992a9f2f2cc1192abd655a2eb010d959 (patch) | |
| tree | 7d4ffcd96ffe78f1b8362a5d56f163b594d7635d /bin/common | |
| parent | e977c4b431a8d53ab7dd72e6106989a5852ff247 (diff) | |
| parent | 20d702194c2db3e1f0f06e8d40e5b43b6b347c1a (diff) | |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/common')
| -rwxr-xr-x | bin/common/gt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/common/gt b/bin/common/gt index cf05a1e..bfd990f 100755 --- a/bin/common/gt +++ b/bin/common/gt @@ -67,7 +67,14 @@ while getopts ":a:c:f:dlsheu" opt; do fi repo="$(git rev-parse --show-toplevel 2>/dev/null)" - remote_url="$(git remote show -n origin 2>/dev/null | awk '/^ Fetch/ {print $NF}')" + remote_name= + if git remote show -n | grep 'origin' 2>/dev/null + then + remote_name="origin" + else + remote_name="$(git remote show -n | head -n 1)" + fi + remote_url="$(git remote show -n "$remote_name" 2>/dev/null | awk '/^ Fetch/ {print $NF}')" if [ -z "$repo" ] || [ -z "$remote_url" ] then >&2 printf 'Couldn'\''t add '\''%s'\'', not a git repository.\n' "$OPTARG" |
