Commit Graph

27332 Commits

Author SHA1 Message Date
Johannes Schindelin
4f4ef24e34 Do not compile compat/**/*.c with -Wold-style-definition
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2011-01-08 01:49:36 +01:00
Johannes Schindelin
88090de226 Fix old-style function declaration
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2011-01-08 01:49:35 +01:00
Johannes Schindelin
905ba54087 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>
2011-01-07 02:23:06 +01:00
Johannes Schindelin
0b44847a52 Rebasing merge to junio/next (a2bc419) 2010-12-28 18:56:13 +01:00
Eric Sunshine
f3b86ef5dd 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>
2010-12-28 18:56:11 +01:00
Johannes Schindelin
8e7ccdb919 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>
2010-12-28 18:56:11 +01:00
Johannes Schindelin
b354289fb6 Let deny.currentBranch=updateInstead ignore submodules
They are not affected by the update anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:11 +01:00
Johannes Schindelin
474b58f146 add -e: ignore dirty submodules
We cannot add untracked/modified files in submodules anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:10 +01:00
Johannes Schindelin
7441cb3601 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>
2010-12-28 18:56:10 +01:00
Johannes Schindelin
62af20ec64 Gitweb: make line number toggling work for Firefox and Safari
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:10 +01:00
Johannes Schindelin
db32606561 gitweb: Allow line number toggling with Javascript
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:09 +01:00
Johannes Schindelin
b3eb4db82f Give commit message reencoding for output on MinGW a chance
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:09 +01:00
Karsten Blees
f15bcee1ce 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>
2010-12-28 18:56:09 +01:00
Karsten Blees
3d095028b8 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>
2010-12-28 18:56:08 +01:00
Karsten Blees
d52d27e225 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>
2010-12-28 18:56:08 +01:00
Karsten Blees
93e4be8886 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>
2010-12-28 18:56:08 +01:00
Chris West (Faux)
504b3c2a63 Fix another invocation of git from gitk with an overly long command-line
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2010-12-28 18:56:08 +01:00
Johannes Schindelin
bacbd75261 git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:07 +01:00
Eric Sunshine
255256af1b 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>
2010-12-28 18:56:07 +01:00
Erik Faye-Lund
af670f34a7 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>
2010-12-28 18:56:07 +01:00
Cezary Zawadka
fa0722955d 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>
2010-12-28 18:56:06 +01:00
Heiko Voigt
a36c3b2eb4 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>
2010-12-28 18:56:06 +01:00
Johannes Schindelin
d4cd980b75 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>
2010-12-28 18:56:06 +01:00
Johannes Schindelin
2f3171f7ec 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>
2010-12-28 18:56:06 +01:00
Johannes Schindelin
9164924e44 Add a Windows-specific fallback to getenv("HOME");
This fixes msysGit issue 482 properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:05 +01:00
Johannes Schindelin
7037f5e854 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>
2010-12-28 18:56:05 +01:00
bert Dvornik
984163566c 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>
2010-12-28 18:56:05 +01:00
Erik Faye-Lund
0ce7ec1aba send-email: accept absolute path even on Windows
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:04 +01:00
bert Dvornik
df20bd408d 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>
2010-12-28 18:56:04 +01:00
Johannes Schindelin
b99eac90a6 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>
2010-12-28 18:56:04 +01:00
Johannes Schindelin
ba7f6cf93e 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>
2010-12-28 18:56:03 +01:00
Erik Faye-Lund
fe93761f1f 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>
2010-12-28 18:56:03 +01:00
Pat Thoyts
7cf4eb40c9 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>
2010-12-28 18:56:03 +01:00
Johannes Schindelin
5a94fdc803 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>
2010-12-28 18:56:02 +01:00
Heiko Voigt
d8fe30124b 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>
2010-12-28 18:56:02 +01:00
Heiko Voigt
2357080411 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>
2010-12-28 18:56:02 +01:00
Heiko Voigt
13806825d1 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>
2010-12-28 18:56:01 +01:00
Heiko Voigt
3a31964ac2 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>
2010-12-28 18:56:01 +01:00
Heiko Voigt
d32ac57d53 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>
2010-12-28 18:56:01 +01:00
Heiko Voigt
786e04bd83 Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit a9fa11fe5b.
2010-12-28 18:56:00 +01:00
Johannes Sixt
9f3b1ebbd6 criss cross rename failure workaround
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-12-28 18:56:00 +01:00
Johannes Schindelin
2c44b0281b 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>
2010-12-28 18:56:00 +01:00
Erik Faye-Lund
adb8bdce7e 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>
2010-12-28 18:56:00 +01:00
Sebastian Schuberth
68d2aefba3 MinGW: Add missing file mode bit defines
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2010-12-28 18:55:59 +01:00
Junio C Hamano
a2bc419662 Merge branch 'nd/setup' into next
* nd/setup: (46 commits)
  git.txt: correct where --work-tree path is relative to
  Revert "Documentation: always respect core.worktree if set"
  t0001: test git init when run via an alias
  Remove all logic from get_git_work_tree()
  setup: rework setup_explicit_git_dir()
  setup: clean up setup_discovered_git_dir()
  t1020-subdirectory: test alias expansion in a subdirectory
  setup: clean up setup_bare_git_dir()
  setup: limit get_git_work_tree()'s to explicit setup case only
  Use git_config_early() instead of git_config() during repo setup
  Add git_config_early()
  git-rev-parse.txt: clarify --git-dir
  t1510: setup case #31
  t1510: setup case #30
  t1510: setup case #29
  t1510: setup case #28
  t1510: setup case #27
  t1510: setup case #26
  t1510: setup case #25
  t1510: setup case #24
  ...
2010-12-23 15:46:52 -08:00
Junio C Hamano
fd4361f275 Merge branch 'jc/maint-rebase-rewrite-last-skip' into next
* jc/maint-rebase-rewrite-last-skip:
  rebase --skip: correctly wrap-up when skipping the last patch
2010-12-23 15:46:52 -08:00
Junio C Hamano
32c2264b40 Merge branch 'master' into next
* master:
  Makefile: add NO_FNMATCH_CASEFOLD to IRIX sections
  test-lib.sh/test_decode_color(): use octal not hex in awk script
2010-12-23 12:51:22 -08:00
Junio C Hamano
73e7b2ef6c Merge branch 'rj/maint-difftool-cygwin-workaround'
* rj/maint-difftool-cygwin-workaround:
  difftool: Fix failure on Cygwin
2010-12-23 12:51:11 -08:00
Junio C Hamano
4e3a1b24ad Merge branch 'maint'
* maint:
  test-lib.sh/test_decode_color(): use octal not hex in awk script
2010-12-22 20:33:12 -08:00
Brandon Casey
19128d6cd8 Makefile: add NO_FNMATCH_CASEFOLD to IRIX sections
IRIX's fnmatch() does not support the GNU FNM_CASEFOLD extension, so set
NO_FNMATCH_CASEFOLD so that the internal fnmatch implementation will be
used.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 19:56:02 -08:00