From 3d2d4f96d240317d898bd05af567bad938e0bda2 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 7 Mar 2009 13:37:24 +0100 Subject: [PATCH 1/5] Documentation: fix badly indented paragraphs in "--bisect-all" description Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Documentation/rev-list-options.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 5076322877..7dd237c2f6 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -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. From c2e9364a06df55e70d7652d37bb4d712f6b3bb3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 7 Mar 2009 14:06:49 +0100 Subject: [PATCH 2/5] cleanup: add isascii() Add a standard definition of isascii() and use it to replace an open coded high-bit test in pretty.c. While we're there, write the ESC char as the more commonly used '\033' instead of as 0x1b to enhance its grepability. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- git-compat-util.h | 2 ++ pretty.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index dcf4127750..878d83dd08 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -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) diff --git a/pretty.c b/pretty.c index 6cd91491d3..e9540e46da 100644 --- a/pretty.c +++ b/pretty.c @@ -75,8 +75,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) From 003f69b282f9cc54da771e1b3e9378aa3f5178cd Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 7 Mar 2009 12:14:04 -0500 Subject: [PATCH 3/5] t1300: use test_must_fail as appropriate Some of the tests checked the exit code manually, even going so far as to run git outside of the test_expect harness. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 11b82f43dd..3c06842d99 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -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] From d57f07ebae7e84b356ff2b891adeccf965d2ba11 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 7 Mar 2009 12:14:06 -0500 Subject: [PATCH 4/5] document config --bool-or-int The documentation is just a pointer to the --bool and --int options, but it makes sense to at least mention that it exists. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-config.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt index 19a8917b83..6ab2af4b61 100644 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@ -130,6 +130,10 @@ See also <>. 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 From 0d66e95903a5c2567baa61cc7299ce865abe41b1 Mon Sep 17 00:00:00 2001 From: Chris Johnsen Date: Sat, 7 Mar 2009 03:30:51 -0600 Subject: [PATCH 5/5] builtin-revert.c: release index lock when cherry-picking an empty commit When a cherry-pick of an empty commit is done, release the lock held on the index. The fix is the same as was applied to similar code in 4271666046. Signed-off-by: Chris Johnsen Signed-off-by: Junio C Hamano --- builtin-revert.c | 1 + t/t3505-cherry-pick-empty.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 t/t3505-cherry-pick-empty.sh diff --git a/builtin-revert.c b/builtin-revert.c index d48313c745..09d08fa3e3 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -387,6 +387,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"); diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh new file mode 100755 index 0000000000..9aaeabd972 --- /dev/null +++ b/t/t3505-cherry-pick-empty.sh @@ -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