git/compat
Heiko Voigt c9b7840080 mingw: make failures to unlink or move raise a question
On Windows in case a program is accessing a file unlink or
move operations may fail. To give the user a chance to correct
this we simply wait until the user asks us to retry or fail.

This is useful because of the following use case which seem
to happen rarely but when it does it is a mess:

After making some changes the user realizes that he was on the
incorrect branch. When trying to change the branch some file
is still in use by some other process and git stops in the
middle of changing branches. Now the user has lots of files
with changes mixed with his own. This is especially confusing
on repositories that contain lots of files.

Although the recent implementation of automatic retry makes
this scenario much more unlikely lets provide a fallback as
a last resort.

Thanks to Albert Dvornik for disabling the question if users can't see it.

If the stdout of the command is connected to a terminal but the stderr
has been redirected, the odds are good that the user can't see any
question we print out to stderr.  This will result in a "mysterious
hang" while the app is waiting for user input.

It seems better to be conservative, and avoid asking for input
whenever the stderr is not a terminal, just like we do for stdin.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Albert Dvornik <dvornik+git@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-07 15:45:54 -08:00
..
fnmatch Fix more typos/spelling in comments 2009-04-22 19:03:39 -07:00
nedmalloc Typos in code comments, an error message, documentation 2010-08-22 13:25:08 -07:00
regex Fix compat/regex ANSIfication on MinGW 2010-08-26 09:25:53 -07:00
vcbuild win32: use our own dirent.h 2010-11-23 16:06:50 -08:00
win32 win32: use our own dirent.h 2010-11-23 16:06:50 -08:00
basename.c compat: add a basename() compatibility function 2009-05-31 17:57:59 -07:00
bswap.h Don't redefine htonl and ntohl on big-endian 2010-03-31 14:21:39 -07:00
cygwin.c Fix more typos/spelling in comments 2009-04-22 19:03:39 -07:00
cygwin.h cygwin: Use native Win32 API for stat 2008-09-30 14:30:06 -07:00
fopen.c compat/fopen.c: avoid clobbering the system defined fopen macro 2008-05-08 17:43:01 -07:00
hstrerror.c Add a local implementation of hstrerror for the system which do not have it 2007-06-15 22:48:34 -07:00
inet_ntop.c inet_ntop: fix a couple of old-style decls 2010-11-04 16:53:50 -07:00
inet_pton.c compat: add inet_pton and inet_ntop prototypes 2010-11-04 16:53:49 -07:00
memmem.c optimize compat/ memmem() 2009-03-02 18:28:06 -08:00
mingw.c mingw: make failures to unlink or move raise a question 2011-02-07 15:45:54 -08:00
mingw.h mingw: move unlink wrapper to mingw.c 2011-02-07 15:45:54 -08:00
mkdtemp.c Fix gitmkdtemp: correct test for mktemp() return value 2010-02-25 12:08:22 -08:00
mmap.c War on whitespace 2007-06-07 00:04:01 -07:00
msvc.c win32: use our own dirent.h 2010-11-23 16:06:50 -08:00
msvc.h MSVC: Fix an "incompatible pointer types" compiler warning 2010-01-16 16:43:55 -08:00
pread.c Replacing the system call pread() with lseek()/xread()/lseek() sequence. 2007-01-09 16:40:40 -08:00
qsort.c compat: Add simplified merge sort implementation from glibc 2008-02-06 22:35:28 -08:00
setenv.c simplify inclusion of system header files. 2006-12-20 09:51:35 -08:00
snprintf.c Test for WIN32 instead of __MINGW32_ 2009-09-18 20:00:42 -07:00
strcasestr.c Clean up compatibility definitions. 2005-12-05 15:50:29 -08:00
strlcpy.c simplify inclusion of system header files. 2006-12-20 09:51:35 -08:00
strtok_r.c compat: add strtok_r() 2010-08-14 19:35:38 -07:00
strtoumax.c Add a compat/strtoumax.c for Solaris 8. 2007-02-19 18:20:30 -08:00
unsetenv.c simplify inclusion of system header files. 2006-12-20 09:51:35 -08:00
win32.h Make usage of windows.h lean and mean 2009-09-18 20:00:42 -07:00
win32mmap.c Fix "Out of memory? mmap failed" for files larger than 4GB on Windows 2010-05-20 16:11:06 -07:00
winansi.c Make usage of windows.h lean and mean 2009-09-18 20:00:42 -07:00