Unfsck the indendtation in parse_git_branch()
This is just whitespace changes.
- Id
- 3708f0a30b9a33410a72288d7b4b47c95f4a69e8
- Author
- Caio
- Commit time
- 2013-11-30T23:19:24-02:00
Modified lib/vcsinfo.sh
git_dir() {
- parse_git_branch() {
- git_status="$(git status -b --porcelain --ignore-submodules 2> /dev/null)"
+ parse_git_branch() {
+ git_status="$(git status -b --porcelain --ignore-submodules 2> /dev/null)"
- # Index/Worktree status:
- # green => clean
- # yellow => index modified (has precedence over red)
- # red => worktree modified
- local state="${GREEN}"
- if [[ ${git_status} =~ $'\n'(M |A |R |C |D ) ]]; then
- state="${YELLOW}"
- elif [[ ${git_status} =~ $'\n'( M| D|\?\?) ]]; then
- state="${RED}"
- fi
+ # Index/Worktree status:
+ # green => clean
+ # yellow => index modified (has precedence over red)
+ # red => worktree modified
+ local state="${GREEN}"
+ if [[ ${git_status} =~ $'\n'(M |A |R |C |D ) ]]; then
+ state="${YELLOW}"
+ elif [[ ${git_status} =~ $'\n'( M| D|\?\?) ]]; then
+ state="${RED}"
+ fi
- local remote=""
- [[ ${git_status} =~ ^##.+\[.*ahead ]] && remote="↑"
- if [[ ${git_status} =~ ^##.+\[.*behind ]]; then
- # If behind AND ahead, the status is "diverged"
- test -z $remote && remote="↓" || remote="↕"
- fi
+ local remote=""
+ [[ ${git_status} =~ ^##.+\[.*ahead ]] && remote="↑"
+ if [[ ${git_status} =~ ^##.+\[.*behind ]]; then
+ # If behind AND ahead, the status is "diverged"
+ test -z $remote && remote="↓" || remote="↕"
+ fi
- # Get the name of the branch by trying to match
- # ## branchname..upstream [ahead X, behind Y]
- if [[ ${git_status} =~ ^##\ ([^\ ]+)($'\n'| \[|$) ]]; then
- branch=${BASH_REMATCH[1]}
- # Remove the ...upstream part, if present
- branch=${branch%...*}
- fi
+ # Get the name of the branch by trying to match
+ # ## branchname..upstream [ahead X, behind Y]
+ if [[ ${git_status} =~ ^##\ ([^\ ]+)($'\n'| \[|$) ]]; then
+ branch=${BASH_REMATCH[1]}
+ # Remove the ...upstream part, if present
+ branch=${branch%...*}
+ fi
- echo "${state}${branch}${remote}${COLOR_NONE}"
- }
- base_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
- base_dir=$(readlink -f "$base_dir/..")
- sub_dir=$(git rev-parse --show-prefix)
- sub_dir=${sub_dir%/}
- ref=$(parse_git_branch)
- vcs="±"
+ echo "${state}${branch}${remote}${COLOR_NONE}"
+ }
+
+ base_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
+ base_dir=$(readlink -f "$base_dir/..")
+ sub_dir=$(git rev-parse --show-prefix)
+ sub_dir=${sub_dir%/}
+ ref=$(parse_git_branch)
+ vcs="±"
}
git_dir ||