You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @shive, thanks for opening this issue. I think that what you're describing here is in fact not a bug. While it is true that the pointer corresponding to an empty file is another empty file, the gzip compressed contents of an empty file is not. Therefore, the pointer of a gzip'd file is non-empty, too.
For example, consider this:
~ $ cat | gzip -c > gzip.out
~ $ cat gzip.out
Z%
In the first cat(1), no data is given to gzip other than to terminate it. The output file is malformed ASCII, but is non-zero in size. Therefore, the shasum of that file is captured in the final oid field of the pointer.
I hope that helps, and if you have additional questions please don't hesitate to reopen this issue!
In other words, in order to process an empty file correctly in lfs.extension, is it necessary to judge whether it is an empty file and branch whether or not to pass it to gzip?
Activity
ttaylorr commentedon Feb 14, 2018
Hi @shive, thanks for opening this issue. I think that what you're describing here is in fact not a bug. While it is true that the pointer corresponding to an empty file is another empty file, the gzip compressed contents of an empty file is not. Therefore, the pointer of a gzip'd file is non-empty, too.
For example, consider this:
In the first
cat(1), no data is given to gzip other than to terminate it. The output file is malformed ASCII, but is non-zero in size. Therefore, the shasum of that file is captured in the finaloidfield of the pointer.I hope that helps, and if you have additional questions please don't hesitate to reopen this issue!
shive commentedon Feb 14, 2018
@ttaylorr
Thank you for your reply.
In other words, in order to process an empty file correctly in lfs.extension, is it necessary to judge whether it is an empty file and branch whether or not to pass it to gzip?
Is it wrong to pass directly to gzip?
shive commentedon Feb 14, 2018
There is no problem that the result of going through gzip does not become an empty file, but it is in trouble because
git statusis judged different.ttaylorr commentedon Feb 14, 2018
Ah, thank you for the clarification. I think that this is indeed a bug.
shive commentedon Feb 14, 2018
Thank you!
I am looking forward to the update.
mathstuf commentedon Feb 21, 2018
For reference, #2447 discussed the addition of that note to the spec (and it was added in #2449).