summaryrefslogtreecommitdiff
path: root/compat
AgeCommit message (Collapse)AuthorFilesLines
2013-02-26Revert "compat: add strtok_r()"Libravatar Erik Faye-Lund1-61/+0
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-01-10Merge branch 'nd/wildmatch'Libravatar Junio C Hamano1-1/+2
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'Libravatar Junio C Hamano1-1/+4
* 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'Libravatar Junio C Hamano1-12/+12
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 glibcLibravatar Nguyễn Thái Ngọc Duy1-1/+2
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 ANSILibravatar Junio C Hamano1-12/+12
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-11nedmalloc: Fix a compile warning (exposed as error) with GCC 4.7.2Libravatar Sebastian Schuberth1-1/+4
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'Libravatar Junio C Hamano1-1/+3
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-emptyLibravatar Erik Faye-Lund1-1/+3
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 implementationLibravatar Erik Faye-Lund2-17/+0
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_promptLibravatar Erik Faye-Lund1-9/+60
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 handlesLibravatar Erik Faye-Lund1-11/+18
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-disablingLibravatar Erik Faye-Lund1-18/+25
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 apropriateLibravatar Erik Faye-Lund2-10/+72
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_DFLLibravatar Erik Faye-Lund1-2/+5
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 maintLibravatar Junio C Hamano1-1/+1
* nd/maint-compat-fnmatch-fix: compat/fnmatch: fix off-by-one character class's length check
2012-11-25Merge branch 'nd/maint-compat-fnmatch-fix'Libravatar Junio C Hamano1-1/+1
* nd/maint-compat-fnmatch-fix: compat/fnmatch: fix off-by-one character class's length check
2012-11-20compat/fnmatch: fix off-by-one character class's length checkLibravatar Nguyễn Thái Ngọc Duy1-1/+1
Character class "xdigit" is the only one that hits 6 character limit defined by CHAR_CLASS_MAX_LENGTH. All other character classes are 5 character long and therefore never caught by this. This should make xdigit tests in t3070 pass on Windows. Reported-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-18USE CGYWIN_V15_WIN32API as macro to select api for cygwinLibravatar Mark Levedahl1-1/+1
The previous macro was confusing to some, and did not include "cygwin" in its name. The updated name more clearly expresses a choice of the win32api implementation that shipped with version 1.5 of cygwin. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-12Update cygwin.c for new mingw-64 win32 api headersLibravatar Mark Levedahl1-0/+7
The cygwin project recently switched to a new implementation of the windows api, now using header files from the mingw-64 project. These new header files are incompatible with the way cygwin.c included the old headers: cygwin.c can be compiled using the new or the older (mingw) headers, but different files must be included in different order for each to work. The new headers are in use only for the current release series (based upon the v1.7.x dll version). The previous release series using the v1.5 dll is kept available but unmaintained for use on older versions of Windows. So, patch cygwin.c to use the new include ordering only if the dll version is 1.7 or higher. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
2012-10-25Merge branch 'js/mingw-fflush-errno'Libravatar Jeff King2-0/+25
* js/mingw-fflush-errno: maybe_flush_or_die: move a too-loose Windows specific error
2012-10-17maybe_flush_or_die: move a too-loose Windows specific errorLibravatar Johannes Sixt2-0/+25
check to compat Commit b2f5e268 (Windows: Work around an oddity when a pipe with no reader is written to) introduced a check for EINVAL after fflush() to fight spurious "Invalid argument" errors on Windows when a pipe was broken. But this check may hide real errors on systems that do not have the this odd behavior. Introduce an fflush wrapper in compat/mingw.* so that the treatment is only applied on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17make poll() work on platforms that can't recv() on a non-socketLibravatar Joachim Schmitz1-0/+4
This way it just got added to gnulib too the other day. Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17poll() exits too early with EFAULT if 1st arg is NULLLibravatar Joachim Schmitz1-1/+1
If poll() is used as a milli-second sleep, like in help.c, by passing a NULL in the 1st and a 0 in the 2nd arg, it exits with EFAULT. As per Paolo Bonzini, the original author, this is a bug and to be fixed Like in this commit, which is not to exit if the 2nd arg is 0. It got fixed In gnulib in the same manner the other day. Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17fix some win32 specific dependencies in poll.cLibravatar Joachim Schmitz1-2/+6
In order for non-win32 platforms to be able to use poll.c, #ifdef the inclusion of two header files properly Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17make poll available for other platforms lacking itLibravatar Joachim Schmitz2-0/+0
move poll.[ch] out of compat/win32/ into compat/poll/ and adjust Makefile with the changed paths. Adding comments to Makefile about how/when to enable it and add logic for this Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-11Merge branch 'rr/precompose-utf8-cleanup' into maintLibravatar Junio C Hamano1-25/+19
* rr/precompose-utf8-cleanup: precompose-utf8: do not call checks for non-ascii "utf8" cleanup precompose_utf8
2012-09-03Merge branch 'js/compat-mkdir'Libravatar Junio C Hamano1-0/+24
Some mkdir(2) implementations do not want to see trailing slash in its parameter. * js/compat-mkdir: compat: some mkdir() do not like a slash at the end
2012-08-29Merge branch 'rr/precompose-utf8-cleanup'Libravatar Junio C Hamano1-25/+19
* rr/precompose-utf8-cleanup: precompose-utf8: do not call checks for non-ascii "utf8" cleanup precompose_utf8
2012-08-24Merge branch 'bw/maint-1.7.9-solaris-getpass' into maint-1.7.11Libravatar Junio C Hamano1-0/+1
* bw/maint-1.7.9-solaris-getpass: Enable HAVE_DEV_TTY for Solaris terminal: seek when switching between reading and writing
2012-08-24compat: some mkdir() do not like a slash at the endLibravatar Joachim Schmitz1-0/+24
Introduce a compatibility helper for platforms with such a mkdir(). Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-20precompose-utf8: do not call checks for non-ascii "utf8"Libravatar Junio C Hamano1-8/+8
As suggested by Linus, this function is not checking UTF-8-ness of the string; it only is seeing if it is pure US-ASCII. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-17cleanup precompose_utf8Libravatar Robin Rosenberg1-20/+14
- Remove extraneous parentheses and braces; - Remove redundant NUL-termination before strcpy(); - Check result of unlink when probing for decomposed file names; - Adjust for the coding style by adding missing whitespaces; - Move storage class "static" at the beginning of the decl. Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-08Merge branch 'bw/maint-1.7.9-solaris-getpass'Libravatar Junio C Hamano1-0/+1
The recent update to terminal I/O interface to get passwords &c interactively didn't quite work on Solaris. * bw/maint-1.7.9-solaris-getpass: Enable HAVE_DEV_TTY for Solaris terminal: seek when switching between reading and writing
2012-08-06terminal: seek when switching between reading and writingLibravatar Jeff King1-0/+1
When a stdio stream is opened in update mode (e.g., "w+"), the C standard forbids switching between reading or writing without an intervening positioning function. Many implementations are lenient about this, but Solaris libc will flush the recently-read contents to the output buffer. In this instance, that meant writing the non-echoed password that the user just typed to the terminal. Fix it by inserting a no-op fseek between the read and write. The opposite direction (writing followed by reading) is also disallowed, but our intervening fflush is an acceptable positioning function for that alternative. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-13Merge branch 'tb/sanitize-decomposed-utf-8-pathname'Libravatar Junio C Hamano2-0/+235
Teaches git to normalize pathnames read from readdir(3) and all arguments from the command line into precomposed UTF-8 (assuming that they come as decomposed UTF-8) to work around issues on Mac OS. I think there still are other places that need conversion (e.g. paths that are read from stdin for some commands), but this should be a good first step in the right direction. * tb/sanitize-decomposed-utf-8-pathname: git on Mac OS and precomposed unicode
2012-07-08git on Mac OS and precomposed unicodeLibravatar Torsten Bögershausen2-0/+235
Mac OS X mangles file names containing unicode on file systems HFS+, VFAT or SAMBA. When a file using unicode code points outside ASCII is created on a HFS+ drive, the file name is converted into decomposed unicode and written to disk. No conversion is done if the file name is already decomposed unicode. Calling open("\xc3\x84", ...) with a precomposed "Ä" yields the same result as open("\x41\xcc\x88",...) with a decomposed "Ä". As a consequence, readdir() returns the file names in decomposed unicode, even if the user expects precomposed unicode. Unlike on HFS+, Mac OS X stores files on a VFAT drive (e.g. an USB drive) in precomposed unicode, but readdir() still returns file names in decomposed unicode. When a git repository is stored on a network share using SAMBA, file names are send over the wire and written to disk on the remote system in precomposed unicode, but Mac OS X readdir() returns decomposed unicode to be compatible with its behaviour on HFS+ and VFAT. The unicode decomposition causes many problems: - The names "git add" and other commands get from the end user may often be precomposed form (the decomposed form is not easily input from the keyboard), but when the commands read from the filesystem to see what it is going to update the index with already is on the filesystem, readdir() will give decomposed form, which is different. - Similarly "git log", "git mv" and all other commands that need to compare pathnames found on the command line (often but not always precomposed form; a command line input resulting from globbing may be in decomposed) with pathnames found in the tree objects (should be precomposed form to be compatible with other systems and for consistency in general). - The same for names stored in the index, which should be precomposed, that may need to be compared with the names read from readdir(). NFS mounted from Linux is fully transparent and does not suffer from the above. As Mac OS X treats precomposed and decomposed file names as equal, we can - wrap readdir() on Mac OS X to return the precomposed form, and - normalize decomposed form given from the command line also to the precomposed form, to ensure that all pathnames used in Git are always in the precomposed form. This behaviour can be requested by setting "core.precomposedunicode" configuration variable to true. The code in compat/precomposed_utf8.c implements basically 4 new functions: precomposed_utf8_opendir(), precomposed_utf8_readdir(), precomposed_utf8_closedir() and precompose_argv(). The first three are to wrap opendir(3), readdir(3), and closedir(3) functions. The argv[] conversion allows to use the TAB filename completion done by the shell on command line. It tolerates other tools which use readdir() to feed decomposed file names into git. When creating a new git repository with "git init" or "git clone", "core.precomposedunicode" will be set "false". The user needs to activate this feature manually. She typically sets core.precomposedunicode to "true" on HFS and VFAT, or file systems mounted via SAMBA. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-22Documentation: Fix misspellingsLibravatar Leila Muhtasib1-1/+1
Signed-off-by: Leila Muhtasib <muhtasib@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-14Merge branch 'nd/threaded-index-pack'Libravatar Junio C Hamano1-0/+5
Enables threading in index-pack to resolve base data in parallel. By Nguyễn Thái Ngọc Duy (3) and Ramsay Jones (1) * nd/threaded-index-pack: index-pack: disable threading if NO_PREAD is defined index-pack: support multithreaded delta resolving index-pack: restructure pack processing into three main functions compat/win32/pthread.h: Add an pthread_key_delete() implementation
2012-04-30remove superfluous newlines in error messagesLibravatar Pete Wyckoff1-1/+1
The error handling routines add a newline. Remove the duplicate ones in error messages. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-23Merge branch 'rj/mingw-isguid'Libravatar Junio C Hamano1-3/+4
By Ramsay Jones * rj/mingw-isguid: compat/mingw.h: Set S_ISUID to prevent a fast-import test failure
2012-04-20Merge branch 'jk/run-command-eacces'Libravatar Junio C Hamano2-4/+6
When PATH contains an unreadable directory, alias expansion code did not kick in, and failed with an error that said "git-subcmd" was not found. By Jeff King (1) and Ramsay Jones (1) * jk/run-command-eacces: run-command: treat inaccessible directories as ENOENT compat/mingw.[ch]: Change return type of exec functions to int
2012-04-18compat/mingw.h: Set S_ISUID to prevent a fast-import test failureLibravatar Ramsay Jones1-3/+4
The current t9300-fast-import.sh test number 62 ("L: nested tree copy does not corrupt deltas") was introduced in commit 9a0edb79 ("fast-import: add a test for tree delta base corruption", 15-08-2011). A fix for the demonstrated problem was introduced by commit 8fb3ad76 ("fast-import: prevent producing bad delta", 15-08-2011). However, this fix didn't work on MinGW and so this test has always failed on MinGW. Part of the solution in commit 8fb3ad76 was to add an NO_DELTA preprocessor constant which was defined as follows: +/* + * We abuse the setuid bit on directories to mean "do not delta". + */ +#define NO_DELTA S_ISUID + Unfortunately, the S_ISUID constant on MinGW is defined as zero. In order to fix the problem, we simply alter the definition of S_ISUID in the mingw header file to a more appropriate value. Also, we take the opportunity to similarly define S_ISGID and S_ISVTX. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11compat/win32/pthread.h: Add an pthread_key_delete() implementationLibravatar Ramsay Jones1-0/+5
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-05compat/mingw.[ch]: Change return type of exec functions to intLibravatar Ramsay Jones2-4/+6
The POSIX standard specifies a return type of int for all six exec functions. In addition, all exec functions return -1 on error, and simply do not return on success. However, the current emulation of the exec functions on mingw are declared with a void return type. This would cause a problem should any code attempt to call the exec function in a non-void context. In particular, if an exec function were used in a conditional it would fail to compile. In order to improve the fidelity of the emulation, we change the return type of the mingw_execv[p] functions to int and return -1 on error. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-12Merge branch 'bw/inet-pton-ntop-compat'Libravatar Junio C Hamano2-12/+0
* bw/inet-pton-ntop-compat: Drop system includes from inet_pton/inet_ntop compatibility wrappers
2012-02-05Drop system includes from inet_pton/inet_ntop compatibility wrappersLibravatar Ben Walton2-12/+0
As both of these compatibility wrappers include git-compat-utils.h, all of the system includes were redundant. Dropping these system includes also makes git-compat-utils.h the first include which avoids a compiler warning on Solaris due to the redefinition of _FILE_OFFSET_BITS. Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-22Merge branch 'ef/setenv-putenv'Libravatar Junio C Hamano1-2/+8
* ef/setenv-putenv: compat/setenv.c: error if name contains '=' compat/setenv.c: update errno when erroring out
2011-12-22Merge branch 'jk/git-prompt'Libravatar Junio C Hamano2-0/+87
* jk/git-prompt: contrib: add credential helper for OS X Keychain Makefile: OS X has /dev/tty Makefile: linux has /dev/tty credential: use git_prompt instead of git_getpass prompt: use git_terminal_prompt add generic terminal prompt function refactor git_getpass into generic prompt function move git_getpass to its own source file imap-send: don't check return value of git_getpass imap-send: avoid buffer overflow Conflicts: Makefile
2011-12-19Merge branch 'jk/maint-snprintf-va-copy'Libravatar Junio C Hamano1-2/+7
* jk/maint-snprintf-va-copy: compat/snprintf: don't look at va_list twice