gitweb.git
fsck: report integer overflow in author timestampsJeff King Mon, 24 Feb 2014 07:39:04 +0000 (02:39 -0500)

fsck: report integer overflow in author timestamps

When we check commit objects, we complain if commit->date is
ULONG_MAX, which is an indication that we saw integer
overflow when parsing it. However, we do not do any check at
all for author lines, which also contain a timestamp.

Let's actually check the timestamps on each ident line
with strtoul. This catches both author and committer lines,
and we can get rid of the now-redundant commit->date check.

Note that like the existing check, we compare only against
ULONG_MAX. Now that we are calling strtoul at the site of
the check, we could be slightly more careful and also check
that errno is set to ERANGE. However, this will make further
refactoring in future patches a little harder, and it
doesn't really matter in practice.

For 32-bit systems, one would have to create a commit at the
exact wrong second in 2038. But by the time we get close to
that, all systems will hopefully have moved to 64-bit (and
if they haven't, they have a real problem one second later).

For 64-bit systems, by the time we get close to ULONG_MAX,
all systems will hopefully have been consumed in the fiery
wrath of our expanding Sun.

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

t4212: test bogus timestamps with git-logJeff King Mon, 24 Feb 2014 07:36:22 +0000 (02:36 -0500)

t4212: test bogus timestamps with git-log

When t4212 was originally added by 9dbe7c3d (pretty: handle
broken commit headers gracefully, 2013-04-17), it tested our
handling of commits with broken ident lines in which the
timestamps could not be parsed. It does so using a bogus line
like "Name <email>-<> 1234 -0000", because that simulates an
error that was seen in the wild.

Later, 03818a4 (split_ident: parse timestamp from end of
line, 2013-10-14) made our parser smart enough to actually
find the timestamp on such a line, and t4212 was adjusted to
match. While it's nice that we handle this real-world case,
this meant that we were not actually testing the
bogus-timestamp case anymore.

This patch adds a test with a totally incomprehensible
timestamp to make sure we are testing the code path.

Note that the behavior is slightly different between regular log
output and "--format=%ad". In the former case, we produce a
sentinel value and in the latter, we produce an empty
string. While at first this seems unnecessarily
inconsistent, it matches the original behavior given by
9dbe7c3d.

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

introduce GIT_INDEX_VERSION environment variableThomas Gummerer Sun, 23 Feb 2014 20:49:57 +0000 (21:49 +0100)

introduce GIT_INDEX_VERSION environment variable

Respect a GIT_INDEX_VERSION environment variable, when a new index is
initialized. Setting the environment variable will not cause existing
index files to be converted to another format, but will only affect
newly written index files. This can be used to initialize repositories
with index-v4.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash doc: mention short form -k in save descriptionJohn Marshall Fri, 21 Feb 2014 17:25:24 +0000 (17:25 +0000)

stash doc: mention short form -k in save description

Document --keep-index's short form -k in both main synopsis and
the save synopsis in the Options section.

Signed-off-by: John Marshall <jm18@sanger.ac.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file_name(): declare to return a const stringMichael Haggerty Fri, 21 Feb 2014 16:32:05 +0000 (17:32 +0100)

sha1_file_name(): declare to return a const string

Change the return value of sha1_file_name() to (const char *).
(Callers have no business mucking about here.) Change callers
accordingly, deleting a few superfluous temporary variables along the
way.

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

find_pack_entry(): document last_found_packMichael Haggerty Fri, 21 Feb 2014 16:32:04 +0000 (17:32 +0100)

find_pack_entry(): document last_found_pack

Add a comment at the declaration of last_found_pack and where it is
used in find_pack_entry(). In the latter, separate the cases (1) to
make a place for the new comment and (2) to turn the success case into
affirmative logic.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace_object: use struct members instead of an arrayMichael Haggerty Fri, 21 Feb 2014 16:32:03 +0000 (17:32 +0100)

replace_object: use struct members instead of an array

Give the poor humans some names to help them make sense of things.

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

i18n: mark all progress lines for translationNguyễn Thái Ngọc Duy Fri, 21 Feb 2014 12:50:18 +0000 (19:50 +0700)

i18n: mark all progress lines for translation

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

actually remove compat fnmatch source codeNguyễn Thái Ngọc Duy Sat, 15 Feb 2014 02:01:49 +0000 (09:01 +0700)

actually remove compat fnmatch source code

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

stop using fnmatch (either native or compat)Nguyễn Thái Ngọc Duy Sat, 15 Feb 2014 02:01:48 +0000 (09:01 +0700)

stop using fnmatch (either native or compat)

Since v1.8.4 (about six months ago) wildmatch is used as default
replacement for fnmatch. We have seen only one fix since so wildmatch
probably has done a good job as fnmatch replacement. This concludes
the fnmatch->wildmatch transition by no longer relying on fnmatch.

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

Revert "test-wildmatch: add "perf" command to compare... Nguyễn Thái Ngọc Duy Sat, 15 Feb 2014 02:01:47 +0000 (09:01 +0700)

Revert "test-wildmatch: add "perf" command to compare wildmatch and fnmatch"

This reverts commit 1b25892636d2f250eb2163301440ee8c8c1ac944. compat
fnmatch will be removed soon and we can't rely on fnmatch() available
everywhere.

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

use wildmatch() directly without fnmatch() wrapperNguyễn Thái Ngọc Duy Sat, 15 Feb 2014 02:01:46 +0000 (09:01 +0700)

use wildmatch() directly without fnmatch() wrapper

Make it clear that we don't use fnmatch() anymore.

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

Documentation: fix documentation AsciiDoc links for... Roberto Tyley Tue, 18 Feb 2014 21:42:22 +0000 (21:42 +0000)

Documentation: fix documentation AsciiDoc links for external urls

Turns out that putting 'link:' before the 'http' is actually superfluous
in AsciiDoc, as there's already a predefined macro to handle it.

"http, https, [etc] URLs are rendered using predefined inline macros."
http://www.methods.co.nz/asciidoc/userguide.html#_urls

"Hypertext links to files on the local file system are specified
using the link inline macro."
http://www.methods.co.nz/asciidoc/userguide.html#_linking_to_local_documents

Despite being superfluous, the reference implementation of AsciiDoc
tolerates the extra 'link:' and silently removes it, giving a functioning
link in the generated HTML. However, AsciiDoctor (the Ruby implementation
of AsciiDoc used to render the http://git-scm.com/ site) does /not/ have
this behaviour, and so generates broken links, as can be seen here:

http://git-scm.com/docs/git-cvsimport (links to cvs2git & parsecvs)
http://git-scm.com/docs/git-filter-branch (link to The BFG)

It's worth noting that after this change, the html generated by 'make html'
in the git project is identical, and all links still work.

Signed-off-by: Roberto Tyley <roberto.tyley@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: disallow reusing non-blob as a note objectJohan Herland Wed, 12 Feb 2014 09:54:16 +0000 (10:54 +0100)

notes: disallow reusing non-blob as a note object

Currently "git notes add -C $object" will read the raw bytes from $object,
and then copy those bytes into the note object, which is hardcoded to be
of type blob. This means that if the given $object is a non-blob (e.g.
tree or commit), the raw bytes from that object is copied into a blob
object. This is probably not useful, and certainly not what any sane
user would expect. So disallow it, by erroring out if the $object passed
to the -C option is not a blob.

The fix also applies to the -c option (in which the user is prompted to
edit/verify the note contents in a text editor), and also when -c/-C is
passed to "git notes append" (which appends the $object contents to an
existing note object). In both cases, passing a non-blob $object does not
make sense.

Also add a couple of tests demonstrating expected behavior.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Avoid overflowing page body frame with large... Andrew Keller Mon, 17 Feb 2014 14:25:13 +0000 (09:25 -0500)

gitweb: Avoid overflowing page body frame with large images

When displaying a blob in gitweb, if it's an image, specify constraints for
maximum display width and height to prevent the image from overflowing the
frame of the enclosing page_body div.

This change assumes that it is more desirable to see the whole image without
scrolling (new behavior) than it is to see every pixel without zooming
(previous behavior).

Signed-off-by: Andrew Keller <andrew@kellerfarm.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: teach "git config --file -" to read from the... Kirill A. Shutemov Tue, 18 Feb 2014 22:58:55 +0000 (00:58 +0200)

config: teach "git config --file -" to read from the standard input

The patch extends git config --file interface to allow read config from
stdin.

Editing stdin or setting value in stdin is an error.

Include by absolute path is allowed in stdin config, but not by relative
path.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: change git_config_with_options() interfaceKirill A. Shutemov Tue, 18 Feb 2014 22:58:54 +0000 (00:58 +0200)

config: change git_config_with_options() interface

We're going to have more options for config source.

Let's alter git_config_with_options() interface to accept struct with
all source options.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/config.c: rename check_blob_write() -> check_wr... Kirill A. Shutemov Tue, 18 Feb 2014 22:58:53 +0000 (00:58 +0200)

builtin/config.c: rename check_blob_write() -> check_write()

The function will be reused to check for other conditions which prevent
write.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: disallow relative include paths from blobsJeff King Tue, 18 Feb 2014 22:58:52 +0000 (00:58 +0200)

config: disallow relative include paths from blobs

When we see a relative config include like:

[include]
path = foo

we make it relative to the containing directory of the file
that contains the snippet. This makes no sense for config
read from a blob, as it is not on the filesystem. Something
like "HEAD:some/path" could have a relative path within the
tree, but:

1. It would not be part of include.path, which explicitly
refers to the filesystem.

2. It would need different parsing rules anyway to
determine that it is a tree path.

The current code just uses the "name" field, which is wrong.
Let's split that into "name" and "path" fields, use the
latter for relative includes, and fill in only the former
for blobs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

open_istream(): do not dereference NULL in the error... Junio C Hamano Wed, 19 Feb 2014 00:00:53 +0000 (16:00 -0800)

open_istream(): do not dereference NULL in the error case

When stream-filter cannot be attached, it is expected to return NULL,
and we should close the stream we opened and signal an error by
returning NULL ourselves from this function.

However, we attempted to dereference that NULL pointer between the
point we detected the error and returned from the function.

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

builtin/mv: don't use memory after freeJohn Keeping Sun, 16 Feb 2014 16:06:05 +0000 (16:06 +0000)

builtin/mv: don't use memory after free

If 'src' already ends with a slash, then add_slash() will just return
it, meaning that 'free(src_with_slash)' is actually 'free(src)'. Since
we use 'src' later, this will result in use-after-free.

In fact, this cannot happen because 'src' comes from
internal_copy_pathspec() without the KEEP_TRAILING_SLASH flag, so any
trailing '/' will have been stripped; but static analysis tools are not
clever enough to realise this and so warn that 'src' could be used after
having been free'd. Fix this by checking that 'src_w_slash' is indeed
newly allocated memory.

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

utf8: use correct type for values in interval tableJohn Keeping Sun, 16 Feb 2014 16:06:04 +0000 (16:06 +0000)

utf8: use correct type for values in interval table

We treat these as unsigned everywhere and compare against unsigned
values, so declare them using the typedef we already have for this.

While we're here, fix the indentation as well.

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

utf8: fix iconv error detectionJohn Keeping Sun, 16 Feb 2014 16:06:03 +0000 (16:06 +0000)

utf8: fix iconv error detection

iconv(3) returns "(size_t) -1" on error. Make sure that we cast the
"-1" properly when checking for this.

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

notes-utils: handle boolean notes.rewritemode correctlyJohn Keeping Sun, 16 Feb 2014 16:06:02 +0000 (16:06 +0000)

notes-utils: handle boolean notes.rewritemode correctly

If we carry on after outputting config_error_nonbool then we're
guaranteed to dereference a null pointer.

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

http: never use curl_easy_performJeff King Tue, 18 Feb 2014 10:34:20 +0000 (05:34 -0500)

http: never use curl_easy_perform

We currently don't reuse http connections when fetching via
the smart-http protocol. This is bad because the TCP
handshake introduces latency, and especially because SSL
connection setup may be non-trivial.

We can fix it by consistently using curl's "multi"
interface. The reason is rather complicated:

Our http code has two ways of being used: queuing many
"slots" to be fetched in parallel, or fetching a single
request in a blocking manner. The parallel code is built on
curl's "multi" interface. Most of the single-request code
uses http_request, which is built on top of the parallel
code (we just feed it one slot, and wait until it finishes).

However, one could also accomplish the single-request scheme
by avoiding curl's multi interface entirely and just using
curl_easy_perform. This is simpler, and is used by post_rpc
in the smart-http protocol.

It does work to use the same curl handle in both contexts,
as long as it is not at the same time. However, internally
curl may not share all of the cached resources between both
contexts. In particular, a connection formed using the
"multi" code will go into a reuse pool connected to the
"multi" object. Further requests using the "easy" interface
will not be able to reuse that connection.

The smart http protocol does ref discovery via http_request,
which uses the "multi" interface, and then follows up with
the "easy" interface for its rpc calls. As a result, we make
two HTTP connections rather than reusing a single one.

We could teach the ref discovery to use the "easy"
interface. But it is only once we have done this discovery
that we know whether the protocol will be smart or dumb. If
it is dumb, then our further requests, which want to fetch
objects in parallel, will not be able to reuse the same
connection.

Instead, this patch switches post_rpc to build on the
parallel interface, which means that we use it consistently
everywhere. It's a little more complicated to use, but since
we have the infrastructure already, it doesn't add any code;
we can just factor out the relevant bits from http_request.

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

git-contacts: do not fail parsing of good diffsLars Gullik Bjønnes Sat, 15 Feb 2014 17:24:50 +0000 (18:24 +0100)

git-contacts: do not fail parsing of good diffs

If a line in a patch starts with "--- " it will be deemed
malformed unless it also contains the proper diff header
format. This situation can happen with a valid patch if
it has a line starting with "-- " and that line is removed.

This patch just removes the check in git-contacts.

Signed-off-by: Lars Gullik Bjønnes <larsbj@gullik.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: optionally setup worktree and refresh index... Nguyễn Thái Ngọc Duy Sun, 16 Feb 2014 02:28:03 +0000 (09:28 +0700)

reset: optionally setup worktree and refresh index on --mixed

Refreshing index requires work tree. So we have two options: always
set up work tree (and refuse to reset if failing to do so), or make
refreshing index optional.

As refreshing index is not the main task, it makes more sense to make
it optional. This allows us to still work in a bare repository to update
what is in the index.

Reported-by: Patrick Palka <patrick@parcs.ath.cx>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: do not reuse_worktree_file for submodulesThomas Rast Sun, 16 Feb 2014 16:52:34 +0000 (17:52 +0100)

diff: do not reuse_worktree_file for submodules

The GIT_EXTERNAL_DIFF calling code attempts to reuse existing worktree
files for the worktree side of diffs, for performance reasons.
However, that code also tries to do the same with submodules. This
results in calls to $GIT_EXTERNAL_DIFF where the old-file is a file of
the form "Submodule commit $sha1", but the new-file is a directory in
the worktree.

Fix it by never reusing a worktree "file" in the submodule case.

Reported-by: Grégory Pakosz <gregory.pakosz@gmail.com>
Signed-off-by: Thomas Rast <tr@thomasrast.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.9.0 v1.9.0Junio C Hamano Fri, 14 Feb 2014 19:35:04 +0000 (11:35 -0800)

Git 1.9.0

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

release notes: typo fixesMichael J Gruber Thu, 13 Feb 2014 10:35:08 +0000 (11:35 +0100)

release notes: typo fixes

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: turn on network daemon tests by defaultJeff King Mon, 10 Feb 2014 21:29:37 +0000 (16:29 -0500)

tests: turn on network daemon tests by default

We do not run the httpd nor git-daemon tests by default, as
they are rather heavyweight and require network access
(albeit over localhost). However, it would be nice if more
pepole ran them, for two reasons:

1. We would get more test coverage on more systems.

2. The point of the test suite is to find regressions. It
is very easy to change some of the underlying code and
break the httpd code without realizing you are even
affecting it. Running the httpd tests helps find these
problems sooner (ideally before the patches even hit
the list).

We still want to leave an "out", though, for people who really do
not want to run them. For that reason, the GIT_TEST_HTTPD and
GIT_TEST_GIT_DAEMON variables are now tri-state booleans
(true/false/auto), so you can say GIT_TEST_HTTPD=false to turn the
tests back off. To support those who want a stable single way to
disable these tests across versions of Git before and after this
change, an empty string explicitly set to these variables is also
taken as "false", so the behaviour changes only for those who:

a. did not express any preference by leaving these variables
unset. They did not test these features before, but now they
do; or

b. did express that they want to test these features by setting
GIT_TEST_FEATURE=false (or any equivalent other ways to tell
"false" to Git, e.g. "0"), which has been a valid but funny way
to say that they do want to test the feature only because we
used to interpret any non-empty string to mean "yes please
test". They no longer test that feature.

In addition, we are forgiving of common setup failures (e.g., you do
not have apache installed, or have an old version) when the
tri-state is "auto" (or unset), but report an error when it is
"true". This makes "auto" a sane default, as we should not cause
failures on setups where the tests cannot run. But it allows people
who use "true" to catch regressions in their system (e.g., they
uninstalled apache, but were expecting their automated test runs to
test git-httpd, and would want to be notified).

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

Sync with 1.8.5.5Junio C Hamano Thu, 13 Feb 2014 21:42:26 +0000 (13:42 -0800)

Sync with 1.8.5.5

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

Git 1.8.5.5 v1.8.5.5Junio C Hamano Thu, 13 Feb 2014 21:40:47 +0000 (13:40 -0800)

Git 1.8.5.5

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

Merge branch 'bm/merge-base-octopus-dedup' into maintJunio C Hamano Thu, 13 Feb 2014 21:38:59 +0000 (13:38 -0800)

Merge branch 'bm/merge-base-octopus-dedup' into maint

"git merge-base --octopus" used to leave cleaning up suboptimal
result to the caller, but now it does the clean-up itself.

* bm/merge-base-octopus-dedup:
merge-base --octopus: reduce the result from get_octopus_merge_bases()
merge-base: separate "--independent" codepath into its own helper

Merge branch 'jc/revision-range-unpeel' into maintJunio C Hamano Thu, 13 Feb 2014 21:38:47 +0000 (13:38 -0800)

Merge branch 'jc/revision-range-unpeel' into maint

"git log --left-right A...B" lost the "leftness" of commits
reachable from A when A is a tag as a side effect of a recent
bugfix. This is a regression in 1.8.4.x series.

* jc/revision-range-unpeel:
revision: propagate flag bits from tags to pointees
revision: mark contents of an uninteresting tree uninteresting

Merge branch 'jk/allow-fetch-onelevel-refname' into... Junio C Hamano Thu, 13 Feb 2014 21:38:34 +0000 (13:38 -0800)

Merge branch 'jk/allow-fetch-onelevel-refname' into maint

"git clone" would fail to clone from a repository that has a ref
directly under "refs/", e.g. "refs/stash", because different
validation paths do different things on such a refname. Loosen the
client side's validation to allow such a ref.

* jk/allow-fetch-onelevel-refname:
fetch-pack: do not filter out one-level refs

Merge branch 'jk/interpret-branch-name-fix' into maintJunio C Hamano Thu, 13 Feb 2014 21:38:25 +0000 (13:38 -0800)

Merge branch 'jk/interpret-branch-name-fix' into maint

A handful of bugs around interpreting $branch@{upstream} notation
and its lookalike, when $branch part has interesting characters,
e.g. "@", and ":", have been fixed.

* jk/interpret-branch-name-fix:
interpret_branch_name: find all possible @-marks
interpret_branch_name: avoid @{upstream} past colon
interpret_branch_name: always respect "namelen" parameter
interpret_branch_name: rename "cp" variable to "at"
interpret_branch_name: factor out upstream handling

Merge branch 'rk/send-email-ssl-cert' into maintJunio C Hamano Thu, 13 Feb 2014 21:38:19 +0000 (13:38 -0800)

Merge branch 'rk/send-email-ssl-cert' into maint

A recent update to "git send-email" broke platforms where
/etc/ssl/certs/ directory exists but cannot be used as SSL_ca_path
(e.g. Fedora rawhide).

* rk/send-email-ssl-cert:
send-email: /etc/ssl/certs/ directory may not be usable as ca_path

Merge branch 'sb/repack-in-c' into maintJunio C Hamano Thu, 13 Feb 2014 21:38:09 +0000 (13:38 -0800)

Merge branch 'sb/repack-in-c' into maint

"git repack --max-pack-size=8g" stopped being parsed correctly when
the command was reimplemented in C.

* sb/repack-in-c:
repack: propagate pack-objects options as strings
repack: make parsed string options const-correct
repack: fix typo in max-pack-size option

Merge branch 'as/tree-walk-fix-aggressive-short-cut... Junio C Hamano Thu, 13 Feb 2014 21:37:53 +0000 (13:37 -0800)

Merge branch 'as/tree-walk-fix-aggressive-short-cut' into maint

The pathspec matching code, while comparing two trees (e.g. "git
diff A B -- path1 path2") was too aggressive and failed to match
some paths when multiple pathspecs were involved.

* as/tree-walk-fix-aggressive-short-cut:
tree_entry_interesting: match against all pathspecs

t5537: move http tests out to t5539Nguyễn Thái Ngọc Duy Thu, 13 Feb 2014 13:21:14 +0000 (20:21 +0700)

t5537: move http tests out to t5539

start_httpd is supposed to be at the beginning of the test file, not
the middle of it. The "test_seq" line in "no shallow lines.." test is
updated to compensate missing refs that are there in t5537, but not in
the new t5539.

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

Merge git://github.com/git-l10n/git-poJunio C Hamano Wed, 12 Feb 2014 20:28:47 +0000 (12:28 -0800)

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

* 'master' of git://github.com/git-l10n/git-po:
l10n: de.po: correct message when hiding commits by craft
l10n: de.po: translate 28 new messages

ewah: unconditionally ntohll ewah dataJeff King Wed, 12 Feb 2014 16:48:28 +0000 (11:48 -0500)

ewah: unconditionally ntohll ewah data

Commit a201c20 tried to optimize out a loop like:

for (i = 0; i < len; i++)
data[i] = ntohll(data[i]);

in the big-endian case, because we know that ntohll is a
noop, and we do not need to pay the cost of the loop at all.
However, it mistakenly assumed that __BYTE_ORDER was always
defined, whereas it may not be on systems which do not
define it by default, and where we did not need to define it
to set up the ntohll macro. This includes OS X and Windows.

We could muck with the ordering in compat/bswap.h to make
sure it is defined unconditionally, but it is simpler to
still to just execute the loop unconditionally. That avoids
the application code knowing anything about these magic
macros, and lets it depend only on having ntohll defined.

And since the resulting loop looks like (on a big-endian
system):

for (i = 0; i < len; i++)
data[i] = data[i];

any decent compiler can probably optimize it out.

Original report and analysis by Brian Gernhardt.

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

l10n: de.po: correct message when hiding commits by... Ralf Thielow Sat, 8 Feb 2014 21:01:36 +0000 (22:01 +0100)

l10n: de.po: correct message when hiding commits by craft

The recent translation was giving the idea that all commits
based on a graft were meant to be hidden. Make it clear that
it is the graft commit itself.

Reported-by: David Kastrup <dak@gnu.org>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>

l10n: de.po: translate 28 new messagesRalf Thielow Fri, 3 Jan 2014 17:38:12 +0000 (18:38 +0100)

l10n: de.po: translate 28 new messages

Translate 28 new messages came from git.pot update in
df49095 (l10n: git.pot: v1.9 round 1 (27 new, 11 removed)
and d57b24b (l10n: git.pot: v1.9 round 2 (1 new)).

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

pull: add the --gpg-sign option.brian m. carlson Mon, 10 Feb 2014 01:03:38 +0000 (01:03 +0000)

pull: add the --gpg-sign option.

git merge already allows us to sign commits, and git rebase has recently
learned how to do so as well. Teach git pull to parse the -S/--gpg-sign
option and pass this along to merge or rebase, as appropriate.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: add the --gpg-sign optionNicolas Vigier Mon, 10 Feb 2014 01:03:37 +0000 (01:03 +0000)

rebase: add the --gpg-sign option

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: parse options in stuck-long modeNicolas Vigier Mon, 10 Feb 2014 01:03:36 +0000 (01:03 +0000)

rebase: parse options in stuck-long mode

There is no functional change. The reason for this change is to be able
to add a new option taking an optional argument.

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: teach --recurse-submodules to fetch, pull... Sup Yut Sum Sun, 9 Feb 2014 14:35:31 +0000 (22:35 +0800)

completion: teach --recurse-submodules to fetch, pull and push

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs/git-blame: explain more clearly the example pickax... Albert L. Lash, IV Sat, 8 Feb 2014 20:41:37 +0000 (15:41 -0500)

docs/git-blame: explain more clearly the example pickaxe use

We state that the following paragraph mentions the pickaxe
interface, but the term pickaxe is not then used. This
change clarifies that the example command uses the pickaxe
interface and what it is searching for.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs/git-clone: clarify use of --no-hardlinks optionAlbert L. Lash, IV Sat, 8 Feb 2014 20:41:36 +0000 (15:41 -0500)

docs/git-clone: clarify use of --no-hardlinks option

Current text claims optimization, implying the use of
hardlinks, when this option ratchets down the level of
efficiency. This change explains the difference made by
using this option, namely copying instead of hardlinking,
and why it may be useful.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs/git-remote: capitalize first word of initial blurbAlbert L. Lash, IV Sat, 8 Feb 2014 20:41:35 +0000 (15:41 -0500)

docs/git-remote: capitalize first word of initial blurb

All other man files have capitalized descriptions which
immediately follow the command's name. Let's capitalize
this one too for consistency.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs/merge-strategies: remove hyphen from mis-mergesAlbert L. Lash, IV Sat, 8 Feb 2014 20:41:34 +0000 (15:41 -0500)

docs/merge-strategies: remove hyphen from mis-merges

The term mismerges without hyphen is used a few other
places in the documentation. Let's update this to
be consistent.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://github.com/git-l10n/git-poJunio C Hamano Tue, 11 Feb 2014 19:02:05 +0000 (11:02 -0800)

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

* 'master' of git://github.com/git-l10n/git-po:
l10n: zh_CN.po: Disambiguation for rebase
l10n: zh_CN.po: translate 1 new message (2211t0f0u)
l10n: vi.po (2211t): Updated one new string
l10n: Update Swedish translation (2211t0f0u)
l10n: fr: 1.9rc2 2211t
l10n: git.pot: v1.9 round 2 (1 new)

dir: ignore trailing spaces in exclude patternsNguyễn Thái Ngọc Duy Sun, 9 Feb 2014 00:26:38 +0000 (07:26 +0700)

dir: ignore trailing spaces in exclude patterns

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

dir: warn about trailing spaces in exclude patternsNguyễn Thái Ngọc Duy Sun, 9 Feb 2014 00:26:37 +0000 (07:26 +0700)

dir: warn about trailing spaces in exclude patterns

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

tests: auto-set git-daemon portJeff King Mon, 10 Feb 2014 19:16:38 +0000 (14:16 -0500)

tests: auto-set git-daemon port

A recent commit taught lib-httpd to always start apache on
the same port as the numbered tests. Let's do the same for
the git-daemon tests.

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

gc: config option for running --auto in backgroundNguyễn Thái Ngọc Duy Sat, 8 Feb 2014 07:08:52 +0000 (14:08 +0700)

gc: config option for running --auto in background

`gc --auto` takes time and can block the user temporarily (but not any
less annoyingly). Make it run in background on systems that support
it. The only thing lost with running in background is printouts. But
gc output is not really interesting. You can keep it in foreground by
changing gc.autodetach.

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

daemon: move daemonize() to libgit.aNguyễn Thái Ngọc Duy Sat, 8 Feb 2014 07:08:51 +0000 (14:08 +0700)

daemon: move daemonize() to libgit.a

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

fetch-pack: fix deepen shallow over smart http with... Nguyễn Thái Ngọc Duy Thu, 6 Feb 2014 15:10:39 +0000 (22:10 +0700)

fetch-pack: fix deepen shallow over smart http with no-done cap

In smart http, upload-pack adds new shallow lines at the beginning of
each rpc response. Only shallow lines from the first rpc call are
useful. After that they are thrown away. It's designed this way
because upload-pack is stateless and has no idea when its shallow
lines are helpful or not.

So after refs are negotiated with multi_ack_detailed and the server
thinks it learned enough, it sends "ACK obj-id ready", terminates the
rpc call and waits for the final rpc round. The client sends "done".
The server sends another response, which also has shallow lines at
the beginning, and the last "ACK obj-id" line.

When no-done is active, the last round is cut out, the server sends
"ACK obj-id ready" and "ACK obj-id" in the same rpc
response. fetch-pack is updated to recognize this and not send
"done". However it still tries to consume shallow lines, which are
never sent.

Update the code, make sure to skip consuming shallow lines when
no-done is enabled.

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

protocol-capabilities.txt: document no-doneNguyễn Thái Ngọc Duy Thu, 6 Feb 2014 15:10:38 +0000 (22:10 +0700)

protocol-capabilities.txt: document no-done

See 3e63b21 (upload-pack: Implement no-done capability - 2011-03-14)
and 761ecf0 (fetch-pack: Implement no-done capability - 2011-03-14)
for more information.

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

protocol-capabilities.txt: refer multi_ack_detailed... Nguyễn Thái Ngọc Duy Thu, 6 Feb 2014 15:10:37 +0000 (22:10 +0700)

protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txt

pack-protocol.txt explains in detail how multi_ack_detailed works and
what's the difference between no multi_ack, multi_ack and
multi_ack_detailed. No need to repeat here.

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

pack-protocol.txt: clarify 'obj-id' in the last ACK... Nguyễn Thái Ngọc Duy Thu, 6 Feb 2014 15:10:36 +0000 (22:10 +0700)

pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done'

It's introduced in 1bd8c8f (git-upload-pack: Support the multi_ack
protocol - 2005-10-28) but probably better documented in the commit
message of 78affc4 (Add multi_ack_detailed capability to
fetch-pack/upload-pack - 2009-10-30).

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

test: rename http fetch and push test filesNguyễn Thái Ngọc Duy Thu, 6 Feb 2014 15:10:34 +0000 (22:10 +0700)

test: rename http fetch and push test files

Make clear which one is for dumb protocol, which one is for smart from
their file name.

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

tests: auto-set LIB_HTTPD_PORT from test nameJeff King Mon, 10 Feb 2014 14:39:48 +0000 (09:39 -0500)

tests: auto-set LIB_HTTPD_PORT from test name

We set the default apache port for each of the httpd tests
to the 4-digit test number of the test script. We want these
to remain unique so that the tests do not conflict with each
other when run in parallel.

Instead of doing it manually in each test script, let's just
set it from the test name at run time. This is simpler, and
is one less thing to be updated when test scripts are
renamed (e.g., when being re-rolled or when conflicting
after being merged with another topic).

Incidentally, this fixes a case where t5537 and t5538 used
the same port number (5537), and could conflict with each
other when run in parallel.

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

Git 1.9.0-rc3 v1.9.0-rc3Junio C Hamano Fri, 7 Feb 2014 19:56:07 +0000 (11:56 -0800)

Git 1.9.0-rc3

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

Merge branch 'ow/manpages-typofix'Junio C Hamano Fri, 7 Feb 2014 19:55:11 +0000 (11:55 -0800)

Merge branch 'ow/manpages-typofix'

Various typofixes, all looked correct.

* ow/manpages-typofix:
Documentation: fix typos in man pages

Merge branch 'aj/ada-diff-word-pattern'Junio C Hamano Fri, 7 Feb 2014 19:55:10 +0000 (11:55 -0800)

Merge branch 'aj/ada-diff-word-pattern'

* aj/ada-diff-word-pattern:
userdiff: update Ada patterns

Merge branch 'nd/tag-doc'Junio C Hamano Fri, 7 Feb 2014 19:55:06 +0000 (11:55 -0800)

Merge branch 'nd/tag-doc'

* nd/tag-doc:
git-tag.txt: <commit> for --contains is optional

check-attr: move to the top of working tree when in... Junio C Hamano Thu, 6 Feb 2014 18:19:33 +0000 (10:19 -0800)

check-attr: move to the top of working tree when in non-bare repository

Lasse Makholm noticed that running "git check-attr" from a place
totally unrelated to $GIT_DIR and $GIT_WORK_TREE does not give
expected results. I think it is because the command does not say it
wants to call setup_work_tree().

We still need to support use cases where only a bare repository is
involved, so unconditionally requiring a working tree would not work
well. Instead, make a call only in a non-bare repository.

We may want to see if we want to do a similar fix in the opposite
direction to check-ignore. The command unconditionally requires a
working tree, but it should be usable in a bare repository just like
check-attr attempts to be.

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

t0003: do not chdir the whole test processJunio C Hamano Thu, 6 Feb 2014 18:16:27 +0000 (10:16 -0800)

t0003: do not chdir the whole test process

Moving to some other directory and letting the remainder of the test
pieces to expect that they start there is a bad practice. The test
that contains chdir itself may fail (or by mistake skipped via the
GIT_SKIP_TESTS mechanism) in which case the remainder may operate on
files in unexpected places.

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

l10n: zh_CN.po: Disambiguation for rebaseJiang Xin Sun, 2 Feb 2014 12:46:58 +0000 (20:46 +0800)

l10n: zh_CN.po: Disambiguation for rebase

Disambiguate the Chinese translation for "rebase", and update other
related entries.

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

reset: support "--mixed --intent-to-add" modeNguyễn Thái Ngọc Duy Tue, 4 Feb 2014 02:20:09 +0000 (09:20 +0700)

reset: support "--mixed --intent-to-add" mode

When --mixed is used, entries could be removed from index if the
target ref does not have them. When "reset" is used in preparation for
commit spliting (in a dirty worktree), it could be hard to track what
files to be added back. The new option --intent-to-add simplifies it
by marking all removed files intent-to-add.

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

Documentation: fix typos in man pagesØystein Walle Wed, 5 Feb 2014 22:19:43 +0000 (23:19 +0100)

Documentation: fix typos in man pages

Signed-off-by: Øystein Walle <oystwa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with 1.8.5.4Junio C Hamano Wed, 5 Feb 2014 22:14:40 +0000 (14:14 -0800)

Sync with 1.8.5.4

howto/maintain-git.txt: new version numbering schemeJunio C Hamano Fri, 31 Jan 2014 23:14:05 +0000 (15:14 -0800)

howto/maintain-git.txt: new version numbering scheme

We wanted to call the upcoming release "Git 1.9", with its
maintenance track being "Git 1.9.1", "Git 1.9.2", etc., but various
third-party tools are reported to assume that there are at least
three dewey-decimal components in our version number.

Adjust the plan so that vX.Y.0 are feature releases while vX.Y.Z
(Z > 0) are maintenance releases.

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

Git 1.8.5.4 v1.8.5.4Junio C Hamano Wed, 5 Feb 2014 22:05:31 +0000 (14:05 -0800)

Git 1.8.5.4

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

Merge branch 'jc/maint-pull-docfix' into maintJunio C Hamano Wed, 5 Feb 2014 22:03:47 +0000 (14:03 -0800)

Merge branch 'jc/maint-pull-docfix' into maint

The documentation to "git pull" hinted there is an "-m" option
because it incorrectly shared the documentation with "git merge".

* jc/maint-pull-docfix:
Documentation: "git pull" does not have the "-m" option
Documentation: exclude irrelevant options from "git pull"

Merge branch 'ow/stash-with-ifs' into maintJunio C Hamano Wed, 5 Feb 2014 22:03:20 +0000 (14:03 -0800)

Merge branch 'ow/stash-with-ifs' into maint

The implementation of 'git stash $cmd "stash@{...}"' did not quote
the stash argument properly and left it split at IFS whitespace.

* ow/stash-with-ifs:
stash: handle specifying stashes with $IFS

Merge branch 'js/lift-parent-count-limit' into maintJunio C Hamano Wed, 5 Feb 2014 22:03:01 +0000 (14:03 -0800)

Merge branch 'js/lift-parent-count-limit' into maint

There is no reason to have a hardcoded upper limit of the number of
parents for an octopus merge, created via the graft mechanism, but
there was.

* js/lift-parent-count-limit:
Remove the line length limit for graft files

Merge branch 'nd/add-empty-fix' into maintJunio C Hamano Wed, 5 Feb 2014 22:02:44 +0000 (14:02 -0800)

Merge branch 'nd/add-empty-fix' into maint

"git add -A" (no other arguments) in a totally empty working tree
used to emit an error.

* nd/add-empty-fix:
add: don't complain when adding empty project root

Merge branch 'bc/log-decoration' into maintJunio C Hamano Wed, 5 Feb 2014 22:02:05 +0000 (14:02 -0800)

Merge branch 'bc/log-decoration' into maint

"git log --decorate" did not handle a tag pointed by another tag
nicely.

* bc/log-decoration:
log: properly handle decorations with chained tags

Merge branch 'jh/rlimit-nofile-fallback' into maintJunio C Hamano Wed, 5 Feb 2014 22:01:23 +0000 (14:01 -0800)

Merge branch 'jh/rlimit-nofile-fallback' into maint

When we figure out how many file descriptors to allocate for
keeping packfiles open, a system with non-working getrlimit() could
cause us to die(), but because we make this call only to get a
rough estimate of how many is available and we do not even attempt
to use up all file descriptors available ourselves, it is nicer to
fall back to a reasonable low value rather than dying.

* jh/rlimit-nofile-fallback:
get_max_fd_limit(): fall back to OPEN_MAX upon getrlimit/sysconf failure

Merge branch 'jl/commit-v-strip-marker' into maintJunio C Hamano Wed, 5 Feb 2014 22:01:09 +0000 (14:01 -0800)

Merge branch 'jl/commit-v-strip-marker' into maint

"git commit -v" appends the patch to the log message before
editing, and then removes the patch when the editor returned
control. However, the patch was not stripped correctly when the
first modified path was a submodule.

* jl/commit-v-strip-marker:
commit -v: strip diffs and submodule shortlogs from the commit message

Merge branch 'tr/send-email-ssl' into maintJunio C Hamano Wed, 5 Feb 2014 22:00:18 +0000 (14:00 -0800)

Merge branch 'tr/send-email-ssl' into maint

SSL-related options were not passed correctly to underlying socket
layer in "git send-email".

* tr/send-email-ssl:
send-email: set SSL options through IO::Socket::SSL::set_client_defaults
send-email: --smtp-ssl-cert-path takes an argument
send-email: pass Debug to Net::SMTP::SSL::new

Merge branch 'tb/clone-ssh-with-colon-for-port' into... Junio C Hamano Wed, 5 Feb 2014 21:59:16 +0000 (13:59 -0800)

Merge branch 'tb/clone-ssh-with-colon-for-port' into maint

Remote repository URL expressed in scp-style host:path notation are
parsed more carefully (e.g. "foo/bar:baz" is local, "[::1]:/~user" asks
to connect to user's home directory on host at address ::1.

* tb/clone-ssh-with-colon-for-port:
git_connect(): use common return point
connect.c: refactor url parsing
git_connect(): refactor the port handling for ssh
git fetch: support host:/~repo
t5500: add test cases for diag-url
git fetch-pack: add --diag-url
git_connect: factor out discovery of the protocol and its parts
git_connect: remove artificial limit of a remote command
t5601: add tests for ssh
t5601: remove clear_ssh, refactor setup_ssh_wrapper

Merge branch 'nd/transport-positive-depth-only' into... Junio C Hamano Wed, 5 Feb 2014 21:58:51 +0000 (13:58 -0800)

Merge branch 'nd/transport-positive-depth-only' into maint

"git fetch --depth=0" was a no-op, and was silently ignored.
Diagnose it as an error.

* nd/transport-positive-depth-only:
clone,fetch: catch non positive --depth option value

Merge branch 'tb/repack-fix-renames' (early part)Junio C Hamano Wed, 5 Feb 2014 20:02:29 +0000 (12:02 -0800)

Merge branch 'tb/repack-fix-renames' (early part)

Finishing touches to the "rewrite repack in C" series.

* 'tb/repack-fix-renames' (early part):
repack.c: rename and unlink pack file if it exists

repack.c: rename and unlink pack file if it existsTorsten Bögershausen Sun, 2 Feb 2014 15:09:56 +0000 (16:09 +0100)

repack.c: rename and unlink pack file if it exists

When a repo was fully repacked, and is repacked again, we may run
into the situation that "new" packfiles have the same name as
already existing ones (traditionally packfiles have been named after
the list of names of objects in them, so repacking all the objects
in a single pack would have produced a packfile with the same name).

The logic is to rename the existing ones into filename like
"old-XXX", create the new ones and then remove the "old-" ones.
When something went wrong in the middle, this sequence is rolled
back by renaming the "old-" files back.

The renaming into "old-" did not work as intended, because
file_exists() was done on "XXX", not "pack-XXX". Also when rolling
back the change, the code tried to rename "old-pack-XXX" but the
saved ones are named "old-XXX", so this couldn't have worked.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revision: convert to using diff_tree_sha1()Kirill Smelkov Wed, 5 Feb 2014 16:57:12 +0000 (20:57 +0400)

revision: convert to using diff_tree_sha1()

Since diff_tree_sha1() can now accept empty trees via NULL sha1, we
could just call it without manually reading trees into tree_desc and
duplicating code.

Besides, that

if (!tree)
return 0;

looked suspect - we were saying an invalid tree != empty tree, but maybe it is
better to just say the tree is invalid here, which is what diff_tree_sha1()
does for such case.

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

line-log: convert to using diff_tree_sha1()Kirill Smelkov Wed, 5 Feb 2014 16:57:11 +0000 (20:57 +0400)

line-log: convert to using diff_tree_sha1()

Since diff_tree_sha1() can now accept empty trees via NULL sha1, we
could just call it without manually reading trees into tree_desc and
duplicating code.

Cc: Thomas Rast <tr@thomasrast.ch>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree-diff: convert diff_root_tree_sha1() to just call... Kirill Smelkov Wed, 5 Feb 2014 16:57:10 +0000 (20:57 +0400)

tree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL

Now since diff_tree_sha1 understands NULL for both old and new, we could
indicate an empty tree for root commit by providing just NULL for old
sha1.

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

tree-diff: allow diff_tree_sha1 to accept NULL sha1Kirill Smelkov Wed, 5 Feb 2014 16:57:09 +0000 (20:57 +0400)

tree-diff: allow diff_tree_sha1 to accept NULL sha1

which would mean that corresponding tree - old or new - is empty.

As followup patches will show, that functionality was already needed in
several places of Git codebase, but there, we were preparing empty
tree_desc objects by hand, with some code duplication.

For handling sha1 = NULL case, let's reuse fill_tree_descriptor() which
returns just empty tree_desc in that case.

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

userdiff: update Ada patternsAdrian Johnson Mon, 3 Feb 2014 11:33:16 +0000 (22:03 +1030)

userdiff: update Ada patterns

- Allow extra space in "is new" and "is separate"
- Fix bug in word regex for numbers

Signed-off-by: Adrian Johnson <ajohnson@redneon.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup: don't dereference in-tree symlinks for absolute... Martin Erik Werner Tue, 4 Feb 2014 14:25:20 +0000 (15:25 +0100)

setup: don't dereference in-tree symlinks for absolute paths

The prefix_path_gently() function currently applies real_path to
everything if given an absolute path, dereferencing symlinks both
outside and inside the work tree.

This causes most high-level functions to misbehave when acting on
symlinks given via absolute paths. For example

$ git add /dir/repo/symlink

attempts to add the target of the symlink rather than the symlink
itself, which is usually not what the user intends to do.

In order to manipulate symlinks in the work tree using absolute paths,
symlinks should only be dereferenced outside the work tree.

Modify the prefix_path_gently() to first normalize the path in order to
make sure path levels are separated by '/', then pass the result to
'abspath_part_inside_repo' to find the part inside the work tree
(without dereferencing any symlinks inside the work tree).

For absolute paths, prefix_path_gently() did not, nor does now do, any
actual prefixing, hence the result from abspath_part_in_repo() is
returned as-is.

Fixes t0060-82 and t3004-5.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup: add abspath_part_inside_repo() functionMartin Erik Werner Tue, 4 Feb 2014 14:25:19 +0000 (15:25 +0100)

setup: add abspath_part_inside_repo() function

In order to extract the part of an absolute path which lies inside the
repo, it is not possible to directly use real_path, since that would
dereference symlinks both outside and inside the work tree.

Add an abspath_part_inside_repo() function which first checks if the
work tree is already the prefix, then incrementally checks each path
level by temporarily NUL-terminating at each '/' and comparing against
the work tree path. If a match is found, it overwrites the input path
with the remainder past the work tree (which will be the part inside the
work tree).

This function is currently only intended for use in
'prefix_path_gently'.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0060: add tests for prefix_path when path begins with... Martin Erik Werner Tue, 4 Feb 2014 14:25:18 +0000 (15:25 +0100)

t0060: add tests for prefix_path when path begins with work tree

One edge-case that isn't currently checked in the tests is the beginning
of the path matching the work tree, despite the target not actually
being the work tree, for example:

path = /dir/repoa
work_tree = /dir/repo

should fail since the path is outside the repo. However, if /dir/repoa
is in fact a symlink that points to /dir/repo, it should instead
succeed.

Add two tests covering these cases, since they might be potential
regression points.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0060: add test for prefix_path when path == work treeMartin Erik Werner Tue, 4 Feb 2014 14:25:17 +0000 (15:25 +0100)

t0060: add test for prefix_path when path == work tree

The current behaviour of prefix_path is to return an empty string if
prefixing and absolute path that only contains exactly the work tree.
This behaviour is a potential regression point.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0060: add test for prefix_path on symlinks via absolut... Martin Erik Werner Tue, 4 Feb 2014 14:25:16 +0000 (15:25 +0100)

t0060: add test for prefix_path on symlinks via absolute paths

When symlinks in the working tree are manipulated using the absolute
path, git dereferences them, and tries to manipulate the link target
instead.

This applies to most high-level commands but prefix_path is the common
denominator for all of them.

Add a known-breakage tests using the prefix_path function, which
currently uses real_path, causing the dereference.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3004: add test for ls-files on symlinks via absolute... Junio C Hamano Tue, 4 Feb 2014 14:25:15 +0000 (15:25 +0100)

t3004: add test for ls-files on symlinks via absolute paths

When symlinks in the working tree are manipulated using the absolute
path, git dereferences them, and tries to manipulate the link target
instead.

This causes most high-level functions to misbehave when acting on
symlinks given via absolute paths. For example

$ git add /dir/repo/symlink

attempts to add the target of the symlink rather than the symlink
itself, which is usually not what the user intends to do.

This is a regression introduced by 18e051a:
setup: translate symlinks in filename when using absolute paths
(which did not take symlinks inside the work tree into consideration).

Add a known-breakage test using the ls-files function, checking both if
the symlink leads to a target in the same directory, and a target in the
above directory.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Tested-by: Martin Erik Werner <martinerikwerner@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>