Skip to content

Commit bf0fe35

Browse files
committed
Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0: bisect: fix another instance of eval'ed string bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped Support "\" in non-wildcard exclusion entries Conflicts: git-bisect.sh
2 parents 1e68adc + 688ba09 commit bf0fe35

File tree

4 files changed

+82
-38
lines changed

4 files changed

+82
-38
lines changed

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ int match_pathspec(const char **pathspec, const char *name, int namelen, int pre
134134

135135
static int no_wildcard(const char *string)
136136
{
137-
return string[strcspn(string, "*?[{")] == '\0';
137+
return string[strcspn(string, "*?[{\\")] == '\0';
138138
}
139139

140140
void add_exclude(const char *string, const char *base,

git-bisect.sh

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -284,62 +284,74 @@ filter_skipped() {
284284
_skip="$2"
285285

286286
if [ -z "$_skip" ]; then
287-
eval "$_eval"
287+
eval "$_eval" | {
288+
while read line
289+
do
290+
echo "$line &&"
291+
done
292+
echo ':'
293+
}
288294
return
289295
fi
290296

291297
# Let's parse the output of:
292298
# "git rev-list --bisect-vars --bisect-all ..."
293-
eval "$_eval" | while read hash line
294-
do
295-
case "$VARS,$FOUND,$TRIED,$hash" in
296-
# We display some vars.
297-
1,*,*,*) echo "$hash $line" ;;
298-
299-
# Split line.
300-
,*,*,---*) ;;
301-
302-
# We had nothing to search.
299+
eval "$_eval" | {
300+
VARS= FOUND= TRIED=
301+
while read hash line
302+
do
303+
case "$VARS,$FOUND,$TRIED,$hash" in
304+
1,*,*,*)
305+
# "bisect_foo=bar" read from rev-list output.
306+
echo "$hash &&"
307+
;;
308+
,*,*,---*)
309+
# Separator
310+
;;
303311
,,,bisect_rev*)
304-
echo "bisect_rev="
312+
# We had nothing to search.
313+
echo "bisect_rev= &&"
305314
VARS=1
306315
;;
307-
308-
# We did not find a good bisect rev.
309-
# This should happen only if the "bad"
310-
# commit is also a "skip" commit.
311316
,,*,bisect_rev*)
312-
echo "bisect_rev=$TRIED"
317+
# We did not find a good bisect rev.
318+
# This should happen only if the "bad"
319+
# commit is also a "skip" commit.
320+
echo "bisect_rev='$TRIED' &&"
313321
VARS=1
314322
;;
315-
316-
# We are searching.
317323
,,*,*)
324+
# We are searching.
318325
TRIED="${TRIED:+$TRIED|}$hash"
319326
case "$_skip" in
320327
*$hash*) ;;
321328
*)
322-
echo "bisect_rev=$hash"
323-
echo "bisect_tried=\"$TRIED\""
329+
echo "bisect_rev=$hash &&"
330+
echo "bisect_tried='$TRIED' &&"
324331
FOUND=1
325332
;;
326333
esac
327334
;;
328-
329-
# We have already found a rev to be tested.
330-
,1,*,bisect_rev*) VARS=1 ;;
331-
,1,*,*) ;;
332-
333-
# ???
334-
*) die "filter_skipped error " \
335-
"VARS: '$VARS' " \
336-
"FOUND: '$FOUND' " \
337-
"TRIED: '$TRIED' " \
338-
"hash: '$hash' " \
339-
"line: '$line'"
340-
;;
341-
esac
342-
done
335+
,1,*,bisect_rev*)
336+
# We have already found a rev to be tested.
337+
VARS=1
338+
;;
339+
,1,*,*)
340+
;;
341+
*)
342+
# Unexpected input
343+
echo "die 'filter_skipped error'"
344+
die "filter_skipped error " \
345+
"VARS: '$VARS' " \
346+
"FOUND: '$FOUND' " \
347+
"TRIED: '$TRIED' " \
348+
"hash: '$hash' " \
349+
"line: '$line'"
350+
;;
351+
esac
352+
done
353+
echo ':'
354+
}
343355
}
344356

345357
exit_if_skipped_commits () {

t/t3001-ls-files-others-exclude.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ do
1919
>$dir/a.$i
2020
done
2121
done
22+
>"#ignore1"
23+
>"#ignore2"
24+
>"#hidden"
2225

2326
cat >expect <<EOF
2427
a.2
@@ -42,6 +45,9 @@ three/a.8
4245
EOF
4346

4447
echo '.gitignore
48+
\#ignore1
49+
\#ignore2*
50+
\#hid*n
4551
output
4652
expect
4753
.gitignore
@@ -79,9 +85,10 @@ test_expect_success \
7985
>output &&
8086
test_cmp expect output'
8187

82-
cat > excludes-file << EOF
88+
cat > excludes-file <<\EOF
8389
*.[1-8]
8490
e*
91+
\#*
8592
EOF
8693

8794
git config core.excludesFile excludes-file

t/t6030-bisect-porcelain.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,31 @@ test_expect_success 'bisect skip: cannot tell between 2 commits' '
224224
fi
225225
'
226226

227+
# $HASH1 is good, $HASH4 is both skipped and bad, we skip $HASH3
228+
# and $HASH2 is good,
229+
# so we should not be able to tell the first bad commit
230+
# among $HASH3 and $HASH4
231+
test_expect_success 'bisect skip: with commit both bad and skipped' '
232+
git bisect start &&
233+
git bisect skip &&
234+
git bisect bad &&
235+
git bisect good $HASH1 &&
236+
git bisect skip &&
237+
if git bisect good > my_bisect_log.txt
238+
then
239+
echo Oops, should have failed.
240+
false
241+
else
242+
test $? -eq 2 &&
243+
grep "first bad commit could be any of" my_bisect_log.txt &&
244+
! grep $HASH1 my_bisect_log.txt &&
245+
! grep $HASH2 my_bisect_log.txt &&
246+
grep $HASH3 my_bisect_log.txt &&
247+
grep $HASH4 my_bisect_log.txt &&
248+
git bisect reset
249+
fi
250+
'
251+
227252
# We want to automatically find the commit that
228253
# introduced "Another" into hello.
229254
test_expect_success \

0 commit comments

Comments
 (0)