Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-08-17 19:24:01 +0300
committerJunio C Hamano <gitster@pobox.com>2019-08-19 20:48:02 +0300
commit82a46af13eeed4b73a077b50edb90f559460267f (patch)
tree71c84819205a896e7f33f375e18317f0b901ebf2 /t/t5004-archive-corner-cases.sh
parent4060c1990a9cceb710808bd4b4ab94d2355aefff (diff)
archive-tar: fix pax extended header length calculation
A pax extended header record starts with a decimal number. Its value is the length of the whole record, including its own length. The calculation of that number in strbuf_append_ext_header() is off by one in case the length of the rest is close to a higher order of magnitude. This affects paths and link targets a bit shorter than 1000, 10000, 100000 etc. characters -- paths with a length of up to 100 fit into the tar header and don't need a pax extended header. The mistake has been present since the function was added by ae64bbc18c ("tar-tree: Introduce write_entry()", 2006-03-25). Account for digits added to len during the loop and keep incrementing until we have enough space for len and the rest. The crucial change is to check against the current value of len before each iteration, instead of against its value before the loop. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5004-archive-corner-cases.sh')
-rwxr-xr-xt/t5004-archive-corner-cases.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index 2f15d1899d..4966a74b4d 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -217,7 +217,7 @@ build_tree() {
' "$1"
}
-test_expect_failure 'tar archive with long paths' '
+test_expect_success 'tar archive with long paths' '
blob=$(echo foo | git hash-object -w --stdin) &&
tree=$(build_tree $blob | git mktree) &&
git archive -o long_paths.tar $tree 2>stderr &&