Merge branch 'hn/sort-ls-remote'
[gitweb.git] / name-hash.c
index ada66f066a002ac5ecb73f94a582d758c0a3a657..163849831c9f11316ce97c649b77c32cf2eed276 100644 (file)
@@ -699,12 +699,12 @@ void adjust_dirname_case(struct index_state *istate, char *name)
                if (*ptr == '/') {
                        struct dir_entry *dir;
 
-                       ptr++;
-                       dir = find_dir_entry(istate, name, ptr - name + 1);
+                       dir = find_dir_entry(istate, name, ptr - name);
                        if (dir) {
                                memcpy((void *)startPtr, dir->name + (startPtr - name), ptr - startPtr);
-                               startPtr = ptr;
+                               startPtr = ptr + 1;
                        }
+                       ptr++;
                }
        }
 }