summaryrefslogtreecommitdiff
path: root/compat
AgeCommit message (Collapse)Author
2010-08-31Merge branch 'jn/svn-fe'Junio C Hamano
* jn/svn-fe: t/t9010-svn-fe.sh: add an +x bit to this test t9010 (svn-fe): avoid symlinks in test t9010 (svn-fe): use Unix-style path in URI vcs-svn: Avoid %z in format string vcs-svn: Rename dirent pool to build on Windows compat: add strtok_r() treap: style fix vcs-svn: remove build artifacts on "make clean" svn-fe manual: Clarify warning about deltas in dump files Update svn-fe manual SVN dump parser Infrastructure to write revisions in fast-export format Add stream helper library Add string-specific memory pool Add treap implementation Add memory pool library Introduce vcs-svn lib
2010-08-31Merge branch 'sg/rerere-gc-old-still-used'Junio C Hamano
* sg/rerere-gc-old-still-used: rerere: fix overeager gc mingw_utime(): handle NULL times parameter
2010-08-26Fix compat/regex ANSIfication on MinGWJohannes Sixt
compat/regexec.c had a weird combination of function declaration in ANSI style and function definition in K&R style, for example: static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, int nregs, int regs_allocated) internal_function; static unsigned re_copy_regs (regs, pmatch, nregs, regs_allocated) struct re_registers *regs; regmatch_t *pmatch; int nregs, regs_allocated; { ... } with this #define: #ifndef _LIBC # ifdef __i386__ # define internal_function __attribute ((regparm (3), stdcall)) # else # define internal_function # endif #endif The original version as shown above was fine, but with the ANSIfied function definition and in the case where internal_function is not empty, gcc identifies the declaration and definition as different and bails out. Adding internal_function to the definition doesn't help (it results in a syntax error); hence, remove it from the subset of declarations that gcc flags as erroneous. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-22Typos in code comments, an error message, documentationRalf Wildenhues
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-19compat/regex: get rid of old-style definitionJunio C Hamano
These files mostly used ANSI style function definitions, but with small number of old-style ones. Convert them to consistently use ANSI style. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-19compat/regex: define out variables only used under RE_ENABLE_I18NÆvar Arnfjörð Bjarmason
Wrap variables that were only used RE_ENABLE_I18N in `#ifdef RE_ENABLE_I18N`. This eliminates compiler warnings when compiling with NO_REGEX=YesPlease. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18Change regerror() declaration from K&R style to ANSI C (C89)Frank Li
The MSVC headers typedef errcode as int, and thus confused the compiler in the K&R style definition. ANSI style deconfuses it. This patch was originally applied as v1.6.5-rc2~23 but needs to be re-applied since compat/regex was overwritten by Ævar Arnfjörð Bjarmason with the gawk regex engine. Signed-off-by: Frank Li <lznuaa@gmail.com> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18compat/regex: get the gawk regex engine to compile within gitÆvar Arnfjörð Bjarmason
We need to define -DGAWK -DNO_MBSUPPORT so that the gawk regex engine will compile, and include stdio.h and stddef.h in regex.h. Gawk itself includes these headers before it includes the regex.h header. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18compat/regex: use the regex engine from gawk for compatÆvar Arnfjörð Bjarmason
Change the regex engine in compat to use the gawk engine from the gawk-devel module in gawk CVS. This engine supports the REG_STARTEND flag, which was optionally available in Git since v1.7.2-rc0~77^2~1. The source was grabbed from cvs.savannah.gnu.org:/sources/gawk, and these are the upstream versions of the files being included: regcomp.c 1.4 regex.h 1.3 regex.h 1.3 regex_internal.c 1.3 regex_internal.h 1.3 regexec.c 1.3 Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-15compat: add strtok_r()Jonathan Nieder
Windows does not have strtok_r (and while it does have an identical strtok_s, but it is not obvious how to use it). Grab an implementation from glibc. The svn-fe tool uses strtok_r to parse paths. Acked-by: Johannes Sixt <j6t@kdbg.org> Helped-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-13mingw_utime(): handle NULL times parameterSZEDER Gábor
POSIX sayeth: "If times is a null pointer, the access and modification times of the file shall be set to the current time." Let's do so. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-21Merge branch 'js/async-thread'Junio C Hamano
* js/async-thread: fast-import: die_nicely() back to vsnprintf (reverts part of ebaa79f) Enable threaded async procedures whenever pthreads is available Dying in an async procedure should only exit the thread, not the process. Reimplement async procedures using pthreads Windows: more pthreads functions Fix signature of fcntl() compatibility dummy Make report() from usage.c public as vreportf() and use it. Modernize t5530-upload-pack-error. Conflicts: http-backend.c
2010-06-16Merge branch 'np/malloc-threading' into maintJunio C Hamano
* np/malloc-threading: Thread-safe xmalloc and xrealloc needs a recursive mutex Make xmalloc and xrealloc thread-safe
2010-06-13Merge branch 'js/maint-windows'Junio C Hamano
* js/maint-windows: Recent MinGW has a C99 implementation of snprintf functions mingw: use _commit to implement fsync
2010-05-21Merge branch 'np/malloc-threading'Junio C Hamano
* np/malloc-threading: Thread-safe xmalloc and xrealloc needs a recursive mutex Make xmalloc and xrealloc thread-safe
2010-05-20mingw: use _commit to implement fsyncErik Faye-Lund
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>
2010-05-20Fix checkout of large files to network shares on Windows XPRené Scharfe
Bigger writes to network drives on Windows XP fail. Cap them at 31MB to allow them to succeed. Callers need to be prepared for write() calls that do less work than requested anyway. On local drives, write() calls are translated to WriteFile() calls with a cap of 64KB on Windows XP and 256KB on Vista. Thus a cap of 31MB won't affect the number of WriteFile() calls which do the actual work. There's still room for some other version of Windows to use a chunk size of 1MB without increasing the number of system calls. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-20Fix "Out of memory? mmap failed" for files larger than 4GB on WindowsIan McLean
The git_mmap implementation was broken for file sizes that wouldn't fit into a size_t (32 bits). This was caused by intermediate variables that were only 32 bits wide when they should be 64 bits. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-20Merge branch 'maint'Junio C Hamano
* maint: t7012: Mark missing tests as TODO reflog: remove 'show' from 'expire's usage string MSVC: Fix build by adding missing termios.h dummy
2010-04-19Merge branch 'maint-1.6.6' into maintJunio C Hamano
* maint-1.6.6: MSVC: Fix build by adding missing termios.h dummy
2010-04-19MSVC: Fix build by adding missing termios.h dummyJohannes Sixt
A use of this header file was introduced in eb80042 (Add missing #include to support TIOCGWINSZ on Solaris, 2010-01-11). Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-11Merge branch 'jl/maint-submodule-gitfile-awareness'Junio C Hamano
* jl/maint-submodule-gitfile-awareness: Windows: start_command: Support non-NULL dir in struct child_process
2010-04-11Windows: start_command: Support non-NULL dir in struct child_processJohannes Sixt
A caller of start_command can set the member 'dir' to a directory to request that the child process starts with that directory as CWD. The first user of this feature was added recently in eee49b6 (Teach diff --submodule and status to handle .git files in submodules). On Windows, we have been lazy and had not implemented support for this feature, yet. This fixes the shortcoming. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-09Thread-safe xmalloc and xrealloc needs a recursive mutexJohannes Sixt
The mutex used to protect object access (read_mutex) may need to be acquired recursively. Introduce init_recursive_mutex() helper function in thread-utils.c that constructs a mutex with the PHREAD_MUTEX_RECURSIVE attribute. pthread_mutex_init() emulation on Win32 is already recursive as it is implemented on top of the CRITICAL_SECTION type, which is recursive. http://msdn.microsoft.com/en-us/library/ms682530%28VS.85%29.aspx Add do-nothing compatibility wrappers for pthread_mutexattr* functions. Initial-version-by: Fredrik Kuivinen <frekui@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-31Sync with 1.7.0.4Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-31Don't redefine htonl and ntohl on big-endianHolger Weiß
Since commit 0fcabdeb52b79775173d009ccc179db104dfbb66, compat/bswap.h redefined htonl and ntohl to bswap32 not only if bswap32 has been defined earlier in compat/bswap.h (which is done only on selected platforms), but also if bswap32 has been defined anywhere else. This broke Git at least for NetBSD systems running on big-endian machines (where ntohl and htonl should, of course, be NOOPs), since NetBSD defines a bswap32 macro in the system headers. So, we now undefine any previously defined bswap32 in compat/bswap.h before defining our own. Signed-off-by: Holger Weiß <holger@zedat.fu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-30Windows: fix utime() for read-only filesJohannes Sixt
Starting with 5256b00 (Use git_mkstemp_mode instead of plain mkstemp to create object files, 2010-02-22) utime() is invoked on read-only files. This is not allowed on Windows and results in many warnings of the form failed utime() on .git/objects/23/tmp_obj_VlgHlc: Permission denied during a repack. Fix it by making the file temporarily writable. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-08Merge branch 'fn/maint-mkdtemp-compat' into maintJunio C Hamano
* fn/maint-mkdtemp-compat: Fix gitmkdtemp: correct test for mktemp() return value
2010-03-08Merge branch 'mm/mkstemps-mode-for-packfiles' into maintJunio C Hamano
* mm/mkstemps-mode-for-packfiles: Use git_mkstemp_mode instead of plain mkstemp to create object files git_mkstemps_mode: don't set errno to EINVAL on exit. Use git_mkstemp_mode and xmkstemp_mode in odb_mkstemp, not chmod later. git_mkstemp_mode, xmkstemp_mode: variants of gitmkstemps with mode argument. Move gitmkstemps to path.c Add a testcase for ACL with restrictive umask.
2010-03-07Merge branch 'fn/maint-mkdtemp-compat'Junio C Hamano
* fn/maint-mkdtemp-compat: Fix gitmkdtemp: correct test for mktemp() return value
2010-03-07Merge branch 'mm/mkstemps-mode-for-packfiles'Junio C Hamano
* mm/mkstemps-mode-for-packfiles: Use git_mkstemp_mode instead of plain mkstemp to create object files git_mkstemps_mode: don't set errno to EINVAL on exit. Use git_mkstemp_mode and xmkstemp_mode in odb_mkstemp, not chmod later. git_mkstemp_mode, xmkstemp_mode: variants of gitmkstemps with mode argument. Move gitmkstemps to path.c Add a testcase for ACL with restrictive umask.
2010-03-07Windows: more pthreads functionsJohannes Sixt
This adds: pthread_self pthread_equal pthread_exit pthread_key_create pthread_setspecific pthread_getspecific Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-07Fix signature of fcntl() compatibility dummyJohannes Sixt
Obviously, this function was never called with two arguments in Windows code sections, but this will be the case in a subsequent patch. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-25Windows: redirect f[re]open("/dev/null") to f[re]open("nul")Johannes Sixt
On Windows, the equivalent of "/dev/null" is "nul". This implements compatibility wrappers around fopen() and freopen() that check for this particular file name. The new tests exercise code paths where this is relevant. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-25Fix gitmkdtemp: correct test for mktemp() return valueFilippo Negroni
In gitmkdtemp, the return value of mktemp is not tested correctly. mktemp() always returns its 'template' argument, even upon failure. An error is signalled by making the template an empty string. Signed-off-by: Filippo Negroni <fnegroni@flexerasoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-22Move gitmkstemps to path.cMatthieu Moy
This function used to be only a compatibility function, but we're going to extend it and actually use it, so make it part of Git. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-04Typofixes outside documentation areaJunio C Hamano
begining -> beginning canonicalizations -> canonicalization comand -> command dewrapping -> unwrapping dirtyness -> dirtiness DISCLAMER -> DISCLAIMER explicitely -> explicitly feeded -> fed impiled -> implied madatory -> mandatory mimick -> mimic preceeding -> preceding reqeuest -> request substition -> substitution Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-30Implement pthread_cond_broadcast on WindowsJohannes Sixt
See http://www.cse.wustl.edu/~schmidt/win32-cv-1.html, section "The SignalObjectAndWait solution". But note that this implementation does not use SignalObjectAndWait (which is needed to achieve fairness, but we do not need fairness). Note that our implementations of pthread_cond_broadcast and pthread_cond_signal require that they are invoked with the mutex held that is used in the pthread_cond_wait calls. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-23msvc: Fix a compiler warning due to an incorrect pointer castRamsay Jones
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-23msvc: Fix an "unrecognized option" linker warningRamsay Jones
Having recently added support for building git-imap-send on Windows, we now link against OpenSSL libraries, and the linker issues the following warning: warning LNK4044: unrecognized option '/lssl'; ignored In order to suppress the warning, we change the msvc linker script to translate an '-lssl' parameter to the ssleay32.lib library. Note that the linker script was already including ssleay32.lib (along with libeay32.lib) as part of the translation of the '-lcrypto' library parameter. However, libeay32.dll does not depend on ssleay32.dll and can be used stand-alone, so we remove ssleay32.lib from the '-lcrypto' translation. The dependence of ssleay32.dll on libeay32.dll is represented in the Makefile by the NEEDS_CRYPTO_WITH_SSL build variable. Also, add the corresponding change to the buildsystem generator. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-17Do not use date.c:tm_to_time_t() from compat/mingw.cJohannes Sixt
To implement gettimeofday(), a broken-down UTC time was requested from the system using GetSystemTime(), then tm_to_time_t() was used to convert it to a time_t because it does not look at the current timezone, which mktime() would do. Use GetSystemTimeAsFileTime() and a different conversion path to avoid this back-reference from the compatibility layer to the generic code. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-17MSVC: Windows-native implementation for subset of Pthreads APIAndrzej K. Haczewski
This patch implements native to Windows subset of pthreads API used by Git. It allows to remove Pthreads for Win32 dependency for MSVC, msysgit and Cygwin. [J6t: If the MinGW build was built as part of the msysgit build environment, then threading was already enabled because the pthreads-win32 package is available in msysgit. With this patch, we can now enable threaded code unconditionally.] Signed-off-by: Andrzej K. Haczewski <ahaczewski@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-17MSVC: Fix an "incompatible pointer types" compiler warningRamsay Jones
In particular, the following warning is issued while compiling compat/msvc.c: ...mingw.c(223) : warning C4133: 'function' : incompatible \ types - from '_stati64 *' to '_stat64 *' which relates to a call of _fstati64() in the mingw_fstat() function definition. This is caused by various layers of macro magic and attempts to avoid macro redefinition compiler warnings. For example, the call to _fstati64() mentioned above is actually a call to _fstat64(), and expects a pointer to a struct _stat64 rather than the struct _stati64 which is passed to mingw_fstat(). The definition of struct _stati64 given in compat/msvc.h had the same "shape" as the definition of struct _stat64, so the call to _fstat64() does not actually cause any runtime errors, but the structure types are indeed incompatible. In order to avoid the compiler warning, we add declarations for the mingw_lstat() and mingw_fstat() functions and supporting macros to msvc.h, suppressing the corresponding declarations in mingw.h, so that we can use the appropriate structure type (and function) names from the msvc headers. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-17Windows: avoid the "dup dance" when spawning a child processJohannes Sixt
When stdin, stdout, or stderr must be redirected for a child process that on Windows is spawned using one of the spawn() functions of Microsoft's C runtime, then there is no choice other than to 1. make a backup copy of fd 0,1,2 with dup 2. dup2 the redirection source fd into 0,1,2 3. spawn 4. dup2 the backup back into 0,1,2 5. close the backup copy and the redirection source We used this idiom as well -- but we are not using the spawn() functions anymore! Instead, we have our own implementation. We had hardcoded that stdin, stdout, and stderr of the child process were inherited from the parent's fds 0, 1, and 2. But we can actually specify any fd. With this patch, the fds to inherit are passed from start_command()'s WIN32 section to our spawn implementation. This way, we can avoid the backup copies of the fds. The backup copies were a bug waiting to surface: The OS handles underlying the dup()ed fds were inherited by the child process (but were not associated with a file descriptor in the child). Consequently, the file or pipe represented by the OS handle remained open even after the backup copy was closed in the parent process until the child exited. Since our implementation of pipe() creates non-inheritable OS handles, we still dup() file descriptors in start_command() because dup() happens to create inheritable duplicates. (A nice side effect is that the fd cleanup in start_command is the same for Windows and Unix and remains unchanged.) Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-17Windows: simplify the pipe(2) implementationJohannes Sixt
Our implementation of pipe() must create non-inheritable handles for the reason that when a child process is started, there is no opportunity to close the unneeded pipe ends in the child (on POSIX this is done between fork() and exec()). Previously, we used the _pipe() function provided by Microsoft's C runtime (which creates inheritable handles) and then turned the handles into non-inheritable handles using the DuplicateHandle() API. Simplify the procedure by using the CreatePipe() API, which can create non-inheritable handles right from the beginning. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-17Windows: boost startup by avoiding a static dependency on shell32.dllJohannes Sixt
This DLL is only needed to invoke the browser in a "git help" call. By looking up the only function that we need at runtime, we can avoid the startup costs of this DLL. DLL usage can be profiled with Microsoft's Dependency Walker. For example, a call to "git diff-files" loaded before: 19 DLLs after: 9 DLLs As a result, the runtime of 'make -j2 test' went down from 16:00min to 12:40min on one of my boxes. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-25Explicitly truncate bswap operand to uint32_tBenjamin Kramer
There are some places in git where a long is passed to htonl/ntohl. llvm doesn't support matching operands of different bitwidths intentionally. This patch fixes the build with llvm-gcc (and clang) on x86_64. Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-24Enable support for IPv6 on MinGWMartin Storsjö
The IPv6 support functions are loaded dynamically, to maintain backwards compatibility with versions of Windows prior to XP, and fallback wrappers are provided, implemented in terms of gethostbyname and gethostbyaddr. Signed-off-by: Martin Storsjo <martin@martin.st> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-24Refactor winsock initialization into a separate functionMartin Storsjö
The winsock library must be initialized. Since gethostbyname() is the first function that calls into winsock, it was overridden to do the initialization. This refactoring helps the next patch, where other functions can be called earlier. Signed-off-by: Martin Storsjo <martin@martin.st> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-21Merge branch 'rj/cygwin-msvc'Junio C Hamano
* rj/cygwin-msvc: MSVC: Add support for building with NO_MMAP Makefile: keep MSVC and Cygwin configuration separate