gitweb.git
lock_raw_ref(): add a files_ref_store argumentMichael Haggerty Sun, 4 Sep 2016 16:08:31 +0000 (18:08 +0200)

lock_raw_ref(): add a files_ref_store argument

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

repack_without_refs(): add a files_ref_store argumentMichael Haggerty Sun, 4 Sep 2016 16:08:30 +0000 (18:08 +0200)

repack_without_refs(): add a files_ref_store argument

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

refs: make peel_ref() virtualMichael Haggerty Sun, 4 Sep 2016 16:08:29 +0000 (18:08 +0200)

refs: make peel_ref() virtual

For now it only supports the main reference store.

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

refs: make create_symref() virtualMichael Haggerty Sun, 4 Sep 2016 16:08:28 +0000 (18:08 +0200)

refs: make create_symref() virtual

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

refs: make pack_refs() virtualMichael Haggerty Sun, 4 Sep 2016 16:08:27 +0000 (18:08 +0200)

refs: make pack_refs() virtual

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

refs: make verify_refname_available() virtualMichael Haggerty Sun, 4 Sep 2016 16:08:26 +0000 (18:08 +0200)

refs: make verify_refname_available() virtual

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

refs: make read_raw_ref() virtualMichael Haggerty Sun, 4 Sep 2016 16:08:25 +0000 (18:08 +0200)

refs: make read_raw_ref() virtual

Reference backends will be able to customize this function to implement
reference reading.

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

resolve_gitlink_ref(): rename path parameter to submoduleMichael Haggerty Sun, 4 Sep 2016 16:08:24 +0000 (18:08 +0200)

resolve_gitlink_ref(): rename path parameter to submodule

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

resolve_gitlink_ref(): avoid memory allocation in many... Michael Haggerty Sun, 4 Sep 2016 16:08:23 +0000 (18:08 +0200)

resolve_gitlink_ref(): avoid memory allocation in many cases

If we don't have to strip trailing '/' from the submodule path, then
don't allocate and copy the submodule name.

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

resolve_gitlink_ref(): implement using resolve_ref_recu... Michael Haggerty Sun, 4 Sep 2016 16:08:22 +0000 (18:08 +0200)

resolve_gitlink_ref(): implement using resolve_ref_recursively()

resolve_ref_recursively() can handle references in arbitrary files
reference stores, so use it to resolve "gitlink" (i.e., submodule)
references. Aside from removing redundant code, this allows submodule
lookups to benefit from the much more robust code that we use for
reading non-submodule references. And, since the code is now agnostic
about reference backends, it will work for any future references
backend (so move its definition to refs.c).

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

resolve_ref_recursively(): new functionMichael Haggerty Sun, 4 Sep 2016 16:08:21 +0000 (18:08 +0200)

resolve_ref_recursively(): new function

Add a new function, resolve_ref_recursively(), which is basically like
the old resolve_ref_unsafe() except that it takes a (ref_store *)
argument and also works for submodules.

Re-implement resolve_ref_unsafe() as a thin wrapper around
resolve_ref_recursively().

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

read_raw_ref(): take a (struct ref_store *) argumentMichael Haggerty Sun, 4 Sep 2016 16:08:20 +0000 (18:08 +0200)

read_raw_ref(): take a (struct ref_store *) argument

And make the function work for submodules.

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

resolve_gitlink_packed_ref(): remove functionMichael Haggerty Sun, 4 Sep 2016 16:08:19 +0000 (18:08 +0200)

resolve_gitlink_packed_ref(): remove function

Now that resolve_packed_ref() can work with an arbitrary
files_ref_store, there is no need to have a separate
resolve_gitlink_packed_ref() function.

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

resolve_packed_ref(): rename function from resolve_miss... Michael Haggerty Sun, 4 Sep 2016 16:08:18 +0000 (18:08 +0200)

resolve_packed_ref(): rename function from resolve_missing_loose_ref()

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

refs: reorder definitionsMichael Haggerty Sun, 4 Sep 2016 16:08:17 +0000 (18:08 +0200)

refs: reorder definitions

Move resolve_gitlink_ref() and related functions lower in the file to
avoid the need for forward declarations in the next step.

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

refs: add a transaction_commit() methodRonnie Sahlberg Sun, 4 Sep 2016 16:08:16 +0000 (18:08 +0200)

refs: add a transaction_commit() method

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

{lock,commit,rollback}_packed_refs(): add files_ref_sto... Michael Haggerty Sun, 4 Sep 2016 16:08:15 +0000 (18:08 +0200)

{lock,commit,rollback}_packed_refs(): add files_ref_store arguments

These functions currently only work in the main repository, so add an
assert_main_repository() check to each function.

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

resolve_missing_loose_ref(): add a files_ref_store... Michael Haggerty Sun, 4 Sep 2016 16:08:14 +0000 (18:08 +0200)

resolve_missing_loose_ref(): add a files_ref_store argument

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

get_packed_ref(): add a files_ref_store argumentMichael Haggerty Sun, 4 Sep 2016 16:08:13 +0000 (18:08 +0200)

get_packed_ref(): add a files_ref_store argument

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

add_packed_ref(): add a files_ref_store argumentMichael Haggerty Sun, 4 Sep 2016 16:08:12 +0000 (18:08 +0200)

add_packed_ref(): add a files_ref_store argument

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

refs: create a base class "ref_store" for files_ref_storeMichael Haggerty Sun, 4 Sep 2016 16:08:11 +0000 (18:08 +0200)

refs: create a base class "ref_store" for files_ref_store

We want ref_stores to be polymorphic, so invent a base class of which
files_ref_store is a derived class. For now there is exactly one
ref_store for the main repository and one for any submodules whose
references have been accessed.

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

refs: add a backend method structureRonnie Sahlberg Sun, 4 Sep 2016 16:08:10 +0000 (18:08 +0200)

refs: add a backend method structure

Add a `struct ref_storage_be` to represent types of reference stores. In
OO notation, this is the class, and will soon hold some class
methods (e.g., a factory to create new ref_store instances) and will
also serve as the vtable for ref_store instances of that type.

As yet, the backends cannot do anything.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: rename struct ref_cache to files_ref_storeMichael Haggerty Sun, 4 Sep 2016 16:08:09 +0000 (18:08 +0200)

refs: rename struct ref_cache to files_ref_store

The greater goal of this patch series is to develop the concept of a
reference store, which is a place that references, their values, and
their reflogs are stored, and to virtualize the reference interface so
that different types of ref_stores can be implemented. We will then, for
example, use ref_store instances to access submodule references and
worktree references.

Currently, we keep a ref_cache for each submodule that has had its
references iterated over. It is a far cry from a ref_store, but they are
stored the way we will want to store ref_stores, and ref_stores will
eventually have to hold the reference caches. So let's treat ref_caches
as embryo ref_stores, and build them out from there.

As the first step, simply rename `ref_cache` to `files_ref_store`, and
rename some functions and attributes correspondingly.

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

rename_ref_available(): add docstringDavid Turner Sun, 4 Sep 2016 16:08:08 +0000 (18:08 +0200)

rename_ref_available(): add docstring

And improve the internal variable names.

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

resolve_gitlink_ref(): eliminate temporary variableMichael Haggerty Sun, 4 Sep 2016 16:08:07 +0000 (18:08 +0200)

resolve_gitlink_ref(): eliminate temporary variable

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

for_each_reflog(): reimplement using iteratorsMichael Haggerty Sat, 18 Jun 2016 04:15:19 +0000 (06:15 +0200)

for_each_reflog(): reimplement using iterators

Allow references with reflogs to be iterated over using a ref_iterator.
The latter is implemented as a files_reflog_iterator, which in turn uses
dir_iterator to read the "logs" directory.

Note that reflog iteration doesn't correctly handle per-worktree
reflogs (either before or after this patch).

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

dir_iterator: new API for iterating over a directory... Michael Haggerty Sat, 18 Jun 2016 04:15:18 +0000 (06:15 +0200)

dir_iterator: new API for iterating over a directory tree

The iterator interface is modeled on that for references, though no
vtable is necessary because there is (so far?) only one type of
dir_iterator.

There are obviously a lot of features that could easily be added to this
class:

* Skip/include directory paths in the iteration
* Shallow/deep iteration
* Letting the caller decide which subdirectories to recurse into (e.g.,
via a dir_iterator_advance_into() function)
* Option to iterate in sorted order
* Option to iterate over directory paths before vs. after their contents

But these are not needed for the current patch series, so I refrain.

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

for_each_reflog(): don't abort for bad referencesMichael Haggerty Sat, 18 Jun 2016 04:15:17 +0000 (06:15 +0200)

for_each_reflog(): don't abort for bad references

If there is a file under "$GIT_DIR/logs" with no corresponding
reference, the old code was emitting an error message, aborting the
reflog iteration, and returning -1. But

* None of the callers was checking the exit value

* The callers all want to find all legitimate reflogs (sometimes for the
purpose of determining object reachability!) and wouldn't benefit from
a truncated iteration anyway.

So instead, emit an error message and skip the "broken" reflog, but
continue with the iteration.

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

do_for_each_ref(): reimplement using reference iterationMichael Haggerty Sat, 18 Jun 2016 04:15:16 +0000 (06:15 +0200)

do_for_each_ref(): reimplement using reference iteration

Use the reference iterator interface to implement do_for_each_ref().
Delete a bunch of code supporting the old for_each_ref() implementation.
And now that do_for_each_ref() is generic code (it is no longer tied to
the files backend), move it to refs.c.

The implementation is via a new function, do_for_each_ref_iterator(),
which takes a reference iterator as argument and calls a callback
function for each of the references in the iterator.

This change requires the current_ref performance hack for peel_ref() to
be implemented via ref_iterator_peel() rather than peel_entry() because
we don't have a ref_entry handy (it is hidden under three layers:
file_ref_iterator, merge_ref_iterator, and cache_ref_iterator). So:

* do_for_each_ref_iterator() records the active iterator in
current_ref_iter while it is running.

* peel_ref() checks whether current_ref_iter is pointing at the
requested reference. If so, it asks the iterator to peel the
reference (which it can do efficiently via its "peel" virtual
function). For extra safety, we do the optimization only if the
refname *addresses* are the same, not only if the refname *strings*
are the same, to forestall possible mixups between refnames that come
from different ref_iterators.

Please note that this optimization of peel_ref() is only available when
iterating via do_for_each_ref_iterator() (including all of the
for_each_ref() functions, which call it indirectly). It would be
complicated to implement a similar optimization when iterating directly
using a reference iterator, because multiple reference iterators can be
in use at the same time, with interleaved calls to
ref_iterator_advance(). (In fact we do exactly that in
merge_ref_iterator.)

But that is not necessary. peel_ref() is only called while iterating
over references. Callers who iterate using the for_each_ref() functions
benefit from the optimization described above. Callers who iterate using
reference iterators directly have access to the ref_iterator, so they
can call ref_iterator_peel() themselves to get an analogous optimization
in a more straightforward manner.

If we rewrite all callers to use the reference iteration API, then we
can remove the current_ref_iter hack permanently.

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

refs: introduce an iterator interfaceMichael Haggerty Sat, 18 Jun 2016 04:15:15 +0000 (06:15 +0200)

refs: introduce an iterator interface

Currently, the API for iterating over references is via a family of
for_each_ref()-type functions that invoke a callback function for each
selected reference. All of these eventually call do_for_each_ref(),
which knows how to do one thing: iterate in parallel through two
ref_caches, one for loose and one for packed refs, giving loose
references precedence over packed refs. This is rather complicated code,
and is quite specialized to the files backend. It also requires callers
to encapsulate their work into a callback function, which often means
that they have to define and use a "cb_data" struct to manage their
context.

The current design is already bursting at the seams, and will become
even more awkward in the upcoming world of multiple reference storage
backends:

* Per-worktree vs. shared references are currently handled via a kludge
in git_path() rather than iterating over each part of the reference
namespace separately and merging the results. This kludge will cease
to work when we have multiple reference storage backends.

* The current scheme is inflexible. What if we sometimes want to bypass
the ref_cache, or use it only for packed or only for loose refs? What
if we want to store symbolic refs in one type of storage backend and
non-symbolic ones in another?

In the future, each reference backend will need to define its own way of
iterating over references. The crux of the problem with the current
design is that it is impossible to compose for_each_ref()-style
iterations, because the flow of control is owned by the for_each_ref()
function. There is nothing that a caller can do but iterate through all
references in a single burst, so there is no way for it to interleave
references from multiple backends and present the result to the rest of
the world as a single compound backend.

This commit introduces a new iteration primitive for references: a
ref_iterator. A ref_iterator is a polymorphic object that a reference
storage backend can be asked to instantiate. There are three functions
that can be applied to a ref_iterator:

* ref_iterator_advance(): move to the next reference in the iteration
* ref_iterator_abort(): end the iteration before it is exhausted
* ref_iterator_peel(): peel the reference currently being looked at

Iterating using a ref_iterator leaves the flow of control in the hands
of the caller, which means that ref_iterators from multiple
sources (e.g., loose and packed refs) can be composed and presented to
the world as a single compound ref_iterator.

It also means that the backend code for implementing reference iteration
will sometimes be more complicated. For example, the
cache_ref_iterator (which iterates over a ref_cache) can't use the C
stack to recurse; instead, it must manage its own stack internally as
explicit data structures. There is also a lot of boilerplate connected
with object-oriented programming in C.

Eventually, end-user callers will be able to be written in a more
natural way—managing their own flow of control rather than having to
work via callbacks. Since there will only be a few reference backends
but there are many consumers of this API, this is a good tradeoff.

More importantly, we gain composability, and especially the possibility
of writing interchangeable parts that can work with any ref_iterator.

For example, merge_ref_iterator implements a generic way of merging the
contents of any two ref_iterators. It is used to merge loose + packed
refs as part of the implementation of the files_ref_iterator. But it
will also be possible to use it to merge other pairs of reference
sources (e.g., per-worktree vs. shared refs).

Another example is prefix_ref_iterator, which can be used to trim a
prefix off the front of reference names before presenting them to the
caller (e.g., "refs/heads/master" -> "master").

In this patch, we introduce the iterator abstraction and many utilities,
and implement a reference iterator for the files ref storage backend.
(I've written several other obvious utilities, for example a generic way
to filter references being iterated over. These will probably be useful
in the future. But they are not needed for this patch series, so I am
not including them at this time.)

In a moment we will rewrite do_for_each_ref() to work via reference
iterators (allowing some special-purpose code to be discarded), and do
something similar for reflogs. In future patch series, we will expose
the ref_iterator abstraction in the public refs API so that callers can
use it directly.

Implementation note: I tried abstracting this a layer further to allow
generic iterators (over arbitrary types of objects) and generic
utilities like a generic merge_iterator. But the implementation in C was
very cumbersome, involving (in my opinion) too much boilerplate and too
much unsafe casting, some of which would have had to be done on the
caller side. However, I did put a few iterator-related constants in a
top-level header file, iterator.h, as they will be useful in a moment to
implement iteration over directory trees and possibly other types of
iterators in the future.

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

ref_resolves_to_object(): new functionMichael Haggerty Sat, 18 Jun 2016 04:15:14 +0000 (06:15 +0200)

ref_resolves_to_object(): new function

Extract new function ref_resolves_to_object() from
entry_resolves_to_object(). It can be used even if there is no ref_entry
at hand.

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

entry_resolves_to_object(): rename function from ref_re... Michael Haggerty Sat, 18 Jun 2016 04:15:13 +0000 (06:15 +0200)

entry_resolves_to_object(): rename function from ref_resolves_to_object()

Free up the old name for a more general purpose.

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

get_ref_cache(): only create an instance if there is... Michael Haggerty Sat, 18 Jun 2016 04:15:12 +0000 (06:15 +0200)

get_ref_cache(): only create an instance if there is a submodule

If there is not a nonbare repository where a submodule is supposedly
located, then don't instantiate a ref_cache for it.

The analogous check can be removed from resolve_gitlink_ref().

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

remote rm: handle symbolic refs correctlyMichael Haggerty Sat, 18 Jun 2016 04:15:11 +0000 (06:15 +0200)

remote rm: handle symbolic refs correctly

In the modern world of reference backends, it is not OK to delete a
symref by unlink()ing the file directly. This must be done via the refs
API.

We do so by adding the symref to the list of references to delete along
with the non-symbolic references, then calling delete_refs() with the
new flags option set to REF_NODEREF.

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

delete_refs(): add a flags argumentMichael Haggerty Sat, 18 Jun 2016 04:15:10 +0000 (06:15 +0200)

delete_refs(): add a flags argument

This will be useful for passing REF_NODEREF through.

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

refs: use name "prefix" consistentlyMichael Haggerty Sat, 18 Jun 2016 04:15:09 +0000 (06:15 +0200)

refs: use name "prefix" consistently

In the context of the for_each_ref() functions, call the prefix that
references must start with "prefix". (In some places it was called
"base".) This is clearer, and also prevents confusion with another
planned use of the word "base".

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

do_for_each_ref(): move docstring to the header fileMichael Haggerty Sat, 18 Jun 2016 04:15:08 +0000 (06:15 +0200)

do_for_each_ref(): move docstring to the header file

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

refs: remove unnecessary "extern" keywordsMichael Haggerty Thu, 31 Mar 2016 04:19:22 +0000 (06:19 +0200)

refs: remove unnecessary "extern" keywords

There's continuing work in this area, so clean up unneeded "extern"
keywords rather than schlepping them around. Also split up some overlong
lines and add parameter names in a couple of places.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

lock_ref_sha1_basic(): only handle REF_NODEREF modeMichael Haggerty Fri, 22 Apr 2016 13:25:25 +0000 (15:25 +0200)

lock_ref_sha1_basic(): only handle REF_NODEREF mode

Now lock_ref_sha1_basic() is only called with flags==REF_NODEREF. So we
don't have to handle other cases anymore.

This enables several simplifications, the most interesting of which come
from the fact that ref_lock::orig_ref_name is now always the same as
ref_lock::ref_name:

* Remove ref_lock::orig_ref_name
* Remove local variable orig_refname from lock_ref_sha1_basic()
* ref_name can be initialize once and its value reused
* commit_ref_update() never has to write to the reflog for
lock->orig_ref_name

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

commit_ref_update(): remove the flags parameterMichael Haggerty Fri, 22 Apr 2016 12:38:56 +0000 (14:38 +0200)

commit_ref_update(): remove the flags parameter

commit_ref_update() is now only called with flags=0. So remove the flags
parameter entirely.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

lock_ref_for_update(): don't resolve symrefsMichael Haggerty Mon, 25 Apr 2016 15:48:32 +0000 (17:48 +0200)

lock_ref_for_update(): don't resolve symrefs

If a transaction includes a non-NODEREF update to a symbolic reference,
we don't have to look it up in lock_ref_for_update(). The reference will
be dereferenced anyway when the split-off update is processed.

This change requires that we store a backpointer from the split-off
update to its parent update, for two reasons:

* We still want to report the original reference name in error messages.
So if an error occurs when checking the split-off update's old_sha1,
walk the parent_update pointers back to find the original reference
name, and report that one.

* We still need to write the old_sha1 of the symref to its reflog. So
after we read the split-off update's reference value, walk the
parent_update pointers back and fill in their old_sha1 fields.

Aside from eliminating unnecessary reads, this change fixes a
subtle (though not very serious) race condition: in the old code, the
old_sha1 of the symref was resolved before the reference that it pointed
at was locked. So it was possible that the old_sha1 value logged to the
symref's reflog could be wrong if another process changed the downstream
reference before it was locked.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

lock_ref_for_update(): don't re-read non-symbolic refer... Michael Haggerty Mon, 25 Apr 2016 15:38:35 +0000 (17:38 +0200)

lock_ref_for_update(): don't re-read non-symbolic references

Before the previous patch, our first read of the reference happened
before the reference was locked, so we couldn't trust its value and had
to read it again. But now that our first read of the reference happens
after acquiring the lock, there is no need to read it a second time. So
move the read_ref_full() call into the (update->type & REF_ISSYMREF)
block.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refs: resolve symbolic refs firstMichael Haggerty Mon, 25 Apr 2016 13:56:07 +0000 (15:56 +0200)

refs: resolve symbolic refs first

Before committing ref updates, split symbolic ref updates into two
parts: an update to the underlying ref, and a log-only update to the
symbolic ref. This ensures that both references are locked correctly
during the transaction, including while their reflogs are updated.

Similarly, if the reference pointed to by HEAD is modified directly, add
a separate log-only update to HEAD, rather than leaving the job of
updating HEAD's reflog to commit_ref_update(). This change ensures that
HEAD is locked correctly while its reflog is being modified, as well as
being cheaper (HEAD only needs to be resolved once).

This makes use of a new function, lock_raw_ref(), which is analogous to
read_raw_ref(), but acquires a lock on the reference before reading it.

This change still has two problems:

* There are redundant read_ref_full() reference lookups.

* It is still possible to get incorrect reflogs for symbolic references
if there is a concurrent update by another process, since the old_oid
of a symref is determined before the lock on the pointed-to ref is
held.

Both problems will soon be fixed.

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

ref_transaction_update(): check refname_is_safe() at... Michael Haggerty Wed, 27 Apr 2016 13:54:45 +0000 (15:54 +0200)

ref_transaction_update(): check refname_is_safe() at a minimum

If the user has asked that a new value be set for a reference, we use
check_refname_format() to verify that the reference name satisfies all
of the rules. But in other cases, at least check that refname_is_safe().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

unlock_ref(): move definition higher in the fileMichael Haggerty Sun, 24 Apr 2016 06:11:37 +0000 (08:11 +0200)

unlock_ref(): move definition higher in the file

This avoids the need for a forward declaration in the next patch.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

lock_ref_for_update(): new functionMichael Haggerty Sun, 24 Apr 2016 06:58:41 +0000 (08:58 +0200)

lock_ref_for_update(): new function

Extract a new function, lock_ref_for_update(), from
ref_transaction_commit().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

add_update(): initialize the whole ref_updateMichael Haggerty Mon, 25 Apr 2016 09:39:54 +0000 (11:39 +0200)

add_update(): initialize the whole ref_update

Change add_update() to initialize all of the fields in the new
ref_update object. Rename the function to ref_transaction_add_update(),
and increase its visibility to all of the refs-related code.

All of this makes the function more useful for other future callers.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

verify_refname_available(): adjust constness in declarationMichael Haggerty Mon, 25 Apr 2016 09:20:08 +0000 (11:20 +0200)

verify_refname_available(): adjust constness in declaration

The two string_list arguments can be const.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refs: don't dereference on renameDavid Turner Wed, 24 Feb 2016 22:58:51 +0000 (17:58 -0500)

refs: don't dereference on rename

When renaming refs, don't dereference either the origin or the destination
before renaming.

The origin does not need to be dereferenced because it is presently
forbidden to rename symbolic refs.

Not dereferencing the destination fixes a bug where renaming on top of
a broken symref would use the pointed-to ref name for the moved
reflog.

Add a test for the reflog bug.

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

refs: allow log-only updatesDavid Turner Wed, 24 Feb 2016 22:58:50 +0000 (17:58 -0500)

refs: allow log-only updates

The refs infrastructure learns about log-only ref updates, which only
update the reflog. Later, we will use this to separate symbolic
reference resolution from ref updating.

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

delete_branches(): use resolve_refdup()Michael Haggerty Mon, 25 Apr 2016 08:42:19 +0000 (10:42 +0200)

delete_branches(): use resolve_refdup()

The return value of resolve_ref_unsafe() is not guaranteed to stay
around as long as we need it, so use resolve_refdup() instead.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

ref_transaction_commit(): correctly report close_ref... Michael Haggerty Mon, 25 Apr 2016 09:58:23 +0000 (11:58 +0200)

ref_transaction_commit(): correctly report close_ref() failure

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

ref_transaction_create(): disallow recursive pruningMichael Haggerty Sun, 24 Apr 2016 07:48:26 +0000 (09:48 +0200)

ref_transaction_create(): disallow recursive pruning

It is nonsensical (and a little bit dangerous) to use REF_ISPRUNING
without REF_NODEREF. Forbid it explicitly. Change the one REF_ISPRUNING
caller to pass REF_NODEREF too.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refs: make error messages more consistentMichael Haggerty Wed, 27 Apr 2016 13:21:36 +0000 (15:21 +0200)

refs: make error messages more consistent

* Always start error messages with a lower-case letter.

* Always enclose reference names in single quotes.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

lock_ref_sha1_basic(): remove unneeded local variableMichael Haggerty Fri, 22 Apr 2016 07:13:00 +0000 (09:13 +0200)

lock_ref_sha1_basic(): remove unneeded local variable

resolve_ref_unsafe() can cope with being called with NULL passed to its
flags argument. So lock_ref_sha1_basic() can just hand its own type
parameter through.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

read_raw_ref(): move docstring to header fileMichael Haggerty Fri, 6 May 2016 15:25:31 +0000 (17:25 +0200)

read_raw_ref(): move docstring to header file

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

read_raw_ref(): improve docstringMichael Haggerty Sun, 24 Apr 2016 06:10:30 +0000 (08:10 +0200)

read_raw_ref(): improve docstring

Among other things, document the (important!) requirement that input
refname be checked for safety before calling this function.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

read_raw_ref(): rename symref argument to referentMichael Haggerty Thu, 21 Apr 2016 23:11:17 +0000 (01:11 +0200)

read_raw_ref(): rename symref argument to referent

After all, it doesn't hold the symbolic reference, but rather the
reference referred to.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

read_raw_ref(): clear *type at start of functionMichael Haggerty Thu, 21 Apr 2016 23:11:17 +0000 (01:11 +0200)

read_raw_ref(): clear *type at start of function

This is more convenient and less error-prone for callers.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

read_raw_ref(): rename flags argument to typeMichael Haggerty Tue, 26 Apr 2016 01:06:23 +0000 (03:06 +0200)

read_raw_ref(): rename flags argument to type

This will hopefully reduce confusion with the "flags" arguments that are
used in many functions in this module as an input parameter to choose
how the function should operate.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

ref_transaction_commit(): remove local variables n... Michael Haggerty Thu, 21 Apr 2016 22:02:50 +0000 (00:02 +0200)

ref_transaction_commit(): remove local variables n and updates

These microoptimizations don't make a significant difference in speed.
And they cause problems if somebody ever wants to modify the function to
add updates to a transaction as part of processing it, as will happen
shortly.

Make the same changes in initial_ref_transaction_commit().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

rename_ref(): remove unneeded local variableMichael Haggerty Thu, 21 Apr 2016 21:42:19 +0000 (23:42 +0200)

rename_ref(): remove unneeded local variable

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

commit_ref_update(): write error message to *err, not... Michael Haggerty Tue, 26 Apr 2016 07:09:51 +0000 (09:09 +0200)

commit_ref_update(): write error message to *err, not stderr

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refname_is_safe(): insist that the refname already... Michael Haggerty Wed, 27 Apr 2016 10:40:39 +0000 (12:40 +0200)

refname_is_safe(): insist that the refname already be normalized

The reference name is going to be compared to other reference names, so
it should be in its normalized form.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refname_is_safe(): don't allow the empty stringMichael Haggerty Wed, 27 Apr 2016 10:42:27 +0000 (12:42 +0200)

refname_is_safe(): don't allow the empty string

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refname_is_safe(): use skip_prefix()Michael Haggerty Wed, 27 Apr 2016 10:39:11 +0000 (12:39 +0200)

refname_is_safe(): use skip_prefix()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

remove_dir_recursively(): add docstringMichael Haggerty Sun, 24 Apr 2016 05:07:59 +0000 (07:07 +0200)

remove_dir_recursively(): add docstring

Add a docstring for the remove_dir_recursively() function and the
REMOVE_DIR_* flags that can be passed to it.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

safe_create_leading_directories(): improve docstringMichael Haggerty Sun, 24 Apr 2016 02:34:12 +0000 (04:34 +0200)

safe_create_leading_directories(): improve docstring

Document the difference between this function and
safe_create_leading_directories_const(), and that the former restores
path before returning.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

read_raw_ref(): don't get confused by an empty directoryMichael Haggerty Thu, 5 May 2016 12:09:41 +0000 (14:09 +0200)

read_raw_ref(): don't get confused by an empty directory

Even if there is an empty directory where we look for the loose version
of a reference, check for a packed reference before giving up. This
fixes the failing test that was introduced two commits ago.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

commit_ref(): if there is an empty dir in the way,... Michael Haggerty Thu, 5 May 2016 13:33:03 +0000 (15:33 +0200)

commit_ref(): if there is an empty dir in the way, delete it

Part of the bug revealed in the last commit is that resolve_ref_unsafe()
incorrectly returns EISDIR if it finds a directory in the place where it
is looking for a loose reference, even if the corresponding packed
reference exists. lock_ref_sha1_basic() notices the bogus EISDIR, and
use it as an indication that it should call remove_empty_directories()
and call resolve_ref_unsafe() again.

But resolve_ref_unsafe() shouldn't report EISDIR in this case. If we
would simply make that change, then remove_empty_directories() wouldn't
get called anymore, and the empty directory would get in the way when
commit_ref() calls commit_lock_file() to rename the lockfile into place.

So instead of relying on lock_ref_sha1_basic() to delete empty
directories, teach commit_ref(), just before calling commit_lock_file(),
to check whether a directory is in the way, and if so, try to delete it.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

t1404: demonstrate a bug resolving referencesMichael Haggerty Thu, 5 May 2016 11:22:23 +0000 (13:22 +0200)

t1404: demonstrate a bug resolving references

Add some tests checking that it is possible to work with a reference
even if there is an empty directory where the loose ref would be stored.

One of the new tests demonstrates a bug that has been with us since at
least 2.5.0--single reference lookup gives up when it sees the
directory, even if the reference exists as a packed ref. This probably
hasn't been reported before because Git usually cleans up empty
directories when packing references.

This bug will be fixed shortly.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

Sync with maintJunio C Hamano Mon, 25 Apr 2016 22:18:41 +0000 (15:18 -0700)

Sync with maint

* maint:
l10n: fr: don't translate "merge" as a parameter
l10n: fr: change "id de clé" to match "id-clé"
l10n: fr: fix wrongly translated option name
l10n: fr: fix transcation of "dir"

Seventh batch for post 2.8 cycleJunio C Hamano Mon, 25 Apr 2016 22:18:35 +0000 (15:18 -0700)

Seventh batch for post 2.8 cycle

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

Merge branch 'sb/submodule-path-misc-bugs'Junio C Hamano Mon, 25 Apr 2016 22:17:16 +0000 (15:17 -0700)

Merge branch 'sb/submodule-path-misc-bugs'

"git submodule" reports the paths of submodules the command
recurses into, but this was incorrect when the command was not run
from the root level of the superproject.

* sb/submodule-path-misc-bugs:
t7407: make expectation as clear as possible
submodule update: test recursive path reporting from subdirectory
submodule update: align reporting path for custom command execution
submodule status: correct path handling in recursive submodules
submodule update --init: correct path handling in recursive submodules
submodule foreach: correct path display in recursive submodules

Merge branch 'en/merge-trivial-fix'Junio C Hamano Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)

Merge branch 'en/merge-trivial-fix'

When "git merge" notices that the merge can be resolved purely at
the tree level (without having to merge blobs) and the resulting
tree happens to already exist in the object store, it forgot to
update the index, which lead to an inconsistent state for later
operations.

* en/merge-trivial-fix:
builtin/merge.c: fix a bug with trivial merges
t7605: add a testcase demonstrating a bug with trivial merges

Merge branch 'en/merge-octopus-fix'Junio C Hamano Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)

Merge branch 'en/merge-octopus-fix'

"merge-octopus" strategy did not ensure that the index is clean
when merge begins.

* en/merge-octopus-fix:
merge-octopus: abort if index does not match HEAD
t6044: new merge testcases for when index doesn't match HEAD

Merge branch 'dt/pre-refs-backend'Junio C Hamano Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)

Merge branch 'dt/pre-refs-backend'

Code restructuring around the "refs" area to prepare for pluggable
refs backends.

* dt/pre-refs-backend: (24 commits)
refs: on symref reflog expire, lock symref not referrent
refs: move resolve_ref_unsafe into common code
show_head_ref(): check the result of resolve_ref_namespace()
check_aliased_update(): check that dst_name is non-NULL
checkout_paths(): remove unneeded flag variable
cmd_merge(): remove unneeded flag variable
fsck_head_link(): remove unneeded flag variable
read_raw_ref(): change flags parameter to unsigned int
files-backend: inline resolve_ref_1() into resolve_ref_unsafe()
read_raw_ref(): manage own scratch space
files-backend: break out ref reading
resolve_ref_1(): eliminate local variable "bad_name"
resolve_ref_1(): reorder code
resolve_ref_1(): eliminate local variable
resolve_ref_unsafe(): ensure flags is always set
resolve_ref_unsafe(): use for loop to count up to MAXDEPTH
resolve_missing_loose_ref(): simplify semantics
t1430: improve test coverage of deletion of badly-named refs
t1430: test for-each-ref in the presence of badly-named refs
t1430: don't rely on symbolic-ref for creating broken symrefs
...

Merge branch 'jc/rerere-multi'Junio C Hamano Mon, 25 Apr 2016 22:17:14 +0000 (15:17 -0700)

Merge branch 'jc/rerere-multi'

"git rerere" can encounter two or more files with the same conflict
signature that have to be resolved in different ways, but there was
no way to record these separate resolutions.

* jc/rerere-multi:
rerere: adjust 'forget' to multi-variant world order
rerere: split code to call ll_merge() further
rerere: move code related to "forget" together
rerere: gc and clear
rerere: do use multiple variants
t4200: rerere a merge with two identical conflicts
rerere: allow multiple variants to exist
rerere: delay the recording of preimage
rerere: handle leftover rr-cache/$ID directory and postimage files
rerere: scan $GIT_DIR/rr-cache/$ID when instantiating a rerere_id
rerere: split conflict ID further

Merge tag 'l10n-2.8.0-rnd3-fr' of git://github.com... Junio C Hamano Mon, 25 Apr 2016 20:36:26 +0000 (13:36 -0700)

Merge tag 'l10n-2.8.0-rnd3-fr' of git://github.com/git-l10n/git-po into maint

l10n-2.8.0-rnd3-fr

* tag 'l10n-2.8.0-rnd3-fr' of git://github.com/git-l10n/git-po:
l10n: fr: don't translate "merge" as a parameter
l10n: fr: change "id de clé" to match "id-clé"
l10n: fr: fix wrongly translated option name
l10n: fr: fix transcation of "dir"

Merge branch 'fr_v2.8.0_r3' of git://github.com/jnavila... Jiang Xin Sun, 24 Apr 2016 12:36:34 +0000 (20:36 +0800)

Merge branch 'fr_v2.8.0_r3' of git://github.com/jnavila/git into maint

* 'fr_v2.8.0_r3' of git://github.com/jnavila/git:
l10n: fr: don't translate "merge" as a parameter
l10n: fr: change "id de clé" to match "id-clé"
l10n: fr: fix wrongly translated option name
l10n: fr: fix transcation of "dir"

Sixth batch for post 2.8 cycleJunio C Hamano Fri, 22 Apr 2016 22:48:03 +0000 (15:48 -0700)

Sixth batch for post 2.8 cycle

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

Merge branch 'ad/cygwin-wants-rename'Junio C Hamano Fri, 22 Apr 2016 22:45:10 +0000 (15:45 -0700)

Merge branch 'ad/cygwin-wants-rename'

On Cygwin, object creation uses the "create a temporary and then
rename it to the final name" pattern, not "create a temporary,
hardlink it to the final name and then unlink the temporary"
pattern.

This is necessary to use Git on Windows shared directories, and is
already enabled for the MinGW and plain Windows builds. It also
has been used in Cygwin packaged versions of Git for quite a while.
See http://thread.gmane.org/gmane.comp.version-control.git/291853

($gmane/275680, $gmane/291853).

* ad/cygwin-wants-rename:
config.mak.uname: Cygwin needs OBJECT_CREATION_USES_RENAMES

Merge branch 'jk/use-write-script-more'Junio C Hamano Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)

Merge branch 'jk/use-write-script-more'

Code clean-up.

* jk/use-write-script-more:
t3404: use write_script
t1020: do not overuse printf and use write_script
t5532: use write_script

Merge branch 'jk/do-not-printf-NULL'Junio C Hamano Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)

Merge branch 'jk/do-not-printf-NULL'

"git config" had a codepath that tried to pass a NULL to
printf("%s"), which nobody seems to have noticed.

* jk/do-not-printf-NULL:
git_config_set_multivar_in_file: handle "unset" errors
git_config_set_multivar_in_file: all non-zero returns are errors
config: lower-case first word of error strings

Merge branch 'jc/http-socks5h'Junio C Hamano Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)

Merge branch 'jc/http-socks5h'

The socks5:// proxy support added back in 2.6.4 days was not aware
that socks5h:// proxies behave differently.

* jc/http-socks5h:
http: differentiate socks5:// and socks5h://

Merge branch 'ky/imap-send-openssl-1.1.0'Junio C Hamano Fri, 22 Apr 2016 22:45:08 +0000 (15:45 -0700)

Merge branch 'ky/imap-send-openssl-1.1.0'

Upcoming OpenSSL 1.1.0 will break compilation b updating a few APIs
we use in imap-send, which has been adjusted for the change.

* ky/imap-send-openssl-1.1.0:
configure: remove checking for HMAC_CTX_cleanup
imap-send: avoid deprecated TLSv1_method()
imap-send: check NULL return of SSL_CTX_new()
imap-send: use HMAC() function provided by OpenSSL

Merge branch 'ky/imap-send'Junio C Hamano Fri, 22 Apr 2016 22:45:08 +0000 (15:45 -0700)

Merge branch 'ky/imap-send'

Support for CRAM-MD5 authentication method in "git imap-send" did
not work well.

* ky/imap-send:
imap-send: fix CRAM-MD5 response calculation
imap-send: check for NOLOGIN capability only when using LOGIN command

Merge branch 'jc/xstrfmt-null-with-prec-0'Junio C Hamano Fri, 22 Apr 2016 22:45:07 +0000 (15:45 -0700)

Merge branch 'jc/xstrfmt-null-with-prec-0'

* jc/xstrfmt-null-with-prec-0:
setup.c: do not feed NULL to "%.*s" even with precision 0

Merge branch 'ad/commit-have-m-option'Junio C Hamano Fri, 22 Apr 2016 22:45:07 +0000 (15:45 -0700)

Merge branch 'ad/commit-have-m-option'

"git commit" misbehaved in a few minor ways when an empty message
is given via -m '', all of which has been corrected.

* ad/commit-have-m-option:
commit: do not ignore an empty message given by -m ''
commit: --amend -m '' silently fails to wipe message

Merge branch 'ew/send-email-drop-data-dumper'Junio C Hamano Fri, 22 Apr 2016 22:45:06 +0000 (15:45 -0700)

Merge branch 'ew/send-email-drop-data-dumper'

Code clean-up.

* ew/send-email-drop-data-dumper:
send-email: do not load Data::Dumper

Merge branch 'ew/send-email-readable-message-id'Junio C Hamano Fri, 22 Apr 2016 22:45:05 +0000 (15:45 -0700)

Merge branch 'ew/send-email-readable-message-id'

"git send-email" now uses a more readable timestamps when
formulating a message ID.

* ew/send-email-readable-message-id:
send-email: more meaningful Message-ID

Merge branch 'sb/submodule-helper-clone-regression... Junio C Hamano Fri, 22 Apr 2016 22:45:03 +0000 (15:45 -0700)

Merge branch 'sb/submodule-helper-clone-regression-fix'

A partial rewrite of "git submodule" in the 2.7 timeframe changed
the way the gitdir: pointer in the submodules point at the real
repository location to use absolute paths by accident. This has
been corrected.

* sb/submodule-helper-clone-regression-fix:
submodule--helper, module_clone: catch fprintf failure
submodule--helper: do not borrow absolute_path() result for too long
submodule--helper, module_clone: always operate on absolute paths
submodule--helper clone: create the submodule path just once
submodule--helper: fix potential NULL-dereference
recursive submodules: test for relative paths

Fifth batch for post 2.8 cycleJunio C Hamano Mon, 18 Apr 2016 17:51:09 +0000 (10:51 -0700)

Fifth batch for post 2.8 cycle

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

Merge branch 'jk/branch-shortening-funny-symrefs'Junio C Hamano Mon, 18 Apr 2016 17:49:14 +0000 (10:49 -0700)

Merge branch 'jk/branch-shortening-funny-symrefs'

A change back in version 2.7 to "git branch" broke display of a
symbolic ref in a non-standard place in the refs/ hierarchy (we
expect symbolic refs to appear in refs/remotes/*/HEAD to point at
the primary branch the remote has, and as .git/HEAD to point at the
branch we locally checked out).

* jk/branch-shortening-funny-symrefs:
branch: fix shortening of non-remote symrefs

Merge branch 'ky/branch-m-worktree'Junio C Hamano Mon, 18 Apr 2016 17:48:11 +0000 (10:48 -0700)

Merge branch 'ky/branch-m-worktree'

When "git worktree" feature is in use, "git branch -m" renamed a
branch that is checked out in another worktree without adjusting
the HEAD symbolic ref for the worktree.

* ky/branch-m-worktree:
set_worktree_head_symref(): fix error message
branch -m: update all per-worktree HEADs
refs: add a new function set_worktree_head_symref

Merge branch 'maint'Junio C Hamano Fri, 15 Apr 2016 01:59:09 +0000 (18:59 -0700)

Merge branch 'maint'

* maint:
Prepare for 2.8.2
Start preparing for 2.8.2

Prepare for 2.8.2Junio C Hamano Fri, 15 Apr 2016 01:58:11 +0000 (18:58 -0700)

Prepare for 2.8.2

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

Merge branch 'jv/merge-nothing-into-void' into maintJunio C Hamano Fri, 15 Apr 2016 01:57:49 +0000 (18:57 -0700)

Merge branch 'jv/merge-nothing-into-void' into maint

"git merge FETCH_HEAD" dereferenced NULL pointer when merging
nothing into an unborn history (which is arguably unusual usage,
which perhaps was the reason why nobody noticed it).

* jv/merge-nothing-into-void:
merge: fix NULL pointer dereference when merging nothing into void

Merge branch 'ss/commit-squash-msg' into maintJunio C Hamano Fri, 15 Apr 2016 01:57:48 +0000 (18:57 -0700)

Merge branch 'ss/commit-squash-msg' into maint

When "git merge --squash" stopped due to conflict, the concluding
"git commit" failed to read in the SQUASH_MSG that shows the log
messages from all the squashed commits.

* ss/commit-squash-msg:
commit: do not lose SQUASH_MSG contents

Merge branch 'jk/send-email-rtrim-mailrc-alias' into... Junio C Hamano Fri, 15 Apr 2016 01:57:47 +0000 (18:57 -0700)

Merge branch 'jk/send-email-rtrim-mailrc-alias' into maint

"git send-email" had trouble parsing alias file in mailrc format
when lines in it had trailing whitespaces on them.

* jk/send-email-rtrim-mailrc-alias:
send-email: ignore trailing whitespace in mailrc alias file