]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jh/mingw-unlink'
authorJunio C Hamano <gitster@pobox.com>
Wed, 19 Aug 2020 23:14:53 +0000 (16:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Aug 2020 23:14:53 +0000 (16:14 -0700)
"unlink" emulation on MinGW has been optimized.

* jh/mingw-unlink:
  mingw: improve performance of mingw_unlink()

1  2 
compat/mingw.c

diff --combined compat/mingw.c
index 4454b3e67b7488be2701fdc0001aa608362fd002,f18636c17c5be7a4db441640ed773e07f1c84611..a00f3312300ac36773bf42aec80b4514f31b1293
@@@ -18,8 -18,8 +18,8 @@@ void open_in_gdb(void
        static struct child_process cp = CHILD_PROCESS_INIT;
        extern char *_pgmptr;
  
 -      argv_array_pushl(&cp.args, "mintty", "gdb", NULL);
 -      argv_array_pushf(&cp.args, "--pid=%d", getpid());
 +      strvec_pushl(&cp.args, "mintty", "gdb", NULL);
 +      strvec_pushf(&cp.args, "--pid=%d", getpid());
        cp.clean_on_exit = 1;
        if (start_command(&cp) < 0)
                die_errno("Could not start gdb");
@@@ -290,6 -290,9 +290,9 @@@ int mingw_unlink(const char *pathname
        if (xutftowcs_path(wpathname, pathname) < 0)
                return -1;
  
+       if (DeleteFileW(wpathname))
+               return 0;
        /* read-only files cannot be removed */
        _wchmod(wpathname, 0666);
        while ((ret = _wunlink(wpathname)) == -1 && tries < ARRAY_SIZE(delay)) {