Code

git.git
12 years agogrep: respect diff attributes for binary-ness
Jeff King [Thu, 2 Feb 2012 08:21:02 +0000 (03:21 -0500)]
grep: respect diff attributes for binary-ness

There is currently no way for users to tell git-grep that a
particular path is or is not a binary file; instead, grep
always relies on its auto-detection (or the user specifying
"-a" to treat all binary-looking files like text).

This patch teaches git-grep to use the same attribute lookup
that is used by git-diff. We could add a new "grep" flag,
but that is unnecessarily complex and unlikely to be useful.
Despite the name, the "-diff" attribute (or "diff=foo" and
the associated diff.foo.binary config option) are really
about describing the contents of the path. It's simply
historical that diff was the only thing that cared about
these attributes in the past.

And if this simple approach turns out to be insufficient, we
still have a backwards-compatible path forward: we can add a
separate "grep" attribute, and fall back to respecting
"diff" if it is unset.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep: cache userdiff_driver in grep_source
Jeff King [Thu, 2 Feb 2012 08:20:43 +0000 (03:20 -0500)]
grep: cache userdiff_driver in grep_source

Right now, grep only uses the userdiff_driver for one thing:
looking up funcname patterns for "-p" and "-W".  As new uses
for userdiff drivers are added to the grep code, we want to
minimize attribute lookups, which can be expensive.

It might seem at first that this would also optimize multiple
lookups when the funcname pattern for a file is needed
multiple times. However, the compiled funcname pattern is
already cached in struct grep_opt's "priv" member, so
multiple lookups are already suppressed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep: drop grep_buffer's "name" parameter
Jeff King [Thu, 2 Feb 2012 08:20:10 +0000 (03:20 -0500)]
grep: drop grep_buffer's "name" parameter

Before the grep_source interface existed, grep_buffer was
used by two types of callers:

  1. Ones which pulled a file into a buffer, and then wanted
     to supply the file's name for the output (i.e.,
     git grep).

  2. Ones which really just wanted to grep a buffer (i.e.,
     git log --grep).

Callers in set (1) should now be using grep_source. Callers
in set (2) always pass NULL for the "name" parameter of
grep_buffer. We can therefore get rid of this now-useless
parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoconvert git-grep to use grep_source interface
Jeff King [Thu, 2 Feb 2012 08:19:37 +0000 (03:19 -0500)]
convert git-grep to use grep_source interface

The grep_source interface (as opposed to grep_buffer) will
eventually gives us a richer interface for telling the
low-level grep code about our buffers. Eventually this will
lead to things like better binary-file handling. For now, it
lets us drop a lot of now-redundant code.

The conversion is mostly straight-forward. One thing to note
is that the memory ownership rules for "struct grep_source"
are different than the "struct work_item" found here (the
former will copy things like the filename, rather than
taking ownership). Therefore you will also see some slight
tweaking of when filename buffers are released.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep: refactor the concept of "grep source" into an object
Jeff King [Thu, 2 Feb 2012 08:19:28 +0000 (03:19 -0500)]
grep: refactor the concept of "grep source" into an object

The main interface to the low-level grep code is
grep_buffer, which takes a pointer to a buffer and a size.
This is convenient and flexible (we use it to grep commit
bodies, files on disk, and blobs by sha1), but it makes it
hard to pass extra information about what we are grepping
(either for correctness, like overriding binary
auto-detection, or for optimizations, like lazily loading
blob contents).

Instead, let's encapsulate the idea of a "grep source",
including the buffer, its size, and where the data is coming
from. This is similar to the diff_filespec structure used by
the diff code (unsurprising, since future patches will
implement some of the same optimizations found there).

The diffstat is slightly scarier than the actual patch
content. Most of the modified lines are simply replacing
access to raw variables with their counterparts that are now
in a "struct grep_source". Most of the added lines were
taken from builtin/grep.c, which partially abstracted the
idea of grep sources (for file vs sha1 sources).

Instead of dropping the now-redundant code, this patch
leaves builtin/grep.c using the traditional grep_buffer
interface (which now wraps the grep_source interface). That
makes it easy to test that there is no change of behavior
(yet).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep: move sha1-reading mutex into low-level code
Jeff King [Thu, 2 Feb 2012 08:18:41 +0000 (03:18 -0500)]
grep: move sha1-reading mutex into low-level code

The multi-threaded git-grep code needs to serialize access
to the thread-unsafe read_sha1_file call. It does this with
a mutex that is local to builtin/grep.c.

Let's instead push this down into grep.c, where it can be
used by both builtin/grep.c and grep.c. This will let us
safely teach the low-level grep.c code tricks that involve
reading from the object db.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep: make locking flag global
Jeff King [Thu, 2 Feb 2012 08:18:29 +0000 (03:18 -0500)]
grep: make locking flag global

The low-level grep code traditionally didn't care about
threading, as it doesn't do any threading itself and didn't
call out to other non-thread-safe code.  That changed with
0579f91 (grep: enable threading with -p and -W using lazy
attribute lookup, 2011-12-12), which pushed the lookup of
funcname attributes (which is not thread-safe) into the
low-level grep code.

As a result, the low-level code learned about a new global
"grep_attr_mutex" to serialize access to the attribute code.
A multi-threaded caller (e.g., builtin/grep.c) is expected
to initialize the mutex and set "use_threads" in the
grep_opt structure. The low-level code only uses the lock if
use_threads is set.

However, putting the use_threads flag into the grep_opt
struct is not the most logical place. Whether threading is
in use is not something that matters for each call to
grep_buffer, but is instead global to the whole program
(i.e., if any thread is doing multi-threaded grep, every
other thread, even if it thinks it is doing its own
single-threaded grep, would need to use the locking).  In
practice, this distinction isn't a problem for us, because
the only user of multi-threaded grep is "git-grep", which
does nothing except call grep.

This patch turns the opt->use_threads flag into a global
flag. More important than the nit-picking semantic argument
above is that this means that the locking functions don't
need to actually have access to a grep_opt to know whether
to lock. Which in turn can make adding new locks simpler, as
we don't need to pass around a grep_opt.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoi18n: format_tracking_info "Your branch is behind" message
Jiang Xin [Thu, 2 Feb 2012 02:02:23 +0000 (10:02 +0800)]
i18n: format_tracking_info "Your branch is behind" message

Function format_tracking_info in remote.c is called by
wt_status_print_tracking in wt-status.c, which will print
branch tracking message in git-status. git-checkout also
show these messages through it's report_tracking function.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoi18n: git-commit whence_s "merge/cherry-pick" message
Jiang Xin [Wed, 1 Feb 2012 17:20:30 +0000 (01:20 +0800)]
i18n: git-commit whence_s "merge/cherry-pick" message

Mark the "merge/cherry-pick" messages in whence_s for translation.
These messages returned from whence_s function are used as argument
to build other messages.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofind_pack_entry(): do not keep packed_git pointer locally
Nguyễn Thái Ngọc Duy [Wed, 1 Feb 2012 13:48:55 +0000 (20:48 +0700)]
find_pack_entry(): do not keep packed_git pointer locally

Commit f7c22cc (always start looking up objects in the last used pack
first - 2007-05-30) introduce a static packed_git* pointer as an
optimization.  The kept pointer however may become invalid if
free_pack_by_name() happens to free that particular pack.

Current code base does not access packs after calling
free_pack_by_name() so it should not be a problem. Anyway, move the
pointer out so that free_pack_by_name() can reset it to avoid running
into troubles in future.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agosha1_file.c: move the core logic of find_pack_entry() into fill_pack_entry()
Nguyễn Thái Ngọc Duy [Wed, 1 Feb 2012 13:48:54 +0000 (20:48 +0700)]
sha1_file.c: move the core logic of find_pack_entry() into fill_pack_entry()

The new helper function implements the logic to find the offset for the
object in one pack and fill a pack_entry structure. The next patch will
restructure the loop and will call the helper from two places.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorequest-pull: explicitly ask tags/$name to be pulled
Junio C Hamano [Wed, 1 Feb 2012 05:06:06 +0000 (21:06 -0800)]
request-pull: explicitly ask tags/$name to be pulled

When asking for a tag to be pulled, disambiguate by leaving tags/ prefix
in front of the name of the tag. E.g.

    ... in the git repository at:

      git://example.com/git/git.git/ tags/v1.2.3

    for you to fetch changes up to 123456...

This way, older versions of "git pull" can be used to respond to such a
request more easily, as "git pull $URL v1.2.3" did not DWIM to fetch
v1.2.3 tag in older versions. Also this makes it clearer for humans that
the pull request is made for a tag and he should anticipate a signed one.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocompletion: --edit-description option for git-branch
Ralf Thielow [Sun, 29 Jan 2012 12:55:33 +0000 (13:55 +0100)]
completion: --edit-description option for git-branch

Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9 v1.7.9
Junio C Hamano [Fri, 27 Jan 2012 19:31:02 +0000 (11:31 -0800)]
Git 1.7.9

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoINSTALL: warn about recent Fedora breakage
Junio C Hamano [Fri, 27 Jan 2012 05:48:33 +0000 (21:48 -0800)]
INSTALL: warn about recent Fedora breakage

Recent releases of Redhat/Fedora are reported to ship Perl binary package
with some core modules stripped away (see http://lwn.net/Articles/477234/)
against the upstream Perl5 people's wishes. The Time::HiRes module used by
gitweb one of them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-completion: workaround zsh COMPREPLY bug
Felipe Contreras [Wed, 25 Jan 2012 01:37:02 +0000 (03:37 +0200)]
git-completion: workaround zsh COMPREPLY bug

zsh adds a backslash (foo\ ) for each item in the COMPREPLY array if IFS
doesn't contain spaces. This issue has been reported[1], but there is no
solution yet.

This wasn't a problem due to another bug[2], which was fixed in zsh
version 4.3.12. After this change, 'git checkout ma<tab>' would resolve
to 'git checkout master\ '.

Aditionally, the introduction of __gitcomp_nl in commit a31e626
(completion: optimize refs completion) in git also made the problem
apparent, as Matthieu Moy reported.

The simplest and most generic solution is to hide all the changes we do
to IFS, so that "foo \nbar " is recognized by zsh as "foo bar". This
works on versions of git before and after the introduction of
__gitcomp_nl (a31e626), and versions of zsh before and after 4.3.12.

Once zsh is fixed, we should conditionally disable this workaround to
have the same benefits as bash users.

[1] http://www.zsh.org/mla/workers/2012/msg00053.html
[2] http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=2e25dfb8fd38dbef0a306282ffab1d343ce3ad8d

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodocs: minor grammar fixes for v1.7.9 release notes
Jeff King [Wed, 25 Jan 2012 22:20:03 +0000 (17:20 -0500)]
docs: minor grammar fixes for v1.7.9 release notes

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agosubmodule add: fix breakage when re-adding a deep submodule
Jens Lehmann [Tue, 24 Jan 2012 21:49:56 +0000 (22:49 +0100)]
submodule add: fix breakage when re-adding a deep submodule

Since recently a submodule with name <name> has its git directory in the
.git/modules/<name> directory of the superproject while the work tree
contains a gitfile pointing there.

When the same submodule is added on a branch where it wasn't present so
far (it is not found in the .gitmodules file), the name is not initialized
from the path as it should. This leads to a wrong path entered in the
gitfile when the .git/modules/<name> directory is found, as this happily
uses the - now empty - name. It then always points only a single directory
up, even if we have a path deeper in the directory hierarchy.

Fix that by initializing the name of the submodule early in module_clone()
if module_name() returned an empty name and add a test to catch that bug.

Reported-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomergetool: Provide an empty file when needed
David Aguilar [Fri, 20 Jan 2012 07:47:35 +0000 (23:47 -0800)]
mergetool: Provide an empty file when needed

Some merge tools cannot cope when $LOCAL, $BASE, or $REMOTE are missing.
$BASE can be missing when two branches independently add the same
filename.

Provide an empty file to make these tools happy.

When a delete/modify conflict occurs, $LOCAL and $REMOTE can also be
missing. We have special case code to handle such case so this change
may not affect that codepath, but try to be consistent and create an
empty file for them anyway.

Reported-by: Jason Wenger <jcwenger@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep: fix -l/-L interaction with decoration lines
Albert Yale [Mon, 23 Jan 2012 17:52:44 +0000 (18:52 +0100)]
grep: fix -l/-L interaction with decoration lines

In threaded mode, git-grep emits file breaks (enabled with context, -W
and --break) into the accumulation buffers even if they are not
required.  The output collection thread then uses skip_first_line to
skip the first such line in the output, which would otherwise be at
the very top.

This is wrong when the user also specified -l/-L/-c, in which case
every line is relevant.  While arguably giving these options together
doesn't make any sense, git-grep has always quietly accepted it.  So
do not skip anything in these cases.

Signed-off-by: Albert Yale <surfingalbert@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoFix typo in 1.7.9 release notes
Michael Haggerty [Mon, 23 Jan 2012 12:09:58 +0000 (13:09 +0100)]
Fix typo in 1.7.9 release notes

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoremote-curl: Fix push status report when all branches fail
Shawn O. Pearce [Fri, 20 Jan 2012 03:12:09 +0000 (19:12 -0800)]
remote-curl: Fix push status report when all branches fail

The protocol between transport-helper.c and remote-curl requires
remote-curl to always print a blank line after the push command
has run. If the blank line is ommitted, transport-helper kills its
container process (the git push the user started) with exit(128)
and no message indicating a problem, assuming the helper already
printed reasonable error text to the console.

However if the remote rejects all branches with "ng" commands in the
report-status reply, send-pack terminates with non-zero status, and
in turn remote-curl exited with non-zero status before outputting
the blank line after the helper status printed by send-pack. No
error messages reach the user.

This caused users to see the following from git push over HTTP
when the remote side's update hook rejected the branch:

  $ git push http://... master
  Counting objects: 4, done.
  Delta compression using up to 6 threads.
  Compressing objects: 100% (2/2), done.
  Writing objects: 100% (3/3), 301 bytes, done.
  Total 3 (delta 0), reused 0 (delta 0)
  $

Always print a blank line after the send-pack process terminates,
ensuring the helper status report (if it was output) will be
correctly parsed by the calling transport-helper.c. This ensures
the helper doesn't abort before the status report can be shown to
the user.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMaking pathspec limited log play nicer with --first-parent
Junio C Hamano [Thu, 19 Jan 2012 19:58:45 +0000 (11:58 -0800)]
Making pathspec limited log play nicer with --first-parent

In a topic branch workflow, you often want to find the latest commit that
merged a side branch that touched a particular area of the system, so that
a new topic branch to work on that area can be forked from that commit.
For example, I wanted to find an appropriate fork-point to queue Luke's
changes related to git-p4 in contrib/fast-import/.

"git log --first-parent" traverses the first-parent chain, and "-m --stat"
shows the list of paths touched by commits including merge commits.  We
could ask the question this way:

    # What is the latest commit that touched that path?
    $ git log --first-parent --oneline -m --stat master |
      sed -e '/^ contrib\/fast-import\/git-p4 /q' | tail

The above finds that 8cbfc11 (Merge branch 'pw/p4-view-updates',
2012-01-06) was such a commit.

But a more natural way to spell this question is this:

    $ git log --first-parent --oneline -m --stat -1 master -- \
      contrib/fast-import/git-p4

Unfortunately, this does not work. It finds ecb7cf9 (git-p4: rewrite view
handling, 2012-01-02). This commit is a part of the merged topic branch
and is _not_ on the first-parent path from the 'master':

    $ git show-branch 8cbfc11 ecb7cf9
    ! [8cbfc11] Merge branch 'pw/p4-view-updates'
     ! [ecb7cf9] git-p4: rewrite view handling
    --
    -  [8cbfc11] Merge branch 'pw/p4-view-updates'
    +  [8cbfc11^2] git-p4: view spec documentation
    ++ [ecb7cf9] git-p4: rewrite view handling

The problem is caused by the merge simplification logic when it inspects
the merge commit 8cbfc11. In this case, the history leading to the tip of
'master' did not touch git-p4 since 'pw/p4-view-updates' topic forked, and
the result of the merge is simply a copy from the tip of the topic branch
in the view limited by the given pathspec.  The merge simplification logic
discards the history on the mainline side of the merge, and pretends as if
the sole parent of the merge is its second parent, i.e. the tip of the
topic. While this simplification is correct in the general case, it is at
least surprising if not outright wrong when the user explicitly asked to
show the first-parent history.

Here is an attempt to fix this issue, by not allowing us to compare the
merge result with anything but the first parent when --first-parent is in
effect, to avoid the history traversal veering off to the side branch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9-rc2 v1.7.9-rc2
Junio C Hamano [Wed, 18 Jan 2012 23:53:35 +0000 (15:53 -0800)]
Git 1.7.9-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint'
Junio C Hamano [Wed, 18 Jan 2012 23:52:08 +0000 (15:52 -0800)]
Merge branch 'maint'

* maint:
  Git 1.7.8.4
  Git 1.7.7.6
  diff-index: enable recursive pathspec matching in unpack_trees

Conflicts:
GIT-VERSION-GEN

12 years agoGit 1.7.8.4 v1.7.8.4
Junio C Hamano [Wed, 18 Jan 2012 23:51:00 +0000 (15:51 -0800)]
Git 1.7.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint-1.7.7' into maint
Junio C Hamano [Wed, 18 Jan 2012 23:48:46 +0000 (15:48 -0800)]
Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
  Git 1.7.7.6
  diff-index: enable recursive pathspec matching in unpack_trees

Conflicts:
GIT-VERSION-GEN

12 years agoGit 1.7.7.6 v1.7.7.6
Junio C Hamano [Wed, 18 Jan 2012 23:46:31 +0000 (15:46 -0800)]
Git 1.7.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodiff-index: enable recursive pathspec matching in unpack_trees
Nguyen Thai Ngoc Duy [Sun, 15 Jan 2012 10:03:27 +0000 (17:03 +0700)]
diff-index: enable recursive pathspec matching in unpack_trees

The pathspec structure has a few bits of data to drive various operation
modes after we unified the pathspec matching logic in various codepaths.
For example, max_depth field is there so that "git grep" can limit the
output for files found in limited depth of tree traversal. Also in order
to show just the surface level differences in "git diff-tree", recursive
field stops us from descending into deeper level of the tree structure
when it is set to false, and this also affects pathspec matching when
we have wildcards in the pathspec.

The diff-index has always wanted the recursive behaviour, and wanted to
match pathspecs without any depth limit. But we forgot to do so when we
updated tree_entry_interesting() logic to unify the pathspec matching
logic.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/pull-signed-tag-doc'
Junio C Hamano [Wed, 18 Jan 2012 23:18:02 +0000 (15:18 -0800)]
Merge branch 'jc/pull-signed-tag-doc'

* jc/pull-signed-tag-doc:
  pulling signed tag: add howto document

12 years agopulling signed tag: add howto document
Junio C Hamano [Tue, 17 Jan 2012 22:52:24 +0000 (14:52 -0800)]
pulling signed tag: add howto document

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jk/credentials'
Junio C Hamano [Wed, 18 Jan 2012 23:16:53 +0000 (15:16 -0800)]
Merge branch 'jk/credentials'

* jk/credentials:
  credential-cache: ignore "connection refused" errors
  unix-socket: do not let close() or chdir() clobber errno during cleanup
  credential-cache: report more daemon connection errors
  unix-socket: handle long socket pathnames

12 years agoMerge branch 'nd/pathspec-recursion-cleanup'
Junio C Hamano [Wed, 18 Jan 2012 23:16:43 +0000 (15:16 -0800)]
Merge branch 'nd/pathspec-recursion-cleanup'

* nd/pathspec-recursion-cleanup:
  diff-index: enable recursive pathspec matching in unpack_trees
  Document limited recursion pathspec matching with wildcards

12 years agoMerge branch 'mh/maint-show-ref-doc'
Junio C Hamano [Wed, 18 Jan 2012 23:16:23 +0000 (15:16 -0800)]
Merge branch 'mh/maint-show-ref-doc'

* mh/maint-show-ref-doc:
  git-show-ref doc: typeset regexp in fixed width font
  git-show-ref: fix escaping in asciidoc source

12 years agoMerge branch 'tr/maint-word-diff-incomplete-line'
Junio C Hamano [Wed, 18 Jan 2012 23:16:19 +0000 (15:16 -0800)]
Merge branch 'tr/maint-word-diff-incomplete-line'

* tr/maint-word-diff-incomplete-line:
  word-diff: ignore '\ No newline at eof' marker

12 years agocredential-cache: ignore "connection refused" errors
Jeff King [Tue, 17 Jan 2012 06:02:32 +0000 (01:02 -0500)]
credential-cache: ignore "connection refused" errors

The credential-cache helper will try to connect to its
daemon over a unix socket. Originally, a failure to do so
was silently ignored, and we would either give up (if
performing a "get" or "erase" operation), or spawn a new
daemon (for a "store" operation).

But since 8ec6c8d, we try to report more errors. We detect a
missing daemon by checking for ENOENT on our connection
attempt.  If the daemon is missing, we continue as before
(giving up or spawning a new daemon). For any other error,
we die and report the problem.

However, checking for ENOENT is not sufficient for a missing
daemon. We might also get ECONNREFUSED if a dead daemon
process left a stale socket. This generally shouldn't
happen, as the daemon cleans up after itself, but the daemon
may not always be given a chance to do so (e.g., power loss,
"kill -9").

The resulting state is annoying not just because the helper
outputs an extra useless message, but because it actually
blocks the helper from spawning a new daemon to replace the
stale socket.

Fix it by checking for ECONNREFUSED.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jn/maint-gitweb-grep-fix'
Junio C Hamano [Tue, 17 Jan 2012 00:45:56 +0000 (16:45 -0800)]
Merge branch 'jn/maint-gitweb-grep-fix'

* jn/maint-gitweb-grep-fix:
  gitweb: Harden "grep" search against filenames with ':'
  gitweb: Fix file links in "grep" search

12 years agodiff-index: enable recursive pathspec matching in unpack_trees
Nguyen Thai Ngoc Duy [Sun, 15 Jan 2012 10:03:27 +0000 (17:03 +0700)]
diff-index: enable recursive pathspec matching in unpack_trees

The pathspec structure has a few bits of data to drive various operation
modes after we unified the pathspec matching logic in various codepaths.
For example, max_depth field is there so that "git grep" can limit the
output for files found in limited depth of tree traversal. Also in order
to show just the surface level differences in "git diff-tree", recursive
field stops us from descending into deeper level of the tree structure
when it is set to false, and this also affects pathspec matching when
we have wildcards in the pathspec.

The diff-index has always wanted the recursive behaviour, and wanted to
match pathspecs without any depth limit. But we forgot to do so when we
updated tree_entry_interesting() logic to unify the pathspec matching
logic.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocument limited recursion pathspec matching with wildcards
Nguyễn Thái Ngọc Duy [Sat, 14 Jan 2012 09:23:22 +0000 (16:23 +0700)]
Document limited recursion pathspec matching with wildcards

It's actually unlimited recursion if wildcards are active regardless
--max-depth

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-show-ref doc: typeset regexp in fixed width font
Michael Haggerty [Fri, 13 Jan 2012 16:39:16 +0000 (17:39 +0100)]
git-show-ref doc: typeset regexp in fixed width font

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-show-ref: fix escaping in asciidoc source
Michael Haggerty [Fri, 13 Jan 2012 16:39:15 +0000 (17:39 +0100)]
git-show-ref: fix escaping in asciidoc source

Two "^" characters were incorrectly being interpreted as markup for
superscripting.  Fix them by writing them as attribute references
"{caret}".

Although a single "^" character in a paragraph cannot be
misinterpreted in this way, also write other "^" characters as
"{caret}" in the interest of good hygiene (unless they are in literal
paragraphs, of course, in which context attribute references are not
recognized).

Spell "{}" consistently, namely *not* quoted as "\{\}".  Since the
braces are empty, they cannot be interpreted as an attribute
reference, and either spelling is OK.  So arbitrarily choose one
variation and use it consistently.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9-rc1 v1.7.9-rc1
Junio C Hamano [Fri, 13 Jan 2012 07:43:28 +0000 (23:43 -0800)]
Git 1.7.9-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/request-pull-show-head-4'
Junio C Hamano [Fri, 13 Jan 2012 07:34:30 +0000 (23:34 -0800)]
Merge branch 'jc/request-pull-show-head-4'

* jc/request-pull-show-head-4:
  request-pull: use the real fork point when preparing the message

12 years agoMerge branch 'tr/maint-mailinfo'
Junio C Hamano [Fri, 13 Jan 2012 07:34:26 +0000 (23:34 -0800)]
Merge branch 'tr/maint-mailinfo'

* tr/maint-mailinfo:
  mailinfo documentation: accurately describe non -k case

12 years agoMerge branch 'ss/maint-msys-cvsexportcommit'
Junio C Hamano [Fri, 13 Jan 2012 07:34:21 +0000 (23:34 -0800)]
Merge branch 'ss/maint-msys-cvsexportcommit'

* ss/maint-msys-cvsexportcommit:
  git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
  t9200: On MSYS, do not pass Windows-style paths to CVS

12 years agoMerge branch 'jk/maint-upload-archive'
Junio C Hamano [Fri, 13 Jan 2012 07:34:17 +0000 (23:34 -0800)]
Merge branch 'jk/maint-upload-archive'

* jk/maint-upload-archive:
  archive: re-allow HEAD:Documentation on a remote invocation

12 years agoMerge branch 'maint'
Junio C Hamano [Fri, 13 Jan 2012 07:33:39 +0000 (23:33 -0800)]
Merge branch 'maint'

* maint:
  Update draft release notes to 1.7.8.4
  Update draft release notes to 1.7.7.6
  Update draft release notes to 1.7.6.6
  thin-pack: try harder to use preferred base objects as base

12 years agoUpdate draft release notes to 1.7.8.4
Junio C Hamano [Fri, 13 Jan 2012 07:33:29 +0000 (23:33 -0800)]
Update draft release notes to 1.7.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint-1.7.7' into maint
Junio C Hamano [Fri, 13 Jan 2012 07:31:46 +0000 (23:31 -0800)]
Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
  Update draft release notes to 1.7.7.6
  Update draft release notes to 1.7.6.6
  thin-pack: try harder to use preferred base objects as base

12 years agoUpdate draft release notes to 1.7.7.6
Junio C Hamano [Fri, 13 Jan 2012 07:31:41 +0000 (23:31 -0800)]
Update draft release notes to 1.7.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint-1.7.6' into maint-1.7.7
Junio C Hamano [Fri, 13 Jan 2012 07:31:05 +0000 (23:31 -0800)]
Merge branch 'maint-1.7.6' into maint-1.7.7

* maint-1.7.6:
  Update draft release notes to 1.7.6.6
  thin-pack: try harder to use preferred base objects as base

12 years agoUpdate draft release notes to 1.7.6.6
Junio C Hamano [Fri, 13 Jan 2012 07:30:53 +0000 (23:30 -0800)]
Update draft release notes to 1.7.6.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agothin-pack: try harder to use preferred base objects as base
Jeff King [Thu, 12 Jan 2012 22:32:34 +0000 (17:32 -0500)]
thin-pack: try harder to use preferred base objects as base

When creating a pack using objects that reside in existing packs, we try
to avoid recomputing futile delta between an object (trg) and a candidate
for its base object (src) if they are stored in the same packfile, and trg
is not recorded as a delta already. This heuristics makes sense because it
is likely that we tried to express trg as a delta based on src but it did
not produce a good delta when we created the existing pack.

As the pack heuristics prefer producing delta to remove data, and Linus's
law dictates that the size of a file grows over time, we tend to record
the newest version of the file as inflated, and older ones as delta
against it.

When creating a thin-pack to transfer recent history, it is likely that we
will try to send an object that is recorded in full, as it is newer.  But
the heuristics to avoid recomputing futile delta effectively forbids us
from attempting to express such an object as a delta based on another
object. Sending an object in full is often more expensive than sending a
suboptimal delta based on other objects, and it is even more so if we
could use an object we know the receiving end already has (i.e. preferred
base object) as the delta base.

Tweak the recomputation avoidance logic, so that we do not punt on
computing delta against a preferred base object.

The effect of this change can be seen on two simulated upload-pack
workloads. The first is based on 44 reflog entries from my git.git
origin/master reflog, and represents the packs that kernel.org sent me git
updates for the past month or two. The second workload represents much
larger fetches, going from git's v1.0.0 tag to v1.1.0, then v1.1.0 to
v1.2.0, and so on.

The table below shows the average generated pack size and the average CPU
time consumed for each dataset, both before and after the patch:

                  dataset
            | reflog | tags
---------------------------------
     before | 53358  | 2750977
size  after | 32398  | 2668479
     change |   -39% |      -3%
---------------------------------
     before |  0.18  | 1.12
CPU   after |  0.18  | 1.15
     change |    +0% |      +3%

This patch makes a much bigger difference for packs with a shorter slice
of history (since its effect is seen at the boundaries of the pack) though
it has some benefit even for larger packs.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoword-diff: ignore '\ No newline at eof' marker
Thomas Rast [Thu, 12 Jan 2012 11:15:33 +0000 (12:15 +0100)]
word-diff: ignore '\ No newline at eof' marker

The word-diff logic accumulates + and - lines until another line type
appears (normally [ @\]), at which point it generates the word diff.
This is usually correct, but it breaks when the preimage does not have
a newline at EOF:

  $ printf "%s" "a a a" >a
  $ printf "%s\n" "a ab a" >b
  $ git diff --no-index --word-diff a b
  diff --git 1/a 2/b
  index 9f68e94..6a7c02f 100644
  --- 1/a
  +++ 2/b
  @@ -1 +1 @@
  [-a a a-]
   No newline at end of file
  {+a ab a+}

Because of the order of the lines in a unified diff

  @@ -1 +1 @@
  -a a a
  \ No newline at end of file
  +a ab a

the '\' line flushed the buffers, and the - and + lines were never
matched with each other.

A proper fix would defer such markers until the end of the hunk.
However, word-diff is inherently whitespace-ignoring, so as a cheap
fix simply ignore the marker (and hide it from the output).

We use a prefix match for '\ ' to parallel the logic in
apply.c:parse_fragment().  We currently do not localize this string
(just accept other variants of it in git-apply), but this should be
future-proof.

Noticed-by: Ivan Shirokoff <shirokoff@yandex-team.ru>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoarchive: re-allow HEAD:Documentation on a remote invocation
Carlos Martín Nieto [Wed, 11 Jan 2012 12:12:38 +0000 (13:12 +0100)]
archive: re-allow HEAD:Documentation on a remote invocation

The tightening done in (ee27ca4a: archive: don't let remote clients
get unreachable commits, 2011-11-17) went too far and disallowed
HEAD:Documentation as it would try to find "HEAD:Documentation" as a
ref.

Only DWIM the "HEAD" part to see if it exists as a ref. Once we're
sure that we've been given a valid ref, we follow the normal code
path. This still disallows attempts to access commits which are not
branch tips.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint'
Junio C Hamano [Thu, 12 Jan 2012 03:11:28 +0000 (19:11 -0800)]
Merge branch 'maint'

* maint:
  attr: fix leak in free_attr_elem
  t2203: fix wrong commit command

12 years agoMerge branch 'maint-1.7.7' into maint
Junio C Hamano [Thu, 12 Jan 2012 03:11:13 +0000 (19:11 -0800)]
Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
  attr: fix leak in free_attr_elem
  t2203: fix wrong commit command

12 years agoMerge branch 'maint-1.7.6' into maint-1.7.7
Junio C Hamano [Thu, 12 Jan 2012 03:11:00 +0000 (19:11 -0800)]
Merge branch 'maint-1.7.6' into maint-1.7.7

* maint-1.7.6:
  attr: fix leak in free_attr_elem
  t2203: fix wrong commit command

12 years agoattr: fix leak in free_attr_elem
Jeff King [Thu, 12 Jan 2012 03:05:03 +0000 (22:05 -0500)]
attr: fix leak in free_attr_elem

This function frees the individual "struct match_attr"s we
have allocated, but forgot to free the array holding their
pointers, leading to a minor memory leak (but it can add up
after checking attributes for paths in many directories).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
Sebastian Schuberth [Wed, 11 Jan 2012 09:21:10 +0000 (10:21 +0100)]
git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS

Due to MSYS path mangling GIT_DIR contains a Windows-style path when
checked inside a Perl script even if GIT_DIR was previously set to an
MSYS-style path in a shell script. So explicitly convert to an MSYS-style
path before calling Perl's rel2abs() to make it work.

This fix was inspired by a very similar patch in WebKit:

http://trac.webkit.org/changeset/76255/trunk/Tools/Scripts/commit-log-editor

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot9200: On MSYS, do not pass Windows-style paths to CVS
Sebastian Schuberth [Wed, 11 Jan 2012 09:20:14 +0000 (10:20 +0100)]
t9200: On MSYS, do not pass Windows-style paths to CVS

For details, see the commit message of 4114156ae9. Note that while using
$PWD as part of GIT_DIR is not required here, it does no harm and it is
more consistent. In addition, on MSYS using an environment variable should
be slightly faster than spawning an external executable.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agounix-socket: do not let close() or chdir() clobber errno during cleanup
Jonathan Nieder [Wed, 11 Jan 2012 23:50:10 +0000 (17:50 -0600)]
unix-socket: do not let close() or chdir() clobber errno during cleanup

unix_stream_connect and unix_stream_listen return -1 on error, with
errno set by the failing underlying call to allow the caller to write
a useful diagnosis.

Unfortunately the error path involves a few system calls itself, such
as close(), that can themselves touch errno.

This is not as worrisome as it might sound.  If close() fails, this
just means substituting one meaningful error message for another,
which is perfectly fine.  However, when the call _succeeds_, it is
allowed to (and sometimes might) clobber errno along the way with some
undefined value, so it is good higiene to save errno and restore it
immediately before returning to the caller.  Do so.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomailinfo documentation: accurately describe non -k case
Thomas Rast [Wed, 11 Jan 2012 20:13:42 +0000 (21:13 +0100)]
mailinfo documentation: accurately describe non -k case

Since its very first description of -k, the documentation for
git-mailinfo claimed that (in the case without -k) after cleaning up
bracketed strings [blah], it would insert [PATCH].

It doesn't; on the contrary, one of the important jobs of mailinfo is
to remove those strings.

Since we're already there, rewrite the paragraph to give a complete
enumeration of all the transformations.  Specifically, it was missing
the whitespace normalization (run of isspace(c) -> ' ') and the
removal of leading ':'.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot2203: fix wrong commit command
Nguyễn Thái Ngọc Duy [Wed, 11 Jan 2012 03:21:38 +0000 (10:21 +0700)]
t2203: fix wrong commit command

Add commit message to avoid commit's aborting due to the lack of
commit message, not because there are INTENT_TO_ADD entries in index.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorequest-pull: use the real fork point when preparing the message
Junio C Hamano [Wed, 11 Jan 2012 05:45:52 +0000 (21:45 -0800)]
request-pull: use the real fork point when preparing the message

The command takes the "start" argument and computes the merge base
between it and the commit to be pulled so that we can show the diffstat,
but uses the "start" argument as-is when composing the message

    The following changes since commit $X are available

to tell the integrator which commit the work is based on. Giving "origin"
(most of the time it resolves to refs/remotes/origin/master) as the start
argument is often convenient, but it is usually not the fork point, and
does not help the integrator at all.

Use the real fork point, which is the merge base we already compute, when
composing that part of the message.

Suggested-by: Linus Torvalds
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'bw/maint-t8006-sed-incomplete-line'
Junio C Hamano [Tue, 10 Jan 2012 22:46:52 +0000 (14:46 -0800)]
Merge branch 'bw/maint-t8006-sed-incomplete-line'

* bw/maint-t8006-sed-incomplete-line:
  Use perl instead of sed for t8006-blame-textconv test

12 years agoSync with maint
Junio C Hamano [Tue, 10 Jan 2012 22:46:22 +0000 (14:46 -0800)]
Sync with maint

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoPrepare for 1.7.8.4
Junio C Hamano [Tue, 10 Jan 2012 22:27:14 +0000 (14:27 -0800)]
Prepare for 1.7.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge the attributes fix in from maint-1.6.7 branch
Junio C Hamano [Tue, 10 Jan 2012 22:24:01 +0000 (14:24 -0800)]
Merge the attributes fix in from maint-1.6.7 branch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoPrepare for 1.7.7.6
Junio C Hamano [Tue, 10 Jan 2012 22:16:49 +0000 (14:16 -0800)]
Prepare for 1.7.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge the attributes fix in from maint-1.6.6 branch
Junio C Hamano [Tue, 10 Jan 2012 22:14:26 +0000 (14:14 -0800)]
Merge the attributes fix in from maint-1.6.6 branch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoPrepare for 1.7.6.6
Junio C Hamano [Tue, 10 Jan 2012 21:11:03 +0000 (13:11 -0800)]
Prepare for 1.7.6.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: rerere's rr-cache auto-creation and rerere.enabled
Junio C Hamano [Tue, 10 Jan 2012 14:57:27 +0000 (15:57 +0100)]
Documentation: rerere's rr-cache auto-creation and rerere.enabled

The description of rerere.enabled left the user in the dark as to who
might create an rr-cache directory.  Add a note that simply invoking
rerere does this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoattr.c: clarify the logic to pop attr_stack
Junio C Hamano [Tue, 10 Jan 2012 20:28:38 +0000 (12:28 -0800)]
attr.c: clarify the logic to pop attr_stack

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoattr.c: make bootstrap_attr_stack() leave early
Junio C Hamano [Tue, 10 Jan 2012 20:27:37 +0000 (12:27 -0800)]
attr.c: make bootstrap_attr_stack() leave early

Thas would de-dent the body of a function that has grown rather large over
time, making it a bit easier to read.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoattr: drop misguided defensive coding
Jeff King [Tue, 10 Jan 2012 19:32:06 +0000 (14:32 -0500)]
attr: drop misguided defensive coding

In prepare_attr_stack, we pop the old elements of the stack
(which were left from a previous lookup and may or may not
be useful to us). Our loop to do so checks that we never
reach the top of the stack. However, the code immediately
afterwards will segfault if we did actually reach the top of
the stack.

Fortunately, this is not an actual bug, since we will never
pop all of the stack elements (we will always keep the root
gitattributes, as well as the builtin ones). So the extra
check in the loop condition simply clutters the code and
makes the intent less clear. Let's get rid of it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoattr: don't confuse prefixes with leading directories
Jeff King [Tue, 10 Jan 2012 18:08:21 +0000 (13:08 -0500)]
attr: don't confuse prefixes with leading directories

When we prepare the attribute stack for a lookup on a path,
we start with the cached stack from the previous lookup
(because it is common to do several lookups in the same
directory hierarchy). So the first thing we must do in
preparing the stack is to pop any entries that point to
directories we are no longer interested in.

For example, if our stack contains gitattributes for:

  foo/bar/baz
  foo/bar
  foo

but we want to do a lookup in "foo/bar/bleep", then we want
to pop the top element, but retain the others.

To do this we walk down the stack from the top, popping
elements that do not match our lookup directory. However,
the test do this simply checked strncmp, meaning we would
mistake "foo/bar/baz" as a leading directory of
"foo/bar/baz_plus". We must also check that the character
after our match is '/', meaning we matched the whole path
component.

There are two special cases to consider:

  1. The top of our attr stack has the empty path. So we
     must not check for '/', but rather special-case the
     empty path, which always matches.

  2. Typically when matching paths in this way, you would
     also need to check for a full string match (i.e., the
     character after is '\0'). We don't need to do so in
     this case, though, because our path string is actually
     just the directory component of the path to a file
     (i.e., we know that it terminates with "/", because the
     filename comes after that).

Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredential-cache: report more daemon connection errors
Jeff King [Tue, 10 Jan 2012 04:57:33 +0000 (23:57 -0500)]
credential-cache: report more daemon connection errors

Originally, this code remained relatively silent when we
failed to connect to the cache. The idea was that it was
simply a cache, and we didn't want to bother the user with
temporary failures (the worst case is that we would simply
ask their password again).

However, if you have a configuration failure or other
problem, it is helpful for the daemon to report those
problems. Git will happily ignore the failed error code, but
the extra information to stderr can help the user diagnose
the problem.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agounix-socket: handle long socket pathnames
Jeff King [Tue, 10 Jan 2012 04:44:30 +0000 (23:44 -0500)]
unix-socket: handle long socket pathnames

On many systems, the sockaddr_un.sun_path field is quite
small. Even on Linux, it is only 108 characters. A user of
the credential-cache daemon can easily surpass this,
especially if their home directory is in a deep directory
tree (since the default location expands ~/.git-credentials).

We can hack around this in the unix-socket.[ch] code by
doing a chdir() to the enclosing directory, feeding the
relative basename to the socket functions, and then
restoring the working directory.

This introduces several new possible error cases for
creating a socket, including an irrecoverable one in the
case that we can't restore the working directory. In the
case of the credential-cache code, we could perhaps get away
with simply chdir()-ing to the socket directory and never
coming back. However, I'd rather do it at the lower level
for a few reasons:

  1. It keeps the hackery behind an opaque interface instead
     of polluting the main program logic.

  2. A hack in credential-cache won't help any unix-socket
     users who come along later.

  3. The chdir trickery isn't that likely to fail (basically
     it's only a problem if your cwd is missing or goes away
     while you're running).  And because we only enable the
     hack when we get a too-long name, it can only fail in
     cases that would have failed under the previous code
     anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUse perl instead of sed for t8006-blame-textconv test
Ben Walton [Tue, 10 Jan 2012 02:47:33 +0000 (21:47 -0500)]
Use perl instead of sed for t8006-blame-textconv test

In test 'blame --textconv with local changes' of t8006-blame-textconv,
using /usr/xpg4/bin/sed (as set by SANE_TOOL_PATH), an additional
newline was added to the output from the 'helper' script.

This was noted by sed with a message such as:
sed: Missing newline at end of file zero.bin.

Sed then exits with status 2 causing the helper script to also exit
with status 2.

In turn, this was triggering a fatal error from git blame:
fatal: unable to read files to diff

To work around this difference in sed behaviour, use perl -p instead
of sed -e as it exits cleanly and does not insert the additional
newline.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jk/credentials'
Junio C Hamano [Mon, 9 Jan 2012 23:58:47 +0000 (15:58 -0800)]
Merge branch 'jk/credentials'

* jk/credentials:
  credentials: unable to connect to cache daemon

12 years agoMerge branch 'mh/ref-api-less-extra-refs'
Junio C Hamano [Mon, 9 Jan 2012 23:58:43 +0000 (15:58 -0800)]
Merge branch 'mh/ref-api-less-extra-refs'

* mh/ref-api-less-extra-refs:
  write_head_info(): handle "extra refs" locally
  show_ref(): remove unused "flag" and "cb_data" arguments
  receive-pack: move more work into write_head_info()

12 years agoMerge branch 'mm/maint-gitweb-project-maxdepth'
Junio C Hamano [Mon, 9 Jan 2012 23:58:30 +0000 (15:58 -0800)]
Merge branch 'mm/maint-gitweb-project-maxdepth'

* mm/maint-gitweb-project-maxdepth:
  gitweb: accept trailing "/" in $project_list

12 years agoMerge branch 'maint'
Junio C Hamano [Mon, 9 Jan 2012 23:56:58 +0000 (15:56 -0800)]
Merge branch 'maint'

* maint:
  send-email: multiedit is a boolean config option

12 years agosend-email: multiedit is a boolean config option
Jeff King [Mon, 9 Jan 2012 22:55:42 +0000 (17:55 -0500)]
send-email: multiedit is a boolean config option

The sendemail.multiedit variable is meant to be a boolean.
However, it is not marked as such in the code, which means
we store its value literally. Thus in the do_edit function,
perl ends up coercing it to a boolean value according to
perl rules, not git rules. This works for "0", but "false",
"no", or "off" will erroneously be interpreted as true.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodashed externals: kill children on exit
Clemens Buchacher [Sun, 8 Jan 2012 20:41:09 +0000 (21:41 +0100)]
dashed externals: kill children on exit

Several git commands are so-called dashed externals, that is commands
executed as a child process of the git wrapper command. If the git
wrapper is killed by a signal, the child process will continue to run.
This is different from internal commands, which always die with the git
wrapper command.

Enable the recently introduced cleanup mechanism for child processes in
order to make dashed externals act more in line with internal commands.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorun-command: optionally kill children on exit
Jeff King [Sat, 7 Jan 2012 11:42:43 +0000 (12:42 +0100)]
run-command: optionally kill children on exit

When we spawn a helper process, it should generally be done
and finish_command called before we exit. However, if we
exit abnormally due to an early return or a signal, the
helper may continue to run in our absence.

In the best case, this may simply be wasted CPU cycles or a
few stray messages on a terminal. But it could also mean a
process that the user thought was aborted continues to run
to completion (e.g., a push's pack-objects helper will
complete the push, even though you killed the push process).

This patch provides infrastructure for run-command to keep
track of PIDs to be killed, and clean them on signal
reception or input, just as we do with tempfiles. PIDs can
be added in two ways:

  1. If NO_PTHREADS is defined, async helper processes are
     automatically marked. By definition this code must be
     ready to die when the parent dies, since it may be
     implemented as a thread of the parent process.

  2. If the run-command caller specifies the "clean_on_exit"
     option. This is not the default, as there are cases
     where it is OK for the child to outlive us (e.g., when
     spawning a pager).

PIDs are cleared from the kill-list automatically during
wait_or_whine, which is called from finish_command and
finish_async.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredentials: unable to connect to cache daemon
Clemens Buchacher [Sat, 7 Jan 2012 11:54:36 +0000 (12:54 +0100)]
credentials: unable to connect to cache daemon

Error out if we just spawned the daemon and yet we cannot connect.

And always release the string buffer.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5541: avoid TAP test miscounting
Michael J Gruber [Sun, 8 Jan 2012 21:06:21 +0000 (22:06 +0100)]
t5541: avoid TAP test miscounting

lib-terminal.sh runs a test and thus increases the test count, but the
output is lost so that TAP produces a "no plan found error".

Move the lib-terminal call after the lib-httpd and make TAP happy
(though still leave me clueless).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofix push --quiet: add 'quiet' capability to receive-pack
Clemens Buchacher [Sun, 8 Jan 2012 21:06:20 +0000 (22:06 +0100)]
fix push --quiet: add 'quiet' capability to receive-pack

Currently, git push --quiet produces some non-error output, e.g.:

 $ git push --quiet
 Unpacking objects: 100% (3/3), done.

This fixes a bug reported for the fedora git package:

 https://bugzilla.redhat.com/show_bug.cgi?id=725593

Reported-by: Jesse Keating <jkeating@redhat.com>
Cc: Todd Zullinger <tmz@pobox.com>
Commit 90a6c7d4 (propagate --quiet to send-pack/receive-pack)
introduced the --quiet option to receive-pack and made send-pack
pass that option. Older versions of receive-pack do not recognize
the option, however, and terminate immediately. The commit was
therefore reverted.

This change instead adds a 'quiet' capability to receive-pack,
which is a backwards compatible.

In addition, this fixes push --quiet via http: A verbosity of 0
means quiet for remote helpers.

Reported-by: Tobias Ulmer <tobiasu@tmux.org>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoserver_supports(): parse feature list more carefully
Junio C Hamano [Sun, 8 Jan 2012 21:06:19 +0000 (22:06 +0100)]
server_supports(): parse feature list more carefully

We have been carefully choosing feature names used in the protocol
extensions so that the vocabulary does not contain a word that is a
substring of another word, so it is not a real problem, but we have
recently added "quiet" feature word, which would mean we cannot later
add some other word with "quiet" (e.g. "quiet-push"), which is awkward.

Let's make sure that we can eventually be able to do so by teaching the
clients and servers that feature words consist of non whitespace
letters. This parser also allows us to later add features with parameters
e.g. "feature=1.5" (parameter values need to be quoted for whitespaces,
but we will worry about the detauls when we do introduce them).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9-rc0 v1.7.9-rc0
Junio C Hamano [Fri, 6 Jan 2012 20:48:17 +0000 (12:48 -0800)]
Git 1.7.9-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/show-sig'
Junio C Hamano [Fri, 6 Jan 2012 20:44:07 +0000 (12:44 -0800)]
Merge branch 'jc/show-sig'

* jc/show-sig:
  log --show-signature: reword the common two-head merge case
  log-tree: show mergetag in log --show-signature output
  log-tree.c: small refactor in show_signature()
  commit --amend -S: strip existing gpgsig headers
  verify_signed_buffer: fix stale comment
  gpg-interface: allow use of a custom GPG binary
  pretty: %G[?GS] placeholders
  test "commit -S" and "log --show-signature"
  log: --show-signature
  commit: teach --gpg-sign option

Conflicts:
builtin/commit-tree.c
builtin/commit.c
builtin/merge.c
notes-cache.c
pretty.c

12 years agoMerge branch 'jm/stash-diff-disambiguate'
Junio C Hamano [Fri, 6 Jan 2012 20:44:03 +0000 (12:44 -0800)]
Merge branch 'jm/stash-diff-disambiguate'

* jm/stash-diff-disambiguate:
  stash: Don't fail if work dir contains file named 'HEAD'

12 years agoMerge branch 'jh/fetch-head-update'
Junio C Hamano [Fri, 6 Jan 2012 20:44:01 +0000 (12:44 -0800)]
Merge branch 'jh/fetch-head-update'

* jh/fetch-head-update:
  write first for-merge ref to FETCH_HEAD first

12 years agoMerge branch 'pw/p4-view-updates'
Junio C Hamano [Fri, 6 Jan 2012 20:43:59 +0000 (12:43 -0800)]
Merge branch 'pw/p4-view-updates'

* pw/p4-view-updates:
  git-p4: view spec documentation
  git-p4: rewrite view handling
  git-p4: support single file p4 client view maps
  git-p4: sort client views by reverse View number
  git-p4: fix test for unsupported P4 Client Views
  git-p4: test client view handling

12 years agoSync with 1.7.8.3
Junio C Hamano [Fri, 6 Jan 2012 20:42:48 +0000 (12:42 -0800)]
Sync with 1.7.8.3

12 years agoGit 1.7.8.3 v1.7.8.3
Junio C Hamano [Fri, 6 Jan 2012 20:41:39 +0000 (12:41 -0800)]
Git 1.7.8.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jn/maint-gitweb-utf8-fix' into maint
Junio C Hamano [Fri, 6 Jan 2012 20:36:43 +0000 (12:36 -0800)]
Merge branch 'jn/maint-gitweb-utf8-fix' into maint

* jn/maint-gitweb-utf8-fix:
  gitweb: Fix fallback mode of to_utf8 subroutine
  gitweb: Output valid utf8 in git_blame_common('data')
  gitweb: esc_html() site name for title in OPML
  gitweb: Call to_utf8() on input string in chop_and_escape_str()

12 years agoMerge branch 'maint-1.7.7' into maint
Junio C Hamano [Fri, 6 Jan 2012 20:35:12 +0000 (12:35 -0800)]
Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
  Documentation: rerere.enabled is the primary way to configure rerere