{"thread":{"id":"15617","subject":"[PATCH 1/2] Add new test to show git archive autocrlf bug","startedAt":"2008-09-21T20:25:26Z","lastAt":"2008-09-21T20:25:27Z","messageCount":2,"participants":["Charles Bailey"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"91258","messageId":"1222028727-30097-1-git-send-email-charles@hashpling.org","threadId":"15617","inReplyTo":null,"subject":"[PATCH 1/2] Add new test to show git archive autocrlf bug","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2008-09-21T20:25:26Z","receivedAt":"2008-09-21T20:25:26Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"Signed-off-by: Charles Bailey <charles@hashpling.org>\n---\n\nAs the few responses to this patch were only positive last time around\n(despite my attempt to confuse things by messing up the threading), I'm\nresending for inclusion. I believe that the current behaviour is buggy,\nso I hope that this patch is 'maint' worthy.\n\n t/t0024-crlf-archive.sh |   46 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 46 insertions(+), 0 deletions(-)\n create mode 100644 t/t0024-crlf-archive.sh\n\ndiff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh\nnew file mode 100644\nindex 0000000..3511439\n--- /dev/null\n+++ b/t/t0024-crlf-archive.sh\n@@ -0,0 +1,46 @@\n+#!/bin/sh\n+\n+test_description='respect crlf in git archive'\n+\n+. ./test-lib.sh\n+UNZIP=${UNZIP:-unzip}\n+\n+test_expect_success setup '\n+\n+\tgit config core.autocrlf true\n+\n+\tprintf \"CRLF line ending\\r\\nAnd another\\r\\n\" > sample &&\n+\tgit add sample &&\n+\n+\ttest_tick &&\n+\tgit commit -m Initial\n+\n+'\n+\n+test_expect_success 'tar archive' '\n+\n+\tgit archive --format=tar HEAD |\n+\t( mkdir untarred && cd untarred && \"$TAR\" -xf - )\n+\n+\ttest_cmp sample untarred/sample\n+\n+'\n+\n+\"$UNZIP\" -v >/dev/null 2>&1\n+if [ $? -eq 127 ]; then\n+\techo \"Skipping ZIP test, because unzip was not found\"\n+\ttest_done\n+\texit\n+fi\n+\n+test_expect_failure 'zip archive' '\n+\n+\tgit archive --format=zip HEAD >test.zip &&\n+\n+\t( mkdir unzipped && cd unzipped && unzip ../test.zip ) &&\n+\n+\ttest_cmp sample unzipped/sample\n+\n+'\n+\n+test_done\n-- \n1.6.0.1.309.g4f56\n"},{"id":"91259","messageId":"1222028727-30097-2-git-send-email-charles@hashpling.org","threadId":"15617","inReplyTo":"1222028727-30097-1-git-send-email-charles@hashpling.org","subject":"[PATCH 2/2] Make git respect core.autocrlf for zip archives","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2008-09-21T20:25:27Z","receivedAt":"2008-09-21T20:25:27Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"There is currently no call to git_config at the start of cmd_archive.\nWhen creating tar archives the core config is read as a side-effect of\nreading the tar specific config, but this doesn't happen for zip\narchives.\n\nThe consequence is that in a configuration with core.autocrlf set,\nalthough files in a tar archive are created with crlf line endings,\nfiles in a zip archive retain unix line endings.\n\nSigned-off-by: Charles Bailey <charles@hashpling.org>\n---\n builtin-archive.c       |    2 ++\n t/t0024-crlf-archive.sh |    2 +-\n 2 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-archive.c b/builtin-archive.c\nindex 5ceec43..432ce2a 100644\n--- a/builtin-archive.c\n+++ b/builtin-archive.c\n@@ -111,6 +111,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)\n {\n \tconst char *remote = NULL;\n \n+\tgit_config(git_default_config, NULL);\n+\n \tremote = extract_remote_arg(&argc, argv);\n \tif (remote)\n \t\treturn run_remote_archiver(remote, argc, argv);\ndiff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh\nindex 3511439..e533039 100644\n--- a/t/t0024-crlf-archive.sh\n+++ b/t/t0024-crlf-archive.sh\n@@ -33,7 +33,7 @@ if [ $? -eq 127 ]; then\n \texit\n fi\n \n-test_expect_failure 'zip archive' '\n+test_expect_success 'zip archive' '\n \n \tgit archive --format=zip HEAD >test.zip &&\n \n-- \n1.6.0.1.309.g4f56\n"}]}