Commit Graph

22115 Commits

Author SHA1 Message Date
Johannes Schindelin
66eac8a919 Replace obsolete 'diff' call with 'test_cmp'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-12 14:56:22 +02:00
Johannes Schindelin
78577c6a9f 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-12 14:56:21 +02:00
Johannes Schindelin
6a5eac6a31 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-12 14:56:21 +02:00
Johannes Schindelin
e1a0ad012b 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-12 14:56:20 +02:00
Johannes Schindelin
d3c402ff43 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-12 14:56:20 +02:00
Johannes Schindelin
756a719c58 git-am: fix absolute path logic on Windows
This fixes t4150 on msysGit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-12 14:56:19 +02:00
Erik Faye-Lund
f971b94480 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-12 14:56:19 +02:00
Erik Faye-Lund
6e5ac68edf 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-12 14:56:19 +02:00
Pat Thoyts
4eb7315e35 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-12 14:56:18 +02:00
Pat Thoyts
f67e4f300f 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-12 14:56:18 +02:00
Pat Thoyts
3a8fc9256d 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-12 14:56:17 +02:00
Sebastian Schuberth
c57b92c1a1 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-12 14:56:17 +02:00
Johannes Schindelin
38cda0b0de 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-12 14:56:16 +02:00
Pat Thoyts
6f75a58a47 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-12 14:56:16 +02:00
Jens Lehmann
e7eaa7114a 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-12 14:56:15 +02:00
Heiko Voigt
8fa3c5f743 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-12 14:56:15 +02:00
Heiko Voigt
2defae3462 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-12 14:56:14 +02:00
Heiko Voigt
a2b220086b 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-12 14:56:14 +02:00
Heiko Voigt
1a3910eb8c 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-12 14:56:13 +02:00
Heiko Voigt
435584e2a4 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-12 14:56:13 +02:00
Heiko Voigt
a195394b83 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-12 14:56:13 +02:00
Markus Heidelberg
a11a60a4f2 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-12 14:56:12 +02:00
Heiko Voigt
19c1cd04e4 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-12 14:56:12 +02:00
Heiko Voigt
14bd669336 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-12 14:56:11 +02:00
Pat Thoyts
4fd6984e82 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-12 14:56:11 +02:00
Heiko Voigt
88d1dbe696 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-12 14:56:10 +02:00
Heiko Voigt
a92d8e3484 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-12 14:56:10 +02:00
Heiko Voigt
6192be5ce6 Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit a9fa11fe5b.
2010-04-12 14:56:09 +02:00
Pat Thoyts
92d03c49d0 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-12 14:56:09 +02:00
Johannes Sixt
98bd4ad497 criss cross rename failure workaround
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-12 14:56:08 +02:00
Johannes Schindelin
a4b6862547 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-12 14:56:08 +02:00
Johannes Schindelin
aa86b307a6 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-12 14:56:07 +02:00
Erik Faye-Lund
0a4d61c121 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-12 14:56:07 +02:00
Sebastian Schuberth
1cc3c02fdc MinGW: Add missing file mode bit defines
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2010-04-12 14:56:06 +02:00
Sebastian Schuberth
2ee859df0b MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2010-04-12 14:56:06 +02:00
Johannes Schindelin
c99542f51b Avoid TAGS/tags warning from GNU Make
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2010-04-12 14:56:06 +02:00
Johannes Schindelin
9c63503c92 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-12 14:56:05 +02:00
Junio C Hamano
e1730fbcd4 Merge branch 'np/malloc-threading' into next
* np/malloc-threading:
  Thread-safe xmalloc and xrealloc needs a recursive mutex
  Make xmalloc and xrealloc thread-safe
2010-04-10 17:27:38 -07:00
Junio C Hamano
cd4e8cf7dc Merge branch 'jc/doc-submit-gmail' into next
* jc/doc-submit-gmail:
  SubmittingPatches: update GMail section
2010-04-10 17:27:38 -07:00
Junio C Hamano
c76b8ba913 Merge branch 'master' into next
* master:
  Git 1.7.1-rc1
  Teach diff --submodule and status to handle .git files in submodules
2010-04-10 13:16:48 -07:00
Junio C Hamano
b9aa901856 Git 1.7.1-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.1-rc1
2010-04-10 13:05:16 -07:00
Junio C Hamano
b92cbb62de Merge branch 'mr/gitweb-jsmin'
* mr/gitweb-jsmin:
  gitweb: update INSTALL to use shorter make target
  gitweb: add documentation to INSTALL regarding gitweb.js
  instaweb: add minification awareness
  Gitweb: add autoconfigure support for minifiers
  Gitweb: add support for minifying gitweb.css
  Gitweb: add ignore and clean rules for minified files
2010-04-10 13:02:22 -07:00
Junio C Hamano
055e1e2969 Merge branch 'jl/maint-submodule-gitfile-awareness'
* jl/maint-submodule-gitfile-awareness:
  Teach diff --submodule and status to handle .git files in submodules
2010-04-10 12:13:46 -07:00
Jens Lehmann
eee49b6ce4 Teach diff --submodule and status to handle .git files in submodules
The simple test for an existing .git directory gives an incorrect result
if .git is a file that records "gitdir: overthere". So for submodules that
use a .git file, "git status" and the diff family - when the "--submodule"
option is given - did assume the submodule was not populated at all when
a .git file was used, thus generating wrong output or no output at all.

This is fixed by using read_gitfile_gently() to get the correct location
of the .git directory. While at it, is_submodule_modified() was cleaned up
to use the "dir" member of "struct child_process" instead of setting the
GIT_WORK_TREE and GIT_DIR environment variables.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-10 11:51:56 -07:00
Junio C Hamano
94f6e3de72 Merge branch 'sr/remote-helper-export' into next
* sr/remote-helper-export:
  Makefile: Simplify handling of python scripts

Conflicts:
	Makefile
2010-04-09 22:45:56 -07:00
Junio C Hamano
fab94c6899 Merge branch 'master' into next
* master:
  Let check_preimage() use memset() to initialize "struct checkout"
  fetch/push: fix usage strings
  branch: say "Reset to" in reflog entries for 'git branch -f' operations
2010-04-09 22:45:51 -07:00
Junio C Hamano
3b0c19663e Merge branch 'maint'
* maint:
  Let check_preimage() use memset() to initialize "struct checkout"
  fetch/push: fix usage strings
2010-04-09 22:43:18 -07:00
Jens Lehmann
54fd955c21 Let check_preimage() use memset() to initialize "struct checkout"
Every code site except check_preimage() uses either memset() or declares
a static instance of "struct checkout" to achieve proper initialization.
Lets use memset() instead of explicit initialization of all members here
too to be on the safe side in case this structure is expanded someday.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-09 22:42:57 -07:00
Junio C Hamano
408dee5222 Merge branch 'ef/maint-empty-commit-log' into maint
* ef/maint-empty-commit-log:
  rev-list: fix --pretty=oneline with empty message
2010-04-09 22:38:53 -07:00
Junio C Hamano
daaf2e8892 Merge branch 'jc/conflict-marker-size' into maint
* jc/conflict-marker-size:
  diff --check: honor conflict-marker-size attribute
2010-04-09 22:38:34 -07:00