+To use this patch, run these commands for a successful build:
+
+ patch -p1 <patches/ignore-case.diff
+ ./configure (optional if already run)
+ make
+
+TODO:
+
+ - Make this code handle multibyte character encodings, and honor the
+ --iconv setting when converting case.
+
+--- old/exclude.c
++++ new/exclude.c
+@@ -32,6 +32,7 @@ extern int io_error;
+ extern int local_server;
+ extern int prune_empty_dirs;
+ extern int ignore_perishable;
++extern int ignore_case;
+ extern int delete_mode;
+ extern int delete_excluded;
+ extern int cvs_exclude;
+@@ -583,16 +584,17 @@ static int rule_matches(char *name, stru
+ if (litmatch_array(pattern, strings, slash_handling))
+ return ret_match;
+ } else if (anchored_match) {
+- if (strcmp(name, pattern) == 0)
++ if ((ignore_case ? strcasecmp(name, pattern)
++ : strcmp(name, pattern)) == 0)
+ return ret_match;
+ } else {
+ int l1 = strlen(name);
+ int l2 = strlen(pattern);
+- if (l2 <= l1 &&
+- strcmp(name+(l1-l2),pattern) == 0 &&
+- (l1==l2 || name[l1-(l2+1)] == '/')) {
++ if (l2 <= l1
++ && (ignore_case ? strcasecmp(name + (l1-l2), pattern)
++ : strcmp(name + (l1-l2), pattern)) == 0
++ && (l1 == l2 || name[l1 - (l2+1)] == '/'))
+ return ret_match;
+- }
+ }
+
+ return !ret_match;
+--- old/flist.c
++++ new/flist.c
+@@ -35,6 +35,7 @@ extern int inc_recurse;
+ extern int do_progress;
+ extern int always_checksum;
+ extern int module_id;
++extern int ignore_case;
+ extern int ignore_errors;
+ extern int numeric_ids;
+ extern int recurse;
+@@ -2494,6 +2495,7 @@ int f_name_cmp(const struct file_struct
+ {
+ int dif;
+ const uchar *c1, *c2;
++ uchar ch1, ch2;
+ enum fnc_state state1, state2;
+ enum fnc_type type1, type2;
+ enum fnc_type t_path = protocol_version >= 29 ? t_PATH : t_ITEM;
+@@ -2604,7 +2606,15 @@ int f_name_cmp(const struct file_struct
+ if (type1 != type2)
+ return type1 == t_PATH ? 1 : -1;
+ }
+- } while ((dif = (int)*c1++ - (int)*c2++) == 0);
++ ch1 = CVAL(c1++, 0);
++ ch2 = CVAL(c2++, 0);
++ if (ignore_case) {
++ if (islower(ch1))
++ ch1 = toupper(ch1);
++ if (islower(ch2))
++ ch2 = toupper(ch2);
++ }
++ } while ((dif = ch1 - ch2) == 0);
+
+ return dif;
+ }
+--- old/lib/wildmatch.c
++++ new/lib/wildmatch.c