Merge branch 'dt/merge-recursive-case-insensitive'
authorJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:23:13 +0000 (11:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:23:13 +0000 (11:23 -0700)
On a case insensitive filesystem, merge-recursive incorrectly
deleted the file that is to be renamed to a name that is the same
except for case differences.

* dt/merge-recursive-case-insensitive:
mv: allow renaming to fix case on case insensitive filesystems
merge-recursive.c: fix case-changing merge bug

1  2 
builtin/mv.c
diff --combined builtin/mv.c
index 2a7243f52e413c821f9f75969edcc0a9822c8e21,f4d89d06408be1fabf964000b18fa8204a9bb3a4..180ef99127d47d0e8fe9f12a590fd9ba9e524f08
@@@ -162,8 -162,7 +162,8 @@@ int cmd_mv(int argc, const char **argv
                                        if (strncmp(path, src_w_slash, len_w_slash))
                                                break;
                                }
 -                              free((char *)src_w_slash);
 +                              if (src_w_slash != src)
 +                                      free((char *)src_w_slash);
  
                                if (last - first < 1)
                                        bad = _("source directory is empty");
                        }
                } else if (cache_name_pos(src, length) < 0)
                        bad = _("not under version control");
-               else if (lstat(dst, &st) == 0) {
+               else if (lstat(dst, &st) == 0 &&
+                        (!ignore_case || strcasecmp(src, dst))) {
                        bad = _("destination exists");
                        if (force) {
                                /*