Karsten Blees [Tue, 21 Dec 2010 01:06:40 +0000 (21 02:06 +0100)]
Mark unicode-related tests broken on msys
MSys bash doesn't support unicode at all. Testing a unicode-enabled git
with an encoding-agnostic bash cannot work.
This patch adds a new test function test_expect_success_unicode that tests
whether the shell is capable of passing unicode strings to another process.
If that works, the test is expected to succeed, otherwise it's expected to
fail.
Tested-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 20:30:50 +0000 (7 21:30 +0100)]
Win32: Thread-safe windows console output
Replace stdout and stderr with a pipe if they point to the console. A
background thread reads from the pipe, handles ANSI escape sequences and
UTF-8 to UTF-16 conversion, then writes to the console.
Global variables are either initialized on startup (single threaded) or
exclusively modified by the background thread. Threads communicate through
the pipe, no further synchronization is necessary.
Due to the byte-oriented pipe, ANSI escape sequences can no longer be
expected to arrive in one piece. Replace the string-based ansi_emulate()
with a simple stateful parser (this also fixes colored diff hunk headers,
which were broken as of commit
2efcc977).
Override isatty to return true for the pipes redirecting to the console.
Exec/spawn obtain the original console handle to pass to the next process
via winansi_get_osfhandle().
All other overrides are gone, the default stdio implementations work as
expected with the piped stdout/stderr descriptors.
Limitations: doesn't track reopened or duped file descriptors, i.e.:
- fdopen(1/2) returns fully buffered streams
- dup(1/2), dup2(1/2) returns normal pipe descriptors (i.e. isatty() =
false, winansi_get_osfhandle won't return the original console handle)
Currently, only the git-format-patch command uses xfdopen(xdup(1)) (see
"realstdout" in builtin/log.c), but works well with these limitations.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 20:18:12 +0000 (7 21:18 +0100)]
Win32: Unicode arguments and environment
Convert command line arguments and environment from UTF-16 to UTF-8 on
startup, and vice versa when creating other processes.
Provide replacements for getenv/putenv/unsetenv that operate directly on
the UTF-8-encoded "environ" array to save UTF-8/16 conversions on each
call (and save the trouble to keep track of conversion memory). As sorting
the environment is required for CreateProcess anyway, keep "environ"
sorted and use binary search for faster lookups.
The mingw_startup function converts the command line and environment to
UTF-8, and fixes Windows specific environment settings (TMPDIR and TERM,
formerly handled in mingw_getenv).
Altering the environment when creating new processes is now handled in
spawnv* internally, replacing make_augmented_environ and related APIs.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 20:02:20 +0000 (7 21:02 +0100)]
Unicode file name support (gitk and git-gui)
Assumes file names in git tree objects are UTF-8 encoded.
On most unix systems, the system encoding (and thus the TCL system
encoding) will be UTF-8, so file names will be displayed correctly.
On Windows, it is impossible to set the system encoding to UTF-8. Changing
the TCL system encoding (via 'encoding system ...', e.g. in the startup
code) is explicitly discouraged by the TCL docs.
Change gitk and git-gui functions dealing with file names to always convert
from and to UTF-8.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 19:34:30 +0000 (7 20:34 +0100)]
Win32: Unicode file name support (dirent)
Changes opendir/readdir to use Windows Unicode APIs and convert between
UTF-8/UTF-16.
Removes parameter checks that are already covered by utftowcs.
Increases the size of dirent.d_name to accommodate the full
WIN32_FIND_DATA.cFileName converted to UTF-8 (UTF-16 to UTF-8 conversion
may grow by factor three in the worst case).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 19:28:51 +0000 (7 20:28 +0100)]
Win32: Unicode file name support (except dirent)
Replaces Windows "ANSI" APIs dealing with file- or path names with their
Unicode equivalent, adding UTF-8/UTF-16LE conversion as necessary.
The dirent API (opendir/readdir/closedir) is updated in a separate commit.
Adds trivial wrappers for access, chmod and chdir.
Adds wrapper for mktemp (needed for both mkstemp and mkdtemp).
The simplest way to convert a repository with legacy-encoded (e.g. Cp1252)
file names to UTF-8 ist to checkout with an old msysgit version and
"git add --all & git commit" with the new version.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 19:02:53 +0000 (7 20:02 +0100)]
Win32: add Unicode conversion functions
Add Unicode conversion functions to convert between Windows native UTF-16LE
encoding to UTF-8 and back.
To support repositories with legacy-encoded file names, the UTF-8 to UTF-16
conversion function tries to create valid, unique file names even for
invalid UTF-8 byte sequences, so that these repositories can be checked out
without error.
The current implementation leaves invalid UTF-8 bytes in range 0xa0 - 0xff
as is (producing printable Unicode chars \u00a0 - \u00ff, equivalent to
ISO-8859-1), and converts 0x80 - 0x9f to hex-code (\u0080 - \u009f are
control chars).
The Windows MultiByteToWideChar API was not used as it either drops invalid
UTF-8 sequences (on Win2k/XP; producing non-unique or even empty file
names) or converts them to the replacement char \ufffd (Vista/7; causing
ERROR_INVALID_NAME in subsequent calls to file system APIs).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 18:52:20 +0000 (7 19:52 +0100)]
MinGW: disable command line globbing (fixes t5505 and t7810)
Disable MSVCRT command line wildcard expansion to be able to pass * / ? to
git-grep and friends.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 18:47:23 +0000 (7 19:47 +0100)]
Win32: move main macro to a function
The code in the MinGW main macro is getting more and more complex, move to
a separate initialization function for readabiliy and extensibility.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 17:38:07 +0000 (7 18:38 +0100)]
gitk: fix file name encoding in diff hunk headers
Decode file names from system encoding in all diff hunk header lines, not
just the first (i.e. print nice file names in 'rename from' / 'rename to' /
'Binary files' lines, too).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 17:28:37 +0000 (7 18:28 +0100)]
git-gui: fix encoding in git-gui file browser
Assume git tree objects (i.e. output of git-ls-tree) are encoded in system
encoding, for display in the git-gui file browser.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 17:04:16 +0000 (7 18:04 +0100)]
Win32: fix potential multi-threading issue
...by removing a static buffer in do_stat_internal.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 16:57:02 +0000 (7 17:57 +0100)]
Win32 dirent: improve dirent implementation
Improve the dirent implementation by removing the relics that were once
necessary to plug into the now unused MinGW runtime, in preparation for
Unicode file name support.
Move FindFirstFile to opendir, and FindClose to closedir, with the
following implications:
- DIR.dd_name is no longer needed
- chdir(one); opendir(relative); chdir(two); readdir() works as expected
(i.e. lists one/relative instead of two/relative)
- DIR.dd_handle is a valid handle for the entire lifetime of the DIR struct
- thus, all checks for dd_handle == INVALID_HANDLE_VALUE and dd_handle == 0
have been removed
- the special case that the directory has been fully read (which was
previously explicitly tracked with dd_handle == INVALID_HANDLE_VALUE &&
dd_stat != 0) is now handled implicitly by the FindNextFile error
handling code (if a client continues to call readdir after receiving
NULL, FindNextFile will continue to fail with ERROR_NO_MORE_FILES, to
the same effect)
- extracting dirent data from WIN32_FIND_DATA is needed in two places, so
moved to its own method
- GetFileAttributes is no longer needed. The same information can be
obtained from the FindFirstFile error code, which is ERROR_DIRECTORY if
the name is NOT a directory (-> ENOTDIR), otherwise we can use
err_win_to_posix (e.g. ERROR_PATH_NOT_FOUND -> ENOENT). The
ERROR_DIRECTORY case could be fixed in err_win_to_posix, but this
probably breaks other functionality.
Removes the ERROR_NO_MORE_FILES check after FindFirstFile (this was
fortunately a NOOP (searching for '*' always finds '.' and '..'),
otherwise the subsequent code would have copied data from an uninitialized
buffer).
Changes malloc to git support function xmalloc, so opendir will die() if
out of memory, rather than failing with ENOMEM and letting git work on
incomplete directory listings (error handling in dir.c is quite sparse).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 16:47:41 +0000 (7 17:47 +0100)]
Win32 dirent: clarify #include directives
Git-compat-util.h is two dirs up, and already includes <dirent.h> (which
is the same as "dirent.h" due to -Icompat/win32 in the Makefile).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 16:43:14 +0000 (7 17:43 +0100)]
Win32 dirent: change FILENAME_MAX to MAX_PATH
FILENAME_MAX and MAX_PATH are both 260 on Windows, however, MAX_PATH is
used throughout the other Win32 code in Git, and also defines the length
of file name buffers in the Win32 API (e.g. WIN32_FIND_DATA.cFileName,
from which we're copying the dirent data).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 16:38:25 +0000 (7 17:38 +0100)]
Win32 dirent: remove unused dirent.d_reclen member
Remove the union around dirent.d_type and the unused dirent.d_reclen member
(which was necessary for compatibility with the MinGW dirent runtime, which
is no longer used).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 16:34:33 +0000 (7 17:34 +0100)]
Win32 dirent: remove unused dirent.d_ino member
There are no proper inodes on Windows, so remove dirent.d_ino and #define
NO_D_INO_IN_DIRENT in the Makefile (this skips e.g. an ineffective qsort in
fsck.c).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 16:20:21 +0000 (7 17:20 +0100)]
MSVC: link dynamically to the CRT
Dynamic linking is generally preferred over static linking, and MSVCRT.dll
has been integral part of Windows for a long time.
This also fixes linker warnings for _malloc and _free in zlib.lib, which
seems to be compiled for MSVCRT.dll already.
The DLL version also exports some of the CRT initialization functions,
which are hidden in the static libcmt.lib (e.g. __wgetmainargs, required by
subsequent Unicode patches).
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 15:50:28 +0000 (7 16:50 +0100)]
MSVC: fix winansi.c compile errors
Some constants (such as LF_FACESIZE) are undefined with -DNOGDI (set in the
Makefile), and CONSOLE_FONT_INFOEX is available in MSVC, but not in MinGW.
Cast FARPROC to PGETCURRENTCONSOLEFONTEX to suppress MSVC compiler warning.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 14:18:24 +0000 (7 15:18 +0100)]
MSVC: include <io.h> for mktemp
Include io.h from unistd.h, as in MinGW, so that mktemp is available.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 13:41:39 +0000 (7 14:41 +0100)]
MSVC: disable frequent compiler warnings
Using uninitialized variables to initialize themselves (i.e. 'type varname
= varname;') seems to be a frequent pattern in git. This is supposedly to
suppress the 'using uninitialized variable' warning, which is a bit
paradox, but seems to work with most compilers. MSVC correctly complains
here - disable C4090 warning.
MSVC also warns about implicit casts from non-const to const, which is
stupid - disable C4700 warning.
MSVC link.exe doesn't recognize the /wd option in CFLAGS in the Makefile,
so use #pragma warning in central, MSVC-specific unistd.h.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 13:28:49 +0000 (7 14:28 +0100)]
Remove dummy S_I[RWX]USR definitions
These are declared in stat.h (for MinGW) or unistd.h (for MSVC, currently
resulting in many duplicate definition warnings). As git actually uses
these constants (in contrast to, e.g. S_I*GRP), there's no point in
dummy-defining them to 0 anyway.
Signed-off-by: Karsten Blees <blees@dcon.de>
Karsten Blees [Fri, 7 Jan 2011 14:09:00 +0000 (7 15:09 +0100)]
Remove unused / incompatible environ declaration
Exec_cmd.c no longer uses environ (as of
511707d4), and the declaration is
incompatible with MSVC (where environ is #defined to (*__p__environ()),
resulting in a compiler warning).
Signed-off-by: Karsten Blees <blees@dcon.de>
Johannes Schindelin [Sat, 8 Jan 2011 16:06:48 +0000 (8 17:06 +0100)]
Handle new t1510 test cases properly with MinGW
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sat, 8 Jan 2011 16:02:17 +0000 (8 17:02 +0100)]
Handle new t1501 test case properly with MinGW
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sat, 8 Jan 2011 14:18:01 +0000 (8 15:18 +0100)]
Rebasing merge to junio/next (
600460d)
Johannes Schindelin [Sat, 8 Jan 2011 00:47:45 +0000 (8 01:47 +0100)]
Do not compile compat/**/*.c with -Wold-style-definition
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sat, 8 Jan 2011 00:46:41 +0000 (8 01:46 +0100)]
Fix old-style function declaration
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Mon, 12 Jan 2009 12:20:53 +0000 (12 13:20 +0100)]
Make CFLAGS more strict
This is a gcc-ism, but as we use gcc exclusively, we can use them.
Taken from one of Junio's mails. (Reminded to cherry-pick this patch
by one of Karsten Blees' mails.)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Eric Sunshine [Mon, 27 Sep 2010 12:01:35 +0000 (27 08:01 -0400)]
Side-step line-ending corruption leading to t3032 failures.
By default, MSYS grep and sed throw away CR from CRLF line-endings.
Tests t3032.4 through t3032.8 employ grep and fail due to this behavior.
Test t3032.9 employs sed and fails. Fix by employing grep's -U/--binary
and sed's -b/--binary switches to suppress the default behavior of
dropping CR characters.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Johannes Schindelin [Mon, 8 Nov 2010 15:10:43 +0000 (8 16:10 +0100)]
grep -I: do not bother to read known-binary files
Incidentally, this makes grep -I respect the "binary" attribute (actually,
the "-text" attribute, but "binary" implies that).
Since the attributes are not thread-safe, we now need to switch off
threading if -I was passed.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sat, 23 Oct 2010 15:06:23 +0000 (23 08:06 -0700)]
Let deny.currentBranch=updateInstead ignore submodules
They are not affected by the update anyway.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sat, 23 Oct 2010 14:56:21 +0000 (23 07:56 -0700)]
add -e: ignore dirty submodules
We cannot add untracked/modified files in submodules anyway.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sun, 26 Jul 2009 03:08:42 +0000 (26 05:08 +0200)]
Handle http.* config variables pointing to files gracefully on Windows
On Windows, we would like to be able to have a default http.sslCAinfo
that points to an MSys path (i.e. relative to the installation root of
Git). As Git is a MinGW program, it has to handle the conversion
of the MSys path into a MinGW32 path itself.
Since system_path() considers paths starting with '/' as absolute, we
have to convince it to make a Windows path by stripping the leading
slash.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Tue, 7 Sep 2010 14:58:16 +0000 (7 16:58 +0200)]
Gitweb: make line number toggling work for Firefox and Safari
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Tue, 7 Sep 2010 12:43:00 +0000 (7 14:43 +0200)]
gitweb: Allow line number toggling with Javascript
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Tue, 3 Aug 2010 19:01:08 +0000 (3 21:01 +0200)]
Give commit message reencoding for output on MinGW a chance
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Karsten Blees [Sat, 31 Jul 2010 00:04:03 +0000 (31 00:04 +0000)]
Warn if the Windows console font doesn't support Unicode
Unicode console output won't display correctly with default settings
because the default console font ("Terminal") only supports the system's
OEM charset. Unfortunately, this is a user specific setting, so it cannot
be easily fixed by e.g. some registry tricks in the setup program.
This change prints a warning on exit if console output contained non-ascii
characters and the console font is supposedly not a TrueType font (which
usually have decent Unicode support).
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Karsten Blees [Sat, 31 Jul 2010 00:04:02 +0000 (31 00:04 +0000)]
Detect console streams more reliably on Windows
GetStdHandle(STD_OUTPUT_HANDLE) doesn't work for stderr if stdout is
redirected. Use _get_osfhandle of the FILE* instead.
_isatty() is true for all character devices (including parallel and serial
ports). Check return value of GetConsoleScreenBufferInfo instead to
reliably detect console handles (also don't initialize internal state from
an uninitialized CONSOLE_SCREEN_BUFFER_INFO structure if the function
fails).
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Karsten Blees [Sat, 31 Jul 2010 00:04:01 +0000 (31 00:04 +0000)]
Support Unicode console output on Windows
WriteConsoleW seems to be the only way to reliably print unicode to the
console (without weird code page conversions).
Also redirects vfprintf to the winansi.c version.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Karsten Blees [Sat, 31 Jul 2010 00:04:00 +0000 (31 00:04 +0000)]
Enable color output in Windows cmd.exe
Git requires the TERM environment variable to be set for all color*
settings. Simulate the TERM variable if it is not set (default on Windows).
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Chris West (Faux) [Sun, 25 Jul 2010 23:36:19 +0000 (26 00:36 +0100)]
Fix another invocation of git from gitk with an overly long command-line
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Johannes Schindelin [Fri, 23 Jul 2010 16:06:05 +0000 (23 18:06 +0200)]
git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Eric Sunshine [Tue, 13 Jul 2010 16:19:52 +0000 (13 12:19 -0400)]
Make mingw_offset_1st_component() behave consistently for all paths.
mingw_offset_1st_component() returns "foo" for inputs "/foo" and
"c:/foo", but inconsistently returns "/foo" for UNC input
"/machine/share/foo". Fix it to return "foo" for all cases.
Reference: http://groups.google.com/group/msysgit/browse_thread/thread/
c0af578549b5dda0
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Erik Faye-Lund [Tue, 13 Jul 2010 14:23:58 +0000 (13 16:23 +0200)]
config.c: trivial fix for compile-time warning
The warning ("builtin/config.c:351: warning: initialization
discards qualifiers from pointer target type") was introduced
in commit
6754497c.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Cezary Zawadka [Tue, 13 Jul 2010 14:17:43 +0000 (13 16:17 +0200)]
Allow using UNC path for git repository
[efl: moved MinGW-specific part to compat/]
[jes: fixed compilation on non-Windows]
Signed-off-by: Cezary Zawadka <czawadka@gmail.com>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Heiko Voigt [Wed, 16 Jun 2010 18:11:00 +0000 (16 20:11 +0200)]
work around misdetection of stdin attached to a tty
Git on Windows was made aware of the fact that sometimes a file may be
used by another process and so an operation may fail but the user might
be able to fix it and is asking for confirmation whether it should
retry.
This is implemented in a way that git only asks in case stdin and stderr
are attached to a tty. Unfortunately this seems to be misdetected
sometimes causing the testsuite to hang when git is waiting for a user
answer.
This patch works around the situation.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Johannes Schindelin [Sat, 29 May 2010 19:50:11 +0000 (29 21:50 +0200)]
git am: ignore dirty submodules
This fixes a rebase in the presence of dirty submodules. This is
orthogonal to the application of patches changing submodules.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Fri, 11 Jun 2010 22:44:01 +0000 (12 00:44 +0200)]
t7602: cope with CR/LF
The output of git-merge-octopus has CR/LF line endings, so let's just
strip the CR out.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Tue, 1 Jun 2010 22:41:33 +0000 (2 00:41 +0200)]
Add a Windows-specific fallback to getenv("HOME");
This fixes msysGit issue 482 properly.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 26 May 2010 10:42:50 +0000 (26 12:42 +0200)]
mingw_rmdir: set errno=ENOTEMPTY when appropriate
On Windows, EACCES overrules ENOTEMPTY when calling rmdir(). But if the
directory is busy, we only want to retry deleting the directory if it
is empty, so test specifically for that case and set ENOTEMPTY rather
than EACCES.
Noticed by Greg Hazel.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
bert Dvornik [Sun, 23 May 2010 07:00:47 +0000 (23 03:00 -0400)]
send-email: handle Windows paths for display just like we do for processing
In git-send-email.perl, here are two checks to determine if
$smtp_server is an absolute path (so it'll be treated as a mailer) or
not (so it'll be treated as a hostname). The one that handles actual
mail processing has been taught to recognize Windows pathnames by
commit
33b2e81f.
The other check is just to tell the user what happened, so it's far
less important, but the current state is that we will still claim to
the user that c:/foo/bar is a server. =) This makes the second check
consistent with the first.
Signed-off-by: bert Dvornik <dvornik+git@gmail.com>
Erik Faye-Lund [Mon, 27 Jul 2009 19:05:40 +0000 (27 21:05 +0200)]
send-email: accept absolute path even on Windows
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
bert Dvornik [Mon, 26 Apr 2010 01:22:31 +0000 (25 21:22 -0400)]
mingw: Don't ask the user yes/no questions if they can't see the question.
If the stdout of the command is connected to a terminal but the stderr
has been redirected, the odds are good that the user can't see any
question we print out to stderr. This will result in a "mysterious
hang" while the app is waiting for user input.
It seems better to be conservative, and avoid asking for input
whenever the stderr is not a terminal, just like we do for stdin.
Signed-off-by: bert Dvornik <dvornik+git@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Mon, 16 Feb 2009 20:52:51 +0000 (16 21:52 +0100)]
Add a few more values for receive.denyCurrentBranch
For a long time, this developer thought that Git's insistence that
pushing into the current branch is evil was completely merited.
Just for fun, the original patch tried to show people that Git is right
there, and that it causes more trouble than it does good when Git allows
you to try to update the working tree for fast-forwards, or to detach the
HEAD, depending on some config settings.
Surprisingly, the opposite was shown.
So here is the support for two new options you can give the config
variable receive.denyCurrentBranch:
'updateInstead':
Try to merge the working tree with the new tip of the branch
(which can lead to really horrible merge conflicts).
'detachInstead':
Detach the HEAD, thereby avoiding a disagreement between the
HEAD and the index (as well as the working tree), possibly
leaving the local user wondering how on earth her HEAD became
so detached.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Wed, 7 Apr 2010 22:18:07 +0000 (8 00:18 +0200)]
Work around funny CR issue
This is really a problem with shell scripts being called on msysGit,
but there are more important bugs to fix for the moment.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Erik Faye-Lund [Thu, 18 Mar 2010 10:21:31 +0000 (18 10:21 +0000)]
mingw: do not hide bare repositories
As reported in msysGit issue 450 the recent change to set the windows
hidden attribute on the .git directory is being applied to bare git
directories. This patch excludes bare repositories.
Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Pat Thoyts [Thu, 18 Mar 2010 11:48:50 +0000 (18 11:48 +0000)]
mingw: add tests for the hidden attribute on the git directory
With msysGit the .git directory is supposed to be hidden, unless it is
a bare git repository. Test this.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Johannes Schindelin [Tue, 11 Aug 2009 00:22:33 +0000 (11 02:22 +0200)]
Work around the command line limit on Windows
On Windows, there are dramatic problems when a command line grows
beyond PATH_MAX, which is restricted to 8191 characters on XP and
later (according to http://support.microsoft.com/kb/830473).
Work around this by just cutting off the command line at that length
(actually, at a space boundary) in the hope that only negative
refs are chucked: gitk will then do unnecessary work, but that is
still better than flashing the gitk window and exiting with exit
status 5 (which no Windows user is able to make sense of).
The first fix caused Tcl to fail to compile the regexp, see msysGit issue
427. Here is another fix without using regexp, and using a more relaxed
command line length limit to fix the original issue 387.
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Heiko Voigt [Sun, 21 Feb 2010 20:05:04 +0000 (21 21:05 +0100)]
git-gui: provide question helper for retry fallback on Windows
Make use of the new environment variable GIT_ASK_YESNO to support the
recently implemented fallback in case unlink, rename or rmdir fail for
files in use on Windows. The added dialog will present a yes/no question
to the the user which will currently be used by the windows compat layer
to let the user retry a failed file operation.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Heiko Voigt [Thu, 25 Feb 2010 13:58:36 +0000 (25 14:58 +0100)]
mingw: add fallback for rmdir in case directory is in use
The same logic as for unlink and rename also applies to rmdir. For
example in case you have a shell open in a git controlled folder. This
will easily fail. So lets be nice for such cases as well.
Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Heiko Voigt [Sun, 21 Feb 2010 20:19:42 +0000 (21 21:19 +0100)]
mingw: make failures to unlink or move raise a question
On Windows in case a program is accessing a file unlink or
move operations may fail. To give the user a chance to correct
this we simply wait until the user asks us to retry or fail.
This is useful because of the following use case which seem
to happen rarely but when it does it is a mess:
After making some changes the user realizes that he was on the
incorrect branch. When trying to change the branch some file
is still in use by some other process and git stops in the
middle of changing branches. Now the user has lots of files
with changes mixed with his own. This is especially confusing
on repositories that contain lots of files.
Although the recent implementation of automatic retry makes
this scenario much more unlikely lets provide a fallback as
a last resort.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Heiko Voigt [Tue, 26 Jan 2010 20:48:45 +0000 (26 21:48 +0100)]
mingw: work around irregular failures of unlink on windows
If a file is opened by another process (e.g. indexing of an IDE) for
reading it is not allowed to be deleted. So in case unlink fails retry
after waiting for some time. This extends the workaround from
6ac6f878.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Heiko Voigt [Tue, 26 Jan 2010 20:17:36 +0000 (26 21:17 +0100)]
mingw: move unlink wrapper to mingw.c
The next patch implements a workaround in case unlink fails on Windows.
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Heiko Voigt [Thu, 18 Feb 2010 17:27:27 +0000 (18 18:27 +0100)]
Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit
a9fa11fe5bd5978bb175b3b5663f6477a345d428.
Johannes Sixt [Wed, 16 Sep 2009 14:06:53 +0000 (16 16:06 +0200)]
criss cross rename failure workaround
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sat, 9 Jan 2010 18:33:25 +0000 (9 19:33 +0100)]
When initializing .git/, record the current setting of core.hideDotFiles
This is on Windows only, of course.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Erik Faye-Lund [Wed, 16 Dec 2009 21:20:55 +0000 (16 22:20 +0100)]
core.hidedotfiles: hide '.git' dir by default
At least for cross-platform projects, it makes sense to hide the
files starting with a dot, as this is the behavior on Unix/MacOSX.
However, at least Eclipse has problems interpreting the hidden flag
correctly, so the default is to hide only the .git/ directory.
The config setting core.hideDotFiles therefore supports not only
'true' and 'false', but also 'dotGitOnly'.
[jes: clarified the commit message, made git init respect the setting
by marking the .git/ directory only after reading the config, and added
documentation, and rebased on top of current junio/next]
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Sebastian Schuberth [Mon, 28 Dec 2009 17:13:52 +0000 (28 18:13 +0100)]
MinGW: Add missing file mode bit defines
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Johannes Schindelin [Sat, 8 Jan 2011 00:47:45 +0000 (8 01:47 +0100)]
Do not compile compat/**/*.c with -Wold-style-definition
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin [Sat, 8 Jan 2011 00:46:41 +0000 (8 01:46 +0100)]
Fix old-style function declaration
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Junio C Hamano [Fri, 7 Jan 2011 23:27:25 +0000 (7 15:27 -0800)]
Merge branch 'master' into next
* master:
t9157-*.sh: Add an svn version check
git svn: fix the final example in man page
Ramsay Jones [Thu, 6 Jan 2011 18:29:23 +0000 (6 18:29 +0000)]
t9157-*.sh: Add an svn version check
Acked-by: Eric Wong <normalperson@yhbt.net>
Acked-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
StephenB [Thu, 6 Jan 2011 19:06:51 +0000 (6 19:06 +0000)]
git svn: fix the final example in man page
'git-remote add' creates a remote.origin.fetch entry in the config, we
want to replace this entry rather than add another one (which will
cause 'git fetch' to error).
This adds 'git config --remove-section remote.origin' after the fetch
for encouraging users to only use "git svn" for future updates.
[ew: rewording of commit message for present tense]
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: StephenB <mail4stb@gmail.com>
Johannes Schindelin [Mon, 12 Jan 2009 12:20:53 +0000 (12 13:20 +0100)]
Make CFLAGS more strict
This is a gcc-ism, but as we use gcc exclusively, we can use them.
Taken from one of Junio's mails. (Reminded to cherry-pick this patch
by one of Karsten Blees' mails.)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Junio C Hamano [Fri, 7 Jan 2011 00:40:09 +0000 (6 16:40 -0800)]
Merge branch 'master' into next
* master:
t3032: limit sed branch labels to 8 characters
t0001,t1510,t3301: use sane_unset which always returns with status 0
trace.c: ensure NULL is not passed to printf
Junio C Hamano [Fri, 7 Jan 2011 00:33:27 +0000 (6 16:33 -0800)]
Merge branch 'ef/alias-via-run-command' into next
* ef/alias-via-run-command:
alias: use run_command api to execute aliases
Erik Faye-Lund [Thu, 6 Jan 2011 23:00:38 +0000 (7 00:00 +0100)]
alias: use run_command api to execute aliases
On Windows, system() executes with cmd.exe instead of /bin/sh. This
means that aliases currently has to be batch-scripts instead of
bourne-scripts. On top of that, cmd.exe does not handle single quotes,
which is what the code-path currently uses to handle arguments with
spaces.
To solve both problems in one go, use run_command_v_opt() to execute
the alias. It already does the right thing prepend "sh -c " to the
alias.
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>
Brandon Casey [Thu, 6 Jan 2011 00:30:03 +0000 (5 18:30 -0600)]
t3032: limit sed branch labels to 8 characters
POSIX leaves as unspecified the handling of labels greater than 8
characters. Apparently, Sun decided to treat them as errors. Make sed on
Solaris happy by trimming the length of labels to 8 characters.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey [Thu, 6 Jan 2011 00:30:02 +0000 (5 18:30 -0600)]
t0001,t1510,t3301: use sane_unset which always returns with status 0
On some shells (like /usr/xpg4/bin/sh on Solaris), unset will exit
non-zero when passed the name of a variable that has not been set. Use
sane_unset instead so that the return value of unset can be ignored while
the && linkage of the test script can be preserved.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey [Thu, 6 Jan 2011 00:30:01 +0000 (5 18:30 -0600)]
trace.c: ensure NULL is not passed to printf
GNU printf, and many others, will print the string "(null)" if a NULL
pointer is passed as the argument to a "%s" format specifier. Some
implementations (like on Solaris) do not detect a NULL pointer and will
produce a segfault in this case.
So, fix this by ensuring that pointer variables do not contain the value
NULL. Assign the string "(null)" to the variables are NULL.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 5 Jan 2011 22:58:05 +0000 (5 14:58 -0800)]
Merge branch 'master' into next
* master:
Git 1.7.4-rc1
Git 1.7.3.5
t/t9001-send-email.sh: fix '&&' chain in some tests
Junio C Hamano [Wed, 5 Jan 2011 22:46:07 +0000 (5 14:46 -0800)]
Git 1.7.4-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 5 Jan 2011 22:50:33 +0000 (5 14:50 -0800)]
Merge branch 'maint' to sync with 1.7.3.5
Junio C Hamano [Wed, 5 Jan 2011 22:49:19 +0000 (5 14:49 -0800)]
Git 1.7.3.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 5 Jan 2011 22:25:07 +0000 (5 14:25 -0800)]
Merge branch 'sr/gitweb-hilite-more' into next
* sr/gitweb-hilite-more:
gitweb: remove unnecessary test when closing file descriptor
gitweb: add extensions to highlight feature map
Junio C Hamano [Wed, 5 Jan 2011 22:25:06 +0000 (5 14:25 -0800)]
Merge branch 'rj/svn-test' into next
* rj/svn-test:
lib-git-svn.sh: Move web-server handling code into separate function
Junio C Hamano [Wed, 5 Jan 2011 22:25:06 +0000 (5 14:25 -0800)]
Merge branch 'cb/setup' into next
* cb/setup:
setup: translate symlinks in filename when using absolute paths
Junio C Hamano [Wed, 5 Jan 2011 22:25:05 +0000 (5 14:25 -0800)]
Merge branch 'ae/better-template-failure-report' into next
* ae/better-template-failure-report:
Improve error messages when temporary file creation fails
Junio C Hamano [Wed, 5 Jan 2011 22:25:05 +0000 (5 14:25 -0800)]
Merge branch 'jn/cherry-pick-strategy-option' into next
* jn/cherry-pick-strategy-option:
cherry-pick/revert: add support for -X/--strategy-option
Junio C Hamano [Wed, 5 Jan 2011 22:25:05 +0000 (5 14:25 -0800)]
Merge branch 'jn/perl-funcname' into next
* jn/perl-funcname:
userdiff/perl: catch BEGIN/END/... and POD as headers
diff: funcname and word patterns for perl
Junio C Hamano [Wed, 5 Jan 2011 21:34:43 +0000 (5 13:34 -0800)]
Merge branch 'jn/svn-fe' (early part)
* 'jn/svn-fe' (early part):
vcs-svn: Error out for v3 dumps
Conflicts:
t/t9010-svn-fe.sh
Junio C Hamano [Wed, 5 Jan 2011 21:31:25 +0000 (5 13:31 -0800)]
Merge branch 'ao/t9001-fix'
* ao/t9001-fix:
t/t9001-send-email.sh: fix '&&' chain in some tests
Junio C Hamano [Wed, 5 Jan 2011 21:31:01 +0000 (5 13:31 -0800)]
Merge branch 'pw/convert-pathname-substitution'
* pw/convert-pathname-substitution:
t0021: avoid getting filter killed with SIGPIPE
convert filter: supply path to external driver
Junio C Hamano [Wed, 5 Jan 2011 21:30:29 +0000 (5 13:30 -0800)]
Merge branch 'mg/cvsimport'
* mg/cvsimport:
cvsimport: handle the parsing of uppercase config options
cvsimport: partial whitespace cleanup
Junio C Hamano [Wed, 5 Jan 2011 00:24:18 +0000 (4 16:24 -0800)]
Merge branch 'pw/convert-pathname-substitution' into next
* pw/convert-pathname-substitution:
t0021: avoid getting filter killed with SIGPIPE
convert filter: supply path to external driver
Junio C Hamano [Wed, 5 Jan 2011 00:24:17 +0000 (4 16:24 -0800)]
Merge branch 'mg/cvsimport' into next
* mg/cvsimport:
cvsimport: handle the parsing of uppercase config options
cvsimport: partial whitespace cleanup
Junio C Hamano [Wed, 5 Jan 2011 00:22:00 +0000 (4 16:22 -0800)]
Merge branch 'jn/svn-fe' (early part) into next
* 'jn/svn-fe' (early part):
vcs-svn: Error out for v3 dumps
Conflicts:
t/t9010-svn-fe.sh
Sylvain Rabot [Thu, 30 Dec 2010 21:20:29 +0000 (30 22:20 +0100)]
gitweb: remove unnecessary test when closing file descriptor
It happens that closing file descriptor fails whereas the blob is
perfectly readable. According to perlman the reasons could be:
If the file handle came from a piped open, "close" will additionally
return false if one of the other system calls involved fails, or if the
program exits with non-zero status. (If the only problem was that the
program exited non-zero, $! will be set to 0.) Closing a pipe also waits
for the process executing on the pipe to complete, in case you want to
look at the output of the pipe afterwards, and implicitly puts the exit
status value of that command into $?.
Prematurely closing the read end of a pipe (i.e. before the process writ-
ing to it at the other end has closed it) will result in a SIGPIPE being
delivered to the writer. If the other end can't handle that, be sure to
read all the data before closing the pipe.
In this case we don't mind that close fails.
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sylvain Rabot [Thu, 30 Dec 2010 21:20:28 +0000 (30 22:20 +0100)]
gitweb: add extensions to highlight feature map
added: sql, php5, phps, bash, zsh, ksh, mk, make
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>