summaryrefslogtreecommitdiff
path: root/compat
AgeCommit message (Collapse)Author
2013-08-02Merge branch 'rj/cygwin-clarify-use-of-cheating-lstat'Junio C Hamano
Cygwin port added a "not quite correct but a lot faster and good enough for many lstat() calls that are only used to see if the working tree entity matches the index entry" lstat() emulation some time ago, and it started biting us in places. This removes it and uses the standard lstat() that comes with Cygwin. Recent topic that uses lstat on packed-refs file is broken when this cheating lstat is used, and this is a simplest fix that is also the cleanest direction to go in the long run. * rj/cygwin-clarify-use-of-cheating-lstat: cygwin: Remove the Win32 l/stat() implementation
2013-07-25Merge branch 'ob/typofixes'Junio C Hamano
* ob/typofixes: typofix: in-code comments typofix: documentation typofix: release notes
2013-07-25Merge branch 'rj/sparse'Junio C Hamano
* rj/sparse: Revert "compat/unsetenv.c: Fix a sparse warning"
2013-07-22typofix: in-code commentsOndřej Bílka
Signed-off-by: Ondřej Bílka <neleai@seznam.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-21Revert "compat/unsetenv.c: Fix a sparse warning"Benoit Sigoure
This reverts commit ec535cc27e6c4f5e0b1d157e04f5511f166ecd9d. POSIX explicitly states "the [environ] variable, which must be declared by the user if it is to be used directly". Not declaring it causes compilation to fail on OS X. Instead don't declare the variable on MinGW, as it causes a spurious warning there. Signed-off-by: Benoit Sigoure <tsunanet@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-18cygwin: Remove the Win32 l/stat() implementationRamsay Jones
Commit adbc0b6b ("cygwin: Use native Win32 API for stat", 30-09-2008) added a Win32 specific implementation of the stat functions. In order to handle absolute paths, cygwin mount points and symbolic links, this implementation may fall back on the standard cygwin l/stat() functions. Also, the choice of cygwin or Win32 functions is made lazily (by the first call(s) to l/stat) based on the state of some config variables. Unfortunately, this "schizophrenic stat" implementation has been the source of many problems ever since. For example, see commits 7faee6b8, 79748439, 452993c2, 085479e7, b8a97333, 924aaf3e, 05bab3ea and 0117c2f0. In order to avoid further problems, such as the issue raised by the new reference handling API, remove the Win32 l/stat() implementation. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11Merge branch 'rj/mingw-cygwin'Junio C Hamano
Update build for Cygwin 1.[57]. Torsten Bögershausen reports that this is fine with Cygwin 1.7 ($gmane/225824) so let's try moving it ahead. * rj/mingw-cygwin: cygwin: Remove the CYGWIN_V15_WIN32API build variable mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE
2013-06-10Sync with 1.8.3.1Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-10mingw: make mingw_signal return the correct handlerErik Faye-Lund
Returning the SIGALRM handler for SIGINT is not very useful. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-02Merge branch 'fc/macos-x-clipped-write'Junio C Hamano
Mac OS X does not like to write(2) more than INT_MAX number of bytes. * fc/macos-x-clipped-write: compate/clipped-write.c: large write(2) fails on Mac OS X/XNU
2013-05-17compate/clipped-write.c: large write(2) fails on Mac OS X/XNUFilipe Cabecinhas
Due to a bug in the Darwin kernel, write(2) calls have a maximum size of INT_MAX bytes. Introduce a new compat function, clipped_write(), that only writes at most INT_MAX bytes and returns the number of bytes written, as a substitute for write(2), and allow platforms that need this to enable it from the build mechanism with NEEDS_CLIPPED_WRITE. Set it for Mac OS X by default. It may be necessary to include this function on Windows, too. Signed-off-by: Filipe Cabecinhas <filcab+git@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-08cygwin: Remove the CYGWIN_V15_WIN32API build variableRamsay Jones
Commit 380a4d92 ("Update cygwin.c for new mingw-64 win32 api headers", 11-11-2012) solved an header include order problem on cygwin 1.7 when using the new mingw-64 WIN32 API headers. The solution involved using a new build variable (V15_MINGW_HEADERS) to conditionally compile the cygwin.c source file to use an include order appropriate for the old and new header files. (The build variable was later renamed in commit 9fca6cff to CYGWIN_V15_WIN32API). The include order used for cygwin 1.7 includes the "win32.h" header before "../git-compat-util.h". This order was problematic on cygwin 1.5, since it lead to the WIN32 symbol being defined along with the inclusion of some WIN32 API headers (e.g. <winsock2.h>) which cause compilation errors. The header include order problem on cygwin 1.5 has since been fixed (see commit "mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE"), so we can now remove the conditional compilation along with the associated CYGWIN_V15_WIN32API build variable. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-08mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVEJonathan Nieder
Throughout git, it is assumed that the WIN32 preprocessor symbol is defined on native Windows setups (mingw and msvc) and not on Cygwin. On Cygwin, most of the time git can pretend this is just another Unix machine, and Windows-specific magic is generally counterproductive. Unfortunately Cygwin *does* define the WIN32 symbol in some headers. Best to rely on a new git-specific symbol GIT_WINDOWS_NATIVE instead, defined as follows: #if defined(WIN32) && !defined(__CYGWIN__) # define GIT_WINDOWS_NATIVE #endif After this change, it should be possible to drop the CYGWIN_V15_WIN32API setting without any negative effect. [rj: %s/WINDOWS_NATIVE/GIT_WINDOWS_NATIVE/g ] Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28sparse: Fix mingw_main() argument number/type errorsRamsay Jones
Sparse issues 68 errors (two errors for each main() function) such as the following: SP git.c git.c:510:5: error: too many arguments for function mingw_main git.c:510:5: error: symbol 'mingw_main' redeclared with different type \ (originally declared at git.c:510) - different argument counts The errors are caused by the 'main' macro used by the MinGW build to provide a replacement main() function. The original main function is effectively renamed to 'mingw_main' and is called from the new main function. The replacement main is used to execute certain actions common to all git programs on MinGW (e.g. ensure the standard I/O streams are in binary mode). In order to suppress the errors, we change the macro to include the parameters in the declaration of the mingw_main function. Unfortunately, this change provokes both sparse and gcc to complain about 9 calls to mingw_main(), such as the following: CC git.o git.c: In function 'main': git.c:510: warning: passing argument 2 of 'mingw_main' from \ incompatible pointer type git.c:510: note: expected 'const char **' but argument is of \ type 'char **' In order to suppress these warnings, since both of the main functions need to be declared with the same prototype, we change the declaration of the 9 main functions, thus: int main(int argc, char **argv) Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/mingw.c: Fix some sparse warningsRamsay Jones
Sparse issues the following warnings: SP compat/mingw.c compat/mingw.c:795:3: warning: symbol 'pinfo_t' was not declared. \ Should it be static? compat/mingw.c:796:16: warning: symbol 'pinfo' was not declared. \ Should it be static? compat/mingw.c:797:18: warning: symbol 'pinfo_cs' was not declared. \ Should it be static? compat/mingw.c:1207:23: warning: Using plain integer as NULL pointer In 'pinfo_t' variable, defined on line 795, seems to have been a mistake (a missing typedef keyword?), so we simply remove it. The 'pinfo' variable does not require more than file scope, so we simply add the static modifier to the declaration. The 'pinfo_cs' variable, in contrast, requires initialisation in the mingw replacement main() function, so we add an extern declaration to the compat/mingw.h header file. The remaining warning is suppressed by replacing the rhs of the pointer assignment with the NULL pointer literal. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/win32mmap.c: Fix some sparse warningsRamsay Jones
Sparse issues two 'Using plain integer as NULL pointer' warnings against the call to the CreateFileMapping() function. The warnings relate to the second and sixth parameters, which both have pointer type. In order to suppress the warnings, we simply pass the NULL pointer, rather than '0', to those parameters in the function call. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/poll/poll.c: Fix a sparse warningRamsay Jones
Sparse issues an 'Using plain integer as NULL pointer' warning when passing the constant '0' as the second parameter in the call to the WSAEventSelect() function. The function parameter has a pointer type (WSAEVENT, aka HANDLE, aka void *) so that, in order to suppress the warning, we simply pass NULL for that parameter in the function call expression. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/win32/pthread.c: Fix a sparse warningRamsay Jones
Sparse issues a 'Using plain integer as NULL pointer' warning when initializing an pthread_t structure with an '{ 0 }' initializer. The first field of the pthread_t structure has type HANDLE (void *), so in order to suppress the warning, we replace the initializer expression with '{ NULL }'. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/unsetenv.c: Fix a sparse warningRamsay Jones
The gitunsetenv function includes an (redundant) declaration of the 'environ' symbol, which is a pointer to the table of environment variables. Unfortunately, on MinGW, this provokes sparse to issue the following warning: compat/unsetenv.c:5:20: warning: non-ANSI function declaration of \ function '__p__environ' On MinGW, the <stdlib.h> header defines the 'environ' symbol as a preprocessor macro (via _environ) which obtains the environ table pointer via a call to the __p__environ() function. In order to suppress the warning, we simply remove the redundant declaration of the 'environ' symbol, since the symbol is already declared correctly in <stdlib.h> (included via git-compat-util.h). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/nedmalloc: Fix compiler warnings on linuxRamsay Jones
On linux, when the build variable USE_NED_ALLOCATOR is set, gcc issues the following warnings: In file included from compat/nedmalloc/nedmalloc.c:63: .../malloc.c.h: In function 'mmap_resize': .../malloc.c.h:3762: warning: implicit declaration of function 'mremap' .../malloc.c.h: In function 'sys_trim': .../malloc.c.h:4195: warning: comparison between pointer and integer The warnings are caused by the <sys/mman.h> header not enabling the (conditional) declaration of the mremap() function. The declaration can be enabled by defining the _GNU_SOURCE symbol prior to including certain system header files. In particular, it may not be sufficient to simply define _GNU_SOURCE just prior to including the <sys/mman.h> header. (e.g. defining the symbol after including <sys/types.h> will be completely ineffective.) In order to suppress the warnings, we define the _GNU_SOURCE symbol at the start of the malloc.c.h header file. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/nedmalloc: Fix some sparse warningsRamsay Jones
Sparse issues many "Using plain integer as NULL pointer" warnings while checking nedmalloc.c (at least 98 such warnings before giving up due to "too many warnings"). In addition, sparse issues some "non-ANSI function declaration" type warnings for the symbols 'win32_getcurrentthreadid', 'malloc_stats' and 'malloc_footprint'. In order to suppress the NULL pointer warnings, rather than replace all uses of '0' as a null pointer representation with NULL, we add -Wno-non-pointer-null to SPARSE_FLAGS while checking nedmalloc.c. In order to suppress the "non-ANSI function declaration" warnings, we simply include the missing 'empty parameter list' prototype (void) in the function declarations. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/fnmatch/fnmatch.c: Fix a sparse errorRamsay Jones
Sparse issues the following error and warnings: SP compat/fnmatch/fnmatch.c .../fnmatch.c:144:17: warning: Using plain integer as NULL pointer .../fnmatch.c:238:67: warning: Using plain integer as NULL pointer .../fnmatch.c:303:40: error: too many arguments for function getenv The error is caused by the extern declaration for the getenv function not including the function prototype. Without the prototype, sparse effectively sees the declaration as 'char *getenv(void)'. In order to suppress the error, we simply include the function prototype. In order to suppress the warnings, we include the <stddef.h> header which provides an appropriate definition of the NULL macro, rather than using the (inappropriate) default definition at fnmatch.c:132. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/regex/regexec.c: Fix some sparse warningsRamsay Jones
Sparse issues an "Using plain integer as NULL pointer" warning along with two "symbol was not declared. Should it be static?" type warnings for the 'merge_state_with_log' and 'find_recover_state' functions. In order to suppress the warnings, we replace the use of '0' as a null pointer constant with NULL and add the static modifier to the function definitions. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-18utf8.c: add reencode_string_len() that can handle NULs in stringNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12Sync with 'maint'Junio C Hamano
* maint: Correct common spelling mistakes in comments and tests kwset: fix spelling in comments precompose-utf8: fix spelling of "want" in error message compat/nedmalloc: fix spelling in comments compat/regex: fix spelling and grammar in comments obstack: fix spelling of similar contrib/subtree: fix spelling of accidentally git-remote-mediawiki: spelling fixes doc: various spelling fixes fast-export: fix argument name in error messages Documentation: distinguish between ref and offset deltas in pack-format i18n: make the translation of -u advice in one go
2013-04-12precompose-utf8: fix spelling of "want" in error messageStefano Lattarini
Noticed using Lucas De Marchi's codespell tool. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12compat/nedmalloc: fix spelling in commentsStefano Lattarini
Correct some typos found using Lucas De Marchi's codespell tool. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12compat/regex: fix spelling and grammar in commentsStefano Lattarini
Some of these were found using Lucas De Marchi's codespell tool. Others noticed by Eric Sunshine. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12obstack: fix spelling of similarStefano Lattarini
Noticed using Lucas De Marchi's codespell tool. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-25Make core.sharedRepository work under cygwin 1.7Torsten Bögershausen
When core.sharedRepository is used, set_shared_perm() in path.c needs lstat() to return the correct POSIX permissions. The default for cygwin is core.ignoreCygwinFSTricks = false, which means that the fast implementation in do_stat() is used instead of lstat(). lstat() under cygwin uses the Windows security model to implement POSIX-like permissions. The user, group or everyone bits can be set individually. do_stat() simplifes the file permission bits, and may return a wrong value. The read-only attribute of a file is used to calculate the permissions, resulting in either rw-r--r-- or r--r--r-- One effect of the simplified do_stat() is that t1301 fails. Add a function cygwin_get_st_mode_bits() which returns the POSIX permissions. When not compiling for cygwin, true_mode_bits() in path.c is used. Side note: t1301 passes under cygwin 1.5. The "user write" bit is synchronized with the "read only" attribute of a file: $ chmod 444 x $ attrib x A R C:\temp\pt\x cygwin 1.7 would show A C:\temp\pt\x Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-19Merge branch 'rj/msvc-build'Junio C Hamano
* rj/msvc-build: msvc: avoid collisions between "tags" and "TAGS" msvc: test-svn-fe: Fix linker "unresolved external" error msvc: Fix build by adding missing symbol defines msvc: git-daemon: Fix linker "unresolved external" errors msvc: Fix compilation errors caused by poll.h emulation
2013-02-26Revert "compat: add strtok_r()"Erik Faye-Lund
This reverts commit 78457bc0ccc1af8b9eb776a0b17986ebd50442bc. commit 28c5d9e ("vcs-svn: drop string_pool") previously removed the only call-site for strtok_r. So let's get rid of the compat implementation as well. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-25msvc: test-svn-fe: Fix linker "unresolved external" errorRamsay Jones
In particular, while linking test-svn-fe.exe, the linker complains that the external symbol _strtoull is unresolved. A call to this function was added in commit ddcc8c5b ("vcs-svn: skeleton of an svn delta parser", 25-12-2010). The NO_STRTOULL build variable attempts to provide support to old systems which can't even declare 'unsigned long long' variables, let alone provide the strtoll() or strtoull() functions. Setting this build variable does not provide an implementation of these functions. Rather, it simply allows the compat implementations of strto{i,u}max() to use strtol() and strtoul() instead. In order to fix the linker error on systems with NO_STRTOULL set, currently MSVC and OSF1, we can substitute a call to strtoumax(). However, we can easily provide support for the strtoull() and strtoll() functions on MSVC, since they are essentially already available as _strtoui64() and _strtoi64(). This allows us to remove NO_STRTOULL for MSVC. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Tested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-25msvc: Fix build by adding missing symbol definesRamsay Jones
In particular, remote-testsvn.c fails to compile with two undeclared identifier errors relating to the 'UINT32_MAX' and 'STDIN_FILENO' symbols. In order to fix the compilation errors, we add appropriate definitions for the UINT32_MAX and STDIN_FILENO constants to an msvc compat header file. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Tested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-25msvc: Fix compilation errors caused by poll.h emulationRamsay Jones
Commit 0f77dea9 ("mingw: move poll out of sys-folder", 24-10-2011), along with other commits in the 'ef/mingw-upload-archive' branch (see commit 7406aa20), effectively reintroduced the same problem addressed by commit 56fb3ddc ("msvc: Fix compilation errors in compat/win32/sys/poll.c", 04-12-2010). In order to fix the compilation errors, we use the same solution adopted in that earlier commit. In particular, we set _WIN32_WINNT to 0x0502 (which would target Windows Server 2003) prior to including the winsock2.h header file. Also, we delete the compat/vcbuild/include/sys/poll.h header file, since it is now redundant and it's presence may cause some confusion. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Tested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-10Merge branch 'nd/wildmatch'Junio C Hamano
Allows pathname patterns in .gitignore and .gitattributes files with double-asterisks "foo/**/bar" to match any number of directory hierarchies. * nd/wildmatch: wildmatch: replace variable 'special' with better named ones compat/fnmatch: respect NO_FNMATCH* even on glibc wildmatch: fix "**" special case t3070: Disable some failing fnmatch tests test-wildmatch: avoid Windows path mangling Support "**" wildcard in .gitignore and .gitattributes wildmatch: make /**/ match zero or more directories wildmatch: adjust "**" behavior wildmatch: fix case-insensitive matching wildmatch: remove static variable force_lower_case wildmatch: make wildmatch's return value compatible with fnmatch t3070: disable unreliable fnmatch tests Integrate wildmatch to git wildmatch: follow Git's coding convention wildmatch: remove unnecessary functions Import wildmatch from rsync ctype: support iscntrl, ispunct, isxdigit and isprint ctype: make sane_ctype[] const array Conflicts: Makefile
2013-01-03Merge branch 'ss/nedmalloc-compilation'Junio C Hamano
* ss/nedmalloc-compilation: nedmalloc: Fix a compile warning (exposed as error) with GCC 4.7.2
2013-01-03Merge branch 'jc/maint-fnmatch-old-style-definition'Junio C Hamano
Update old-style function definition "int foo(bar) int bar; {}" to "int foo(int bar) {}". * jc/maint-fnmatch-old-style-definition: compat/fnmatch: update old-style definition to ANSI
2013-01-01compat/fnmatch: respect NO_FNMATCH* even on glibcNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-19compat/fnmatch: update old-style definition to ANSIJunio C Hamano
We try to avoid touching borrowed code, but we encourage people to write without old-style definition and compile with -Werror these days, and on platforms that need to use NO_FNMATCH, these three functions make the compilation fail. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-12nedmalloc: Fix a compile warning (exposed as error) with GCC 4.7.2Sebastian Schuberth
On MinGW, GCC 4.7.2 complains about operation on 'p->m[end]' may be undefined Fix this by replacing the faulty lines with those of 69825ca from https://github.com/ned14/nedmalloc/blob/master/nedmalloc.c Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-11Merge branch 'ef/mingw-rmdir'Junio C Hamano
MinGW has a workaround when rmdir unnecessarily fails to retry with a prompt, but the logic was kicking in when the rmdir failed with ENOTEMPTY, i.e. was expected to fail and there is no point retrying. * ef/mingw-rmdir: mingw_rmdir: do not prompt for retry when non-empty
2012-12-10mingw_rmdir: do not prompt for retry when non-emptyErik Faye-Lund
in ab1a11be ("mingw_rmdir: set errno=ENOTEMPTY when appropriate"), a check was added to prevent us from retrying to delete a directory that is both in use and non-empty. However, this logic was slightly flawed; since we didn't return immediately, we end up falling out of the retry-loop, but right into the prompting-loop. Fix this by setting errno, and guarding the prompting-loop with an errno-check. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-04mingw: get rid of getpass implementationErik Faye-Lund
There's no remaining call-sites, and as pointed out in the previous commit message, it's not quite ideal. So let's just lose it. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-04mingw: reuse tty-version of git_terminal_promptErik Faye-Lund
The getpass-implementation we use on Windows isn't at all ideal; it works in raw-mode (as opposed to cooked mode), and as a result does not deal correcly with deletion, arrow-keys etc. Instead, use cooked mode to read a line at the time, allowing the C run-time to process the input properly. Since we set files to be opened in binary-mode by default on Windows, introduce a FORCE_TEXT macro that expands to the "t" modifier that forces the terminal to be opened in text-mode so we do not have to deal with CRLF issues. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-04compat/terminal: separate input and output handlesErik Faye-Lund
On Windows, the terminal cannot be opened in read-write mode, so we need distinct pairs for reading and writing. Since this works fine on other platforms as well, always open them in pairs. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-04compat/terminal: factor out echo-disablingErik Faye-Lund
By moving the echo-disabling code to a separate function, we can implement OS-specific versions of it for non-POSIX platforms. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-04mingw: make fgetc raise SIGINT if apropriateErik Faye-Lund
Set a control-handler to prevent the process from terminating, and simulate SIGINT so it can be handled by a signal-handler as usual. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-04mingw: correct exit-code for SIGALRM's SIG_DFLErik Faye-Lund
Make sure SIG_DFL for SIGALRM exits with 128 + SIGALRM so other processes can diagnose why it exits. While we're at it, make sure we only write to stderr if it's a terminal, and change the output to match that of Linux. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-27Merge branch 'nd/maint-compat-fnmatch-fix' into maintJunio C Hamano
* nd/maint-compat-fnmatch-fix: compat/fnmatch: fix off-by-one character class's length check