author | Jeff King <peff@peff.net> | |
Fri, 24 Feb 2012 22:05:03 +0000 (17:05 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 24 Feb 2012 22:12:19 +0000 (14:12 -0800) | ||
commit | 4c3b57b98bccfdb740b8f1d0ca574dd51deacfad | |
tree | 30c26917c01a0cedd3e70b9eb5856206b52c95ec | tree | snapshot |
parent | 92ac3197e4859ba8c19e3e7f7b8cf5dc38e4669d | commit | diff |
teach dry-run convert_to_git not to require a src buffer
When we call convert_to_git in dry-run mode, it may still
want to look at the source buffer, because some CRLF
conversion modes depend on analyzing the source to determine
whether it is in fact convertible CRLF text.
However, the main motivation for convert_to_git's dry-run
mode is that we would decide which method to use to acquire
the blob's data (streaming versus in-core). Requiring this
source analysis creates a chicken-and-egg problem. We are
better off simply guessing that anything we can't analyze
will end up needing conversion.
This patch lets a caller specify a NULL src buffer when
using dry-run mode (and only dry-run mode). A non-zero
return value goes from "we would convert" to "we might
convert"; a zero return value remains "we would definitely
not convert".
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When we call convert_to_git in dry-run mode, it may still
want to look at the source buffer, because some CRLF
conversion modes depend on analyzing the source to determine
whether it is in fact convertible CRLF text.
However, the main motivation for convert_to_git's dry-run
mode is that we would decide which method to use to acquire
the blob's data (streaming versus in-core). Requiring this
source analysis creates a chicken-and-egg problem. We are
better off simply guessing that anything we can't analyze
will end up needing conversion.
This patch lets a caller specify a NULL src buffer when
using dry-run mode (and only dry-run mode). A non-zero
return value goes from "we would convert" to "we might
convert"; a zero return value remains "we would definitely
not convert".
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c | diff | blob | history |