OSDN Git Service

git-core/git.git
9 years agopush --signed: tighten what the receiving end can ask to sign
Junio C Hamano [Thu, 2 Apr 2015 01:00:36 +0000 (18:00 -0700)]
push --signed: tighten what the receiving end can ask to sign

Instead of blindly trusting the receiving side to give us a sensible
nonce to sign, limit the length (max 256 bytes) and the alphabet
(alnum and a few selected punctuations, enough to encode in base64)
that can be used in nonce.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agotransport-helper: fix typo in error message when --signed is not supported
Mike Hommey [Thu, 12 Feb 2015 10:10:01 +0000 (19:10 +0900)]
transport-helper: fix typo in error message when --signed is not supported

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: avoid minor leak in case start_async() fails
René Scharfe [Tue, 28 Oct 2014 20:27:54 +0000 (21:27 +0100)]
receive-pack: avoid minor leak in case start_async() fails

If the asynchronous start of copy_to_sideband() fails, then any
env_array entries added to struct child_process proc by
prepare_push_cert_sha1() are leaked.  Call the latter function only
after start_async() succeeded so that the allocated entries are
cleaned up automatically by start_command() or finish_command().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agopush: heed user.signingkey for signed pushes
Michael J Gruber [Wed, 22 Oct 2014 14:57:49 +0000 (16:57 +0200)]
push: heed user.signingkey for signed pushes

push --signed promises to take user.signingkey as the signing key but
fails to read the config.

Make it do so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack::hmac_sha1(): copy the entire SHA-1 hash out
Brian Gernhardt [Thu, 25 Sep 2014 15:02:20 +0000 (11:02 -0400)]
receive-pack::hmac_sha1(): copy the entire SHA-1 hash out

clang gives the following warning:

builtin/receive-pack.c:327:35: error: sizeof on array function
parameter will return size of 'unsigned char *' instead of 'unsigned
char [20]' [-Werror,-Wsizeof-array-argument]
        git_SHA1_Update(&ctx, out, sizeof(out));
                                         ^
builtin/receive-pack.c:292:37: note: declared here
static void hmac_sha1(unsigned char out[20],
                                   ^
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosigned push: allow stale nonce in stateless mode
Junio C Hamano [Fri, 5 Sep 2014 17:46:04 +0000 (10:46 -0700)]
signed push: allow stale nonce in stateless mode

When operating with the stateless RPC mode, we will receive a nonce
issued by another instance of us that advertised our capability and
refs some time ago.  Update the logic to check received nonce to
detect this case, compute how much time has passed since the nonce
was issued and report the status with a new environment variable
GIT_PUSH_CERT_NONCE_SLOP to the hooks.

GIT_PUSH_CERT_NONCE_STATUS will report "SLOP" in such a case.  The
hooks are free to decide how large a slop it is willing to accept.

Strictly speaking, the "nonce" is not really a "nonce" anymore in
the stateless RPC mode, as it will happily take any "nonce" issued
by it (which is protected by HMAC and its secret key) as long as it
is fresh enough.  The degree of this security degradation, relative
to the native protocol, is about the same as the "we make sure that
the 'git push' decided to update our refs with new objects based on
the freshest observation of our refs by making sure the values they
claim the original value of the refs they ask us to update exactly
match the current state" security is loosened to accomodate the
stateless RPC mode in the existing code without this series, so
there is no need for those who are already using smart HTTP to push
to their repositories to be alarmed any more than they already are.

In addition, the server operator can set receive.certnonceslop
configuration variable to specify how stale a nonce can be (in
seconds).  When this variable is set, and if the nonce received in
the certificate that passes the HMAC check was less than that many
seconds old, hooks are given "OK" in GIT_PUSH_CERT_NONCE_STATUS
(instead of "SLOP") and the received nonce value is given in
GIT_PUSH_CERT_NONCE, which makes it easier for a simple-minded
hook to check if the certificate we received is recent enough.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosigned push: teach smart-HTTP to pass "git push --signed" around
Junio C Hamano [Mon, 15 Sep 2014 21:59:00 +0000 (14:59 -0700)]
signed push: teach smart-HTTP to pass "git push --signed" around

The "--signed" option received by "git push" is first passed to the
transport layer, which the native transport directly uses to notice
that a push certificate needs to be sent.  When the transport-helper
is involved, however, the option needs to be told to the helper with
set_helper_option(), and the helper needs to take necessary action.
For the smart-HTTP helper, the "necessary action" involves spawning
the "git send-pack" subprocess with the "--signed" option.

Once the above all gets wired in, the smart-HTTP transport now can
use the push certificate mechanism to authenticate its pushes.

Add a test that is modeled after tests for the native transport in
t5534-push-signed.sh to t5541-http-push-smart.sh.  Update the test
Apache configuration to pass GNUPGHOME environment variable through.
As PassEnv would trigger warnings for an environment variable that
is not set, export it from test-lib.sh set to a harmless value when
GnuPG is not being used in the tests.

Note that the added test is deliberately loose and does not check
the nonce in this step.  This is because the stateless RPC mode is
inevitably flaky and a nonce that comes back in the actual push
processing is one issued by a different process; if the two
interactions with the server crossed a second boundary, the nonces
will not match and such a check will fail.  A later patch in the
series will work around this shortcoming.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosigned push: fortify against replay attacks
Junio C Hamano [Thu, 21 Aug 2014 23:45:30 +0000 (16:45 -0700)]
signed push: fortify against replay attacks

In order to prevent a valid push certificate for pushing into an
repository from getting replayed in a different push operation, send
a nonce string from the receive-pack process and have the signer
include it in the push certificate.  The receiving end uses an HMAC
hash of the path to the repository it serves and the current time
stamp, hashed with a secret seed (the secret seed does not have to
be per-repository but can be defined in /etc/gitconfig) to generate
the nonce, in order to ensure that a random third party cannot forge
a nonce that looks like it originated from it.

The original nonce is exported as GIT_PUSH_CERT_NONCE for the hooks
to examine and match against the value on the "nonce" header in the
certificate to notice a replay, but returned "nonce" header in the
push certificate is examined by receive-pack and the result is
exported as GIT_PUSH_CERT_NONCE_STATUS, whose value would be "OK"
if the nonce recorded in the certificate matches what we expect, so
that the hooks can more easily check.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosigned push: add "pushee" header to push certificate
Junio C Hamano [Sat, 23 Aug 2014 01:15:24 +0000 (18:15 -0700)]
signed push: add "pushee" header to push certificate

Record the URL of the intended recipient for a push (after
anonymizing it if it has authentication material) on a new "pushee
URL" header.  Because the networking configuration (SSH-tunnels,
proxies, etc.) on the pushing user's side varies, the receiving
repository may not know the single canonical URL all the pushing
users would refer it as (besides, many sites allow pushing over
ssh://host/path and https://host/path protocols to the same
repository but with different local part of the path).  So this
value may not be reliably used for replay-attack prevention
purposes, but this will still serve as a human readable hint to
identify the repository the certificate refers to.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosigned push: remove duplicated protocol info
Junio C Hamano [Mon, 18 Aug 2014 21:38:45 +0000 (14:38 -0700)]
signed push: remove duplicated protocol info

With the interim protocol, we used to send the update commands even
though we already send a signed copy of the same information when
push certificate is in use.  Update the send-pack/receive-pack pair
not to do so.

The notable thing on the receive-pack side is that it makes sure
that there is no command sent over the traditional protocol packet
outside the push certificate.  Otherwise a pusher can claim to be
pushing one set of ref updates in the signed certificate while
issuing commands to update unrelated refs, and such an update will
evade later audits.

Finally, start documenting the protocol.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: send feature request on push-cert packet
Junio C Hamano [Mon, 18 Aug 2014 20:46:58 +0000 (13:46 -0700)]
send-pack: send feature request on push-cert packet

We would want to update the interim protocol so that we do not send
the usual update commands when the push certificate feature is in
use, as the same information is in the certificate.  Once that
happens, the push-cert packet may become the only protocol command,
but then there is no packet to put the feature request behind, like
we always did.

As we have prepared the receiving end that understands the push-cert
feature to accept the feature request on the first protocol packet
(other than "shallow ", which was an unfortunate historical mistake
that has to come before everything else), we can give the feature
request on the push-cert packet instead of the first update protocol
packet, in preparation for the next step to actually update to the
final protocol.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: GPG-validate push certificates
Junio C Hamano [Thu, 14 Aug 2014 22:59:21 +0000 (15:59 -0700)]
receive-pack: GPG-validate push certificates

Reusing the GPG signature check helpers we already have, verify
the signature in receive-pack and give the results to the hooks
via GIT_PUSH_CERT_{SIGNER,KEY,STATUS} environment variables.

Policy decisions, such as accepting or rejecting a good signature by
a key that is not fully trusted, is left to the hook and kept
outside of the core.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agopush: the beginning of "git push --signed"
Junio C Hamano [Fri, 12 Sep 2014 18:17:07 +0000 (11:17 -0700)]
push: the beginning of "git push --signed"

While signed tags and commits assert that the objects thusly signed
came from you, who signed these objects, there is not a good way to
assert that you wanted to have a particular object at the tip of a
particular branch.  My signing v2.0.1 tag only means I want to call
the version v2.0.1, and it does not mean I want to push it out to my
'master' branch---it is likely that I only want it in 'maint', so
the signature on the object alone is insufficient.

The only assurance to you that 'maint' points at what I wanted to
place there comes from your trust on the hosting site and my
authentication with it, which cannot easily audited later.

Introduce a mechanism that allows you to sign a "push certificate"
(for the lack of better name) every time you push, asserting that
what object you are pushing to update which ref that used to point
at what other object.  Think of it as a cryptographic protection for
ref updates, similar to signed tags/commits but working on an
orthogonal axis.

The basic flow based on this mechanism goes like this:

 1. You push out your work with "git push --signed".

 2. The sending side learns where the remote refs are as usual,
    together with what protocol extension the receiving end
    supports.  If the receiving end does not advertise the protocol
    extension "push-cert", an attempt to "git push --signed" fails.

    Otherwise, a text file, that looks like the following, is
    prepared in core:

certificate version 0.1
pusher Junio C Hamano <gitster@pobox.com> 1315427886 -0700

7339ca65... 21580ecb... refs/heads/master
3793ac56... 12850bec... refs/heads/next

    The file begins with a few header lines, which may grow as we
    gain more experience.  The 'pusher' header records the name of
    the signer (the value of user.signingkey configuration variable,
    falling back to GIT_COMMITTER_{NAME|EMAIL}) and the time of the
    certificate generation.  After the header, a blank line follows,
    followed by a copy of the protocol message lines.

    Each line shows the old and the new object name at the tip of
    the ref this push tries to update, in the way identical to how
    the underlying "git push" protocol exchange tells the ref
    updates to the receiving end (by recording the "old" object
    name, the push certificate also protects against replaying).  It
    is expected that new command packet types other than the
    old-new-refname kind will be included in push certificate in the
    same way as would appear in the plain vanilla command packets in
    unsigned pushes.

    The user then is asked to sign this push certificate using GPG,
    formatted in a way similar to how signed tag objects are signed,
    and the result is sent to the other side (i.e. receive-pack).

    In the protocol exchange, this step comes immediately before the
    sender tells what the result of the push should be, which in
    turn comes before it sends the pack data.

 3. When the receiving end sees a push certificate, the certificate
    is written out as a blob.  The pre-receive hook can learn about
    the certificate by checking GIT_PUSH_CERT environment variable,
    which, if present, tells the object name of this blob, and make
    the decision to allow or reject this push.  Additionally, the
    post-receive hook can also look at the certificate, which may be
    a good place to log all the received certificates for later
    audits.

Because a push certificate carry the same information as the usual
command packets in the protocol exchange, we can omit the latter
when a push certificate is in use and reduce the protocol overhead.
This however is not included in this patch to make it easier to
review (in other words, the series at this step should never be
released without the remainder of the series, as it implements an
interim protocol that will be incompatible with the final one).
As such, the documentation update for the protocol is left out of
this step.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agopack-protocol doc: typofix for PKT-LINE
Junio C Hamano [Tue, 19 Aug 2014 21:23:55 +0000 (14:23 -0700)]
pack-protocol doc: typofix for PKT-LINE

Everywhere else we use PKT-LINE to denote the pkt-line formatted
data, but "shallow/deepen" messages are described with PKT_LINE().

Fix them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogpg-interface: move parse_signature() to where it should be
Junio C Hamano [Tue, 19 Aug 2014 20:18:07 +0000 (13:18 -0700)]
gpg-interface: move parse_signature() to where it should be

Our signed-tag objects set the standard format used by Git to store
GPG-signed payload (i.e. the payload followed by its detached
signature) [*1*], and it made sense to have a helper to find the
boundary between the payload and its signature in tag.c back then.

Newer code added later to parse other kinds of objects that learned
to use the same format to store GPG-signed payload (e.g. signed
commits), however, kept using the helper from the same location.

Move it to gpg-interface; the helper is no longer about signed tag,
but it is how our code and data interact with GPG.

[Reference]
*1* http://thread.gmane.org/gmane.linux.kernel/297998/focus=1383

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogpg-interface: move parse_gpg_output() to where it should be
Junio C Hamano [Thu, 14 Aug 2014 22:31:13 +0000 (15:31 -0700)]
gpg-interface: move parse_gpg_output() to where it should be

Earlier, ffb6d7d5 (Move commit GPG signature verification to
commit.c, 2013-03-31) moved this helper that used to be in pretty.c
(i.e. the output code path) to commit.c for better reusability.

It was a good first step in the right direction, but still suffers
from a myopic view that commits will be the only thing we would ever
want to sign---we would actually want to be able to reuse it even
wider.

The function interprets what GPG said; gpg-interface is obviously a
better place.  Move it there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: clarify that cmds_sent is a boolean
Junio C Hamano [Tue, 19 Aug 2014 20:02:19 +0000 (13:02 -0700)]
send-pack: clarify that cmds_sent is a boolean

We use it to make sure that the feature request is sent only once on
the very first request packet (ignoring the "shallow " line, which
was an unfortunate mistake we cannot retroactively fix with existing
receive-pack already deployed in the field) and we set it to "true"
with cmds_sent++, not because we care about the actual number of
updates sent but because it is merely an idiomatic way.

Set it explicitly to one to clarify that the code that uses this
variable only cares about its zero-ness.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: refactor inspecting and resetting status and sending commands
Junio C Hamano [Fri, 15 Aug 2014 19:29:42 +0000 (12:29 -0700)]
send-pack: refactor inspecting and resetting status and sending commands

The main loop over remote_refs list inspects the ref status
to see if we need to generate pack data (i.e. a delete-only push
does not need to send any additional data), resets it to "expecting
the status report" state, and formats the actual update commands
to be sent.

Split the former two out of the main loop, as it will become
conditional in later steps.

Besides, we should have code that does real thing here, before the
"Finally, tell the other end!" part ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: rename "new_refs" to "need_pack_data"
Junio C Hamano [Fri, 15 Aug 2014 19:23:51 +0000 (12:23 -0700)]
send-pack: rename "new_refs" to "need_pack_data"

The variable counts how many non-deleting command is being sent, but
is only checked with 0-ness to decide if we need to send the pack
data.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: factor out capability string generation
Junio C Hamano [Thu, 4 Sep 2014 19:13:32 +0000 (12:13 -0700)]
receive-pack: factor out capability string generation

Similar to the previous one for send-pack, make it easier and
cleaner to add to capability advertisement.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: factor out capability string generation
Junio C Hamano [Fri, 15 Aug 2014 18:37:01 +0000 (11:37 -0700)]
send-pack: factor out capability string generation

A run of 'var ? " var" : ""' fed to a long printf string in a deeply
nested block was hard to read.  Move it outside the loop and format
it into a strbuf.

As an added bonus, the trick to add "agent=<agent-name>" by using
two conditionals is replaced by a more readable version.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: always send capabilities
Junio C Hamano [Fri, 15 Aug 2014 18:30:36 +0000 (11:30 -0700)]
send-pack: always send capabilities

We tried to avoid sending one extra byte, NUL and nothing behind it
to signal there is no protocol capabilities being sent, on the first
command packet on the wire, but it just made the code look ugly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: refactor decision to send update per ref
Junio C Hamano [Tue, 12 Aug 2014 22:40:00 +0000 (15:40 -0700)]
send-pack: refactor decision to send update per ref

A new helper function ref_update_to_be_sent() decides for each ref
if the update is to be sent based on the status previously set by
set_ref_status_for_push() and also if this is a mirrored push.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosend-pack: move REF_STATUS_REJECT_NODELETE logic a bit higher
Junio C Hamano [Tue, 12 Aug 2014 22:04:17 +0000 (15:04 -0700)]
send-pack: move REF_STATUS_REJECT_NODELETE logic a bit higher

20e8b465 (refactor ref status logic for pushing, 2010-01-08)
restructured the code to set status for each ref to be pushed, but
did not quite go far enough.  We inspect the status set earlier by
set_refs_status_for_push() and then perform yet another update to
the status of a ref with an otherwise OK status to be deleted to
mark it with REF_STATUS_REJECT_NODELETE when the protocol tells us
never to delete.

Split the latter into a separate loop that comes before we enter the
per-ref loop.  This way we would have one less condition to check in
the main loop.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: factor out queueing of command
Junio C Hamano [Fri, 15 Aug 2014 21:28:28 +0000 (14:28 -0700)]
receive-pack: factor out queueing of command

Make a helper function to accept a line of a protocol message and
queue an update command out of the code from read_head_info().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: do not reuse old_sha1[] for other things
Junio C Hamano [Fri, 15 Aug 2014 21:26:17 +0000 (14:26 -0700)]
receive-pack: do not reuse old_sha1[] for other things

This piece of code reads object names of shallow boundaries, not
old_sha1[], i.e. the current value the ref points at, which is to be
replaced by what is in new_sha1[].

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: parse feature request a bit earlier
Junio C Hamano [Fri, 15 Aug 2014 21:11:33 +0000 (14:11 -0700)]
receive-pack: parse feature request a bit earlier

Ideally, we should have also allowed the first "shallow" to carry
the feature request trailer, but that is water under the bridge
now.  This makes the next step to factor out the queuing of commands
easier to review.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: do not overallocate command structure
Junio C Hamano [Fri, 15 Aug 2014 20:53:46 +0000 (13:53 -0700)]
receive-pack: do not overallocate command structure

An "update" command in the protocol exchange consists of 40-hex old
object name, SP, 40-hex new object name, SP, and a refname, but the
first instance is further followed by a NUL with feature requests.

The command structure, which has a flex-array member that stores the
refname at the end, was allocated based on the whole length of the
update command, without excluding the trailing feature requests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with 2.0.4
Junio C Hamano [Wed, 30 Jul 2014 21:25:46 +0000 (14:25 -0700)]
Sync with 2.0.4

* maint:
  Git 2.0.4
  commit --amend: test specifies authorship but forgets to check

9 years agoUpdate draft release notes to 2.1
Junio C Hamano [Wed, 30 Jul 2014 21:25:14 +0000 (14:25 -0700)]
Update draft release notes to 2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/more-push-completion'
Junio C Hamano [Wed, 30 Jul 2014 21:21:13 +0000 (14:21 -0700)]
Merge branch 'jk/more-push-completion'

* jk/more-push-completion:
  completion: complete `git push --force-with-lease=`
  completion: add some missing options to `git push`
  completion: complete "unstuck" `git push --recurse-submodules`

9 years agoMerge branch 'sk/mingw-tests-workaround'
Junio C Hamano [Wed, 30 Jul 2014 21:21:12 +0000 (14:21 -0700)]
Merge branch 'sk/mingw-tests-workaround'

Make tests pass on msysgit by mostly disabling ones that are
infeasible on that platform.

* sk/mingw-tests-workaround:
  t800[12]: work around MSys limitation
  t9902: mingw-specific fix for gitfile link files
  t4210: skip command-line encoding tests on mingw
  MinGW: disable legacy encoding tests
  t0110/MinGW: skip tests that pass arbitrary bytes on the command line
  MinGW: Skip test redirecting to fd 4

9 years agoMerge branch 'sk/mingw-uni-fix-more'
Junio C Hamano [Wed, 30 Jul 2014 21:21:09 +0000 (14:21 -0700)]
Merge branch 'sk/mingw-uni-fix-more'

Most of these are battle-tested in msysgit and are needed to
complete what has been merged to 'master' already.

* sk/mingw-uni-fix-more:
  Win32: enable color output in Windows cmd.exe
  Win32: patch Windows environment on startup
  Win32: keep the environment sorted
  Win32: use low-level memory allocation during initialization
  Win32: reduce environment array reallocations
  Win32: don't copy the environment twice when spawning child processes
  Win32: factor out environment block creation
  Win32: unify environment function names
  Win32: unify environment case-sensitivity
  Win32: fix environment memory leaks
  Win32: Unicode environment (incoming)
  Win32: Unicode environment (outgoing)
  Revert "Windows: teach getenv to do a case-sensitive search"
  tests: do not pass iso8859-1 encoded parameter

9 years agoMerge branch 'ep/avoid-test-a-o'
Junio C Hamano [Wed, 30 Jul 2014 21:21:05 +0000 (14:21 -0700)]
Merge branch 'ep/avoid-test-a-o'

* ep/avoid-test-a-o:
  t9814: fix misconversion from test $a -o $b to test $a || test $b

9 years agoGit 2.0.4 v2.0.4
Junio C Hamano [Wed, 30 Jul 2014 21:19:53 +0000 (14:19 -0700)]
Git 2.0.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocommit --amend: test specifies authorship but forgets to check
Fabian Ruch [Wed, 30 Jul 2014 09:45:11 +0000 (11:45 +0200)]
commit --amend: test specifies authorship but forgets to check

The test case "--amend option copies authorship" specifies that the
git-commit option `--amend` uses the authorship of the replaced
commit for the new commit. Add the omitted check that this property
actually holds.

Signed-off-by: Fabian Ruch <bafain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'maint'
Junio C Hamano [Mon, 28 Jul 2014 18:31:46 +0000 (11:31 -0700)]
Merge branch 'maint'

* maint:
  t4013: test diff-tree's --stdin commit formatting
  diff-tree: avoid lookup_unknown_object
  object_as_type: set commit index
  alloc: factor out commit index
  add object_as_type helper for casting objects
  parse_object_buffer: do not set object type
  move setting of object->type to alloc_* functions
  alloc: write out allocator definitions
  alloc.c: remove the alloc_raw_commit_node() function

9 years agot4013: test diff-tree's --stdin commit formatting
Jeff King [Mon, 28 Jul 2014 18:01:57 +0000 (14:01 -0400)]
t4013: test diff-tree's --stdin commit formatting

Once upon a time, git-log was just "rev-list | diff-tree",
and we did not bother to test it separately. These days git-log
is implemented internally, but we want to make sure that the
rev-list to diff-tree pipeline continues to function. Let's
add a basic sanity test.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/misc-fixes-maint'
Junio C Hamano [Mon, 28 Jul 2014 18:30:41 +0000 (11:30 -0700)]
Merge branch 'jk/misc-fixes-maint'

* jk/misc-fixes-maint:
  apply: avoid possible bogus pointer
  fix memory leak parsing core.commentchar
  transport: fix leaks in refs_from_alternate_cb
  free ref string returned by dwim_ref
  receive-pack: don't copy "dir" parameter

9 years agot1402: check for refs ending with a dot
Jeff King [Mon, 28 Jul 2014 15:48:11 +0000 (11:48 -0400)]
t1402: check for refs ending with a dot

This has been illegal since cbdffe4 (check_ref_format(): tighten
refname rules, 2009-03-21), but we never tested it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoRevert "Merge branch 'dt/refs-check-refname-component-sse'"
Junio C Hamano [Mon, 28 Jul 2014 17:41:53 +0000 (10:41 -0700)]
Revert "Merge branch 'dt/refs-check-refname-component-sse'"

This reverts commit 6f92e5ff3cdc813de8ef5327fd4bad492fb7d6c9, reversing
changes made to a02ad882a17b9d45f63ea448391ac5e9f7948222.

9 years agoRevert "Merge branch 'dt/refs-check-refname-component-sse-fix'"
Junio C Hamano [Mon, 28 Jul 2014 17:41:16 +0000 (10:41 -0700)]
Revert "Merge branch 'dt/refs-check-refname-component-sse-fix'"

This reverts commit 779c99fd68dcdaff7d996a1985914154a36a272c, reversing
changes made to df4d7d56461c19361a6f32b633e850c7ba6e55e6.

9 years agoMerge branch 'jk/alloc-commit-id-maint' into maint
Junio C Hamano [Mon, 28 Jul 2014 17:35:35 +0000 (10:35 -0700)]
Merge branch 'jk/alloc-commit-id-maint' into maint

* jk/alloc-commit-id-maint:
  diff-tree: avoid lookup_unknown_object
  object_as_type: set commit index
  alloc: factor out commit index
  add object_as_type helper for casting objects
  parse_object_buffer: do not set object type
  move setting of object->type to alloc_* functions
  alloc: write out allocator definitions
  alloc.c: remove the alloc_raw_commit_node() function

9 years agodiff-tree: avoid lookup_unknown_object
Jeff King [Sun, 13 Jul 2014 06:42:17 +0000 (02:42 -0400)]
diff-tree: avoid lookup_unknown_object

We generally want to avoid lookup_unknown_object, because it
results in allocating more memory for the object than may be
strictly necessary.

In this case, it is used to check whether we have an
already-parsed object before calling parse_object, to save
us from reading the object from disk. Using lookup_object
would be fine for that purpose, but we can take it a step
further. Since this code was written, parse_object already
learned the "check lookup_object" optimization, so we can
simply call parse_object directly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoobject_as_type: set commit index
Jeff King [Sun, 13 Jul 2014 06:42:12 +0000 (02:42 -0400)]
object_as_type: set commit index

The point of the "index" field of struct commit is that
every allocated commit would have one. It is supposed to be
an invariant that whenever object->type is set to
OBJ_COMMIT, we have a unique index.

Commit 969eba6 (commit: push commit_index update into
alloc_commit_node, 2014-06-10) covered this case for
newly-allocated commits. However, we may also allocate an
"unknown" object via lookup_unknown_object, and only later
convert it to a commit. We must make sure that we set the
commit index when we switch the type field.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoalloc: factor out commit index
Jeff King [Sun, 13 Jul 2014 06:42:08 +0000 (02:42 -0400)]
alloc: factor out commit index

We keep a static counter to set the commit index on newly
allocated objects. However, since we also need to set the
index on any_objects which are converted to commits, let's
make the counter available as a public function.

While we're moving it, let's make sure the counter is
allocated as an unsigned integer to match the index field in
"struct commit".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoadd object_as_type helper for casting objects
Jeff King [Sun, 13 Jul 2014 06:42:03 +0000 (02:42 -0400)]
add object_as_type helper for casting objects

When we call lookup_commit, lookup_tree, etc, the logic goes
something like:

  1. Look for an existing object struct. If we don't have
     one, allocate and return a new one.

  2. Double check that any object we have is the expected
     type (and complain and return NULL otherwise).

  3. Convert an object with type OBJ_NONE (from a prior
     call to lookup_unknown_object) to the expected type.

We can encapsulate steps 2 and 3 in a helper function which
checks whether we have the expected object type, converts
OBJ_NONE as appropriate, and returns the object.

Not only does this shorten the code, but it also provides
one central location for converting OBJ_NONE objects into
objects of other types. Future patches will use that to
enforce type-specific invariants.

Since this is a refactoring, we would want it to behave
exactly as the current code. It takes a little reasoning to
see that this is the case:

  - for lookup_{commit,tree,etc} functions, we are just
    pulling steps 2 and 3 into a function that does the same
    thing.

  - for the call in peel_object, we currently only do step 3
    (but we want to consolidate it with the others, as
    mentioned above). However, step 2 is a noop here, as the
    surrounding conditional makes sure we have OBJ_NONE
    (which we want to keep to avoid an extraneous call to
    sha1_object_info).

  - for the call in lookup_commit_reference_gently, we are
    currently doing step 2 but not step 3. However, step 3
    is a noop here. The object we got will have just come
    from deref_tag, which must have figured out the type for
    each object in order to know when to stop peeling.
    Therefore the type will never be OBJ_NONE.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoparse_object_buffer: do not set object type
Jeff King [Sun, 13 Jul 2014 06:42:00 +0000 (02:42 -0400)]
parse_object_buffer: do not set object type

The only way that "obj" can be non-NULL is if it came from
one of the lookup_* functions. These functions always ensure
that the object has the expected type (and return NULL
otherwise), so there is no need for us to set the type.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agomove setting of object->type to alloc_* functions
Jeff King [Sun, 13 Jul 2014 06:41:55 +0000 (02:41 -0400)]
move setting of object->type to alloc_* functions

The "struct object" type implements basic object
polymorphism.  Individual instances are allocated as
concrete types (or as a union type that can store any
object), and a "struct object *" can be cast into its real
type after examining its "type" enum.  This means it is
dangerous to have a type field that does not match the
allocation (e.g., setting the type field of a "struct blob"
to "OBJ_COMMIT" would mean that a reader might read past the
allocated memory).

In most of the current code this is not a problem; the first
thing we do after allocating an object is usually to set its
type field by passing it to create_object. However, the
virtual commits we create in merge-recursive.c do not ever
get their type set. This does not seem to have caused
problems in practice, though (presumably because we always
pass around a "struct commit" pointer and never even look at
the type).

We can fix this oversight and also make it harder for future
code to get it wrong by setting the type directly in the
object allocation functions.

This will also make it easier to fix problems with commit
index allocation, as we know that any object allocated by
alloc_commit_node will meet the invariant that an object
with an OBJ_COMMIT type field will have a unique index
number.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoalloc: write out allocator definitions
Jeff King [Sun, 13 Jul 2014 06:41:51 +0000 (02:41 -0400)]
alloc: write out allocator definitions

Because the allocator functions for tree, blobs, etc are all
very similar, we originally used a macro to avoid repeating
ourselves. Since the prior commit, though, the heavy lifting
is done by an inline helper function.  The macro does still
save us a few lines, but at some readability cost.  It
obfuscates the function definitions (and makes them hard to
find via grep).

Much worse, though, is the fact that it isn't used
consistently for all allocators. Somebody coming later may
be tempted to modify DEFINE_ALLOCATOR, but they would miss
alloc_commit_node, which is treated specially.

Let's just drop the macro and write everything out
explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoalloc.c: remove the alloc_raw_commit_node() function
Ramsay Jones [Sun, 13 Jul 2014 06:41:41 +0000 (02:41 -0400)]
alloc.c: remove the alloc_raw_commit_node() function

In order to encapsulate the setting of the unique commit index, commit
969eba63 ("commit: push commit_index update into alloc_commit_node",
10-06-2014) introduced a (logically private) intermediary allocator
function. However, this function (alloc_raw_commit_node()) was declared
as a public function, which undermines its entire purpose.

Introduce an inline function, alloc_node(), which implements the main
logic of the allocator used by DEFINE_ALLOCATOR, and redefine the macro
in terms of the new function. In addition, use the new function in the
implementation of the alloc_commit_node() allocator, rather than the
intermediary allocator, which can now be removed.

Noticed by sparse ("symbol 'alloc_raw_commit_node' was not declared.
Should it be static?").

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.1.0-rc0 v2.1.0-rc0
Junio C Hamano [Sun, 27 Jul 2014 22:22:22 +0000 (15:22 -0700)]
Git 2.1.0-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/rebase-am-fork-point'
Junio C Hamano [Sun, 27 Jul 2014 22:14:21 +0000 (15:14 -0700)]
Merge branch 'jk/rebase-am-fork-point'

"git rebase --fork-point" did not filter out patch-identical
commits correctly.

* jk/rebase-am-fork-point:
  rebase: omit patch-identical commits with --fork-point
  rebase--am: use --cherry-pick instead of --ignore-if-in-upstream

9 years agoMerge branch 'cc/replace-graft'
Junio C Hamano [Sun, 27 Jul 2014 22:14:18 +0000 (15:14 -0700)]
Merge branch 'cc/replace-graft'

"git replace" learned a "--graft" option to rewrite parents of a
commit.

* cc/replace-graft:
  replace: add test for --graft with a mergetag
  replace: check mergetags when using --graft
  replace: add test for --graft with signed commit
  replace: remove signature when using --graft
  contrib: add convert-grafts-to-replace-refs.sh
  Documentation: replace: add --graft option
  replace: add test for --graft
  replace: add --graft option
  replace: cleanup redirection style in tests

9 years agoMerge branch 'jk/stable-prio-queue'
Junio C Hamano [Sun, 27 Jul 2014 22:14:14 +0000 (15:14 -0700)]
Merge branch 'jk/stable-prio-queue'

* jk/stable-prio-queue:
  t5539: update a flaky test
  paint_down_to_common: use prio_queue
  prio-queue: make output stable with respect to insertion
  prio-queue: factor out compare and swap operations

9 years agot9814: fix misconversion from test $a -o $b to test $a || test $b
Junio C Hamano [Fri, 25 Jul 2014 19:44:18 +0000 (12:44 -0700)]
t9814: fix misconversion from test $a -o $b to test $a || test $b

Spotted-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoapply: avoid possible bogus pointer
Jeff King [Thu, 24 Jul 2014 04:43:23 +0000 (00:43 -0400)]
apply: avoid possible bogus pointer

When parsing "index" lines from a git-diff, we look for a
space followed by the mode. If we don't have a space, then
we set our pointer to the end-of-line. However, we don't
double-check that our end-of-line pointer is valid (e.g., if
we got a truncated diff input), which could lead to some
wrap-around pointer arithmetic.

In most cases this would probably get caught by our "40 <
len" check later in the function, but to be on the safe
side, let's just use strchrnul to treat end-of-string the
same as end-of-line.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofix memory leak parsing core.commentchar
Jeff King [Thu, 24 Jul 2014 04:42:39 +0000 (00:42 -0400)]
fix memory leak parsing core.commentchar

When we see the core.commentchar config option, we extract
the string with git_config_string, which does two things:

  1. It complains via config_error_nonbool if there is no
     string value.

  2. It makes a copy of the string.

Since we immediately parse the string into its
single-character value, we only care about (1). And in fact
(2) is a detriment, as it means we leak the copy. Instead,
let's just check the pointer value ourselves, and parse
directly from the const string we already have.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agotransport: fix leaks in refs_from_alternate_cb
Jeff King [Thu, 24 Jul 2014 04:41:30 +0000 (00:41 -0400)]
transport: fix leaks in refs_from_alternate_cb

The function starts by creating a copy of the static buffer
returned by real_path, but forgets to free it in the error
code paths. We can solve this by jumping to the cleanup code
that is already there.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofree ref string returned by dwim_ref
Jeff King [Thu, 24 Jul 2014 04:41:11 +0000 (00:41 -0400)]
free ref string returned by dwim_ref

A call to "dwim_ref(name, len, flags, &ref)" will allocate a
new string in "ref" to return the exact ref we found. We do
not consistently free it in all code paths, leading to small
leaks. The worst is in get_sha1_basic, which may be called
many times (e.g., by "cat-file --batch"), though it is
relatively unlikely, as it only triggers on a bogus reflog
specification.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreceive-pack: don't copy "dir" parameter
Jeff King [Thu, 24 Jul 2014 04:40:43 +0000 (00:40 -0400)]
receive-pack: don't copy "dir" parameter

We used to do this so could pass a mutable string to
enter_repo. But since 1c64b48 (enter_repo: do not modify
input, 2011-10-04), this is not necessary.

The resulting code is simpler, and it fixes a minor leak.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with v2.0.3
Junio C Hamano [Wed, 23 Jul 2014 18:36:40 +0000 (11:36 -0700)]
Sync with v2.0.3

* maint:
  Git 2.0.3
  .mailmap: combine Stefan Beller's emails
  git.1: switch homepage for stats

9 years agoMerge branch 'rs/fix-unlink-unix-socket'
Junio C Hamano [Wed, 23 Jul 2014 18:35:59 +0000 (11:35 -0700)]
Merge branch 'rs/fix-unlink-unix-socket'

The unix-domain socket used by the sample credential cache daemon
tried to unlink an existing stale one at a wrong path, if the path
to the socket was given as an overlong path that does not fit in
sun_path member of the sockaddr_un structure.

* rs/fix-unlink-unix-socket:
  unix-socket: remove stale socket before calling chdir()

9 years agoMerge branch 'ta/string-list-init'
Junio C Hamano [Wed, 23 Jul 2014 18:35:54 +0000 (11:35 -0700)]
Merge branch 'ta/string-list-init'

* ta/string-list-init:
  replace memset with string-list initializers
  string-list: add string_list initializer helper function

9 years agoMerge branch 'mb/local-clone-after-applying-insteadof'
Junio C Hamano [Wed, 23 Jul 2014 18:35:49 +0000 (11:35 -0700)]
Merge branch 'mb/local-clone-after-applying-insteadof'

Apply the "if cloning from a local disk, physically copy repository
using hardlinks, unless otherwise told not to with --no-local"
optimization when url.*.insteadOf mechanism rewrites a "git clone
$URL" that refers to a repository over the network to a clone from
a local disk.

* mb/local-clone-after-applying-insteadof:
  use local cloning if insteadOf makes a local URL

9 years agoMerge branch 'jk/tag-sort'
Junio C Hamano [Wed, 23 Jul 2014 18:35:45 +0000 (11:35 -0700)]
Merge branch 'jk/tag-sort'

* jk/tag-sort:
  tag: support configuring --sort via .gitconfig
  tag: fix --sort tests to use cat<<-\EOF format

9 years agoGit 2.0.3 v2.0.3
Junio C Hamano [Wed, 23 Jul 2014 18:33:16 +0000 (11:33 -0700)]
Git 2.0.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years ago.mailmap: combine Stefan Beller's emails
Stefan Beller [Wed, 23 Jul 2014 12:32:10 +0000 (14:32 +0200)]
.mailmap: combine Stefan Beller's emails

Google mail has had the extension @googlemail.com for a long time
in Germany as @gmail.de was already taken by a competitor.
Nowadays the original gmail company isn't there anymore(?), hence
Googlemail also introduced @gmail.com in Germany, which I switched to.

This changed mail address of mine first appeared in 398dd4bd039680b
(2014-07-10, .mailmap: map different names with the same email
address together) ironically.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit.1: switch homepage for stats
Stefan Beller [Wed, 23 Jul 2014 12:32:09 +0000 (14:32 +0200)]
git.1: switch homepage for stats

According to http://meta.ohloh.net/2014/07/black-duck-open-hub/
the site name of ohloh changed to openhub.

Change the man page accordingly.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocompletion: complete `git push --force-with-lease=`
John Keeping [Tue, 22 Jul 2014 18:24:58 +0000 (19:24 +0100)]
completion: complete `git push --force-with-lease=`

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocompletion: add some missing options to `git push`
John Keeping [Tue, 22 Jul 2014 18:24:57 +0000 (19:24 +0100)]
completion: add some missing options to `git push`

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocompletion: complete "unstuck" `git push --recurse-submodules`
John Keeping [Tue, 22 Jul 2014 18:24:56 +0000 (19:24 +0100)]
completion: complete "unstuck" `git push --recurse-submodules`

Since the argument to `--recurse-submodules` is mandatory, it does not
need to be stuck to the option with `=`.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with maint
Junio C Hamano [Tue, 22 Jul 2014 18:00:23 +0000 (11:00 -0700)]
Sync with maint

* maint:
  Documentation: fix missing text for rev-parse --verify

9 years agoMerge branch 'rs/code-cleaning'
Junio C Hamano [Tue, 22 Jul 2014 17:59:36 +0000 (10:59 -0700)]
Merge branch 'rs/code-cleaning'

* rs/code-cleaning:
  remote-testsvn: use internal argv_array of struct child_process in cmd_import()
  bundle: use internal argv_array of struct child_process in create_bundle()
  fast-import: use hashcmp() for SHA1 hash comparison
  transport: simplify fetch_objs_via_rsync() using argv_array
  run-command: use internal argv_array of struct child_process in run_hook_ve()
  use commit_list_count() to count the members of commit_lists
  strbuf: use strbuf_addstr() for adding C strings

9 years agoMerge branch 'nd/path-max-must-go'
Junio C Hamano [Tue, 22 Jul 2014 17:59:31 +0000 (10:59 -0700)]
Merge branch 'nd/path-max-must-go'

* nd/path-max-must-go:
  prep_exclude: remove the artificial PATH_MAX limit
  dir.h: move struct exclude declaration to top level
  dir.c: coding style fix

9 years agoMerge branch 'jk/alloc-commit-id'
Junio C Hamano [Tue, 22 Jul 2014 17:59:24 +0000 (10:59 -0700)]
Merge branch 'jk/alloc-commit-id'

Make sure all in-core commit objects are assigned a unique number
so that they can be annotated using the commit-slab API.

* jk/alloc-commit-id:
  diff-tree: avoid lookup_unknown_object
  object_as_type: set commit index
  alloc: factor out commit index
  add object_as_type helper for casting objects
  parse_object_buffer: do not set object type
  move setting of object->type to alloc_* functions
  alloc: write out allocator definitions
  alloc.c: remove the alloc_raw_commit_node() function

9 years agoMerge branch 'kb/perf-trace'
Junio C Hamano [Tue, 22 Jul 2014 17:59:18 +0000 (10:59 -0700)]
Merge branch 'kb/perf-trace'

* kb/perf-trace:
  api-trace.txt: add trace API documentation
  progress: simplify performance measurement by using getnanotime()
  wt-status: simplify performance measurement by using getnanotime()
  git: add performance tracing for git's main() function to debug scripts
  trace: add trace_performance facility to debug performance issues
  trace: add high resolution timer function to debug performance issues
  trace: add 'file:line' to all trace output
  trace: move code around, in preparation to file:line output
  trace: add current timestamp to all trace output
  trace: disable additional trace output for unit tests
  trace: add infrastructure to augment trace output with additional info
  sha1_file: change GIT_TRACE_PACK_ACCESS logging to use trace API
  Documentation/git.txt: improve documentation of 'GIT_TRACE*' variables
  trace: improve trace performance
  trace: remove redundant printf format attribute
  trace: consistently name the format parameter
  trace: move trace declarations from cache.h to new trace.h

9 years agoMerge branch 'ah/fix-http-push' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:29:07 +0000 (10:29 -0700)]
Merge branch 'ah/fix-http-push' into maint

* ah/fix-http-push:
  http-push.c: make CURLOPT_IOCTLDATA a usable pointer

9 years agoMerge branch 'po/error-message-style' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:59 +0000 (10:28 -0700)]
Merge branch 'po/error-message-style' into maint

* po/error-message-style:
  doc: give some guidelines for error messages

9 years agoMerge branch 'zk/log-graph-showsig' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:51 +0000 (10:28 -0700)]
Merge branch 'zk/log-graph-showsig' into maint

* zk/log-graph-showsig:
  log: fix indentation for --graph --show-signature

9 years agoMerge branch 'mg/fix-log-mergetag-color' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:43 +0000 (10:28 -0700)]
Merge branch 'mg/fix-log-mergetag-color' into maint

* mg/fix-log-mergetag-color:
  log: correctly identify mergetag signature verification status

9 years agoMerge branch 'cb/filter-branch-prune-empty-degenerate-merges' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:30 +0000 (10:28 -0700)]
Merge branch 'cb/filter-branch-prune-empty-degenerate-merges' into maint

* cb/filter-branch-prune-empty-degenerate-merges:
  filter-branch: eliminate duplicate mapped parents

9 years agoMerge branch 'ye/doc-http-proto' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:02 +0000 (10:28 -0700)]
Merge branch 'ye/doc-http-proto' into maint

* ye/doc-http-proto:
  http-protocol.txt: Basic Auth is defined in RFC 2617, not RFC 2616

9 years agoMerge branch 'jm/api-strbuf-doc' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:52 +0000 (10:26 -0700)]
Merge branch 'jm/api-strbuf-doc' into maint

* jm/api-strbuf-doc:
  api-strbuf.txt minor typos

9 years agoMerge branch 'jm/dedup-test-config' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:45 +0000 (10:26 -0700)]
Merge branch 'jm/dedup-test-config' into maint

* jm/dedup-test-config:
  t/t7810-grep.sh: remove duplicate test_config()

9 years agoMerge branch 'sk/test-cmp-bin' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:34 +0000 (10:26 -0700)]
Merge branch 'sk/test-cmp-bin' into maint

* sk/test-cmp-bin:
  t5000, t5003: do not use test_cmp to compare binary files

9 years agoMerge branch 'jm/doc-wording-tweaks' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:17 +0000 (10:26 -0700)]
Merge branch 'jm/doc-wording-tweaks' into maint

* jm/doc-wording-tweaks:
  Documentation: wording fixes in the user manual and glossary

9 years agoMerge branch 'jm/instaweb-apache-24' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:25:24 +0000 (10:25 -0700)]
Merge branch 'jm/instaweb-apache-24' into maint

* jm/instaweb-apache-24:
  git-instaweb: add support for Apache 2.4

9 years agoMerge branch 'bg/xcalloc-nmemb-then-size' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:25:17 +0000 (10:25 -0700)]
Merge branch 'bg/xcalloc-nmemb-then-size' into maint

* bg/xcalloc-nmemb-then-size:
  transport-helper.c: rearrange xcalloc arguments
  remote.c: rearrange xcalloc arguments
  reflog-walk.c: rearrange xcalloc arguments
  pack-revindex.c: rearrange xcalloc arguments
  notes.c: rearrange xcalloc arguments
  imap-send.c: rearrange xcalloc arguments
  http-push.c: rearrange xcalloc arguments
  diff.c: rearrange xcalloc arguments
  config.c: rearrange xcalloc arguments
  commit.c: rearrange xcalloc arguments
  builtin/remote.c: rearrange xcalloc arguments
  builtin/ls-remote.c: rearrange xcalloc arguments

9 years agoMerge branch 'cb/byte-order' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:25:02 +0000 (10:25 -0700)]
Merge branch 'cb/byte-order' into maint

* cb/byte-order:
  compat/bswap.h: fix endianness detection
  compat/bswap.h: restore preference __BIG_ENDIAN over BIG_ENDIAN
  compat/bswap.h: detect endianness on more platforms that don't use BYTE_ORDER

9 years agoMerge branch 'lt/request-pull' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:23:41 +0000 (10:23 -0700)]
Merge branch 'lt/request-pull' into maint

* lt/request-pull:
  fix brown paper bag breakage in t5150-request-pull.sh

9 years agoMerge branch 'ep/shell-assign-and-export-vars' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:22:57 +0000 (10:22 -0700)]
Merge branch 'ep/shell-assign-and-export-vars' into maint

* ep/shell-assign-and-export-vars:
  scripts: more "export VAR=VALUE" fixes
  scripts: "export VAR=VALUE" construct is not portable

9 years agoMerge branch 'maint-1.9' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:17:34 +0000 (10:17 -0700)]
Merge branch 'maint-1.9' into maint

* maint-1.9:
  Documentation: fix missing text for rev-parse --verify

9 years agoMerge branch 'maint-1.8.5' into maint-1.9
Junio C Hamano [Tue, 22 Jul 2014 17:16:50 +0000 (10:16 -0700)]
Merge branch 'maint-1.8.5' into maint-1.9

* maint-1.8.5:
  Documentation: fix missing text for rev-parse --verify

9 years agoDocumentation: fix missing text for rev-parse --verify
brian m. carlson [Mon, 21 Jul 2014 23:00:35 +0000 (23:00 +0000)]
Documentation: fix missing text for rev-parse --verify

The caret (^) is used as a markup symbol in AsciiDoc.  Due to the
inability of AsciiDoc to parse a line containing an unmatched caret, it
omitted the line from the output, resulting in the man page missing the
end of a sentence.  Escape this caret so that the man page ends up with
the complete text.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'maint'
Junio C Hamano [Mon, 21 Jul 2014 19:35:39 +0000 (12:35 -0700)]
Merge branch 'maint'

* maint:
  use xmemdupz() to allocate copies of strings given by start and length
  use xcalloc() to allocate zero-initialized memory

9 years agoNinth batch for 2.1
Junio C Hamano [Mon, 21 Jul 2014 19:13:03 +0000 (12:13 -0700)]
Ninth batch for 2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreplace: add test for --graft with a mergetag
Christian Couder [Sat, 19 Jul 2014 15:01:15 +0000 (17:01 +0200)]
replace: add test for --graft with a mergetag

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreplace: check mergetags when using --graft
Christian Couder [Sat, 19 Jul 2014 15:01:14 +0000 (17:01 +0200)]
replace: check mergetags when using --graft

When using --graft, with a mergetag in the original
commit, we should check that the commit pointed to by
the mergetag is still a parent of then new commit we
create, otherwise the mergetag could be misleading.

If the commit pointed to by the mergetag is no more
a parent of the new commit, we could remove the
mergetag, but in this case there is a good chance
that the title or other elements of the commit might
also be misleading. So let's just error out and
suggest to use --edit instead on the commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoreplace: add test for --graft with signed commit
Christian Couder [Sat, 19 Jul 2014 15:01:13 +0000 (17:01 +0200)]
replace: add test for --graft with signed commit

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>