aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-04-22 23:37:06 -0700
committerJunio C Hamano <gitster@pobox.com>2008-04-22 23:37:06 -0700
commitd6958a1a32814af69a7571daa45252018c61f969 (patch)
tree355fe5cdd4749e67d8979f80f7dcdc649b9aba41
parent491b1b11213c373a3e91004b1ab775d7e52ac1f3 (diff)
parent4f7ec7970874d09be162bc7f16415a0ec2d36ae5 (diff)
downloadgit-d6958a1a32814af69a7571daa45252018c61f969.tar.gz
git-d6958a1a32814af69a7571daa45252018c61f969.tar.xz
Merge branch 'maint-1.5.4' into maint
* maint-1.5.4: svn-git: Use binmode for reading/writing binary rev maps diff options documentation: refer to --diff-filter in --name-status git-svn bug with blank commits and author file archive.c: format_subst - fixed bogus argument to memchr copy.c: copy_fd - correctly report write errors gitattributes: Fix subdirectory attributes specified from root directory
-rw-r--r--Documentation/diff-options.txt3
-rw-r--r--archive.c4
-rw-r--r--attr.c4
-rw-r--r--copy.c8
-rwxr-xr-xgit-svn.perl7
-rwxr-xr-xt/t0003-attributes.sh8
6 files changed, 24 insertions, 10 deletions
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 01e7a5785..13234fa28 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -83,7 +83,8 @@ endif::git-format-patch[]
Show only names of changed files.
--name-status::
- Show only names and status of changed files.
+ Show only names and status of changed files. See the description
+ of the `--diff-filter` option on what the status letters mean.
--color::
Show colored diff.
diff --git a/archive.c b/archive.c
index fb159fe59..7a32c19d3 100644
--- a/archive.c
+++ b/archive.c
@@ -16,9 +16,9 @@ static void format_subst(const struct commit *commit,
const char *b, *c;
b = memmem(src, len, "$Format:", 8);
- if (!b || src + len < b + 9)
+ if (!b)
break;
- c = memchr(b + 8, '$', len - 8);
+ c = memchr(b + 8, '$', (src + len) - b - 8);
if (!c)
break;
diff --git a/attr.c b/attr.c
index 64b77b166..1a15fad29 100644
--- a/attr.c
+++ b/attr.c
@@ -546,7 +546,9 @@ static int path_matches(const char *pathname, int pathlen,
(baselen && pathname[baselen] != '/') ||
strncmp(pathname, base, baselen))
return 0;
- return fnmatch(pattern, pathname + baselen + 1, FNM_PATHNAME) == 0;
+ if (baselen != 0)
+ baselen++;
+ return fnmatch(pattern, pathname + baselen, FNM_PATHNAME) == 0;
}
static int fill_one(const char *what, struct match_attr *a, int rem)
diff --git a/copy.c b/copy.c
index afc4fbf41..e54d15ace 100644
--- a/copy.c
+++ b/copy.c
@@ -9,8 +9,7 @@ int copy_fd(int ifd, int ofd)
if (!len)
break;
if (len < 0) {
- int read_error;
- read_error = errno;
+ int read_error = errno;
close(ifd);
return error("copy-fd: read returned %s",
strerror(read_error));
@@ -25,9 +24,10 @@ int copy_fd(int ifd, int ofd)
close(ifd);
return error("copy-fd: write returned 0");
} else {
+ int write_error = errno;
close(ifd);
return error("copy-fd: write returned %s",
- strerror(errno));
+ strerror(write_error));
}
}
}
@@ -48,7 +48,7 @@ int copy_file(const char *dst, const char *src, int mode)
}
status = copy_fd(fdi, fdo);
if (close(fdo) != 0)
- return error("%s: write error: %s", dst, strerror(errno));
+ return error("%s: close error: %s", dst, strerror(errno));
if (!status && adjust_shared_perm(dst))
return -1;
diff --git a/git-svn.perl b/git-svn.perl
index b864b54a4..b1510495a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2375,8 +2375,7 @@ sub check_author {
my ($author) = @_;
if (!defined $author || length $author == 0) {
$author = '(no author)';
- }
- if (defined $::_authors && ! defined $::users{$author}) {
+ } elsif (defined $::_authors && ! defined $::users{$author}) {
die "Author: $author not defined in $::_authors file\n";
}
$author;
@@ -2519,6 +2518,7 @@ sub rebuild_from_rev_db {
my ($self, $path) = @_;
my $r = -1;
open my $fh, '<', $path or croak "open: $!";
+ binmode $fh or croak "binmode: $!";
while (<$fh>) {
length($_) == 41 or croak "inconsistent size in ($_) != 41";
chomp($_);
@@ -2616,6 +2616,7 @@ sub rebuild {
sub _rev_map_set {
my ($fh, $rev, $commit) = @_;
+ binmode $fh or croak "binmode: $!";
my $size = (stat($fh))[7];
($size % 24) == 0 or croak "inconsistent size: $size";
@@ -2719,6 +2720,7 @@ sub rev_map_max {
my $map_path = $self->map_path;
stat $map_path or return $want_commit ? (0, undef) : 0;
sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
+ binmode $fh or croak "binmode: $!";
my $size = (stat($fh))[7];
($size % 24) == 0 or croak "inconsistent size: $size";
@@ -2751,6 +2753,7 @@ sub rev_map_get {
return undef unless -e $map_path;
sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
+ binmode $fh or croak "binmode: $!";
my $size = (stat($fh))[7];
($size % 24) == 0 or croak "inconsistent size: $size";
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index 3faf135e3..c56d2fbab 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -21,6 +21,7 @@ test_expect_success 'setup' '
mkdir -p a/b/d a/c &&
(
echo "f test=f"
+ echo "a/i test=a/i"
) >.gitattributes &&
(
echo "g test=a/g" &&
@@ -46,4 +47,11 @@ test_expect_success 'attribute test' '
'
+test_expect_success 'root subdir attribute test' '
+
+ attr_check a/i a/i &&
+ attr_check subdir/a/i unspecified
+
+'
+
test_done