@@ -73,6 +73,91 @@ test_completion ()
73
73
test_cmp expected out
74
74
}
75
75
76
+ newline=$' \n '
77
+
78
+ test_expect_success ' __gitcomp - trailing space - options' '
79
+ sed -e "s/Z$//" >expected <<-\EOF &&
80
+ --reuse-message=Z
81
+ --reedit-message=Z
82
+ --reset-author Z
83
+ EOF
84
+ (
85
+ local -a COMPREPLY &&
86
+ cur="--re" &&
87
+ __gitcomp "--dry-run --reuse-message= --reedit-message=
88
+ --reset-author" &&
89
+ IFS="$newline" &&
90
+ echo "${COMPREPLY[*]}" > out
91
+ ) &&
92
+ test_cmp expected out
93
+ '
94
+
95
+ test_expect_success ' __gitcomp - trailing space - config keys' '
96
+ sed -e "s/Z$//" >expected <<-\EOF &&
97
+ branch.Z
98
+ branch.autosetupmerge Z
99
+ branch.autosetuprebase Z
100
+ browser.Z
101
+ EOF
102
+ (
103
+ local -a COMPREPLY &&
104
+ cur="br" &&
105
+ __gitcomp "branch. branch.autosetupmerge
106
+ branch.autosetuprebase browser." &&
107
+ IFS="$newline" &&
108
+ echo "${COMPREPLY[*]}" > out
109
+ ) &&
110
+ test_cmp expected out
111
+ '
112
+
113
+ test_expect_success ' __gitcomp - option parameter' '
114
+ sed -e "s/Z$//" >expected <<-\EOF &&
115
+ recursive Z
116
+ resolve Z
117
+ EOF
118
+ (
119
+ local -a COMPREPLY &&
120
+ cur="--strategy=re" &&
121
+ __gitcomp "octopus ours recursive resolve subtree
122
+ " "" "re" &&
123
+ IFS="$newline" &&
124
+ echo "${COMPREPLY[*]}" > out
125
+ ) &&
126
+ test_cmp expected out
127
+ '
128
+
129
+ test_expect_success ' __gitcomp - prefix' '
130
+ sed -e "s/Z$//" >expected <<-\EOF &&
131
+ branch.maint.merge Z
132
+ branch.maint.mergeoptions Z
133
+ EOF
134
+ (
135
+ local -a COMPREPLY &&
136
+ cur="branch.me" &&
137
+ __gitcomp "remote merge mergeoptions rebase
138
+ " "branch.maint." "me" &&
139
+ IFS="$newline" &&
140
+ echo "${COMPREPLY[*]}" > out
141
+ ) &&
142
+ test_cmp expected out
143
+ '
144
+
145
+ test_expect_success ' __gitcomp - suffix' '
146
+ sed -e "s/Z$//" >expected <<-\EOF &&
147
+ branch.master.Z
148
+ branch.maint.Z
149
+ EOF
150
+ (
151
+ local -a COMPREPLY &&
152
+ cur="branch.me" &&
153
+ __gitcomp "master maint next pu
154
+ " "branch." "ma" "." &&
155
+ IFS="$newline" &&
156
+ echo "${COMPREPLY[*]}" > out
157
+ ) &&
158
+ test_cmp expected out
159
+ '
160
+
76
161
test_expect_success ' basic' '
77
162
run_completion "git \"\"" &&
78
163
# built-in
0 commit comments