OSDN Git Service

git-core/git.git
11 years agorefs: inline function do_not_prune()
Michael Haggerty [Mon, 22 Apr 2013 19:52:36 +0000 (21:52 +0200)]
refs: inline function do_not_prune()

Function do_not_prune() was redundantly checking REF_ISSYMREF, which
was already tested at the top of pack_one_ref(), so remove that check.
And the rest was trivial, so inline the function.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopack_refs(): change to use do_for_each_entry()
Michael Haggerty [Mon, 22 Apr 2013 19:52:35 +0000 (21:52 +0200)]
pack_refs(): change to use do_for_each_entry()

pack_refs() was not using any of the extra features of for_each_ref(),
so change it to use do_for_each_entry().  This also gives it access to
the ref_entry and in particular its peeled field, which will be taken
advantage of in the next commit.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: use same lock_file object for both ref-packing functions
Michael Haggerty [Mon, 22 Apr 2013 19:52:34 +0000 (21:52 +0200)]
refs: use same lock_file object for both ref-packing functions

Use a single struct lock_file for both pack_refs() and
repack_without_ref().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopack_one_ref(): rename "path" parameter to "refname"
Michael Haggerty [Mon, 22 Apr 2013 19:52:33 +0000 (21:52 +0200)]
pack_one_ref(): rename "path" parameter to "refname"

Make this function conform to the naming convention established in
65385ef7d4 for the rest of the refs.c file.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopack-refs: merge code from pack-refs.{c,h} into refs.{c,h}
Michael Haggerty [Mon, 22 Apr 2013 19:52:32 +0000 (21:52 +0200)]
pack-refs: merge code from pack-refs.{c,h} into refs.{c,h}

pack-refs.c doesn't contain much code, and the code it does contain is
closely related to reference handling.  Moreover, there is some
duplication between pack_refs() and repack_without_ref().  Therefore,
merge pack-refs.c into refs.c and pack-refs.h into refs.h.

The code duplication will be addressed in future commits.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopack-refs: rename handle_one_ref() to pack_one_ref()
Michael Haggerty [Mon, 22 Apr 2013 19:52:31 +0000 (21:52 +0200)]
pack-refs: rename handle_one_ref() to pack_one_ref()

This code is about to be moved, so name the function more
distinctively.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: extract a function write_packed_entry()
Michael Haggerty [Mon, 22 Apr 2013 19:52:30 +0000 (21:52 +0200)]
refs: extract a function write_packed_entry()

Extract the I/O code from the "business logic" in repack_ref_fn().
Later there will be another caller for this function.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorepack_without_ref(): write peeled refs in the rewritten file
Michael Haggerty [Mon, 22 Apr 2013 19:52:29 +0000 (21:52 +0200)]
repack_without_ref(): write peeled refs in the rewritten file

When a reference that existed in the packed-refs file is deleted, the
packed-refs file must be rewritten.  Previously, the file was
rewritten without any peeled refs, even if the file contained peeled
refs when it was read.  This was not a bug, because the packed-refs
file header didn't claim that the file contained peeled values.  But
it had a performance cost, because the repository would lose the
benefit of having precomputed peeled references until pack-refs was
run again.

Teach repack_without_ref() to write peeled refs to the packed-refs
file (regardless of whether they were present in the old version of
the file).

This means that if the old version of the packed-refs file was not
fully peeled, then repack_without_ref() will have to peel references.
To avoid the expense of reading lots of loose references, we take two
shortcuts relative to pack-refs:

* If the peeled value of a reference is already known (i.e., because
  it was read from the old version of the packed-refs file), then
  output that peeled value again without any checks.  This is the
  usual code path and should avoid any noticeable overhead.  (This is
  different than pack-refs, which always re-peels references.)

* We don't verify that the packed ref is still current.  It could be
  that a packed references is overridden by a loose reference, in
  which case the packed ref is no longer needed and might even refer
  to an object that has been garbage collected.  But we don't check;
  instead, we just try to peel all references.  If peeling is
  successful, the peeled value is written out (even though it might
  not be needed any more); if not, then the reference is silently
  omitted from the output.

The extra overhead of peeling references in repack_without_ref()
should only be incurred the first time the packed-refs file is written
by a version of Git that knows about the "fully-peeled" attribute.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot3211: demonstrate loss of peeled refs if a packed ref is deleted
Michael Haggerty [Mon, 22 Apr 2013 19:52:28 +0000 (21:52 +0200)]
t3211: demonstrate loss of peeled refs if a packed ref is deleted

Add a test that demonstrates that the peeled values recorded in
packed-refs are lost if a packed ref is deleted.  (The code in
repack_without_ref() doesn't even attempt to write peeled refs.)  This
will be fixed in a moment.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: change how packed refs are deleted
Michael Haggerty [Mon, 22 Apr 2013 19:52:27 +0000 (21:52 +0200)]
refs: change how packed refs are deleted

Add a function remove_ref(), which removes a single entry from a
reference cache.

Use this function to reimplement repack_without_ref().  The old
version iterated over all refs, packing all of them except for the one
to be deleted, then discarded the entire packed reference cache.  The
new version deletes the doomed reference from the cache *before*
iterating.

This has two advantages:

* the code for writing packed-refs becomes simpler, because it doesn't
  have to exclude one of the references.

* it is no longer necessary to discard the packed refs cache after
  deleting a reference: symbolic refs cannot be packed, so packed
  references cannot depend on each other, so the rest of the packed
  refs cache remains valid after a reference is deleted.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosearch_ref_dir(): return an index rather than a pointer
Michael Haggerty [Mon, 22 Apr 2013 19:52:26 +0000 (21:52 +0200)]
search_ref_dir(): return an index rather than a pointer

Change search_ref_dir() to return the index of the sought entry (or -1
on error) rather than a pointer to the entry.  This will make it more
natural to use the function for removing an entry from the list.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorepack_without_ref(): silence errors for dangling packed refs
Michael Haggerty [Mon, 22 Apr 2013 19:52:25 +0000 (21:52 +0200)]
repack_without_ref(): silence errors for dangling packed refs

Stop emitting an error message when deleting a packed reference if we
find another dangling packed reference that is overridden by a loose
reference.  See the previous commit for a longer explanation of the
issue.

We have to be careful to make sure that the invalid packed reference
really *is* overridden by a loose reference; otherwise what we have
found is repository corruption, which we *should* report.

Please note that this approach is vulnerable to a race condition
similar to the race conditions already known to affect packed
references [1]:

* Process 1 tries to peel packed reference X as part of deleting
  another packed reference.  It discovers that X does not refer to a
  valid object (because the object that it referred to has been
  garbage collected).

* Process 2 tries to delete reference X.  It starts by deleting the
  loose reference X.

* Process 1 checks whether there is a loose reference X.  There is not
  (it has just been deleted by process 2), so process 1 reports a
  spurious error "X does not point to a valid object!"

The worst case seems relatively harmless, and the fix is identical to
the fix that will be needed for the other race conditions (namely
holding a lock on the packed-refs file during *all* reference
deletions), so we leave the cleaning up of all of them as a future
project.

[1] http://thread.gmane.org/gmane.comp.version-control.git/211956

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot3210: test for spurious error messages for dangling packed refs
Michael Haggerty [Mon, 22 Apr 2013 19:52:24 +0000 (21:52 +0200)]
t3210: test for spurious error messages for dangling packed refs

A packed reference can be overridden by a loose reference, in which
case the packed reference is obsolete and is never used.  The object
pointed to by such a reference can be garbage collected.  Since
d66da478f2, this could lead to the emission of a spurious error
message:

    error: refs/heads/master does not point to a valid object!

The error is generated by repack_without_ref() if there is an obsolete
dangling packed reference in packed-refs when the packed-refs file has
to be rewritten due to the deletion of another packed reference.  Add
a failing test demonstrating this problem and some passing tests of
related scenarios.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: change the internal reference-iteration API
Michael Haggerty [Mon, 22 Apr 2013 19:52:23 +0000 (21:52 +0200)]
refs: change the internal reference-iteration API

Establish an internal API for iterating over references, which gives
the callback functions direct access to the ref_entry structure
describing the reference.  (Do not change the iteration API that is
exposed outside of the module.)

Define a new internal callback signature

   int each_ref_entry_fn(struct ref_entry *entry, void *cb_data)

Change do_for_each_ref_in_dir() and do_for_each_ref_in_dirs() to
accept each_ref_entry_fn callbacks, and rename them to
do_for_each_entry_in_dir() and do_for_each_entry_in_dirs(),
respectively.  Adapt their callers accordingly.

Add a new function do_for_each_entry() analogous to do_for_each_ref()
but using the new callback style.

Change do_one_ref() into an each_ref_entry_fn that does some
bookkeeping and then calls a wrapped each_ref_fn.

Reimplement do_for_each_ref() in terms of do_for_each_entry(), using
do_one_ref() as an adapter.

Please note that the responsibility for setting current_ref remains in
do_one_ref(), which means that current_ref is *not* set when iterating
over references via the new internal API.  This is not a disadvantage,
because current_ref is not needed by callers of the internal API (they
receive a pointer to the current ref_entry anyway).  But more
importantly, this change prevents peel_ref() from returning invalid
results in the following scenario:

When iterating via the external API, the iteration always includes
both packed and loose references, and in particular never presents a
packed ref if there is a loose ref with the same name.  The internal
API, on the other hand, gives the option to iterate over only the
packed references.  During such an iteration, there is no check
whether the packed ref might be hidden by a loose ref of the same
name.  But until now the packed ref was recorded in current_ref during
the iteration.  So if peel_ref() were called with the reference name
corresponding to current ref, it would return the peeled version of
the packed ref even though there might be a loose ref that peels to a
different value.  This scenario doesn't currently occur in the code,
but fix it to prevent things from breaking in a very confusing way in
the future.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: extract a function peel_entry()
Michael Haggerty [Mon, 22 Apr 2013 19:52:22 +0000 (21:52 +0200)]
refs: extract a function peel_entry()

Peel the entry, and as a side effect store the peeled value in the
entry.  Use this function from two places in peel_ref(); a third
caller will be added soon.

Please note that this change can lead to ref_entries for unpacked refs
being peeled.  This has no practical benefit but is harmless.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopeel_ref(): fix return value for non-peelable, not-current reference
Michael Haggerty [Mon, 22 Apr 2013 19:52:21 +0000 (21:52 +0200)]
peel_ref(): fix return value for non-peelable, not-current reference

The old version was inconsistent: when a reference was
REF_KNOWS_PEELED but with a null peeled value, it returned non-zero
for the current reference but zero for other references.  Change the
behavior for non-current references to match that of current_ref,
which is what callers expect.  Document the behavior.

Current callers only call peel_ref() from within a for_each_ref-style
iteration and only for the current ref; therefore, the buggy code path
was never reached.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopeel_object(): give more specific information in return value
Michael Haggerty [Mon, 22 Apr 2013 19:52:20 +0000 (21:52 +0200)]
peel_object(): give more specific information in return value

Instead of just returning a success/failure bit, return an enumeration
value that explains the reason for any failure.  This will come in
handy shortly.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: extract function peel_object()
Michael Haggerty [Mon, 22 Apr 2013 19:52:19 +0000 (21:52 +0200)]
refs: extract function peel_object()

It is a nice, logical unit of work, and putting it in a function
removes the need to use a goto in peel_ref().  Soon it will also have
other uses.

The algorithm is unchanged.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: extract a function ref_resolves_to_object()
Michael Haggerty [Mon, 22 Apr 2013 19:52:18 +0000 (21:52 +0200)]
refs: extract a function ref_resolves_to_object()

It is a nice unit of work and soon will be needed from multiple
locations.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorepack_without_ref(): use function get_packed_ref()
Michael Haggerty [Mon, 22 Apr 2013 19:52:17 +0000 (21:52 +0200)]
repack_without_ref(): use function get_packed_ref()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopeel_ref(): use function get_packed_ref()
Michael Haggerty [Mon, 22 Apr 2013 19:52:16 +0000 (21:52 +0200)]
peel_ref(): use function get_packed_ref()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoget_packed_ref(): return a ref_entry
Michael Haggerty [Mon, 22 Apr 2013 19:52:15 +0000 (21:52 +0200)]
get_packed_ref(): return a ref_entry

Instead of copying the reference's SHA1 into a caller-supplied
variable, just return the ref_entry itself (or NULL if there is no
such entry).  This change will allow the function to be used from
elsewhere.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodo_for_each_ref_in_dirs(): remove dead code
Michael Haggerty [Mon, 22 Apr 2013 19:52:14 +0000 (21:52 +0200)]
do_for_each_ref_in_dirs(): remove dead code

There is no way to drop out of the while loop.  This code has been
dead since 432ad41e.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: define constant PEELED_LINE_LENGTH
Michael Haggerty [Mon, 22 Apr 2013 19:52:13 +0000 (21:52 +0200)]
refs: define constant PEELED_LINE_LENGTH

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: document how current_ref is used
Michael Haggerty [Mon, 22 Apr 2013 19:52:12 +0000 (21:52 +0200)]
refs: document how current_ref is used

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: document do_for_each_ref() and do_one_ref()
Michael Haggerty [Mon, 22 Apr 2013 19:52:11 +0000 (21:52 +0200)]
refs: document do_for_each_ref() and do_one_ref()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: document the fields of struct ref_value
Michael Haggerty [Sun, 14 Apr 2013 12:54:17 +0000 (14:54 +0200)]
refs: document the fields of struct ref_value

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorefs: document flags constants REF_*
Michael Haggerty [Sun, 14 Apr 2013 12:54:16 +0000 (14:54 +0200)]
refs: document flags constants REF_*

Document the bits that can appear in the "flags" parameter passed to
an each_ref_function and/or in the ref_entry::flag field.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoprune: introduce OPT_EXPIRY_DATE() and use it
Junio C Hamano [Thu, 25 Apr 2013 18:13:49 +0000 (11:13 -0700)]
prune: introduce OPT_EXPIRY_DATE() and use it

Earlier we added support for --expire=all (or --expire=now) that
considers all crufts, regardless of their age, as eligible for
garbage collection by turning command argument parsers that use
approxidate() to use parse_expiry_date(), but "git prune" used a
built-in parse-options facility OPT_DATE() and did not benefit from
the new function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoapi-parse-options.txt: document "no-" for non-boolean options
Michael Haggerty [Thu, 18 Apr 2013 07:46:35 +0000 (09:46 +0200)]
api-parse-options.txt: document "no-" for non-boolean options

Document that the "no-" prefix can also be used for non-boolean
options.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-gc.txt, git-reflog.txt: document new expiry options
Michael Haggerty [Thu, 18 Apr 2013 07:46:34 +0000 (09:46 +0200)]
git-gc.txt, git-reflog.txt: document new expiry options

Document the new values that can be used for expiry values where their
use makes sense:

* git reflog expire --expire=[all|never]
* git reflog expire --expire-unreachable=[all|never]
* git gc --prune=all

Other combinations aren't useful and therefore no documentation is
added (even though they are allowed):

* git gc --prune=never

  is redundant with "git gc --no-prune"

* git prune --expire=all

  is equivalent to providing no --expire option

* git prune --expire=never

  is a NOP

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodate.c: add parse_expiry_date()
Junio C Hamano [Wed, 17 Apr 2013 22:38:08 +0000 (15:38 -0700)]
date.c: add parse_expiry_date()

"git reflog --expire=all" tries to expire reflog entries up to the
current second, because the approxidate() parser gives the current
timestamp for anything it does not understand (and it does not know
what time "all" means).  When the user tells us to expire "all" (or
set the expiration time to "now"), the user wants to remove all the
reflog entries (no reflog entry should record future time).

Just set it to ULONG_MAX and to let everything that is older that
timestamp expire.

While at it, allow "now" to be treated the same way for callers that
parse expiry date timestamp with this function.  Also use an error
reporting version of approxidate() to report misspelled date.  When
the user says e.g. "--expire=mnoday" to delete entries two days or
older on Wednesday, we wouldn't want the "unknown, default to now"
logic to kick in.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofast-export: fix argument name in error messages
Paul Price [Fri, 12 Apr 2013 14:05:55 +0000 (10:05 -0400)]
fast-export: fix argument name in error messages

The --signed-tags argument is plural, while error messages referred
to --signed-tag (singular).  Tweak error messages to correspond to the
argument.

Signed-off-by: Paul Price <price@astro.princeton.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: distinguish between ref and offset deltas in pack-format
Stefan Saasen [Fri, 12 Apr 2013 05:56:24 +0000 (15:56 +1000)]
Documentation: distinguish between ref and offset deltas in pack-format

eb32d236 introduced the OBJ_OFS_DELTA object that uses a relative offset to
identify the base object instead of the 20-byte SHA1 reference. The pack file
documentation only mentions the SHA1 based reference in its description of the
deltified object entry.

Update the pack format documentation to clarify that the deltified object
representation refers to its base using either a relative negative offset or
the absolute SHA1 identifier.

Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.8.1.6 v1.8.1.6
Junio C Hamano [Sun, 7 Apr 2013 15:58:30 +0000 (08:58 -0700)]
Git 1.8.1.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jc/directory-attrs-regression-fix' into maint-1.8.1
Junio C Hamano [Sun, 7 Apr 2013 15:45:03 +0000 (08:45 -0700)]
Merge branch 'jc/directory-attrs-regression-fix' into maint-1.8.1

A pattern "dir" (without trailing slash) in the attributes file
stopped matching a directory "dir" by mistake with an earlier change
that wanted to allow pattern "dir/" to also match.

* jc/directory-attrs-regression-fix:
  t: check that a pattern without trailing slash matches a directory
  dir.c::match_pathname(): pay attention to the length of string parameters
  dir.c::match_pathname(): adjust patternlen when shifting pattern
  dir.c::match_basename(): pay attention to the length of string parameters
  attr.c::path_matches(): special case paths that end with a slash
  attr.c::path_matches(): the basename is part of the pathname

11 years agoremote-helpers/test-bzr.sh: do not use "grep '\s'"
Torsten Bögershausen [Sun, 7 Apr 2013 08:48:30 +0000 (10:48 +0200)]
remote-helpers/test-bzr.sh: do not use "grep '\s'"

Using grep "devel\s\+3:" to find at least one whitspace is not
portable on all grep versions; not all grep versions understand "\s"
as a "whitespace".

Use a literal TAB followed by SPACE.

The + as a qualifier for "one or more" is not a basic regular
expression; use egrep instead of grep.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoStart preparing for 1.8.1.6
Junio C Hamano [Wed, 3 Apr 2013 16:12:11 +0000 (09:12 -0700)]
Start preparing for 1.8.1.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'kb/name-hash' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:44:54 +0000 (08:44 -0700)]
Merge branch 'kb/name-hash' into maint-1.8.1

* kb/name-hash:
  name-hash.c: fix endless loop with core.ignorecase=true

11 years agoMerge branch 'kk/revwalk-slop-too-many-commit-within-a-second' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:44:02 +0000 (08:44 -0700)]
Merge branch 'kk/revwalk-slop-too-many-commit-within-a-second' into maint-1.8.1

* kk/revwalk-slop-too-many-commit-within-a-second:
  Fix revision walk for commits with the same dates

11 years agoMerge branch 'jk/checkout-attribute-lookup' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:43:40 +0000 (08:43 -0700)]
Merge branch 'jk/checkout-attribute-lookup' into maint-1.8.1

* jk/checkout-attribute-lookup:
  t2003: work around path mangling issue on Windows
  entry: fix filter lookup
  t2003: modernize style

11 years agoMerge branch 'jk/fully-peeled-packed-ref' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:43:03 +0000 (08:43 -0700)]
Merge branch 'jk/fully-peeled-packed-ref' into maint-1.8.1

* jk/fully-peeled-packed-ref:
  pack-refs: add fully-peeled trait
  pack-refs: write peeled entry for non-tags
  use parse_object_or_die instead of die("bad object")
  avoid segfaults on parse_object failure

11 years agoMerge branch 'ap/maint-diff-rename-avoid-overlap' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:37:39 +0000 (08:37 -0700)]
Merge branch 'ap/maint-diff-rename-avoid-overlap' into maint-1.8.1

* ap/maint-diff-rename-avoid-overlap:
  tests: make sure rename pretty print works
  diff: prevent pprint_rename from underrunning input
  diff: Fix rename pretty-print when suffix and prefix overlap

11 years agoMerge branch 'yd/doc-merge-annotated-tag' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:36:52 +0000 (08:36 -0700)]
Merge branch 'yd/doc-merge-annotated-tag' into maint-1.8.1

* yd/doc-merge-annotated-tag:
  Documentation: merging a tag is a special case

11 years agoMerge branch 'ap/maint-update-index-h-is-for-help' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:36:10 +0000 (08:36 -0700)]
Merge branch 'ap/maint-update-index-h-is-for-help' into maint-1.8.1

* ap/maint-update-index-h-is-for-help:
  update-index: allow "-h" to also display options

11 years agoMerge branch 'jc/perl-cat-blob' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:45 +0000 (08:35 -0700)]
Merge branch 'jc/perl-cat-blob' into maint-1.8.1

* jc/perl-cat-blob:
  Git.pm: fix cat_blob crashes on large files

11 years agoMerge branch 'ob/imap-send-ssl-verify' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:33 +0000 (08:35 -0700)]
Merge branch 'ob/imap-send-ssl-verify' into maint-1.8.1

* ob/imap-send-ssl-verify:
  imap-send: support Server Name Indication (RFC4366)

11 years agoMerge branch 'nd/index-pack-l10n-buf-overflow' into maint-1.8.1
Junio C Hamano [Wed, 3 Apr 2013 15:35:06 +0000 (08:35 -0700)]
Merge branch 'nd/index-pack-l10n-buf-overflow' into maint-1.8.1

* nd/index-pack-l10n-buf-overflow:
  index-pack: fix buffer overflow caused by translations

11 years agogit-tag(1): we tag HEAD by default
Thomas Rast [Wed, 3 Apr 2013 14:27:14 +0000 (16:27 +0200)]
git-tag(1): we tag HEAD by default

The <commit>|<object> argument is actually not explained anywhere
(except implicitly in the description of an unannotated tag).  Write a
little explanation, in particular to cover the default.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot: check that a pattern without trailing slash matches a directory
Jeff King [Thu, 28 Mar 2013 21:50:04 +0000 (17:50 -0400)]
t: check that a pattern without trailing slash matches a directory

Prior to v1.8.1.1, with:

  git init
  echo content >foo &&
  mkdir subdir &&
  echo content >subdir/bar &&
  echo "subdir export-ignore" >.gitattributes
  git add . &&
  git commit -m one &&
  git archive HEAD | tar tf -

the resulting archive would contain only "foo" and ".gitattributes",
not subdir.  This was broken with a recent change that intended to
allow "subdir/ export-ignore" to also exclude the directory, but
instead ended up _requiring_ the trailing slash by mistake.

A pattern "subdir" should match any path "subdir", whether it is a
directory or a non-directory.  A pattern "subdir/" insists that a
path "subdir" must be a directory for it to match.

This patch adds test not just for this simple case, but also for
deeper cross-directory cases, as well as cases with wildcards.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodir.c::match_pathname(): pay attention to the length of string parameters
Jeff King [Thu, 28 Mar 2013 21:48:21 +0000 (17:48 -0400)]
dir.c::match_pathname(): pay attention to the length of string parameters

This function takes two counted strings: a <pattern, patternlen> pair
and a <pathname, pathlen> pair. But we end up feeding the result to
fnmatch, which expects NUL-terminated strings.

We can fix this by calling the fnmatch_icase_mem function, which
handles re-allocating into a NUL-terminated string if necessary.

While we're at it, we can avoid even calling fnmatch in some cases. In
addition to patternlen, we get "prefix", the size of the pattern that
contains no wildcard characters. We do a straight match of the prefix
part first, and then use fnmatch to cover the rest. But if there are
no wildcards in the pattern at all, we do not even need to call
fnmatch; we would simply be comparing two empty strings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodir.c::match_pathname(): adjust patternlen when shifting pattern
Jeff King [Thu, 28 Mar 2013 21:47:47 +0000 (17:47 -0400)]
dir.c::match_pathname(): adjust patternlen when shifting pattern

If we receive a pattern that starts with "/", we shift it
forward to avoid looking at the "/" part. Since the prefix
and patternlen parameters are counts of what is in the
pattern, we must decrement them as we increment the pointer.

We remembered to handle prefix, but not patternlen. This
didn't cause any bugs, though, because the patternlen
parameter is not actually used. Since it will be used in
future patches, let's correct this oversight.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodir.c::match_basename(): pay attention to the length of string parameters
Junio C Hamano [Thu, 28 Mar 2013 21:47:28 +0000 (17:47 -0400)]
dir.c::match_basename(): pay attention to the length of string parameters

The function takes two counted strings (<basename, basenamelen> and
<pattern, patternlen>) as parameters, together with prefix (the
length of the prefix in pattern that is to be matched literally
without globbing against the basename) and EXC_* flags that tells it
how to match the pattern against the basename.

However, it did not pay attention to the length of these counted
strings.  Update them to do the following:

 * When the entire pattern is to be matched literally, the pattern
   matches the basename only when the lengths of them are the same,
   and they match up to that length.

 * When the pattern is "*" followed by a string to be matched
   literally, make sure that the basenamelen is equal or longer than
   the "literal" part of the pattern, and the tail of the basename
   string matches that literal part.

 * Otherwise, use the new fnmatch_icase_mem helper to make
   sure we only lookmake sure we use only look at the
   counted part of the strings.  Because these counted strings are
   full strings most of the time, we check for termination
   to avoid unnecessary allocation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoattr.c::path_matches(): special case paths that end with a slash
Junio C Hamano [Thu, 28 Mar 2013 21:49:13 +0000 (17:49 -0400)]
attr.c::path_matches(): special case paths that end with a slash

The function is given a string that ends with a slash to signal that
the path is a directory to make sure that a pattern that ends with a
slash (i.e. MUSTBEDIR) can tell directories and non-directories
apart.  However, the pattern itself (pat->pattern and
pat->patternlen) that came from such a MUSTBEDIR pattern is
represented as a string that ends with a slash, but patternlen does
not count that trailing slash. A MUSTBEDIR pattern "element/" is
represented as a counted string <"element/", 7> and this must match
match pathname "element/".

Because match_basename() and match_pathname() want to see pathname
"element" to match against the pattern <"element/", 7>, reduce the
length of the path to exclude the trailing slash when calling
these functions.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit help config: s/insn/instruction/
Matthias Krüger [Wed, 27 Mar 2013 22:53:50 +0000 (23:53 +0100)]
git help config: s/insn/instruction/

"insn" appears to be an in-code abbreviation and should not appear
in manual/help pages.

Signed-off-by: Matthias Krüger <matthias.krueger@famsik.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomerge-tree: fix typo in merge-tree.c::unresolved
John Keeping [Wed, 27 Mar 2013 15:58:50 +0000 (15:58 +0000)]
merge-tree: fix typo in merge-tree.c::unresolved

When calculating whether there is a d/f conflict, the calculation of
whether both sides are directories generates an incorrect references
mask because it does not use the loop index to set the correct bit.
Fix this typo.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-commit doc: describe use of multiple `-m` options
Christian Helmuth [Wed, 27 Mar 2013 14:19:35 +0000 (15:19 +0100)]
git-commit doc: describe use of multiple `-m` options

The text is copied from Documentation/git-tag.txt.

Signed-off-by: Christian Helmuth <christian.helmuth@genode-labs.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-pull doc: fix grammo ("conflicts" is plural)
Mihai Capotă [Wed, 27 Mar 2013 11:04:51 +0000 (12:04 +0100)]
git-pull doc: fix grammo ("conflicts" is plural)

Signed-off-by: Mihai Capotă <mihai@mihaic.ro>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoattr.c::path_matches(): the basename is part of the pathname
Junio C Hamano [Tue, 26 Mar 2013 17:28:07 +0000 (10:28 -0700)]
attr.c::path_matches(): the basename is part of the pathname

The function takes two strings (pathname and basename) as if they
are independent strings, but in reality, the latter is always
pointing into a substring in the former.

Clarify this relationship by expressing the latter as an offset into
the former.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoCorrect the docs about GIT_SSH.
Dan Bornstein [Thu, 21 Mar 2013 23:06:40 +0000 (23:06 +0000)]
Correct the docs about GIT_SSH.

In particular, it can get called with four arguments if you happen to
be referring to a repo using the ssh:// scheme with a non-default port
number.

Signed-off-by: Dan Bornstein <danfuzz@milk.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'lf/bundle-verify-list-prereqs' into maint-1.8.1
Junio C Hamano [Mon, 25 Mar 2013 20:46:02 +0000 (13:46 -0700)]
Merge branch 'lf/bundle-verify-list-prereqs' into maint-1.8.1

"git bundle verify" did not say "records a complete history" for a
bundle that does not have any prerequisites.

* lf/bundle-verify-list-prereqs:
  bundle: Add colons to list headings in "verify"
  bundle: Fix "verify" output if history is complete

11 years agoMerge branch 'tk/doc-filter-branch' into maint-1.8.1
Junio C Hamano [Mon, 25 Mar 2013 20:45:53 +0000 (13:45 -0700)]
Merge branch 'tk/doc-filter-branch' into maint-1.8.1

Add an example use of "--env-filter" in "filter-branch"
documentation.

* tk/doc-filter-branch:
  Documentation: filter-branch env-filter example
  git-filter-branch.txt: clarify ident variables usage

11 years agoMerge branch 'dm/ni-maxhost-may-be-missing' into maint-1.8.1
Junio C Hamano [Mon, 25 Mar 2013 20:45:42 +0000 (13:45 -0700)]
Merge branch 'dm/ni-maxhost-may-be-missing' into maint-1.8.1

Some sources failed to compile on systems that lack NI_MAXHOST in
their system header.

* dm/ni-maxhost-may-be-missing:
  git-compat-util.h: Provide missing netdb.h definitions

11 years agoMerge branch 'gp/describe-match-uses-glob-pattern' into maint-1.8.1
Junio C Hamano [Mon, 25 Mar 2013 20:45:33 +0000 (13:45 -0700)]
Merge branch 'gp/describe-match-uses-glob-pattern' into maint-1.8.1

The "--match=<pattern>" argument "git describe" takes uses glob
pattern but it wasn't obvious from the documentation.

* gp/describe-match-uses-glob-pattern:
  describe: Document --match pattern format

11 years agoMerge branch 'nd/doc-index-format' into maint-1.8.1
Junio C Hamano [Mon, 25 Mar 2013 20:45:26 +0000 (13:45 -0700)]
Merge branch 'nd/doc-index-format' into maint-1.8.1

The v4 index format was not documented.

* nd/doc-index-format:
  update-index: list supported idx versions and their features
  read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr()
  index-format.txt: mention of v4 is missing in some places

11 years agoMerge branch 'wk/doc-pre-rebase' into maint-1.8.1
Junio C Hamano [Mon, 25 Mar 2013 20:45:14 +0000 (13:45 -0700)]
Merge branch 'wk/doc-pre-rebase' into maint-1.8.1

The arguments given to pre-rebase hook were not documented.

* wk/doc-pre-rebase:
  Documentation/githooks: Explain pre-rebase parameters

11 years agoMerge branch 'jc/color-diff-doc' into maint-1.8.1
Junio C Hamano [Mon, 25 Mar 2013 20:44:53 +0000 (13:44 -0700)]
Merge branch 'jc/color-diff-doc' into maint-1.8.1

The "--color=<when>" argument to the commands in the diff family
was described poorly.

* jc/color-diff-doc:
  diff-options: unconfuse description of --color

11 years agoFix revision walk for commits with the same dates
Kacper Kornet [Fri, 22 Mar 2013 18:38:19 +0000 (19:38 +0100)]
Fix revision walk for commits with the same dates

Logic in still_interesting function allows to stop the commits
traversing if the oldest processed commit is not older then the
youngest commit on the list to process and the list contains only
commits marked as not interesting ones. It can be premature when dealing
with a set of coequal commits. For example git rev-list A^! --not B
provides wrong answer if all commits in the range A..B had the same
commit time and there are more then 7 of them.

To fix this problem the relevant part of the logic in still_interesting
is changed to: the walk can be stopped if the oldest processed commit is
younger then the youngest commit on the list to processed.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: merging a tag is a special case
Junio C Hamano [Thu, 21 Mar 2013 21:57:48 +0000 (22:57 +0100)]
Documentation: merging a tag is a special case

When asking Git to merge a tag (such as a signed tag or annotated tag),
it will always create a merge commit even if fast-forward was possible.
It's like having --no-ff present on the command line.

It's a difference from the default behavior described in git-merge.txt.
It should be documented as an exception of "FAST-FORWARD MERGE" section
and "--ff" option description.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot2003: work around path mangling issue on Windows
Johannes Sixt [Wed, 20 Mar 2013 08:47:57 +0000 (09:47 +0100)]
t2003: work around path mangling issue on Windows

MSYS bash considers the part "/g" in the sed expression "s/./=/g" as an
absolute path after an assignment, and mangles it to a C:/something
string. Do not attract bash's attention by avoiding the equals sign.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopack-refs: add fully-peeled trait
Michael Haggerty [Mon, 18 Mar 2013 11:37:32 +0000 (07:37 -0400)]
pack-refs: add fully-peeled trait

Older versions of pack-refs did not write peel lines for
refs outside of refs/tags. This meant that on reading the
pack-refs file, we might set the REF_KNOWS_PEELED flag for
such a ref, even though we do not know anything about its
peeled value.

The previous commit updated the writer to always peel, no
matter what the ref is. That means that packed-refs files
written by newer versions of git are fine to be read by both
old and new versions of git. However, we still have the
problem of reading packed-refs files written by older
versions of git, or by other implementations which have not
yet learned the same trick.

The simplest fix would be to always unset the
REF_KNOWS_PEELED flag for refs outside of refs/tags that do
not have a peel line (if it has a peel line, we know it is
valid, but we cannot assume a missing peel line means
anything). But that loses an important optimization, as
upload-pack should not need to load the object pointed to by
refs/heads/foo to determine that it is not a tag.

Instead, we add a "fully-peeled" trait to the packed-refs
file. If it is set, we know that we can trust a missing peel
line to mean that a ref cannot be peeled. Otherwise, we fall
back to assuming nothing.

[commit message and tests by Jeff King <peff@peff.net>]

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot1507: Test that branchname@{upstream} is interpreted as branch
Kacper Kornet [Sun, 17 Mar 2013 22:17:09 +0000 (23:17 +0100)]
t1507: Test that branchname@{upstream} is interpreted as branch

Syntax branchname@{upstream} should interpret its argument as a name of
a branch. Add the test to check that it doesn't try to interpret it as a
refname if the branch in question does not exist.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopack-refs: write peeled entry for non-tags
Jeff King [Sun, 17 Mar 2013 08:23:46 +0000 (04:23 -0400)]
pack-refs: write peeled entry for non-tags

When we pack an annotated tag ref, we write not only the
sha1 of the tag object along with the ref, but also the sha1
obtained by peeling the tag. This lets readers of the
pack-refs file know the peeled value without having to
actually load the object, speeding up upload-pack's ref
advertisement.

The writer marks a packed-refs file with peeled refs using
the "peeled" trait at the top of the file. When the reader
sees this trait, it knows that each ref is either followed
by its peeled value, or it is not an annotated tag.

However, there is a mismatch between the assumptions of the
reader and writer. The writer will only peel refs under
refs/tags, but the reader does not know this; it will assume
a ref without a peeled value must not be a tag object. Thus
an annotated tag object placed outside of the refs/tags
hierarchy will not have its peeled value printed by
upload-pack.

The simplest way to fix this is to start writing peel values
for all refs. This matches what the reader expects for both
new and old versions of git.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agouse parse_object_or_die instead of die("bad object")
Jeff King [Sun, 17 Mar 2013 08:23:31 +0000 (04:23 -0400)]
use parse_object_or_die instead of die("bad object")

Some call-sites do:

  o = parse_object(sha1);
  if (!o)
  die("bad object %s", some_name);

We can now handle that as a one-liner, and get more
consistent output.

In the third case of this patch, it looks like we are losing
information, as the existing message also outputs the sha1
hex; however, parse_object will already have written a more
specific complaint about the sha1, so there is no point in
repeating it here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoavoid segfaults on parse_object failure
Jeff King [Sun, 17 Mar 2013 08:22:36 +0000 (04:22 -0400)]
avoid segfaults on parse_object failure

Many call-sites of parse_object assume that they will get a
non-NULL return value; this is not the case if we encounter
an error while parsing the object.

This patch adds a wrapper function around parse_object that
handles dying automatically, and uses it anywhere we
immediately try to access the return value as a non-NULL
pointer (i.e., anywhere that we would currently segfault).

This wrapper may also be useful in other places. The most
obvious one is code like:

  o = parse_object(sha1);
  if (!o)
  die(...);

However, these should not be mechanically converted to
parse_object_or_die, as the die message is sometimes
customized. Later patches can address these sites on a
case-by-case basis.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorev-parse: clarify documentation of $name@{upstream} syntax
Kacper Kornet [Sat, 16 Mar 2013 18:51:43 +0000 (19:51 +0100)]
rev-parse: clarify documentation of $name@{upstream} syntax

"git rev-parse" interprets string in string@{upstream} as a name of
a branch not a ref. For example, refs/heads/master@{upstream} looks
for an upstream branch that is merged by git-pull to ref
refs/heads/refs/heads/master not to refs/heads/master.

However the documentation could mislead a user to believe that the
string is interpreted as ref.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosha1_name: pass object name length to diagnose_invalid_sha1_path()
René Scharfe [Sat, 16 Mar 2013 18:29:31 +0000 (19:29 +0100)]
sha1_name: pass object name length to diagnose_invalid_sha1_path()

The only caller of diagnose_invalid_sha1_path() extracts a substring from
an object name by creating a NUL-terminated copy of the interesting part.
Add a length parameter to the function and thus avoid the need for an
allocation, thereby simplifying the code.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMakefile: keep LIB_H entries together and sorted
René Scharfe [Sat, 16 Mar 2013 15:58:28 +0000 (16:58 +0100)]
Makefile: keep LIB_H entries together and sorted

As a follow-up to 60d24dd25 (Makefile: fold XDIFF_H and VCSSVN_H into
LIB_H), let the unconditional additions to LIB_H form a single sorted
list.  Also drop the duplicate entry for xdiff/xdiff.h, which was easy
to spot after sorting.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoindex-pack: fix buffer overflow caused by translations
Nguyễn Thái Ngọc Duy [Sat, 16 Mar 2013 01:25:18 +0000 (08:25 +0700)]
index-pack: fix buffer overflow caused by translations

The translation of "completed with %d local objects" is put in a
48-byte buffer, which may be enough for English but not true for any
translations. Convert it to use strbuf (i.e. no hard limit on
translation length).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoentry: fix filter lookup
John Keeping [Thu, 14 Mar 2013 20:00:51 +0000 (20:00 +0000)]
entry: fix filter lookup

When looking up the stream filter, write_entry() should be passing the
path of the file in the repository, not the path to which the content is
going to be written.  This allows the file to be correctly looked up
against the .gitattributes files in the working tree.

This change makes the streaming case match the non-streaming case which
passes ce->name to convert_to_working_tree later in the same function.

The two tests added here test the different paths through write_entry
since the CRLF filter is a streaming filter but the user-defined smudge
filter is not streamed.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot2003: modernize style
John Keeping [Thu, 14 Mar 2013 20:00:50 +0000 (20:00 +0000)]
t2003: modernize style

- Description goes on the test_expect_* line
- Open SQ of test goes on the test_expect_* line
- Closing SQ of test goes on its own line
- Use TAB for indent

Also remove three comments that appear to relate to the development of
the patch before it was committed.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit.c: make usage match manual page
Kevin Bracey [Mon, 11 Mar 2013 19:44:15 +0000 (21:44 +0200)]
git.c: make usage match manual page

Reorder option list in command-line usage to match the manual page.
Also make it less than 80-characters wide.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoTranslate git_more_info_string consistently
Kevin Bracey [Sun, 10 Mar 2013 15:10:20 +0000 (17:10 +0200)]
Translate git_more_info_string consistently

"git help" translated the "See 'git help <command>' for more
information..." message, but "git" didn't.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoperf: update documentation of GIT_PERF_REPEAT_COUNT
Antoine Pelisse [Sat, 9 Mar 2013 15:29:25 +0000 (16:29 +0100)]
perf: update documentation of GIT_PERF_REPEAT_COUNT

Currently the documentation of GIT_PERF_REPEAT_COUNT says the default is
five while "perf-lib.sh" uses a value of three as a default.

Update the documentation so that it is consistent with the code.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobundle: Add colons to list headings in "verify"
Lukas Fleischer [Fri, 8 Mar 2013 18:01:26 +0000 (19:01 +0100)]
bundle: Add colons to list headings in "verify"

These slightly improve the reading flow by making it obvious that a list
follows.

Also, make the wording of both headings consistent by changing "contains
%d ref(s)" to "contains this ref"/"contains these %d refs".

Signed-off-by: Lukas Fleischer <git@cryptocrack.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobundle: Fix "verify" output if history is complete
Lukas Fleischer [Thu, 7 Mar 2013 00:56:35 +0000 (01:56 +0100)]
bundle: Fix "verify" output if history is complete

A more informative message for "complete" bundles was added in commit
8c3710fd3011 (tweak "bundle verify" of a complete history, 2012-06-04).

However, the prerequisites ref list is currently read *after* we
check if it equals zero, which means we never actually use the
number of prerequisite refs to decide when to print the newly
introduced message.  The code incorrectly uses the number of
references recorded in the bundle instead.

Signed-off-by: Lukas Fleischer <git@cryptocrack.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'mh/maint-ceil-absolute' into maint
Junio C Hamano [Thu, 7 Mar 2013 20:49:57 +0000 (12:49 -0800)]
Merge branch 'mh/maint-ceil-absolute' into maint

* mh/maint-ceil-absolute:
  Provide a mechanism to turn off symlink resolution in ceiling paths

11 years agogitweb/README: remove reference to git.kernel.org
Fredrik Gustafsson [Thu, 7 Mar 2013 01:23:43 +0000 (02:23 +0100)]
gitweb/README: remove reference to git.kernel.org

git.kernel.org no longer uses gitweb but has switched to cgit.

Info about this can be found on: https://www.kernel.org/pelican.html
or simply by looking at http://git.kernel.org . This is change since
2013-03-01.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotests: make sure rename pretty print works
Antoine Pelisse [Wed, 6 Mar 2013 21:36:12 +0000 (22:36 +0100)]
tests: make sure rename pretty print works

Add basic use cases and corner cases tests for
"git diff -M --summary/stat".

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.8.1.5 v1.8.1.5
Junio C Hamano [Fri, 1 Mar 2013 21:15:29 +0000 (13:15 -0800)]
Git 1.8.1.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMake !pattern in .gitattributes non-fatal
Thomas Rast [Fri, 1 Mar 2013 20:06:17 +0000 (21:06 +0100)]
Make !pattern in .gitattributes non-fatal

Before 82dce99 (attr: more matching optimizations from .gitignore,
2012-10-15), .gitattributes did not have any special treatment of a
leading '!'.  The docs, however, always said

  The rules how the pattern matches paths are the same as in
  `.gitignore` files; see linkgit:gitignore[5].

By those rules, leading '!' means pattern negation.  So 82dce99
correctly determined that this kind of line makes no sense and should
be disallowed.

However, users who actually had a rule for files starting with a '!'
are in a bad position: before 82dce99 '!' matched that literal
character, so it is conceivable that users have .gitattributes with
such lines in them.  After 82dce99 the unescaped version was
disallowed in such a way that git outright refuses to run(!) most
commands in the presence of such a .gitattributes.  It therefore
becomes very hard to fix, let alone work with, such repositories.

Let's at least allow the users to fix their repos: change the fatal
error into a warning.

Reported-by: mathstuf@gmail.com
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'wk/user-manual' into maint
Junio C Hamano [Fri, 1 Mar 2013 18:37:40 +0000 (10:37 -0800)]
Merge branch 'wk/user-manual' into maint

* wk/user-manual:
  user-manual: Flesh out uncommitted changes and submodule updates
  user-manual: Use request-pull to generate "please pull" text
  user-manual: Reorganize the reroll sections, adding 'git rebase -i'

11 years agoDocumentation/githooks: Fix linkgit
Andrew Wong [Fri, 1 Mar 2013 17:23:57 +0000 (12:23 -0500)]
Documentation/githooks: Fix linkgit

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoname-hash.c: fix endless loop with core.ignorecase=true
Karsten Blees [Wed, 27 Feb 2013 23:57:48 +0000 (00:57 +0100)]
name-hash.c: fix endless loop with core.ignorecase=true

With core.ignorecase=true, name-hash.c builds a case insensitive index of
all tracked directories. Currently, the existing cache entry structures are
added multiple times to the same hashtable (with different name lengths and
hash codes). However, there's only one dir_next pointer, which gets
completely messed up in case of hash collisions. In the worst case, this
causes an endless loop if ce == ce->dir_next (see t7062).

Use a separate hashtable and separate structures for the directory index
so that each directory entry has its own next pointer. Use reference
counting to track which directory entry contains files.

There are only slight changes to the name-hash.c API:
- new free_name_hash() used by read_cache.c::discard_index()
- remove_name_hash() takes an additional index_state parameter
- index_name_exists() for a directory (trailing '/') may return a cache
  entry that has been removed (CE_UNHASHED). This is not a problem as the
  return value is only used to check if the directory exists (dir.c) or to
  normalize casing of directory names (read-cache.c).

Getting rid of cache_entry.dir_next reduces memory consumption, especially
with core.ignorecase=false (which doesn't use that member at all).

With core.ignorecase=true, building the directory index is slightly faster
as we add / check the parent directory first (instead of going through all
directory levels for each file in the index). E.g. with WebKit (~200k
files, ~7k dirs), time spent in lazy_init_name_hash is reduced from 176ms
to 130ms.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.8.1.5
Junio C Hamano [Wed, 27 Feb 2013 18:09:59 +0000 (10:09 -0800)]
Update draft release notes to 1.8.1.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'ef/non-ascii-parse-options-error-diag' into maint
Junio C Hamano [Wed, 27 Feb 2013 18:04:26 +0000 (10:04 -0800)]
Merge branch 'ef/non-ascii-parse-options-error-diag' into maint

* ef/non-ascii-parse-options-error-diag:
  parse-options: report uncorrupted multi-byte options

11 years agoMerge branch 'wk/man-deny-current-branch-is-default-these-days' into maint
Junio C Hamano [Wed, 27 Feb 2013 18:01:21 +0000 (10:01 -0800)]
Merge branch 'wk/man-deny-current-branch-is-default-these-days' into maint

* wk/man-deny-current-branch-is-default-these-days:
  user-manual: typofix (ofthe->of the)
  user-manual: Update for receive.denyCurrentBranch=refuse

11 years agoMerge branch 'jn/less-reconfigure' into maint
Junio C Hamano [Wed, 27 Feb 2013 17:59:19 +0000 (09:59 -0800)]
Merge branch 'jn/less-reconfigure' into maint

* jn/less-reconfigure:
  Makefile: avoid infinite loop on configure.ac change

11 years agoDocumentation/submodule: Add --force to update synopsis
Brad King [Wed, 27 Feb 2013 00:41:34 +0000 (19:41 -0500)]
Documentation/submodule: Add --force to update synopsis

In commit 9db31bdf (submodule: Add --force option for git submodule
update, 2011-04-01) we added the option to the implementation's usage
synopsis but forgot to add it to the synopsis in the command
documentation.  Add the option to the synopsis in the same location it
is reported in usage and re-wrap the options to avoid long lines.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodiff: prevent pprint_rename from underrunning input
Thomas Rast [Tue, 26 Feb 2013 20:47:01 +0000 (21:47 +0100)]
diff: prevent pprint_rename from underrunning input

The logic described in d020e27 (diff: Fix rename pretty-print when
suffix and prefix overlap, 2013-02-23) is wrong: The proof in the
comment is valid only if both strings are the same length.  *One* of
old/new can reach a-1 (b-1, resp.) if 'a' is a suffix of 'b' (or vice
versa).

Since the intent was to let the loop run down to the '/' at the end of
the common prefix, fix it by making that distinction explicit: if
there is no prefix, allow no underrun.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>