Merge branch 'maint'

* maint:
  t1301-shared-repo.sh: don't let a default ACL interfere with the test
  git-check-attr(1): add output and example sections
  xdiff-interface.c: strip newline (and cr) from line before pattern matching
  t4018-diff-funcname: demonstrate end of line funcname matching flaw
  t4018-diff-funcname: rework negated last expression test
  Typo "does not exists" when git remote update remote.
  remote.c: correct the check for a leading '/' in a remote name
  Add testcase to ensure merging an early part of a branch is done properly

Conflicts:
	t/t7600-merge.sh
This commit is contained in:
Junio C Hamano 2008-10-17 01:52:32 -07:00
commit 46dc1b0e33
7 changed files with 101 additions and 6 deletions

View File

@ -22,6 +22,56 @@ OPTIONS
arguments as path names. If not supplied, only the first argument will
be treated as an attribute.
OUTPUT
------
The output is of the form:
<path> COLON SP <attribute> COLON SP <info> LF
Where <path> is the path of a file being queried, <attribute> is an attribute
being queried and <info> can be either:
'unspecified';; when the attribute is not defined for the path.
'unset';; when the attribute is defined to false.
'set';; when the attribute is defined to true.
<value>;; when a value has been assigned to the attribute.
EXAMPLES
--------
In the examples, the following '.gitattributes' file is used:
---------------
*.java diff=java -crlf myAttr
NoMyAttr.java !myAttr
README caveat=unspecified
---------------
* Listing a single attribute:
---------------
$ git check-attr diff org/example/MyClass.java
org/example/MyClass.java: diff: java
---------------
* Listing multiple attributes for a file:
---------------
$ git check-attr crlf diff myAttr -- org/example/MyClass.java
org/example/MyClass.java: crlf: unset
org/example/MyClass.java: diff: java
org/example/MyClass.java: myAttr: set
---------------
* Listing attribute for multiple files:
---------------
$ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
org/example/MyClass.java: myAttr: set
org/example/NoMyAttr.java: myAttr: unspecified
---------------
* Not all values are equally unambiguous:
---------------
$ git check-attr caveat README
README: caveat: unspecified
---------------
SEE ALSO
--------

View File

@ -309,7 +309,7 @@ sub update_remote {
}
}
} else {
print STDERR "Remote group $name does not exists.\n";
print STDERR "Remote group $name does not exist.\n";
exit(1);
}
for (@remotes) {

View File

@ -341,13 +341,14 @@ static int handle_config(const char *key, const char *value, void *cb)
if (prefixcmp(key, "remote."))
return 0;
name = key + 7;
if (*name == '/') {
warning("Config remote shorthand cannot begin with '/': %s",
name);
return 0;
}
subkey = strrchr(name, '.');
if (!subkey)
return error("Config with no key for remote %s", name);
if (*subkey == '/') {
warning("Config remote shorthand cannot begin with '/': %s", name);
return 0;
}
remote = make_remote(name, subkey - name);
if (!strcmp(subkey, ".mirror"))
remote->mirror = git_config_bool(key, value);

View File

@ -7,6 +7,9 @@ test_description='Test shared repository initialization'
. ./test-lib.sh
# Remove a default ACL from the test dir if possible.
setfacl -k . 2>/dev/null
# User must have read permissions to the repo -> failure on --shared=0400
test_expect_success 'shared = 0400 (faulty permission u-w)' '
mkdir sub && (

View File

@ -65,7 +65,14 @@ test_expect_success 'custom pattern' '
test_expect_success 'last regexp must not be negated' '
git config diff.java.funcname "!static" &&
test_must_fail git diff --no-index Beer.java Beer-correct.java
git diff --no-index Beer.java Beer-correct.java 2>&1 |
grep "fatal: Last expression must not be negated:"
'
test_expect_success 'pattern which matches to end of line' '
git config diff.java.funcname "Beer$" &&
git diff --no-index Beer.java Beer-correct.java |
grep "^@@.*@@ Beer"
'
test_expect_success 'alternation in pattern' '

View File

@ -518,6 +518,30 @@ test_expect_success 'refresh the index before merging' '
git merge c3
'
cat >expected <<EOF
Merge branch 'c5' (early part)
EOF
test_expect_success 'merge early part of c2' '
git reset --hard c3 &&
echo c4 > c4.c &&
git add c4.c &&
git commit -m c4 &&
git tag c4 &&
echo c5 > c5.c &&
git add c5.c &&
git commit -m c5 &&
git tag c5 &&
git reset --hard c3 &&
echo c6 > c6.c &&
git add c6.c &&
git commit -m c6 &&
git tag c6 &&
git merge c5~1 &&
git show -s --pretty=format:%s HEAD > actual &&
test_cmp actual expected
'
test_debug 'gitk --all'
test_done

View File

@ -207,6 +207,16 @@ static long ff_regexp(const char *line, long len,
line_buffer = xstrndup(line, len); /* make NUL terminated */
/* Exclude terminating newline (and cr) from matching */
if (len > 0 && line[len-1] == '\n') {
if (len > 1 && line[len-2] == '\r')
len -= 2;
else
len--;
}
line_buffer = xstrndup(line, len); /* make NUL terminated */
for (i = 0; i < regs->nr; i++) {
struct ff_reg *reg = regs->array + i;
if (!regexec(&reg->re, line_buffer, 2, pmatch, 0)) {