gitweb.git
rebase -i: do not "echo" random user-supplied stringsUwe Storbeck Fri, 14 Mar 2014 23:56:43 +0000 (00:56 +0100)

rebase -i: do not "echo" random user-supplied strings

In some places we "echo" a string that comes from a commit log
message, which may have a backslash sequence that is interpreted by
the command (POSIX.1 allows this), most notably "dash"'s built-in
'echo'.

A commit message which contains the string '\n' (or ends with the
string '\c') may result in a garbage line in the todo list of an
interactive rebase which causes the rebase to fail.

To reproduce the behavior (with dash as /bin/sh):

mkdir test && cd test && git init
echo 1 >foo && git add foo
git commit -m"this commit message ends with '\n'"
echo 2 >foo && git commit -a --fixup HEAD
git rebase -i --autosquash --root

Now the editor opens with garbage in line 3 which has to be
removed or the rebase fails.

Signed-off-by: Uwe Storbeck <uwe@ibr.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mv: prevent mismatched data when ignoring errors.brian m. carlson Sat, 15 Mar 2014 18:56:52 +0000 (18:56 +0000)

mv: prevent mismatched data when ignoring errors.

We shrink the source and destination arrays, but not the modes or
submodule_gitfile arrays, resulting in potentially mismatched data. Shrink
all the arrays at the same time to prevent this. Add tests to ensure the
problem does not recur.

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

t/lib-terminal: make TTY a lazy prerequisiteJeff King Fri, 14 Mar 2014 21:57:23 +0000 (17:57 -0400)

t/lib-terminal: make TTY a lazy prerequisite

When lib-terminal.sh is sourced by a test script, we
immediately set up the TTY prerequisite. We do so inside a
test_expect_success, because that nicely isolates any
generated output.

However, this early test can interfere with a script that
later wants to skip all tests (e.g., t5541 then goes on to
set up the httpd server, and wants to skip_all if that
fails). TAP output doesn't let us skip everything after we
have already run at least one test.

We could fix this by reordering the inclusion of
lib-terminal.sh in t5541 to go after the httpd setup. That
solves this case, but we might eventually hit a case with
circular dependencies, where either lib-*.sh include might
want to skip_all after the other has run a test. So
instead, let's just remove the ordering constraint entirely
by doing the setup inside a test_lazy_prereq construct,
rather than in a regular test. We never cared about the
test outcome anyway (it was written to always succeed).

Note that in addition to setting up the prerequisite, the
current test also defines test_terminal. Since we can't
affect the environment from a lazy_prereq, we have to hoist
that out. We previously depended on it _not_ being defined
when the TTY prereq isn't set as a way to ensure that tests
properly declare their dependency on TTY. However, we still
cover the case (see the in-code comment for details).

Reported-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to Git 2.0Junio C Hamano Thu, 13 Mar 2014 21:01:17 +0000 (14:01 -0700)

Update draft release notes to Git 2.0

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

Merge branch 'ta/parse-commit-with-skip-prefix'Junio C Hamano Fri, 14 Mar 2014 21:27:23 +0000 (14:27 -0700)

Merge branch 'ta/parse-commit-with-skip-prefix'

* ta/parse-commit-with-skip-prefix:
commit.c: use skip_prefix() instead of starts_with()

Merge branch 'sr/add--interactive-term-readkey'Junio C Hamano Fri, 14 Mar 2014 21:27:21 +0000 (14:27 -0700)

Merge branch 'sr/add--interactive-term-readkey'

* sr/add--interactive-term-readkey:
git-add--interactive: warn if module for interactive.singlekey is missing
git-config: document interactive.singlekey requires Term::ReadKey

Merge branch 'sh/write-pack-file-warning-message-fix'Junio C Hamano Fri, 14 Mar 2014 21:27:16 +0000 (14:27 -0700)

Merge branch 'sh/write-pack-file-warning-message-fix'

A warning from "git pack-objects" were generated by referring to an
incorrect variable when forming the filename that we had trouble
with.

* sh/write-pack-file-warning-message-fix:
write_pack_file: use correct variable in diagnostic

Merge branch 'nd/strbuf-inline-styles'Junio C Hamano Fri, 14 Mar 2014 21:27:13 +0000 (14:27 -0700)

Merge branch 'nd/strbuf-inline-styles'

* nd/strbuf-inline-styles:
strbuf: style fix -- top opening bracket on a separate line

Merge branch 'jn/bisect-coding-style'Junio C Hamano Fri, 14 Mar 2014 21:27:11 +0000 (14:27 -0700)

Merge branch 'jn/bisect-coding-style'

* jn/bisect-coding-style:
git-bisect.sh: fix a few style issues

Merge branch 'mh/replace-refs-variable-rename'Junio C Hamano Fri, 14 Mar 2014 21:27:06 +0000 (14:27 -0700)

Merge branch 'mh/replace-refs-variable-rename'

* mh/replace-refs-variable-rename:
Document some functions defined in object.c
Add docstrings for lookup_replace_object() and do_lookup_replace_object()
rename read_replace_refs to check_replace_refs

Merge branch 'sg/archive-restrict-remote'Junio C Hamano Fri, 14 Mar 2014 21:27:02 +0000 (14:27 -0700)

Merge branch 'sg/archive-restrict-remote'

Allow loosening remote "git archive" invocation security check that
refuses to serve tree-ish not at the tip of any ref.

* sg/archive-restrict-remote:
add uploadarchive.allowUnreachable option
docs: clarify remote restrictions for git-upload-archive

Merge branch 'rt/help-pretty-prints-cmd-names'Junio C Hamano Fri, 14 Mar 2014 21:27:00 +0000 (14:27 -0700)

Merge branch 'rt/help-pretty-prints-cmd-names'

* rt/help-pretty-prints-cmd-names:
help.c: rename function "pretty_print_string_list"

Merge branch 'jl/doc-submodule-update-checkout'Junio C Hamano Fri, 14 Mar 2014 21:26:58 +0000 (14:26 -0700)

Merge branch 'jl/doc-submodule-update-checkout'

Add missing documentation for "submodule update --checkout".

* jl/doc-submodule-update-checkout:
submodule update: consistently document the '--checkout' option

Merge branch 'jk/doc-coding-guideline'Junio C Hamano Fri, 14 Mar 2014 21:26:55 +0000 (14:26 -0700)

Merge branch 'jk/doc-coding-guideline'

Elaborate on a style niggle that has been part of "mimic existing
code".

* jk/doc-coding-guideline:
CodingGuidelines: mention C whitespace rules

Merge branch 'da/difftool-git-files'Junio C Hamano Fri, 14 Mar 2014 21:26:52 +0000 (14:26 -0700)

Merge branch 'da/difftool-git-files'

"git difftool" misbehaved when the repository is bound to the
working tree with the ".git file" mechanism, where a textual
file ".git" tells us where it is.

* da/difftool-git-files:
t7800: add a difftool test for .git-files
difftool: support repositories with .git-files

Merge branch 'tg/index-v4-format'Junio C Hamano Fri, 14 Mar 2014 21:26:50 +0000 (14:26 -0700)

Merge branch 'tg/index-v4-format'

* tg/index-v4-format:
read-cache: add index.version config variable
test-lib: allow setting the index format version
introduce GIT_INDEX_VERSION environment variable

Merge branch 'nd/i18n-progress'Junio C Hamano Fri, 14 Mar 2014 21:26:31 +0000 (14:26 -0700)

Merge branch 'nd/i18n-progress'

Mark the progress indicators from various time-consuming commands
for i18n/l10n.

* nd/i18n-progress:
i18n: mark all progress lines for translation

Merge branch 'mh/object-code-cleanup'Junio C Hamano Fri, 14 Mar 2014 21:26:29 +0000 (14:26 -0700)

Merge branch 'mh/object-code-cleanup'

* mh/object-code-cleanup:
sha1_file.c: document a bunch of functions defined in the file
sha1_file_name(): declare to return a const string
find_pack_entry(): document last_found_pack
replace_object: use struct members instead of an array

Merge branch 'jn/am-doc-hooks'Junio C Hamano Fri, 14 Mar 2014 21:26:27 +0000 (14:26 -0700)

Merge branch 'jn/am-doc-hooks'

* jn/am-doc-hooks:
am doc: add a pointer to relevant hooks

Merge branch 'jm/stash-doc-k-for-keep'Junio C Hamano Fri, 14 Mar 2014 21:26:22 +0000 (14:26 -0700)

Merge branch 'jm/stash-doc-k-for-keep'

* jm/stash-doc-k-for-keep:
stash doc: mention short form -k in save description

Merge branch 'jk/remote-pushremote-config-reading'Junio C Hamano Fri, 14 Mar 2014 21:26:04 +0000 (14:26 -0700)

Merge branch 'jk/remote-pushremote-config-reading'

"git push" did not pay attention to branch.*.pushremote if it is
defined earlier than remote.pushdefault; the order of these two
variables in the configuration file should not matter, but it did by
mistake.

* jk/remote-pushremote-config-reading:
remote: handle pushremote config in any order

Merge branch 'jk/commit-dates-parsing-fix'Junio C Hamano Fri, 14 Mar 2014 21:25:44 +0000 (14:25 -0700)

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

Tighten codepaths that parse timestamps in commit objects.

* jk/commit-dates-parsing-fix:
show_ident_date: fix tz range check
log: do not segfault on gmtime errors
log: handle integer overflow in timestamps
date: check date overflow against time_t
fsck: report integer overflow in author timestamps
t4212: test bogus timestamps with git-log

Merge branch 'jh/note-trees-record-blobs'Junio C Hamano Fri, 14 Mar 2014 21:25:39 +0000 (14:25 -0700)

Merge branch 'jh/note-trees-record-blobs'

"git notes -C <blob>" should not take an object that is not a blob.

* jh/note-trees-record-blobs:
notes: disallow reusing non-blob as a note object

Merge branch 'rt/links-for-asciidoctor'Junio C Hamano Fri, 14 Mar 2014 21:25:36 +0000 (14:25 -0700)

Merge branch 'rt/links-for-asciidoctor'

* rt/links-for-asciidoctor:
Documentation: fix documentation AsciiDoc links for external urls

Merge branch 'nd/no-more-fnmatch'Junio C Hamano Fri, 14 Mar 2014 21:25:31 +0000 (14:25 -0700)

Merge branch 'nd/no-more-fnmatch'

We started using wildmatch() in place of fnmatch(3); complete the
process and stop using fnmatch(3).

* nd/no-more-fnmatch:
actually remove compat fnmatch source code
stop using fnmatch (either native or compat)
Revert "test-wildmatch: add "perf" command to compare wildmatch and fnmatch"
use wildmatch() directly without fnmatch() wrapper

Merge branch 'ak/gitweb-fit-image'Junio C Hamano Fri, 14 Mar 2014 21:25:28 +0000 (14:25 -0700)

Merge branch 'ak/gitweb-fit-image'

Instead of allowing an <img> to be shown in whatever size, force
scaling it to fit on the page with max-height/max-width css style
attributes.

* ak/gitweb-fit-image:
gitweb: Avoid overflowing page body frame with large images

Merge branch 'tr/diff-submodule-no-reuse-worktree'Junio C Hamano Fri, 14 Mar 2014 21:25:20 +0000 (14:25 -0700)

Merge branch 'tr/diff-submodule-no-reuse-worktree'

"git diff --external-diff" incorrectly fed the submodule directory
in the working tree to the external diff driver when it knew it is
the same as one of the versions being compared.

* tr/diff-submodule-no-reuse-worktree:
diff: do not reuse_worktree_file for submodules

Merge branch 'nd/reset-setup-worktree'Junio C Hamano Fri, 14 Mar 2014 21:25:02 +0000 (14:25 -0700)

Merge branch 'nd/reset-setup-worktree'

"git reset" needs to refresh the index when working in a working
tree (it can also be used to match the index to the HEAD in an
otherwise bare repository), but it failed to set up the working
tree properly, causing GIT_WORK_TREE to be ignored.

* nd/reset-setup-worktree:
reset: optionally setup worktree and refresh index on --mixed

Merge branch 'lb/contrib-contacts-looser-diff-parsing'Junio C Hamano Fri, 14 Mar 2014 21:24:59 +0000 (14:24 -0700)

Merge branch 'lb/contrib-contacts-looser-diff-parsing'

* lb/contrib-contacts-looser-diff-parsing:
git-contacts: do not fail parsing of good diffs

Merge branch 'ks/config-file-stdin'Junio C Hamano Fri, 14 Mar 2014 21:24:40 +0000 (14:24 -0700)

Merge branch 'ks/config-file-stdin'

"git config" learned to read from the standard input when "-" is
given as the value to its "--file" parameter (attempting an
operation to update the configuration in the standard input of
course is rejected).

* ks/config-file-stdin:
config: teach "git config --file -" to read from the standard input
config: change git_config_with_options() interface
builtin/config.c: rename check_blob_write() -> check_write()
config: disallow relative include paths from blobs

Merge branch 'jk/janitorial-fixes'Junio C Hamano Fri, 14 Mar 2014 21:24:37 +0000 (14:24 -0700)

Merge branch 'jk/janitorial-fixes'

* jk/janitorial-fixes:
open_istream(): do not dereference NULL in the error case
builtin/mv: don't use memory after free
utf8: use correct type for values in interval table
utf8: fix iconv error detection
notes-utils: handle boolean notes.rewritemode correctly

Merge branch 'jk/http-no-curl-easy'Junio C Hamano Fri, 14 Mar 2014 21:24:18 +0000 (14:24 -0700)

Merge branch 'jk/http-no-curl-easy'

Uses of curl's "multi" interface and "easy" interface do not mix
well when we attempt to reuse outgoing connections. Teach the RPC
over http code, used in the smart HTTP transport, not to use the
"easy" interface.

* jk/http-no-curl-easy:
http: never use curl_easy_perform

Merge branch 'ss/completion-rec-sub-fetch-push'Junio C Hamano Fri, 14 Mar 2014 21:24:15 +0000 (14:24 -0700)

Merge branch 'ss/completion-rec-sub-fetch-push'

* ss/completion-rec-sub-fetch-push:
completion: teach --recurse-submodules to fetch, pull and push

Merge branch 'nd/gitignore-trailing-whitespace'Junio C Hamano Fri, 14 Mar 2014 21:23:37 +0000 (14:23 -0700)

Merge branch 'nd/gitignore-trailing-whitespace'

Trailing whitespaces in .gitignore files, unless they are quoted for
fnmatch(3), e.g. "path\ ", are warned and ignored.

Strictly speaking, this is a backward incompatible change, but very
unlikely to bite any sane user and adjusting should be obvious and
easy.

* nd/gitignore-trailing-whitespace:
t0008: skip trailing space test on Windows
dir: ignore trailing spaces in exclude patterns
dir: warn about trailing spaces in exclude patterns

Merge branch 'jc/check-attr-honor-working-tree'Junio C Hamano Fri, 14 Mar 2014 21:05:59 +0000 (14:05 -0700)

Merge branch 'jc/check-attr-honor-working-tree'

"git check-attr" when (trying to) work on a repository with a
working tree did not work well when the working tree was specified
via --work-tree (and obviously with --git-dir).

The command also works in a bare repository but it reads from the
(possibly stale, irrelevant and/or nonexistent) index, which may
need to be fixed to read from HEAD, but that is a completely
separate issue. As a related tangent to this separate issue, we
may want to also fix "check-ignore", which refuses to work in a
bare repository, to also operate in a bare one.

* jc/check-attr-honor-working-tree:
check-attr: move to the top of working tree when in non-bare repository
t0003: do not chdir the whole test process

request-pull: documentation updatesJunio C Hamano Wed, 12 Mar 2014 18:04:11 +0000 (11:04 -0700)

request-pull: documentation updates

The original description talked only about what it does. Instead,
start it with the purpose of the command, i.e. what it is used for,
and then mention what it does to achieve that goal.

Clarify what <start>, <url> and <end> means in the context of the
overall purpose of the command.

Describe the extended syntax of <end> parameter that is used when
the local branch name is different from the branch name at the
repository the changes are published.

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

rev-list: disable object/refname ambiguity check with... Jeff King Wed, 12 Mar 2014 20:06:17 +0000 (16:06 -0400)

rev-list: disable object/refname ambiguity check with --stdin

This is the "rev-list" analogue to 25fba78 (cat-file:
disable object/refname ambiguity check for batch mode,
2013-07-12). Like cat-file, "rev-list --stdin" may read a
large number of sha1 object names, and the warning check
introduces a significant slow-down.

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

cat-file: restore warn_on_object_refname_ambiguity... Jeff King Wed, 12 Mar 2014 20:05:43 +0000 (16:05 -0400)

cat-file: restore warn_on_object_refname_ambiguity flag

Commit 25fba78 turned off the object/refname ambiguity check
during "git cat-file --batch" operations. However, this is a
global flag, so let's restore it when we are done.

This shouldn't make any practical difference, as cat-file
exits immediately afterwards, but is good code hygeine and
would prevent an unnecessary surprise if somebody starts to
call cmd_cat_file later.

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

entry.c: fix possible buffer overflow in remove_subtree()Michael Haggerty Thu, 13 Mar 2014 09:19:08 +0000 (10:19 +0100)

entry.c: fix possible buffer overflow in remove_subtree()

remove_subtree() manipulated path in a fixed-size buffer even though
the length of the input, let alone the length of entries within the
directory, were not known in advance. Change the function to take a
strbuf argument and use that object as its scratch space.

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

checkout_entry(): use the strbuf throughout the functionMichael Haggerty Thu, 13 Mar 2014 09:19:07 +0000 (10:19 +0100)

checkout_entry(): use the strbuf throughout the function

There is no need to break out the "buf" and "len" members into
separate temporary variables. Rename path_buf to path and use
path.buf and path.len directly. This makes it easier to reason about
the data flow in the function.

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

connect.c: SP after "}", not TABNguyễn Thái Ngọc Duy Thu, 13 Mar 2014 11:45:31 +0000 (18:45 +0700)

connect.c: SP after "}", not TAB

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

sh-i18n--envsubst: retire unused string_list_member()Eric Sunshine Tue, 11 Mar 2014 22:46:44 +0000 (18:46 -0400)

sh-i18n--envsubst: retire unused string_list_member()

This static function has no callers, nor has it had any since its
introduction in ba67aaf2d05d (git-sh-i18n--envsubst: our own envsubst(1)
for eval_gettext(), 2011-05-14). Remove it.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: lift the artificual "at least 20 columns... Junio C Hamano Wed, 12 Mar 2014 20:43:51 +0000 (13:43 -0700)

wt-status: lift the artificual "at least 20 columns" floor

When we show unmerged paths, we had an artificial 20 columns floor
for the width of labels (e.g. "both deleted:") shown next to the
pathnames. Depending on the locale, this may result in a label that
is too wide when all the label strings are way shorter than 20
columns, or no-op when a label string is longer than 20 columns.

Just drop the artificial floor. The screen real estate is better
utilized this way when all the strings are shorter.

Adjust the tests to this change.

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

wt-status: i18n of section labelsJonathan Nieder Thu, 19 Dec 2013 19:43:19 +0000 (11:43 -0800)

wt-status: i18n of section labels

The original code assumes that:

(1) the number of bytes written is the width of a string, so they
can line up;

(2) the "how" string is always <= 19 bytes.

Neither of which we should assume.

Using the same approach as the earlier 3651e45c (wt-status: take the
alignment burden off translators, 2013-11-05), compute the necessary
column width to hold the longest label and use that for alignment.

cf. http://bugs.debian.org/725777

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

wt-status: extract the code to compute width for labelsJonathan Nieder Thu, 19 Dec 2013 19:43:19 +0000 (11:43 -0800)

wt-status: extract the code to compute width for labels

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

wt-status: make full label string to be subject to... Junio C Hamano Wed, 12 Mar 2014 20:51:22 +0000 (13:51 -0700)

wt-status: make full label string to be subject to l10n

Earlier in 3651e45c (wt-status: take the alignment burden off
translators, 2013-11-05), we assumed that it is OK to make the
string before the colon in a label string we give as the section
header of various kinds of changes (e.g. "new file:") translatable.

This assumption apparently does not hold for some languages,
e.g. ones that want to have spaces around the colon.

Also introduce a static label_width to avoid having to run
strlen(padding) over and over.

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

grep: support -h (no header) with --countRené Scharfe Tue, 11 Mar 2014 21:15:49 +0000 (22:15 +0100)

grep: support -h (no header) with --count

Suppress printing the header (filename) with -h even if in -c/--count
mode. GNU grep and OpenBSD's grep do the same.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7810: add missing variables to tests in loopRené Scharfe Tue, 11 Mar 2014 21:07:58 +0000 (22:07 +0100)

t7810: add missing variables to tests in loop

Some tests in t7810-grep.sh are in a loop that runs them against HEAD and
the work tree. In order for that to work the test code should use the
variables $L (display name), $H (HEAD or empty string) and $HC (revision
prefix for result lines); otherwise tests are just repeated with the same
target. Add the variables where they're missing and make sure the test
description is wrapped in double quotes (instead of single quotes) to
allow variables to be expanded.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/mv: fix out of bounds writeJohn Keeping Sat, 8 Mar 2014 19:29:17 +0000 (19:29 +0000)

builtin/mv: fix out of bounds write

When commit a88c915 (mv: move submodules using a gitfile, 2013-07-30)
added the submodule_gitfile array, it was not added to the block that
enlarges the arrays when we are moving a directory so that we do not
have to worry about it being a directory when we perform the actual
move. After this, the loop continues over the enlarged set of sources.

Since we assume that submodule_gitfile has size argc, if any of the
items in the source directory are submodules we are guaranteed to write
beyond the end of submodule_gitfile.

Fix this by realloc'ing submodule_gitfile at the same time as the other
arrays.

Reported-by: Guillaume Gelin <contact@ramnes.eu>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-am: Document supported --patch-format... Chris Packham Tue, 11 Mar 2014 03:51:57 +0000 (16:51 +1300)

Documentation/git-am: Document supported --patch-format options

The --patch-format option has been supported for a while but it is not
mentioned in the man page and the short help cannot tell the user what
the supported formats are. Add the option to the man page along with the
supported options.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

configure.ac: link with -liconv for locale_charset()Dmitry Marakasov Tue, 11 Mar 2014 18:35:29 +0000 (22:35 +0400)

configure.ac: link with -liconv for locale_charset()

On e.g. FreeBSD 10.x, the following situation is common:
- there's iconv implementation in libc, which has no locale_charset()
function
- there's GNU libiconv installed from Ports Collection

Git build process
- detects that iconv is in libc and thus -liconv is not needed for it
- detects locale_charset in -liconv, but for some reason doesn't add it
to CHARSET_LIB (as it would do with -lcharset if locale_charset() was
found there instead of -liconv)
- git doesn't build due to unresolved external locale_charset()

Fix this by adding -liconv to CHARSET_LIB if locale_charset() is
detected in this library.

Signed-off-by: Dmitry Marakasov <amdmi3@amdmi3.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

upload-pack: send shallow info over stdin to pack-objectsNguyễn Thái Ngọc Duy Tue, 11 Mar 2014 12:59:46 +0000 (19:59 +0700)

upload-pack: send shallow info over stdin to pack-objects

Before cdab485 (upload-pack: delegate rev walking in shallow fetch to
pack-objects - 2013-08-16) upload-pack does not write to the source
repository. cdab485 starts to write $GIT_DIR/shallow_XXXXXX if it's a
shallow fetch, so the source repo must be writable.

git:// servers do not need write access to repos and usually don't
have it, which means cdab485 breaks shallow clone over git://

Instead of using a temporary file as the media for shallow points, we
can send them over stdin to pack-objects as well. Prepend shallow
SHA-1 with --shallow so pack-objects knows what is what.

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

clean: simplify dir/not-dir logicJeff King Mon, 10 Mar 2014 17:24:47 +0000 (13:24 -0400)

clean: simplify dir/not-dir logic

When we get a list of paths from read_directory, we further
prune it to create the final list of items to remove. The
code paths for directories and non-directories repeat the
same "add to list" code.

This patch restructures the code so that we don't repeat
ourselves. Also, by following a "if (condition) continue"
pattern like the pathspec check above, it makes it more
obvious that the conditional is about excluding directories
under certain circumstances.

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

clean: respect pathspecs with "-d"Jeff King Mon, 10 Mar 2014 20:37:30 +0000 (16:37 -0400)

clean: respect pathspecs with "-d"

git-clean uses read_directory to fill in a `struct dir` with
potential hits. However, read_directory does not actually
check against our pathspec. It uses a simplified version
that may turn up false positives. As a result, we need to
check that any hits match our pathspec. We do so reliably
for non-directories. For directories, if "-d" is not given
we check that the pathspec matched exactly (i.e., we are
even stricter, and require an explicit "git clean foo" to
clean "foo/"). But if "-d" is given, rather than relaxing
the exact match to allow a recursive match, we do not check
the pathspec at all.

This regression was introduced in 113f10f (Make git-clean a
builtin, 2007-11-11).

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

t0008: skip trailing space test on WindowsJohannes Sixt Tue, 11 Mar 2014 07:46:40 +0000 (08:46 +0100)

t0008: skip trailing space test on Windows

The Windows API does not preserve file names with trailing spaces (and
dots), but rather strips them. Our tools (MSYS bash, git) base the POSIX
emulation on the Windows API. As a consequence, it is impossible for bash
on Windows to allocate a file whose name has trailing spaces, and for git
to stat such a file. Both operate on a file whose name has the spaces
stripped. Skip the test that needs such a file name.

Note that we do not use (another incarnation of) prerequisite FUNNYNAMES.
The reason is that FUNNYNAMES is intended to represent a property of the
file system. But the inability to have trailing spaces in a file name is
a property of the Windows API. The file system (NTFS) does not have this
limitation.

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

use strchrnul() in place of strchr() and strlen()Rohit Mani Sat, 8 Mar 2014 06:48:31 +0000 (22:48 -0800)

use strchrnul() in place of strchr() and strlen()

Avoid scanning strings twice, once with strchr() and then with
strlen(), by using strchrnul().

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Rohit Mani <rohit.mani@outlook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Start preparing for Git 2.0Junio C Hamano Fri, 7 Mar 2014 23:12:19 +0000 (15:12 -0800)

Start preparing for Git 2.0

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

Merge branch 'cc/starts-n-ends-with-endgame'Junio C Hamano Fri, 7 Mar 2014 23:18:17 +0000 (15:18 -0800)

Merge branch 'cc/starts-n-ends-with-endgame'

prefixcmp/suffixcmp are gone.

Merge branch 'jc/hold-diff-remove-q-synonym-for-no... Junio C Hamano Fri, 7 Mar 2014 23:17:40 +0000 (15:17 -0800)

Merge branch 'jc/hold-diff-remove-q-synonym-for-no-deletion'

Remove a confusing and deprecated "-q" option from "git diff-files";
"git diff-files --diff-filter=d" can be used instead.

Merge branch 'gj/push-more-verbose-advice'Junio C Hamano Fri, 7 Mar 2014 23:17:20 +0000 (15:17 -0800)

Merge branch 'gj/push-more-verbose-advice'

Merge branch 'jc/core-checkstat-2.0'Junio C Hamano Fri, 7 Mar 2014 23:16:22 +0000 (15:16 -0800)

Merge branch 'jc/core-checkstat-2.0'

"core.statinfo" configuration variable, which was a never-advertised
synonym to "core.checkstat", has been removed.

Merge branch 'jc/add-2.0-ignore-removal'Junio C Hamano Fri, 7 Mar 2014 23:14:47 +0000 (15:14 -0800)

Merge branch 'jc/add-2.0-ignore-removal'

"git add <pathspec>" is the same as "git add -A <pathspec>" now,
i.e. it does not ignore removals from the directory specified.

Merge branch 'jn/add-2.0-u-A-sans-pathspec'Junio C Hamano Fri, 7 Mar 2014 23:14:01 +0000 (15:14 -0800)

Merge branch 'jn/add-2.0-u-A-sans-pathspec'

"git add -u" and "git add -A" without any pathspec is a tree-wide
operation now, even when they are run in a subdirectory of the
working tree.

Merge branch 'jc/push-2.0-default-to-simple'Junio C Hamano Fri, 7 Mar 2014 23:13:15 +0000 (15:13 -0800)

Merge branch 'jc/push-2.0-default-to-simple'

Finally update the "git push" default behaviour to "simple".

tag: grok "--with" as synonym to "--contains"Junio C Hamano Fri, 7 Mar 2014 20:07:35 +0000 (12:07 -0800)

tag: grok "--with" as synonym to "--contains"

Just like "git branch" can be told to list the branches that has the
named commit by "git branch --with <commit>", teach the same
short-hand to "git tag", so that "git tag --with <commit>" shows the
releases with the named commit.

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

show_ident_date: fix tz range checkJeff King Fri, 7 Mar 2014 17:15:01 +0000 (12:15 -0500)

show_ident_date: fix tz range check

Commit 1dca155fe3fa (log: handle integer overflow in
timestamps, 2014-02-24) tried to catch integer overflow
coming from strtol() on the timezone field by comparing against
LONG_MIN/LONG_MAX. However, the intermediate "tz" variable
is an "int", which means it can never be LONG_MAX on LP64
systems; we would truncate the output from strtol before the
comparison.

Clang's -Wtautological-constant-out-of-range-compare notices
this and rightly complains.

Let's instead store the result of strtol in a long, and then
compare it against INT_MIN/INT_MAX. This will catch overflow
from strtol, and also overflow when we pass the result as an
int to show_date.

Reported-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

*.sh: drop useless use of "env"Junio C Hamano Thu, 6 Mar 2014 23:22:34 +0000 (15:22 -0800)

*.sh: drop useless use of "env"

In a bourne shell script, "VAR=VAL command" is sufficient to run
'command' with environment variable VAR set to value VAL without
affecting the environment of the shell itself; there is no need
to say "env VAR=VAL command".

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

Use hashcpy() when copying object namesSun He Mon, 3 Mar 2014 09:39:59 +0000 (17:39 +0800)

Use hashcpy() when copying object names

We invented hashcpy() to keep the abstraction of "object name"
behind it. Use it instead of calling memcpy() with hard-coded
20-byte length when moving object names between pieces of memory.

Leave ppc/sha1.c as-is, because the function is about the SHA-1 hash
algorithm whose output is and will always be 20 bytes.

Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Helped-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Sun He <sunheehnus@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: use skip_prefix() in install_branch_config()Brian Gesiak Fri, 28 Feb 2014 06:43:33 +0000 (15:43 +0900)

branch: use skip_prefix() in install_branch_config()

The install_branch_config() function reimplemented the skip_prefix()
function inline.

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

t3200-branch: test setting branch as own upstreamBrian Gesiak Wed, 5 Mar 2014 07:31:55 +0000 (16:31 +0900)

t3200-branch: test setting branch as own upstream

No test asserts that "git branch -u refs/heads/my-branch my-branch"
avoids leaving nonsense configuration and emits a warning.

Add a test that does so.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 5 Mar 2014 23:06:59 +0000 (15:06 -0800)

Merge branch 'maint'

* maint:
i18n: proposed command missing leading dash

Merge branch 'jk/run-network-tests-by-default'Junio C Hamano Wed, 5 Mar 2014 23:06:42 +0000 (15:06 -0800)

Merge branch 'jk/run-network-tests-by-default'

Teach "make test" to run networking tests when possible by default.

* jk/run-network-tests-by-default:
tests: turn on network daemon tests by default

Merge branch 'nd/daemonize-gc'Junio C Hamano Wed, 5 Mar 2014 23:06:38 +0000 (15:06 -0800)

Merge branch 'nd/daemonize-gc'

Allow running "gc --auto" in the background.

* nd/daemonize-gc:
gc: config option for running --auto in background
daemon: move daemonize() to libgit.a

Merge branch 'ks/combine-diff'Junio C Hamano Wed, 5 Mar 2014 23:06:26 +0000 (15:06 -0800)

Merge branch 'ks/combine-diff'

Teach combine-diff to honour the path-output-order imposed by
diffcore-order, and optimize how matching paths are found in
the N-way diffs made with parents.

* ks/combine-diff:
tests: add checking that combine-diff emits only correct paths
combine-diff: simplify intersect_paths() further
combine-diff: combine_diff_path.len is not needed anymore
combine-diff: optimize combine_diff_path sets intersection
diff test: add tests for combine-diff with orderfile
diffcore-order: export generic ordering interface

push: detect local refspec errors earlyJeff King Wed, 5 Mar 2014 19:04:54 +0000 (14:04 -0500)

push: detect local refspec errors early

When pushing, we do not even look at our push refspecs until
after we have made contact with the remote receive-pack and
gotten its list of refs. This means that we may go to some
work, including asking the user to log in, before realizing
we have simple errors like "git push origin matser".

We cannot catch all refspec problems, since fully evaluating
the refspecs requires knowing what the remote side has. But
we can do a quick sanity check of the local side and catch a
few simple error cases.

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

match_explicit_lhs: allow a "verify only" modeJeff King Wed, 5 Mar 2014 19:03:43 +0000 (14:03 -0500)

match_explicit_lhs: allow a "verify only" mode

The match_explicit_lhs function has all of the logic
necessary to verify the refspecs without actually doing any
work. This patch lets callers pass a NULL "match" pointer to
indicate they want a "verify only" operation.

For the most part, we just need to avoid writing to the NULL
pointer. However, we also have to refactor the
try_explicit_object_name sub-function; it indicates success by
allocating and returning a new ref. Instead, we give it an
"out" parameter for the match and return a numeric status.

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

match_explicit: hoist refspec lhs checks into their... Jeff King Wed, 5 Mar 2014 19:03:21 +0000 (14:03 -0500)

match_explicit: hoist refspec lhs checks into their own function

In preparation for being able to check the left-hand side of
our push refspecs separately, this pulls the examination of
them out into its own function. There should be no behavior
change.

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

cache_tree_find(): use path variable when passing over... Michael Haggerty Wed, 5 Mar 2014 17:26:30 +0000 (18:26 +0100)

cache_tree_find(): use path variable when passing over slashes

The search for the end of the slashes is part of the update of the
path variable for the next iteration as opposed to an update of the
slash variable. So iterate using path rather than slash.

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

cache_tree_find(): remove early returnMichael Haggerty Wed, 5 Mar 2014 17:26:29 +0000 (18:26 +0100)

cache_tree_find(): remove early return

There is no need for an early

return it;

from the loop if slash points at the end of the string, because that
is exactly what will happen when the while condition fails at the
start of the next iteration.

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

cache_tree_find(): remove redundant checkMichael Haggerty Wed, 5 Mar 2014 17:26:28 +0000 (18:26 +0100)

cache_tree_find(): remove redundant check

If *slash == '/', then it is necessarily non-NUL.

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

cache_tree_find(): fix comment formattingMichael Haggerty Wed, 5 Mar 2014 17:26:27 +0000 (18:26 +0100)

cache_tree_find(): fix comment formatting

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

cache_tree_find(): find the end of path component using... Michael Haggerty Wed, 5 Mar 2014 17:26:26 +0000 (18:26 +0100)

cache_tree_find(): find the end of path component using strchrnul()

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

cache_tree_find(): remove redundant checksMichael Haggerty Wed, 5 Mar 2014 17:26:25 +0000 (18:26 +0100)

cache_tree_find(): remove redundant checks

slash is initialized to a value that cannot be NULL. So remove the
guards against slash == NULL later in the loop.

Suggested-by: David Kastrup <dak@gnu.org>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch.c: delete size check of newly tracked branch... Jacopo Notarstefano Fri, 28 Feb 2014 11:09:04 +0000 (12:09 +0100)

branch.c: delete size check of newly tracked branch names

Since commit 6f084a56 the length of a newly tracked branch name was limited
to 1019 = 1024 - 7 - 7 - 1 characters, a bound derived by having to store
this name in a char[1024] called key with two strings of length at most 7
and a '\0' character.

This was no longer necessary as of commit a9f2c136, which uses a strbuf
(documented in Documentation/technical/api-strbuf.txt) to store this value.

Remove this unneeded check to allow branch names longer than 1019
characters.

Signed-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs: mark info/grafts as outdatedJeff King Wed, 5 Mar 2014 19:28:38 +0000 (14:28 -0500)

docs: mark info/grafts as outdated

We should be encouraging people to use git-replace instead.

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

t7800: add a difftool test for .git-filesJunio C Hamano Wed, 5 Mar 2014 09:23:35 +0000 (01:23 -0800)

t7800: add a difftool test for .git-files

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: proposed command missing leading dashSandy Carter Mon, 3 Mar 2014 14:55:53 +0000 (09:55 -0500)

i18n: proposed command missing leading dash

Add missing leading dash to proposed commands in french output when
using the command:
git branch --set-upstream remotename/branchname
and when upstream is gone

Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit.c: use skip_prefix() instead of starts_with()Tanay Abhra Tue, 4 Mar 2014 21:06:30 +0000 (13:06 -0800)

commit.c: use skip_prefix() instead of starts_with()

In record_author_date() & parse_gpg_output(), the callers of
starts_with() not just want to know if the string starts with the
prefix, but also can benefit from knowing the string that follows
the prefix.

By using skip_prefix(), we can do both at the same time.

Helped-by: Max Horn <max@quendi.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-bisect.sh: fix a few style issuesJacopo Notarstefano Tue, 4 Mar 2014 00:21:43 +0000 (01:21 +0100)

git-bisect.sh: fix a few style issues

Redirection operators should have a space before them, but not after them.

Signed-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

skip_prefix(): scan prefix only onceDavid Kastrup Mon, 3 Mar 2014 23:22:15 +0000 (00:22 +0100)

skip_prefix(): scan prefix only once

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file.c: use ALLOC_GROW() in pretend_sha1_file()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:32:02 +0000 (02:32 +0400)

sha1_file.c: use ALLOC_GROW() in pretend_sha1_file()

Helped-by: He Sun <sunheehnus@gmail.com>
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read-cache.c: use ALLOC_GROW() in add_index_entry()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:32:01 +0000 (02:32 +0400)

read-cache.c: use ALLOC_GROW() in add_index_entry()

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/mktree.c: use ALLOC_GROW() in append_to_tree()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:32:00 +0000 (02:32 +0400)

builtin/mktree.c: use ALLOC_GROW() in append_to_tree()

Helped-by: He Sun <sunheehnus@gmail.com>
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr.c: use ALLOC_GROW() in handle_attr_line()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:31:59 +0000 (02:31 +0400)

attr.c: use ALLOC_GROW() in handle_attr_line()

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir.c: use ALLOC_GROW() in create_simplify()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:31:58 +0000 (02:31 +0400)

dir.c: use ALLOC_GROW() in create_simplify()

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reflog-walk.c: use ALLOC_GROW()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:31:57 +0000 (02:31 +0400)

reflog-walk.c: use ALLOC_GROW()

Use ALLOC_GROW() instead of open-coding it in add_commit_info() and
read_one_reflog().

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace_object.c: use ALLOC_GROW() in register_replace_... Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:31:56 +0000 (02:31 +0400)

replace_object.c: use ALLOC_GROW() in register_replace_object()

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

patch-ids.c: use ALLOC_GROW() in add_commit()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:31:55 +0000 (02:31 +0400)

patch-ids.c: use ALLOC_GROW() in add_commit()

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diffcore-rename.c: use ALLOC_GROW()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:31:54 +0000 (02:31 +0400)

diffcore-rename.c: use ALLOC_GROW()

Use ALLOC_GROW() instead of open-coding it in locate_rename_dst()
and register_rename_src().

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff.c: use ALLOC_GROW()Dmitry S. Dolzhenko Mon, 3 Mar 2014 22:31:53 +0000 (02:31 +0400)

diff.c: use ALLOC_GROW()

Use ALLOC_GROW() instead of open-coding it in diffstat_add() and
diff_q().

Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>