git
3 months agogit peer: enumerate announced repositories next
Giuseppe Bilotta [Mon, 22 Nov 2010 14:22:33 +0000 (15:22 +0100)] 
git peer: enumerate announced repositories

This script lists git repositories announced on avahi by e.g. git serve.

3 months agogit serve: basic functionality
Giuseppe Bilotta [Mon, 22 Nov 2010 09:01:09 +0000 (10:01 +0100)] 
git serve: basic functionality

This tool is a wrapper around git-daemon to allow users to quickly
export one or more of their repositories. The export is announced using
avahi to allow machines in the local network to find them.

3 months agorebase: pass --signoff option to git am
Giuseppe Bilotta [Thu, 16 Sep 2010 08:59:21 +0000 (10:59 +0200)] 
rebase: pass --signoff option to git am

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>

3 months agoMerge branch 'jn/svn-fe' into next origin/next
Junio C Hamano [Sun, 29 Jan 2012 22:15:16 +0000 (14:15 -0800)] 
Merge branch 'jn/svn-fe' into next

This simplifies svn-fe a great deal and fulfills a longstanding wish:
support for dumps with deltas in them, and incremental imports.

The cost is that commandline usage of the svn-fe tool becomes a little
more complicated since it no longer keeps state itself but instead reads
blobs back from fast-import in order to copy them between revisions and
apply deltas to them.

Also removes a couple of custom data structures and replaces them with
strbufs like other parts of Git.

* jn/svn-fe: (33 commits)
  vcs-svn/svndiff.c: squelch false "unused" warning from gcc
  vcs-svn: reset first_commit_done in fast_export_init
  vcs-svn: do not initialize report_buffer twice
  vcs-svn: avoid hangs from corrupt deltas
  vcs-svn: guard against overflow when computing preimage length
  vcs-svn: cap number of bytes read from sliding view
  test-svn-fe: split off "test-svn-fe -d" into a separate function
  vcs-svn: implement text-delta handling
  vcs-svn: let deltas use data from preimage
  vcs-svn: let deltas use data from postimage
  vcs-svn: verify that deltas consume all inline data
  vcs-svn: implement copyfrom_data delta instruction
  vcs-svn: read instructions from deltas
  vcs-svn: read inline data from deltas
  vcs-svn: read the preimage when applying deltas
  vcs-svn: parse svndiff0 window header
  vcs-svn: skeleton of an svn delta parser
  vcs-svn: make buffer_read_binary API more convenient
  vcs-svn: learn to maintain a sliding view of a file
  Makefile: list one vcs-svn/xdiff object or header per line
  ...

3 months agoMerge branch 'master' into next
Junio C Hamano [Sun, 29 Jan 2012 21:46:44 +0000 (13:46 -0800)] 
Merge branch 'master' into next

* master:
  Kick off the post 1.7.9 cycle

3 months agoKick off the post 1.7.9 cycle origin/HEAD origin/master
Junio C Hamano [Sun, 29 Jan 2012 21:46:18 +0000 (13:46 -0800)] 
Kick off the post 1.7.9 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoRevert "Merge branch 'mm/zsh-completion-regression-fix' into next"
Junio C Hamano [Sun, 29 Jan 2012 21:26:27 +0000 (13:26 -0800)] 
Revert "Merge branch 'mm/zsh-completion-regression-fix' into next"

This reverts commit 7bc2e0a9f46e7c87f2828aa20b4729462599edee, reversing
changes made to f927323461ca9d6bb109f21793afb13b102fb836.

This topic has been superseded by Felipe's f15026b (git-completion:
workaround zsh COMPREPLY bug, 2012-01-25) to use "typeset -h IFS".

3 months agoMerge branch 'nd/index-pack-no-recurse'
Junio C Hamano [Sun, 29 Jan 2012 21:18:56 +0000 (13:18 -0800)] 
Merge branch 'nd/index-pack-no-recurse'

* nd/index-pack-no-recurse:
  index-pack: eliminate unlimited recursion in get_base_data()
  index-pack: eliminate recursion in find_unresolved_deltas
  Eliminate recursion in setting/clearing marks in commit list

3 months agoMerge branch 'rs/diff-postimage-in-context'
Junio C Hamano [Sun, 29 Jan 2012 21:18:55 +0000 (13:18 -0800)] 
Merge branch 'rs/diff-postimage-in-context'

* rs/diff-postimage-in-context:
  xdiff: print post-image for common records instead of pre-image

3 months agoMerge branch 'jk/parse-object-cached'
Junio C Hamano [Sun, 29 Jan 2012 21:18:55 +0000 (13:18 -0800)] 
Merge branch 'jk/parse-object-cached'

* jk/parse-object-cached:
  upload-pack: avoid parsing tag destinations
  upload-pack: avoid parsing objects during ref advertisement
  parse_object: try internal cache before reading object db

3 months agoMerge branch 'sp/smart-http-failure-to-push'
Junio C Hamano [Sun, 29 Jan 2012 21:18:54 +0000 (13:18 -0800)] 
Merge branch 'sp/smart-http-failure-to-push'

* sp/smart-http-failure-to-push:
  remote-curl: Fix push status report when all branches fail

3 months agoMerge branch 'jc/maint-log-first-parent-pathspec'
Junio C Hamano [Sun, 29 Jan 2012 21:18:54 +0000 (13:18 -0800)] 
Merge branch 'jc/maint-log-first-parent-pathspec'

* jc/maint-log-first-parent-pathspec:
  Making pathspec limited log play nicer with --first-parent

3 months agoMerge branch 'mh/ref-clone-without-extra-refs'
Junio C Hamano [Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800)] 
Merge branch 'mh/ref-clone-without-extra-refs'

* mh/ref-clone-without-extra-refs:
  write_remote_refs(): create packed (rather than extra) refs
  add_packed_ref(): new function in the refs API.
  ref_array: keep track of whether references are sorted
  pack_refs(): remove redundant check

3 months agoMerge branch 'jl/test-pause'
Junio C Hamano [Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800)] 
Merge branch 'jl/test-pause'

* jl/test-pause:
  test-lib: add the test_pause convenience function

3 months agoMerge branch 'tr/maint-mailinfo'
Junio C Hamano [Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800)] 
Merge branch 'tr/maint-mailinfo'

* tr/maint-mailinfo:
  mailinfo: with -b, keep space after [foo]
  am: learn passing -b to mailinfo

Conflicts:
git-am.sh

3 months agoMerge branch 'pw/p4-view-updates'
Junio C Hamano [Sun, 29 Jan 2012 21:18:52 +0000 (13:18 -0800)] 
Merge branch 'pw/p4-view-updates'

* pw/p4-view-updates:
  git-p4: add tests demonstrating spec overlay ambiguities
  git-p4: adjust test to adhere to stricter useClientSpec
  git-p4: clarify comment
  git-p4: fix verbose comment typo
  git-p4: only a single ... wildcard is supported

3 months agoMerge branch 'nd/maint-refname-in-hierarchy-check'
Junio C Hamano [Sun, 29 Jan 2012 21:18:51 +0000 (13:18 -0800)] 
Merge branch 'nd/maint-refname-in-hierarchy-check'

* nd/maint-refname-in-hierarchy-check:
  Fix incorrect ref namespace check

3 months agoMerge branch 'jn/gitweb-unspecified-action'
Junio C Hamano [Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)] 
Merge branch 'jn/gitweb-unspecified-action'

* jn/gitweb-unspecified-action:
  gitweb: Fix actionless dispatch for non-existent objects

3 months agoMerge branch 'cb/push-quiet'
Junio C Hamano [Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)] 
Merge branch 'cb/push-quiet'

* cb/push-quiet:
  t5541: avoid TAP test miscounting
  fix push --quiet: add 'quiet' capability to receive-pack
  server_supports(): parse feature list more carefully

3 months agoMerge branch 'nd/clone-single-branch'
Junio C Hamano [Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)] 
Merge branch 'nd/clone-single-branch'

* nd/clone-single-branch:
  clone: add --single-branch to fetch only one branch

3 months agoMerge branch 'cb/git-daemon-tests'
Junio C Hamano [Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)] 
Merge branch 'cb/git-daemon-tests'

* cb/git-daemon-tests:
  git-daemon tests: wait until daemon is ready
  git-daemon: produce output when ready
  git-daemon: add tests

3 months agoMerge branch 'cb/maint-kill-subprocess-upon-signal'
Junio C Hamano [Sun, 29 Jan 2012 21:18:50 +0000 (13:18 -0800)] 
Merge branch 'cb/maint-kill-subprocess-upon-signal'

* cb/maint-kill-subprocess-upon-signal:
  dashed externals: kill children on exit
  run-command: optionally kill children on exit

3 months agovcs-svn/svndiff.c: squelch false "unused" warning from gcc
Junio C Hamano [Fri, 27 Jan 2012 19:58:56 +0000 (11:58 -0800)] 
vcs-svn/svndiff.c: squelch false "unused" warning from gcc

Curiously, pre_len given to read_length() does not trigger the same warning
even though the code structure is the same. Most likely this is because
read_offset() is used only once and inlining it will make gcc realize that
it has a chance to do more flow analysis. Alas, the analysis is flawed, so
it does not help X-<.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoMerge branch 'master' into next
Junio C Hamano [Fri, 27 Jan 2012 19:31:18 +0000 (11:31 -0800)] 
Merge branch 'master' into next

* master:
  Git 1.7.9
  INSTALL: warn about recent Fedora breakage

3 months agoGit 1.7.9 origin/maint 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>

3 months agoMerge branch 'ar/i18n-no-gettext' into next
Junio C Hamano [Fri, 27 Jan 2012 19:21:03 +0000 (11:21 -0800)] 
Merge branch 'ar/i18n-no-gettext' into next

* ar/i18n-no-gettext:
  i18n: Do not force USE_GETTEXT_SCHEME=fallthrough on NO_GETTEXT

3 months agoMerge branch 'svn-fe' of git://repo.or.cz/git/jrn into jn/svn-fe
Junio C Hamano [Fri, 27 Jan 2012 19:04:28 +0000 (11:04 -0800)] 
Merge branch 'svn-fe' of git://repo.or.cz/git/jrn into jn/svn-fe

This simplifies svn-fe a great deal and fulfills a longstanding wish:
support for dumps with deltas in them, and incremental imports.

The cost is that commandline usage of the svn-fe tool becomes a little
more complicated since it no longer keeps state itself but instead reads
blobs back from fast-import in order to copy them between revisions and
apply deltas to them.

Also removes a couple of custom data structures and replaces them with
strbufs like other parts of Git.

* 'svn-fe' of git://repo.or.cz/git/jrn: (32 commits)
  vcs-svn: reset first_commit_done in fast_export_init
  vcs-svn: do not initialize report_buffer twice
  vcs-svn: avoid hangs from corrupt deltas
  vcs-svn: guard against overflow when computing preimage length
  vcs-svn: cap number of bytes read from sliding view
  test-svn-fe: split off "test-svn-fe -d" into a separate function
  vcs-svn: implement text-delta handling
  vcs-svn: let deltas use data from preimage
  vcs-svn: let deltas use data from postimage
  vcs-svn: verify that deltas consume all inline data
  vcs-svn: implement copyfrom_data delta instruction
  vcs-svn: read instructions from deltas
  vcs-svn: read inline data from deltas
  vcs-svn: read the preimage when applying deltas
  vcs-svn: parse svndiff0 window header
  vcs-svn: skeleton of an svn delta parser
  vcs-svn: make buffer_read_binary API more convenient
  vcs-svn: learn to maintain a sliding view of a file
  Makefile: list one vcs-svn/xdiff object or header per line
  vcs-svn: avoid using ls command twice
  ...

Conflicts:
Makefile
contrib/svn-fe/svn-fe.txt

3 months agoi18n: Do not force USE_GETTEXT_SCHEME=fallthrough on NO_GETTEXT
Junio C Hamano [Tue, 24 Jan 2012 00:31:09 +0000 (18:31 -0600)] 
i18n: Do not force USE_GETTEXT_SCHEME=fallthrough on NO_GETTEXT

It should merely be the default used when the builder does not say
anything about USE_GETTEXT_SCHEME.

Even with NO_GETTEXT, USE_GETTEXT_SCHEME=gnu may be a way to avoid
possibly slower emulation in our shell scripts.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months 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>

3 months agoMerge branch 'master' into next
Junio C Hamano [Thu, 26 Jan 2012 22:32:15 +0000 (14:32 -0800)] 
Merge branch 'master' into next

* master:
  git-completion: workaround zsh COMPREPLY bug
  docs: minor grammar fixes for v1.7.9 release notes

3 months agoMerge branch 'va/git-p4-branch' into next
Junio C Hamano [Thu, 26 Jan 2012 22:05:33 +0000 (14:05 -0800)] 
Merge branch 'va/git-p4-branch' into next

* va/git-p4-branch:
  t9801: do not overuse test_must_fail
  git-p4: Change p4 command invocation
  git-p4: Add test case for complex branch import
  git-p4: Search for parent commit on branch creation

3 months agoMerge branch 'jl/submodule-re-add' into next
Junio C Hamano [Thu, 26 Jan 2012 22:04:57 +0000 (14:04 -0800)] 
Merge branch 'jl/submodule-re-add' into next

* jl/submodule-re-add:
  submodule add: fix breakage when re-adding a deep submodule

3 months agoMerge branch 'nd/clone-detached' into next
Junio C Hamano [Thu, 26 Jan 2012 22:04:35 +0000 (14:04 -0800)] 
Merge branch 'nd/clone-detached' into next

* nd/clone-detached:
  clone: fix up delay cloning conditions

3 months 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>

3 months agot9801: do not overuse test_must_fail
Junio C Hamano [Thu, 26 Jan 2012 19:40:09 +0000 (11:40 -0800)] 
t9801: do not overuse test_must_fail

test_must_fail is to make sure a program we can potentially break during
the course of updating git itself exits with a non-zero status in a clean
and controlled way.

When we expect a non-zero exit status from the commands we use from the
underlying platform in tests, e.g. making sure a string "error: " does not
appear in the output by running "grep 'error: '", just use "! grep" for
readability. It is not like we will try to update Git and suddenly 'grep'
we use from the system starts segfaulting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: Change p4 command invocation
Pete Wyckoff [Wed, 25 Jan 2012 23:48:24 +0000 (23:48 +0000)] 
git-p4: Change p4 command invocation

Change p4 command invocation to avoid going through the shell. This
allows names with spaces and wildcards to work.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: Add test case for complex branch import
Vitor Antunes [Wed, 25 Jan 2012 23:48:23 +0000 (23:48 +0000)] 
git-p4: Add test case for complex branch import

Check if branches created from old changelists are correctly imported.
Also included some updates to simple branch test so that both are
coherent in respect to each other.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: Search for parent commit on branch creation
Vitor Antunes [Wed, 25 Jan 2012 23:48:22 +0000 (23:48 +0000)] 
git-p4: Search for parent commit on branch creation

To find out which is its parent the commit of the new branch is compared
sequentially to each blob of the parent branch from the newest to the
oldest. The first blob which results in a zero diff is considered the
parent commit. If none is found, then the commit is applied to the top
of the parent branch.

A fast-import "checkpoint" call is required because diff-tree is only
able to work with blobs on disk. But most of these commits will not be
part of the final imported tree, making fast-import fail. To avoid this,
the temporary branches are tracked and then removed at the end of the
import process.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months 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>

3 months 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>

3 months agoclone: fix up delay cloning conditions
Nguyễn Thái Ngọc Duy [Tue, 24 Jan 2012 11:10:38 +0000 (18:10 +0700)] 
clone: fix up delay cloning conditions

6f48d39 (clone: delay cloning until after remote HEAD checking -
2012-01-16) allows us to perform some checks on remote refs before the
actual cloning happens. But not all transport types support
this. Remote helper with "import" capability will not return complete
ref information until fetch is performed and therefore the clone cannot
be delayed.

foreign_vcs field in struct remote was used to detect this kind of transport
and save the result. This is a mistake because foreign_vcs is designed
to override url-based transport detection. As a result, if the same
"struct transport *" object is used on many different urls and one of
them attached remote transport, the following urls will be mistakenly
attached to the same transport. This fault is worked around by dad0b3d
(push: do not let configured foreign-vcs permanently clobbered -
2012-01-23)

To fix this, detect incomplete refs from transport_get_remote_refs()
by SHA-1. Incomplete ones must have null SHA-1 (*). Then revert
changes related to foreign_cvs field in 6f48d39 and dad0b3d.

A good thing from this change is that cloning smart http transport can
also be delayed. Earlier it falls into the same category "remote
transport, no delay".

(*) Theoretically if one of the remote refs happens to have null SHA-1,
it will trigger false alarm and the clone will not be delayed. But
that chance may be too small for us to pay attention to.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoMerge branch 'nd/clone-detached' into next
Junio C Hamano [Tue, 24 Jan 2012 00:43:10 +0000 (16:43 -0800)] 
Merge branch 'nd/clone-detached' into next

* nd/clone-detached:
  push: do not let configured foreign-vcs permanently clobbered

3 months agopush: do not let configured foreign-vcs permanently clobbered
Junio C Hamano [Tue, 24 Jan 2012 00:34:22 +0000 (16:34 -0800)] 
push: do not let configured foreign-vcs permanently clobbered

Recently, 6f48d39 (clone: delay cloning until after remote HEAD checking,
2012-01-16) tried to record if a remote helper needs to be called after
parsing the remote when transport_get() is called, by overwriting the
field meant to store the configured remote helper name in the remote
structure.

This is OK when a remote represents a single remote repository, but fails
miserably when pushing to locations with multiple URLs, like this:

    $ cat .git/config
    [remote "origin"]
        url = https://code.google.com/p/git-htmldocs/
        url = github.com:gitster/git-htmldocs.git
        push = refs/heads/master:refs/heads/master
    $ git push

The second url that is supposed to use the git-over-ssh transport
mistakenly use https:// and fails with:

    error: Couldn't resolve host 'github.com:gitster' while accessing
    github.com:gitster/git-htmldocs.git/info/refs
    fatal: HTTP request failed

The right solution would probably be to dedicate a separate field to store
the detected external helper to be used, which is valid only during a
single use of transport until it is disconnected, instead of overwriting
foreign_vcs field, but in the meantime, this band-aid should suffice.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoMerge branch 'rr/sequencer' into next
Junio C Hamano [Mon, 23 Jan 2012 22:55:26 +0000 (14:55 -0800)] 
Merge branch 'rr/sequencer' into next

* rr/sequencer:
  sequencer: factor code out of revert builtin
  revert: prepare to move replay_action to header

Conflicts:
builtin/revert.c

3 months agoMerge branch 'jc/pull-signed-tag' into next
Junio C Hamano [Mon, 23 Jan 2012 22:35:26 +0000 (14:35 -0800)] 
Merge branch 'jc/pull-signed-tag' into next

* jc/pull-signed-tag:
  merge: use editor by default in interactive sessions

Conflicts:
Documentation/merge-options.txt

3 months agomerge: use editor by default in interactive sessions
Junio C Hamano [Wed, 11 Jan 2012 06:44:45 +0000 (22:44 -0800)] 
merge: use editor by default in interactive sessions

Traditionally, a cleanly resolved merge was committed by "git merge" using
the auto-generated merge commit log message without invoking the editor.

After 5 years of use in the field, it turns out that people perform too
many unjustified merges of the upstream history into their topic branches.
These merges are not just useless, but they are often not explained well,
and making the end result unreadable when it gets time for merging their
history back to their upstream.

Earlier we added the "--edit" option to the command, so that people can
edit the log message to explain and justify their merge commits. Let's
take it one step further and spawn the editor by default when we are in an
interactive session (i.e. the standard input and the standard output are
pointing at the same tty device).

There may be existing scripts that leave the standard input and the
standard output of the "git merge" connected to whatever environment the
scripts were started, and such invocation might trigger the above
"interactive session" heuristics.  GIT_MERGE_AUTOEDIT environment variable
can be set to "no" at the beginning of such scripts to use the historical
behaviour while the script runs.

Note that this backward compatibility is meant only for scripts, and we
deliberately do *not* support "merge.edit = yes/no/auto" configuration
option to allow people to keep the historical behaviour.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoMerge branch 'ar/i18n-no-gettext' into next
Junio C Hamano [Mon, 23 Jan 2012 22:25:56 +0000 (14:25 -0800)] 
Merge branch 'ar/i18n-no-gettext' into next

* ar/i18n-no-gettext:
  i18n: Make NO_GETTEXT imply fallthrough scheme in shell l10n
  add a Makefile switch to avoid gettext translation in shell scripts
  git-sh-i18n: restructure the logic to compute gettext.sh scheme

3 months agoi18n: Make NO_GETTEXT imply fallthrough scheme in shell l10n
Junio C Hamano [Mon, 23 Jan 2012 22:25:19 +0000 (14:25 -0800)] 
i18n: Make NO_GETTEXT imply fallthrough scheme in shell l10n

Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoadd a Makefile switch to avoid gettext translation in shell scripts
Alex Riesen [Mon, 23 Jan 2012 22:04:29 +0000 (14:04 -0800)] 
add a Makefile switch to avoid gettext translation in shell scripts

Some systems have gettext.sh (GNU gettext) installed, but it is either
broken or misconfigured in such a way so its output is not usable.  In
case the users of these systems are unable or not interested in fixing
them, setting the new Makefile switch should help:

    make USE_GETTEXT_SCHEME=fallthrough

This will replace the translation routines with fallthrough versions,
that does not use gettext from the platform.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-sh-i18n: restructure the logic to compute gettext.sh scheme
Junio C Hamano [Mon, 23 Jan 2012 22:02:55 +0000 (14:02 -0800)] 
git-sh-i18n: restructure the logic to compute gettext.sh scheme

Instead of having a single long and complex chain of commands to decide
what to do and carry out the decision, split the code so that we first
decide which scheme to use, and in the second section define what exactly
is done by the chosen scheme. It makes the code much easier to follow and
update.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoMerge branch 'nd/clone-detached' into next
Junio C Hamano [Mon, 23 Jan 2012 21:25:55 +0000 (13:25 -0800)] 
Merge branch 'nd/clone-detached' into next

* nd/clone-detached:
  clone: print advice on checking out detached HEAD
  clone: allow --branch to take a tag
  clone: refuse to clone if --branch points to bogus ref
  clone: --branch=<branch> always means refs/heads/<branch>
  clone: delay cloning until after remote HEAD checking
  clone: factor out remote ref writing
  clone: factor out HEAD update code
  clone: factor out checkout code
  clone: write detached HEAD in bare repositories
  t5601: add missing && cascade

3 months agoMerge branch 'tr/grep-l-with-decoration' into next
Junio C Hamano [Mon, 23 Jan 2012 21:25:54 +0000 (13:25 -0800)] 
Merge branch 'tr/grep-l-with-decoration' into next

* tr/grep-l-with-decoration:
  grep: fix -l/-L interaction with decoration lines

3 months agoMerge branch 'ks/sort-wildcard-in-makefile' into next
Junio C Hamano [Mon, 23 Jan 2012 21:25:54 +0000 (13:25 -0800)] 
Merge branch 'ks/sort-wildcard-in-makefile' into next

* ks/sort-wildcard-in-makefile:
  t/Makefile: Use $(sort ...) explicitly where needed

3 months agoMerge branch 'jc/advise-i18n' into next
Junio C Hamano [Mon, 23 Jan 2012 21:25:54 +0000 (13:25 -0800)] 
Merge branch 'jc/advise-i18n' into next

* jc/advise-i18n:
  i18n of multi-line advice messages

3 months agoMerge branch 'ld/git-p4-branches-and-labels' into next
Junio C Hamano [Mon, 23 Jan 2012 21:25:53 +0000 (13:25 -0800)] 
Merge branch 'ld/git-p4-branches-and-labels' into next

* ld/git-p4-branches-and-labels:
  git-p4: label import fails with multiple labels at the same changelist
  git-p4: add test for p4 labels
  git-p4: importing labels should cope with missing owner
  git-p4: cope with labels with empty descriptions
  git-p4: handle p4 branches and labels containing shell chars

3 months agoMerge branch 'mm/zsh-completion-regression-fix' into next
Junio C Hamano [Mon, 23 Jan 2012 20:53:09 +0000 (12:53 -0800)] 
Merge branch 'mm/zsh-completion-regression-fix' into next

* mm/zsh-completion-regression-fix:
  bash-completion: don't add quoted space for ZSH (fix regression)

3 months agoMerge branch 'da/maint-mergetool-twoway' into next
Junio C Hamano [Mon, 23 Jan 2012 20:53:09 +0000 (12:53 -0800)] 
Merge branch 'da/maint-mergetool-twoway' into next

* da/maint-mergetool-twoway:
  mergetool: Provide an empty file when needed

3 months agoMerge branch 'master' into next
Junio C Hamano [Mon, 23 Jan 2012 20:52:59 +0000 (12:52 -0800)] 
Merge branch 'master' into next

* master:
  Fix typo in 1.7.9 release notes

3 months 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>

3 months 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>

3 months 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>

3 months agot/Makefile: Use $(sort ...) explicitly where needed
Kirill Smelkov [Sat, 3 Sep 2011 20:41:21 +0000 (00:41 +0400)] 
t/Makefile: Use $(sort ...) explicitly where needed

Starting from GNU Make 3.82 $(wildcard ...) no longer sorts the result
(from NEWS):

    * WARNING: Backward-incompatibility!
      Wildcards were not documented as returning sorted values, but the results
      have been sorted up until this release..  If your makefiles require sorted
      results from wildcard expansions, use the $(sort ...)  function to request
      it explicitly.

    http://repo.or.cz/w/make.git/commitdiff/2a59dc32aaf0681dec569f32a9d7ab88a379d34f

I usually watch test progress visually, and if tests are sorted, even
with make -j4 they go more or less incrementally by their t number. On
the other side, without sorting, tests are executed in seemingly random
order even for -j1. Let's please maintain sane tests order for perceived
prettyness.

Another note is that in GNU Make sort also works as uniq, so after sort
being removed, we might expect e.g. $(wildcard *.sh a.*) to produce
duplicates for e.g. "a.sh". From this point of view, adding sort could
be seen as hardening t/Makefile from accidentally introduced dups.

It turned out that prevous releases of GNU Make did not perform full
sort in $(wildcard), only sorting results for each pattern, that's why
explicit sort-as-uniq is relevant even for older makes.

Signed-off-by: Kirill Smelkov <kirr@navytux.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: label import fails with multiple labels at the same changelist
Luke Diamand [Thu, 19 Jan 2012 09:52:29 +0000 (09:52 +0000)] 
git-p4: label import fails with multiple labels at the same changelist

git-p4 has an array of changelists with one label per changelist.
But you can have multiple labels on a single changelist and so this
code fails.

Add a test case demonstrating the problem.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: add test for p4 labels
Luke Diamand [Thu, 19 Jan 2012 09:52:28 +0000 (09:52 +0000)] 
git-p4: add test for p4 labels

Add basic test of p4 label import. Checks label import and
import with shell metachars; labels with different length
descriptions.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: importing labels should cope with missing owner
Luke Diamand [Thu, 19 Jan 2012 09:52:27 +0000 (09:52 +0000)] 
git-p4: importing labels should cope with missing owner

In p4, the Owner field is optional. If it is missing,
construct something sensible rather than crashing.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: cope with labels with empty descriptions
Luke Diamand [Thu, 19 Jan 2012 09:52:26 +0000 (09:52 +0000)] 
git-p4: cope with labels with empty descriptions

Use an explicit length for the data in a label, rather
than EOT, so that labels with empty descriptions are
passed through correctly.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agogit-p4: handle p4 branches and labels containing shell chars
Luke Diamand [Thu, 19 Jan 2012 09:52:25 +0000 (09:52 +0000)] 
git-p4: handle p4 branches and labels containing shell chars

Don't use shell expansion when detecting branches, as it will
fail if the branch name contains a shell metachar. Similarly
for labels.

Add additional test for branches with shell metachars.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

3 months agoMerge branch 'mh/ref-clone-without-extra-refs' into next
Junio C Hamano [Fri, 20 Jan 2012 22:35:58 +0000 (14:35 -0800)] 
Merge branch 'mh/ref-clone-without-extra-refs' into next

* mh/ref-clone-without-extra-refs:
  write_remote_refs(): create packed (rather than extra) refs
  add_packed_ref(): new function in the refs API.
  ref_array: keep track of whether references are sorted
  pack_refs(): remove redundant check

3 months agoMerge branch 'sp/smart-http-failure-to-push' into next
Junio C Hamano [Fri, 20 Jan 2012 22:35:58 +0000 (14:35 -0800)] 
Merge branch 'sp/smart-http-failure-to-push' into next

* sp/smart-http-failure-to-push:
  remote-curl: Fix push status report when all branches fail

3 months agoMerge branch 'pw/p4-view-updates' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:29 +0000 (14:25 -0800)] 
Merge branch 'pw/p4-view-updates' into next

* pw/p4-view-updates:
  git-p4: add tests demonstrating spec overlay ambiguities
  git-p4: adjust test to adhere to stricter useClientSpec
  git-p4: clarify comment
  git-p4: fix verbose comment typo
  git-p4: only a single ... wildcard is supported

3 months agoMerge branch 'nd/index-pack-no-recurse' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:29 +0000 (14:25 -0800)] 
Merge branch 'nd/index-pack-no-recurse' into next

* nd/index-pack-no-recurse:
  index-pack: eliminate unlimited recursion in get_base_data()
  index-pack: eliminate recursion in find_unresolved_deltas
  Eliminate recursion in setting/clearing marks in commit list

3 months agoMerge branch 'jc/maint-log-first-parent-pathspec' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:29 +0000 (14:25 -0800)] 
Merge branch 'jc/maint-log-first-parent-pathspec' into next

* jc/maint-log-first-parent-pathspec:
  Making pathspec limited log play nicer with --first-parent

3 months agoMerge branch 'jl/test-pause' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:28 +0000 (14:25 -0800)] 
Merge branch 'jl/test-pause' into next

* jl/test-pause:
  test-lib: add the test_pause convenience function

3 months agoMerge branch 'tr/maint-mailinfo' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:28 +0000 (14:25 -0800)] 
Merge branch 'tr/maint-mailinfo' into next

* tr/maint-mailinfo:
  mailinfo: with -b, keep space after [foo]
  am: learn passing -b to mailinfo

Conflicts:
git-am.sh

3 months agoMerge branch 'nd/maint-refname-in-hierarchy-check' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:27 +0000 (14:25 -0800)] 
Merge branch 'nd/maint-refname-in-hierarchy-check' into next

* nd/maint-refname-in-hierarchy-check:
  Fix incorrect ref namespace check

3 months agoMerge branch 'jn/gitweb-unspecified-action' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:27 +0000 (14:25 -0800)] 
Merge branch 'jn/gitweb-unspecified-action' into next

* jn/gitweb-unspecified-action:
  gitweb: Fix actionless dispatch for non-existent objects

3 months agoMerge branch 'cb/push-quiet' into next
Junio C Hamano [Fri, 20 Jan 2012 22:25:27 +0000 (14:25 -0800)] 
Merge branch 'cb/push-quiet' into next

* cb/push-quiet:
  t5541: avoid TAP test miscounting
  fix push --quiet: add 'quiet' capability to receive-pack
  server_supports(): parse feature list more carefully

3 months 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>

4 months 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>

4 months agoMerge branch 'master' into next
Junio C Hamano [Wed, 18 Jan 2012 23:53:55 +0000 (15:53 -0800)] 
Merge branch 'master' into next

* master:
  Git 1.7.9-rc2
  Git 1.7.8.4
  Git 1.7.7.6
  diff-index: enable recursive pathspec matching in unpack_trees
  pulling signed tag: add howto document

4 months 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>

4 months 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

4 months 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>

4 months 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

4 months 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>

4 months 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>

4 months 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

4 months 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>

4 months 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

4 months 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

4 months 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

4 months 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

4 months agotest-lib: add the test_pause convenience function
Jens Lehmann [Tue, 17 Jan 2012 21:04:31 +0000 (22:04 +0100)] 
test-lib: add the test_pause convenience function

Since 781f76b15 (test-lib: redirect stdin of tests) you can't simply put a
"bash &&" into a test for debugging purposes anymore. Instead you'll have
to use "bash <&6 >&3 2>&4".

As that invocation is not that easy to remember add the test_pause
convenience function. It invokes "$SHELL_PATH" to provide a sane shell
for the user.

This function also checks if the -v flag is given and will error out if
that is not the case instead of letting the test hang until ^D is pressed.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

4 months agowrite_remote_refs(): create packed (rather than extra) refs
Michael Haggerty [Tue, 17 Jan 2012 05:50:34 +0000 (06:50 +0100)] 
write_remote_refs(): create packed (rather than extra) refs

write_remote_refs() creates new packed refs from references obtained
from the remote repository, which is "out of thin air" as far as the
local repository is concerned.  Previously it did this by creating
"extra" refs, then calling pack_refs() to bake them into the
packed-refs file.  Instead, create packed refs (in the packed
reference cache) directly, then call pack_refs().

Aside from being more logical, this is another step towards removing
extra refs entirely.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

4 months agoadd_packed_ref(): new function in the refs API.
Michael Haggerty [Tue, 17 Jan 2012 05:50:33 +0000 (06:50 +0100)] 
add_packed_ref(): new function in the refs API.

Add a new function add_packed_ref() that adds a reference directly to
the in-memory packed reference cache.  This will be useful for
creating local references while cloning.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

4 months agoref_array: keep track of whether references are sorted
Michael Haggerty [Tue, 17 Jan 2012 05:50:32 +0000 (06:50 +0100)] 
ref_array: keep track of whether references are sorted

Keep track of how many entries at the beginning of a ref_array are already
sorted.  In sort_ref_array(), return early if the the array is already
sorted (i.e., if no new references has been appended to the end of the
list since the last call to sort_ref_array()).

Sort ref_arrays only when needed, namely in search_ref_array() and in
do_for_each_ref().  However, never call sort_ref_array() on the
extra_refs, because extra_refs can contain multiple entries with the same
name and because sort_ref_array() not only sorts, but de-dups its
contents.

This change is currently not useful, because entries are not added to
ref_arrays after they are created.  But in a moment they will be...

Implementation note: we could store a binary "sorted" value instead of
an integer, but storing the number of sorted entries leaves the way
open for a couple of possible future optimizations:

* In sort_ref_array(), sort *only* the unsorted entries, then merge
  them with the sorted entries.  This should be faster if most of the
  entries are already sorted.

* Teach search_ref_array() to do a binary search of any sorted
  entries, and if unsuccessful do a linear search of any unsorted
  entries.  This would avoid the need to sort the list every time that
  search_ref_array() is called, and (given some intelligence about how
  often to sort) could significantly improve the speed in certain
  hypothetical usage patterns.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

4 months agopack_refs(): remove redundant check
Michael Haggerty [Tue, 17 Jan 2012 05:50:31 +0000 (06:50 +0100)] 
pack_refs(): remove redundant check

handle_one_ref() only adds refs to the cbdata.ref_to_prune list if
(cbdata.flags & PACK_REFS_PRUNE) is set.  So any references in this
list at the end of pack_refs() can be pruned unconditionally.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

4 months agobash-completion: don't add quoted space for ZSH (fix regression)
Matthieu Moy [Sat, 14 Jan 2012 18:55:36 +0000 (19:55 +0100)] 
bash-completion: don't add quoted space for ZSH (fix regression)

Commit a31e626 (completion: optimize refs completion) introduced a
regression for ZSH users: ref names were completed with a quoted trailing
space (i.e. "git checkout ma" completes to "git checkout master\ "). The
space is convenient for bash users since we use "-o nospace", but a
quoted space is worse than nothing. The absence of trailing space for ZSH
is a long-standing issue, that this patch is not fixing. We just fix the
regression by not appending a space when the shell is ZSH.

Original-patch-by: SZEDER Gábor <szeder@ira.uka.de>
Reported-by: Stefan Haller <lists@haller-berlin.de>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

4 months agoMerge branch 'jk/credentials' into next
Junio C Hamano [Tue, 17 Jan 2012 06:16:50 +0000 (22:16 -0800)] 
Merge branch 'jk/credentials' into next

* jk/credentials:
  credential-cache: ignore "connection refused" errors

4 months 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>