Commit graph

27067 commits

Author SHA1 Message Date
Junio C Hamano e2d0a2e440 Merge branch 'jk/maint-fetch-submodule-check-fix' into maint
* jk/maint-fetch-submodule-check-fix:
  fetch: avoid quadratic loop checking for updated submodules
2011-10-15 20:46:38 -07:00
Junio C Hamano 8f858299b5 Merge branch 'tr/mergetool-valgrind' into maint
* tr/mergetool-valgrind:
  Symlink mergetools scriptlets into valgrind wrappers
2011-10-15 20:46:37 -07:00
Junio C Hamano 7c4f050ae1 Merge branch 'nm/grep-object-sha1-lock' into maint
* nm/grep-object-sha1-lock:
  grep: Fix race condition in delta_base_cache

Conflicts:
	builtin/grep.c
2011-10-15 20:46:37 -07:00
Junio C Hamano fc26f57b84 Merge branch 'jc/diff-index-unpack' into maint
* jc/diff-index-unpack:
  diff-index: pass pathspec down to unpack-trees machinery
  unpack-trees: allow pruning with pathspec
  traverse_trees(): allow pruning with pathspec
2011-10-15 20:46:36 -07:00
Junio C Hamano 57ded055c4 Merge branch 'mm/rebase-i-exec-edit' into maint
* mm/rebase-i-exec-edit:
  rebase -i: notice and warn if "exec $cmd" modifies the index or the working tree
  rebase -i: clean error message for --continue after failed exec
2011-10-15 20:46:36 -07:00
Matthew Daley 155b940f7a send-email: Honour SMTP domain when using TLS
git-send-email sends two SMTP EHLOs when using TLS encryption, however
only the first, unencrypted EHLO uses the SMTP domain that can be
optionally specified by the user (--smtp-domain).  This is because the
call to hello() that produces the second, encrypted EHLO does not pass
the SMTP domain as an argument, and hence a default of
'localhost.localdomain' is used instead.

Fix by passing in the SMTP domain in this call.

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15 20:33:04 -07:00
Junio C Hamano efe7aecbce Merge branch 'jc/grep-untracked-exclude'
* jc/grep-untracked-exclude:
  grep: fix the error message that mentions --exclude
2011-10-15 20:27:19 -07:00
Junio C Hamano 9fddaf7896 Merge branch 'jc/maint-grep-untracked-exclude' into jc/grep-untracked-exclude
* jc/maint-grep-untracked-exclude:
  grep: fix the error message that mentions --exclude

Conflicts:
	builtin/grep.c
2011-10-15 20:26:52 -07:00
Bert Wesarg 92e61831fb grep: fix the error message that mentions --exclude
Missing rename from --exclude to --standard-exclude.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15 20:25:21 -07:00
Pat Thoyts f64943d242 t9901: fix line-ending dependency on windows
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15 20:17:32 -07:00
Pat Thoyts 13d24b018f mingw: ensure sockets are initialized before calling gethostname
If the Windows sockets subsystem has not been initialized yet then an
attempt to get the hostname returns an error and prints a warning to the
console. This solves this issue for msysGit as seen with 'git fetch'.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15 20:14:39 -07:00
Pat Thoyts 8850c3da95 mergetools: use the correct tool for Beyond Compare 3 on Windows
On Windows the bcompare tool launches a graphical program and does
not wait for it to terminate. A separate 'bcomp' tool is provided which
will wait for the view to exit so we use this instead.

Reported-by: Werner BEROUX <werner@beroux.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15 20:13:55 -07:00
Bert Wesarg 843d6597fb git-gui: incremental goto line in blame view
The view jumps now to the given line number after each key press.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-10-15 23:14:13 +01:00
Bert Wesarg 81a92e5205 git-gui: clear the goto line input when hiding
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-10-15 23:14:13 +01:00
Bert Wesarg 59252107ac git-gui: only accept numbers in the goto-line input
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-10-15 23:13:32 +01:00
Bert Wesarg e0e0a6c64c git-gui: search and linenumber input are mutual exclusive in the blame view
It was possible to open the search input (Ctrl+S) and the goto-line input
(Ctrl+G) at the same time. Prevent this.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-10-15 09:13:33 +01:00
Johannes Schindelin b52612ed4f t9300: do not run --cat-blob-fd related tests on MinGW
As diagnosed by Johannes Sixt, msys.dll does not hand through file
descriptors > 2 to child processes, so these test cases cannot passes when
run through an MSys bash.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 22:46:45 -07:00
Sebastian Schuberth 184892fb3e git-svn: On MSYS, escape and quote SVN_SSH also if set by the user
While GIT_SSH does not require any escaping / quoting (e.g. for paths
containing spaces), SVN_SSH requires it due to its use in a Perl script.

Previously, SVN_SSH has only been escaped and quoted automatically if it
was unset and thus derived from GIT_SSH. For user convenience, do the
escaping and quoting also for a SVN_SSH set by the user. This way, the
user is able to use the same unescaped and unquoted syntax for GIT_SSH
and SVN_SSH.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 22:38:15 -07:00
Johannes Schindelin 72b5158b25 t9001: do not fail only due to CR/LF issues
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 22:37:58 -07:00
Johannes Schindelin 9931df3fa9 t1020: disable the pwd test on MinGW
It fails both for line ending and for DOS path reasons.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 22:37:29 -07:00
Cord Seele 463b0ea22b send-email: Fix %config_path_settings handling
cec5dae (use new Git::config_path() for aliasesfile, 2011-09-30) broke
the expansion of aliases.

This was caused by treating %config_path_settings, newly introduced in
said patch, like %config_bool_settings instead of like %config_settings.
Copy from %config_settings, making it more readable.

While at it add basic test for expansion of aliases, and for path
expansion, which would catch this error.

Nb. there were a few issues that were responsible for this error:

1. %config_bool_settings and %config_settings despite similar name have
   different semantic.

   %config_bool_settings values are arrays where the first element is
   (reference to) the variable to set, and second element is default
   value... which admittedly is a bit cryptic.  More readable if more
   verbose option would be to use hash reference, e.g.:

        my %config_bool_settings = (
            "thread" => { variable => \$thread, default => 1},
            [...]

   %config_settings values are either either reference to scalar variable
   or reference to array.  In second case it means that option (or config
   option) is multi-valued.  BTW. this is similar to what Getopt::Long does.

2. In cec5dae (use new Git::config_path() for aliasesfile, 2011-09-30)
   the setting "aliasesfile" was moved from %config_settings to newly
   introduced %config_path_settings.  But the loop that parses settings
   from %config_path_settings was copy'n'pasted *wrongly* from
   %config_bool_settings instead of from %config_settings.

   It looks like cec5dae author cargo-culted this change...

3. 994d6c6 (send-email: address expansion for common mailers, 2006-05-14)
   didn't add test for alias expansion to t9001-send-email.sh

Signed-off-by: Cord Seele <cowose@gmail.com>
Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 14:45:49 -07:00
Junio C Hamano cf8ddeead9 Merge branch 'maint'
* maint:
  t1304: fall back to $USER if $LOGNAME is not defined
2011-10-14 12:51:24 -07:00
Jeff King 58a6a9cc43 downgrade "packfile cannot be accessed" errors to warnings
These can happen if another process simultaneously prunes a
pack. But that is not usually an error condition, because a
properly-running prune should have repacked the object into
a new pack. So we will notice that the pack has disappeared
unexpectedly, print a message, try other packs (possibly
after re-scanning the list of packs), and find it in the new
pack.

Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 11:43:09 -07:00
Jeff King 4c08018204 pack-objects: protect against disappearing packs
It's possible that while pack-objects is running, a
simultaneously running prune process might delete a pack
that we are interested in. Because we load the pack indices
early on, we know that the pack contains our item, but by
the time we try to open and map it, it is gone.

Since c715f78, we already protect against this in the normal
object access code path, but pack-objects accesses the packs
at a lower level.  In the normal access path, we call
find_pack_entry, which will call find_pack_entry_one on each
pack index, which does the actual lookup. If it gets a hit,
we will actually open and verify the validity of the
matching packfile (using c715f78's is_pack_valid). If we
can't open it, we'll issue a warning and pretend that we
didn't find it, causing us to go on to the next pack (or on
to loose objects).

Furthermore, we will cache the descriptor to the opened
packfile. Which means that later, when we actually try to
access the object, we are likely to still have that packfile
opened, and won't care if it has been unlinked from the
filesystem.

Notice the "likely" above. If there is another pack access
in the interim, and we run out of descriptors, we could
close the pack. And then a later attempt to access the
closed pack could fail (we'll try to re-open it, of course,
but it may have been deleted). In practice, this doesn't
happen because we tend to look up items and then access them
immediately.

Pack-objects does not follow this code path. Instead, it
accesses the packs at a much lower level, using
find_pack_entry_one directly. This means we skip the
is_pack_valid check, and may end up with the name of a
packfile, but no open descriptor.

We can add the same is_pack_valid check here. Unfortunately,
the access patterns of pack-objects are not quite as nice
for keeping lookup and object access together. We look up
each object as we find out about it, and the only later when
writing the packfile do we necessarily access it. Which
means that the opened packfile may be closed in the interim.

In practice, however, adding this check still has value, for
three reasons.

  1. If you have a reasonable number of packs and/or a
     reasonable file descriptor limit, you can keep all of
     your packs open simultaneously. If this is the case,
     then the race is impossible to trigger.

  2. Even if you can't keep all packs open at once, you
     may end up keeping the deleted one open (i.e., you may
     get lucky).

  3. The race window is shortened. You may notice early that
     the pack is gone, and not try to access it. Triggering
     the problem without this check means deleting the pack
     any time after we read the list of index files, but
     before we access the looked-up objects.  Triggering it
     with this check means deleting the pack means deleting
     the pack after we do a lookup (and successfully access
     the packfile), but before we access the object. Which
     is a smaller window.

Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 11:42:37 -07:00
René Scharfe ac2604cf5f t1304: fall back to $USER if $LOGNAME is not defined
For some reason $LOGNAME is not set anymore for me after an upgrade from
Ubuntu 11.04 to 11.10.  Use $USER in such a case.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 11:41:28 -07:00
Junio C Hamano 15a31e7885 t7800: avoid arithmetic expansion notation
The construct "var=$(( something ..." is interpreted by some shells as
arithmetic expansion, even when it clearly is not, e.g.

	var=$((foo; bar) | baz)

Avoid the issue by giving an extra SP to help the parser, i.e.

	var=$( (foo; bar) | baz )

Noticed by Michael J Gruber.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14 11:11:30 -07:00
Junio C Hamano c9e7aa4f68 Update draft release notes to 1.7.8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 22:18:04 -07:00
Junio C Hamano b73c6834dd Merge branch 'js/maint-merge-one-file-osx-expr'
* js/maint-merge-one-file-osx-expr:
  merge-one-file: fix "expr: non-numeric argument"
2011-10-13 19:03:24 -07:00
Junio C Hamano 3022386fee Merge branch 'jn/ident-from-etc-mailname'
* jn/ident-from-etc-mailname:
  ident: do not retrieve default ident when unnecessary
  ident: check /etc/mailname if email is unknown
2011-10-13 19:03:24 -07:00
Junio C Hamano 1810abb994 Merge branch 'il/archive-err-signal'
* il/archive-err-signal:
  Support ERR in remote archive like in fetch/push
2011-10-13 19:03:23 -07:00
Junio C Hamano ab1e76b88c Merge branch 'jc/grep-untracked-exclude'
* jc/grep-untracked-exclude:
  grep: teach --untracked and --exclude-standard options
2011-10-13 19:03:23 -07:00
Junio C Hamano 7a63a920fd Merge branch 'rs/diff-cleanup-records-fix'
* rs/diff-cleanup-records-fix:
  diff: resurrect XDF_NEED_MINIMAL with --minimal
  Revert removal of multi-match discard heuristic in 27af01
2011-10-13 19:03:22 -07:00
Junio C Hamano 0941d60545 Merge branch 'rs/pending'
* rs/pending:
  commit: factor out clear_commit_marks_for_object_array
  checkout: use leak_pending flag
  bundle: use leak_pending flag
  bisect: use leak_pending flag
  revision: add leak_pending flag
  checkout: use add_pending_{object,sha1} in orphan check
  revision: factor out add_pending_sha1
  checkout: check for "Previous HEAD" notice in t2020

Conflicts:
	builtin/checkout.c
	revision.c
2011-10-13 19:03:22 -07:00
Junio C Hamano dd57c76e84 Merge branch 'jn/no-g-plus-s-on-bsd'
* jn/no-g-plus-s-on-bsd:
  Makefile: do not set setgid bit on directories on GNU/kFreeBSD
2011-10-13 19:03:21 -07:00
Junio C Hamano 8b482c0ccc Merge branch 'jc/is-url-simplify'
* jc/is-url-simplify:
  url.c: simplify is_url()
2011-10-13 19:03:21 -07:00
Junio C Hamano 522a54568e Merge branch 'nd/git-daemon-error-msgs'
* nd/git-daemon-error-msgs:
  daemon: return "access denied" if a service is not allowed
2011-10-13 19:03:21 -07:00
Junio C Hamano 719c09fdad Merge branch 'nd/daemon-log-sock-errors'
* nd/daemon-log-sock-errors:
  daemon: log errors if we could not use some sockets
2011-10-13 19:03:21 -07:00
Junio C Hamano 8626238800 Merge branch 'cp/git-web-browse-browsers'
* cp/git-web-browse-browsers:
  git-web--browse: avoid the use of eval
2011-10-13 19:03:20 -07:00
Junio C Hamano 89dfd2dfbf Merge branch 'jc/apply-blank-at-eof-fix'
* jc/apply-blank-at-eof-fix:
  apply --whitespace=error: correctly report new blank lines at end
2011-10-13 19:03:20 -07:00
Junio C Hamano c13975e7fd Merge branch 'di/fast-import-empty-tag-note-fix'
* di/fast-import-empty-tag-note-fix:
  fast-import: don't allow to note on empty branch
  fast-import: don't allow to tag empty branch
2011-10-13 19:03:19 -07:00
Junio C Hamano 0fd8cb3fec Merge branch 'nd/maint-autofix-tag-in-head'
* nd/maint-autofix-tag-in-head:
  Accept tags in HEAD or MERGE_HEAD
  merge: remove global variable head[]
  merge: use return value of resolve_ref() to determine if HEAD is invalid
  merge: keep stash[] a local variable

Conflicts:
	builtin/merge.c
2011-10-13 19:03:19 -07:00
Junio C Hamano 6fdab32e14 Merge branch 'bw/grep-no-index-no-exclude'
* bw/grep-no-index-no-exclude:
  grep --no-index: don't use git standard exclusions
  grep: do not use --index in the short usage output
2011-10-13 19:03:18 -07:00
Junio C Hamano 08ec3b5e4d Merge branch 'nd/maint-sparse-errors'
* nd/maint-sparse-errors:
  Add explanation why we do not allow to sparse checkout to empty working tree
  sparse checkout: show error messages when worktree shaping fails
2011-10-13 19:03:18 -07:00
Johannes Sixt 42afe62df4 t1402-check-ref-format: skip tests of refs beginning with slash on Windows
Bash on Windows converts program arguments that look like absolute POSIX
paths to their Windows form, i.e., drive-letter-colon format. For this
reason, those tests in t1402 that check refs that begin with a slash do not
work as expected on Windows: valid_ref tests are doomed to fail, and
invalid_ref tests fail for the wrong reason (that there is a colon rather
than that they begin with a slash).

Skip these tests.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 16:05:22 -07:00
Junio C Hamano 2727b71f05 bundle: add parse_bundle_header() helper function
Move most of the code from read_bundle_header() to parse_bundle_header()
that takes a file descriptor that is already opened for reading, and make
the former responsible only for opening the file and noticing errors.

As a logical consequence of this, is_bundle() helper function can be
implemented as a non-complaining variant of read_bundle_header() that
does not return an open file descriptor, and can be used to tighten
the check used to decide the use of bundle transport in transport_get()
function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 15:50:21 -07:00
Junio C Hamano e9ee84cf28 bundle: allowing to read from an unseekable fd
We wished that "git bundle" to eventually learn to read from a network
socket which is not seekable. The current code opens with fopen(), reads
the file halfway and run ftell(), and reopens the same file with open()
and seeks, to skip the header.

This patch by itself does not reach that goal yet, but I think it is a
right step in that direction.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 15:12:02 -07:00
Jeff King 035b5bf643 pull,rebase: handle GIT_WORK_TREE better
You can't currently run git-pull or git-rebase from outside
of the work tree, even with GIT_WORK_TREE set, due to an
overeager require_work_tree function. Commit e2eb527
documents this problem and provides the infrastructure for a
fix, but left it to later commits to audit and update
individual scripts.

Changing these scripts to use require_work_tree_exists is
easy to verify. We immediately call cd_to_toplevel, anyway.
Therefore no matter which function we use, the state
afterwards is one of:

  1. We have a work tree, and we are at the top level.

  2. We don't have a work tree, and we have died.

The only catch is that we must also make sure no code that
ran before the cd_to_toplevel assumed that we were already
in the working tree.

In this case, we will only have included shell libraries and
called set_reflog_action, neither of which care about the
current working directory at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 12:16:36 -07:00
Brad King 80988783c8 submodule: Search for merges only at end of recursive merge
The submodule merge search is not useful during virtual merges because
the results cannot be used automatically.  Furthermore any suggestions
made by the search may apply to commits different than HEAD:sub and
MERGE_HEAD:sub, thus confusing the user.  Skip searching for submodule
merges during a virtual merge such as that between B and C while merging
the heads of:

    B---BC
   / \ /
  A   X
   \ / \
    C---CB

Run the search only when the recursion level is zero (!o->call_depth).
This fixes known breakage tested in t7405-submodule-merge.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 10:18:16 -07:00
Brad King 72251b7de6 submodule: Demonstrate known breakage during recursive merge
Since commit 68d03e4a (Implement automatic fast-forward merge for
submodules, 2010-07-07) we try to suggest submodule commits that resolve
a conflict.  Consider a true recursive merge case

    b---bc
   / \ /
  o   X
   \ / \
    c---cb

in which the two heads themselves (bc,cb) had resolved a submodule
conflict (i.e. reference different commits than their parents).  The
submodule merge search runs during the temporary merge of the two merge
bases (b,c) and prints out a suggestion that is not meaningful to the
user.  Then during the main merge the submodule merge search runs again
but dies with the message

  fatal: --ancestry-path given but there are no bottom commits

while trying to enumerate candidates.  Demonstrate this known breakage
with a new test in t7405-submodule-merge covering the case.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 10:16:59 -07:00
Jay Soffian 66f4b98ad9 Teach merge the '[-e|--edit]' option
Implemented internally instead of as "git merge --no-commit && git commit"
so that "merge --edit" is otherwise consistent (hooks, etc) with "merge".

Note: the edit message does not include the status information that one
gets with "commit --status" and it is cleaned up after editing like one
gets with "commit --cleanup=default". A later patch could add the status
information if desired.

Note: previously we were not calling stripspace() after running the
prepare-commit-msg hook. Now we are, stripping comments and
leading/trailing whitespace lines if --edit is given, otherwise only
stripping leading/trailing whitespace lines if not given --edit.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-12 13:17:18 -07:00