summaryrefslogtreecommitdiff
path: root/convert.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-02-24 22:02:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-24 22:11:27 (GMT)
commit92ac3197e4859ba8c19e3e7f7b8cf5dc38e4669d (patch)
tree66604f0afda58b0f6c522ea25262be830266d7fd /convert.h
parentd0482e88a735787f7bb33ef4783be0e7f6a70946 (diff)
downloadgit-92ac3197e4859ba8c19e3e7f7b8cf5dc38e4669d.zip
git-92ac3197e4859ba8c19e3e7f7b8cf5dc38e4669d.tar.gz
git-92ac3197e4859ba8c19e3e7f7b8cf5dc38e4669d.tar.bz2
teach convert_to_git a "dry run" mode
Some callers may want to know whether convert_to_git will actually do anything before performing the conversion itself (e.g., to decide whether to stream or handle blobs in-core). This patch lets callers specify the dry run mode by passing a NULL destination buffer. The return value, instead of indicating whether conversion happened, will indicate whether conversion would occur. For readability, we also include a wrapper function which makes it more obvious we are not actually performing the conversion. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.h')
-rw-r--r--convert.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/convert.h b/convert.h
index d799a16..ec5fd69 100644
--- a/convert.h
+++ b/convert.h
@@ -40,6 +40,11 @@ extern int convert_to_working_tree(const char *path, const char *src,
size_t len, struct strbuf *dst);
extern int renormalize_buffer(const char *path, const char *src, size_t len,
struct strbuf *dst);
+static inline int would_convert_to_git(const char *path, const char *src,
+ size_t len, enum safe_crlf checksafe)
+{
+ return convert_to_git(path, src, len, NULL, checksafe);
+}
/*****************************************************************
*