summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorMax Kirillov <max@max630.net>2015-06-07 00:02:31 +0300
committerJunio C Hamano <gitster@pobox.com>2015-06-08 09:23:32 -0700
commit3b7416611eb22d6beaa44acfbcb14f2d1f6e8c2d (patch)
treec600fe9b00d0795d65193b40147f3c32b12ee4f9 /utf8.c
parent7974889a053574e449b55ca543a486e38e74864f (diff)
downloadgit-mk/utf8-no-iconv-warn.tar.gz
utf8.c: print warning about disabled iconvmk/utf8-no-iconv-warn
It is an allowed compile-time option to build git without iconv support. Resulting build almost always functions correctly, and never displays that it is missing anything, but reencode_string_len() just never modifies its input. This gives undesirable result that returned data or even data written into repository is incorrect and user is not aware about it. Show warning there is non-trivial reencoding requested. Show it only once during program run. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 28e6d76a42..85fa2cd03f 100644
--- a/utf8.c
+++ b/utf8.c
@@ -521,6 +521,19 @@ char *reencode_string_len(const char *in, int insz,
iconv_close(conv);
return out;
}
+#else
+static int noiconv_warning_shown = 0;
+
+char *reencode_string_len(const char *in, int insz,
+ const char *out_encoding, const char *in_encoding,
+ int *outsz)
+{
+ if (!same_encoding(in_encoding, out_encoding) && !noiconv_warning_shown) {
+ warning("Iconv support is disabled at compile time. It is likely that\nincorrect data will be printed or stored in repository.\nConsider using other build for this task.");
+ noiconv_warning_shown = 1;
+ }
+ return NULL;
+}
#endif
/*