Skip to content

Commit 934f788

Browse files
committed
Merge branch 'maint'
* maint: builtin-revert.c: release index lock when cherry-picking an empty commit document config --bool-or-int t1300: use test_must_fail as appropriate cleanup: add isascii() Documentation: fix badly indented paragraphs in "--bisect-all" description
2 parents 113106e + 9a6682b commit 934f788

File tree

7 files changed

+48
-9
lines changed

7 files changed

+48
-9
lines changed

Documentation/git-config.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ See also <<FILES>>.
131131
in the config file will cause the value to be multiplied
132132
by 1024, 1048576, or 1073741824 prior to output.
133133

134+
--bool-or-int::
135+
'git-config' will ensure that the output matches the format of
136+
either --bool or --int, as described above.
137+
134138
-z::
135139
--null::
136140
For all options that output values and/or keys, always

Documentation/rev-list-options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,11 @@ This outputs all the commit objects between the included and excluded
568568
commits, ordered by their distance to the included and excluded
569569
commits. The farthest from them is displayed first. (This is the only
570570
one displayed by `--bisect`.)
571-
571+
+
572572
This is useful because it makes it easy to choose a good commit to
573573
test when you want to avoid to test some of them for some reason (they
574574
may not compile for example).
575-
575+
+
576576
This option can be used along with `--bisect-vars`, in this case,
577577
after all the sorted commit objects, there will be the same text as if
578578
`--bisect-vars` had been used alone.

builtin-revert.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
376376
(write_cache(index_fd, active_cache, active_nr) ||
377377
commit_locked_index(&index_lock)))
378378
die("%s: Unable to write new index file", me);
379+
rollback_lock_file(&index_lock);
379380

380381
if (!clean) {
381382
add_to_msg("\nConflicts:\n\n");

git-compat-util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ static inline int has_extension(const char *filename, const char *ext)
319319
}
320320

321321
/* Sane ctype - no locale, and works with signed chars */
322+
#undef isascii
322323
#undef isspace
323324
#undef isdigit
324325
#undef isalpha
@@ -332,6 +333,7 @@ extern unsigned char sane_ctype[256];
332333
#define GIT_GLOB_SPECIAL 0x08
333334
#define GIT_REGEX_SPECIAL 0x10
334335
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
336+
#define isascii(x) (((x) & ~0x7f) == 0)
335337
#define isspace(x) sane_istest(x,GIT_SPACE)
336338
#define isdigit(x) sane_istest(x,GIT_DIGIT)
337339
#define isalpha(x) sane_istest(x,GIT_ALPHA)

pretty.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ static int get_one_line(const char *msg)
8383
/* High bit set, or ISO-2022-INT */
8484
int non_ascii(int ch)
8585
{
86-
ch = (ch & 0xff);
87-
return ((ch & 0x80) || (ch == 0x1b));
86+
return !isascii(ch) || ch == '\033';
8887
}
8988

9089
static int is_rfc2047_special(char ch)

t/t1300-repo-config.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,10 @@ test_expect_success 'get bool variable with empty value' \
336336
'git config --bool emptyvalue.variable > output &&
337337
cmp output expect'
338338

339-
git config > output 2>&1
340-
341-
test_expect_success 'no arguments, but no crash' \
342-
"test $? = 129 && grep usage output"
339+
test_expect_success 'no arguments, but no crash' '
340+
test_must_fail git config >output 2>&1 &&
341+
grep usage output
342+
'
343343

344344
cat > .git/config << EOF
345345
[a.b]
@@ -373,7 +373,7 @@ EOF
373373
test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect'
374374

375375
test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' \
376-
'git config --file non-existing-config -l; test $? != 0'
376+
'test_must_fail git config --file non-existing-config -l'
377377

378378
cat > other-config << EOF
379379
[ein]

t/t3505-cherry-pick-empty.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
test_description='test cherry-picking an empty commit'
4+
5+
. ./test-lib.sh
6+
7+
test_expect_success setup '
8+
9+
echo first > file1 &&
10+
git add file1 &&
11+
test_tick &&
12+
git commit -m "first" &&
13+
14+
git checkout -b empty-branch &&
15+
test_tick &&
16+
git commit --allow-empty -m "empty"
17+
18+
'
19+
20+
test_expect_code 1 'cherry-pick an empty commit' '
21+
22+
git checkout master &&
23+
git cherry-pick empty-branch
24+
25+
'
26+
27+
test_expect_success 'index lockfile was removed' '
28+
29+
test ! -f .git/index.lock
30+
31+
'
32+
33+
test_done

0 commit comments

Comments
 (0)