gitweb.git
attr.c::path_matches(): special case paths that end... Junio C Hamano Thu, 28 Mar 2013 21:49:13 +0000 (17:49 -0400)

attr.c::path_matches(): special case paths that end with a slash

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

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

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

Merge branch 'maint-1.8.1' into maintJunio C Hamano Thu, 28 Mar 2013 21:34:07 +0000 (14:34 -0700)

Merge branch 'maint-1.8.1' into maint

* maint-1.8.1:
git help config: s/insn/instruction/

t5516: test interaction between pushURL and pushInstead... Junio C Hamano Thu, 28 Mar 2013 15:39:39 +0000 (08:39 -0700)

t5516: test interaction between pushURL and pushInsteadOf correctly

1c2eafb89bca (Add url.<base>.pushInsteadOf: URL rewriting for push
only, 2009-09-07) wants to make sure that a push destination read
from URL is not rewritten by pushInsteadOf because an explicit
pushURL exists; for that, a pushInsteadOf rewrite rule for the value
of remote.r.URL is set to a non-existent is set up.

We would also want to make sure that pushInsteadOf rewrite rule is
not applied to the location read from pushURL.

This way, we will make sure that

- "testrepo/" (pushURL) gets updated;

- the push does not try to update "trash2/" (the result of applying
pushInsteadOf to pushURL);

- the push does not try to update "trash3/" (the result of applying
pushInsteadOf to URL).

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

git help config: s/insn/instruction/Matthias Krüger Wed, 27 Mar 2013 22:53:50 +0000 (23:53 +0100)

git help config: s/insn/instruction/

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

Signed-off-by: Matthias Krüger <matthias.krueger@famsik.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

More fixes for 1.8.2.1Junio C Hamano Wed, 27 Mar 2013 17:57:57 +0000 (10:57 -0700)

More fixes for 1.8.2.1

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

Merge branch 'maint-1.8.1' into maintJunio C Hamano Wed, 27 Mar 2013 17:51:10 +0000 (10:51 -0700)

Merge branch 'maint-1.8.1' into maint

* maint-1.8.1:
merge-tree: fix typo in merge-tree.c::unresolved
git-commit doc: describe use of multiple `-m` options
git-pull doc: fix grammo ("conflicts" is plural)

merge-tree: fix typo in merge-tree.c::unresolvedJohn Keeping Wed, 27 Mar 2013 15:58:50 +0000 (15:58 +0000)

merge-tree: fix typo in merge-tree.c::unresolved

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

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

git-commit doc: describe use of multiple `-m` optionsChristian Helmuth Wed, 27 Mar 2013 14:19:35 +0000 (15:19 +0100)

git-commit doc: describe use of multiple `-m` options

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

Signed-off-by: Christian Helmuth <christian.helmuth@genode-labs.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-pull doc: fix grammo ("conflicts" is plural)Mihai Capotă Wed, 27 Mar 2013 11:04:51 +0000 (12:04 +0100)

git-pull doc: fix grammo ("conflicts" is plural)

Signed-off-by: Mihai Capotă <mihai@mihaic.ro>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

More corrections for 1.8.2.1Junio C Hamano Tue, 26 Mar 2013 19:53:49 +0000 (12:53 -0700)

More corrections for 1.8.2.1

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

Merge branch 'maint-1.8.1' into maintJunio C Hamano Tue, 26 Mar 2013 20:14:11 +0000 (13:14 -0700)

Merge branch 'maint-1.8.1' into maint

* maint-1.8.1:
Correct the docs about GIT_SSH.

Merge branch 'we/submodule-update-prefix-output' into... Junio C Hamano Tue, 26 Mar 2013 19:44:26 +0000 (12:44 -0700)

Merge branch 'we/submodule-update-prefix-output' into maint

"git submodule update", when recursed into sub-submodules, did not
acccumulate the prefix paths.

* we/submodule-update-prefix-output:
submodule update: when using recursion, show full path

Merge branch 'jk/mailsplit-maildir-muttsort' into maintJunio C Hamano Tue, 26 Mar 2013 19:44:11 +0000 (12:44 -0700)

Merge branch 'jk/mailsplit-maildir-muttsort' into maint

Sort filenames read from the maildir/ in a way that is more likely
to sort messages in the order the writing MUA meant to, by sorting
numeric segment in numeric order and non-numeric segment in
alphabetical order.

* jk/mailsplit-maildir-muttsort:
mailsplit: sort maildir filenames more cleverly

Merge branch 'rs/zip-compresssed-size-with-export-subst... Junio C Hamano Tue, 26 Mar 2013 19:43:49 +0000 (12:43 -0700)

Merge branch 'rs/zip-compresssed-size-with-export-subst' into maint

When export-subst is used, "zip" output recorded incorrect
size of the file.

* rs/zip-compresssed-size-with-export-subst:
archive-zip: fix compressed size for stored export-subst files

Merge branch 'jk/utf-8-can-be-spelled-differently'... Junio C Hamano Tue, 26 Mar 2013 19:43:25 +0000 (12:43 -0700)

Merge branch 'jk/utf-8-can-be-spelled-differently' into maint

Some platforms and users spell UTF-8 differently; retry with the
most official "UTF-8" when the system does not understand the
user-supplied encoding name that are the common alternative
spellings of UTF-8.

* jk/utf-8-can-be-spelled-differently:
utf8: accept alternate spellings of UTF-8

Merge branch 'nd/branch-error-cases' into maintJunio C Hamano Tue, 26 Mar 2013 19:43:05 +0000 (12:43 -0700)

Merge branch 'nd/branch-error-cases' into maint

"git branch" had more cases where it did not bother to check
nonsense command line parameters.

* nd/branch-error-cases:
branch: segfault fixes and validation

Merge branch 'ap/maint-update-index-h-is-for-help'... Junio C Hamano Tue, 26 Mar 2013 19:42:42 +0000 (12:42 -0700)

Merge branch 'ap/maint-update-index-h-is-for-help' into maint

"git update-index -h" did not do the usual "-h(elp)" thing.

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

Merge branch 'jc/perl-cat-blob' into maintJunio C Hamano Tue, 26 Mar 2013 19:42:24 +0000 (12:42 -0700)

Merge branch 'jc/perl-cat-blob' into maint

perl/Git.pm::cat_blob slurped everything in core only to write it
out to a file descriptor, which was not a very smart thing to do.

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

Merge branch 'ob/imap-send-ssl-verify' into maintJunio C Hamano Tue, 26 Mar 2013 19:41:59 +0000 (12:41 -0700)

Merge branch 'ob/imap-send-ssl-verify' into maint

Correctly connect to SSL/TLS sites that serve multiple hostnames on
a single IP by including Server Name Indication in the client-hello.

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

Merge branch 'nd/index-pack-l10n-buf-overflow' into... Junio C Hamano Tue, 26 Mar 2013 19:40:19 +0000 (12:40 -0700)

Merge branch 'nd/index-pack-l10n-buf-overflow' into maint

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

Merge branch 'jc/maint-push-refspec-default-doc' into... Junio C Hamano Tue, 26 Mar 2013 19:40:13 +0000 (12:40 -0700)

Merge branch 'jc/maint-push-refspec-default-doc' into maint

* jc/maint-push-refspec-default-doc:
Documentation/git-push: clarify the description of defaults

Merge branch 'wk/user-manual-literal-format' into maintJunio C Hamano Tue, 26 Mar 2013 19:40:11 +0000 (12:40 -0700)

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

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

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

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

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

Merge branch 'jc/maint-reflog-expire-clean-mark-typofix... Junio C Hamano Tue, 26 Mar 2013 19:39:51 +0000 (12:39 -0700)

Merge branch 'jc/maint-reflog-expire-clean-mark-typofix' into maint

In "git reflog expire", REACHABLE bit was not cleared from the
correct objects.

* jc/maint-reflog-expire-clean-mark-typofix:
reflog: fix typo in "reflog expire" clean-up codepath

attr.c::path_matches(): the basename is part of the... Junio C Hamano Tue, 26 Mar 2013 17:28:07 +0000 (10:28 -0700)

attr.c::path_matches(): the basename is part of the pathname

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

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

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

Correct the docs about GIT_SSH.Dan Bornstein Thu, 21 Mar 2013 23:06:40 +0000 (23:06 +0000)

Correct the docs about GIT_SSH.

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

Signed-off-by: Dan Bornstein <danfuzz@milk.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Start preparing for 1.8.2.1Junio C Hamano Mon, 25 Mar 2013 20:51:13 +0000 (13:51 -0700)

Start preparing for 1.8.2.1

... at the same time, preparation for 1.8.1.6 also has started ;-)

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

Merge branch 'jk/graph-c-expose-symbols-for-cgit' into... Junio C Hamano Mon, 25 Mar 2013 20:48:39 +0000 (13:48 -0700)

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

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 'maint-1.8.1' into maintJunio C Hamano Mon, 25 Mar 2013 20:46:42 +0000 (13:46 -0700)

Merge branch 'maint-1.8.1' into maint

* maint-1.8.1:
bundle: Add colons to list headings in "verify"
bundle: Fix "verify" output if history is complete
Documentation: filter-branch env-filter example
git-filter-branch.txt: clarify ident variables usage
git-compat-util.h: Provide missing netdb.h definitions
describe: Document --match pattern format
Documentation/githooks: Explain pre-rebase parameters
update-index: list supported idx versions and their features
diff-options: unconfuse description of --color
read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr()
index-format.txt: mention of v4 is missing in some places

Merge branch 'lf/bundle-verify-list-prereqs' into maint... Junio C Hamano Mon, 25 Mar 2013 20:46:02 +0000 (13:46 -0700)

Merge branch 'lf/bundle-verify-list-prereqs' into maint-1.8.1

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

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

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

Merge branch 'tk/doc-filter-branch' into maint-1.8.1

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

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

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

Merge branch 'dm/ni-maxhost-may-be-missing' into maint-1.8.1

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

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

Merge branch 'gp/describe-match-uses-glob-pattern'... Junio C Hamano Mon, 25 Mar 2013 20:45:33 +0000 (13:45 -0700)

Merge branch 'gp/describe-match-uses-glob-pattern' into maint-1.8.1

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

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

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

Merge branch 'nd/doc-index-format' into maint-1.8.1

The v4 index format was not documented.

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

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

Merge branch 'wk/doc-pre-rebase' into maint-1.8.1

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

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

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

Merge branch 'jc/color-diff-doc' into maint-1.8.1

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

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

transport.c: help gcc 4.6.3 users by squelching compile... Junio C Hamano Mon, 25 Mar 2013 19:51:50 +0000 (12:51 -0700)

transport.c: help gcc 4.6.3 users by squelching compiler warning

To a human reader, it is quite obvious that cmp is assigned before
it is used, but gcc 4.6.3 that ships with Ubuntu 12.04 is among
those that do not get this right.

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

match-trees: simplify score_trees() using tree_entry()René Scharfe Sun, 24 Mar 2013 22:46:28 +0000 (23:46 +0100)

match-trees: simplify score_trees() using tree_entry()

Convert the loop in score_trees() to tree_entry(). The code becomes
shorter and simpler because the calls to update_tree_entry() are not
needed any more.

Another benefit is that we need less variables to track the current
tree entries; as a side-effect of that the compiler has an easier
job figuring out the control flow and thus can avoid false warnings
about uninitialized variables.

Using struct name_entry also allows the use of tree_entry_len() for
finding the path length instead of strlen(), which may be slightly
more efficient.

Also unify the handling of missing entries in one of the two trees
(i.e. added or removed files): Just set cmp appropriately first, no
matter if we ran off the end of a tree or if we actually have two
entries to compare, and check its value a bit later without
duplicating the handler code.

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

Fix revision walk for commits with the same datesKacper Kornet Fri, 22 Mar 2013 18:38:19 +0000 (19:38 +0100)

Fix revision walk for commits with the same dates

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

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

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: clarify logic in show_submodule_summaryJeff King Fri, 22 Mar 2013 16:19:56 +0000 (12:19 -0400)

submodule: clarify logic in show_submodule_summary

There are two uses of the "left" and "right" commit variables that
make it hard to be sure what values they have (both for the reader,
and for gcc, which wrongly complains that they might be used
uninitialized).

The function starts with a cascading if statement, checking that the
input sha1s exist, and finally working up to preparing a revision
walk. We only prepare the walk if the cascading conditional did not
find any problems, which we check by seeing whether it set the
"message" variable or not. It's simpler and more obvious to just add
a condition to the end of the cascade.

Later, we check the same "message" variable when deciding whether to
clear commit marks on the left/right commits; if it is set, we
presumably never started the walk. This is wrong, though; we might
have started the walk and munged commit flags, only to encounter an
error afterwards. We should always clear the flags on left/right if
they exist, whether the walk was successful or not.

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

apply --whitespace=fix: avoid running over the postimag... Junio C Hamano Fri, 22 Mar 2013 18:10:03 +0000 (11:10 -0700)

apply --whitespace=fix: avoid running over the postimage buffer

Originally update-pre-post-images could assume that any whitespace
fixing will make the result only shorter by unexpanding runs of
leading SPs into HTs and removing trailing whitespaces at the end of
lines. Updating the post-image we read from the patch to match the
actual result can be performed in-place under this assumption.
These days, however, we have tab-in-indent (aka Python) rule whose
result can be longer than the original, and we do need to allocate
a larger buffer than the input and replace the result.

Fortunately the support for lengthening rewrite was already added
when we began supporting "match while ignoring whitespace
differences" mode in 86c91f91794c (git apply: option to ignore
whitespace differences, 2009-08-04). We only need to correctly
count the number of bytes necessary to hold the updated result and
tell the function to allocate a new buffer.

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

Documentation: merging a tag is a special caseJunio C Hamano Thu, 21 Mar 2013 21:57:48 +0000 (22:57 +0100)

Documentation: merging a tag is a special case

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

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

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

CodingGuidelines: our documents are in AsciiDocJunio C Hamano Thu, 21 Mar 2013 21:17:32 +0000 (14:17 -0700)

CodingGuidelines: our documents are in AsciiDoc

Before talking about notations such as optional [--option] enclosed
in brackets, state that the documents are in AsciiDoc and processed
into other formats.

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

diff.c: diff.renamelimit => diff.renameLimit in messageMax Nanasy Thu, 21 Mar 2013 19:53:38 +0000 (12:53 -0700)

diff.c: diff.renamelimit => diff.renameLimit in message

In the warning message printed when rename or unmodified copy
detection was skipped due to too many files, change "diff.renamelimit"
to "diff.renameLimit", in order to make it consistent with git
documentation, which consistently uses "diff.renameLimit".

Signed-off-by: Max Nanasy <max.nanasy@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: fix possible use of uninitialized variableJeff King Thu, 21 Mar 2013 11:05:28 +0000 (07:05 -0400)

wt-status: fix possible use of uninitialized variable

In wt_status_print_change_data, we accept a change_type flag
that is meant to be either WT_STATUS_UPDATED or
WT_STATUS_CHANGED. We then switch() on this value to set
the local variable "status" for each case, but do not
provide a fallback "default" label to the switch statement.

As a result, the compiler realizes that "status" might be
unset, and complains with a warning. To silence this
warning, we use the "int status = status" trick. This is
correct with the current code, as all callers provide one of
the two expected change_type flags. However, it's also a
maintenance trap, as there is nothing to prevent future
callers from passing another flag, nor to document this
assumption.

Instead of using the "x = x" hack, let's handle the default
case in the switch() statement with a die("BUG"). That tells
the compiler and any readers of the code exactly what the
function's input assumptions are.

We could also convert the flag to an enum, which would
provide a compile-time check on the function input. However,
since these flags are part of a larger enum, that would make
the code unnecessarily complex (we would have to make a new
enum with just the two flags, and then convert it to the old
enum for passing to sub-functions).

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

fast-import: clarify "inline" logic in file_change_mJeff King Thu, 21 Mar 2013 15:44:39 +0000 (11:44 -0400)

fast-import: clarify "inline" logic in file_change_m

When we read a fast-import line like:

M 100644 :1 foo.c

we point the local object_entry variable "oe" to the object
named by the mark ":1". When the input uses the "inline"
construct, however, we do not have such an object_entry.

The current code is careful not to access "oe" in the inline
case, but we can make the assumption even more obvious (and
catch violations of it) by setting oe to NULL and adding a
comment. As a bonus, this also squelches an over-zealous gcc
-Wuninitialized warning, which means we can drop the "oe =
oe" initialization hack.

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

run-command: always set failed_errno in start_commandJeff King Thu, 21 Mar 2013 15:45:00 +0000 (11:45 -0400)

run-command: always set failed_errno in start_command

When we fail to fork, we set the failed_errno variable to
the value of errno so it is not clobbered by later syscalls.
However, we do so in a conditional, and it is hard to see
later under what conditions the variable has a valid value.

Instead of setting it only when fork fails, let's just
always set it after forking. This is more obvious for human
readers (as we are no longer setting it as a side effect of
a strerror call), and it is more obvious to gcc, which no
longer generates a spurious -Wuninitialized warning. It also
happens to match what the WIN32 half of the #ifdef does.

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

transport: drop "int cmp = cmp" hackJeff King Thu, 21 Mar 2013 11:13:33 +0000 (07:13 -0400)

transport: drop "int cmp = cmp" hack

According to 47ec794, this initialization is meant to
squelch an erroneous uninitialized variable warning from gcc
4.0.1. That version is quite old at this point, and gcc 4.1
and up handle it fine, with one exception. There seems to be
a regression in gcc 4.6.3, which produces the warning;
however, gcc versions 4.4.7 and 4.7.2 do not.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

drop some obsolete "x = x" compiler warning hacksJeff King Thu, 21 Mar 2013 11:10:28 +0000 (07:10 -0400)

drop some obsolete "x = x" compiler warning hacks

In cases where the setting and access of a variable are
protected by the same conditional flag, older versions of
gcc would generate a "might be used unitialized" warning. We
silence the warning by initializing the variable to itself,
a hack that gcc recognizes.

Modern versions of gcc are smart enough to get this right,
going back to at least version 4.3.5. gcc 4.1 does get it
wrong in both cases, but is sufficiently old that we
probably don't need to care about it anymore.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: use pointer-to-pointer to keep list tailJeff King Thu, 21 Mar 2013 11:08:17 +0000 (07:08 -0400)

fast-import: use pointer-to-pointer to keep list tail

This is shorter, idiomatic, and it means the compiler does
not get confused about whether our "e" pointer is valid,
letting us drop the "e = e" hack.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3200 (branch): modernize styleRamkumar Ramachandra Wed, 20 Mar 2013 12:30:12 +0000 (18:00 +0530)

t3200 (branch): modernize style

Style is inconsistent throughout the file. Make the following
changes:

1. Indent everything with tabs.

2. Put the opening quote (') for the test in the same line as
test_expect_success, and the closing quote on a line by itself.

3. Do not add extra space between redirection operator and filename,
i.e. "cmd >dst", not "cmd > dst".

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

index-pack: always zero-initialize object_entry listJeff King Tue, 19 Mar 2013 16:17:22 +0000 (12:17 -0400)

index-pack: always zero-initialize object_entry list

Commit 38a4556 (index-pack: start learning to emulate
"verify-pack -v", 2011-06-03) added a "delta_depth" counter
to each "struct object_entry". Initially, all object entries
have their depth set to 0; in resolve_delta, we then set the
depth of each delta to "base + 1". Base entries never have
their depth touched, and remain at 0.

To ensure that all depths start at 0, that commit changed
calls to xmalloc the object_entry list into calls to
xcalloc. However, it forgot that we grow the list with
xrealloc later. These extra entries are used when we add an
object from elsewhere to complete a thin pack. If we add a
non-delta object, its depth value will just be uninitialized
heap data.

This patch fixes it by zero-initializing entries we add to
the objects list via the xrealloc.

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

t2003: work around path mangling issue on WindowsJohannes Sixt Wed, 20 Mar 2013 08:47:57 +0000 (09:47 +0100)

t2003: work around path mangling issue on Windows

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

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

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>

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>

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>

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>

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>

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>

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>

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>

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

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>

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>