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
This commit is contained in:
Junio C Hamano 2009-03-07 22:34:13 -08:00
commit 934f788981
7 changed files with 48 additions and 9 deletions

View File

@ -131,6 +131,10 @@ See also <<FILES>>.
in the config file will cause the value to be multiplied
by 1024, 1048576, or 1073741824 prior to output.
--bool-or-int::
'git-config' will ensure that the output matches the format of
either --bool or --int, as described above.
-z::
--null::
For all options that output values and/or keys, always

View File

@ -568,11 +568,11 @@ This outputs all the commit objects between the included and excluded
commits, ordered by their distance to the included and excluded
commits. The farthest from them is displayed first. (This is the only
one displayed by `--bisect`.)
+
This is useful because it makes it easy to choose a good commit to
test when you want to avoid to test some of them for some reason (they
may not compile for example).
+
This option can be used along with `--bisect-vars`, in this case,
after all the sorted commit objects, there will be the same text as if
`--bisect-vars` had been used alone.

View File

@ -376,6 +376,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
(write_cache(index_fd, active_cache, active_nr) ||
commit_locked_index(&index_lock)))
die("%s: Unable to write new index file", me);
rollback_lock_file(&index_lock);
if (!clean) {
add_to_msg("\nConflicts:\n\n");

View File

@ -319,6 +319,7 @@ static inline int has_extension(const char *filename, const char *ext)
}
/* Sane ctype - no locale, and works with signed chars */
#undef isascii
#undef isspace
#undef isdigit
#undef isalpha
@ -332,6 +333,7 @@ extern unsigned char sane_ctype[256];
#define GIT_GLOB_SPECIAL 0x08
#define GIT_REGEX_SPECIAL 0x10
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
#define isascii(x) (((x) & ~0x7f) == 0)
#define isspace(x) sane_istest(x,GIT_SPACE)
#define isdigit(x) sane_istest(x,GIT_DIGIT)
#define isalpha(x) sane_istest(x,GIT_ALPHA)

View File

@ -83,8 +83,7 @@ static int get_one_line(const char *msg)
/* High bit set, or ISO-2022-INT */
int non_ascii(int ch)
{
ch = (ch & 0xff);
return ((ch & 0x80) || (ch == 0x1b));
return !isascii(ch) || ch == '\033';
}
static int is_rfc2047_special(char ch)

View File

@ -336,10 +336,10 @@ test_expect_success 'get bool variable with empty value' \
'git config --bool emptyvalue.variable > output &&
cmp output expect'
git config > output 2>&1
test_expect_success 'no arguments, but no crash' \
"test $? = 129 && grep usage output"
test_expect_success 'no arguments, but no crash' '
test_must_fail git config >output 2>&1 &&
grep usage output
'
cat > .git/config << EOF
[a.b]
@ -373,7 +373,7 @@ EOF
test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect'
test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' \
'git config --file non-existing-config -l; test $? != 0'
'test_must_fail git config --file non-existing-config -l'
cat > other-config << EOF
[ein]

33
t/t3505-cherry-pick-empty.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
test_description='test cherry-picking an empty commit'
. ./test-lib.sh
test_expect_success setup '
echo first > file1 &&
git add file1 &&
test_tick &&
git commit -m "first" &&
git checkout -b empty-branch &&
test_tick &&
git commit --allow-empty -m "empty"
'
test_expect_code 1 'cherry-pick an empty commit' '
git checkout master &&
git cherry-pick empty-branch
'
test_expect_success 'index lockfile was removed' '
test ! -f .git/index.lock
'
test_done