@matheusbsbs / matheus-bagliano / commits / 50906e04e8
Fork 0

Support case folding in git fast-import when core.ignorecase=true

When core.ignorecase=true, imported file paths will be folded to match existing directory case. Signed-off-by: Joshua Jensen <jjensen@workspacewhiz.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Joshua Jensen committed Oct 3, 2010 at 09:56 UTC 50906e04e8f48215b0b09841686709b92a2ab2e4
1 file changed +4 -3
fast-import.c
+4 -3
@@ -156,6 +156,7 @@ Format of STDIN stream:
156 #include "csum-file.h"
157 #include "quote.h"
158 #include "exec_cmd.h"
159 +#include "dir.h"
160
161 #define PACK_ID_BITS 16
162 #define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -1461,7 +1462,7 @@ static int tree_content_set(
1462
1463 for (i = 0; i < t->entry_count; i++) {
1464 e = t->entries[i];
1464 - if (e->name->str_len == n && !strncmp(p, e->name->str_dat, n)) {
1465 + if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) {
1466 if (!slash1) {
1467 if (!S_ISDIR(mode)
1468 && e->versions[1].mode == mode
@@ -1527,7 +1528,7 @@ static int tree_content_remove(
1528
1529 for (i = 0; i < t->entry_count; i++) {
1530 e = t->entries[i];
1530 - if (e->name->str_len == n && !strncmp(p, e->name->str_dat, n)) {
1531 + if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) {
1532 if (!slash1 || !S_ISDIR(e->versions[1].mode))
1533 goto del_entry;
1534 if (!e->tree)
@@ -1577,7 +1578,7 @@ static int tree_content_get(
1578
1579 for (i = 0; i < t->entry_count; i++) {
1580 e = t->entries[i];
1580 - if (e->name->str_len == n && !strncmp(p, e->name->str_dat, n)) {
1581 + if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) {
1582 if (!slash1) {
1583 memcpy(leaf, e, sizeof(*leaf));
1584 if (e->tree && is_null_sha1(e->versions[1].sha1))