gitweb.git
Update draft release notes to 1.9.2Junio C Hamano Tue, 8 Apr 2014 19:08:34 +0000 (12:08 -0700)

Update draft release notes to 1.9.2

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

Merge branch 'mm/status-porcelain-format-i18n-fix'... Junio C Hamano Tue, 8 Apr 2014 19:07:06 +0000 (12:07 -0700)

Merge branch 'mm/status-porcelain-format-i18n-fix' into maint

* mm/status-porcelain-format-i18n-fix:
status: disable translation when --porcelain is used

Merge branch 'bp/commit-p-editor' into maintJunio C Hamano Tue, 8 Apr 2014 19:07:06 +0000 (12:07 -0700)

Merge branch 'bp/commit-p-editor' into maint

* bp/commit-p-editor:
run-command: mark run_hook_with_custom_index as deprecated
merge hook tests: fix and update tests
merge: fix GIT_EDITOR override for commit hook
commit: fix patch hunk editing with "commit -p -m"
test patch hunk editing with "commit -p -m"
merge hook tests: use 'test_must_fail' instead of '!'
merge hook tests: fix missing '&&' in test

Merge branch 'jk/pack-bitmap'Junio C Hamano Tue, 8 Apr 2014 19:00:32 +0000 (12:00 -0700)

Merge branch 'jk/pack-bitmap'

* jk/pack-bitmap:
pack-objects: do not reuse packfiles without --delta-base-offset
add `ignore_missing_links` mode to revwalk

Merge branch 'jl/nor-or-nand-and'Junio C Hamano Tue, 8 Apr 2014 19:00:27 +0000 (12:00 -0700)

Merge branch 'jl/nor-or-nand-and'

Eradicate mistaken use of "nor" (that is, essentially "nor" used
not in "neither A nor B" ;-)) from in-code comments, command output
strings, and documentations.

* jl/nor-or-nand-and:
code and test: fix misuses of "nor"
comments: fix misuses of "nor"
contrib: fix misuses of "nor"
Documentation: fix misuses of "nor"

Merge branch 'mh/update-ref-batch-create-fix'Junio C Hamano Tue, 8 Apr 2014 19:00:22 +0000 (12:00 -0700)

Merge branch 'mh/update-ref-batch-create-fix'

* mh/update-ref-batch-create-fix:
update-ref: fail create operation over stdin if ref already exists

Merge branch 'mr/opt-set-ptr'Junio C Hamano Tue, 8 Apr 2014 19:00:16 +0000 (12:00 -0700)

Merge branch 'mr/opt-set-ptr'

OPT_SET_PTR() implementation was broken on IL32P64 platforms;
it turns out that the macro is not used by any real user.

* mr/opt-set-ptr:
parse-options: remove unused OPT_SET_PTR
parse-options: add cast to correct pointer type to OPT_SET_PTR
MSVC: fix t0040-parse-options crash

Merge branch 'ib/rev-parse-parseopt-argh'Junio C Hamano Tue, 8 Apr 2014 19:00:08 +0000 (12:00 -0700)

Merge branch 'ib/rev-parse-parseopt-argh'

Finishing touch to a new topic scheduled for 2.0.

* ib/rev-parse-parseopt-argh:
rev-parse: fix typo in example on manpage

Merge branch 'mr/msvc-link-with-invalidcontinue'Junio C Hamano Tue, 8 Apr 2014 18:59:46 +0000 (11:59 -0700)

Merge branch 'mr/msvc-link-with-invalidcontinue'

* mr/msvc-link-with-invalidcontinue:
MSVC: link in invalidcontinue.obj for better POSIX compatibility

Merge branch 'jc/rev-parse-argh-dashed-multi-words'Junio C Hamano Tue, 8 Apr 2014 18:59:27 +0000 (11:59 -0700)

Merge branch 'jc/rev-parse-argh-dashed-multi-words'

Make sure that the help text given to describe the "<param>" part
of the "git cmd --option=<param>" does not contain SP or _,
e.g. "--gpg-sign=<key-id>" option for "git commit" is not spelled
as "--gpg-sign=<key id>".

* jc/rev-parse-argh-dashed-multi-words:
parse-options: make sure argh string does not have SP or _
update-index: teach --cacheinfo a new syntax "mode,sha1,path"
parse-options: multi-word argh should use dash to separate words

Merge branch 'jk/commit-dates-parsing-fix'Junio C Hamano Tue, 8 Apr 2014 18:59:05 +0000 (11:59 -0700)

Merge branch 'jk/commit-dates-parsing-fix'

Finishing touches for portability.

* jk/commit-dates-parsing-fix:
t4212: loosen far-in-future test for AIX
date: recognize bogus FreeBSD gmtime output

git-p4: explicitly specify that HEAD is a revisionVlad Dogaru Mon, 7 Apr 2014 13:19:11 +0000 (16:19 +0300)

git-p4: explicitly specify that HEAD is a revision

'git p4 rebase' fails with the following message if there is a file
named HEAD in the current directory:

fatal: ambiguous argument 'HEAD': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Take the suggestion above and explicitly state that HEAD should be
treated as a revision.

Signed-off-by: Vlad Dogaru <vdogaru@ixiacom.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

combine-diff: speed it up, by using multiparent diff... Kirill Smelkov Mon, 24 Feb 2014 16:21:51 +0000 (20:21 +0400)

combine-diff: speed it up, by using multiparent diff tree-walker directly

As was recently shown in "combine-diff: optimize
combine_diff_path sets intersection", combine-diff runs very slowly. In
that commit we optimized paths sets intersection, but that accounted
only for ~ 25% of the slowness, and as my tracing showed, for linux.git
v3.10..v3.11, for merges a lot of time is spent computing
diff(commit,commit^2) just to only then intersect that huge diff to
almost small set of files from diff(commit,commit^1).

In previous commit, we described the problem in more details, and
reworked the diff tree-walker to be general one - i.e. to work in
multiple parent case too. Now is the time to take advantage of it for
finding paths for combine diff.

The implementation is straightforward - if we know, we can get generated
diff paths directly, and at present that means no diff filtering or
rename/copy detection was requested(*), we can call multiparent tree-walker
directly and get ready paths.

(*) because e.g. at present, all diffcore transformations work on
diff_filepair queues, but in the future, that limitation can be
lifted, if filters would operate directly on combine_diff_paths.

Timings for `git log --raw --no-abbrev --no-renames` without `-c` ("git log")
and with `-c` ("git log -c") and with `-c --merges` ("git log -c --merges")
before and after the patch are as follows:

linux.git v3.10..v3.11

log log -c log -c --merges

before 1.9s 16.4s 15.2s
after 1.9s 2.4s 1.1s

The result stayed the same.

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

tree-diff: rework diff_tree() to generate diffs for... Kirill Smelkov Sun, 6 Apr 2014 21:46:26 +0000 (01:46 +0400)

tree-diff: rework diff_tree() to generate diffs for multiparent cases as well

Previously diff_tree(), which is now named ll_diff_tree_sha1(), was
generating diff_filepair(s) for two trees t1 and t2, and that was
usually used for a commit as t1=HEAD~, and t2=HEAD - i.e. to see changes
a commit introduces.

In Git, however, we have fundamentally built flexibility in that a
commit can have many parents - 1 for a plain commit, 2 for a simple merge,
but also more than 2 for merging several heads at once.

For merges there is a so called combine-diff, which shows diff, a merge
introduces by itself, omitting changes done by any parent. That works
through first finding paths, that are different to all parents, and then
showing generalized diff, with separate columns for +/- for each parent.
The code lives in combine-diff.c .

There is an impedance mismatch, however, in that a commit could
generally have any number of parents, and that while diffing trees, we
divide cases for 2-tree diffs and more-than-2-tree diffs. I mean there
is no special casing for multiple parents commits in e.g.
revision-walker .

That impedance mismatch *hurts* *performance* *badly* for generating
combined diffs - in "combine-diff: optimize combine_diff_path
sets intersection" I've already removed some slowness from it, but from
the timings provided there, it could be seen, that combined diffs still
cost more than an order of magnitude more cpu time, compared to diff for
usual commits, and that would only be an optimistic estimate, if we take
into account that for e.g. linux.git there is only one merge for several
dozens of plain commits.

That slowness comes from the fact that currently, while generating
combined diff, a lot of time is spent computing diff(commit,commit^2)
just to only then intersect that huge diff to almost small set of files
from diff(commit,commit^1).

That's because at present, to compute combine-diff, for first finding
paths, that "every parent touches", we use the following combine-diff
property/definition:

D(A,P1...Pn) = D(A,P1) ^ ... ^ D(A,Pn) (w.r.t. paths)

where

D(A,P1...Pn) is combined diff between commit A, and parents Pi

and

D(A,Pi) is usual two-tree diff Pi..A

So if any of that D(A,Pi) is huge, tracting 1 n-parent combine-diff as n
1-parent diffs and intersecting results will be slow.

And usually, for linux.git and other topic-based workflows, that
D(A,P2) is huge, because, if merge-base of A and P2, is several dozens
of merges (from A, via first parent) below, that D(A,P2) will be diffing
sum of merges from several subsystems to 1 subsystem.

The solution is to avoid computing n 1-parent diffs, and to find
changed-to-all-parents paths via scanning A's and all Pi's trees
simultaneously, at each step comparing their entries, and based on that
comparison, populate paths result, and deduce we could *skip*
*recursing* into subdirectories, if at least for 1 parent, sha1 of that
dir tree is the same as in A. That would save us from doing significant
amount of needless work.

Such approach is very similar to what diff_tree() does, only there we
deal with scanning only 2 trees simultaneously, and for n+1 tree, the
logic is a bit more complex:

D(T,P1...Pn) calculation scheme
-------------------------------

D(T,P1...Pn) = D(T,P1) ^ ... ^ D(T,Pn) (regarding resulting paths set)

D(T,Pj) - diff between T..Pj
D(T,P1...Pn) - combined diff from T to parents P1,...,Pn

We start from all trees, which are sorted, and compare their entries in
lock-step:

T P1 Pn
- - -
|t| |p1| |pn|
|-| |--| ... |--| imin = argmin(p1...pn)
| | | | | |
|-| |--| |--|
|.| |. | |. |
. . .
. . .

at any time there could be 3 cases:

1) t < p[imin];
2) t > p[imin];
3) t = p[imin].

Schematic deduction of what every case means, and what to do, follows:

1) t < p[imin] -> ∀j t ∉ Pj -> "+t" ∈ D(T,Pj) -> D += "+t"; t↓

2) t > p[imin]

2.1) ∃j: pj > p[imin] -> "-p[imin]" ∉ D(T,Pj) -> D += ø; ∀ pi=p[imin] pi↓
2.2) ∀i pi = p[imin] -> pi ∉ T -> "-pi" ∈ D(T,Pi) -> D += "-p[imin]"; ∀i pi↓

3) t = p[imin]

3.1) ∃j: pj > p[imin] -> "+t" ∈ D(T,Pj) -> only pi=p[imin] remains to investigate
3.2) pi = p[imin] -> investigate δ(t,pi)
|
|
v

3.1+3.2) looking at δ(t,pi) ∀i: pi=p[imin] - if all != ø ->

⎧δ(t,pi) - if pi=p[imin]
-> D += ⎨
⎩"+t" - if pi>p[imin]

in any case t↓ ∀ pi=p[imin] pi↓

~

For comparison, here is how diff_tree() works:

D(A,B) calculation scheme
-------------------------

A B
- -
|a| |b| a < b -> a ∉ B -> D(A,B) += +a a↓
|-| |-| a > b -> b ∉ A -> D(A,B) += -b b↓
| | | | a = b -> investigate δ(a,b) a↓ b↓
|-| |-|
|.| |.|
. .
. .

~~~~~~~~

This patch generalizes diff tree-walker to work with arbitrary number of
parents as described above - i.e. now there is a resulting tree t, and
some parents trees tp[i] i=[0..nparent). The generalization builds on
the fact that usual diff

D(A,B)

is by definition the same as combined diff

D(A,[B]),

so if we could rework the code for common case and make it be not slower
for nparent=1 case, usual diff(t1,t2) generation will not be slower, and
multiparent diff tree-walker would greatly benefit generating
combine-diff.

What we do is as follows:

1) diff tree-walker ll_diff_tree_sha1() is internally reworked to be
a paths generator (new name diff_tree_paths()), with each generated path
being `struct combine_diff_path` with info for path, new sha1,mode and for
every parent which sha1,mode it was in it.

2) From that info, we can still generate usual diff queue with
struct diff_filepairs, via "exporting" generated
combine_diff_path, if we know we run for nparent=1 case.
(see emit_diff() which is now named emit_diff_first_parent_only())

3) In order for diff_can_quit_early(), which checks

DIFF_OPT_TST(opt, HAS_CHANGES))

to work, that exporting have to be happening not in bulk, but
incrementally, one diff path at a time.

For such consumers, there is a new callback in diff_options
introduced:

->pathchange(opt, struct combine_diff_path *)

which, if set to !NULL, is called for every generated path.

(see new compat ll_diff_tree_sha1() wrapper around new paths
generator for setup)

4) The paths generation itself, is reworked from previous
ll_diff_tree_sha1() code according to "D(A,P1...Pn) calculation
scheme" provided above:

On the start we allocate [nparent] arrays in place what was
earlier just for one parent tree.

then we just generalize loops, and comparison according to the
algorithm.

Some notes(*):

1) alloca(), for small arrays, is used for "runs not slower for
nparent=1 case than before" goal - if we change it to xmalloc()/free()
the timings get ~1% worse. For alloca() we use just-introduced
xalloca/xalloca_free compatibility wrappers, so it should not be a
portability problem.

2) For every parent tree, we need to keep a tag, whether entry from that
parent equals to entry from minimal parent. For performance reasons I'm
keeping that tag in entry's mode field in unused bit - see S_IFXMIN_NEQ.
Not doing so, we'd need to alloca another [nparent] array, which hurts
performance.

3) For emitted paths, memory could be reused, if we know the path was
processed via callback and will not be needed later. We use efficient
hand-made realloc-style path_appendnew(), that saves us from ~1-1.5%
of potential additional slowdown.

4) goto(s) are used in several places, as the code executes a little bit
faster with lowered register pressure.

Also

- we should now check for FIND_COPIES_HARDER not only when two entries
names are the same, and their hashes are equal, but also for a case,
when a path was removed from some of all parents having it.

The reason is, if we don't, that path won't be emitted at all (see
"a > xi" case), and we'll just skip it, and FIND_COPIES_HARDER wants
all paths - with diff or without - to be emitted, to be later analyzed
for being copies sources.

The new check is only necessary for nparent >1, as for nparent=1 case
xmin_eqtotal always =1 =nparent, and a path is always added to diff as
removal.

~~~~~~~~

Timings for

# without -c, i.e. testing only nparent=1 case
`git log --raw --no-abbrev --no-renames`

before and after the patch are as follows:

navy.git linux.git v3.10..v3.11

before 0.611s 1.889s
after 0.619s 1.907s
slowdown 1.3% 0.9%

This timings show we did no harm to usual diff(tree1,tree2) generation.
From the table we can see that we actually did ~1% slowdown, but I think
I've "earned" that 1% in the previous patch ("tree-diff: reuse base
str(buf) memory on sub-tree recursion", HEAD~~) so for nparent=1 case,
net timings stays approximately the same.

The output also stayed the same.

(*) If we revert 1)-4) to more usual techniques, for nparent=1 case,
we'll get ~2-2.5% of additional slowdown, which I've tried to avoid, as
"do no harm for nparent=1 case" rule.

For linux.git, combined diff will run an order of magnitude faster and
appropriate timings will be provided in the next commit, as we'll be
taking advantage of the new diff tree-walker for combined-diff
generation there.

P.S. and combined diff is not some exotic/for-play-only stuff - for
example for a program I write to represent Git archives as readonly
filesystem, there is initial scan with

`git log --reverse --raw --no-abbrev --no-renames -c`

to extract log of what was created/changed when, as a result building a
map

{} sha1 -> in which commit (and date) a content was added

that `-c` means also show combined diff for merges, and without them, if
a merge is non-trivial (merges changes from two parents with both having
separate changes to a file), or an evil one, the map will not be full,
i.e. some valid sha1 would be absent from it.

That case was my initial motivation for combined diffs speedup.

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

ref_transaction_commit(): work with transaction->update... Michael Haggerty Mon, 7 Apr 2014 13:48:18 +0000 (15:48 +0200)

ref_transaction_commit(): work with transaction->updates in place

Now that we free the transaction when we are done, there is no need to
make a copy of transaction->updates before working with it.

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

struct ref_update: add a type fieldMichael Haggerty Mon, 7 Apr 2014 13:48:17 +0000 (15:48 +0200)

struct ref_update: add a type field

It used to be that ref_transaction_commit() allocated a temporary
array to hold the types of references while it is working. Instead,
add a type field to ref_update that ref_transaction_commit() can use
as its scratch space.

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

struct ref_update: add a lock fieldMichael Haggerty Mon, 7 Apr 2014 13:48:16 +0000 (15:48 +0200)

struct ref_update: add a lock field

Now that we manage ref_update objects internally, we can use them to
hold some of the scratch space we need when actually carrying out the
updates. Store the (struct ref_lock *) there.

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

ref_transaction_commit(): simplify code using temporary... Michael Haggerty Mon, 7 Apr 2014 13:48:15 +0000 (15:48 +0200)

ref_transaction_commit(): simplify code using temporary variables

Use temporary variables in the for-loop blocks to simplify expressions
in the rest of the loop.

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

struct ref_update: store refname as a FLEX_ARRAYMichael Haggerty Mon, 7 Apr 2014 13:48:14 +0000 (15:48 +0200)

struct ref_update: store refname as a FLEX_ARRAY

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

struct ref_update: rename field "ref_name" to "refname"Michael Haggerty Mon, 7 Apr 2014 13:48:13 +0000 (15:48 +0200)

struct ref_update: rename field "ref_name" to "refname"

This is consistent with the usual nomenclature.

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

refs: remove API function update_refs()Michael Haggerty Mon, 7 Apr 2014 13:48:12 +0000 (15:48 +0200)

refs: remove API function update_refs()

It has been superseded by reference transactions. This also means
that struct ref_update can become private.

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

update-ref --stdin: reimplement using reference transac... Michael Haggerty Mon, 7 Apr 2014 13:48:11 +0000 (15:48 +0200)

update-ref --stdin: reimplement using reference transactions

This change is mostly clerical: the parse_cmd_*() functions need to
use local variables rather than a struct ref_update to collect the
arguments needed for each update, and then call ref_transaction_*() to
queue the change rather than building up the list of changes at the
caller side.

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

refs: add a concept of a reference transactionMichael Haggerty Mon, 7 Apr 2014 13:48:10 +0000 (15:48 +0200)

refs: add a concept of a reference transaction

Build out the API for dealing with a bunch of reference checks and
changes within a transaction. Define an opaque ref_transaction type
that is managed entirely within refs.c. Introduce functions for
beginning a transaction, adding updates to a transaction, and
committing/rolling back a transaction.

This API will soon replace update_refs().

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

update-ref --stdin: harmonize error messagesMichael Haggerty Mon, 7 Apr 2014 13:48:09 +0000 (15:48 +0200)

update-ref --stdin: harmonize error messages

Make (most of) the error messages for invalid input have the same
format [1]:

$COMMAND [SP $REFNAME]: $MESSAGE

Update the tests accordingly.

[1] A few error messages are left with their old form, because
$COMMAND and $REFNAME aren't passed all the way down the call
stack. Maybe those sites should be changed some day, too.

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

update-ref --stdin: improve the error message for unexp... Michael Haggerty Mon, 7 Apr 2014 13:48:08 +0000 (15:48 +0200)

update-ref --stdin: improve the error message for unexpected EOF

Distinguish this error from the error that an argument is missing for
another reason. Update the tests accordingly.

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

t1400: test one mistake at a timeMichael Haggerty Mon, 7 Apr 2014 13:48:07 +0000 (15:48 +0200)

t1400: test one mistake at a time

This case wants to test passing a bad refname to the "update" command.
But it also passes too few arguments to "update", which muddles the
situation: which error should be diagnosed? So split this test into
two:

* One that passes too few arguments to update

* One that passes all three arguments to "update", but with a bad
refname.

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

update-ref --stdin -z: deprecate interpreting the empty... Michael Haggerty Mon, 7 Apr 2014 13:48:06 +0000 (15:48 +0200)

update-ref --stdin -z: deprecate interpreting the empty string as zeros

In the original version of this command, for the single case of the
"update" command's <newvalue>, the empty string was interpreted as
being equivalent to 40 "0"s. This shorthand is unnecessary (binary
input will usually be generated programmatically anyway), and it
complicates the parser and the documentation.

So gently deprecate this usage: remove its description from the
documentation and emit a warning if it is found. But for reasons of
backwards compatibility, continue to accept it.

Helped-by: Brad King <brad.king@kitware.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update-ref.c: extract a new function, parse_next_sha1()Michael Haggerty Mon, 7 Apr 2014 13:48:05 +0000 (15:48 +0200)

update-ref.c: extract a new function, parse_next_sha1()

Replace three functions, update_store_new_sha1(),
update_store_old_sha1(), and parse_next_arg(), with a single function,
parse_next_sha1(). The new function takes care of a whole argument,
including checking whether it is there, converting it to an SHA-1, and
emitting errors on EOF or for invalid values. The return value
indicates whether the argument was present or absent, which requires
a bit of intelligence because absent values are represented
differently depending on whether "-z" was used.

The new interface means that the calling functions, parse_cmd_*(),
don't have to interpret the result differently based on the
line_termination mode that is in effect. It also means that
parse_cmd_create() can distinguish unambiguously between an empty new
value and a zeros new value, which fixes a failure in t1400.

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

t1400: test that stdin -z update treats empty <newvalue... Michael Haggerty Mon, 7 Apr 2014 13:48:04 +0000 (15:48 +0200)

t1400: test that stdin -z update treats empty <newvalue> as zeros

This is the (slightly inconsistent) status quo; make sure it doesn't
change by accident.

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

update-ref --stdin: simplify error messages for missing... Michael Haggerty Mon, 7 Apr 2014 13:48:03 +0000 (15:48 +0200)

update-ref --stdin: simplify error messages for missing oldvalues

Instead of, for example,

fatal: update refs/heads/master missing [<oldvalue>] NUL

emit

fatal: update refs/heads/master missing <oldvalue>

Update the tests accordingly.

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

update-ref --stdin: make error messages more consistentMichael Haggerty Mon, 7 Apr 2014 13:48:02 +0000 (15:48 +0200)

update-ref --stdin: make error messages more consistent

The old error messages emitted for invalid input sometimes said
"<oldvalue>"/"<newvalue>" and sometimes said "old value"/"new value".
Convert them all to the former. Update the tests accordingly.

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

update-ref --stdin: improve error messages for invalid... Michael Haggerty Mon, 7 Apr 2014 13:48:01 +0000 (15:48 +0200)

update-ref --stdin: improve error messages for invalid values

If an invalid value is passed to "update-ref --stdin" as <oldvalue> or
<newvalue>, include the command and the name of the reference at the
beginning of the error message. Update the tests accordingly.

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

update-ref.c: extract a new function, parse_refname()Michael Haggerty Mon, 7 Apr 2014 13:48:00 +0000 (15:48 +0200)

update-ref.c: extract a new function, parse_refname()

There is no reason to obscure the fact that parse_first_arg() always
parses refnames. Form the new function by combining parse_first_arg()
and update_store_ref_name().

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

parse_cmd_verify(): copy old_sha1 instead of evaluating... Michael Haggerty Mon, 7 Apr 2014 13:47:59 +0000 (15:47 +0200)

parse_cmd_verify(): copy old_sha1 instead of evaluating <oldvalue> twice

Aside from avoiding a tiny bit of work, this makes it transparently
obvious that old_sha1 and new_sha1 are identical. It is arguably a
bit silly to have to set new_sha1 in order to verify old_sha1, but
that is a problem for another day.

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

update-ref --stdin: read the whole input at onceMichael Haggerty Mon, 7 Apr 2014 13:47:58 +0000 (15:47 +0200)

update-ref --stdin: read the whole input at once

Read the whole input into a strbuf at once, and then parse it from
there. This might also be a tad faster, but that is not the point.
The point is to decouple the parsing code from the input source (the
old parsing code had to read new data even in the middle of commands).
Add docstrings for the parsing functions.

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

update_refs(): fix constnessMichael Haggerty Mon, 7 Apr 2014 13:47:57 +0000 (15:47 +0200)

update_refs(): fix constness

The old signature of update_refs() required a
(const struct ref_update **) for its updates_orig argument. The
"const" is presumably there to promise that the function will not
modify the contents of the structures.

But this declaration does not permit the function to be called with a
(struct ref_update **), which is perfectly legitimate. C's type
system is not powerful enough to express what we'd like. So remove
the first "const" from the declaration.

On the other hand, the function *can* promise not to modify the
pointers within the array that is passed to it without inconveniencing
its callers. So add a "const" that has that effect, making the final
declaration
(struct ref_update * const *).

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

refs.h: rename the action_on_err constantsMichael Haggerty Mon, 7 Apr 2014 13:47:56 +0000 (15:47 +0200)

refs.h: rename the action_on_err constants

Given that these constants are only being used when updating
references, it is inappropriate to give them such generic names as
"DIE_ON_ERR". So prefix their names with "UPDATE_REFS_".

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

t1400: add some more tests involving quoted argumentsMichael Haggerty Mon, 7 Apr 2014 13:47:55 +0000 (15:47 +0200)

t1400: add some more tests involving quoted arguments

Previously there were no good tests of C-quoted arguments.

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

parse_arg(): really test that argument is properly... Michael Haggerty Mon, 7 Apr 2014 13:47:54 +0000 (15:47 +0200)

parse_arg(): really test that argument is properly terminated

The old parse_arg(), when fed an argument

"refs/heads/a"master

parsed 'refs/heads/a' off of the front of the argument and considered
itself successful. It was only when parse_next_arg() tried to parse
the *next* argument that a problem was noticed. But in fact, the
definition of the input format requires arguments to be terminated by
SP or NUL, so *this* argument is already erroneous and parse_arg()
should diagnose the problem.

So teach parse_arg() to verify that C-quoted arguments are terminated
correctly. If not, emit a more specific error message.

There is no corresponding error case of a non-C-quoted argument that
is not terminated correctly, because the end of a non-quoted argument
is *by definition* a space or NUL, so there is no way to insert other
junk between the "end" of the argument and the argument terminator.

Adjust the tests to expect the new error message. Add a docstring to
the function, incorporating the comments that were formerly within the
function plus some added information.

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

t1400: provide more usual input to the commandMichael Haggerty Mon, 7 Apr 2014 13:47:53 +0000 (15:47 +0200)

t1400: provide more usual input to the command

The old version was passing (among other things)

update SP refs/heads/c NUL NUL 0{40} NUL

to "git update-ref -z --stdin" to test whether the old-value check for
c is working. But the <newvalue> is empty, which is a bit off the
beaten track.

So, to be sure that we are testing what we want to test, provide an
actual <newvalue> on the "update" line.

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

t1400: fix name and expected result of one testMichael Haggerty Mon, 7 Apr 2014 13:47:52 +0000 (15:47 +0200)

t1400: fix name and expected result of one test

The test

stdin -z create ref fails with zero new value

actually passes an empty new value, not a zero new value. So rename
the test s/zero/empty/, and change the expected error from

fatal: create $c given zero new value

to

fatal: create $c missing <newvalue>

Of course, this makes the test fail now, because although "git
update-ref" tries to distinguish between these two errors, it does not
succeed in this situation. Fixing it is more than a one-liner, so
mark the test test_expect_failure for now. The failure will be fixed
later in this patch series.

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

git-multimail: update to version 1.0.0Michael Haggerty Mon, 7 Apr 2014 15:20:40 +0000 (17:20 +0200)

git-multimail: update to version 1.0.0

This commit contains the squashed changes from the upstream
git-multimail repository since the last code drop. Highlights:

* Fix encoding of non-ASCII email addresses in email headers.

* Fix backwards-compatibility bugs for older Python 2.x versions.

* Fix a backwards-compatibility bug for Git 1.7.1.

* Add an option commitDiffOpts to customize logs for revisions.

* Pass "-oi" to sendmail by default to prevent premature
termination
on a line containing only ".".

* Stagger email "Date:" values in an attempt to help mail clients
thread the emails in the right order.

* If a mailing list setting is missing, just skip sending the
corresponding email (with a warning) instead of failing.

* Add a X-Git-Host header that can be used for email filtering.

* Allow the sender's fully-qualified domain name to be configured.

* Minor documentation improvements.

* Add a CHANGES file.

Contributions-by: Raphaël Hertzog <hertzog@debian.org>
Contributions-by: Eric Berberich <eric.berberich@gmail.com>
Contributions-by: Michiel Holtkamp <git@elfstone.nl>
Contributions-by: Malte Swart <mswart@devtation.de>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: do not reuse packfiles without --delta... Jeff King Wed, 2 Apr 2014 06:39:17 +0000 (02:39 -0400)

pack-objects: do not reuse packfiles without --delta-base-offset

When we are sending a packfile to a remote, we currently try
to reuse a whole chunk of packfile without bothering to look
at the individual objects. This can make things like initial
clones much lighter on the server, as we can just dump the
packfile bytes.

However, it's possible that the other side cannot read our
packfile verbatim. For example, we may have objects stored
as OFS_DELTA, but the client is an antique version of git
that only understands REF_DELTA. We negotiate this
capability over the fetch protocol. A normal pack-objects
run will convert OFS_DELTA into REF_DELTA on the fly, but
the "reuse pack" code path never even looks at the objects.

This patch disables packfile reuse if the other side is
missing any capabilities that we might have used in the
on-disk pack. Right now the only one is OFS_DELTA, but we
may need to expand in the future (e.g., if packv4 introduces
new object types).

We could be more thorough and only disable reuse in this
case when we actually have an OFS_DELTA to send, but:

1. We almost always will have one, since we prefer
OFS_DELTA to REF_DELTA when possible. So this case
would almost never come up.

2. Looking through the objects defeats the purpose of the
optimization, which is to do as little work as possible
to get the bytes to the remote.

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

add `ignore_missing_links` mode to revwalkVicent Marti Fri, 28 Mar 2014 10:00:43 +0000 (06:00 -0400)

add `ignore_missing_links` mode to revwalk

When pack-objects is computing the reachability bitmap to
serve a fetch request, it can erroneously die() if some of
the UNINTERESTING objects are not present. Upload-pack
throws away HAVE lines from the client for objects we do not
have, but we may have a tip object without all of its
ancestors (e.g., if the tip is no longer reachable and was
new enough to survive a `git prune`, but some of its
reachable objects did get pruned).

In the non-bitmap case, we do a revision walk with the HAVE
objects marked as UNINTERESTING. The revision walker
explicitly ignores errors in accessing UNINTERESTING commits
to handle this case (and we do not bother looking at
UNINTERESTING trees or blobs at all).

When we have bitmaps, however, the process is quite
different. The bitmap index for a pack-objects run is
calculated in two separate steps:

First, we perform an extensive walk from all the HAVEs to
find the full set of objects reachable from them. This walk
is usually optimized away because we are expected to hit an
object with a bitmap during the traversal, which allows us
to terminate early.

Secondly, we perform an extensive walk from all the WANTs,
which usually also terminates early because we hit a commit
with an existing bitmap.

Once we have the resulting bitmaps from the two walks, we
AND-NOT them together to obtain the resulting set of objects
we need to pack.

When we are walking the HAVE objects, the revision walker
does not know that we are walking it only to mark the
results as uninteresting. We strip out the UNINTERESTING flag,
because those objects _are_ interesting to us during the
first walk. We want to keep going to get a complete set of
reachable objects if we can.

We need some way to tell the revision walker that it's OK to
silently truncate the HAVE walk, just like it does for the
UNINTERESTING case. This patch introduces a new
`ignore_missing_links` flag to the `rev_info` struct, which
we set only for the HAVE walk.

It also adds tests to cover UNINTERESTING objects missing
from several positions: a missing blob, a missing tree, and
a missing parent commit. The missing blob already worked (as
we do not care about its contents at all), but the other two
cases caused us to die().

Note that there are a few cases we do not need to test:

1. We do not need to test a missing tree, with the blob
still present. Without the tree that refers to it, we
would not know that the blob is relevant to our walk.

2. We do not need to test a tip commit that is missing.
Upload-pack omits these for us (and in fact, we
complain even in the non-bitmap case if it fails to do
so).

Reported-by: Siddharth Agarwal <sid0@fb.com>
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

MSVC: allow using ExtUtils::MakeMakerMarat Radchenko Thu, 3 Apr 2014 07:34:03 +0000 (11:34 +0400)

MSVC: allow using ExtUtils::MakeMaker

Drop NO_PERL_MAKEMAKER from config.mak.uname for the MSVC platform.

MakeMaker is available on Windows Perl implementations and
installs modules to correct location, unlike NO_PERL_MAKEMAKER Makefile.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 2.0Junio C Hamano Thu, 3 Apr 2014 20:40:59 +0000 (13:40 -0700)

Update draft release notes to 2.0

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

Merge branch 'maint'Junio C Hamano Thu, 3 Apr 2014 20:40:31 +0000 (13:40 -0700)

Merge branch 'maint'

* maint:
Start preparing for 1.9.1

Start preparing for 1.9.1Junio C Hamano Thu, 3 Apr 2014 20:37:29 +0000 (13:37 -0700)

Start preparing for 1.9.1

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

Merge branch 'jk/mv-submodules-fix' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:06 +0000 (13:39 -0700)

Merge branch 'jk/mv-submodules-fix' into maint

* jk/mv-submodules-fix:
mv: prevent mismatched data when ignoring errors.
builtin/mv: fix out of bounds write

Conflicts:
t/t7001-mv.sh

Merge branch 'mh/remove-subtree-long-pathname-fix'... Junio C Hamano Thu, 3 Apr 2014 20:39:05 +0000 (13:39 -0700)

Merge branch 'mh/remove-subtree-long-pathname-fix' into maint

* mh/remove-subtree-long-pathname-fix:
entry.c: fix possible buffer overflow in remove_subtree()
checkout_entry(): use the strbuf throughout the function

Merge branch 'jk/lib-terminal-lazy' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:04 +0000 (13:39 -0700)

Merge branch 'jk/lib-terminal-lazy' into maint

* jk/lib-terminal-lazy:
t/lib-terminal: make TTY a lazy prerequisite

Merge branch 'nd/index-pack-error-message' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:04 +0000 (13:39 -0700)

Merge branch 'nd/index-pack-error-message' into maint

* nd/index-pack-error-message:
index-pack: report error using the correct variable

Merge branch 'us/printf-not-echo' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:04 +0000 (13:39 -0700)

Merge branch 'us/printf-not-echo' into maint

* us/printf-not-echo:
test-lib.sh: do not "echo" caller-supplied strings
rebase -i: do not "echo" random user-supplied strings

Merge branch 'rr/doc-merge-strategies' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:03 +0000 (13:39 -0700)

Merge branch 'rr/doc-merge-strategies' into maint

* rr/doc-merge-strategies:
Documentation/merge-strategies: avoid hyphenated commands

Merge branch 'jk/shallow-update-fix' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:03 +0000 (13:39 -0700)

Merge branch 'jk/shallow-update-fix' into maint

* jk/shallow-update-fix:
shallow: verify shallow file after taking lock
shallow: automatically clean up shallow tempfiles
shallow: use stat_validity to check for up-to-date file

Merge branch 'jc/stash-pop-not-popped' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:03 +0000 (13:39 -0700)

Merge branch 'jc/stash-pop-not-popped' into maint

* jc/stash-pop-not-popped:
stash pop: mention we did not drop the stash upon failing to apply

Merge branch 'jn/wt-status' into maintJunio C Hamano Thu, 3 Apr 2014 20:39:02 +0000 (13:39 -0700)

Merge branch 'jn/wt-status' into maint

* jn/wt-status:
wt-status: lift the artificual "at least 20 columns" floor
wt-status: i18n of section labels
wt-status: extract the code to compute width for labels
wt-status: make full label string to be subject to l10n

Merge branch 'nd/gc-aggressive'Junio C Hamano Thu, 3 Apr 2014 19:38:46 +0000 (12:38 -0700)

Merge branch 'nd/gc-aggressive'

Allow tweaking the maximum length of the delta-chain produced by
"gc --aggressive".

* nd/gc-aggressive:
environment.c: fix constness for odb_pack_keep()
gc --aggressive: make --depth configurable

Merge branch 'jc/fix-diff-no-index-diff-opt-parse'Junio C Hamano Thu, 3 Apr 2014 19:38:42 +0000 (12:38 -0700)

Merge branch 'jc/fix-diff-no-index-diff-opt-parse'

"diff --no-index -Mq a b" fell into an infinite loop.

* jc/fix-diff-no-index-diff-opt-parse:
diff-no-index: correctly diagnose error return from diff_opt_parse()

Merge branch 'cb/aix'Junio C Hamano Thu, 3 Apr 2014 19:38:38 +0000 (12:38 -0700)

Merge branch 'cb/aix'

* cb/aix:
tests: don't rely on strerror text when testing rmdir failure
dir.c: make git_fnmatch() not inline

Merge branch 'cn/fetch-prune-overlapping-destination'Junio C Hamano Thu, 3 Apr 2014 19:38:18 +0000 (12:38 -0700)

Merge branch 'cn/fetch-prune-overlapping-destination'

Protect refs in a hierarchy that can come from more than one remote
hierarcies from incorrect removal by "git fetch --prune".

* cn/fetch-prune-overlapping-destination:
fetch: handle overlaping refspecs on --prune
fetch: add a failing test for prunning with overlapping refspecs

Merge branch 'nd/log-show-linear-break'Junio C Hamano Thu, 3 Apr 2014 19:38:11 +0000 (12:38 -0700)

Merge branch 'nd/log-show-linear-break'

Attempts to show where a single-strand-of-pearls break in "git log"
output.

* nd/log-show-linear-break:
log: add --show-linear-break to help see non-linear history
object.h: centralize object flag allocation

Merge branch 'ep/shell-command-substitution'Junio C Hamano Thu, 3 Apr 2014 19:38:04 +0000 (12:38 -0700)

Merge branch 'ep/shell-command-substitution'

* ep/shell-command-substitution:
git-am.sh: use the $(...) construct for command substitution
check-builtins.sh: use the $(...) construct for command substitution

Merge branch 'ap/remote-hg-skip-null-bookmarks'Junio C Hamano Wed, 2 Apr 2014 21:18:23 +0000 (14:18 -0700)

Merge branch 'ap/remote-hg-skip-null-bookmarks'

* ap/remote-hg-skip-null-bookmarks:
remote-hg: do not fail on invalid bookmarks

Merge branch 'rs/pickaxe-i'Junio C Hamano Wed, 2 Apr 2014 21:18:19 +0000 (14:18 -0700)

Merge branch 'rs/pickaxe-i'

Allow the options -i/--regexp-ignore-case, --pickaxe-regex, and -S
to be used together and work as expected to perform a pickaxe
search using case-insensitive regular expression matching.

* rs/pickaxe-i:
pickaxe: simplify kwset loop in contains()
pickaxe: call strlen only when necessary in diffcore_pickaxe_count()
pickaxe: move pickaxe() after pickaxe_match()
pickaxe: merge diffcore_pickaxe_grep() and diffcore_pickaxe_count() into diffcore_pickaxe()
pickaxe: honor -i when used with -S and --pickaxe-regex
t4209: use helper functions to test --author
t4209: use helper functions to test --grep
t4209: factor out helper function test_log_icase()
t4209: factor out helper function test_log()
t4209: set up expectations up front

Revert part of 384364b (Start preparing for Git 2.0... Junio C Hamano Tue, 1 Apr 2014 18:55:56 +0000 (11:55 -0700)

Revert part of 384364b (Start preparing for Git 2.0, 2014-03-07)

As we are not shipping with the submodule change, remove the
entry for it.

Revert "submodule: explicit local branch creation in... Junio C Hamano Wed, 2 Apr 2014 21:15:36 +0000 (14:15 -0700)

Revert "submodule: explicit local branch creation in module_clone"

This reverts commit 23d25e48f5ead73c9ce233986f90791abec9f1e8, as it is
broken for users who haven't opted into the new feature of checking
out submodule.*.branch with update mode set to checkout.

update-ref: fail create operation over stdin if ref... Aman Gupta Wed, 2 Apr 2014 08:09:54 +0000 (10:09 +0200)

update-ref: fail create operation over stdin if ref already exists

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4212: loosen far-in-future test for AIXJeff King Tue, 1 Apr 2014 07:43:06 +0000 (03:43 -0400)

t4212: loosen far-in-future test for AIX

One of the tests in t4212 checks our behavior when we feed
gmtime a date so far in the future that it gives up and
returns NULL. Some implementations, like AIX, may actually
just provide us a bogus result instead.

It's not worth it for us to come up with heuristics that
guess whether the return value is sensible or not. On good
platforms where gmtime reports the problem to us with NULL,
we will print the epoch value. On bad platforms, we will
print garbage. But our test should be written for the
lowest common denominator so that it passes everywhere.

Reported-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

date: recognize bogus FreeBSD gmtime outputJeff King Tue, 1 Apr 2014 21:28:42 +0000 (17:28 -0400)

date: recognize bogus FreeBSD gmtime output

Most gmtime implementations return a NULL value when they
encounter an error (and this behavior is specified by ANSI C
and POSIX). FreeBSD's implementation, however, will simply
leave the "struct tm" untouched. Let's also recognize this
and convert it to a NULL (with this patch, t4212 should pass
on FreeBSD).

Reported-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-parse: fix typo in example on manpageRené Scharfe Tue, 1 Apr 2014 19:27:23 +0000 (21:27 +0200)

rev-parse: fix typo in example on manpage

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

Revert "Merge branch 'wt/doc-submodule-name-path-confus... Junio C Hamano Tue, 1 Apr 2014 18:52:37 +0000 (11:52 -0700)

Revert "Merge branch 'wt/doc-submodule-name-path-confusion-2'"

This reverts commit 00d4ff1a69883e24b095f45251d99143b5bc0320, reversing
changes made to d3badc6eb0961382788c2670129d5ee133d079fd.

Update draft release notes to 2.0Junio C Hamano Mon, 31 Mar 2014 23:41:23 +0000 (16:41 -0700)

Update draft release notes to 2.0

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

Merge branch 'mm/status-porcelain-format-i18n-fix'Junio C Hamano Mon, 31 Mar 2014 23:31:25 +0000 (16:31 -0700)

Merge branch 'mm/status-porcelain-format-i18n-fix'

* mm/status-porcelain-format-i18n-fix:
status: disable translation when --porcelain is used

Merge branch 'an/branch-config-message'Junio C Hamano Mon, 31 Mar 2014 23:31:19 +0000 (16:31 -0700)

Merge branch 'an/branch-config-message'

* an/branch-config-message:
branch.c: install_branch_config: simplify if chain

Merge branch 'jk/tests-cleanup'Junio C Hamano Mon, 31 Mar 2014 23:31:17 +0000 (16:31 -0700)

Merge branch 'jk/tests-cleanup'

* jk/tests-cleanup:
t0001: drop subshells just for "cd"
t0001: drop useless subshells
t0001: use test_must_fail
t0001: use test_config_global
t0001: use test_path_is_*
t0001: make symlink reinit test more careful
t: prefer "git config --file" to GIT_CONFIG
t: prefer "git config --file" to GIT_CONFIG with test_must_fail
t: stop using GIT_CONFIG to cross repo boundaries
t: drop useless sane_unset GIT_* calls
t/test-lib: drop redundant unset of GIT_CONFIG
t/Makefile: stop setting GIT_CONFIG

Merge branch 'wt/doc-submodule-name-path-confusion-2'Junio C Hamano Mon, 31 Mar 2014 23:31:16 +0000 (16:31 -0700)

Merge branch 'wt/doc-submodule-name-path-confusion-2'

* wt/doc-submodule-name-path-confusion-2:
doc: submodule.*.branch config is keyed by name

Merge branch 'wt/doc-submodule-name-path-confusion-1'Junio C Hamano Mon, 31 Mar 2014 23:31:13 +0000 (16:31 -0700)

Merge branch 'wt/doc-submodule-name-path-confusion-1'

* wt/doc-submodule-name-path-confusion-1:
doc: submodule.* config are keyed by submodule names

Merge branch 'mr/msvc-link-with-lcurl'Junio C Hamano Mon, 31 Mar 2014 23:31:07 +0000 (16:31 -0700)

Merge branch 'mr/msvc-link-with-lcurl'

* mr/msvc-link-with-lcurl:
MSVC: allow linking with the cURL library

Merge branch 'ib/rev-parse-parseopt-argh'Junio C Hamano Mon, 31 Mar 2014 23:30:59 +0000 (16:30 -0700)

Merge branch 'ib/rev-parse-parseopt-argh'

Teaches the "rev-parse --parseopt" mechanism used by scripted
Porcelains to parse command line options and give help text how to
supply argv-help (the placeholder string for an option parameter,
e.g. "key-id" in "--gpg-sign=<key-id>").

* ib/rev-parse-parseopt-argh:
t1502: protect runs of SPs used in the indentation
rev-parse --parseopt: option argument name hints

Merge branch 'dp/makefile-charset-lib-doc'Junio C Hamano Mon, 31 Mar 2014 23:30:57 +0000 (16:30 -0700)

Merge branch 'dp/makefile-charset-lib-doc'

* dp/makefile-charset-lib-doc:
Makefile: describe CHARSET_LIB better

Merge branch 'js/userdiff-cc'Junio C Hamano Mon, 31 Mar 2014 23:30:54 +0000 (16:30 -0700)

Merge branch 'js/userdiff-cc'

Improves the pattern to match the hunk-header for C/C++.

* js/userdiff-cc:
userdiff: have 'cpp' hunk header pattern catch more C++ anchor points
t4018: test cases showing that the cpp pattern misses many anchor points
t4018: test cases for the built-in cpp pattern
t4018: reduce test files for pattern compilation tests
t4018: convert custom pattern test to the new infrastructure
t4018: convert java pattern test to the new infrastructure
t4018: convert perl pattern tests to the new infrastructure
t4018: an infrastructure to test hunk headers
userdiff: support unsigned and long long suffixes of integer constants
userdiff: support C++ ->* and .* operators in the word regexp

Merge branch 'dw/doc-status-no-longer-shows-pound-prefix'Junio C Hamano Mon, 31 Mar 2014 23:30:52 +0000 (16:30 -0700)

Merge branch 'dw/doc-status-no-longer-shows-pound-prefix'

* dw/doc-status-no-longer-shows-pound-prefix:
doc: status, remove leftover statement about '#' prefix

Merge branch 'ca/doc-config-third-party'Junio C Hamano Mon, 31 Mar 2014 23:30:49 +0000 (16:30 -0700)

Merge branch 'ca/doc-config-third-party'

* ca/doc-config-third-party:
config.txt: third-party tools may and do use their own variables

Merge branch 'hs/simplify-bit-setting-in-fsck-tree'Junio C Hamano Mon, 31 Mar 2014 23:30:44 +0000 (16:30 -0700)

Merge branch 'hs/simplify-bit-setting-in-fsck-tree'

* hs/simplify-bit-setting-in-fsck-tree:
fsck: use bitwise-or assignment operator to set flag

Merge branch 'dt/tests-with-env-not-subshell'Junio C Hamano Mon, 31 Mar 2014 23:30:40 +0000 (16:30 -0700)

Merge branch 'dt/tests-with-env-not-subshell'

* dt/tests-with-env-not-subshell:
tests: use "env" to run commands with temporary env-var settings

code and test: fix misuses of "nor"Justin Lebar Mon, 31 Mar 2014 22:11:47 +0000 (15:11 -0700)

code and test: fix misuses of "nor"

Signed-off-by: Justin Lebar <jlebar@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

comments: fix misuses of "nor"Justin Lebar Mon, 31 Mar 2014 22:11:46 +0000 (15:11 -0700)

comments: fix misuses of "nor"

Signed-off-by: Justin Lebar <jlebar@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib: fix misuses of "nor"Justin Lebar Mon, 31 Mar 2014 22:11:45 +0000 (15:11 -0700)

contrib: fix misuses of "nor"

Signed-off-by: Justin Lebar <jlebar@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: fix misuses of "nor"Justin Lebar Mon, 31 Mar 2014 22:11:44 +0000 (15:11 -0700)

Documentation: fix misuses of "nor"

Signed-off-by: Justin Lebar <jlebar@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

parse-options: remove unused OPT_SET_PTRMarat Radchenko Sun, 30 Mar 2014 11:08:23 +0000 (15:08 +0400)

parse-options: remove unused OPT_SET_PTR

OPT_SET_PTR was never used since its creation at db7244bd
(parse-options new features., 2007-11-07).

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

parse-options: add cast to correct pointer type to... Junio C Hamano Sun, 30 Mar 2014 02:01:54 +0000 (19:01 -0700)

parse-options: add cast to correct pointer type to OPT_SET_PTR

Do not force users of OPT_SET_PTR to cast pointer to correct
underlying pointer type by integrating cast into OPT_SET_PTR macro.

Cast is required to prevent 'initialization makes integer from pointer
without a cast' compiler warning.

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

MSVC: fix t0040-parse-options crashMarat Radchenko Sun, 30 Mar 2014 11:08:21 +0000 (15:08 +0400)

MSVC: fix t0040-parse-options crash

On 64-bit MSVC, pointers are 64 bit but `long` is only 32.
Thus, casting string to `unsigned long`, which is redundand on other
platforms, throws away important bits and when later cast to `intptr_t`
results in corrupt pointer.

This patch fixes test-parse-options by replacing harming cast with
correct one.

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: don't rely on strerror text when testing rmdir... Charles Bailey Sat, 29 Mar 2014 15:39:01 +0000 (15:39 +0000)

tests: don't rely on strerror text when testing rmdir failure

AIX doesn't make a distiction between EEXIST and ENOTEMPTY; relying
on the strerror string for the rmdir failure is fragile. Just test
that the start of the string matches the Git controlled "failed to
rmdir..." error. The exact text of the OS generated error string
isn't important to the test.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir.c: make git_fnmatch() not inlineCharles Bailey Sat, 29 Mar 2014 15:39:00 +0000 (15:39 +0000)

dir.c: make git_fnmatch() not inline

Now that it calls a static inline function, it cannot be an inline
definition with external linkage. Remove inline and make it an
external definition.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff-no-index: correctly diagnose error return from... Junio C Hamano Mon, 31 Mar 2014 18:47:17 +0000 (11:47 -0700)

diff-no-index: correctly diagnose error return from diff_opt_parse()

diff_opt_parse() returns the number of options parsed, or often
returns error() which is defined to return -1. Yes, return value of
0 is "I did not process that option at all", which should cause the
caller to say that, but negative return should not be forgotten.

This bug caused "diff --no-index" to infinitely show the same error
message because the returned value was used to decrement the loop
control variable, e.g.

$ git diff --no-index --color=words a b
error: option `color' expects "always", "auto", or "never"
error: option `color' expects "always", "auto", or "never"
...

Instead, make it act like so:

$ git diff --no-index --color=words a b
error: option `color' expects "always", "auto", or "never"
fatal: invalid diff option/value: --color=words

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

environment.c: fix constness for odb_pack_keep()Nguyễn Thái Ngọc Duy Sun, 16 Mar 2014 13:35:00 +0000 (20:35 +0700)

environment.c: fix constness for odb_pack_keep()

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

gc --aggressive: make --depth configurableNguyễn Thái Ngọc Duy Sun, 16 Mar 2014 13:35:03 +0000 (20:35 +0700)

gc --aggressive: make --depth configurable

When 1c192f3 (gc --aggressive: make it really aggressive - 2007-12-06)
made --depth=250 the default value, it didn't really explain the
reason behind, especially the pros and cons of --depth=250.

An old mail from Linus below explains it at length. Long story short,
--depth=250 is a disk saver and a performance killer. Not everybody
agrees on that aggressiveness. Let the user configure it.

From: Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] gc --aggressive: make it really aggressive
Date: Thu, 6 Dec 2007 08:19:24 -0800 (PST)
Message-ID: <alpine.LFD.0.9999.0712060803430.13796@woody.linux-foundation.org>
Gmane-URL: http://article.gmane.org/gmane.comp.gcc.devel/94637

On Thu, 6 Dec 2007, Harvey Harrison wrote:
>
> 7:41:25elapsed 86%CPU

Heh. And this is why you want to do it exactly *once*, and then just
export the end result for others ;)

> -r--r--r-- 1 hharrison hharrison 324094684 2007-12-06 07:26 pack-1d46...pack

But yeah, especially if you allow longer delta chains, the end result can
be much smaller (and what makes the one-time repack more expensive is the
window size, not the delta chain - you could make the delta chains longer
with no cost overhead at packing time)

HOWEVER.

The longer delta chains do make it potentially much more expensive to then
use old history. So there's a trade-off. And quite frankly, a delta depth
of 250 is likely going to cause overflows in the delta cache (which is
only 256 entries in size *and* it's a hash, so it's going to start having
hash conflicts long before hitting the 250 depth limit).

So when I said "--depth=250 --window=250", I chose those numbers more as
an example of extremely aggressive packing, and I'm not at all sure that
the end result is necessarily wonderfully usable. It's going to save disk
space (and network bandwidth - the delta's will be re-used for the network
protocol too!), but there are definitely downsides too, and using long
delta chains may simply not be worth it in practice.

(And some of it might just want to have git tuning, ie if people think
that long deltas are worth it, we could easily just expand on the delta
hash, at the cost of some more memory used!)

That said, the good news is that working with *new* history will not be
affected negatively, and if you want to be _really_ sneaky, there are ways
to say "create a pack that contains the history up to a version one year
ago, and be very aggressive about those old versions that we still want to
have around, but do a separate pack for newer stuff using less aggressive
parameters"

So this is something that can be tweaked, although we don't really have
any really nice interfaces for stuff like that (ie the git delta cache
size is hardcoded in the sources and cannot be set in the config file, and
the "pack old history more aggressively" involves some manual scripting
and knowing how "git pack-objects" works rather than any nice simple
command line switch).

So the thing to take away from this is:
- git is certainly flexible as hell
- .. but to get the full power you may need to tweak things
- .. happily you really only need to have one person to do the tweaking,
and the tweaked end results will be available to others that do not
need to know/care.

And whether the difference between 320MB and 500MB is worth any really
involved tweaking (considering the potential downsides), I really don't
know. Only testing will tell.

Linus

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

Update draft release notes to 2.0Junio C Hamano Fri, 28 Mar 2014 20:56:29 +0000 (13:56 -0700)

Update draft release notes to 2.0

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

Merge branch 'ys/fsck-commit-parsing'Junio C Hamano Fri, 28 Mar 2014 20:51:24 +0000 (13:51 -0700)

Merge branch 'ys/fsck-commit-parsing'

* ys/fsck-commit-parsing:
fsck.c:fsck_commit(): use skip_prefix() to verify and skip constant
fsck.c:fsck_ident(): ident points at a const string