From 672701d1f7f9406c356548d0697f62f213c87aed Mon Sep 17 00:00:00 2001 From: Benjamin Maidel Date: Fri, 20 Oct 2023 20:32:22 +0200 Subject: [PATCH 01/10] remove -r (relative link) from ln commands --- install.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.zsh b/install.zsh index 55574d7..851c1c7 100755 --- a/install.zsh +++ b/install.zsh @@ -10,9 +10,9 @@ function _add_to_config { # Link files basedir="$(dirname "$(realpath "$0")")" mkdir -p ~/.local/{bin,share/bash-completion/completions} -ln -frs "${basedir}/gis" ~/.local/bin/gis +ln -fs "${basedir}/gis" ~/.local/bin/gis echo "Created link '~/.local/bin/gis'" -ln -frs "${basedir}/gis_completion.bash" ~/.local/share/bash-completion/completions/gis +ln -fs "${basedir}/gis_completion.bash" ~/.local/share/bash-completion/completions/gis echo "Created link '~/.local/share/bash-completion/completions/gis'" # Modify config From ba46ba95d9ae73f7d3d2c4f8a537dacfe8271ca9 Mon Sep 17 00:00:00 2001 From: Benjamin Maidel Date: Fri, 20 Oct 2023 20:46:19 +0200 Subject: [PATCH 02/10] use /Users/ben env variable instead of /home/ben --- install.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.zsh b/install.zsh index 851c1c7..4b0e5e1 100755 --- a/install.zsh +++ b/install.zsh @@ -20,7 +20,7 @@ touch ~/.zshrc _add_to_config "export PATH=\$PATH:${HOME}/.local/bin" _add_to_config "autoload -U +X compinit && compinit" _add_to_config "autoload -U +X bashcompinit && bashcompinit" -_add_to_config "source /home/${USER}/.local/share/bash-completion/completions/gis" +_add_to_config "source ${HOME}/.local/share/bash-completion/completions/gis" echo "Updated '~/.zshrc'" echo From f8bad2700be80417165a160b146ad729c3f24cb7 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Thu, 2 Nov 2023 11:48:56 +0100 Subject: [PATCH 03/10] echo pull information --- gis | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gis b/gis index a55059b..a36edfd 100755 --- a/gis +++ b/gis @@ -120,7 +120,7 @@ if [ "$fetch" == true ]; then repository_name=$(basename "$dir") # Fetch all Git repositories in background - git fetch --prune --all 1> /dev/null 2> >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_blue}${repository_name}${text_reset} /" >&2) & + git fetch --prune --all 1> /dev/null 2> >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_blue}${repository_name}${text_reset} /") & fetch_pids+=("$!") done @@ -157,7 +157,7 @@ if [ "$pull" == true ]; then # Get repository name repository_name=$(basename "$dir") - git pull 1> /dev/null 2> >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_magenta}${repository_name}${text_reset} /" >&2) & + git pull > >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_magenta}${repository_name}${text_reset} /") & pull_pids+=("$!") done From 07e35d8b8c119fb52a349ac2f5f38ea7fef960a0 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Tue, 12 Dec 2023 22:37:28 +0100 Subject: [PATCH 04/10] update flake inputs --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index c921a1a..cb2ec2e 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1694760568, - "narHash": "sha256-3G07BiXrp2YQKxdcdms22MUx6spc6A++MSePtatCYuI=", + "lastModified": 1702272962, + "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "46688f8eb5cd6f1298d873d4d2b9cf245e09e88e", + "rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d", "type": "github" }, "original": { From 0f17558dfebcbf71c46dc7f5fbca5ea70970797a Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Wed, 28 Feb 2024 22:33:29 +0100 Subject: [PATCH 05/10] show missing upstream branches --- gis | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gis b/gis index a36edfd..8f586e6 100755 --- a/gis +++ b/gis @@ -197,8 +197,12 @@ for dir in "${git_dirs[@]}"; do # Get status remote_status_keys="" + has_upstream=true while read -r status; do - if [[ "$status" =~ ^\#\#.*\[(.*)\] ]]; then + if [[ "$status" =~ ^\#\#\ (.*) ]] && [ "$(git remote | wc -l)" -gt 0 ]; then + [[ "${BASH_REMATCH[1]}" != *"..."* ]] && has_upstream=false + fi + if [[ "$status" =~ ^\#\#.*\ \[(.*)\] ]]; then [[ "${BASH_REMATCH[1]}" == *"ahead"* ]] && [[ "${BASH_REMATCH[1]}" == *"behind"* ]] && remote_status_keys="⇕" && continue [[ "${BASH_REMATCH[1]}" == *"ahead"* ]] && remote_status_keys="⇡" && continue [[ "${BASH_REMATCH[1]}" == *"behind"* ]] && remote_status_keys="⇣" && continue @@ -235,6 +239,9 @@ for dir in "${git_dirs[@]}"; do num_additional_branches=$(( num_additional_branches - 1 )) output="${output};${text_bold}${text_yellow}${current_branch}${text_reset} (${origin_head}${text_reset})" fi + if [ "$has_upstream" == false ]; then + output="${output} (no upstream)" + fi if [[ $num_additional_branches -gt 0 ]]; then output="${output} (+${num_additional_branches})" fi From 82201ce6b33beb2c494d93f1937606ae4b75438a Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Wed, 28 Feb 2024 22:37:04 +0100 Subject: [PATCH 06/10] update flake inputs --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index cb2ec2e..454d16f 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1702272962, - "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", + "lastModified": 1709101946, + "narHash": "sha256-TsySgcWm/GlbYdL3AEva49ceeI2BdPQ7muwfYNr1fwo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d", + "rev": "d53c2037394da6fe98decca417fc8fda64bf2443", "type": "github" }, "original": { From f1ab8e79db1eff95f24f417b0b9d299717d7e28f Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Tue, 19 Mar 2024 17:59:00 +0100 Subject: [PATCH 07/10] beautify missing upstream hint --- gis | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gis b/gis index 8f586e6..1f03e0f 100755 --- a/gis +++ b/gis @@ -233,14 +233,17 @@ for dir in "${git_dirs[@]}"; do output="${output}${repository_name};${status_keys}" # Construct branch output - if [ "$current_branch" = "$origin_head" ]; then + if [ "$current_branch" == "$origin_head" ]; then output="${output};${text_bold}${current_branch}${text_reset}" else - num_additional_branches=$(( num_additional_branches - 1 )) - output="${output};${text_bold}${text_yellow}${current_branch}${text_reset} (${origin_head}${text_reset})" + output="${output};${text_bold}${text_yellow}${current_branch}${text_reset}" fi if [ "$has_upstream" == false ]; then - output="${output} (no upstream)" + output="${output} ${text_blue}[no upstream]${text_reset}" + fi + if [ "$current_branch" != "$origin_head" ]; then + num_additional_branches=$(( num_additional_branches - 1 )) + output="${output} (${origin_head}${text_reset})" fi if [[ $num_additional_branches -gt 0 ]]; then output="${output} (+${num_additional_branches})" From f2b09cee54c41e78c240e86a4487f7216aa9308b Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Thu, 18 Apr 2024 12:58:05 +0200 Subject: [PATCH 08/10] fix error formatting --- gis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gis b/gis index 1f03e0f..7aada75 100755 --- a/gis +++ b/gis @@ -52,7 +52,7 @@ while (( "$#" )); do exit 0 ;; -*) - error "Unsupported option ${text_bold}$1${text_bold}" + error "Unsupported option ${text_bold}$1${text_reset}" ;; fetch) fetch=true From 1f7ead61346befe1956c97c20e36967436db6f64 Mon Sep 17 00:00:00 2001 From: ConstantConstantin Date: Thu, 8 Aug 2024 15:48:06 +0200 Subject: [PATCH 09/10] add symbol for renamed files --- README.org | 3 ++- gis | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index db2a0ec..9005681 100644 --- a/README.org +++ b/README.org @@ -66,6 +66,7 @@ It was inspired by [[https://wiki.ros.org/wstool][wstool]], [[https://github.com ! - Local changes + - Staged changes - - File removed + » - File renamed = - Both modified ⇕ - Diverged from upstream ⇡ - Ahead upstream @@ -84,6 +85,6 @@ It was inspired by [[https://wiki.ros.org/wstool][wstool]], [[https://github.com : git remote set-head origin -a Or set it manually to any branch with: - : git remote set-head origin + : git remote set-head origin The number of additional local branches which are neither checked out, nor the =origin/HEAD= branch, is appended at the end of the branch output, e.g. =(+8)=. diff --git a/gis b/gis index 7aada75..e4d9bd6 100755 --- a/gis +++ b/gis @@ -219,6 +219,7 @@ for dir in "${git_dirs[@]}"; do status_keys="${status_keys//D/-}" status_keys="${status_keys//M/!}" status_keys="${status_keys//U/=}" + status_keys="${status_keys//R/»}" # Update all status keys all_status_keys="${all_status_keys}${status_keys}" @@ -261,6 +262,7 @@ if [[ "$all_status_keys" ]]; then [[ "$all_status_keys" == *"!"* ]] && echo " ${text_bold}${text_red}!${text_reset} - Local changes" [[ "$all_status_keys" == *"+"* ]] && echo " ${text_bold}${text_red}+${text_reset} - Staged changes" [[ "$all_status_keys" == *"-"* ]] && echo " ${text_bold}${text_red}-${text_reset} - File removed" + [[ "$all_status_keys" == *"»"* ]] && echo " ${text_bold}${text_red}»${text_reset} - File renamed" [[ "$all_status_keys" == *"="* ]] && echo " ${text_bold}${text_red}=${text_reset} - Both modified" [[ "$all_status_keys" == *"⇕"* ]] && echo " ${text_bold}${text_red}⇕${text_reset} - Diverged from upstream" [[ "$all_status_keys" == *"⇡"* ]] && echo " ${text_bold}${text_red}⇡${text_reset} - Ahead upstream" From 6690c470e35053aab13911c95b100b0c81de8402 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Thu, 19 Sep 2024 10:18:17 +0200 Subject: [PATCH 10/10] check column dependency --- install.bash | 6 ++++++ install.zsh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/install.bash b/install.bash index 28cac40..fae0bef 100755 --- a/install.bash +++ b/install.bash @@ -1,5 +1,11 @@ #!/usr/bin/env bash +# Check 'column' dependency +if ! command -v column &> /dev/null; then + echo "Command 'column' not available on the system, please make sure all dependencies are fulfilled." + exit 1 +fi + # Adds $1 to ~/.bashrc if not already present function _add_to_config { if ! grep "$1" ~/.bashrc > /dev/null; then diff --git a/install.zsh b/install.zsh index 4b0e5e1..507b9fc 100755 --- a/install.zsh +++ b/install.zsh @@ -1,5 +1,11 @@ #!/usr/bin/env zsh +# Check 'column' dependency +if ! command -v column &> /dev/null; then + echo "Command 'column' not available on the system, please make sure all dependencies are fulfilled." + exit 1 +fi + # Adds $1 to ~/.zshrc if not already present function _add_to_config { if ! grep "$1" ~/.zshrc > /dev/null; then