From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: luatex@nililand.de, git@vger.kernel.org
Subject: Re: [PATCH] archive-zip: add --text parameter
Date: Thu, 05 Mar 2015 16:27:40 +0100 [thread overview]
Message-ID: <54F875EC.2020600@web.de> (raw)
In-Reply-To: <xmqq7fuw5guc.fsf@gitster.dls.corp.google.com>
Am 05.03.2015 um 03:16 schrieb Junio C Hamano:
> René Scharfe <l.s.r@web.de> writes:
>
>> No sign-off, yet, because I'm not sure we really need another option.
>> E.g. --text=all doesn't seem to be actually useful, but it was easy to
>> implement. Info-ZIP's zip always creates archives like --text=auto
>> does, so perhaps we should make that our default behavior as well?
>
> My knee-jerk reaction is "yeah, why not? what are the downsides,
> other than the result will not be bit-for-bit identical to the
> output from older Git". I am sure I am missing something as I do
> not regularly use this format.
AFAICS there won't be any other downsides. And archive stability is
harder to achieve for ZIP anyway because it depends on compression level
and (more fundamentally) on libz version.
>> @@ -256,6 +264,8 @@ static int write_zip_entry(struct archiver_args *args,
>> return error("cannot read %s",
>> sha1_to_hex(sha1));
>> crc = crc32(crc, buffer, size);
>> + if (is_binary < 0)
>> + is_binary = buffer_is_binary(buffer, size);
>
> In this codepath, do you have the path of the thing the buffer
> contents came from? I am wondering if consulting the attributes
> system is a better idea. Anything that is explicitly marked as
> "binary" or "-diff" is definitely binary, and anything that is not
> marked as "binary" is text to us for all practical purposes, no?
Yes, attributes can help, especially to allow users to correct wrong
guesses of the heuristic. Offering automatic detection of binary files
by default like git diff and git grep is still a good idea, I think.
buffer_is_binary() doesn't add a lot of overhead since it only looks at
the first few bytes of the buffer.
René
next prev parent reply other threads:[~2015-03-05 15:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-23 13:58 zip files created with git archive flags text files as binaries Ulrike Fischer
2015-02-23 19:30 ` René Scharfe
2015-03-04 21:13 ` René Scharfe
2015-03-04 21:13 ` [PATCH] archive-zip: add --text parameter René Scharfe
2015-03-05 2:16 ` Junio C Hamano
2015-03-05 15:27 ` René Scharfe [this message]
2015-03-05 15:27 ` René Scharfe
2015-03-05 19:06 ` [PATCH v2] archive-zip: mark text files in archives René Scharfe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54F875EC.2020600@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=luatex@nililand.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).