@matheusbsbs / matheus-bagliano / commits / ad244d2568
Fork 0

completion: Use consistent if [...] convention, not "test"

The local coding convention in bash completion is to use [...] rather than test. Additionally, if [...]; then is preferred over if [...] then and so matching "if [...]\nthen" were changed accordingly. Signed-off-by: Ted Pavlic <ted@tedpavlic.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ted Pavlic committed Feb 11, 2009 at 13:03 UTC ad244d256865c06804afffef32b753239a06119e
1 file changed +11 -20
contrib/completion/git-completion.bash
+11 -20
@@ -84,39 +84,30 @@ __git_ps1 ()
84 if [ -n "$g" ]; then
85 local r
86 local b
87 - if [ -d "$g/rebase-apply" ]
88 - then
89 - if test -f "$g/rebase-apply/rebasing"
90 - then
87 + if [ -d "$g/rebase-apply" ]; then
88 + if [ -f "$g/rebase-apply/rebasing" ]; then
89 r="|REBASE"
92 - elif test -f "$g/rebase-apply/applying"
93 - then
90 + elif [ -f "$g/rebase-apply/applying" ]; then
91 r="|AM"
92 else
93 r="|AM/REBASE"
94 fi
95 b="$(git symbolic-ref HEAD 2>/dev/null)"
99 - elif [ -f "$g/rebase-merge/interactive" ]
100 - then
96 + elif [ -f "$g/rebase-merge/interactive" ]; then
97 r="|REBASE-i"
98 b="$(cat "$g/rebase-merge/head-name")"
103 - elif [ -d "$g/rebase-merge" ]
104 - then
99 + elif [ -d "$g/rebase-merge" ]; then
100 r="|REBASE-m"
101 b="$(cat "$g/rebase-merge/head-name")"
107 - elif [ -f "$g/MERGE_HEAD" ]
108 - then
102 + elif [ -f "$g/MERGE_HEAD" ]; then
103 r="|MERGING"
104 b="$(git symbolic-ref HEAD 2>/dev/null)"
105 else
112 - if [ -f "$g/BISECT_LOG" ]
113 - then
106 + if [ -f "$g/BISECT_LOG" ]; then
107 r="|BISECTING"
108 fi
116 - if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
117 - then
118 - if ! b="$(git describe --exact-match HEAD 2>/dev/null)"
119 - then
109 + if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
110 + if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
111 b="$(cut -c1-7 "$g/HEAD")..."
112 fi
113 fi
@@ -125,8 +116,8 @@ __git_ps1 ()
116 local w
117 local i
118
128 - if test -n "${GIT_PS1_SHOWDIRTYSTATE-}"; then
129 - if test "$(git config --bool bash.showDirtyState)" != "false"; then
119 + if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
120 + if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
121 git diff --no-ext-diff --ignore-submodules \
122 --quiet --exit-code || w="*"
123 if git rev-parse --quiet --verify HEAD >/dev/null; then