summaryrefslogtreecommitdiff
path: root/compat
AgeCommit message (Collapse)AuthorFilesLines
2009-06-13Merge branch 'sp/msysgit'Libravatar Junio C Hamano9-1/+7152
* sp/msysgit: compat/ has subdirectories: do not omit them in 'make clean' Fix typo in nedmalloc warning fix MinGW: Teach Makefile to detect msysgit and apply specific settings Fix warnings in nedmalloc when compiling with GCC 4.4.0 Add custom memory allocator to MinGW and MacOS builds MinGW readdir reimplementation to support d_type connect.c: Support PuTTY plink and TortoisePlink as SSH on Windows git: browsing paths with spaces when using the start command MinGW: fix warning about implicit declaration of _getch() test-chmtime: work around Windows limitation Work around a regression in Windows 7, causing erase_in_line() to crash sometimes Quiet make: do not leave Windows behind MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymore Conflicts: Makefile
2009-06-11Fix typo in nedmalloc warning fixLibravatar Johannes Sixt1-1/+1
Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-08Fix warnings in nedmalloc when compiling with GCC 4.4.0Libravatar Johannes Schindelin2-2/+4
Nedmalloc's source code has a cute #define construct to avoid inserting an if() statement, because that might interact badly with enclosing if() statements. However, GCC > 4 complains with a "warning: value computed is not used". So we cast the result to "void". GCC also does not understand the Visual C++ specific pragmas, so we need to disable them for MinGW. We need to include malloc.h on Windows even if we happen to compile the stuff as a MinGW program. Otherwise the function declaration of alloca() is missing. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01Add custom memory allocator to MinGW and MacOS buildsLibravatar Marius Storm-Olsen5-0/+7055
The standard allocator on Windows is pretty bad prior to Windows Vista, and nedmalloc is better than the modified dlmalloc provided with newer versions of the MinGW libc. NedMalloc stats in Git ---------------------- All results are the best result out of 3 runs. The benchmarks have been done on different hardware, so the repack times are not comparable. These benchmarks are all based on 'git repack -adf' on the Linux kernel. XP ----------------------------------------------- MinGW Threads Total Time Speed ----------------------------------------------- 3.4.2 (1T) 00:12:28.422 3.4.2 + nedmalloc (1T) 00:07:25.437 1.68x 3.4.5 (1T) 00:12:20.718 3.4.5 + nedmalloc (1T) 00:07:24.809 1.67x 4.3.3-tdm (1T) 00:12:01.843 4.3.3-tdm + nedmalloc (1T) 00:07:16.468 1.65x 4.3.3-tdm (2T) 00:07:35.062 4.3.3-tdm + nedmalloc (2T) 00:04:57.874 1.54x Vista ----------------------------------------------- MinGW Threads Total Time Speed ----------------------------------------------- 4.3.3-tdm (1T) 00:07:40.844 4.3.3-tdm + nedmalloc (1T) 00:07:17.548 1.05x 4.3.3-tdm (2T) 00:05:33.746 4.3.3-tdm + nedmalloc (2T) 00:05:27.334 1.02x Mac Mini ----------------------------------------------- GCC Threads Total Time Speed ----------------------------------------------- i686-darwin9-4.0.1 (2T) 00:09:57.346 i686-darwin9-4.0.1+ned (2T) 00:08:51.072 1.12x Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01MinGW readdir reimplementation to support d_typeLibravatar Marius Storm-Olsen2-0/+88
The original readdir implementation was fast, but didn't support the d_type. This means that git would do additional lstats for each entry, to figure out if the entry was a directory or not. This unneedingly slowed down many operations, since Windows API provides this information directly when walking the directories. By running this implementation on Moe's repo structure: mkdir bummer && cd bummer; for ((i=0;i<100;i++)); do mkdir $i && pushd $i; for ((j=0;j<1000;j++)); do echo "$j" >$j; done; popd; done We see the following speedups: git add . ------------------- old: 00:00:23(.087) new: 00:00:21(.512) 1.07x git status ------------------- old: 00:00:03(.306) new: 00:00:01(.684) 1.96x git clean -dxf ------------------- old: 00:00:01(.918) new: 00:00:00(.295) 6.50x Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01MinGW: fix warning about implicit declaration of _getch()Libravatar Johannes Schindelin1-0/+1
conio.h provides the declaration. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01Work around a regression in Windows 7, causing erase_in_line() to crash ↵Libravatar Johannes Schindelin1-1/+2
sometimes The function FillConsoleOutputCharacterA() was pretty content in XP to take a NULL pointer if we did not want to store the number of written columns. In Windows 7, it crashes, but only when called from within Git Bash, not from within cmd.exe. Go figure. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymoreLibravatar Johannes Schindelin1-0/+4
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31compat: add a basename() compatibility functionLibravatar David Aguilar1-0/+15
Some systems such as Windows lack libgen.h so provide a basename() implementation for cross-platform use. This introduces the NO_LIBGEN_H construct to the Makefile and autoconf scripts. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31compat: add a mkstemps() compatibility functionLibravatar David Aguilar1-0/+70
mkstemps() is a BSD extension so provide an implementation for cross-platform use. Signed-off-by: David Aguilar <davvid@gmail.com> Tested-by: Johannes Sixt <j6t@kdbg.org> (Windows) Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23MinGW: Add a simple getpass()Libravatar Johannes Schindelin2-0/+17
We need getpass() to activate curl on MinGW. Although the default Makefile currently has 'NO_CURL = YesPlease', msysgit releases do provide curl support, so getpass() is used. [spr: - edited commit message. - squashed commit that provides getpass() declaration.] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23MinGW: use POSIX signature of waitpid()Libravatar Johannes Schindelin1-1/+1
Git's source code expects waitpid() to return a signed int status. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23MinGW: Scan for \r in addition to \n when reading shbang linesLibravatar Peter Harris1-2/+2
\r is common on Windows, so we should handle it gracefully. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-01Fix a bunch of pointer declarations (codestyle)Libravatar Felipe Contreras1-1/+1
Essentially; s/type* /type */ as per the coding guidelines. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-22Fix more typos/spelling in commentsLibravatar Michael J Gruber2-2/+2
A few more fixes on top of the automatic spell checker generated ones. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-22Fix typos / spelling in commentsLibravatar Mike Ralphson4-6/+6
Signed-off-by: Mike Ralphson <mike@abacus.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20Windows: Work around intermittent failures in mingw_renameLibravatar Johannes Sixt1-2/+19
We have replaced rename() with a version that can rename a file to a destination that already exists. Nevertheless, many users, the author included, observe failures in the code that are not reproducible. The theory is that the failures are due to some other process that happens to have opened the destination file briefly at the wrong moment. (And there is no way on Windows to delete or replace a file that is currently open.) The most likely candidate for such a process is a virus scanner. The failure is more often observed while there is heavy git activity (for example while the test suite is running or during a rebase operation). We work around the failure by retrying the rename operation if it failed due to ERROR_ACCESS_DENIED. The retries are delayed a bit: The first only by giving up the time slice, the next after the minimal scheduling granularity, and if more retries are needed, then we wait some non-trivial amount of time with exponential back-off. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-24MinGW: Quote arguments for subprocesses that contain a single-quoteLibravatar Johannes Sixt1-1/+1
Before a process can be spawned by mingw_spawnve, arguments must be surrounded by double-quotes if special characters are present. This is necessary because the startup code of the spawned process will expand arguments that look like glob patterns. "Normal" Windows command line utilities expand only * and ?, but MSYS programs, including bash, are different: They also expand braces, and this has already been taken care of by compat/mingw.c:quote_arg(). But MSYS programs also treat single-quotes in a special way: Arguments between single-quotes are spliced together (with spaces) into a word. With this patch this treatment is avoided by quoting arguments that contain single-quotes. This lets t4252 pass on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-18MinGW: implement mmapLibravatar Janos Laube2-0/+58
Add USE_WIN32_MMAP which triggers the use of windows' native file memory mapping functionality in git_mmap()/git_munmap() functions. As git functions currently use mmap with MAP_PRIVATE set only, this implementation supports only that mode for now. On Windows, offsets for memory mapped files need to match the allocation granularity. Take this into account when calculating the packed git- windowsize and file offsets. At the moment, the only function which makes use of offsets in conjunction with mmap is use_pack() in sha1-file.c. Git fast-import's code path tries to map a portion of the temporary packfile that exceeds the current filesize, i.e. offset+length is greater than the filesize. The NO_MMAP code worked with that since pread() just reads the file content until EOF and returns gracefully, while MapViewOfFile() aborts the mapping and returns 'Access Denied'. Working around that by determining the filesize and adjusting the length parameter. Signed-off-by: Janos Laube <janos.dev@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-17Merge branch 'js/sideband-stderr'Libravatar Junio C Hamano1-3/+15
* js/sideband-stderr: winansi: support ESC [ K (erase in line) recv_sideband: Bands #2 and #3 always go to stderr
2009-03-17MinGW: a hardlink implementationLibravatar Petr Kodl2-2/+22
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-17MinGW: a helper function that translates Win32 API error codesLibravatar Petr Kodl1-0/+113
This function translates many possible Win32 error codes to suitable errno numbers. We will use it in our wrapper functions that need to call into Win32. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-11Merge branch 'rs/memmem'Libravatar Junio C Hamano1-1/+4
* rs/memmem: optimize compat/ memmem() diffcore-pickaxe: use memmem()
2009-03-10winansi: support ESC [ K (erase in line)Libravatar Johannes Schindelin1-3/+15
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07Brown paper bag fix for MinGW 64-bit statLibravatar Johannes Schindelin1-1/+1
When overriding the identifier "stat" so that "struct stat" will be substituted with "struct _stati64" everywhere, I tried to fix the calls to the _function_ stat(), too, but I forgot to change the earlier attempt "stat64" to "_stati64" there. So, the stat() calls were overridden by calls to _stati64() instead. Unfortunately, there is a function _stati64() so that I missed that calls to stat() were not actually overridden by calls to mingw_lstat(), but t4200-rerere.sh showed the error. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-05MinGW: 64-bit file offsetsLibravatar Johannes Schindelin2-4/+9
The type 'off_t' should be used everywhere so that the bit-depth of that type can be adjusted in the standard C library, and you just need to recompile your program to benefit from the extended precision. Only that it was not done that way in the MS runtime library. This patch reroutes off_t to off64_t and provides the other necessary changes so that finally, clones larger than 2 gigabyte work on Windows (provided you are on a file system that allows files larger than 2gb). Initial patch by Sickboy <sb@dev-heaven.net>. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-02optimize compat/ memmem()Libravatar René Scharfe1-1/+4
When memmem() was imported from glibc 2.2 into compat/, an optimization was dropped in the process, in order to make the code smaller and simpler. It was OK because memmem() wasn't used in performance-critical code. Now the situation has changed and we can benefit from this optimization. The trick is to avoid calling memcmp() if the first character of the needle already doesn't match. Checking one character directly is much cheaper than the function call overhead. We keep the first character of the needle in the variable named point and the rest in the one named tail. The following commands were run in a Linux kernel repository and timed, the best of five results is shown: $ STRING='Ensure that the real time constraints are schedulable.' $ git log -S"$STRING" HEAD -- kernel/sched.c >/dev/null On Windows Vista x64, before: real 0m8.470s user 0m0.000s sys 0m0.000s And after the patch: real 0m1.887s user 0m0.000s sys 0m0.000s Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-21Windows: Fix signal numbersLibravatar Johannes Sixt1-6/+6
We had defined some SIG_FOO macros that appear in the code, but that are not supported on Windows, in order to make the code compile. But a subsequent change will assert that a signal number is non-zero. We now use the signal numbers that are commonly used on POSIX systems. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-27Merge branch 'js/mingw-rename-fix'Libravatar Junio C Hamano1-3/+12
* js/mingw-rename-fix: compat/mingw.c: Teach mingw_rename() to replace read-only files
2008-11-23compat/mingw.c: Teach mingw_rename() to replace read-only filesLibravatar Johannes Sixt1-3/+12
On POSIX, rename() can replace files that are not writable. On Windows, however, read-only files cannot be replaced without additional efforts: We have to make the destination writable first. Since the situations where the destination is read-only are rare, we do not make the destination writable on every invocation, but only if the first try to rename a file failed with an "access denied" error. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-06Windows: Make OpenSSH properly detect tty detachment.Libravatar Alexander Gavrilov1-2/+6
Apparently, CREATE_NO_WINDOW makes the OS tell the process that it has a console, but without actually creating the window. As a result, when git is started from GUI, ssh tries to ask its questions on the invisible console. This patch uses DETACHED_PROCESS instead, which clearly means that the process should be left without a console. The downside is that if the process manually calls AllocConsole, the window will appear. A similar thing might occur if it calls another console executable. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Acked-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-28compat/cygwin.c: make runtime detection of lstat/stat lessor impactLibravatar Junio C Hamano1-7/+13
The original patch that lead to an earlier commit adbc0b6 (cygwin: Use native Win32 API for stat, 2008-09-30) did not call git_default_config() and it was a good thing. The lazy config reading when lstat/stat is called for the first time to find out if core.filemode is set can happen anytime in the calling program. If it happens after the calling program parsed the configuration file to prime its default parameter settings and processed its command line parameters to tweak them, this will overwrite the values set by the program with the values read from the config file. This essentially reverts the code to the version as submitted by Mark, with a bit more comments to clarify why we do not fall back on the default configuration parser from git_cygwin_config(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-13compat/cygwin.c - Use cygwin's stat if core.filemode == trueLibravatar Mark Levedahl1-4/+14
Cygwin's POSIX emulation allows use of core.filemode true, unlike native Window's implementation of stat / lstat, and Cygwin/git users who have configured core.filemode true in various repositories will be very unpleasantly surprised to find that git is no longer honoring that option. So, this patch forces use of Cygwin's stat functions if core.filemode is set true, regardless of any other considerations. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-30cygwin: Use native Win32 API for statLibravatar Dmitry Potapov2-0/+136
lstat/stat functions in Cygwin are very slow, because they try to emulate some *nix things that Git does not actually need. This patch adds Win32 specific implementation of these functions for Cygwin. This implementation handles most situation directly but in some rare cases it falls back on the implementation provided for Cygwin. This is necessary for two reasons: - Cygwin has its own file hierarchy, so absolute paths used in Cygwin is not suitable to be used Win32 API. cygwin_conv_to_win32_path can not be used because it automatically dereference Cygwin symbol links, also it causes extra syscall. Fortunately Git rarely use absolute paths, so we always use Cygwin implementation for absolute paths. - Support of symbol links. Cygwin stores symbol links as ordinary using one of two possible formats. Therefore, the fast implementation falls back to Cygwin functions if it detects potential use of symbol links. The speed of this implementation should be the same as mingw_lstat for common cases, but it is considerable slower when the specified file name does not exist. Despite all efforts to make the fast implementation as robust as possible, it may not work well for some very rare situations. I am aware only one situation: use Cygwin mount to bind unrelated paths inside repository together. Therefore, the core.ignoreCygwinFSTricks configuration option is provided, which controls whether native or Cygwin version of stat is used. Signed-off-by: Dmitry Potapov <dpotapov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-30mingw: move common functionality to win32.hLibravatar Dmitry Potapov2-38/+38
Some small Win32 specific functions will be shared by MinGW and Cygwin compatibility layer. Place them into a separate header. Signed-off-by: Dmitry Potapov <dpotapov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-29mingw: remove use of _getdrive() from lstat/fstatLibravatar Dmitry Potapov1-3/+2
The field device is not used by Git, and putting the number of the current device is meaningless anyway. Signed-off-by: Dmitry Potapov <dpotapov@gmail.com> Acked-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-29compat/mingw: Support a timeout in the poll emulation if no fds are givenLibravatar Johannes Sixt1-1/+6
Our poll() emulation did not support the timeout argument. With this patch we support it for the simple case where poll() does not need to wait on file descriptors as well because this case amounts to a mere Sleep(). This is needed if the user sets help.autocorrect is set to a positive value. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-10Merge branch 'maint'Libravatar Junio C Hamano4-0/+0
* maint: Update draft release notes for 1.6.0.2 Use compatibility regex library for OSX/Darwin git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl Git.pm: Use File::Temp->tempfile instead of ->new t7501: always use test_cmp instead of diff Conflicts: Makefile
2008-09-10Use compatibility regex library for OSX/DarwinLibravatar Arjen Laarhoven4-0/+0
The standard libc regex library on OSX does not support alternation in POSIX Basic Regular Expression mode. This breaks the diff.funcname functionality on OSX. To fix this, we use the GNU regex library which is already present in the compat/ diretory for the MinGW port. However, simply adding compat/ to the COMPAT_CFLAGS variable causes a conflict between the system fnmatch.h and the one present in compat/. To remedy this, move the regex and fnmatch functionality to their own subdirectories in compat/ so they can be included seperately. Signed-off-by: Arjen Laarhoven <arjen@yaph.org> Tested-by: Mike Ralphson <mike@abacus.co.uk> (AIX) Tested-by: Johannes Sixt <johannes.sixt@telecom.at> (MinGW) Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-21Merge branch 'maint'Libravatar Junio C Hamano1-0/+4
* maint: compat/snprintf.c: handle snprintf's that always return the # chars transmitted git-svn: fix dcommit to urls with embedded usernames revision.h: make show_early_output an extern which is defined in revision.c
2008-08-21compat/snprintf.c: handle snprintf's that always return the # chars transmittedLibravatar Brandon Casey1-0/+4
Some platforms provide a horribly broken snprintf. More broken than the platforms that return -1 when there is too little space in the target buffer for the formatted string. Some platforms provide an snprintf which _always_ returns the number of characters transmitted to the buffer, regardless of whether there was enough space or not. IRIX 6.5 is such a platform. IRIX does have a working snprintf(), but it is only provided when _NO_XOPEN5 evaluates to zero, and this only happens if _XOPEN_SOURCE is defined, but definition of _XOPEN_SOURCE prevents inclusion of many other common functions and defines. So it must be avoided. Work around these horribly broken snprintf implementations by detecting an snprintf call which results in the number of transmitted characters exactly equal to the length of our buffer and retrying with a larger buffer just to be safe. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Acked-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-18Revert "Windows: Use a customized struct stat that also has the st_blocks ↵Libravatar Johannes Sixt2-32/+11
member." This reverts commit fc2ded5b08e071beed974117c0148781b1acc94a. As we do not need the member in struct stat, we do not need to have a custom "struct mingw_stat" anymore. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-18compat: introduce on_disk_bytes()Libravatar Junio C Hamano2-9/+0
Some platforms do not have st_blocks member in "struct stat"; mingw already emulates it by rounding it up to closest 512-byte blocks (even though it could overcount when a file has holes). The reason to use the member is only to figure out how many kilobytes the files occupy on-disk, so give a helper function in git-compat-util.h to compute this value. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
2008-08-03Modify mingw_main() workaround to avoid link errorsLibravatar Steffen Prohaska1-2/+3
With MinGW's gcc.exe (GCC) 3.4.5 (mingw special) GNU ld version 2.17.50 20060824 the old define caused link errors: git.o: In function `main': C:/msysgit/git/git.c:500: undefined reference to `mingw_main' collect2: ld returned 1 exit status The modified define works. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Acked-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-25Windows: Make sure argv[0] has a pathLibravatar Johannes Sixt1-0/+12
Since the exec-path on Windows is derived from the program invocation path, we must ensure that argv[0] always has a path. Unfortunately, if a program is invoked from CMD, argv[0] has no path. But on the other hand, the C runtime offers a global variable, _pgmptr, that always has the full path to the program. We hook into main() with a preprocessor macro, where we replace argv[0]. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-19Add ANSI control code emulation for the Windows consoleLibravatar Peter Harris2-0/+356
This adds only the minimum necessary to keep git pull/merge's diffstat from wrapping. Notably absent is support for the K (erase) operation, and support for POSIX write. Signed-off-by: Peter Harris <git@peter.is-a-geek.org> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-19Teach lookup_prog not to select directoriesLibravatar Eric Raible1-1/+2
Without this simple fix "git gui" in the git source directory finds the git-gui directory instead of the tcl script in /usr/bin. Signed-off-by: Eric Raible <raible@gmail.com> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13help (Windows): Display HTML in default browser using Windows' shell APILibravatar Steffen Prohaska2-0/+25
The system's default browser for displaying HTML help pages is now used directly on Windows, instead of launching git-web--browser, which requires a Unix shell. Avoiding MSYS' bash when possible is good because it avoids potential path translation issues. In this case it is not too hard to avoid launching a shell, so let's avoid it. The Windows-specific code is implemented in compat/mingw.c to avoid platform-specific code in the main code base. On Windows, open_html is provided as a define. If open_html is not defined, git-web--browse is used. This approach avoids platform-specific ifdefs by using per-function ifdefs. The "ifndef open_html" together with the introductory comment should sufficiently warn developers, so that they hopefully will not break this mechanism. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26Windows: Fix ntohl() related warnings about printf formattingLibravatar Steffen Prohaska1-0/+4
On Windows, ntohl() returns unsigned long. On Unix it returns uint32_t. This makes choosing a suitable printf format string hard. This commit introduces a mingw specific helper function git_ntohl() that casts to unsigned int before returning. This makes gcc's printf format check happy. It should be safe because we expect ntohl to use 32-bit numbers. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2008-06-26Windows: TMP and TEMP environment variables specify a temporary directory.Libravatar Johannes Sixt2-0/+16
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>