Commit Graph

23555 Commits

Author SHA1 Message Date
Johannes Schindelin
79e130abc3 Rebasing merge to junio/next 2010-04-08 20:30:41 +02:00
Johannes Schindelin
8a0f36e728 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-04-08 20:30:40 +02:00
Johannes Schindelin
ac5636e11e Replace obsolete 'diff' call with 'test_cmp'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:39 +02:00
Johannes Schindelin
5bf7ce7bc9 grep -O: allow optional argument specifying the pager (or editor)
Suppose you want to edit all files that contain a specific search term.
Of course, you can do something totally trivial such as

	git grep -z -e <term> | xargs -0r vi +/<term>

but maybe you are happy that the same will be achieved by

	git grep -Ovi <term>

now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:39 +02:00
Johannes Schindelin
e1cf4f7b8b grep: Add the option '--open-files-in-pager'
This adds an option to open the matching files in the pager, and if the
pager happens to be "less" (or "vi") and there is only one grep pattern,
it also jumps to the first match right away.

The short option was chose as '-O' to avoid clashes with GNU grep's
options (as suggested by Junio).

So, 'git grep -O abc' is a short form for 'less +/abc $(grep -l abc)'
except that it works also with spaces in file names, and it does not
start the pager if there was no matching file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:38 +02:00
Johannes Schindelin
f46fcc176a Unify code paths of threaded greps
There were two awfully similar code paths ending the threaded grep. It
is better to avoid duplicated code, though.

This change might very well prevent a race, where the grep patterns were
free()d before waiting that all threads finished.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:37 +02:00
Johannes Schindelin
c5fc0e52b4 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-04-08 20:30:36 +02:00
Johannes Schindelin
78d757687c git-am: fix absolute path logic on Windows
This fixes t4150 on msysGit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:36 +02:00
Erik Faye-Lund
c8a1530575 mingw: fix st_mode for symlink dirs
When encountering symlinks, do_lstat() currently overwrites
buf->st_mode with S_IFREG if follow is true. This is incorrect
when the symlink points to a directory.

get_file_attr calls GetFileAttributesExA, which follows symlinks
already. So our st_mode should already be correct at this point.

Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
2010-04-08 20:30:35 +02:00
Erik Faye-Lund
acc5880a61 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-04-08 20:30:35 +02:00
Pat Thoyts
fd73c0b9bc 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-04-08 20:30:34 +02:00
Pat Thoyts
85e55a6565 Report errors when failing to launch the html browser in mingw.
The mingw function to launch the system html browser is silent if the
target file does not exist leaving the user confused. Make it display
something.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
2010-04-08 20:30:34 +02:00
Pat Thoyts
62f864990a fix mingw stat() and lstat() implementations for handling symlinks
In msysGit the stat() function has been implemented using mingw_lstat
which sets the st_mode member to S_IFLNK when a symbolic links is found.
This causes the is_executable function to return when git attempts to
build a list of available commands in the help code and we end up missing
most git commands. (msysGit issue #445)

This patch modifies the implementation so that lstat() will return the link
flag but if we are called as stat() we read the size of the target and set
the mode to that of a regular file.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-04-08 20:30:34 +02:00
Sebastian Schuberth
faeb863a7f gitk: Second try to work around the command line limit on Windows
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>
2010-04-08 20:30:33 +02:00
Johannes Schindelin
3b4f6cbfce gitk: work around ridiculous command line restriction 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).

This fixes msysGit issue 387.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:33 +02:00
Pat Thoyts
493461349d git-gui: Avoid using the <<Copy>> binding as a menu accelerator on win32
On Windows the Control-C binding is used to copy and is mapped to the Tk
virtual event <<Copy>>. In the initial git-gui dialog this is also bound
as an accelerator for the Clone menu item. The effect is that both bindings
run, copying the text but resetting the clone page or switching to the clone
page when the user tries to copy text from one of the entry fields.
This patch avoids this by using Control-L instead for Windows only.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-04-08 20:30:32 +02:00
Jens Lehmann
62cd93c1df gitk: Add shortcut Ctrl-W for closing the active window
To make the user experience between git gui and gitk more homogeneous, use
Ctrl-W in gitk too for closing the active window. When closing the main
window doquit is called for proper cleanup.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
2010-04-08 20:30:32 +02:00
Heiko Voigt
3876a4604a 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-04-08 20:30:31 +02:00
Heiko Voigt
9b275e71be 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-04-08 20:30:31 +02:00
Heiko Voigt
9da0cb5c86 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-04-08 20:30:30 +02:00
Heiko Voigt
1de940e399 git-gui: fix shortcut creation on cygwin
When the user tried to create a desktop icon with git gui on cygwin
wscript was complaining about an unknown option and displaying the
non-native path as such.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:30 +02:00
Heiko Voigt
ea928bad86 git-gui: fix PATH environment for mingw development environment
When creating a desktop shortcut from the gui the shortcut directly
starts wish with the git-gui script. In the msysgit development
environment some dll's reside in the mingw/bin directory which causes
that git can not start because libiconv2.dll is not found.

When using such a link the error is even more cryptic stating:
"child killed: unknown signal"

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:29 +02:00
Heiko Voigt
4e3c3a570d git-gui: fix usage of _gitworktree when creating shortcut for windows
This fixes msysGit issue 425.

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:29 +02:00
Markus Heidelberg
1c73b79894 git-gui: fix "Explore Working Copy" for Windows again
It has already been fixed in commit 454efb47 (git-gui (Win): make
"Explore Working Copy" more robust, 2009-04-01), but has been broken in
commit 21985a11 (git-gui: handle non-standard worktree locations,
2010-01-23) by accidentally replacing too much with a new variable.

The problem can be reproduced when starting git-gui from within a
subdirectory. The solution is to convert the path name, explorer.exe is
invoked with, to a platform native name.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
2010-04-08 20:30:28 +02:00
Heiko Voigt
f0849bf809 git-gui: check whether systems nice command works or disable it
This fixes issue 394 from msysgit. It seems that the Gnuwin32 project
provides a nice command but it returns a "not implemented" error. To
help users we now try to execute once and disable it in case it fails.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-04-08 20:30:28 +02:00
Heiko Voigt
2ec79df990 git-gui: fix usage of themed widgets variable
There was one forgotten global so NS was not visible to the method
which resulted in an error.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
2010-04-08 20:30:28 +02:00
Pat Thoyts
fae5dc25a7 Handle failure of core.worktree to identify the working directory.
Commit 21985a11 'git-gui: handle non-standard worktree locations' attempts
to use either GIT_WORK_TREE or core.worktree to set the _gitworktree
variable but these may not be set which leads to a failure to launch
gitk to review history. Use _gitdir to set the location for a standard
git layout where the parent of the .git directory is the working tree.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-04-08 20:30:27 +02:00
Heiko Voigt
1de9be03d5 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-04-08 20:30:27 +02:00
Heiko Voigt
87635ed045 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-04-08 20:30:26 +02:00
Heiko Voigt
26c00eab4d Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit a9fa11fe5b.
2010-04-08 20:30:26 +02:00
Pat Thoyts
67bb5597ea Skip t1300.70 and 71 on msysGit.
These two tests fail on msysGit because /dev/null is an alias for nul on
Windows and when reading the value back from git config the alias does
not match the real filename. Also the HOME environment variable has a
unix-style path but git returns a native equivalent path for '~'.  As
these are platform-dependent equivalent results it seems simplest to
skip the test entirely.

Signed-off-by: Pat Thoyts <patthoyts <at> users.sourceforge.net>
2010-04-08 20:30:25 +02:00
Johannes Sixt
27156a29cc criss cross rename failure workaround
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:25 +02:00
Johannes Schindelin
41bc9dba9f Revert "git am: accept patches downloaded from GMane"
This reverts commit 127aa63757.  As pointed
out by Junio, this patch was obsoleted by 0fcb2ca.
2010-04-08 20:30:24 +02:00
Johannes Schindelin
38ab60d7e5 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-04-08 20:30:24 +02:00
Erik Faye-Lund
891b3d11b1 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-04-08 20:30:23 +02:00
Sebastian Schuberth
7574d99881 MinGW: Add missing file mode bit defines
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2010-04-08 20:30:23 +02:00
Sebastian Schuberth
11bcc68dc9 MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2010-04-08 20:30:23 +02:00
Johannes Schindelin
3998051fa3 Avoid TAGS/tags warning from GNU Make
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:22 +02:00
Johannes Schindelin
96cfcbb227 git am: accept patches downloaded from GMane
GMane has this wonderful feature that you can download the raw mails,
but the mails do not fully conform to the mbox format, as they do not
start with a "From ..." line.

But they start with another tell tale we can easily detect.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 20:30:22 +02:00
Johannes Schindelin
3bb030015f 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-04-08 19:38:07 +02:00
Johannes Schindelin
0fff3fe822 Replace obsolete 'diff' call with 'test_cmp'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 19:14:50 +02:00
Johannes Schindelin
65b2c099be Fix rebase of grep-O
grep no longer wants setup to be run already.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-08 19:13:36 +02:00
Johannes Schindelin
add8f7132e Merge remote branch 'origin/work/grep-O' into devel 2010-04-08 00:36:15 +02:00
Junio C Hamano
8b27e1648d Merge branch 'master' into next
* master:
  fix typos and grammar in 1.7.1 draft release notes
2010-04-07 15:35:16 -07:00
Junio C Hamano
02125bcc41 Merge branch 'mg/notes-reflog'
* mg/notes-reflog:
  refs.c: Write reflogs for notes just like for branch heads
  t3301-notes: Test the creation of reflog entries
2010-04-07 15:34:09 -07:00
Junio C Hamano
d6b5af6d76 Merge branch 'jn/mailinfo-scissors'
* jn/mailinfo-scissors:
  Teach mailinfo %< as an alternative scissors mark
2010-04-07 15:34:06 -07:00
Junio C Hamano
8ccf40ac43 Merge branch 'jc/test-sleepless' into next
* jc/test-sleepless:
  war on "sleep" in tests
2010-04-07 15:33:34 -07:00
Junio C Hamano
701e863089 Merge branch 'ab/commit-empty-message' into next
* ab/commit-empty-message:
  Add option to git-commit to allow empty log messages
2010-04-07 15:33:34 -07:00
Junio C Hamano
7f5c112394 Merge branch 'eb/unpretty-b-format' into next
* eb/unpretty-b-format:
  Add `%B' in format strings for raw commit body in `git log' and friends
2010-04-07 15:33:34 -07:00
Junio C Hamano
e50fd3a92e Merge branch 'ar/config-from-command-line' into next
* ar/config-from-command-line:
  Use strbufs instead of open-coded string manipulation
  Allow passing of configuration parameters in the command line
2010-04-07 15:33:34 -07:00