Skip to content

Commit 50906e0

Browse files
jjensengitster
authored andcommitted
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>
1 parent dc1ae70 commit 50906e0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fast-import.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ Format of STDIN stream:
156156
#include "csum-file.h"
157157
#include "quote.h"
158158
#include "exec_cmd.h"
159+
#include "dir.h"
159160

160161
#define PACK_ID_BITS 16
161162
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -1461,7 +1462,7 @@ static int tree_content_set(
14611462

14621463
for (i = 0; i < t->entry_count; i++) {
14631464
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)) {
14651466
if (!slash1) {
14661467
if (!S_ISDIR(mode)
14671468
&& e->versions[1].mode == mode
@@ -1527,7 +1528,7 @@ static int tree_content_remove(
15271528

15281529
for (i = 0; i < t->entry_count; i++) {
15291530
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)) {
15311532
if (!slash1 || !S_ISDIR(e->versions[1].mode))
15321533
goto del_entry;
15331534
if (!e->tree)
@@ -1577,7 +1578,7 @@ static int tree_content_get(
15771578

15781579
for (i = 0; i < t->entry_count; i++) {
15791580
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)) {
15811582
if (!slash1) {
15821583
memcpy(leaf, e, sizeof(*leaf));
15831584
if (e->tree && is_null_sha1(e->versions[1].sha1))

0 commit comments

Comments
 (0)