gitweb.git
Merge branch 'jk/graph-c-expose-symbols-for-cgit'Junio C Hamano Tue, 19 Mar 2013 19:20:56 +0000 (12:20 -0700)

Merge branch 'jk/graph-c-expose-symbols-for-cgit'

In the v1.8.0 era, we changed symbols that do not have to be global
to file scope static, but a few functions in graph.c were used by
CGit from sideways bypassing the entry points of the API the
in-tree users use.

* jk/graph-c-expose-symbols-for-cgit:
Revert "graph.c: mark private file-scope symbols as static"

Merge branch 'tk/doc-filter-branch'Junio C Hamano Tue, 19 Mar 2013 19:20:50 +0000 (12:20 -0700)

Merge branch 'tk/doc-filter-branch'

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

Merge branch 'wk/user-manual-literal-format'Junio C Hamano Tue, 19 Mar 2013 19:20:44 +0000 (12:20 -0700)

Merge branch 'wk/user-manual-literal-format'

* wk/user-manual-literal-format:
user-manual: Standardize backtick quoting

Merge branch 'rj/msvc-build'Junio C Hamano Tue, 19 Mar 2013 19:20:40 +0000 (12:20 -0700)

Merge branch 'rj/msvc-build'

* rj/msvc-build:
msvc: avoid collisions between "tags" and "TAGS"
msvc: test-svn-fe: Fix linker "unresolved external" error
msvc: Fix build by adding missing symbol defines
msvc: git-daemon: Fix linker "unresolved external" errors
msvc: Fix compilation errors caused by poll.h emulation

Merge branch 'dm/ni-maxhost-may-be-missing'Junio C Hamano Tue, 19 Mar 2013 19:18:21 +0000 (12:18 -0700)

Merge branch 'dm/ni-maxhost-may-be-missing'

On systems without NI_MAXHOST in their system header files,
connect.c (hence most of the transport) did not compile.

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

Merge branch 'gp/describe-match-uses-glob-pattern'Junio C Hamano Tue, 19 Mar 2013 19:16:31 +0000 (12:16 -0700)

Merge branch 'gp/describe-match-uses-glob-pattern'

The syntax of the pattern given to the "--match=<pattern>" argument
to "git describe" was not documented to be a glob.

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

Merge branch 'gp/avoid-explicit-mention-of-dot-git... Junio C Hamano Tue, 19 Mar 2013 19:16:22 +0000 (12:16 -0700)

Merge branch 'gp/avoid-explicit-mention-of-dot-git-refs'

* gp/avoid-explicit-mention-of-dot-git-refs:
Fix ".git/refs" stragglers

Merge branch 'da/downcase-u-in-usage'Junio C Hamano Tue, 19 Mar 2013 19:15:54 +0000 (12:15 -0700)

Merge branch 'da/downcase-u-in-usage'

* da/downcase-u-in-usage:
contrib/mw-to-git/t/install-wiki.sh: use a lowercase "usage:" string
contrib/examples/git-remote.perl: use a lowercase "usage:" string
tests: use a lowercase "usage:" string
git-svn: use a lowercase "usage:" string
Documentation/user-manual.txt: use a lowercase "usage:" string
templates/hooks--update.sample: use a lowercase "usage:" string
contrib/hooks/setgitperms.perl: use a lowercase "usage:" string
contrib/examples: use a lowercase "usage:" string
contrib/fast-import/import-zips.py: use spaces instead of tabs
contrib/fast-import/import-zips.py: fix broken error message
contrib/fast-import: use a lowercase "usage:" string
contrib/credential: use a lowercase "usage:" string
git-cvsimport: use a lowercase "usage:" string
git-cvsimport: use a lowercase "usage:" string
git-cvsexportcommit: use a lowercase "usage:" string
git-archimport: use a lowercase "usage:" string
git-merge-one-file: use a lowercase "usage:" string
git-relink: use a lowercase "usage:" string
git-svn: use a lowercase "usage:" string
git-sh-setup: use a lowercase "usage:" string

Merge branch 'nd/doc-index-format'Junio C Hamano Tue, 19 Mar 2013 19:15:14 +0000 (12:15 -0700)

Merge branch 'nd/doc-index-format'

Update the index format documentation to mention the v4 format.

* 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

Merge branch 'wk/doc-pre-rebase'Junio C Hamano Tue, 19 Mar 2013 19:14:05 +0000 (12:14 -0700)

Merge branch 'wk/doc-pre-rebase'

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

Merge branch 'jc/color-diff-doc'Junio C Hamano Tue, 19 Mar 2013 19:11:31 +0000 (12:11 -0700)

Merge branch 'jc/color-diff-doc'

The --color[=<when>] option to the diff family was documented in a
confusing way.

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

push test: rely on &&-chaining instead of 'if bad;... Jonathan Nieder Mon, 18 Mar 2013 23:14:26 +0000 (16:14 -0700)

push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'

When it is unclear which command from a test has failed, usual
practice these days is to debug by running the test again with "sh -x"
instead of relying on debugging 'echo' statements.

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

push test: simplify check of push resultJonathan Nieder Mon, 18 Mar 2013 23:13:41 +0000 (16:13 -0700)

push test: simplify check of push result

This test checks each ref with code like the following:

r=$(git show-ref -s --verify refs/$ref) &&
test "z$r" = "z$the_first_commit"

Afterward it counts refs:

test 1 = $(git for-each-ref refs/remotes/origin | wc -l)

Simpler to test the number and values of relevant refs in for-each-ref
output at the same time using test_cmp. This makes the test more
readable and provides more helpful "./t5516-push-push.sh -v" output
when the test fails.

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

push test: use test_config when appropriateJonathan Nieder Mon, 18 Mar 2013 23:12:11 +0000 (16:12 -0700)

push test: use test_config when appropriate

Configuration from test_config does not last beyond the end of the
current test assertion, making each test easier to think about in
isolation.

This changes the meaning of some of the tests. For example, currently
"push with insteadOf" passes even if the line setting
"url.$TRASH.pushInsteadOf" is dropped because an url.$TRASH.insteadOf
setting leaks in from a previous test.

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

t4018,7810,7811: remove test_config() redefinitionRamkumar Ramachandra Tue, 19 Mar 2013 10:43:14 +0000 (16:13 +0530)

t4018,7810,7811: remove test_config() redefinition

test_config() is already a well-defined function in
test-lib-functions.sh. Don't duplicate it unnecessarily.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: guard nr_resolved_deltas reads by lockThomas Rast Tue, 19 Mar 2013 14:16:41 +0000 (15:16 +0100)

index-pack: guard nr_resolved_deltas reads by lock

The threaded parts of index-pack increment the number of resolved
deltas in nr_resolved_deltas guarded by counter_mutex. However, the
per-thread outer loop accessed nr_resolved_deltas without any locks.

This is not wrong as such, since it doesn't matter all that much
whether we get an outdated value. However, unless someone proves that
this one lock makes all the performance difference, it would be much
cleaner to guard _all_ accesses to the variable with the lock.

The only such use is display_progress() in the threaded section (all
others are in the conclude_pack() callchain outside the threaded
part). To make it obvious that it cannot deadlock, move it out of
work_mutex.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: protect deepest_delta in multithread codeNguyễn Thái Ngọc Duy Tue, 19 Mar 2013 13:01:15 +0000 (20:01 +0700)

index-pack: protect deepest_delta in multithread code

deepest_delta is a global variable but is updated without protection
in resolve_delta(), a multithreaded function. Add a new mutex for it,
but only protect and update when it's actually used (i.e. show_stat is
non-zero).

Another variable that will not be updated is delta_depth in "struct
object_entry" as it's only useful when show_stat is 1. Putting it in
"if (show_stat)" makes it clearer.

The local variable "stat" is renamed to "show_stat" after moving to
global scope because the name "stat" conflicts with stat(2) syscall.

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

Start the post 1.8.2 cycleJunio C Hamano Mon, 18 Mar 2013 22:01:19 +0000 (15:01 -0700)

Start the post 1.8.2 cycle

Again, tentatively let's call this cycle 1.8.3.

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

pack-refs: add fully-peeled traitMichael 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>

Merge branch 'maint'Junio C Hamano Sun, 17 Mar 2013 22:39:43 +0000 (15:39 -0700)

Merge branch 'maint'

* maint:
t1507: Test that branchname@{upstream} is interpreted as branch

t1507: Test that branchname@{upstream} is interpreted... 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>

fast-export: do not load blob objects twiceJeff King Sun, 17 Mar 2013 08:38:57 +0000 (04:38 -0400)

fast-export: do not load blob objects twice

When fast-export wants to export a blob object, it first
calls parse_object to get a "struct object" and check
whether we have already shown the object. If we haven't
shown it, we then use read_sha1_file to pull it from disk
and write it out.

That means we load each blob from disk twice: once for
parse_object to find its type and check its sha1, and a
second time when we actually output it. We can drop this to
a single load by using lookup_object to check the SHOWN
flag, and then checking the signature on and outputting a
single buffer.

This provides modest speedups on git.git (best-of-five, "git
fast-export HEAD >/dev/null"):

[before] [after]
real 0m14.347s real 0m13.780s
user 0m14.084s user 0m13.620s
sys 0m0.208s sys 0m0.100s

and somewhat more on more blob-heavy repos (this is a
repository full of media files):

[before] [after]
real 0m52.236s real 0m44.451s
user 0m50.568s user 0m43.000s
sys 0m1.536s sys 0m1.284s

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

fast-export: rename handle_object functionJeff King Sun, 17 Mar 2013 08:33:12 +0000 (04:33 -0400)

fast-export: rename handle_object function

The handle_object function is rather vaguely named; it only
operates on blobs, and its purpose is to export the blob to
the output stream. Let's call it "export_blob" to make it
more clear what it does.

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

pack-refs: write peeled entry for non-tagsJeff 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>

use 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>

avoid segfaults on parse_object failureJeff 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>

Merge branch 'maint'Junio C Hamano Sun, 17 Mar 2013 07:11:11 +0000 (00:11 -0700)

Merge branch 'maint'

* maint:
rev-parse: clarify documentation of $name@{upstream} syntax
sha1_name: pass object name length to diagnose_invalid_sha1_path()
Makefile: keep LIB_H entries together and sorted

rev-parse: clarify documentation of $name@{upstream... 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>

sha1_name: pass object name length to diagnose_invalid_... 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>

pull: Apply -q and -v options to rebase mode as wellPeter Eisentraut Fri, 15 Mar 2013 02:26:08 +0000 (22:26 -0400)

pull: Apply -q and -v options to rebase mode as well

git pull passed -q and -v only to git merge, but they can be useful for
git rebase as well, so pass them there, too.

In particular, using -q shuts up the "Already up-to-date." message.
Especially, a new test script runs the same "pull --rebase" twice to
make sure both cases are quiet, when it has something to fetch and
when it is already up to date.

Signed-off-by: Peter Eisentraut <peter@eisentraut.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Preallocate hash tables when the number of inserts... Nguyễn Thái Ngọc Duy Sun, 17 Mar 2013 03:28:06 +0000 (10:28 +0700)

Preallocate hash tables when the number of inserts are known in advance

This avoids unnecessary re-allocations and reinsertions. On webkit.git
(i.e. about 182k inserts to the name hash table), this reduces about
100ms out of 3s user time.

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

Makefile: keep LIB_H entries together and sortedRené 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>

upload-pack: load non-tip "want" objects from diskJeff King Sat, 16 Mar 2013 10:28:30 +0000 (06:28 -0400)

upload-pack: load non-tip "want" objects from disk

It is a long-time security feature that upload-pack will not
serve any "want" lines that do not correspond to the tip of
one of our refs. Traditionally, this was enforced by
checking the objects in the in-memory hash; they should have
been loaded and received the OUR_REF flag during the
advertisement.

The stateless-rpc mode, however, has a race condition here:
one process advertises, and another receives the want lines,
so the refs may have changed in the interim. To address
this, commit 051e400 added a new verification mode; if the
object is not OUR_REF, we set a "has_non_tip" flag, and then
later verify that the requested objects are reachable from
our current tips.

However, we still die immediately when the object is not in
our in-memory hash, and at this point we should only have
loaded our tip objects. So the check_non_tip code path does
not ever actually trigger, as any non-tip objects would
have already caused us to die.

We can fix that by using parse_object instead of
lookup_object, which will load the object from disk if it
has not already been loaded.

We still need to check that parse_object does not return
NULL, though, as it is possible we do not have the object
at all. A more appropriate error message would be "no such
object" rather than "not our ref"; however, we do not want
to leak information about what objects are or are not in
the object database, so we continue to use the same "not
our ref" message that would be produced by an unreachable
object.

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

upload-pack: make sure "want" objects are parsedJeff King Sat, 16 Mar 2013 10:27:01 +0000 (06:27 -0400)

upload-pack: make sure "want" objects are parsed

When upload-pack receives a "want" line from the client, it
adds it to an object array. We call lookup_object to find
the actual object, which will only check for objects already
in memory. This works because we are expecting to find
objects that we already loaded during the ref advertisement.

We use the resulting object structs for a variety of
purposes. Some of them care only about the object flags, but
others care about the type of the object (e.g.,
ok_to_give_up), or even feed them to the revision parser
(when --depth is used), which assumes that objects it
receives are fully parsed.

Once upon a time, this was OK; any object we loaded into
memory would also have been parsed. But since 435c833
(upload-pack: use peel_ref for ref advertisements,
2012-10-04), we try to avoid parsing objects during the ref
advertisement. This means that lookup_object may return an
object with a type of OBJ_NONE. The resulting mess depends
on the exact set of objects, but can include the revision
parser barfing, or the shallow code sending the wrong set of
objects.

This patch teaches upload-pack to parse each "want" object
as we receive it. We do not replace the lookup_object call
with parse_object, as the current code is careful not to let
just any object appear on a "want" line, but rather only one
we have previously advertised (whereas parse_object would
actually load any arbitrary object from disk).

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

upload-pack: drop lookup-before-parse optimizationJeff King Sat, 16 Mar 2013 10:25:25 +0000 (06:25 -0400)

upload-pack: drop lookup-before-parse optimization

When we receive a "have" line from the client, we want to
load the object pointed to by the sha1. However, we are
careful to do:

o = lookup_object(sha1);
if (!o || !o->parsed)
o = parse_object(sha1);

to avoid loading the object from disk if we have already
seen it. However, since ccdc603 (parse_object: try internal
cache before reading object db), parse_object already does
this optimization internally. We can just call parse_object
directly.

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

branch: show more information when HEAD is detachedNguyễn Thái Ngọc Duy Wed, 13 Mar 2013 11:42:53 +0000 (18:42 +0700)

branch: show more information when HEAD is detached

This prints more helpful info when HEAD is detached: is it detached
because of bisect or rebase? What is the original branch name in those
cases? Is it detached because the user checks out a remote ref or a
tag (and which one)?

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

status: show more info than "currently not on any branch"Nguyễn Thái Ngọc Duy Wed, 13 Mar 2013 11:42:52 +0000 (18:42 +0700)

status: show more info than "currently not on any branch"

When a remote ref or a tag is checked out, HEAD is automatically
detached. There is no user-friendly way to find out what ref is
checked out in this case. This patch digs in reflog for this
information and shows "HEAD detached from origin/master" or "HEAD
detached at v1.8.0" instead of "currently not on any branch".

When it cannot figure out the original ref, it shows an abbreviated
SHA-1. "Currently not on any branch" would never display (unless
reflog is pruned to near empty that the last checkout entry is lost).

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

wt-status: move wt_status_get_state() out to wt_status_... Nguyễn Thái Ngọc Duy Wed, 13 Mar 2013 11:42:51 +0000 (18:42 +0700)

wt-status: move wt_status_get_state() out to wt_status_print()

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

wt-status: split wt_status_state parsing function outNguyễn Thái Ngọc Duy Wed, 13 Mar 2013 11:42:50 +0000 (18:42 +0700)

wt-status: split wt_status_state parsing function out

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

wt-status: move strbuf into read_and_strip_branch()Nguyễn Thái Ngọc Duy Sat, 16 Mar 2013 02:12:36 +0000 (09:12 +0700)

wt-status: move strbuf into read_and_strip_branch()

The strbufs are placed outside read_and_strip_branch as a premature
optimization: when it reads "refs/heads/foo" to strbuf and wants to
return just "foo", it could do so without memory movement. In return
the caller must not use the returned pointer after releasing strbufs,
which own the buffers that contain the returned strings. It's a clumsy
design.

By moving strbufs into read_and_strip_branch(), the returned pointer
always points to a malloc'd buffer or NULL. The pointer can be passed
around and freed after use.

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

index-pack: fix buffer overflow caused by translationsNguyễ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>

archive-zip: use deflateInit2() to ask for raw compress... René Scharfe Fri, 15 Mar 2013 22:21:51 +0000 (23:21 +0100)

archive-zip: use deflateInit2() to ask for raw compressed data

We use the function git_deflate_init() -- which wraps the zlib function
deflateInit() -- to initialize compression of ZIP file entries. This
results in compressed data prefixed with a two-bytes long header and
followed by a four-bytes trailer. ZIP file entries consist of ZIP
headers and raw compressed data instead, so we remove the zlib wrapper
before writing the result.

We can ask zlib for the the raw compressed data without the unwanted
parts in the first place by using deflateInit2() and specifying a
negative number of bits to size the window. For that purpose, factor
out the function do_git_deflate_init() and add git_deflate_init_raw(),
which wraps it. Then use the latter in archive-zip.c and get rid of
the code that stripped the zlib header and trailer.

Also rename the helper function zlib_deflate() to zlib_deflate_raw()
to reflect the change.

Thus we avoid generating data that we throw away anyway, the code
becomes shorter and some magic constants are removed.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

status: advise to consider use of -u when read_director... Nguyễn Thái Ngọc Duy Wed, 13 Mar 2013 12:59:16 +0000 (19:59 +0700)

status: advise to consider use of -u when read_directory takes too long

Introduce advice.statusUoption to suggest considering use of -u to
strike different trade-off when it took more than 2 seconds to
enumerate untracked/ignored files.

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

git status: document trade-offs in choosing parameters... Junio C Hamano Fri, 15 Mar 2013 16:53:48 +0000 (09:53 -0700)

git status: document trade-offs in choosing parameters to the -u option

In some repostories users experience that "git status" command takes
long time. The command spends some time searching the file system
for untracked files.

Explain the trade-off struck by the default choice of `normal` to
help users make an appropriate choice better, before talking about
the configuration variable.

Inspired by Torsten Bögershausen.

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

entry: fix filter lookupJohn 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>

t2003: modernize styleJohn 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>

Allow combined diff to ignore white-spacesAntoine Pelisse Thu, 14 Mar 2013 21:03:14 +0000 (22:03 +0100)

Allow combined diff to ignore white-spaces

The combined diff --cc output does not honor options to ignore
whitespace changes (-b, -w, and --ignore-space-at-eol).

Correct this by passing diff flags to diff engine, so that combined
diff behaves as normal diff does with spaces, and by coalescing
lines that are removed from both (or more) parents, honoring the
same rule to ignore whitespace changes.

With this change, a conflict-less merge done using a ignore-*
strategy option will not show any conflict if shown in combined-diff
using the same option.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool --dir-diff: symlink all files matching the... John Keeping Thu, 14 Mar 2013 20:19:41 +0000 (20:19 +0000)

difftool --dir-diff: symlink all files matching the working tree

Some users like to edit files in their diff tool when using "git
difftool --dir-diff --symlink" to compare against the working tree but
difftool currently only created symlinks when a file contains unstaged
changes.

Change this behaviour so that symlinks are created whenever the
right-hand side of the comparison has the same SHA1 as the file in the
working tree.

Note that textconv filters are handled in the same way as by git-diff
and if a clean filter is not the inverse of its smudge filter we already
get a null SHA1 from "diff --raw" and will symlink the file without
going through the new hash-object based check.

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

difftool: avoid double slashes in symlink targetsJohn Keeping Thu, 14 Mar 2013 20:19:40 +0000 (20:19 +0000)

difftool: avoid double slashes in symlink targets

When we add tests for symlinks in "git difftool --dir-diff" it's easier
to check the target path if we don't have to worry about double slashes
separating directories. Remove the trailing slash (if present) from
$workdir before creating the symlinks in order to avoid this.

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

git-difftool(1): fix formatting of --symlink descriptionJohn Keeping Thu, 14 Mar 2013 20:19:39 +0000 (20:19 +0000)

git-difftool(1): fix formatting of --symlink description

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

setup.c: check that the pathspec magic ends with ")"Andrew Wong Sat, 9 Mar 2013 23:46:00 +0000 (18:46 -0500)

setup.c: check that the pathspec magic ends with ")"

The previous code did not diagnose an incorrectly spelled ":(top"
as an error.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup.c: stop prefix_pathspec() from looping past the... Andrew Wong Thu, 7 Mar 2013 16:36:03 +0000 (11:36 -0500)

setup.c: stop prefix_pathspec() from looping past the end of string

The code assumes that the string ends at either `)` or `,`, and does
not handle the case where strcspn() returns length due to end of
string. So specifying ":(top" as pathspec will cause the loop to go
past the end of string.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t2200: check that "add -u" limits itself to subdirectoryJeff King Thu, 14 Mar 2013 06:44:04 +0000 (02:44 -0400)

t2200: check that "add -u" limits itself to subdirectory

This behavior is due to change in the future, but let's test
it anyway. That helps make sure we do not accidentally
switch the behavior too soon while we are working in the
area, and it means that we can easily verify the change when
we do make it.

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

Git 1.8.2 v1.8.2Junio C Hamano Wed, 13 Mar 2013 18:28:08 +0000 (11:28 -0700)

Git 1.8.2

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

mergetools/p4merge: create a base if none availableKevin Bracey Wed, 13 Mar 2013 01:12:21 +0000 (03:12 +0200)

mergetools/p4merge: create a base if none available

Originally, with no base, Git gave P4Merge $LOCAL as a dummy base:

p4merge "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"

Commit 0a0ec7bd changed this to:

p4merge "empty file" "$LOCAL" "$REMOTE" "$MERGED"

to avoid the problem of being unable to save in some circumstances with
similar inputs.

Unfortunately this approach produces much worse results on differing
inputs. P4Merge really regards the blank file as the base, and once you
have just a couple of differences between the two branches you end up
with one a massive full-file conflict. The 3-way diff is not readable,
and you have to invoke "difftool MERGE_HEAD HEAD" manually to get a
useful view.

The original approach appears to have invoked special 2-way merge
behaviour in P4Merge that occurs only if the base filename is "" or
equal to the left input. You get a good visual comparison, and it does
not auto-resolve differences. (Normally if one branch matched the base,
it would autoresolve to the other branch).

But there appears to be no way of getting this 2-way behaviour and being
able to reliably save. Having base==left appears to be triggering other
assumptions. There are tricks the user can use to force the save icon
on, but it's not intuitive.

So we now follow a suggestion given in the original patch's discussion:
generate a virtual base, consisting of the lines common to the two
branches. This is the same as the technique used in resolve and octopus
merges, so we relocate that code to a shared function.

Note that if there are no differences at the same location, this
technique can lead to automatic resolution without conflict, combining
everything from the 2 files. As with the other merges using this
technique, we assume the user will inspect the result before saving.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
Reviewed-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetools/p4merge: swap LOCAL and REMOTEKevin Bracey Wed, 13 Mar 2013 01:12:20 +0000 (03:12 +0200)

mergetools/p4merge: swap LOCAL and REMOTE

Reverse LOCAL and REMOTE when invoking P4Merge as a mergetool, so that
the incoming branch is now in the left-hand, blue triangle pane, and the
current branch is in the right-hand, green circle pane.

This change makes use of P4Merge consistent with its built-in help, its
reference documentation, and Perforce itself. But most importantly, it
makes merge results clearer. P4Merge is not totally symmetrical between
left and right; despite changing a few text labels from "theirs/ours" to
"left/right" when invoked manually, it still retains its original
Perforce "theirs/ours" viewpoint.

Most obviously, in the result pane P4Merge shows changes that are common
to both branches in green. This is on the basis of the current branch
being green, as it is when invoked from Perforce; it means that lines in
the result are blue if and only if they are being changed by the merge,
making the resulting diff clearer.

Note that P4Merge now shows "ours" on the right for both diff and merge,
unlike other diff/mergetools, which always have REMOTE on the right.
But observe that REMOTE is the working tree (ie "ours") for a diff,
while it's another branch (ie "theirs") for a merge.

Ours and theirs are reversed for a rebase - see "git help rebase".
However, this does produce the desired "show the results of this commit"
effect in P4Merge - changes that remain in the rebased commit (in your
branch, but not in the new base) appear in blue; changes that do not
appear in the rebased commit (from the new base, or common to both) are
in green. If Perforce had rebase, they'd probably not swap ours/theirs,
but make P4Merge show common changes in blue, picking out our changes in
green. We can't do that, so this is next best.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
Reviewed-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag: --force does not have to warn when creating tagsPhil Hord Tue, 12 Mar 2013 23:13:41 +0000 (19:13 -0400)

tag: --force does not have to warn when creating tags

"git tag --force" mentions what old tag object is being replaced
when it is used to update an existing tag, but it shows the same
message when creating a new one. Stop doing that, as it does not
add any information.

Add a test for this and also to ensure --force can replace tags at
all.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/reflog-reverse-walk' into nd/branch... Junio C Hamano Wed, 13 Mar 2013 16:29:23 +0000 (09:29 -0700)

Merge branch 'jc/reflog-reverse-walk' into nd/branch-show-rebase-bisect-state

* jc/reflog-reverse-walk:
reflog: add for_each_reflog_ent_reverse() API
for_each_recent_reflog_ent(): simplify opening of a reflog file
for_each_reflog_ent(): extract a helper to process a single entry

git p4: avoid expanding client paths in chdirMiklós Fazekas Mon, 11 Mar 2013 21:45:29 +0000 (17:45 -0400)

git p4: avoid expanding client paths in chdir

The generic chdir() helper sets the PWD environment
variable, as that is what is used by p4 to know its
current working directory. Normally the shell would
do this, but in git-p4, we must do it by hand.

However, when the path contains a symbolic link,
os.getcwd() will return the physical location. If the
p4 client specification includes symlinks, setting PWD
to the physical location causes p4 to think it is not
inside the client workspace. It complains, e.g.

Path /vol/bar/projects/foo/... is not under client root /p/foo

One workaround is to use AltRoots in the p4 client specification,
but it is cleaner to handle it directly in git-p4.

Other uses of chdir still require setting PWD to an
absolute path so p4 features like P4CONFIG work. See
bf1d68f (git-p4: use absolute directory for PWD env
var, 2011-12-09).

[ pw: tweak patch and commit message ]

Thanks-to: John Keeping <john@keeping.me.uk>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4 test: should honor symlink in p4 client rootPete Wyckoff Mon, 11 Mar 2013 21:45:28 +0000 (17:45 -0400)

git p4 test: should honor symlink in p4 client root

This test fails when the p4 client root includes
a symlink. It complains:

Path /vol/bar/projects/foo/... is not under client root /p/foo

and dumps a traceback.

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

Merge branch 'maint'Junio C Hamano Mon, 11 Mar 2013 20:00:16 +0000 (13:00 -0700)

Merge branch 'maint'

* maint:
git.c: make usage match manual page

git.c: make usage match manual pageKevin 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>

Merge branch 'mp/complete-paths'Junio C Hamano Mon, 11 Mar 2013 17:32:16 +0000 (10:32 -0700)

Merge branch 'mp/complete-paths'

* mp/complete-paths:
git-completion.bash: zsh does not implement function redirection correctly

Merge branch 'mm/add-u-A-finishing-touches'Junio C Hamano Mon, 11 Mar 2013 17:32:03 +0000 (10:32 -0700)

Merge branch 'mm/add-u-A-finishing-touches'

* mm/add-u-A-finishing-touches:
add: update pathless 'add [-u|-A]' warning to reflect change of plan

git-completion.bash: zsh does not implement function... Matthieu Moy Mon, 11 Mar 2013 12:21:27 +0000 (13:21 +0100)

git-completion.bash: zsh does not implement function redirection correctly

A recent change added functions whose entire standard error stream
is redirected to /dev/null using a construct that is valid POSIX.1
but is not widely used:

funcname () {
cd "$1" && run some command "$2"
} 2>/dev/null

Even though this file is "git-completion.bash", zsh completion
support dot-sources it (instead of asking bash to grok it like tcsh
completion does), and zsh does not implement this redirection
correctly.

With zsh, trying to complete an inexistant directory gave this:

git add no-such-dir/__git_ls_files_helper:cd:2: no such file or directory: no-such-dir/

Also these functions use "cd" to first go somewhere else before
running a command, but the location the caller wants them to go that
is given as an argument to them should not be affected by CDPATH
variable the users may have set for their interactive session.

To fix both of these, wrap the body of the function in a subshell,
unset CDPATH at the beginning of the subshell, and redirect the
standard error stream of the subshell to /dev/null.

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

Merge branch 'gp/add-u-A-documentation'Junio C Hamano Mon, 11 Mar 2013 15:11:37 +0000 (08:11 -0700)

Merge branch 'gp/add-u-A-documentation'

* gp/add-u-A-documentation:
add: Clarify documentation of -A and -u

add: update pathless 'add [-u|-A]' warning to reflect... Matthieu Moy Mon, 11 Mar 2013 08:01:32 +0000 (09:01 +0100)

add: update pathless 'add [-u|-A]' warning to reflect change of plan

We originally thought the transition would need a period where "git add
[-u|-A]" without pathspec would be forbidden, but the warning is big
enough to scare people and teach them not to use it (or, if so, to
understand the consequences).

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

Merge branch 'maint'Junio C Hamano Mon, 11 Mar 2013 05:29:29 +0000 (22:29 -0700)

Merge branch 'maint'

* maint:
Translate git_more_info_string consistently

archive: handle commits with an empty treeJeff King Mon, 11 Mar 2013 01:32:32 +0000 (21:32 -0400)

archive: handle commits with an empty tree

git-archive relies on get_pathspec to convert its argv into
a list of pathspecs. When get_pathspec is given an empty
argv list, it returns a single pathspec, the empty string,
to indicate that everything matches. When we feed this to
our path_exists function, we typically see that the pathspec
turns up at least one item in the tree, and we are happy.

But when our tree is empty, we erroneously think it is
because the pathspec is too limited, when in fact it is
simply that there is nothing to be found in the tree. This
is a weird corner case, but the correct behavior is almost
certainly to produce an empty archive, not to exit with an
error.

This patch teaches git-archive to create empty archives when
there is no pathspec given (we continue to complain if a
pathspec is given, since it obviously is not matched). It
also confirms that the tar and zip writers produce sane
output in this instance.

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

test-lib: factor out $GIT_UNZIP setupJeff King Mon, 11 Mar 2013 01:31:47 +0000 (21:31 -0400)

test-lib: factor out $GIT_UNZIP setup

We set up the $GIT_UNZIP variable and lazy prereq in
multiple places (and the next patch is about to add another
one). Let's factor it out to avoid repeating ourselves.

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

Translate git_more_info_string consistentlyKevin 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>

shell: new no-interactive-login command to print a... Jonathan Nieder Sat, 9 Mar 2013 22:00:11 +0000 (14:00 -0800)

shell: new no-interactive-login command to print a custom message

If I disable git-shell's interactive mode by removing the
~/git-shell-commands directory, attempts to ssh in to the service
produce a message intended for the administrator:

$ ssh git@myserver
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
$

That is helpful for the new admin who is wondering "What? Why isn't
the git-shell I just set up working?", but once the site setup is
complete, it would be better to give the user a friendly hint that she
is on the right track, like GitHub does.

Hi <username>! You've successfully authenticated, but
GitHub does not provide shell access.

An appropriate greeting might even include more complex dynamic
information, like gitolite's list of repositories the user has access
to. Add support for a ~/git-shell-commands/no-interactive-login
command that generates an arbitrary greeting. When the user tries to
log in:

* If the file ~/git-shell-commands/no-interactive-login exists,
run no-interactive-login to let the server say what it likes,
then hang up.

* Otherwise, if ~/git-shell-commands/ is present, start an
interactive read-eval-print loop.

* Otherwise, print the usual configuration hint and hang up.

Reported-by: Ethan Reesor <firelizzard@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

shell doc: emphasize purpose and security modelJonathan Nieder Sat, 9 Mar 2013 21:55:37 +0000 (13:55 -0800)

shell doc: emphasize purpose and security model

The original git-shell(1) manpage emphasized that the shell supports
only git transport commands. As the shell gained features, that
emphasis and focus in the manual has been lost. Bring it back by
splitting the manpage into a few short sections and fleshing out each:

- SYNOPSIS, describing how the shell gets used in practice
- DESCRIPTION, which gives an overview of the purpose and guarantees
provided by this restricted shell
- COMMANDS, listing supported commands and restrictions on the
arguments they accept
- INTERACTIVE USE, describing the interactive mode

Also add a "see also" section with related reading.

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

Merge branch 'maint'Junio C Hamano Sat, 9 Mar 2013 19:54:05 +0000 (11:54 -0800)

Merge branch 'maint'

* maint:
perf: update documentation of GIT_PERF_REPEAT_COUNT

perf: update documentation of GIT_PERF_REPEAT_COUNTAntoine 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>

format-patch: RFC 2047 says multi-octet character may... Kirill Smelkov Thu, 7 Mar 2013 10:55:07 +0000 (14:55 +0400)

format-patch: RFC 2047 says multi-octet character may not be split

Even though an earlier attempt (bafc478..41dd00bad) cleaned
up RFC 2047 encoding, pretty.c::add_rfc2047() still decides
where to split the output line by going through the input
one byte at a time, and potentially splits a character in
the middle. A subject line may end up showing like this:

".... fö?? bar". (instead of ".... föö bar".)

if split incorrectly.

RFC 2047, section 5 (3) explicitly forbids such beaviour

Each 'encoded-word' MUST represent an integral number of
characters. A multi-octet character may not be split across
adjacent 'encoded- word's.

that means that e.g. for

Subject: .... föö bar

encoding

Subject: =?UTF-8?q?....=20f=C3=B6=C3=B6?=
=?UTF-8?q?=20bar?=

is correct, and

Subject: =?UTF-8?q?....=20f=C3=B6=C3?= <-- NOTE ö is broken here
=?UTF-8?q?=B6=20bar?=

is not, because "ö" character UTF-8 encoding C3 B6 is split here across
adjacent encoded words.

To fix the problem, make the loop grab one _character_ at a time and
determine its output length to see where to break the output line. Note
that this version only knows about UTF-8, but the logic to grab one
character is abstracted out in mbs_chrlen() function to make it possible
to extend it to other encodings with the help of iconv in the future.

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

Merge git://git.bogomips.org/git-svnJunio C Hamano Fri, 8 Mar 2013 22:15:55 +0000 (14:15 -0800)

Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
git svn: consistent spacing after "W:" in warnings
git svn: ignore partial svn:mergeinfo

Update draft release notes to 1.8.2Junio C Hamano Fri, 8 Mar 2013 22:14:27 +0000 (14:14 -0800)

Update draft release notes to 1.8.2

Split the backward-compatibility notes into two sections, the ones
that affect this release, and the other to describe changes meant
for Git 2.0. The latter gives a context to understand why the
changes for this release is necessary.

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

setup: suppress implicit "." work-tree for bare reposJeff King Fri, 8 Mar 2013 09:32:22 +0000 (04:32 -0500)

setup: suppress implicit "." work-tree for bare repos

If an explicit GIT_DIR is given without a working tree, we
implicitly assume that the current working directory should
be used as the working tree. E.g.,:

GIT_DIR=/some/repo.git git status

would compare against the cwd.

Unfortunately, we fool this rule for sub-invocations of git
by setting GIT_DIR internally ourselves. For example:

git init foo
cd foo/.git
git status ;# fails, as we expect
git config alias.st status
git status ;# does not fail, but should

What happens is that we run setup_git_directory when doing
alias lookup (since we need to see the config), set GIT_DIR
as a result, and then leave GIT_WORK_TREE blank (because we
do not have one). Then when we actually run the status
command, we do setup_git_directory again, which sees our
explicit GIT_DIR and uses the cwd as an implicit worktree.

It's tempting to argue that we should be suppressing that
second invocation of setup_git_directory, as it could use
the values we already found in memory. However, the problem
still exists for sub-processes (e.g., if "git status" were
an external command).

You can see another example with the "--bare" option, which
sets GIT_DIR explicitly. For example:

git init foo
cd foo/.git
git status ;# fails
git --bare status ;# does NOT fail

We need some way of telling sub-processes "even though
GIT_DIR is set, do not use cwd as an implicit working tree".
We could do it by putting a special token into
GIT_WORK_TREE, but the obvious choice (an empty string) has
some portability problems.

Instead, we add a new boolean variable, GIT_IMPLICIT_WORK_TREE,
which suppresses the use of cwd as a working tree when
GIT_DIR is set. We trigger the new variable when we know we
are in a bare setting.

The variable is left intentionally undocumented, as this is
an internal detail (for now, anyway). If somebody comes up
with a good alternate use for it, and once we are confident
we have shaken any bugs out of it, we can consider promoting
it further.

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

environment: add GIT_PREFIX to local_repo_envJeff King Fri, 8 Mar 2013 09:30:25 +0000 (04:30 -0500)

environment: add GIT_PREFIX to local_repo_env

The GIT_PREFIX variable is set based on our location within
the working tree. It should therefore be cleared whenever
GIT_WORK_TREE is cleared.

In practice, this doesn't cause any bugs, because none of
the sub-programs we invoke with local_repo_env cleared
actually care about GIT_PREFIX. But this is the right thing
to do, and future proofs us against that assumption changing.

While we're at it, let's define a GIT_PREFIX_ENVIRONMENT
macro; this avoids repetition of the string literal, which
can help catch any spelling mistakes in the code.

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

reflog: add for_each_reflog_ent_reverse() APIJunio C Hamano Fri, 8 Mar 2013 21:27:37 +0000 (13:27 -0800)

reflog: add for_each_reflog_ent_reverse() API

"git checkout -" is a short-hand for "git checkout @{-1}" and the
"@{nth}" notation for a negative number is to find nth previous
checkout in the reflog of the HEAD to determine the name of the
branch the user was on. We would want to find the nth most recent
reflog entry that matches "checkout: moving from X to Y" for this.

Unfortunately, reflog is implemented as an append-only file, and the
API to iterate over its entries, for_each_reflog_ent(), reads the
file in order, giving the entries from the oldest to newer. For the
purpose of finding nth most recent one, this API forces us to record
the last n entries in a rotating buffer and give the result out only
after we read everything. To optimize for a common case of finding
the nth most recent one for a small value of n, we also have a side
API for_each_recent_reflog_ent() that starts reading near the end of
the file, but it still has to read the entries in the "wrong" order.
The implementation of understanding @{-1} uses this interface.

This all becomes unnecessary if we add an API to let us iterate over
reflog entries in the reverse order, from the newest to older.

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

for_each_recent_reflog_ent(): simplify opening of a... Junio C Hamano Fri, 8 Mar 2013 18:45:25 +0000 (10:45 -0800)

for_each_recent_reflog_ent(): simplify opening of a reflog file

There is no reason to use a temporary variable logfile.

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

for_each_reflog_ent(): extract a helper to process... Junio C Hamano Fri, 8 Mar 2013 18:36:43 +0000 (10:36 -0800)

for_each_reflog_ent(): extract a helper to process a single entry

Split the logic that takes a single line of reflog entry in a
strbuf, parses the message, and calls the callback function out of
the loop into a separate helper function.

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

bundle: 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>

Documentation/git-push: clarify the description of... Junio C Hamano Fri, 8 Mar 2013 17:44:33 +0000 (09:44 -0800)

Documentation/git-push: clarify the description of defaults

We describe what gets pushed by default when the command line does
not give any <refspec> under the bullet point of <refspec>.

It is a bit unfriendly to expect users to read on <refspec> when
they are not giving any in the first place. "What gets pushed" is
determined by taking many factors (<refspec> argument being only one
of them) into account, and is a property of the entire command, not
an individual argument. Also we do not describe "Where the push
goes" when the command line does not say.

Give the description on "what gets pushed to where" upfront before
explaining individual arguments and options.

Also update the description of <refspec> to say what it is, what it
is used for, before explaining what shape it takes.

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

cache.h: drop LOCAL_REPO_ENV_SIZEJeff King Fri, 8 Mar 2013 09:29:08 +0000 (04:29 -0500)

cache.h: drop LOCAL_REPO_ENV_SIZE

We keep a static array of variables that should be cleared
when invoking a sub-process on another repo. We statically
size the array with the LOCAL_REPO_ENV_SIZE macro so that
any readers do not have to count it themselves.

As it turns out, no readers actually use the macro, and it
creates a maintenance headache, as modifications to the
array need to happen in two places (one to add the new
element, and another to bump the size).

Since it's NULL-terminated, we can just drop the size macro
entirely. While we're at it, we'll clean up some comments
around it, and add a new mention of it at the top of the
list of environment variable macros. Even though
local_repo_env is right below that list, it's easy to miss,
and additions to that list should consider local_repo_env.

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

git svn: consistent spacing after "W:" in warningsEric Wong Fri, 8 Mar 2013 09:46:41 +0000 (09:46 +0000)

git svn: consistent spacing after "W:" in warnings

All other instances of "W:"-prefixed warning messages have a space after
the "W:" to help with readability.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

git svn: ignore partial svn:mergeinfoJan Pešta Thu, 7 Mar 2013 11:28:14 +0000 (12:28 +0100)

git svn: ignore partial svn:mergeinfo

Currently this is cosmetic change - the merges are ignored, becuase the methods
(lookup_svn_merge, find_rev_before, find_rev_after) are failing on comparing text with number.

See http://www.open.collab.net/community/subversion/articles/merge-info.html
Extract:
The range r30430:30435 that was added to 1.5.x in this merge has a '*' suffix for 1.5.x\www.
This '*' is the marker for a non-inheritable mergeinfo range.
The '*' means that only the path on which the mergeinfo is explicitly set has had this range merged into it.

Signed-off-by: Jan Pesta <jan.pesta@certicon.cz>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git p4 test: make sure P4CONFIG relative path worksPete Wyckoff Thu, 7 Mar 2013 23:19:15 +0000 (18:19 -0500)

git p4 test: make sure P4CONFIG relative path works

This adds a test for the fix in bf1d68f (git-p4: use absolute
directory for PWD env var, 2011-12-09). It is necessary to
set PWD to an absolute path so that p4 can find files referenced
by non-absolute paths, like the value of the P4CONFIG environment
variable.

P4 does not open files directly; it builds a path by prepending
the contents of the PWD environment variable.

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

bundle: Fix "verify" output if history is completeLukas 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>

Git 1.8.2-rc3 v1.8.2-rc3Junio C Hamano Thu, 7 Mar 2013 21:14:39 +0000 (13:14 -0800)

Git 1.8.2-rc3

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

Merge git://github.com/git-l10n/git-poJunio C Hamano Thu, 7 Mar 2013 21:12:34 +0000 (13:12 -0800)

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

* 'master' of git://github.com/git-l10n/git-po:
l10n: zh_CN.po: translate 1 new message
l10n: de.po: translate 1 new message
l10n: vi.po: Update translation (2009t0f0u)
l10n: Update Swedish translation (2009t0f0u)
l10n: git.pot: v1.8.2 round 4 (1 changed)

Merge branch 'mp/complete-paths'Junio C Hamano Thu, 7 Mar 2013 21:11:55 +0000 (13:11 -0800)

Merge branch 'mp/complete-paths'

* mp/complete-paths:
git-completion.zsh: define __gitcomp_file compatibility function

Merge branch 'maint'Junio C Hamano Thu, 7 Mar 2013 20:50:36 +0000 (12:50 -0800)

Merge branch 'maint'

* maint:
gitweb/README: remove reference to git.kernel.org

Merge branch 'mh/maint-ceil-absolute' into maintJunio 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

gitweb/README: remove reference to git.kernel.orgFredrik 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>

add: Clarify documentation of -A and -uGreg Price Thu, 7 Mar 2013 10:13:15 +0000 (05:13 -0500)

add: Clarify documentation of -A and -u

The documentation of '-A' and '-u' is very confusing for someone who
doesn't already know what they do. Describe them with fewer words and
clearer parallelism to each other and to the behavior of plain 'add'.

Also mention the default <pathspec> for '-A' as well as '-u', because
it applies to both.

Signed-off-by: Greg Price <price@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: zh_CN.po: translate 1 new messageJiang Xin Tue, 5 Mar 2013 05:09:55 +0000 (13:09 +0800)

l10n: zh_CN.po: translate 1 new message

Translate 1 new message came from git.pot update in ed1ddaf
(l10n: git.pot: v1.8.2 round 4 (1 changed)).

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

tests: make sure rename pretty print worksAntoine 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>

l10n: de.po: translate 1 new messageRalf Thielow Tue, 5 Mar 2013 05:32:41 +0000 (06:32 +0100)

l10n: de.po: translate 1 new message

Translate 1 new message came from git.pot update in
ed1ddaf (l10n: git.pot: v1.8.2 round 4 (1 changed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>