Skip to content

Commit

Permalink
Fix minor ShellCheck violations
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperupcall committed Nov 5, 2023
1 parent 5cf208c commit 884fa4a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions git-prompt-help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ git_prompt_examples() {
cat <<EOF | sed 's/\\\[\\033//g' | sed 's/\\\]//g'
These are examples of the git prompt:
${p}`format_branch master`${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_AHEAD}3${ResetColor}|${GIT_PROMPT_CHANGED}1${ResetColor}${s} - on branch "master", ahead of remote by 3 commits, 1
${p}$(format_branch master)${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_AHEAD}3${ResetColor}|${GIT_PROMPT_CHANGED}1${ResetColor}${s} - on branch "master", ahead of remote by 3 commits, 1
file changed but not staged
${p}`format_branch status`${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_STAGED}2${ResetColor}${s} - on branch "status", 2 files staged
${p}$(format_branch status)${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_STAGED}2${ResetColor}${s} - on branch "status", 2 files staged
${p}`format_branch master`${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CHANGED}7${GIT_PROMPT_UNTRACKED}${ResetColor}${s} - on branch "master", 7 files changed, some files untracked
${p}$(format_branch master)${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CHANGED}7${GIT_PROMPT_UNTRACKED}${ResetColor}${s} - on branch "master", 7 files changed, some files untracked
${p}`format_branch master`${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CONFLICTS}2${GIT_PROMPT_CHANGED}3${ResetColor}${s} - on branch "master", 2 conflicts, 3 files changed
${p}$(format_branch master)${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CONFLICTS}2${GIT_PROMPT_CHANGED}3${ResetColor}${s} - on branch "master", 2 conflicts, 3 files changed
${p}`format_branch master`${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_STASHED}2${ResetColor}${s} - on branch "master", 2 stash entries
${p}$(format_branch master)${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_STASHED}2${ResetColor}${s} - on branch "master", 2 stash entries
${p}`format_branch experimental`${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_BEHIND}2${GIT_PROMPT_SYMBOLS_AHEAD}3${ResetColor}${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CLEAN}${ResetColor}${s}
${p}$(format_branch experimental)${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_BEHIND}2${GIT_PROMPT_SYMBOLS_AHEAD}3${ResetColor}${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CLEAN}${ResetColor}${s}
- on branch "experimental"; your branch has diverged
by 3 commits, remote by 2 commits; the repository is
otherwise clean
${p}${GIT_PROMPT_BRANCH}${GIT_PROMPT_SYMBOLS_PREHASH}70c2952${ResetColor}${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CLEAN}${ResetColor}${s} - not on any branch; parent commit has hash "70c2952"; the
repository is otherwise clean
${p}`format_branch extra-features`${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING}${ResetColor}${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CHANGED}2${GIT_PROMPT_UNTRACKED}4${ResetColor}${s}
${p}$(format_branch extra-features)${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING}${ResetColor}${GIT_PROMPT_SEPARATOR}${GIT_PROMPT_CHANGED}2${GIT_PROMPT_UNTRACKED}4${ResetColor}${s}
- on branch "extra-features"; no remote set (signalled by '${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING}${ResetColor}'),
2 files changed and 4 untracked files exist
EOF
Expand Down
2 changes: 1 addition & 1 deletion gitprompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ function gp_truncate_pwd {

# Sets the window title to the given argument string
function gp_set_window_title {
echo -ne "\[\033]0;"${@}"\007\]"
echo -ne "\[\033]0;$1\007\]"
}

function prompt_callback_default {
Expand Down
3 changes: 2 additions & 1 deletion gitstatus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ else
remote_url='.'
fi

# shellcheck disable=SC2086
gitstatus=$( LC_ALL=C git --no-optional-locks status ${_ignore_submodules} --untracked-files="${__GIT_PROMPT_SHOW_UNTRACKED_FILES:-normal}" --porcelain --branch )

# if the status is fatal, exit now
Expand Down Expand Up @@ -185,7 +186,7 @@ if [[ -z "${upstream:+x}" ]] ; then
upstream='^'
fi

UPSTREAM_TRIMMED=`echo $upstream |xargs`
UPSTREAM_TRIMMED=$(echo $upstream | xargs)

printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
"${branch}${state}" \
Expand Down
3 changes: 1 addition & 2 deletions gitstatus_pre-1.7.10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Alan K. Stebbens <[email protected]> [http://github.com/aks]

# helper functions
count_lines() { echo "${1}" | egrep -c "^${2}" ; }
count_lines() { echo "${1}" | grep -Ec "^${2}" ; }
all_lines() { echo "${1}" | grep -v "^$" | wc -l ; }

if [[ -z "${__GIT_PROMPT_DIR-}" ]]; then
Expand Down Expand Up @@ -95,7 +95,6 @@ else

# detect if the local branch have a remote tracking branch
upstream=$( git rev-parse --abbrev-ref "${branch}"@{upstream} 2>&1 )

if [[ "${?}" == 0 ]]; then
# get the revision list, and count the leading "<" and ">"
revgit=$( git rev-list --left-right "${remote_ref}...HEAD" 2>/dev/null )
Expand Down

0 comments on commit 884fa4a

Please sign in to comment.