gitweb.git
config: set errno in numeric git_parse_* functionsJeff King Sun, 8 Sep 2013 08:36:42 +0000 (04:36 -0400)

config: set errno in numeric git_parse_* functions

When we are parsing an integer or unsigned long, we use
the strto*max functions, which properly set errno to ERANGE
if we get a large value. However, we also do further range
checks after applying our multiplication factor, but do not
set ERANGE. This means that a caller cannot tell if an error
was caused by ERANGE or if the input was simply not a valid
number.

This patch teaches git_parse_signed and git_parse_unsigned to set
ERANGE for range errors, and EINVAL for other errors, so that the
caller can reliably tell these cases apart.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: properly range-check integer valuesJeff King Sun, 8 Sep 2013 08:33:08 +0000 (04:33 -0400)

config: properly range-check integer values

When we look at a config value as an integer using the
git_config_int function, we carefully range-check the value
we get and complain if it is out of our range. But the range
we compare to is that of a "long", which we then cast to an
"int" in the function's return value. This means that on
systems where "int" and "long" have different sizes (e.g.,
LP64 systems), we may pass the range check, but then return
nonsense by truncating the value as we cast it to an int.

We can solve this by converting git_parse_long into
git_parse_int, and range-checking the "int" range. Nobody
actually cared that we used a "long" internally, since the
result was truncated anyway. And the only other caller of
git_parse_long is git_config_maybe_bool, which should be
fine to just use int (though we will now forbid out-of-range
nonsense like setting "merge.ff" to "10g" to mean "true",
which is probably a good thing).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: factor out integer parsing from range checksJeff King Sun, 8 Sep 2013 08:29:27 +0000 (04:29 -0400)

config: factor out integer parsing from range checks

When we are parsing integers for config, we use an intmax_t
(or uintmax_t) internally, and then check against the size
of our result type at the end. We can parameterize the
maximum representable value, which will let us re-use the
parsing code for a variety of range checks.

Unfortunately, we cannot combine the signed and unsigned
parsing functions easily, as we have to rely on the signed
and unsigned C types internally.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch.c: Relax unnecessary requirement on upstream... Per Cederqvist Sun, 8 Sep 2013 20:58:15 +0000 (22:58 +0200)

branch.c: Relax unnecessary requirement on upstream's remote ref name

When creating an upstream relationship, we use the configured remotes and
their refspecs to determine the upstream configuration settings
branch.<name>.remote and branch.<name>.merge. However, if the matching
refspec does not have refs/heads/<something> on the remote side, we end
up rejecting the match, and failing the upstream configuration.

It could be argued that when we set up an branch's upstream, we want that
upstream to also be a proper branch in the remote repo. Although this is
typically the common case, there are cases (as demonstrated by the previous
patch in this series) where this requirement prevents a useful upstream
relationship from being formed. Furthermore:

- We have fundamentally no say in how the remote repo have organized its
branches. The remote repo may put branches (or branch-like constructs
that are insteresting for downstreams to track) outside refs/heads/*.

- The user may intentionally want to track a non-branch from a remote
repo, by using a branch and configured upstream in the local repo.

Relaxing the checking to only require a matching remote/refspec allows the
testcase introduced in the previous patch to succeed, and has no negative
effect on the rest of the test suite.

This patch fixes a behavior (arguably a regression) first introduced in
41c21f2 (branch.c: Validate tracking branches with refspecs instead of
refs/remotes/*) on 2013-04-21 (released in >= v1.8.3.2).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3200: Add test demonstrating minor regression in 41c21f2Johan Herland Sun, 8 Sep 2013 20:58:14 +0000 (22:58 +0200)

t3200: Add test demonstrating minor regression in 41c21f2

In 41c21f2 (branch.c: Validate tracking branches with refspecs instead of
refs/remotes/*), we changed the rules for what is considered a valid tracking
branch (a.k.a. upstream branch). We now use the configured remotes and their
refspecs to determine whether a proposed tracking branch is in fact within
the domain of a remote, and we then use that information to deduce the
upstream configuration (branch.<name>.remote and branch.<name>.merge).

However, with that change, we also check that - in addition to a matching
refspec - the result of mapping the tracking branch through that refspec
(i.e. the corresponding ref name in the remote repo) happens to start with
"refs/heads/". In other words, we require that a tracking branch refers to
a _branch_ in the remote repo.

Now, consider that you are e.g. setting up an automated building/testing
infrastructure for a group of similar "source" repositories. The build/test
infrastructure consists of a central scheduler, and a number of build/test
"slave" machines that perform the actual build/test work. The scheduler
monitors the group of similar repos for changes (e.g. with a periodic
"git fetch"), and triggers builds/tests to be run on one or more slaves.
Graphically the changes flow between the repos like this:

Source #1 -------v ----> Slave #1
/
Source #2 -----> Scheduler -----> Slave #2
\
Source #3 -------^ ----> Slave #3

... ...

The scheduler maintains a single Git repo with each of the source repos set
up as distinct remotes. The slaves also need access to all the changes from
all of the source repos, so they pull from the scheduler repo, but using the
following custom refspec:

remote.origin.fetch = "+refs/remotes/*:refs/remotes/*"

This makes all of the scheduler's remote-tracking branches automatically
available as identical remote-tracking branches in each of the slaves.

Now, consider what happens if a slave tries to create a local branch with
one of the remote-tracking branches as upstream:

git branch local_branch --track refs/remotes/source-1/some_branch

Git now looks at the configured remotes (in this case there is only "origin",
pointing to the scheduler's repo) and sees refs/remotes/source-1/some_branch
matching origin's refspec. Mapping through that refspec we find that the
corresponding remote ref name is "refs/remotes/source-1/some_branch".
However, since this remote ref name does not start with "refs/heads/", we
discard it as a suitable upstream, and the whole command fails.

This patch adds a testcase demonstrating this failure by creating two
source repos ("a" and "b") that are forwarded through a scheduler ("c")
to a slave repo ("d"), that then tries create a local branch with an
upstream. See the next patch in this series for the exciting conclusion
to this story...

Reported-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Refer to branch.<name>.remote/merge when documenting... Johan Herland Sun, 8 Sep 2013 20:58:13 +0000 (22:58 +0200)

Refer to branch.<name>.remote/merge when documenting --track

Make it easier for readers to find the actual config variables that
implement the "upstream" relationship.

Suggested-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3200: Minor fix when preparing for tracking failureJohan Herland Sun, 8 Sep 2013 20:58:12 +0000 (22:58 +0200)

t3200: Minor fix when preparing for tracking failure

We're testing that trying to --track a ref that is not covered by any remote
refspec should fail. For that, we want to have refs/remotes/local/master
present, but we also want the remote.local.fetch refspec to NOT match
refs/remotes/local/master (so that the tracking setup will fail, as intended).
However, when doing "git fetch local" to ensure the existence of
refs/remotes/local/master, we must not already have changed remote.local.fetch
so as to cause refs/remotes/local/master not to be fetched. Therefore, set
remote.local.fetch to refs/heads/*:refs/remotes/local/* BEFORE we fetch, and
then reset it to refs/heads/s:refs/remotes/local/s AFTER we have fetched
(but before we test --track).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t2024: Fix &&-chaining and a couple of typosJohan Herland Sun, 8 Sep 2013 20:58:11 +0000 (22:58 +0200)

t2024: Fix &&-chaining and a couple of typos

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: fix run_specific_rebase's use of "return" on... Matthieu Moy Mon, 9 Sep 2013 08:53:15 +0000 (10:53 +0200)

rebase: fix run_specific_rebase's use of "return" on FreeBSD

Since a1549e10, git-rebase--am.sh uses the shell's "return" statement, to
mean "return from the current file inclusion", which is POSIXly correct,
but badly interpreted on FreeBSD, which returns from the current
function, hence skips the finish_rebase statement that follows the file
inclusion.

Make the use of "return" portable by using the file inclusion as the last
statement of a function.

Reported-by: Christoph Mallon <christoph.mallon@gmx.de>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git_remote_helpers: remove little used Python libraryJohn Keeping Sat, 7 Sep 2013 16:19:29 +0000 (17:19 +0100)

git_remote_helpers: remove little used Python library

When it was originally added, the git_remote_helpers library was used as
part of the tests of the remote-helper interface, but since commit
fc407f9 (Add new simplified git-remote-testgit, 2012-11-28) a simple
shell script is used for this.

A search on Ohloh [1] indicates that this library isn't used by any
external projects and even the Python remote helpers in contrib/ don't
use this library, so it is only used by its own test suite.

Since this is the only Python library in Git, removing it will make
packaging easier as the Python scripts only need to be installed for one
version of Python, whereas the library should be installed for all
available versions.

[1] http://code.ohloh.net/search?s=%22git_remote_helpers%22

Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: use $curr_branch_short moreRené Scharfe Sun, 8 Sep 2013 15:21:44 +0000 (17:21 +0200)

pull: use $curr_branch_short more

One of the first things git-pull.sh does is setting $curr_branch to
the target of HEAD and $curr_branch_short to the same but with the
leading "refs/heads/" removed. Simplify the code by using
$curr_branch_short instead of setting $curr_branch to the same
shortened value.

The only other use of $curr_branch in that function doesn't have to
be replaced with $curr_branch_short because it just checks if the
string is empty. That property is the same with or without the prefix
unless HEAD points to "refs/heads/" alone, which is invalid.

Noticed-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-bzr: reuse bzrlib transports when possibleRichard Hansen Sun, 8 Sep 2013 05:47:49 +0000 (01:47 -0400)

remote-bzr: reuse bzrlib transports when possible

Pass a list of open bzrlib.transport.Transport objects to each bzrlib
function that might create a transport. This enables bzrlib to reuse
existing transports when possible, avoiding multiple concurrent
connections to the same remote server.

If the remote server is accessed via ssh, this fixes a couple of
problems:
* If the user does not have keys loaded into an ssh agent, the user
may be prompted for a password multiple times.
* If the user is using OpenSSH and the ControlMaster setting is set
to auto, git-remote-bzr might hang. This is because bzrlib closes
the multiple ssh sessions in an undefined order and might try to
close the master ssh session before the other sessions. The
master ssh process will not exit until the other sessions have
exited, causing a deadlock. (The ssh sessions are closed in an
undefined order because bzrlib relies on the Python garbage
collector to trigger ssh session termination.)

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Acked-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: de.po: use "das Tag" instead of "der Tag"Ralf Thielow Sun, 8 Sep 2013 14:28:36 +0000 (16:28 +0200)

l10n: de.po: use "das Tag" instead of "der Tag"

Use "das Tag" to avoid confusion with the German word "Tag" (day).

Reported-by: Dirk Heinrichs <dirk.heinrichs@altum.de>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

Documentation: make AsciiDoc links always point to... Sebastian Schuberth Fri, 6 Sep 2013 20:03:22 +0000 (22:03 +0200)

Documentation: make AsciiDoc links always point to HTML files

AsciiDoc's "link" is supposed to create hyperlinks for HTML output, so
prefer a "link" to point to an HTML file instead of a text file if an HTML
version of the file is being generated. For RelNotes, keep pointing to
text files as no equivalent HTML files are generated.

If appropriate, also update the link description to not contain the linked
file's extension.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: add missing blank line after list of "other... Matthieu Moy Fri, 6 Sep 2013 17:43:09 +0000 (19:43 +0200)

status: add missing blank line after list of "other" files

List of files in other sections ("Changes to be committed", ...) end with
a blank line. It is not the case with the "Untracked files" and "Ignored
files" sections. The issue become particularly visible after the #-prefix
removal, as the last line (e.g. "nothing added to commit but untracked
files present") seems mixed with the untracked files.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: don't set status.displayCommentPrefix file-wideMatthieu Moy Fri, 6 Sep 2013 17:43:08 +0000 (19:43 +0200)

tests: don't set status.displayCommentPrefix file-wide

The previous commit set status.displayCommentPrefix file-wide in
t7060-wtstatus.sh, t7508-status.sh and t/t7512-status-help.sh to make the
patch small. However, now that status.displayCommentPrefix is not the
default, it is better to disable it in tests so that the most common
situation is also the most tested.

While we're there, move the "cat > expect << EOF" blocks inside the
tests.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: disable display of '#' comment prefix by defaultMatthieu Moy Fri, 6 Sep 2013 17:43:07 +0000 (19:43 +0200)

status: disable display of '#' comment prefix by default

Historically, "git status" needed to prefix each output line with '#' so
that the output could be added as comment to the commit message. This
prefix comment has no real purpose when "git status" is ran from the
command-line, and this may distract users from the real content.

Disable this prefix comment by default, and make it re-activable for
users needing backward compatibility with status.displayCommentPrefix.

Obviously, "git commit" ignores status.displayCommentPrefix and keeps the
comment unconditionnaly when writing to COMMIT_EDITMSG (but not when
writing to stdout for an error message or with --dry-run).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule summary: ignore --for-status optionMatthieu Moy Fri, 6 Sep 2013 17:43:06 +0000 (19:43 +0200)

submodule summary: ignore --for-status option

The --for-status option was an undocumented option used only by
wt-status.c, which inserted a header and commented out the output. We can
achieve the same result within wt-status.c, without polluting the
submodule command-line options.

This will make it easier to disable the comments from wt-status.c later.

The --for-status is kept so that another topic in flight
(bc/submodule-status-ignored) can continue relying on it, although it is
currently a no-op.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: use argv_array APIMatthieu Moy Fri, 6 Sep 2013 17:43:05 +0000 (19:43 +0200)

wt-status: use argv_array API

No behavior change, but two slight code reorganization: argv_array_push
doesn't accept NULL strings, and duplicates its argument hence
summary_limit must be written to before being inserted into argv.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/stripspace.c: fix broken indentationMatthieu Moy Fri, 6 Sep 2013 17:43:04 +0000 (19:43 +0200)

builtin/stripspace.c: fix broken indentation

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: fix termination issues for remote svn connectionsUli Heller Tue, 3 Sep 2013 07:35:29 +0000 (09:35 +0200)

git-svn: fix termination issues for remote svn connections

git-svn used in combination with serf to talk to svn repository
served over HTTPS dumps core on termination.

This is caused by a bug in serf, and the most recent serf release
1.3.1 still exhibits the problem; a fix for the bug exists (see
https://code.google.com/p/serf/source/detail?r=2146).

Until the bug is fixed, work around the issue within the git perl
module Ra.pm by freeing the private copy of the remote access object
on termination, which seems to be sufficient to prevent the error
from happening.

Note: Since subversion-1.8.0 and later do require serf-1.2.1 or
later, this issue typically shows up when upgrading to a recent
version of subversion.

Credits go to Jonathan Lambrechts for proposing a fix to Ra.pm,
Evgeny Kotkov and Ivan Zhakov for fixing the issue in serf and
pointing me to that fix.

Signed-off-by: Uli Heller <uli.heller@daemons-point.com>
Tested-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

typofix: cherry is spelled with two arsJunio C Hamano Thu, 5 Sep 2013 21:51:17 +0000 (14:51 -0700)

typofix: cherry is spelled with two ars

Do not say chery; it is spelled cherry.

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

Sync with maintJunio C Hamano Thu, 5 Sep 2013 21:41:40 +0000 (14:41 -0700)

Sync with maint

* maint:
Documentation/git-merge.txt: fix formatting of example block

Merge branch 'nd/fetch-pack-shallow-fix' into maintJunio C Hamano Thu, 5 Sep 2013 21:40:58 +0000 (14:40 -0700)

Merge branch 'nd/fetch-pack-shallow-fix' into maint

The recent "short-cut clone connectivity check" topic broke a shallow
repository when a fetch operation tries to auto-follow tags.

* nd/fetch-pack-shallow-fix:
fetch-pack: do not remove .git/shallow file when --depth is not specified

Merge branch 'hv/config-from-blob' into maintJunio C Hamano Thu, 5 Sep 2013 21:40:18 +0000 (14:40 -0700)

Merge branch 'hv/config-from-blob' into maint

Compilation fix on platforms with fgetc() and friends defined as
macros.

* hv/config-from-blob:
config: do not use C function names as struct members

Merge branch 'maint-1.8.3' into maintJunio C Hamano Thu, 5 Sep 2013 21:24:59 +0000 (14:24 -0700)

Merge branch 'maint-1.8.3' into maint

* maint-1.8.3:
Documentation/git-merge.txt: fix formatting of example block

Merge branch 'maint-1.8.2' into maint-1.8.3Junio C Hamano Thu, 5 Sep 2013 21:24:52 +0000 (14:24 -0700)

Merge branch 'maint-1.8.2' into maint-1.8.3

* maint-1.8.2:
Documentation/git-merge.txt: fix formatting of example block

add: lift the pathspec magic restriction on "add -p"Nguyễn Thái Ngọc Duy Thu, 5 Sep 2013 03:40:39 +0000 (10:40 +0700)

add: lift the pathspec magic restriction on "add -p"

Since 480ca64 (convert run_add_interactive to use struct pathspec -
2013-07-14), we have unconditionally passed :(prefix)xxx to
add-interactive.perl. It implies that all commands
add-interactive.perl calls must be aware of pathspec magic, or
:(prefix) is barfed. The restriction to :/ only becomes unnecessary.

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

pathspec: catch prepending :(prefix) on pathspec with... Nguyễn Thái Ngọc Duy Thu, 5 Sep 2013 03:40:38 +0000 (10:40 +0700)

pathspec: catch prepending :(prefix) on pathspec with short magic

:(prefix) is in the long form. Suppose people pass :!foo with '!'
being the short form of magic 'bar', the code will happily turn it to
:(prefix..)!foo, which makes '!' part of the path and no longer a magic.

The correct form must be ':(prefix..,bar)foo', but as so far we
haven't had any magic in short form yet (*), the code to convert from
short form to long one will be inactive anyway. Let's postpone it
until a real short form magic appears.

(*) The short form magic '/' is a special case and won't be caught by
this die(), which is correct. When '/' magic is detected, prefixlen is
set back to 0 and the whole "if (prefixlen..)" block is skipped.

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

Documentation/git-merge.txt: fix formatting of example... Andreas Schwab Thu, 5 Sep 2013 15:12:45 +0000 (17:12 +0200)

Documentation/git-merge.txt: fix formatting of example block

You need at least four dashes in a line to have it recognized as listing
block delimiter by asciidoc.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

typofix: commit is spelled with two emsJunio C Hamano Wed, 4 Sep 2013 22:28:45 +0000 (15:28 -0700)

typofix: commit is spelled with two ems

There are a handful of instances where we say commmit when we mean
commit. Fix them.

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

glossary: fix and clarify the definition of 'ref'Richard Hansen Wed, 4 Sep 2013 19:04:34 +0000 (15:04 -0400)

glossary: fix and clarify the definition of 'ref'

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revisions.txt: fix and clarify <rev>^{<type>}Richard Hansen Wed, 4 Sep 2013 19:04:33 +0000 (15:04 -0400)

revisions.txt: fix and clarify <rev>^{<type>}

If possible, <rev> will be dereferenced even if it is not a tag type
(e.g., commit dereferenced to a tree).

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

glossary: more precise definition of tree-ish (a.k... Richard Hansen Wed, 4 Sep 2013 19:04:32 +0000 (15:04 -0400)

glossary: more precise definition of tree-ish (a.k.a. treeish)

A tree-ish isn't a ref. Also, mention dereferencing, and that a
commit dereferences to a tree, to support gitrevisions(7) and
rev-parse's error messages.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use 'commit-ish' instead of 'committish'Richard Hansen Wed, 4 Sep 2013 19:04:31 +0000 (15:04 -0400)

use 'commit-ish' instead of 'committish'

Replace 'committish' in documentation and comments with 'commit-ish'
to match gitglossary(7) and to be consistent with 'tree-ish'.

The only remaining instances of 'committish' are:
* variable, function, and macro names
* "(also committish)" in the definition of commit-ish in
gitglossary[7]

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use 'tree-ish' instead of 'treeish'Richard Hansen Wed, 4 Sep 2013 19:04:30 +0000 (15:04 -0400)

use 'tree-ish' instead of 'treeish'

Replace 'treeish' in documentation and comments with 'tree-ish' to
match gitglossary(7).

The only remaining instances of 'treeish' are:
* variable, function, and macro names
* "(also treeish)" in the definition of tree-ish in gitglossary(7)

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

glossary: define commit-ish (a.k.a. committish)Richard Hansen Wed, 4 Sep 2013 19:04:29 +0000 (15:04 -0400)

glossary: define commit-ish (a.k.a. committish)

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

glossary: mention 'treeish' as an alternative to 'tree... Richard Hansen Wed, 4 Sep 2013 19:04:28 +0000 (15:04 -0400)

glossary: mention 'treeish' as an alternative to 'tree-ish'

The documentation contains a mix of the two spellings, so include both
in the glossary so that a search for either will lead to the
definition.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: allow pull to preserve merges when rebasingStephen Haberman Tue, 13 Aug 2013 03:43:42 +0000 (22:43 -0500)

pull: allow pull to preserve merges when rebasing

If a user is working on master, and has merged in their feature branch, but now
has to "git pull" because master moved, with pull.rebase their feature branch
will be flattened into master.

This is because "git pull" currently does not know about rebase's preserve
merges flag, which would avoid this behavior, as it would instead replay just
the merge commit of the feature branch onto the new master, and not replay each
individual commit in the feature branch.

Add a --rebase=preserve option, which will pass along --preserve-merges to
rebase.

Also add 'preserve' to the allowed values for the pull.rebase config setting.

Signed-off-by: Stephen Haberman <stephen@exigencecorp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes after merging the first... Junio C Hamano Wed, 4 Sep 2013 19:41:05 +0000 (12:41 -0700)

Update draft release notes after merging the first batch of topics

Merge branch 'sb/parseopt-boolean-removal'Junio C Hamano Wed, 4 Sep 2013 19:39:02 +0000 (12:39 -0700)

Merge branch 'sb/parseopt-boolean-removal'

Convert most uses of OPT_BOOLEAN/OPTION_BOOLEAN that can use
OPT_BOOL/OPTION_BOOLEAN which have much saner semantics, and turn
remaining ones into OPT_SET_INT, OPT_COUNTUP, etc. as necessary.

* sb/parseopt-boolean-removal:
revert: use the OPT_CMDMODE for parsing, reducing code
checkout-index: fix negations of even numbers of -n
config parsing options: allow one flag multiple times
hash-object: replace stdin parsing OPT_BOOLEAN by OPT_COUNTUP
branch, commit, name-rev: ease up boolean conditions
checkout: remove superfluous local variable
log, format-patch: parsing uses OPT__QUIET
Replace deprecated OPT_BOOLEAN by OPT_BOOL
Remove deprecated OPTION_BOOLEAN for parsing arguments

Merge branch 'jc/parseopt-command-modes'Junio C Hamano Wed, 4 Sep 2013 19:37:52 +0000 (12:37 -0700)

Merge branch 'jc/parseopt-command-modes'

Many commands use --dashed-option as a operation mode selector
(e.g. "git tag --delete") that the user can use at most one
(e.g. "git tag --delete --verify" is a nonsense) and you cannot
negate (e.g. "git tag --no-delete" is a nonsense). Make it easier
for users of parse_options() to enforce these restrictions.

* jc/parseopt-command-modes:
tag: use OPT_CMDMODE
parse-options: add OPT_CMDMODE()

Merge branch 'jl/some-submodule-config-are-not-boolean'Junio C Hamano Wed, 4 Sep 2013 19:36:51 +0000 (12:36 -0700)

Merge branch 'jl/some-submodule-config-are-not-boolean'

* jl/some-submodule-config-are-not-boolean:
avoid segfault on submodule.*.path set to an empty "true"

Merge branch 'sg/bash-prompt-lf-in-cwd-test'Junio C Hamano Wed, 4 Sep 2013 19:36:47 +0000 (12:36 -0700)

Merge branch 'sg/bash-prompt-lf-in-cwd-test'

* sg/bash-prompt-lf-in-cwd-test:
bash prompt: test the prompt with newline in repository path

Merge branch 'sb/diff-delta-remove-needless-comparison'Junio C Hamano Wed, 4 Sep 2013 19:36:44 +0000 (12:36 -0700)

Merge branch 'sb/diff-delta-remove-needless-comparison'

* sb/diff-delta-remove-needless-comparison:
create_delta_index: simplify condition always evaluating to true

Merge branch 'fc/unpack-trees-leakfix'Junio C Hamano Wed, 4 Sep 2013 19:36:41 +0000 (12:36 -0700)

Merge branch 'fc/unpack-trees-leakfix'

* fc/unpack-trees-leakfix:
unpack-trees: plug a memory leak

Merge branch 'aj/p4-symlink-lose-nl'Junio C Hamano Wed, 4 Sep 2013 19:36:37 +0000 (12:36 -0700)

Merge branch 'aj/p4-symlink-lose-nl'

* aj/p4-symlink-lose-nl:
git-p4: Fix occasional truncation of symlink contents.

Merge branch 'fc/remote-hg-shared-setup'Junio C Hamano Wed, 4 Sep 2013 19:36:32 +0000 (12:36 -0700)

Merge branch 'fc/remote-hg-shared-setup'

* fc/remote-hg-shared-setup:
remote-hg: add shared repo upgrade
remote-hg: ensure shared repo is initialized

Merge branch 'sb/misc-cleanup'Junio C Hamano Wed, 4 Sep 2013 19:36:30 +0000 (12:36 -0700)

Merge branch 'sb/misc-cleanup'

* sb/misc-cleanup:
rm: remove unneeded null pointer check
diff: fix a possible null pointer dereference
diff: remove ternary operator evaluating always to true

Merge branch 'nd/gc-lock-against-each-other'Junio C Hamano Wed, 4 Sep 2013 19:35:34 +0000 (12:35 -0700)

Merge branch 'nd/gc-lock-against-each-other'

* nd/gc-lock-against-each-other:
gc: reject if another gc is running, unless --force is given

Merge branch 'ap/remote-hg-tilde-is-home-directory'Junio C Hamano Wed, 4 Sep 2013 19:33:57 +0000 (12:33 -0700)

Merge branch 'ap/remote-hg-tilde-is-home-directory'

* ap/remote-hg-tilde-is-home-directory:
remote-hg: fix path when cloning with tilde expansion

Merge branch 'mm/no-shell-escape-in-die-message'Junio C Hamano Wed, 4 Sep 2013 19:32:15 +0000 (12:32 -0700)

Merge branch 'mm/no-shell-escape-in-die-message'

Fixes a minor bug in "git rebase -i" (there could be others, as the
root cause is pretty generic) where the code feeds a random, data
dependeant string to 'echo' and expects it to come out literally.

* mm/no-shell-escape-in-die-message:
die_with_status: use "printf '%s\n'", not "echo"

Merge branch 'tr/fd-gotcha-fixes'Junio C Hamano Wed, 4 Sep 2013 19:32:11 +0000 (12:32 -0700)

Merge branch 'tr/fd-gotcha-fixes'

Finishing touches to an earlier fix already in 'master'.

* tr/fd-gotcha-fixes:
t0070: test that git_mkstemps correctly checks return value of open()

Merge branch 'bc/unuse-packfile'Junio C Hamano Wed, 4 Sep 2013 19:30:21 +0000 (12:30 -0700)

Merge branch 'bc/unuse-packfile'

Handle memory pressure and file descriptor pressure separately when
deciding to release pack windows to honor resource limits.

* bc/unuse-packfile:
Don't close pack fd when free'ing pack windows
sha1_file: introduce close_one_pack() to close packs on fd pressure

Merge branch 'da/darwin'Junio C Hamano Wed, 4 Sep 2013 19:28:15 +0000 (12:28 -0700)

Merge branch 'da/darwin'

* da/darwin:
OS X: Fix redeclaration of die warning
Makefile: Fix APPLE_COMMON_CRYPTO with BLK_SHA1
imap-send: use Apple's Security framework for base64 encoding

Merge branch 'nd/sq-quote-buf'Junio C Hamano Wed, 4 Sep 2013 19:28:12 +0000 (12:28 -0700)

Merge branch 'nd/sq-quote-buf'

Code simplification as a preparatory step to something larger.

* nd/sq-quote-buf:
quote: remove sq_quote_print()
tar-tree: remove dependency on sq_quote_print()
for-each-ref, quote: convert *_quote_print -> *_quote_buf

Merge branch 'rr/feed-real-path-to-editor'Junio C Hamano Wed, 4 Sep 2013 19:26:54 +0000 (12:26 -0700)

Merge branch 'rr/feed-real-path-to-editor'

* rr/feed-real-path-to-editor:
editor: use canonicalized absolute path

Merge branch 'jk/fast-import-empty-ls'Junio C Hamano Wed, 4 Sep 2013 19:23:35 +0000 (12:23 -0700)

Merge branch 'jk/fast-import-empty-ls'

* jk/fast-import-empty-ls:
fast-import: allow moving the root tree
fast-import: allow ls or filecopy of the root tree
fast-import: set valid mode on root tree in "ls"
t9300: document fast-import empty path issues

Merge branch 'km/svn-1.8-serf-only'Junio C Hamano Wed, 4 Sep 2013 19:23:33 +0000 (12:23 -0700)

Merge branch 'km/svn-1.8-serf-only'

Subversion 1.8.0 that was recently released breaks older subversion
clients coming over http/https in various ways.

* km/svn-1.8-serf-only:
Git.pm: revert _temp_cache use of temp_is_locked
git-svn: allow git-svn fetching to work using serf
Git.pm: add new temp_is_locked function

Merge branch 'jc/check-x-z'Junio C Hamano Wed, 4 Sep 2013 19:23:24 +0000 (12:23 -0700)

Merge branch 'jc/check-x-z'

"git check-ignore -z" applied the NUL termination to both its input
(with --stdin) and its output, but "git check-attr -z" ignored the
option on the output side.

This is potentially a backward incompatible fix. Let's see if
anybody screams before deciding if we want to do anything to help
existing users (there may be none).

* jc/check-x-z:
check-attr -z: a single -z should apply to both input and output
check-ignore -z: a single -z should apply to both input and output
check-attr: the name of the character is NUL, not NULL
check-ignore: the name of the character is NUL, not NULL

t5308: check that index-pack --strict detects duplicate... Jeff King Wed, 4 Sep 2013 09:01:53 +0000 (05:01 -0400)

t5308: check that index-pack --strict detects duplicate objects

Commit 68be2fea (receive-pack, fetch-pack: reject bogus pack that
records objects twice, 2011-11-16) taught index-pack to notice and
reject duplicate objects if --strict is given (which it is for
incoming packs, if transfer.fsckObjects is set). However, it never
tested the code, because we did not have an easy way of generating
such a bogus pack.

Now that we have test infrastructure to handle this, let's confirm
that it works.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add--interactive: fix external command invocation on... Johannes Sixt Wed, 4 Sep 2013 07:24:47 +0000 (09:24 +0200)

add--interactive: fix external command invocation on Windows

Back in 21e9757e (Hack git-add--interactive to make it work with
ActiveState Perl, 2007-08-01), the invocation of external commands was
changed to use qx{} on Windows. The rationale was that the command
interpreter on Windows is not a POSIX shell, but rather Windows's CMD.
That patch was wrong to include 'msys' in the check whether to use qx{}
or not: 'msys' identifies MSYS perl as shipped with Git for Windows,
which does not need the special treatment; qx{} should be used only with
ActiveState perl, which is identified by 'MSWin32'.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: implement view spec wildcards with "p4 where"Kazuki Saitoh Fri, 30 Aug 2013 10:02:06 +0000 (19:02 +0900)

git p4: implement view spec wildcards with "p4 where"

"git p4" does not support many of the view wildcards, such as * and
%%n. It only knows the common ... mapping, and exclusions.

Redo the entire wildcard code around the idea of directly querying
the p4 server for the mapping. For each commit, invoke "p4 where"
with committed file paths as args and use the client mapping to
decide where the file goes in git.

This simplifies a lot of code, and adds support for all wildcards
supported by p4. Downside is that there is probably a 20%-ish
slowdown with this approach.

[pw: redo code and tests]

Signed-off-by: Kazuki Saitoh <ksaitoh560@gmail.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Tue, 3 Sep 2013 20:58:16 +0000 (13:58 -0700)

Merge branch 'maint'

* maint:
fix shell syntax error in template
l10n: fr.po: hotfix for commit 6b388fc

Merge git://github.com/git-l10n/git-po into maintJunio C Hamano Tue, 3 Sep 2013 20:58:03 +0000 (13:58 -0700)

Merge git://github.com/git-l10n/git-po into maint

* git://github.com/git-l10n/git-po:
l10n: fr.po: hotfix for commit 6b388fc

Merge branch 'maint-1.8.3' into maintJunio C Hamano Tue, 3 Sep 2013 20:54:32 +0000 (13:54 -0700)

Merge branch 'maint-1.8.3' into maint

* maint-1.8.3:
fix shell syntax error in template

Merge branch 'maint-1.8.2' into maint-1.8.3Junio C Hamano Tue, 3 Sep 2013 20:54:26 +0000 (13:54 -0700)

Merge branch 'maint-1.8.2' into maint-1.8.3

* maint-1.8.2:
fix shell syntax error in template

peel_onion: do not assume length of x_type globalsJeff King Tue, 3 Sep 2013 20:27:30 +0000 (16:27 -0400)

peel_onion: do not assume length of x_type globals

When we are parsing "rev^{foo}", we check "foo" against the
various global type strings, like "commit_type",
"tree_type", etc. This is nicely abstracted, but then we
destroy the abstraction completely by using magic numbers
that must match the length of the type strings.

We could avoid these magic numbers by using skip_prefix. But
taking a step back, we can realize that using the
"commit_type" global is not really buying us anything. It is
not ever going to change from being "commit" without causing
severe breakage to existing uses. And even if it did change
for some crazy reason, we would want to evaluate its effects
on the "rev^{}" syntax, anyway.

Let's just switch these to using a custom string literal, as
we do for "rev^{object}". The resulting code is more robust
to changes in the type strings, and is more readable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

peel_onion(): add support for <rev>^{tag}Richard Hansen Tue, 3 Sep 2013 19:50:16 +0000 (15:50 -0400)

peel_onion(): add support for <rev>^{tag}

Complete the <rev>^{<type>} family of object descriptors by having
<rev>^{tag} dereference <rev> until a tag object is found (or fail if
unable).

At first glance this may not seem very useful, as commits, trees, and
blobs cannot be peeled to a tag, and a tag would just peel to itself.
However, this can be used to ensure that <rev> names a tag object:

$ git rev-parse --verify v1.8.4^{tag}
04f013dc38d7512eadb915eba22efc414f18b869
$ git rev-parse --verify master^{tag}
error: master^{tag}: expected tag type, but the object dereferences to tree type
fatal: Needed a single revision

Users can already ensure that <rev> is a tag object by checking the
output of 'git cat-file -t <rev>', but:
* users may expect <rev>^{tag} to exist given that <rev>^{commit},
<rev>^{tree}, and <rev>^{blob} all exist
* this syntax is more convenient/natural in some circumstances

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-parse test: use standard test functions for setupFelipe Contreras Tue, 3 Sep 2013 17:15:46 +0000 (10:15 -0700)

rev-parse test: use standard test functions for setup

Save the reader from learning specialized t6* setup functions
where familiar commands like test_commit, "git checkout --orphan",
and "git merge" will do.

While at it, wrap the setup commands in a test assertion so errors can
be caught and stray output suppressed when running without --verbose
as in other tests.

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

rev-parse test: use test_cmp instead of "test" builtinJonathan Nieder Tue, 3 Sep 2013 17:07:15 +0000 (10:07 -0700)

rev-parse test: use test_cmp instead of "test" builtin

Use test_cmp instead of passing two command substitutions to the
"test" builtin. This way:

- when tests fail, they can print a helpful diff if run with
"--verbose"

- the argument order "test_cmp expect actual" feels natural,
unlike test <known> = <unknown> that seems backwards

- the exit status from invoking git is checked, so if rev-parse
starts segfaulting then the test will notice and fail

Use a custom function for this instead of test_cmp_rev to emphasize
that we are testing the output from "git rev-parse" with certain
arguments, not checking that the revisions are equal in abstract.

Reported-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-parse test: use test_must_fail, not "if <command... Felipe Contreras Tue, 3 Sep 2013 17:06:18 +0000 (10:06 -0700)

rev-parse test: use test_must_fail, not "if <command>; then false; fi"

This way, if rev-parse segfaults then the test will fail instead
of treating it the same way as a controlled failure.

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

rev-parse test: modernize quoting and whitespaceFelipe Contreras Tue, 3 Sep 2013 17:05:32 +0000 (10:05 -0700)

rev-parse test: modernize quoting and whitespace

Instead of cramming everything in one line, put the test body in an
indented block after the opening test_expect_success line and quote
and put the closing quote on a line by itself.

Use single-quote instead of double-quote to quote the test body
for more useful --verbose output.

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

fast-export: refactor get_tags_and_duplicates()Felipe Contreras Sun, 1 Sep 2013 07:05:48 +0000 (02:05 -0500)

fast-export: refactor get_tags_and_duplicates()

Split into a separate helper function get_commit() so that the part that
finds the relevant commit, and the part that does something with it
(handle tag object, etc.) are in different places.

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-export: make extra_refs globalFelipe Contreras Sun, 1 Sep 2013 07:05:47 +0000 (02:05 -0500)

fast-export: make extra_refs global

There's no need to pass it around everywhere. This would make easier
further refactoring that makes use of this variable.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: branch: fix broken && chainsFelipe Contreras Sat, 31 Aug 2013 04:31:50 +0000 (23:31 -0500)

t: branch: fix broken && chains

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: branch: fix typoFelipe Contreras Sat, 31 Aug 2013 04:31:49 +0000 (23:31 -0500)

t: branch: fix typo

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: branch: trivial style fixFelipe Contreras Sat, 31 Aug 2013 04:31:48 +0000 (23:31 -0500)

t: branch: trivial style fix

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-mediawiki: no need to update private ref... Matthieu Moy Mon, 2 Sep 2013 07:19:48 +0000 (09:19 +0200)

git-remote-mediawiki: no need to update private ref in non-dumb push

We used to update the private ref ourselves, but this update is now
done by default since 664059fb (transport-helper: update remote
helper namespace, 2013-04-17).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-mediawiki: use no-private-update capability... Matthieu Moy Mon, 2 Sep 2013 07:19:47 +0000 (09:19 +0200)

git-remote-mediawiki: use no-private-update capability on dumb push

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport-helper: add no-private-update capabilityMatthieu Moy Tue, 3 Sep 2013 15:45:14 +0000 (17:45 +0200)

transport-helper: add no-private-update capability

Since 664059fb (transport-helper: update remote helper namespace,
2013-04-17), a 'push' operation on a remote helper updates the
private ref by default. This is often a good thing, but it can also
be desirable to disable this update to force the next 'pull' to
re-import the pushed revisions.

Allow remote-helpers to disable the automatic update by introducing a new
capability.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Make setup_git_env() resolve .git file when $GIT_DIR... Nguyễn Thái Ngọc Duy Sat, 31 Aug 2013 01:04:14 +0000 (08:04 +0700)

Make setup_git_env() resolve .git file when $GIT_DIR is not specified

This makes reinitializing on a .git file repository work.

This is probably the only case that setup_git_env() (via
set_git_dir()) is called on a .git file. Other cases in
setup_git_dir_gently() and enter_repo() both cover .git file case
explicitly because they need to verify the target repo is valid.

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

pager: turn on "cat" optimization for DEFAULT_PAGERJeff King Tue, 3 Sep 2013 07:41:50 +0000 (03:41 -0400)

pager: turn on "cat" optimization for DEFAULT_PAGER

If the user specifies a pager of "cat" (or the empty
string), whether it is in the environment or from config, we
automagically optimize it out to mean "no pager" and avoid
forking at all. We treat an empty pager variable similary.

However, we did not apply this optimization when
DEFAULT_PAGER was set to "cat" (or the empty string). There
is no reason to treat DEFAULT_PAGER any differently. The
optimization should not be user-visible (unless the user has
a bizarre "cat" in their PATH). And even if it is, we are
better off behaving consistently between the compile-time
default and the environment and config settings.

The stray "else" we are removing from this code was
introduced by 402461a (pager: do not fork a pager if PAGER
is set to empty., 2006-04-16). At that time, the line
directly above used:

if (!pager)
pager = "less";

as a fallback, meaning that it could not possibly trigger
the optimization. Later, a3d023d (Provide a build time
default-pager setting, 2009-10-30) turned that constant into
a build-time setting which could be anything, but didn't
loosen the "else" to let DEFAULT_PAGER use the optimization.

Noticed-by: Dale R. Worley <worley@alum.mit.edu>
Suggested-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/remote-helpers: quote variable references in... Junio C Hamano Thu, 29 Aug 2013 21:20:18 +0000 (14:20 -0700)

contrib/remote-helpers: quote variable references in redirection targets

Even though it is not required by POSIX to double-quote the
redirection target in a variable, our code does so because some
versions of bash issue a warning without the quotes.

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

contrib/remote-helpers: style updates for test scriptsJunio C Hamano Thu, 29 Aug 2013 21:10:04 +0000 (14:10 -0700)

contrib/remote-helpers: style updates for test scripts

During the review of the main series it was noticed that these test
scripts can use updates to conform to our coding style better, but
fixing the style should be done in a patch separate from the main
series.

This updates the test-*.sh scripts only for style issues:

* We do not leave SP between a redirection operator and the
filename;

* We change line before "then", "do", etc. rather than terminating
the condition for "if"/"while" and list for "for" with a
semicolon;

* When HERE document does not use any expansion, we quote the end
marker (e.g. "cat <<\EOF" not "cat <<EOF") to signal the readers
that there is no funny substitution to worry about when reading
the code.

* We use "test" rather than "[".

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

add: trivial style cleanupFelipe Contreras Fri, 30 Aug 2013 21:56:49 +0000 (16:56 -0500)

add: trivial style cleanup

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: trivial style cleanupFelipe Contreras Fri, 30 Aug 2013 21:56:48 +0000 (16:56 -0500)

reset: trivial style cleanup

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: trivial style fixFelipe Contreras Fri, 30 Aug 2013 21:56:46 +0000 (16:56 -0500)

branch: trivial style fix

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: trivial refactoringFelipe Contreras Fri, 30 Aug 2013 21:56:45 +0000 (16:56 -0500)

reset: trivial refactoring

After commit 3fde386 (reset [--mixed]: use diff-based reset whether or
not pathspec was given), some code can be moved to the 'reset_type ==
MIXED' check.

Let's move the code that is specific to MIXED.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Fix the author initials in blame for non-ASCII... Ævar Arnfjörð Bjarmason Fri, 30 Aug 2013 08:37:01 +0000 (08:37 +0000)

gitweb: Fix the author initials in blame for non-ASCII names

Change the @author_initials feature Jakub added in
v1.6.4-rc2-14-ga36817b to match non-ASCII author initials as intended.

The regexp Jakub added was intended to match
non-ASCII (/\b([[:upper:]])\B/g). But in Perl this doesn't actually
match non-ASCII upper-case characters unless the string being matched
against has the UTF8 flag.

So when we open a pipe to "git blame" we need to mark the file
descriptor we're opening as utf8 explicitly.

So as a result it abbreviates me to "AB" not "ÆAB", entirely because "Æ"
isn't /[[:upper:]]/ unless the string being matched against has the UTF8
flag.

Here's something that demonstrates the issue:

#!/usr/bin/env perl
use strict;
use warnings;

binmode STDOUT, ':utf8' if $ENV{UTF8};
open my $fd, "-|", "git", "blame", "--incremental", "--", "Makefile" or die "Can't open: $!";
binmode $fd, ":utf8" if $ENV{UTF8};
while (my $line = <$fd>) {
next unless my ($author) = $line =~ /^author (.*)/;
my @author_initials = ($author =~ /\b([[:upper:]])\B/g);
printf "%s (%s)\n", join("", @author_initials), $author;
}

When that's run with and without UTF8 being true in the environment it
gives, on git.git:

$ UTF8=0 perl author-initials.pl | sort | uniq -c |
sort -nr | head -n 5
99 JH (Junio C Hamano)
35 JN (Jonathan Nieder)
35 JK (Jeff King)
20 JS (Johannes Schindelin)
16 AB (Ævar Arnfjörð Bjarmason)
$ UTF8=1 perl author-initials.pl | sort | uniq -c |
sort -nr | head -n 5
99 JH (Junio C Hamano)
35 JN (Jonathan Nieder)
35 JK (Jeff King)
20 JS (Johannes Schindelin)
16 ÆAB (Ævar Arnfjörð Bjarmason)

Acked-by: Jakub Narębski <jnareb@gmail.com>
Tested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Tested-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

has_sha1_file: re-check pack directory before giving upJeff King Fri, 30 Aug 2013 19:14:13 +0000 (15:14 -0400)

has_sha1_file: re-check pack directory before giving up

When we read a sha1 file, we first look for a packed
version, then a loose version, and then re-check the pack
directory again before concluding that we cannot find it.
This lets us handle a process that is writing to the
repository simultaneously (e.g., receive-pack writing a new
pack followed by a ref update, or git-repack packing
existing loose objects into a new pack).

However, we do not do the same trick with has_sha1_file; we
only check the packed objects once, followed by loose
objects. This means that we might incorrectly report that we
do not have an object, even though we could find it if we
simply re-checked the pack directory.

By itself, this is usually not a big deal. The other process
is running simultaneously, so we may run has_sha1_file
before it writes, anyway. It is a race whether we see the
object or not. However, we may also see other things
the writing process has done (like updating refs); and in
that case, we must be able to also see the new objects.

For example, imagine we are doing a for_each_ref iteration,
and somebody simultaneously pushes. Receive-pack may write
the pack and update a ref after we have examined the
objects/pack directory, but before the iteration gets to the
updated ref. When we do finally see the updated ref,
for_each_ref will call has_sha1_file to check whether the
ref is broken. If has_sha1_file returns the wrong answer, we
erroneously will think that the ref is broken.

For a normal iteration without DO_FOR_EACH_INCLUDE_BROKEN,
this means that the caller does not see the ref at all
(neither the old nor the new value). So not only will we
fail to see the new value of the ref (which is acceptable,
since we are running simultaneously with the writer, and we
might well read the ref before the writer commits its
write), but we will not see the old value either. For
programs that act on reachability like pack-objects or
prune, this can cause data loss, as we may see the objects
referenced by the original ref value as dangling (and either
omit them from the pack, or delete them via prune).

There's no test included here, because the success case is
two processes running simultaneously forever. But you can
replicate the issue with:

# base.sh
# run this in one terminal; it creates and pushes
# repeatedly to a repository
git init parent &&
(cd parent &&

# create a base commit that will trigger us looking at
# the objects/pack directory before we hit the updated ref
echo content >file &&
git add file &&
git commit -m base &&

# set the unpack limit abnormally low, which
# lets us simulate full-size pushes using tiny ones
git config receive.unpackLimit 1
) &&
git clone parent child &&
cd child &&
n=0 &&
while true; do
echo $n >file && git add file && git commit -m $n &&
git push origin HEAD:refs/remotes/child/master &&
n=$(($n + 1))
done

# fsck.sh
# now run this simultaneously in another terminal; it
# repeatedly fscks, looking for us to consider the
# newly-pushed ref broken. We cannot use for-each-ref
# here, as it uses DO_FOR_EACH_INCLUDE_BROKEN, which
# skips the has_sha1_file check (and if it wants
# more information on the object, it will actually read
# the object, which does the proper two-step lookup)
cd parent &&
while true; do
broken=`git fsck 2>&1 | grep remotes/child`
if test -n "$broken"; then
echo $broken
exit 1
fi
done

Without this patch, the fsck loop fails within a few seconds
(and almost instantly if the test repository actually has a
large number of refs). With it, the two can run
indefinitely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-hg: use notes to keep track of Hg revisionsFelipe Contreras Thu, 29 Aug 2013 22:29:50 +0000 (17:29 -0500)

remote-hg: use notes to keep track of Hg revisions

Keep track of Mercurial revisions as Git notes under the 'refs/notes/hg'
ref. This way, the user can easily see which Mercurial revision
corresponds to certain Git commit.

Unfortunately, there's no way to efficiently update the notes after
doing an export (push), so they'll have to be updated when importing
(fetching).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Start the post-1.8.4 cycleJunio C Hamano Fri, 30 Aug 2013 17:16:16 +0000 (10:16 -0700)

Start the post-1.8.4 cycle

It is tentatively called 1.8.5, but it should be an easy matter of
renaming the release-notes file and RelNotes symlink to later call
it 1.9 near the end of the cycle if we wanted to.

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

Merge branch 'bc/completion-for-bash-3.0'Junio C Hamano Fri, 30 Aug 2013 17:10:55 +0000 (10:10 -0700)

Merge branch 'bc/completion-for-bash-3.0'

Some people still use rather old versions of bash, which cannot
grok some constructs like 'printf -v varname' the prompt and
completion code started to use recently.

* bc/completion-for-bash-3.0:
contrib/git-prompt.sh: handle missing 'printf -v' more gracefully
t9902-completion.sh: old Bash still does not support array+=('') notation
git-completion.bash: use correct Bash/Zsh array length syntax

Merge branch 'sp/doc-smart-http'Junio C Hamano Fri, 30 Aug 2013 17:10:51 +0000 (10:10 -0700)

Merge branch 'sp/doc-smart-http'

* sp/doc-smart-http:
Document the HTTP transport protocols

Merge branch 'mm/war-on-whatchanged'Junio C Hamano Fri, 30 Aug 2013 17:08:26 +0000 (10:08 -0700)

Merge branch 'mm/war-on-whatchanged'

* mm/war-on-whatchanged:
whatchanged: document its historical nature
core-tutorial: trim the section on Inspecting Changes

Merge branch 'rt/doc-merge-file-diff3'Junio C Hamano Fri, 30 Aug 2013 17:08:23 +0000 (10:08 -0700)

Merge branch 'rt/doc-merge-file-diff3'

* rt/doc-merge-file-diff3:
Documentation/git-merge-file: document option "--diff3"

Merge branch 'mb/docs-favor-en-us'Junio C Hamano Fri, 30 Aug 2013 17:08:19 +0000 (10:08 -0700)

Merge branch 'mb/docs-favor-en-us'

Declare that the official grammar & spelling of the source of this
project is en_US, but strongly discourage patches only to "fix"
existing en_UK strings to avoid unnecessary churns.

* mb/docs-favor-en-us:
Provide some linguistic guidance for the documentation.

Merge branch 'rj/doc-rev-parse'Junio C Hamano Fri, 30 Aug 2013 17:08:12 +0000 (10:08 -0700)

Merge branch 'rj/doc-rev-parse'

* rj/doc-rev-parse:
rev-parse(1): logically group options
rev-parse: remove restrictions on some options

Merge branch 'hv/config-from-blob'Junio C Hamano Fri, 30 Aug 2013 17:06:52 +0000 (10:06 -0700)

Merge branch 'hv/config-from-blob'

Portability fix.

* hv/config-from-blob:
config: do not use C function names as struct members