summaryrefslogtreecommitdiff
path: root/archive-tar.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-10 13:47:35 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-10 13:47:35 -0800
commitf12f3af72677c966b0c485f7b0d4cf8ac25a032c (patch)
tree25d9631171fd10d5847bf6c68a9a11ca49169aed /archive-tar.c
parent63d1cf6526a51d72f5c14cf9f8c72d3cc37762bb (diff)
parent22f0dcd9634a818a0c83f23ea1a48f2d620c0546 (diff)
downloadgit-f12f3af72677c966b0c485f7b0d4cf8ac25a032c.tar.gz
Merge branch 'rs/leave-base-name-in-name-field-of-tar'
Improve compatibility with implementations of "tar" that do not like empty name field in header (with the additional prefix field holding everything). * rs/leave-base-name-in-name-field-of-tar: archive-tar: split long paths more carefully
Diffstat (limited to 'archive-tar.c')
-rw-r--r--archive-tar.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/archive-tar.c b/archive-tar.c
index 0ba3f25cf5..d1cce46e33 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -153,6 +153,8 @@ static unsigned int ustar_header_chksum(const struct ustar_header *header)
static size_t get_path_prefix(const char *path, size_t pathlen, size_t maxlen)
{
size_t i = pathlen;
+ if (i > 1 && path[i - 1] == '/')
+ i--;
if (i > maxlen)
i = maxlen;
do {