gitweb.git
Merge branch 'vn/revision-shorthand-for-side-branch... Junio C Hamano Thu, 6 Oct 2016 21:53:10 +0000 (14:53 -0700)

Merge branch 'vn/revision-shorthand-for-side-branch-log'

"git log rev^..rev" is an often-used revision range specification
to show what was done on a side branch merged at rev. This has
gained a short-hand "rev^-1". In general "rev^-$n" is the same as
"^rev^$n rev", i.e. what has happened on other branches while the
history leading to nth parent was looking the other way.

* vn/revision-shorthand-for-side-branch-log:
revision: new rev^-n shorthand for rev^n..rev

Merge branch 'jk/ambiguous-short-object-names'Junio C Hamano Thu, 6 Oct 2016 21:53:10 +0000 (14:53 -0700)

Merge branch 'jk/ambiguous-short-object-names'

When given an abbreviated object name that is not (or more
realistically, "no longer") unique, we gave a fatal error
"ambiguous argument". This error is now accompanied by hints that
lists the objects that begins with the given prefix. During the
course of development of this new feature, numerous minor bugs were
uncovered and corrected, the most notable one of which is that we
gave "short SHA1 xxxx is ambiguous." twice without good reason.

* jk/ambiguous-short-object-names:
get_short_sha1: make default disambiguation configurable
get_short_sha1: list ambiguous objects on error
for_each_abbrev: drop duplicate objects
sha1_array: let callbacks interrupt iteration
get_short_sha1: mark ambiguity error for translation
get_short_sha1: NUL-terminate hex prefix
get_short_sha1: refactor init of disambiguation code
get_short_sha1: parse tags when looking for treeish
get_sha1: propagate flags to child functions
get_sha1: avoid repeating ourselves via ONLY_TO_DIE
get_sha1: detect buggy calls with multiple disambiguators

Sync with 2.10.1Junio C Hamano Mon, 3 Oct 2016 20:32:41 +0000 (13:32 -0700)

Sync with 2.10.1

* maint:
Git 2.10.1

Seventh batch for 2.11Junio C Hamano Mon, 3 Oct 2016 20:32:19 +0000 (13:32 -0700)

Seventh batch for 2.11

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

Merge branch 'pb/rev-list-reverse-with-count'Junio C Hamano Mon, 3 Oct 2016 20:30:39 +0000 (13:30 -0700)

Merge branch 'pb/rev-list-reverse-with-count'

Doc update to clarify what "log -3 --reverse" does.

* pb/rev-list-reverse-with-count:
rev-list-options: clarify the usage of --reverse

Merge branch 'dt/tree-fsck'Junio C Hamano Mon, 3 Oct 2016 20:30:38 +0000 (13:30 -0700)

Merge branch 'dt/tree-fsck'

The codepath in "git fsck" to detect malformed tree objects has
been updated not to die but keep going after detecting them.

* dt/tree-fsck:
fsck: handle bad trees like other errors
tree-walk: be more specific about corrupt tree errors

Merge branch 'kd/mailinfo-quoted-string'Junio C Hamano Mon, 3 Oct 2016 20:30:38 +0000 (13:30 -0700)

Merge branch 'kd/mailinfo-quoted-string'

An author name, that spelled a backslash-quoted double quote in the
human readable part "My \"double quoted\" name", was not unquoted
correctly while applying a patch from a piece of e-mail.

* kd/mailinfo-quoted-string:
mailinfo: unescape quoted-pair in header fields
t5100-mailinfo: replace common path prefix with variable

Merge branch 'mh/diff-indent-heuristic'Junio C Hamano Mon, 3 Oct 2016 20:30:38 +0000 (13:30 -0700)

Merge branch 'mh/diff-indent-heuristic'

Clean-up for a recently graduated topic.

* mh/diff-indent-heuristic:
xdiff: rename "struct group" to "struct xdlgroup"

Merge branch 'dt/mailinfo'Junio C Hamano Mon, 3 Oct 2016 20:30:37 +0000 (13:30 -0700)

Merge branch 'dt/mailinfo'

* dt/mailinfo:
add David Turner's Two Sigma address

Merge branch 'va/git-gui-i18n'Junio C Hamano Mon, 3 Oct 2016 20:30:37 +0000 (13:30 -0700)

Merge branch 'va/git-gui-i18n'

"git gui" l10n to Portuguese.

* va/git-gui-i18n:
git-gui: l10n: add Portuguese translation
git-gui i18n: mark strings for translation

Merge branch 'rs/git-gui-use-modern-git-merge-syntax'Junio C Hamano Mon, 3 Oct 2016 20:30:36 +0000 (13:30 -0700)

Merge branch 'rs/git-gui-use-modern-git-merge-syntax'

The original command line syntax for "git merge", which was "git
merge <msg> HEAD <parent>...", has been deprecated for quite some
time, and "git gui" was the last in-tree user of the syntax. This
is finally fixed, so that we can move forward with the deprecation.

* rs/git-gui-use-modern-git-merge-syntax:
git-gui: stop using deprecated merge syntax

Merge branch 'jc/verify-loose-object-header'Junio C Hamano Mon, 3 Oct 2016 20:30:36 +0000 (13:30 -0700)

Merge branch 'jc/verify-loose-object-header'

Codepaths that read from an on-disk loose object were too loose in
validating what they are reading is a proper object file and
sometimes read past the data they read from the disk, which has
been corrected. H/t to Gustavo Grieco for reporting.

* jc/verify-loose-object-header:
unpack_sha1_header(): detect malformed object header
streaming: make sure to notice corrupt object

Merge branch 'nd/init-core-worktree-in-multi-worktree... Junio C Hamano Mon, 3 Oct 2016 20:30:34 +0000 (13:30 -0700)

Merge branch 'nd/init-core-worktree-in-multi-worktree-world'

"git init" tried to record core.worktree in the repository's
'config' file when GIT_WORK_TREE environment variable was set and
it was different from where GIT_DIR appears as ".git" at its top,
but the logic was faulty when .git is a "gitdir:" file that points
at the real place, causing trouble in working trees that are
managed by "git worktree". This has been corrected.

* nd/init-core-worktree-in-multi-worktree-world:
init: kill git_link variable
init: do not set unnecessary core.worktree
init: kill set_git_dir_init()
init: call set_git_dir_init() from within init_db()
init: correct re-initialization from a linked worktree

Merge branch 'ik/gitweb-force-highlight'Junio C Hamano Mon, 3 Oct 2016 20:30:33 +0000 (13:30 -0700)

Merge branch 'ik/gitweb-force-highlight'

"gitweb" can spawn "highlight" to show blob contents with
(programming) language-specific syntax highlighting, but only
when the language is known. "highlight" can however be told
to make the guess itself by giving it "--force" option, which
has been enabled.

* ik/gitweb-force-highlight:
gitweb: use highlight's shebang detection
gitweb: remove unused guess_file_syntax() parameter

Merge branch 'rs/copy-array'Junio C Hamano Mon, 3 Oct 2016 20:30:33 +0000 (13:30 -0700)

Merge branch 'rs/copy-array'

Code cleanup.

* rs/copy-array:
use COPY_ARRAY
add COPY_ARRAY

Git 2.10.1 v2.10.1Junio C Hamano Mon, 3 Oct 2016 20:24:18 +0000 (13:24 -0700)

Git 2.10.1

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

Merge branch 'jk/ident-ai-canonname-could-be-null'... Junio C Hamano Mon, 3 Oct 2016 20:22:32 +0000 (13:22 -0700)

Merge branch 'jk/ident-ai-canonname-could-be-null' into maint

In the codepath that comes up with the hostname to be used in an
e-mail when the user didn't tell us, we looked at ai_canonname
field in struct addrinfo without making sure it is not NULL first.

* jk/ident-ai-canonname-could-be-null:
ident: handle NULL ai_canonname

Merge branch 'jk/doc-cvs-update' into maintJunio C Hamano Mon, 3 Oct 2016 20:22:25 +0000 (13:22 -0700)

Merge branch 'jk/doc-cvs-update' into maint

Documentation around tools to import from CVS was fairly outdated.

* jk/doc-cvs-update:
docs/cvs-migration: mention cvsimport caveats
docs/cvs-migration: update link to cvsps homepage
docs/cvsimport: prefer cvs-fast-export to parsecvs

Merge branch 'jk/pack-tag-of-tag' into maintJunio C Hamano Mon, 3 Oct 2016 20:22:13 +0000 (13:22 -0700)

Merge branch 'jk/pack-tag-of-tag' into maint

"git pack-objects --include-tag" was taught that when we know that
we are sending an object C, we want a tag B that directly points at
C but also a tag A that points at the tag B. We used to miss the
intermediate tag B in some cases.

* jk/pack-tag-of-tag:
pack-objects: walk tag chains for --include-tag
t5305: simplify packname handling
t5305: use "git -C"
t5305: drop "dry-run" of unpack-objects
t5305: move cleanup into test block

Sync with maintJunio C Hamano Thu, 29 Sep 2016 23:58:29 +0000 (16:58 -0700)

Sync with maint

* maint:
Prepare for 2.10.1

Sixth batch for 2.11Junio C Hamano Thu, 29 Sep 2016 23:58:20 +0000 (16:58 -0700)

Sixth batch for 2.11

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

Merge branch 'jc/worktree-config'Junio C Hamano Thu, 29 Sep 2016 23:57:14 +0000 (16:57 -0700)

Merge branch 'jc/worktree-config'

"git worktree", even though it used the default_abbrev setting that
ought to be affected by core.abbrev configuration variable, ignored
the variable setting. The command has been taught to read the
default set of configuration variables to correct this.

* jc/worktree-config:
worktree: honor configuration variables

Merge branch 'jk/ident-ai-canonname-could-be-null'Junio C Hamano Thu, 29 Sep 2016 23:57:14 +0000 (16:57 -0700)

Merge branch 'jk/ident-ai-canonname-could-be-null'

In the codepath that comes up with the hostname to be used in an
e-mail when the user didn't tell us, we looked at ai_canonname
field in struct addrinfo without making sure it is not NULL first.

* jk/ident-ai-canonname-could-be-null:
ident: handle NULL ai_canonname

Merge branch 'jt/fetch-pack-in-vain-count-with-stateless'Junio C Hamano Thu, 29 Sep 2016 23:57:13 +0000 (16:57 -0700)

Merge branch 'jt/fetch-pack-in-vain-count-with-stateless'

When "git fetch" tries to find where the history of the repository
it runs in has diverged from what the other side has, it has a
mechanism to avoid digging too deep into irrelevant side branches.
This however did not work well over the "smart-http" transport due
to a design bug, which has been fixed.

* jt/fetch-pack-in-vain-count-with-stateless:
fetch-pack: do not reset in_vain on non-novel acks

Merge branch 'jk/verify-packfile-gently'Junio C Hamano Thu, 29 Sep 2016 23:57:13 +0000 (16:57 -0700)

Merge branch 'jk/verify-packfile-gently'

A low-level function verify_packfile() was meant to show errors
that were detected without dying itself, but under some conditions
it didn't and died instead, which has been fixed.

* jk/verify-packfile-gently:
verify_packfile: check pack validity before accessing data

Merge branch 'jt/mailinfo-fold-in-body-headers'Junio C Hamano Thu, 29 Sep 2016 23:57:12 +0000 (16:57 -0700)

Merge branch 'jt/mailinfo-fold-in-body-headers'

When "git format-patch --stdout" output is placed as an in-body
header and it uses the RFC2822 header folding, "git am" failed to
put the header line back into a single logical line. The
underlying "git mailinfo" was taught to handle this properly.

* jt/mailinfo-fold-in-body-headers:
mailinfo: handle in-body header continuations
mailinfo: make is_scissors_line take plain char *
mailinfo: separate in-body header processing

Prepare for 2.10.1Junio C Hamano Thu, 29 Sep 2016 23:51:09 +0000 (16:51 -0700)

Prepare for 2.10.1

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

Merge branch 'tg/add-chmod+x-fix' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:47 +0000 (16:49 -0700)

Merge branch 'tg/add-chmod+x-fix' into maint

"git add --chmod=+x <pathspec>" added recently only toggled the
executable bit for paths that are either new or modified. This has
been corrected to flip the executable bit for all paths that match
the given pathspec.

* tg/add-chmod+x-fix:
t3700-add: do not check working tree file mode without POSIXPERM
t3700-add: create subdirectory gently
add: modify already added files when --chmod is given
read-cache: introduce chmod_index_entry
update-index: add test for chmod flags

Merge branch 'et/add-chmod-x' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:46 +0000 (16:49 -0700)

Merge branch 'et/add-chmod-x' into maint

"git add --chmod=+x" added recently lacked documentation, which has
been corrected.

* et/add-chmod-x:
add: document the chmod option

Merge branch 'rt/rebase-i-broken-insn-advise' into... Junio C Hamano Thu, 29 Sep 2016 23:49:46 +0000 (16:49 -0700)

Merge branch 'rt/rebase-i-broken-insn-advise' into maint

When "git rebase -i" is given a broken instruction, it told the
user to fix it with "--edit-todo", but didn't say what the step
after that was (i.e. "--continue").

* rt/rebase-i-broken-insn-advise:
rebase -i: improve advice on bad instruction lines

Merge branch 'ls/travis-homebrew-path-fix' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:45 +0000 (16:49 -0700)

Merge branch 'ls/travis-homebrew-path-fix' into maint

The procedure to build Git on Mac OS X for Travis CI hardcoded the
internal directory structure we assumed HomeBrew uses, which was a
no-no. The procedure has been updated to ask HomeBrew things we
need to know to fix this.

* ls/travis-homebrew-path-fix:
travis-ci: ask homebrew for its path instead of hardcoding it

Merge branch 'js/regexec-buf' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:44 +0000 (16:49 -0700)

Merge branch 'js/regexec-buf' into maint

Some codepaths in "git diff" used regexec(3) on a buffer that was
mmap(2)ed, which may not have a terminating NUL, leading to a read
beyond the end of the mapped region. This was fixed by introducing
a regexec_buf() helper that takes a <ptr,len> pair with REG_STARTEND
extension.

* js/regexec-buf:
regex: use regexec_buf()
regex: add regexec_buf() that can work on a non NUL-terminated string
regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails

Merge branch 'nd/checkout-disambiguation' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:43 +0000 (16:49 -0700)

Merge branch 'nd/checkout-disambiguation' into maint

"git checkout <word>" does not follow the usual disambiguation
rules when the <word> can be both a rev and a path, to allow
checking out a branch 'foo' in a project that happens to have a
file 'foo' in the working tree without having to disambiguate.
This was poorly documented and the check was incorrect when the
command was run from a subdirectory.

* nd/checkout-disambiguation:
checkout: fix ambiguity check in subdir
checkout.txt: document a common case that ignores ambiguation rules
checkout: add some spaces between code and comment

Merge branch 'ep/doc-check-ref-format-example' into... Junio C Hamano Thu, 29 Sep 2016 23:49:43 +0000 (16:49 -0700)

Merge branch 'ep/doc-check-ref-format-example' into maint

A shell script example in check-ref-format documentation has been
fixed.

* ep/doc-check-ref-format-example:
git-check-ref-format.txt: fixup documentation

Merge branch 'mm/config-color-ui-default-to-auto' into... Junio C Hamano Thu, 29 Sep 2016 23:49:42 +0000 (16:49 -0700)

Merge branch 'mm/config-color-ui-default-to-auto' into maint

Documentation for individual configuration variables to control use
of color (like `color.grep`) said that their default value is
'false', instead of saying their default is taken from `color.ui`.
When we updated the default value for color.ui from 'false' to
'auto' quite a while ago, all of them broke. This has been
corrected.

* mm/config-color-ui-default-to-auto:
Documentation/config: default for color.* is color.ui

Merge branch 'jk/reduce-gc-aggressive-depth' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:42 +0000 (16:49 -0700)

Merge branch 'jk/reduce-gc-aggressive-depth' into maint

"git gc --aggressive" used to limit the delta-chain length to 250,
which is way too deep for gaining additional space savings and is
detrimental for runtime performance. The limit has been reduced to
50.

* jk/reduce-gc-aggressive-depth:
gc: default aggressive depth to 50

Merge branch 'jk/rebase-i-drop-ident-check' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:41 +0000 (16:49 -0700)

Merge branch 'jk/rebase-i-drop-ident-check' into maint

Even when "git pull --rebase=preserve" (and the underlying "git
rebase --preserve") can complete without creating any new commit
(i.e. fast-forwards), it still insisted on having a usable ident
information (read: user.email is set correctly), which was less
than nice. As the underlying commands used inside "git rebase"
would fail with a more meaningful error message and advice text
when the bogus ident matters, this extra check was removed.

* jk/rebase-i-drop-ident-check:
rebase-interactive: drop early check for valid ident

Merge branch 'jt/format-patch-base-info-above-sig'... Junio C Hamano Thu, 29 Sep 2016 23:49:40 +0000 (16:49 -0700)

Merge branch 'jt/format-patch-base-info-above-sig' into maint

"git format-patch --base=..." feature that was recently added
showed the base commit information after "-- " e-mail signature
line, which turned out to be inconvenient. The base information
has been moved above the signature line.

* jt/format-patch-base-info-above-sig:
format-patch: show base info before email signature

Merge branch 'ks/perf-build-with-autoconf' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:40 +0000 (16:49 -0700)

Merge branch 'ks/perf-build-with-autoconf' into maint

Performance tests done via "t/perf" did not use the same set of
build configuration if the user relied on autoconf generated
configuration.

* ks/perf-build-with-autoconf:
t/perf/run: copy config.mak.autogen & friends to build area

Merge branch 'rs/xdiff-merge-overlapping-hunks-for... Junio C Hamano Thu, 29 Sep 2016 23:49:39 +0000 (16:49 -0700)

Merge branch 'rs/xdiff-merge-overlapping-hunks-for-W-context' into maint

"git diff -W" output needs to extend the context backward to
include the header line of the current function and also forward to
include the body of the entire current function up to the header
line of the next one. This process may have to merge to adjacent
hunks, but the code forgot to do so in some cases.

* rs/xdiff-merge-overlapping-hunks-for-W-context:
xdiff: fix merging of hunks with -W context and -u context

Merge branch 'ew/http-do-not-forget-to-call-curl-multi... Junio C Hamano Thu, 29 Sep 2016 23:49:39 +0000 (16:49 -0700)

Merge branch 'ew/http-do-not-forget-to-call-curl-multi-remove-handle' into maint

The http transport (with curl-multi option, which is the default
these days) failed to remove curl-easy handle from a curlm session,
which led to unnecessary API failures.

* ew/http-do-not-forget-to-call-curl-multi-remove-handle:
http: always remove curl easy from curlm session on release
http: consolidate #ifdefs for curl_multi_remove_handle
http: warn on curl_multi_add_handle failures

Merge branch 'jk/patch-ids-no-merges' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:38 +0000 (16:49 -0700)

Merge branch 'jk/patch-ids-no-merges' into maint

"git log --cherry-pick" used to include merge commits as candidates
to be matched up with other commits, resulting a lot of wasted time.
The patch-id generation logic has been updated to ignore merges to
avoid the wastage.

* jk/patch-ids-no-merges:
patch-ids: refuse to compute patch-id for merge commit
patch-ids: turn off rename detection

Merge branch 'js/git-gui-commit-gpgsign' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:38 +0000 (16:49 -0700)

Merge branch 'js/git-gui-commit-gpgsign' into maint

"git commit-tree" stopped reading commit.gpgsign configuration
variable that was meant for Porcelain "git commit" in Git 2.9; we
forgot to update "git gui" to look at the configuration to match
this change.

* js/git-gui-commit-gpgsign:
git-gui: respect commit.gpgsign again

Merge branch 'jk/fix-remote-curl-url-wo-proto' into... Junio C Hamano Thu, 29 Sep 2016 23:49:38 +0000 (16:49 -0700)

Merge branch 'jk/fix-remote-curl-url-wo-proto' into maint

"git fetch http::/site/path" did not die correctly and segfaulted
instead.

* jk/fix-remote-curl-url-wo-proto:
remote-curl: handle URLs without protocol

Merge branch 'sy/git-gui-i18n-ja' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:37 +0000 (16:49 -0700)

Merge branch 'sy/git-gui-i18n-ja' into maint

Update Japanese translation for "git-gui".

* sy/git-gui-i18n-ja:
git-gui: update Japanese information
git-gui: update Japanese translation
git-gui: add Japanese language code
git-gui: apply po template to Japanese translation
git-gui: consistently use the same word for "blame" in Japanese
git-gui: consistently use the same word for "remote" in Japanese

Merge branch 'mr/vcs-svn-printf-ulong' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:37 +0000 (16:49 -0700)

Merge branch 'mr/vcs-svn-printf-ulong' into maint

Code cleanup.

* mr/vcs-svn-printf-ulong:
vcs-svn/fast_export: fix timestamp fmt specifiers

Merge branch 'rs/unpack-trees-reduce-file-scope-global... Junio C Hamano Thu, 29 Sep 2016 23:49:36 +0000 (16:49 -0700)

Merge branch 'rs/unpack-trees-reduce-file-scope-global' into maint

Code cleanup.

* rs/unpack-trees-reduce-file-scope-global:
unpack-trees: pass checkout state explicitly to check_updates()

Merge branch 'rs/strbuf-remove-fix' into maintJunio C Hamano Thu, 29 Sep 2016 23:49:35 +0000 (16:49 -0700)

Merge branch 'rs/strbuf-remove-fix' into maint

Code cleanup.

* rs/strbuf-remove-fix:
strbuf: use valid pointer in strbuf_remove()

Merge branch 'rs/checkout-some-states-are-const' into... Junio C Hamano Thu, 29 Sep 2016 23:49:35 +0000 (16:49 -0700)

Merge branch 'rs/checkout-some-states-are-const' into maint

Code cleanup.

* rs/checkout-some-states-are-const:
checkout: constify parameters of checkout_stage() and checkout_merged()

Merge branch 'bw/pathspec-remove-unused-extern-decl... Junio C Hamano Thu, 29 Sep 2016 23:49:34 +0000 (16:49 -0700)

Merge branch 'bw/pathspec-remove-unused-extern-decl' into maint

Code cleanup.

* bw/pathspec-remove-unused-extern-decl:
pathspec: remove unnecessary function prototypes

mailinfo: unescape quoted-pair in header fieldsKevin Daudt Wed, 28 Sep 2016 19:52:32 +0000 (21:52 +0200)

mailinfo: unescape quoted-pair in header fields

rfc2822 has provisions for quoted strings in structured header fields,
but also allows for escaping these with so-called quoted-pairs.

The only thing git currently does is removing exterior quotes, but
quotes within are left alone.

Remove exterior quotes and remove escape characters so that they don't
show up in the author field.

Signed-off-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5100-mailinfo: replace common path prefix with variableKevin Daudt Wed, 28 Sep 2016 19:52:31 +0000 (21:52 +0200)

t5100-mailinfo: replace common path prefix with variable

Many tests need to store data in a file, and repeat the same pattern to
refer to that path:

"$TEST_DIRECTORY"/t5100/

Create a variable that contains this path, and use that instead.

While we're making this change, make sure the quotes are not just around
the variable, but around the entire string to not give the impression
we want shell splitting to affect the other variables.

Signed-off-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list-options: clarify the usage of --reversePranit Bauva Tue, 27 Sep 2016 20:44:09 +0000 (20:44 +0000)

rev-list-options: clarify the usage of --reverse

Users often wonder if the oldest or the newest n commits are shown
by `log -n --reverse`. Clarify that --reverse kicks in only after
deciding which commits are to be shown to unconfuse them.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsck: handle bad trees like other errorsDavid Turner Tue, 27 Sep 2016 20:59:51 +0000 (16:59 -0400)

fsck: handle bad trees like other errors

Instead of dying when fsck hits a malformed tree object, log the error
like any other and continue. Now fsck can tell the user which tree is
bad, too.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree-walk: be more specific about corrupt tree errorsJeff King Tue, 27 Sep 2016 20:59:50 +0000 (16:59 -0400)

tree-walk: be more specific about corrupt tree errors

When the tree-walker runs into an error, it just calls
die(), and the message is always "corrupt tree file".
However, we are actually covering several cases here; let's
give the user a hint about what happened.

Let's also avoid using the word "corrupt", which makes it
seem like the data bit-rotted on disk. Our sha1 check would
already have found that. These errors are ones of data that
is malformed in the first place.

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

revision: new rev^-n shorthand for rev^n..revVegard Nossum Tue, 27 Sep 2016 08:32:49 +0000 (10:32 +0200)

revision: new rev^-n shorthand for rev^n..rev

"git log rev^..rev" is commonly used to show all work done on and merged
from a side branch. This patch introduces a shorthand "rev^-" for this
and additionally allows "rev^-$n" to mean "reachable from rev, excluding
what is reachable from the nth parent of rev". For example, for a
two-parent merge, you can use rev^-2 to get the set of commits which were
made to the main branch while the topic branch was prepared.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: honor configuration variablesJunio C Hamano Tue, 27 Sep 2016 06:49:39 +0000 (23:49 -0700)

worktree: honor configuration variables

The command accesses default_abbrev (defined in environment.c and is
updated via core.abbrev configuration), but never makes any call to
git_config(). The output from "worktree list" ignores the abbrev
setting for this reason.

Make a call to git_config() to read the default set of configuration
variables at the beginning of the command.

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

get_short_sha1: make default disambiguation configurableJeff King Tue, 27 Sep 2016 12:38:01 +0000 (08:38 -0400)

get_short_sha1: make default disambiguation configurable

When we find ambiguous short sha1s, we may get a
disambiguation rule from our caller's context. But if we
don't, we fall back to treating all sha1s the same, even
though most projects will tend to refer only to commits by
their short sha1s.

This patch introduces a configuration option that lets the
user pick a different fallback (e.g., only commits). It's
possible that we may want to make this the default, but it's
a good idea to start as a config option for two reasons:

1. It lets people experiment with this and see if it's a
good idea (i.e., the "tend to" above is an assumption;
we don't really know if this will break some obscure
cases).

2. Even if we do flip the default, it gives people an
escape hatch if it causes problems (you can sometimes
override it by asking for "1234^{tree}", but not all
combinations are possible).

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

xdiff: rename "struct group" to "struct xdlgroup"Jeff King Tue, 27 Sep 2016 04:37:33 +0000 (00:37 -0400)

xdiff: rename "struct group" to "struct xdlgroup"

Commit e8adf23 (xdl_change_compact(): introduce the concept
of a change group, 2016-08-22) added a "struct group" type
to xdiff/xdiffi.c. But the POSIX system header "grp.h"
already defines "struct group" (it is part of the getgrnam
interface). This happens to work because the new type is
local to xdiffi.c, and the xdiff code includes a relatively
small set of system headers. But it will break compilation
if xdiff ever switches to using git-compat-util.h. It can
also probably cause confusion with tools that look at the
whole code base, like coccinelle or ctags.

Let's resolve by giving the xdiff variant a scoped name,
which is closer to other xdiff types anyway (e.g.,
xdlfile_t, though note that xdiff is fond if typedefs when
Git usually is not).

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

add David Turner's Two Sigma addressDavid Turner Tue, 27 Sep 2016 00:11:33 +0000 (20:11 -0400)

add David Turner's Two Sigma address

Signed-off-by: David Turner <novalis@novalis.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fifth batch for 2.11Junio C Hamano Mon, 26 Sep 2016 23:11:46 +0000 (16:11 -0700)

Fifth batch for 2.11

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

Merge branch 'jk/clone-recursive-progress'Junio C Hamano Mon, 26 Sep 2016 23:09:22 +0000 (16:09 -0700)

Merge branch 'jk/clone-recursive-progress'

"git clone --recurse-submodules" lost the progress eye-candy in
recent update, which has been corrected.

* jk/clone-recursive-progress:
clone: pass --progress decision to recursive submodules

Merge branch 'jk/doc-cvs-update'Junio C Hamano Mon, 26 Sep 2016 23:09:22 +0000 (16:09 -0700)

Merge branch 'jk/doc-cvs-update'

Documentation around tools to import from CVS was fairly outdated.

* jk/doc-cvs-update:
docs/cvs-migration: mention cvsimport caveats
docs/cvs-migration: update link to cvsps homepage
docs/cvsimport: prefer cvs-fast-export to parsecvs

Merge branch 'rt/rebase-i-broken-insn-advise'Junio C Hamano Mon, 26 Sep 2016 23:09:21 +0000 (16:09 -0700)

Merge branch 'rt/rebase-i-broken-insn-advise'

When "git rebase -i" is given a broken instruction, it told the
user to fix it with "--edit-todo", but didn't say what the step
after that was (i.e. "--continue").

* rt/rebase-i-broken-insn-advise:
rebase -i: improve advice on bad instruction lines

Merge branch 'rs/checkout-init-macro'Junio C Hamano Mon, 26 Sep 2016 23:09:21 +0000 (16:09 -0700)

Merge branch 'rs/checkout-init-macro'

Code cleanup.

* rs/checkout-init-macro:
introduce CHECKOUT_INIT

Merge branch 'ls/travis-homebrew-path-fix'Junio C Hamano Mon, 26 Sep 2016 23:09:20 +0000 (16:09 -0700)

Merge branch 'ls/travis-homebrew-path-fix'

The procedure to build Git on Mac OS X for Travis CI hardcoded the
internal directory structure we assumed HomeBrew uses, which was a
no-no. The procedure has been updated to ask HomeBrew things we
need to know to fix this.

* ls/travis-homebrew-path-fix:
travis-ci: ask homebrew for its path instead of hardcoding it

Merge branch 'tg/add-chmod+x-fix'Junio C Hamano Mon, 26 Sep 2016 23:09:20 +0000 (16:09 -0700)

Merge branch 'tg/add-chmod+x-fix'

"git add --chmod=+x <pathspec>" added recently only toggled the
executable bit for paths that are either new or modified. This has
been corrected to flip the executable bit for all paths that match
the given pathspec.

* tg/add-chmod+x-fix:
t3700-add: do not check working tree file mode without POSIXPERM
t3700-add: create subdirectory gently
add: modify already added files when --chmod is given
read-cache: introduce chmod_index_entry
update-index: add test for chmod flags

Merge branch 'js/regexec-buf'Junio C Hamano Mon, 26 Sep 2016 23:09:19 +0000 (16:09 -0700)

Merge branch 'js/regexec-buf'

Some codepaths in "git diff" used regexec(3) on a buffer that was
mmap(2)ed, which may not have a terminating NUL, leading to a read
beyond the end of the mapped region. This was fixed by introducing
a regexec_buf() helper that takes a <ptr,len> pair with REG_STARTEND
extension.

* js/regexec-buf:
regex: use regexec_buf()
regex: add regexec_buf() that can work on a non NUL-terminated string
regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails

Merge branch 'nd/checkout-disambiguation'Junio C Hamano Mon, 26 Sep 2016 23:09:18 +0000 (16:09 -0700)

Merge branch 'nd/checkout-disambiguation'

"git checkout <word>" does not follow the usual disambiguation
rules when the <word> can be both a rev and a path, to allow
checking out a branch 'foo' in a project that happens to have a
file 'foo' in the working tree without having to disambiguate.
This was poorly documented and the check was incorrect when the
command was run from a subdirectory.

* nd/checkout-disambiguation:
checkout: fix ambiguity check in subdir
checkout.txt: document a common case that ignores ambiguation rules
checkout: add some spaces between code and comment

Merge branch 'va/i18n-more'Junio C Hamano Mon, 26 Sep 2016 23:09:17 +0000 (16:09 -0700)

Merge branch 'va/i18n-more'

Even more i18n.

* va/i18n-more:
i18n: stash: mark messages for translation
i18n: notes-merge: mark die messages for translation
i18n: ident: mark hint for translation
i18n: i18n: diff: mark die messages for translation
i18n: connect: mark die messages for translation
i18n: commit: mark message for translation

Merge branch 'jt/format-patch-rfc'Junio C Hamano Mon, 26 Sep 2016 23:09:17 +0000 (16:09 -0700)

Merge branch 'jt/format-patch-rfc'

In some projects, it is common to use "[RFC PATCH]" as the subject
prefix for a patch meant for discussion rather than application. A
new option "--rfc" was a short-hand for "--subject-prefix=RFC PATCH"
to help the participants of such projects.

* jt/format-patch-rfc:
format-patch: add "--rfc" for the common case of [RFC PATCH]

Merge branch 'ep/doc-check-ref-format-example'Junio C Hamano Mon, 26 Sep 2016 23:09:17 +0000 (16:09 -0700)

Merge branch 'ep/doc-check-ref-format-example'

A shell script example in check-ref-format documentation has been
fixed.

* ep/doc-check-ref-format-example:
git-check-ref-format.txt: fixup documentation

Merge branch 'mh/diff-indent-heuristic'Junio C Hamano Mon, 26 Sep 2016 23:09:16 +0000 (16:09 -0700)

Merge branch 'mh/diff-indent-heuristic'

Output from "git diff" can be made easier to read by selecting
which lines are common and which lines are added/deleted
intelligently when the lines before and after the changed section
are the same. A command line option is added to help with the
experiment to find a good heuristics.

* mh/diff-indent-heuristic:
blame: honor the diff heuristic options and config
parse-options: add parse_opt_unknown_cb()
diff: improve positioning of add/delete blocks in diffs
xdl_change_compact(): introduce the concept of a change group
recs_match(): take two xrecord_t pointers as arguments
is_blank_line(): take a single xrecord_t as argument
xdl_change_compact(): only use heuristic if group can't be matched
xdl_change_compact(): fix compaction heuristic to adjust ixo

Merge branch 'rs/c-auto-resets-attributes'Junio C Hamano Mon, 26 Sep 2016 23:09:15 +0000 (16:09 -0700)

Merge branch 'rs/c-auto-resets-attributes'

The pretty-format specifier "%C(auto)" used by the "log" family of
commands to enable coloring of the output is taught to also issue a
color-reset sequence to the output.

* rs/c-auto-resets-attributes:
pretty: let %C(auto) reset all attributes

Merge branch 'mm/config-color-ui-default-to-auto'Junio C Hamano Mon, 26 Sep 2016 23:09:14 +0000 (16:09 -0700)

Merge branch 'mm/config-color-ui-default-to-auto'

Documentation for individual configuration variables to control use
of color (like `color.grep`) said that their default value is
'false', instead of saying their default is taken from `color.ui`.
When we updated the default value for color.ui from 'false' to
'auto' quite a while ago, all of them broke. This has been
corrected.

* mm/config-color-ui-default-to-auto:
Documentation/config: default for color.* is color.ui

Merge branch 'rs/cocci'Junio C Hamano Mon, 26 Sep 2016 23:09:14 +0000 (16:09 -0700)

Merge branch 'rs/cocci'

Code cleanup.

* rs/cocci:
use strbuf_addstr() for adding constant strings to a strbuf, part 2
add coccicheck make target
contrib/coccinelle: fix semantic patch for oid_to_hex_r()

get_short_sha1: list ambiguous objects on errorJeff King Mon, 26 Sep 2016 12:00:36 +0000 (08:00 -0400)

get_short_sha1: list ambiguous objects on error

When the user gives us an ambiguous short sha1, we print an
error and refuse to resolve it. In some cases, the next step
is for them to feed us more characters (e.g., if they were
retyping or cut-and-pasting from a full sha1). But in other
cases, that might be all they have. For example, an old
commit message may have used a 7-character hex that was
unique at the time, but is now ambiguous. Git doesn't
provide any information about the ambiguous objects it
found, so it's hard for the user to find out which one they
probably meant.

This patch teaches get_short_sha1() to list the sha1s of the
objects it found, along with a few bits of information that
may help the user decide which one they meant. Here's what
it looks like on git.git:

$ git rev-parse b2e1
error: short SHA1 b2e1 is ambiguous
hint: The candidates are:
hint: b2e1196 tag v2.8.0-rc1
hint: b2e11d1 tree
hint: b2e1632 commit 2007-11-14 - Merge branch 'bs/maint-commit-options'
hint: b2e1759 blob
hint: b2e18954 blob
hint: b2e1895c blob
fatal: ambiguous argument 'b2e1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

We show the tagname for tags, and the date and subject for
commits. For trees and blobs, in theory we could dig in the
history to find the paths at which they were present. But
that's very expensive (on the order of 30s for the kernel),
and it's not likely to be all that helpful. Most short
references are to commits, so the useful information is
typically going to be that the object in question _isn't_ a
commit. So it's silly to spend a lot of CPU preemptively
digging up the path; the user can do it themselves if they
really need to.

And of course it's somewhat ironic that we abbreviate the
sha1s in the disambiguation hint. But full sha1s would cause
annoying line wrapping for the commit lines, and presumably
the user is going to just re-issue their command immediately
with the corrected sha1.

We also restrict the list to those that match any
disambiguation hint. E.g.:

$ git rev-parse b2e1:foo
error: short SHA1 b2e1 is ambiguous
hint: The candidates are:
hint: b2e1196 tag v2.8.0-rc1
hint: b2e11d1 tree
hint: b2e1632 commit 2007-11-14 - Merge branch 'bs/maint-commit-options'
fatal: Invalid object name 'b2e1'.

does not bother reporting the blobs, because they cannot
work as a treeish.

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

for_each_abbrev: drop duplicate objectsJeff King Mon, 26 Sep 2016 12:00:33 +0000 (08:00 -0400)

for_each_abbrev: drop duplicate objects

If an object appears multiple times in the object database
(e.g., in both loose and packed form, or in two separate
packs), the disambiguation machinery may see it more than
once. The get_short_sha1() function handles this already,
but for_each_abbrev() blindly fires the callback for each
instance it finds.

We can fix this by collecting the output in a sha1 array and
de-duplicating it. As a bonus, the sort done for the
de-duplication means that our output will be stable,
regardless of the order in which the objects are found.

Note that the old code normalized the callback's output to
0/1 to store in the 1-bit ds->ambiguous flag (which both
halted the iteration and was returned from the
for_each_abbrev function). Now that we are using sha1_array,
we can return the real value. In practice, it doesn't matter
as the sole caller only ever returns 0.

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

sha1_array: let callbacks interrupt iterationJeff King Mon, 26 Sep 2016 12:00:29 +0000 (08:00 -0400)

sha1_array: let callbacks interrupt iteration

The callbacks for iterating a sha1_array must have a void
return. This is unlike our usual for_each semantics, where
a callback may interrupt iteration and have its value
propagated. Let's switch it to the usual form, which will
enable its use in more places (e.g., where we are replacing
an existing iteration with a different data structure).

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

get_short_sha1: mark ambiguity error for translationJeff King Mon, 26 Sep 2016 12:00:14 +0000 (08:00 -0400)

get_short_sha1: mark ambiguity error for translation

This is a human-readable message, and there's no reason it
should not be translated. While we're at it, let's drop the
period from the end, which is not our usual style.

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

get_short_sha1: NUL-terminate hex prefixJeff King Mon, 26 Sep 2016 12:00:07 +0000 (08:00 -0400)

get_short_sha1: NUL-terminate hex prefix

We store the hex prefix in a 40-byte buffer with the prefix
itself followed by 40-minus-len "x" characters. These x's
serve no purpose, and the lack of NUL termination makes the
prefix string annoying to use. Let's just terminate it.

Note that this is in contrast to the binary prefix, which
_must_ be zero-padded, because we look at the whole thing
during a binary search to find the first potential match in
each pack index. The loose-object hex search cannot use the
same trick because it has to do a linear walk through the
unsorted results of readdir() (and even if it could, you'd
want zeroes instead of x's).

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

get_short_sha1: refactor init of disambiguation codeJeff King Mon, 26 Sep 2016 12:00:04 +0000 (08:00 -0400)

get_short_sha1: refactor init of disambiguation code

The disambiguation machinery has two callers: get_short_sha1
and for_each_abbrev. Both need to repeat much of the same
setup: declaring buffers, sanity-checking lengths, preparing
the prefixes, etc. Let's pull that into a single init
function so we can avoid repeating ourselves.

Pulling the buffers into the "struct disambiguate_state"
isn't strictly necessary, but it does make things simpler
for the callers, who no longer have to worry about sizing
them correctly (i.e., it's an implicit requirement that
the caller provide 20- and 40-byte buffers).

And while we're touching this code, we can convert any
magic-number sizes to the more modern GIT_SHA1_* constants.

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

get_short_sha1: parse tags when looking for treeishJeff King Mon, 26 Sep 2016 11:59:48 +0000 (07:59 -0400)

get_short_sha1: parse tags when looking for treeish

The treeish disambiguation function tries to peel tags, but
it does so by calling:

deref_tag(lookup_object(sha1), ...);

This will only work if we have previously looked at the tag
and created a "struct tag" for it. Since parsing revision
arguments typically happens before anything else, this is
usually not the case, and we would fail to peel the tag (we
are lucky that deref_tag() gracefully handles the NULL and
does not segfault).

Instead, we can use parse_object(). Note that this is the
same fix done by 94d75d1 (get_short_sha1(): correctly
disambiguate type-limited abbreviation, 2013-07-01), but
that commit fixed only the committish disambiguator, and
left the bug in the treeish one.

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

get_sha1: propagate flags to child functionsJeff King Mon, 26 Sep 2016 11:59:41 +0000 (07:59 -0400)

get_sha1: propagate flags to child functions

The get_sha1() function is actually implementation by many
sub-functions, but we do not always pass our flags around to
all of those functions. As a result, we may forget that our
caller asked us to resolve with GET_SHA1_QUIETLY and output
messages. The two triggerable cases are:

1. Resolving treeish:path will resolve the "treeish"
portion using GET_SHA1_TREEISH, dropping all other
flags.

2. The peel_onion() function did not take flags at all
but recurses to get_sha1_1(), which does.

The solution for both is to bitwise-OR their new flags with
the existing ones (after dropping any mutually exclusive
disambiguation flags).

This bug can trigger with "git rev-parse --quiet", which
asks for quiet resolution. But it can also happen in a more
vanilla code path when we do a follow-up ONLY_TO_DIE
invocation of get_sha1(), and that's what the tests check.

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

get_sha1: avoid repeating ourselves via ONLY_TO_DIEJeff King Mon, 26 Sep 2016 11:59:15 +0000 (07:59 -0400)

get_sha1: avoid repeating ourselves via ONLY_TO_DIE

When the revision code cannot parse an argument like
"HEAD:foo", it will call maybe_die_on_misspelt_object_name(),
which re-runs get_sha1() with an extra ONLY_TO_DIE flag. We
then spend more effort to generate a better error message.

Unfortunately, a side effect is that our second call may
repeat the same error messages from the original get_sha1()
call. You can see this with:

$ git show 0017
error: short SHA1 0017 is ambiguous.
error: short SHA1 0017 is ambiguous.
fatal: ambiguous argument '0017': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

where the second "error:" line comes from the ONLY_TO_DIE
call.

To fix this, we can make ONLY_TO_DIE imply QUIETLY. This is
a little odd, because the whole point of ONLY_TO_DIE is to
output error messages. But what we want to do is tell the
rest of the get_sha1() code (particularly get_sha1_1()) that
the _regular_ messages should be quiet, but the only-to-die
ones should not.

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

get_sha1: detect buggy calls with multiple disambiguatorsJeff King Mon, 26 Sep 2016 11:59:01 +0000 (07:59 -0400)

get_sha1: detect buggy calls with multiple disambiguators

The get_sha1() family of functions takes a flags field, but
some of the flags are mutually exclusive. In particular, we
can only handle one disambiguating function, and the flags
quietly override each other. Let's instead detect these as
programming bugs.

Technically some of the flags are supersets of the others,
so treating COMMITTISH|TREEISH as just COMMITTISH is not
wrong, but it's a good sign the caller is confused. And
certainly asking for BLOB|TREE does not work.

We can do the check easily with some bit-twiddling, and as a
bonus, the bit-mask of disambiguators will come in handy in
a future patch.

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

unpack_sha1_header(): detect malformed object headerJunio C Hamano Mon, 26 Sep 2016 04:29:04 +0000 (21:29 -0700)

unpack_sha1_header(): detect malformed object header

When opening a loose object file, we often do this sequence:

- prepare a short buffer for the object header (on stack)

- call unpack_sha1_header() and have early part of the object data
inflated, enough to fill the buffer

- parse that data in the short buffer, assuming that the first part
of the object is <typename> SP <length> NUL

Because the parsing function parse_sha1_header_extended() is not
given the number of bytes inflated into the header buffer, it you
craft a file whose early part inflates a garbage sequence without SP
or NUL, and replace a loose object with it, it will end up reading
past the end of the inflated data.

To correct this, do the following four things:

- rename unpack_sha1_header() to unpack_sha1_short_header() and
have unpack_sha1_header_to_strbuf() keep calling that as its
helper function. This will detect and report zlib errors, but is
not aware of the format of a loose object (as before).

- introduce unpack_sha1_header() that calls the same helper
function, and when zlib reports it inflated OK into the buffer,
check if the inflated data has NUL. This would ensure that
parsing function will terminate within the buffer that holds the
inflated header.

- update unpack_sha1_header_to_strbuf() to check if the resulting
buffer has NUL for the same effect.

- update parse_sha1_header_extended() to make sure that its loop to
find the SP that terminates the <typename> stops at NUL.

Essentially, this makes unpack_*() functions that are asked to
unpack a loose object header to be a bit more strict and detect an
input that cannot possibly be a valid object header, even before the
parsing function kicks in.

Reported-by: Gustavo Grieco <gustavo.grieco@imag.fr>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

streaming: make sure to notice corrupt objectJunio C Hamano Mon, 26 Sep 2016 16:23:41 +0000 (09:23 -0700)

streaming: make sure to notice corrupt object

The streaming read interface from a loose object called
parse_sha1_header() but discarded its return value, without noticing
a potential error.

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

Merge branch 'va/i18n' of ../git-gui into va/git-gui... Junio C Hamano Mon, 26 Sep 2016 14:19:57 +0000 (07:19 -0700)

Merge branch 'va/i18n' of ../git-gui into va/git-gui-i18n

* 'va/i18n' of ../git-gui:
git-gui: l10n: add Portuguese translation
git-gui i18n: mark strings for translation

git-gui: l10n: add Portuguese translationVasco Almeida Fri, 6 May 2016 16:06:42 +0000 (16:06 +0000)

git-gui: l10n: add Portuguese translation

Add Portuguese glossary.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui i18n: mark strings for translationVasco Almeida Sun, 8 May 2016 10:52:54 +0000 (10:52 +0000)

git-gui i18n: mark strings for translation

Mark strings for translation in lib/index.tcl that were seemingly
left behind by 700e560 ("git-gui: Mark forgotten strings for
translation.", 2008-09-04) which marks string in do_revert_selection
procedure.
These strings are passed to unstage_help and add_helper procedures.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'rs/use-modern-git-merge-syntax' of git... Junio C Hamano Mon, 26 Sep 2016 14:16:29 +0000 (07:16 -0700)

Merge branch 'rs/use-modern-git-merge-syntax' of git-gui into rs/git-gui-use-modern-git-merge-syntax

* 'rs/use-modern-git-merge-syntax' of git-gui:
git-gui: stop using deprecated merge syntax

git-gui: stop using deprecated merge syntaxRené Scharfe Sat, 24 Sep 2016 11:30:22 +0000 (13:30 +0200)

git-gui: stop using deprecated merge syntax

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and
warns when it's called like 'git merge <message> HEAD <commit>' because
that syntax is deprecated. Use this feature in git-gui and get rid of
that warning.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Tested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use COPY_ARRAYRené Scharfe Sun, 25 Sep 2016 07:24:03 +0000 (09:24 +0200)

use COPY_ARRAY

Add a semantic patch for converting certain calls of memcpy(3) to
COPY_ARRAY() and apply that transformation to the code base. The result
is
shorter and safer code. For now only consider calls where source and
destination have the same type, or in other words: easy cases.

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

add COPY_ARRAYRené Scharfe Sun, 25 Sep 2016 07:15:42 +0000 (09:15 +0200)

add COPY_ARRAY

Add COPY_ARRAY, a safe and convenient helper for copying arrays,
complementing ALLOC_ARRAY and REALLOC_ARRAY. Users just specify source,
destination and the number of elements; the size of an element is
inferred automatically.

It checks if the multiplication of size and element count overflows.
The inferred size is passed first to st_mult, which allows the division
there to be done at compilation time.

As a basic type safety check it makes sure the sizes of source and
destination elements are the same. That's evaluated at compilation time
as well.

COPY_ARRAY is safe to use with NULL as source pointer iff 0 elements are
to be copied. That convention is used in some cases for initializing
arrays. Raw memcpy(3) does not support it -- compilers are allowed to
assume that only valid pointers are passed to it and can optimize away
NULL checks after such a call.

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

gitweb: use highlight's shebang detectionIan Kelling Sat, 24 Sep 2016 22:32:58 +0000 (15:32 -0700)

gitweb: use highlight's shebang detection

The "highlight" binary can, in some cases, determine the language type
by the means of file contents, for example the shebang in the first line
for some scripting languages. Make use of this autodetection for files
which syntax is not known by gitweb. In that case, pass the blob
contents to "highlight --force"; the parameter is needed to make it
always generate HTML output (which includes HTML-escaping).

Although we now run highlight on files which do not end up highlighted,
performance is virtually unaffected because when we call highlight, it
is used for escaping HTML. In the case that highlight is used, gitweb
calls sanitize() instead of esc_html(), and the latter is significantly
slower (it does more, being roughly a superset of sanitize()). Simple
benchmark comparing performance of 'blob' view of files without syntax
highlighting in gitweb before and after this change indicates ±1%
difference in request time for all file types. Benchmark was performed
on local instance on Debian, using Apache/2.4.23 web server and CGI.

Document the feature and improve syntax highlight documentation, add
test to ensure gitweb doesn't crash when language detection is used.

Signed-off-by: Ian Kelling <ian@iankelling.org>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: remove unused guess_file_syntax() parameterIan Kelling Sat, 24 Sep 2016 22:32:57 +0000 (15:32 -0700)

gitweb: remove unused guess_file_syntax() parameter

Signed-off-by: Ian Kelling <ian@iankelling.org>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

init: kill git_link variableNguyễn Thái Ngọc Duy Sun, 25 Sep 2016 03:14:40 +0000 (10:14 +0700)

init: kill git_link variable

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

init: do not set unnecessary core.worktreeNguyễn Thái Ngọc Duy Sun, 25 Sep 2016 03:14:39 +0000 (10:14 +0700)

init: do not set unnecessary core.worktree

The function needs_work_tree_config() that is called from
create_default_files() is supposed to be fed the path to ".git" that
looks as if it is at the top of the working tree, and decide if that
location matches the actual worktree being used. This comparison allows
"git init" to decide if core.worktree needs to be recorded in the
working tree.

In the current code, however, we feed the return value from
get_git_dir(), which can be totally different from what the function
expects when "gitdir" file is involved. Instead of giving the path to
the ".git" at the top of the working tree, we end up feeding the actual
path that the file points at.

This original location of ".git" however is only known to init_db().
Make init_db() save it and have it passed to create_default_files() as a
new parameter, which passes the correct location down to
needs_work_tree_config() to fix this.

Noticed-by: Max Nordlund <max.nordlund@sqore.com>
Helped-by: Michael J Gruber <git@drmicha.warpmail.net>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

init: kill set_git_dir_init()Nguyễn Thái Ngọc Duy Sun, 25 Sep 2016 03:14:38 +0000 (10:14 +0700)

init: kill set_git_dir_init()

This is a pure code move, necessary to kill the global variable git_link
later (and also helps a bit in the next patch).

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