git
7 years agoMerge branch 'jk/upload-pack-hook'
Junio C Hamano [Wed, 6 Jul 2016 20:38:11 +0000 (13:38 -0700)] 
Merge branch 'jk/upload-pack-hook'

"upload-pack" allows a custom "git pack-objects" replacement when
responding to "fetch/clone" via the uploadpack.packObjectsHook.

* jk/upload-pack-hook:
  upload-pack: provide a hook for running pack-objects
  t1308: do not get fooled by symbolic links to the source tree
  config: add a notion of "scope"
  config: return configset value for current_config_ functions
  config: set up config_source for command-line config
  git_config_parse_parameter: refactor cleanup code
  git_config_with_options: drop "found" counting

7 years agoMerge branch 'nd/worktree-cleanup-post-head-protection'
Junio C Hamano [Wed, 6 Jul 2016 20:38:11 +0000 (13:38 -0700)] 
Merge branch 'nd/worktree-cleanup-post-head-protection'

Further preparatory clean-up for "worktree" feature continues.

* nd/worktree-cleanup-post-head-protection:
  worktree: simplify prefixing paths
  worktree: avoid 0{40}, too many zeroes, hard to read
  worktree.c: use is_dot_or_dotdot()
  git-worktree.txt: keep subcommand listing in alphabetical order
  worktree.c: rewrite mark_current_worktree() to avoid strbuf
  completion: support git-worktree

7 years agoMerge branch 'jk/bisect-show-tree'
Junio C Hamano [Wed, 6 Jul 2016 20:38:10 +0000 (13:38 -0700)] 
Merge branch 'jk/bisect-show-tree'

"git bisect" makes an internal call to "git diff-tree" when
bisection finds the culprit, but this call did not initialize the
data structure to pass to the diff-tree API correctly.

* jk/bisect-show-tree:
  bisect: always call setup_revisions after init_revisions

7 years agoMerge branch 'lf/sideband-returns-void'
Junio C Hamano [Wed, 6 Jul 2016 20:38:09 +0000 (13:38 -0700)] 
Merge branch 'lf/sideband-returns-void'

A small internal API cleanup.

* lf/sideband-returns-void:
  upload-pack.c: make send_client_data() return void
  sideband.c: make send_sideband() return void

7 years agoMerge branch 'jk/add-i-diff-compact-heuristics'
Junio C Hamano [Wed, 6 Jul 2016 20:38:09 +0000 (13:38 -0700)] 
Merge branch 'jk/add-i-diff-compact-heuristics'

"git add -i/-p" learned to honor diff.compactionHeuristic
experimental knob, so that the user can work on the same hunk split
as "git diff" output.

* jk/add-i-diff-compact-heuristics:
  add--interactive: respect diff.compactionHeuristic

7 years agoMerge branch 'km/fetch-do-not-free-remote-name'
Junio C Hamano [Wed, 6 Jul 2016 20:38:08 +0000 (13:38 -0700)] 
Merge branch 'km/fetch-do-not-free-remote-name'

The ownership rule for the piece of memory that hold references to
be fetched in "git fetch" was screwy, which has been cleaned up.

* km/fetch-do-not-free-remote-name:
  builtin/fetch.c: don't free remote->name after fetch

7 years agoMerge branch 'nd/test-lib-httpd-show-error-log-in-verbose'
Junio C Hamano [Wed, 6 Jul 2016 20:38:08 +0000 (13:38 -0700)] 
Merge branch 'nd/test-lib-httpd-show-error-log-in-verbose'

HTTPd tests learned to show the server error log to help diagnosing
a failing tests.

* nd/test-lib-httpd-show-error-log-in-verbose:
  lib-httpd.sh: print error.log on error

7 years agoMerge branch 'jk/string-list-static-init'
Junio C Hamano [Wed, 6 Jul 2016 20:38:07 +0000 (13:38 -0700)] 
Merge branch 'jk/string-list-static-init'

Instead of taking advantage of a struct string_list that is
allocated with all NULs happens to be STRING_LIST_INIT_NODUP kind,
initialize them explicitly as such, to document their behaviour
better.

* jk/string-list-static-init:
  use string_list initializer consistently
  blame,shortlog: don't make local option variables static
  interpret-trailers: don't duplicate option strings
  parse_opt_string_list: stop allocating new strings

7 years agoMerge branch 'jk/send-pack-stdio'
Junio C Hamano [Wed, 6 Jul 2016 20:38:07 +0000 (13:38 -0700)] 
Merge branch 'jk/send-pack-stdio'

Code clean-up.

* jk/send-pack-stdio:
  write_or_die: remove the unused write_or_whine() function
  send-pack: use buffered I/O to talk to pack-objects

7 years agoMerge branch 'pb/commit-editmsg-path'
Junio C Hamano [Wed, 6 Jul 2016 20:38:06 +0000 (13:38 -0700)] 
Merge branch 'pb/commit-editmsg-path'

Code clean-up.

* pb/commit-editmsg-path:
  builtin/commit.c: memoize git-path for COMMIT_EDITMSG

7 years agoMerge branch 'ep/http-curl-trace'
Junio C Hamano [Wed, 6 Jul 2016 20:38:06 +0000 (13:38 -0700)] 
Merge branch 'ep/http-curl-trace'

HTTP transport gained an option to produce more detailed debugging
trace.

* ep/http-curl-trace:
  imap-send.c: introduce the GIT_TRACE_CURL enviroment variable
  http.c: implement the GIT_TRACE_CURL environment variable

8 years agoSecond batch of topics for 2.10
Junio C Hamano [Mon, 27 Jun 2016 17:07:08 +0000 (10:07 -0700)] 
Second batch of topics for 2.10

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoSync with maint
Junio C Hamano [Mon, 27 Jun 2016 17:00:15 +0000 (10:00 -0700)] 
Sync with maint

* maint:
  Start preparing for 2.9.1

8 years agoStart preparing for 2.9.1
Junio C Hamano [Mon, 27 Jun 2016 16:59:51 +0000 (09:59 -0700)] 
Start preparing for 2.9.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'tb/complete-status'
Junio C Hamano [Mon, 27 Jun 2016 16:56:54 +0000 (09:56 -0700)] 
Merge branch 'tb/complete-status'

The completion script (in contrib/) learned to complete "git
status" options.

* tb/complete-status:
  completion: add git status
  completion: add __git_get_option_value helper
  completion: factor out untracked file modes into a variable

8 years agoMerge branch 'mg/cherry-pick-multi-on-unborn'
Junio C Hamano [Mon, 27 Jun 2016 16:56:53 +0000 (09:56 -0700)] 
Merge branch 'mg/cherry-pick-multi-on-unborn'

"git cherry-pick A" worked on an unborn branch, but "git
cherry-pick A..B" didn't.

* mg/cherry-pick-multi-on-unborn:
  cherry-pick: allow to pick to unborn branches

8 years agoMerge branch 'lf/receive-pack-auto-gc-to-client'
Junio C Hamano [Mon, 27 Jun 2016 16:56:52 +0000 (09:56 -0700)] 
Merge branch 'lf/receive-pack-auto-gc-to-client'

Allow messages that are generated by auto gc during "git push" on
the receiving end to be explicitly passed back to the sending end
over sideband, so that they are shown with "remote: " prefix to
avoid confusing the users.

* lf/receive-pack-auto-gc-to-client:
  receive-pack: send auto-gc output over sideband 2

8 years agoMerge branch 'em/newer-freebsd-shells-are-fine-with-returns'
Junio C Hamano [Mon, 27 Jun 2016 16:56:52 +0000 (09:56 -0700)] 
Merge branch 'em/newer-freebsd-shells-are-fine-with-returns'

Comments about misbehaving FreeBSD shells have been clarified with
the version number (9.x and before are broken, newer ones are OK).

* em/newer-freebsd-shells-are-fine-with-returns:
  rebase: update comment about FreeBSD /bin/sh

8 years agoMerge branch 'lv/status-say-working-tree-not-directory'
Junio C Hamano [Mon, 27 Jun 2016 16:56:51 +0000 (09:56 -0700)] 
Merge branch 'lv/status-say-working-tree-not-directory'

"git status" used to say "working directory" when it meant "working
tree".

* lv/status-say-working-tree-not-directory:
  Use "working tree" instead of "working directory" for git status

8 years agoMerge branch 'nb/gnome-keyring-build'
Junio C Hamano [Mon, 27 Jun 2016 16:56:50 +0000 (09:56 -0700)] 
Merge branch 'nb/gnome-keyring-build'

Build improvements for gnome-keyring (in contrib/)

* nb/gnome-keyring-build:
  gnome-keyring: Don't hard-code pkg-config executable

8 years agoMerge branch 'jc/deref-tag'
Junio C Hamano [Mon, 27 Jun 2016 16:56:49 +0000 (09:56 -0700)] 
Merge branch 'jc/deref-tag'

Code clean-up.

* jc/deref-tag:
  blame, line-log: do not loop around deref_tag()

8 years agoMerge branch 'et/add-chmod-x'
Junio C Hamano [Mon, 27 Jun 2016 16:56:49 +0000 (09:56 -0700)] 
Merge branch 'et/add-chmod-x'

"git update-index --add --chmod=+x file" may be usable as an escape
hatch, but not a friendly thing to force for people who do need to
use it regularly.  "git add --chmod=+x file" can be used instead.

* et/add-chmod-x:
  add: add --chmod=+x / --chmod=-x options

8 years agoMerge branch 'jk/avoid-unbounded-alloca'
Junio C Hamano [Mon, 27 Jun 2016 16:56:48 +0000 (09:56 -0700)] 
Merge branch 'jk/avoid-unbounded-alloca'

* jk/avoid-unbounded-alloca:
  tree-diff: avoid alloca for large allocations

8 years agoMerge branch 'rj/compat-regex-size-max-fix'
Junio C Hamano [Mon, 27 Jun 2016 16:56:47 +0000 (09:56 -0700)] 
Merge branch 'rj/compat-regex-size-max-fix'

A compilation fix.

* rj/compat-regex-size-max-fix:
  regex: fix a SIZE_MAX macro redefinition warning

8 years agoMerge branch 'vs/prompt-avoid-unset-variable'
Junio C Hamano [Mon, 27 Jun 2016 16:56:47 +0000 (09:56 -0700)] 
Merge branch 'vs/prompt-avoid-unset-variable'

The git-prompt scriptlet (in contrib/) was not friendly with those
who uses "set -u", which has been fixed.

* vs/prompt-avoid-unset-variable:
  git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION, $short_sha

8 years agoMerge branch 'sg/reflog-past-root'
Junio C Hamano [Mon, 27 Jun 2016 16:56:46 +0000 (09:56 -0700)] 
Merge branch 'sg/reflog-past-root'

"git reflog" stopped upon seeing an entry that denotes a branch
creation event (aka "unborn"), which made it appear as if the
reflog was truncated.

* sg/reflog-past-root:
  reflog: continue walking the reflog past root commits

8 years agoMerge branch 'pb/strbuf-read-file-doc'
Junio C Hamano [Mon, 27 Jun 2016 16:56:46 +0000 (09:56 -0700)] 
Merge branch 'pb/strbuf-read-file-doc'

* pb/strbuf-read-file-doc:
  strbuf: describe the return value of strbuf_read_file

8 years agoMerge branch 'dn/gpg-doc'
Junio C Hamano [Mon, 27 Jun 2016 16:56:45 +0000 (09:56 -0700)] 
Merge branch 'dn/gpg-doc'

The documentation tries to consistently spell "GPG"; when
referring to the specific program name, "gpg" is used.

* dn/gpg-doc:
  Documentation: GPG capitalization

8 years agoMerge branch 'jk/fetch-prune-doc'
Junio C Hamano [Mon, 27 Jun 2016 16:56:44 +0000 (09:56 -0700)] 
Merge branch 'jk/fetch-prune-doc'

* jk/fetch-prune-doc:
  fetch: document that pruning happens before fetching

8 years agoMerge branch 'ap/git-svn-propset-doc'
Junio C Hamano [Mon, 27 Jun 2016 16:56:43 +0000 (09:56 -0700)] 
Merge branch 'ap/git-svn-propset-doc'

"git svn propset" subcommand that was added in 2.3 days is
documented now.

* ap/git-svn-propset-doc:
  git-svn: document the 'git svn propset' command

8 years agoMerge branch 'tr/doc-tt'
Junio C Hamano [Mon, 27 Jun 2016 16:56:42 +0000 (09:56 -0700)] 
Merge branch 'tr/doc-tt'

The documentation set has been updated so that literal commands,
configuration variables and environment variables are consistently
typeset in fixed-width font and bold in manpages.

* tr/doc-tt:
  doc: change configuration variables format
  doc: more consistency in environment variables format
  doc: change environment variables format
  doc: clearer rule about formatting literals

8 years agoMerge branch 'pc/occurred'
Junio C Hamano [Mon, 27 Jun 2016 16:56:42 +0000 (09:56 -0700)] 
Merge branch 'pc/occurred'

* pc/occurred:
  config.c: fix misspelt "occurred" in an error message
  refs.h: fix misspelt "occurred" in a comment

8 years agoMerge branch 'cc/apply-introduce-state'
Junio C Hamano [Mon, 27 Jun 2016 16:56:42 +0000 (09:56 -0700)] 
Merge branch 'cc/apply-introduce-state'

The "git apply" standalone program is being libified; this is the
first step to move many state variables into a structure that can
be explicitly (re)initialized to make the machinery callable more
than once.

The next step that moves some remaining state variables into the
structure and turns die()s into an error return that propagates up
to the caller is not queued yet but in flight.  It would be good to
review the above first and give the remainder of the series a solid
base to build on.

* cc/apply-introduce-state: (50 commits)
  builtin/apply: remove misleading comment on lock_file field
  builtin/apply: move 'newfd' global into 'struct apply_state'
  builtin/apply: add 'lock_file' pointer into 'struct apply_state'
  builtin/apply: move applying patches into apply_all_patches()
  builtin/apply: move 'state' check into check_apply_state()
  builtin/apply: move 'symlink_changes' global into 'struct apply_state'
  builtin/apply: move 'fn_table' global into 'struct apply_state'
  builtin/apply: move 'state_linenr' global into 'struct apply_state'
  builtin/apply: move 'max_change' and 'max_len' into 'struct apply_state'
  builtin/apply: move 'ws_ignore_action' into 'struct apply_state'
  builtin/apply: move 'ws_error_action' into 'struct apply_state'
  builtin/apply: move 'applied_after_fixing_ws' into 'struct apply_state'
  builtin/apply: move 'squelch_whitespace_errors' into 'struct apply_state'
  builtin/apply: remove whitespace_option arg from set_default_whitespace_mode()
  builtin/apply: move 'whitespace_option' into 'struct apply_state'
  builtin/apply: move 'whitespace_error' global into 'struct apply_state'
  builtin/apply: move 'root' global into 'struct apply_state'
  builtin/apply: move 'p_value_known' global into 'struct apply_state'
  builtin/apply: move 'p_value' global into 'struct apply_state'
  builtin/apply: move 'has_include' global into 'struct apply_state'
  ...

8 years agoMerge branch 'rs/xdiff-hunk-with-func-line' into maint
Junio C Hamano [Mon, 27 Jun 2016 16:56:24 +0000 (09:56 -0700)] 
Merge branch 'rs/xdiff-hunk-with-func-line' into maint

"git show -W" (extend hunks to cover the entire function, delimited
by lines that match the "funcname" pattern) used to show the entire
file when a change added an entire function at the end of the file,
which has been fixed.

* rs/xdiff-hunk-with-func-line:
  xdiff: fix merging of appended hunk with -W
  grep: -W: don't extend context to trailing empty lines
  t7810: add test for grep -W and trailing empty context lines
  xdiff: don't trim common tail with -W
  xdiff: -W: don't include common trailing empty lines in context
  xdiff: ignore empty lines before added functions with -W
  xdiff: handle appended chunks better with -W
  xdiff: factor out match_func_rec()
  t4051: rewrite, add more tests

8 years agoMerge branch 'jk/rev-list-count-with-bitmap' into maint
Junio C Hamano [Mon, 27 Jun 2016 16:56:24 +0000 (09:56 -0700)] 
Merge branch 'jk/rev-list-count-with-bitmap' into maint

"git rev-list --count" whose walk-length is limited with "-n"
option did not work well with the counting optimized to look at the
bitmap index.

* jk/rev-list-count-with-bitmap:
  rev-list: disable bitmaps when "-n" is used with listing objects
  rev-list: "adjust" results of "--count --use-bitmap-index -n"

8 years agoMerge branch 'et/pretty-format-c-auto' into maint
Junio C Hamano [Mon, 27 Jun 2016 16:56:23 +0000 (09:56 -0700)] 
Merge branch 'et/pretty-format-c-auto' into maint

The commands in `git log` family take %C(auto) in a custom format
string.  This unconditionally turned the color on, ignoring
--no-color or with --color=auto when the output is not connected to
a tty; this was corrected to make the format truly behave as
"auto".

* et/pretty-format-c-auto:
  format_commit_message: honor `color=auto` for `%C(auto)`

8 years agoMerge branch 'ew/daemon-socket-keepalive' into maint
Junio C Hamano [Mon, 27 Jun 2016 16:56:22 +0000 (09:56 -0700)] 
Merge branch 'ew/daemon-socket-keepalive' into maint

When "git daemon" is run without --[init-]timeout specified, a
connection from a client that silently goes offline can hang around
for a long time, wasting resources.  The socket-level KEEPALIVE has
been enabled to allow the OS to notice such failed connections.

* ew/daemon-socket-keepalive:
  daemon: enable SO_KEEPALIVE for all sockets

8 years agogit-svn: skip mergeinfo handling with --no-follow-parent
Eric Wong [Mon, 20 Jun 2016 21:52:53 +0000 (21:52 +0000)] 
git-svn: skip mergeinfo handling with --no-follow-parent

For repositories without parent following enabled, finding
git parents through svn:mergeinfo or svk::parents can be
expensive and pointless.

Reported-by: Александр Овчинников <proff@proff.email>
http://mid.gmane.org/4094761466408188@web24o.yandex.ru

Signed-off-by: Eric Wong <e@80x24.org>
8 years agoStart the post-2.9 cycle
Junio C Hamano [Mon, 20 Jun 2016 18:06:49 +0000 (11:06 -0700)] 
Start the post-2.9 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'rs/xdiff-hunk-with-func-line'
Junio C Hamano [Mon, 20 Jun 2016 18:01:04 +0000 (11:01 -0700)] 
Merge branch 'rs/xdiff-hunk-with-func-line'

"git show -W" (extend hunks to cover the entire function, delimited
by lines that match the "funcname" pattern) used to show the entire
file when a change added an entire function at the end of the file,
which has been fixed.

* rs/xdiff-hunk-with-func-line:
  xdiff: fix merging of appended hunk with -W
  grep: -W: don't extend context to trailing empty lines
  t7810: add test for grep -W and trailing empty context lines
  xdiff: don't trim common tail with -W
  xdiff: -W: don't include common trailing empty lines in context
  xdiff: ignore empty lines before added functions with -W
  xdiff: handle appended chunks better with -W
  xdiff: factor out match_func_rec()
  t4051: rewrite, add more tests

8 years agoMerge branch 'jk/rev-list-count-with-bitmap'
Junio C Hamano [Mon, 20 Jun 2016 18:01:03 +0000 (11:01 -0700)] 
Merge branch 'jk/rev-list-count-with-bitmap'

"git rev-list --count" whose walk-length is limited with "-n"
option did not work well with the counting optimized to look at the
bitmap index.

* jk/rev-list-count-with-bitmap:
  rev-list: disable bitmaps when "-n" is used with listing objects
  rev-list: "adjust" results of "--count --use-bitmap-index -n"

8 years agoMerge branch 'wd/userdiff-css'
Junio C Hamano [Mon, 20 Jun 2016 18:01:02 +0000 (11:01 -0700)] 
Merge branch 'wd/userdiff-css'

Update the funcname definition to support css files.

* wd/userdiff-css:
  userdiff: add built-in pattern for CSS

8 years agoMerge branch 'jc/clear-pathspec'
Junio C Hamano [Mon, 20 Jun 2016 18:01:02 +0000 (11:01 -0700)] 
Merge branch 'jc/clear-pathspec'

We usually call a function that clears the contents a data
structure X without freeing the structure itself clear_X(), and
call a function that does clear_X() and also frees it free_X().
free_pathspec() function has been renamed to clear_pathspec()
to avoid confusion.

* jc/clear-pathspec:
  pathspec: rename free_pathspec() to clear_pathspec()

8 years agoMerge branch 'aq/upload-pack-use-parse-options'
Junio C Hamano [Mon, 20 Jun 2016 18:01:02 +0000 (11:01 -0700)] 
Merge branch 'aq/upload-pack-use-parse-options'

"git upload-pack" command has been updated to use the parse-options
API.

* aq/upload-pack-use-parse-options:
  upload-pack.c: use parse-options API

8 years agoMerge branch 'jg/dash-is-last-branch-in-worktree-add'
Junio C Hamano [Mon, 20 Jun 2016 18:01:02 +0000 (11:01 -0700)] 
Merge branch 'jg/dash-is-last-branch-in-worktree-add'

"git worktree add" learned that '-' can be used as a short-hand for
"@{-1}", the previous branch.

* jg/dash-is-last-branch-in-worktree-add:
  worktree: allow "-" short-hand for @{-1} in add command

8 years agoMerge branch 'et/pretty-format-c-auto'
Junio C Hamano [Mon, 20 Jun 2016 18:01:01 +0000 (11:01 -0700)] 
Merge branch 'et/pretty-format-c-auto'

The commands in `git log` family take %C(auto) in a custom format
string.  This unconditionally turned the color on, ignoring
--no-color or with --color=auto when the output is not connected to
a tty; this was corrected to make the format truly behave as
"auto".

* et/pretty-format-c-auto:
  format_commit_message: honor `color=auto` for `%C(auto)`

8 years agoMerge branch 'sb/submodule-recommend-shallowness'
Junio C Hamano [Mon, 20 Jun 2016 18:01:01 +0000 (11:01 -0700)] 
Merge branch 'sb/submodule-recommend-shallowness'

An upstream project can make a recommendation to shallowly clone
some submodules in the .gitmodules file it ships.

* sb/submodule-recommend-shallowness:
  submodule update: learn `--[no-]recommend-shallow` option
  submodule-config: keep shallow recommendation around

8 years agoMerge branch 'sb/submodule-misc-cleanups'
Junio C Hamano [Mon, 20 Jun 2016 18:01:01 +0000 (11:01 -0700)] 
Merge branch 'sb/submodule-misc-cleanups'

Minor simplification.

* sb/submodule-misc-cleanups:
  submodule update: make use of the existing fetch_in_submodule function

8 years agoMerge branch 'ew/daemon-socket-keepalive'
Junio C Hamano [Mon, 20 Jun 2016 18:01:00 +0000 (11:01 -0700)] 
Merge branch 'ew/daemon-socket-keepalive'

When "git daemon" is run without --[init-]timeout specified, a
connection from a client that silently goes offline can hang around
for a long time, wasting resources.  The socket-level KEEPALIVE has
been enabled to allow the OS to notice such failed connections.

* ew/daemon-socket-keepalive:
  daemon: enable SO_KEEPALIVE for all sockets

8 years agoMerge branch 'ah/no-verify-signature-with-pull-rebase'
Junio C Hamano [Mon, 20 Jun 2016 18:01:00 +0000 (11:01 -0700)] 
Merge branch 'ah/no-verify-signature-with-pull-rebase'

"git pull --rebase --verify-signature" learned to warn the user
that "--verify-signature" is a no-op when rebasing.

* ah/no-verify-signature-with-pull-rebase:
  pull: warn on --verify-signatures with --rebase

8 years agoMerge branch 'ew/fast-import-unpack-limit'
Junio C Hamano [Mon, 20 Jun 2016 18:01:00 +0000 (11:01 -0700)] 
Merge branch 'ew/fast-import-unpack-limit'

"git fast-import" learned the same performance trick to avoid
creating too small a packfile as "git fetch" and "git push" have,
using *.unpackLimit configuration.

* ew/fast-import-unpack-limit:
  fast-import: invalidate pack_id references after loosening
  fast-import: implement unpack limit

8 years agorebase: update comment about FreeBSD /bin/sh
Ed Maste [Fri, 17 Jun 2016 15:33:29 +0000 (11:33 -0400)] 
rebase: update comment about FreeBSD /bin/sh

Commit 9f50d32 introduced a fix for FreeBSD /bin/sh misbehaviour
when dot-sourcing a file containing "return" statements outside of
any function, from a function in another shell script. That issue
affects FreeBSD 9.x, and is not present in the /bin/sh in FreeBSD
10.3 and later. Update the comment to clarify this.

The example from 9f50d32's commit message produces the expected output
on FreeBSD 10.3 and -CURRENT (the upcoming 11.0):

% sh script1.sh
only this line should show
%

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation: GPG capitalization
Dave Nicolson [Thu, 16 Jun 2016 22:15:44 +0000 (22:15 +0000)] 
Documentation: GPG capitalization

When "GPG" is used in a sentence it is now consistently capitalized.
When referring to the binary it is left as "gpg".

Signed-off-by: David Nicolson <david.nicolson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobisect: always call setup_revisions after init_revisions
Jeff King [Thu, 16 Jun 2016 23:37:20 +0000 (19:37 -0400)] 
bisect: always call setup_revisions after init_revisions

init_revisions() initializes the rev_info struct to default
values, and setup_revisions() parses any command-line
arguments and finalizes the struct.

In e22278c (bisect: display first bad commit without forking
a new process, 2009-05-28), a show_diff_tree() was added
that calls the former but not the latter. It doesn't have
any arguments to parse, but it still should do the
finalizing step.

This may have caused other minor bugs over the years, but it
became much more prominent after fe37a9c (pretty: allow
tweaking tabwidth in --expand-tabs, 2016-03-29). That leaves
the expected tab width as "-1", rather than the true default
of "8". When we see a commit with tabs to be expanded, we
end up trying to add (size_t)-1 spaces to a strbuf, which
complains about the integer overflow.

The fix is easy: just call setup_revisions() with no
arguments.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoupload-pack.c: make send_client_data() return void
Lukas Fleischer [Tue, 14 Jun 2016 14:49:17 +0000 (16:49 +0200)] 
upload-pack.c: make send_client_data() return void

The send_client_data() function uses write_or_die() for writing data
which immediately terminates the process on errors. If no such error
occurred, send_client_data() always returned the value that was passed
as third parameter prior to this commit. This value is already known to
the caller in any case, so let's turn send_client_data() into a void
function instead.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosideband.c: make send_sideband() return void
Lukas Fleischer [Tue, 14 Jun 2016 14:49:16 +0000 (16:49 +0200)] 
sideband.c: make send_sideband() return void

The send_sideband() function uses write_or_die() for writing data which
immediately terminates the process on errors. If no such error occurred,
send_sideband() always returned the value that was passed as fourth
parameter prior to this commit. This value is already known to the
caller in any case, so let's turn send_sideband() into a void function
instead.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoadd--interactive: respect diff.compactionHeuristic
Jeff King [Thu, 16 Jun 2016 12:27:29 +0000 (08:27 -0400)] 
add--interactive: respect diff.compactionHeuristic

We use plumbing to generate the diff, so it doesn't
automatically pick up UI config like compactionHeuristic.
Let's forward it on, since interactive adding is porcelain.

Note that we only need to handle the "true" case. There's no
point in passing --no-compaction-heuristic when the variable
is false, since nothing else could have turned it on.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-svn: document the 'git svn propset' command
Alfred Perlstein [Wed, 15 Jun 2016 05:19:50 +0000 (22:19 -0700)] 
git-svn: document the 'git svn propset' command

Add example usage to the git-svn documentation.

Reported-by: Joseph Pecoraro <pecoraro@apple.com>
Signed-off-by: Alfred Perlstein <alfred@freebsd.org>
Reviewed-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoblame, line-log: do not loop around deref_tag()
Junio C Hamano [Tue, 14 Jun 2016 20:38:14 +0000 (13:38 -0700)] 
blame, line-log: do not loop around deref_tag()

These callers appear to expect that deref_tag() is to peel one layer
of a tag, but the function does not work that way; it has its own
loop to unwrap tags until an object that is not a tag appears.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agognome-keyring: Don't hard-code pkg-config executable
Heiko Becker [Tue, 14 Jun 2016 11:27:05 +0000 (13:27 +0200)] 
gnome-keyring: Don't hard-code pkg-config executable

Helpful if your pkg-config executable has a prefix based on the
architecture, for example.

Signed-off-by: Heiko Becker <heirecka@exherbo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin/fetch.c: don't free remote->name after fetch
Keith McGuigan [Tue, 14 Jun 2016 18:28:56 +0000 (14:28 -0400)] 
builtin/fetch.c: don't free remote->name after fetch

Make fetch's string_list of remote names own all of its string items
(strdup'ing when necessary) so that it can deallocate them safely
when clearing.

Signed-off-by: Keith McGuigan <kmcguigan@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agostrbuf: describe the return value of strbuf_read_file
Pranit Bauva [Tue, 14 Jun 2016 06:14:11 +0000 (11:44 +0530)] 
strbuf: describe the return value of strbuf_read_file

Mentored-by: Lars Schneider <larsxschneider@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofetch: document that pruning happens before fetching
Jeff King [Mon, 13 Jun 2016 23:58:51 +0000 (19:58 -0400)] 
fetch: document that pruning happens before fetching

This was changed in 10a6cc8 (fetch --prune: Run prune before
fetching, 2014-01-02), but it seems that nobody in that
discussion realized we were advertising the "after"
explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agolib-httpd.sh: print error.log on error
Nguyễn Thái Ngọc Duy [Mon, 13 Jun 2016 12:35:09 +0000 (19:35 +0700)] 
lib-httpd.sh: print error.log on error

Failure to bring up httpd for testing is not considered an error, so the
trash directory, which contains this error.log file, is removed and we
don't know what made httpd fail to start. Improve the situation a bit,
print error.log but only in verbose mode.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoGit 2.9 v2.9.0
Junio C Hamano [Mon, 13 Jun 2016 17:42:13 +0000 (10:42 -0700)] 
Git 2.9

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agouse string_list initializer consistently
Jeff King [Mon, 13 Jun 2016 10:04:20 +0000 (06:04 -0400)] 
use string_list initializer consistently

There are two types of string_lists: those that own the
string memory, and those that don't. You can tell the
difference by the strdup_strings flag, and one should use
either STRING_LIST_INIT_DUP, or STRING_LIST_INIT_NODUP as an
initializer.

Historically, the normal all-zeros initialization has
corresponded to the NODUP case. Many sites use no
initializer at all, and that works as a shorthand for that
case. But for a reader of the code, it can be hard to
remember which is which. Let's be more explicit and actually
have each site declare which type it means to use.

This is a fairly mechanical conversion; I assumed each site
was correct as-is, and just switched them all to NODUP.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/parseopt-string-list' into jk/string-list-static-init
Junio C Hamano [Mon, 13 Jun 2016 17:37:48 +0000 (10:37 -0700)] 
Merge branch 'jk/parseopt-string-list' into jk/string-list-static-init

* jk/parseopt-string-list:
  blame,shortlog: don't make local option variables static
  interpret-trailers: don't duplicate option strings
  parse_opt_string_list: stop allocating new strings

8 years agoblame,shortlog: don't make local option variables static
Jeff King [Mon, 13 Jun 2016 05:39:28 +0000 (01:39 -0400)] 
blame,shortlog: don't make local option variables static

There's no need for these option variables to be static,
except that they are referenced by the options array itself,
which is static. But having all of this static is simply
unnecessary and confusing (and inconsistent with most other
commands, which either use a static global option list or a
true function-local one).

Note that in some cases we may need to actually initialize
the variables (since we cannot rely on BSS to do so). This
is a net improvement to readability, though, as we can use
the more verbose initializers for our string_lists.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agointerpret-trailers: don't duplicate option strings
Jeff King [Mon, 13 Jun 2016 05:39:20 +0000 (01:39 -0400)] 
interpret-trailers: don't duplicate option strings

There's no need to do so; the argv strings will last until
the end of the program.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoparse_opt_string_list: stop allocating new strings
Jeff King [Mon, 13 Jun 2016 05:39:12 +0000 (01:39 -0400)] 
parse_opt_string_list: stop allocating new strings

The parse_opt_string_list callback is basically a thin
wrapper to string_list_append() any string options we get.
However, it calls:

  string_list_append(v, xstrdup(arg));

which duplicates the option value. This is wrong for two
reasons:

  1. If the string list has strdup_strings set, then we are
     making an extra copy, which is simply leaked.

  2. If the string list does not have strdup_strings set,
     then we pass memory ownership to the string list, but
     it does not realize this. If we later call
     string_list_clear(), which can happen if "--no-foo" is
     passed, then we will leak all of the existing entries.

Instead, we should just pass the argument straight to
string_list_append, and it can decide whether to copy or not
based on its strdup_strings flag.

It's possible that some (buggy) caller could be relying on
this extra copy (e.g., because it parses some options from
an allocated argv array and then frees the array), but it's
not likely. For one, we generally only use parse_options on
the argv given to us in main(). And two, such a caller is
broken anyway, because other option types like OPT_STRING()
do not make such a copy.  This patch brings us in line with
them.

Noticed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge tag 'l10n-2.9.0-rc0' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 13 Jun 2016 01:00:57 +0000 (18:00 -0700)] 
Merge tag 'l10n-2.9.0-rc0' of git://github.com/git-l10n/git-po

l10n-2.9.0-rc0

* tag 'l10n-2.9.0-rc0' of git://github.com/git-l10n/git-po:
  l10n: ko.po: Update Korean translation
  l10n: ru.po: update Russian translation
  l10n: de.po: translate 104 new messages
  l10n: zh_CN: review for git v2.9.0 l10n round 1
  l10n: zh_CN: for git v2.9.0 l10n round 1
  l10n: pt_PT: update Portuguese translation
  l10n: pt_PT: update according to git-gui glossary
  l10n: pt_PT: merge git.pot file
  l10n: Updated Bulgarian translation of git (2597t,0f,0u)
  l10n: sv.po: Update Swedish translation (2597t0f0u)
  l10n: fr.po v2.9.0rnd1
  l10n: Updated Vietnamese translation (2597t)
  l10n: git.pot: v2.9.0 round 1 (104 new, 37 removed)
  l10n: fr.po Fixed grammar mistake

8 years agol10n: ko.po: Update Korean translation
Changwoo Ryu [Sat, 11 Jun 2016 16:25:58 +0000 (01:25 +0900)] 
l10n: ko.po: Update Korean translation

8 years agoMerge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ru
Jiang Xin [Sat, 11 Jun 2016 12:21:52 +0000 (20:21 +0800)] 
Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ru

* 'russian-l10n' of https://github.com/DJm00n/git-po-ru:
  l10n: ru.po: update Russian translation

8 years agol10n: ru.po: update Russian translation
Dimitriy Ryazantcev [Sat, 11 Jun 2016 09:53:43 +0000 (12:53 +0300)] 
l10n: ru.po: update Russian translation

Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
8 years agoHopefully the final last-minute update before 2.9 final
Junio C Hamano [Fri, 10 Jun 2016 22:30:19 +0000 (15:30 -0700)] 
Hopefully the final last-minute update before 2.9 final

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/diff-compact-heuristic'
Junio C Hamano [Fri, 10 Jun 2016 22:26:06 +0000 (15:26 -0700)] 
Merge branch 'jk/diff-compact-heuristic'

It turns out that the earlier effort to update the heuristics may
want to use a bit more time to mature.  Turn it off by default.

* jk/diff-compact-heuristic:
  diff: disable compaction heuristic for now

8 years agoMerge branch 'jk/shell-portability'
Junio C Hamano [Fri, 10 Jun 2016 22:26:04 +0000 (15:26 -0700)] 
Merge branch 'jk/shell-portability'

test fixes.

* jk/shell-portability:
  t5500 & t7403: lose bash-ism "local"
  test-lib: add in-shell "env" replacement

8 years agoMerge branch 'jc/t2300-setup'
Junio C Hamano [Fri, 10 Jun 2016 22:26:04 +0000 (15:26 -0700)] 
Merge branch 'jc/t2300-setup'

A test fix.

* jc/t2300-setup:
  t2300: run git-sh-setup in an environment that better mimics the real life

8 years agoconfig.c: fix misspelt "occurred" in an error message
Peter Colberg [Fri, 10 Jun 2016 19:05:26 +0000 (15:05 -0400)] 
config.c: fix misspelt "occurred" in an error message

Signed-off-by: Peter Colberg <peter@colberg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs.h: fix misspelt "occurred" in a comment
Peter Colberg [Fri, 10 Jun 2016 19:05:26 +0000 (15:05 -0400)] 
refs.h: fix misspelt "occurred" in a comment

Signed-off-by: Peter Colberg <peter@colberg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodiff: disable compaction heuristic for now
Junio C Hamano [Fri, 10 Jun 2016 17:58:55 +0000 (10:58 -0700)] 
diff: disable compaction heuristic for now

http://lkml.kernel.org/g/20160610075043.GA13411@sigill.intra.peff.net
reports that a change to add a new "function" with common ending
with the existing one at the end of the file is shown like this:

    def foo
      do_foo_stuff()

   +  common_ending()
   +end
   +
   +def bar
   +  do_bar_stuff()
   +
      common_ending()
    end

when the new heuristic is in use.  In reality, the change is to add
the blank line before "def bar" and everything below, which is what
the code without the new heuristic shows.

Disable the heuristics by default, and resurrect the documentation
for the option and the configuration variables, while clearly
marking the feature as still experimental.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompletion: add git status
Thomas Braun [Fri, 10 Jun 2016 10:12:06 +0000 (12:12 +0200)] 
completion: add git status

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompletion: add __git_get_option_value helper
Thomas Braun [Fri, 10 Jun 2016 10:12:05 +0000 (12:12 +0200)] 
completion: add __git_get_option_value helper

This function allows to search the commmand line and config
files for an option, long and short, with mandatory value.

The function would return e.g. for the command line
"git status -uno --untracked-files=all" the result
"all" regardless of the config option.

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompletion: factor out untracked file modes into a variable
Thomas Braun [Fri, 10 Jun 2016 10:12:04 +0000 (12:12 +0200)] 
completion: factor out untracked file modes into a variable

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agowrite_or_die: remove the unused write_or_whine() function
Ramsay Jones [Thu, 9 Jun 2016 22:52:22 +0000 (23:52 +0100)] 
write_or_die: remove the unused write_or_whine() function

Now the last caller of this function is gone, and new ones are
unlikely to appear, because this function is doing very little that
a regular if() does not besides obfuscating the error message (and
if we ever did want something like it, we would probably prefer the
function to come back with more "normal" return value semantics).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agol10n: de.po: translate 104 new messages
Ralf Thielow [Fri, 10 Jun 2016 16:00:46 +0000 (18:00 +0200)] 
l10n: de.po: translate 104 new messages

Translate 104 new messages came from git.pot update in f517e50
(l10n: git.pot: v2.9.0 round 1 (104 new, 37 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
8 years agoxdiff: fix merging of appended hunk with -W
René Scharfe [Thu, 9 Jun 2016 21:54:48 +0000 (23:54 +0200)] 
xdiff: fix merging of appended hunk with -W

When -W is given we search the lines between the end of the current
context and the next change for a function line.  If there is none then
we merge those two hunks as they must be part of the same function.

If the next change is an appended chunk we abort the search early in
get_func_line(), however, because its line number is out of range.  Fix
that by searching from the end of the pre-image in that case instead.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoUse "working tree" instead of "working directory" for git status
Lars Vogel [Thu, 9 Jun 2016 18:19:30 +0000 (20:19 +0200)] 
Use "working tree" instead of "working directory" for git status

Working directory can be easily confused with the current directory.
In one of my patches I already updated the usage of working directory
with working tree for the man page but I noticed that git status also
uses this incorrect term.

Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin/commit.c: memoize git-path for COMMIT_EDITMSG
Pranit Bauva [Tue, 24 May 2016 19:19:50 +0000 (00:49 +0530)] 
builtin/commit.c: memoize git-path for COMMIT_EDITMSG

This is a follow up commit for f932729c (memoize common git-path
"constant" files, 10-Aug-2015).

The many function calls to git_path() are replaced by
git_path_commit_editmsg() and which thus eliminates the need to repeatedly
compute the location of "COMMIT_EDITMSG".

Mentored-by: Lars Schneider <larsxschneider@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agol10n: zh_CN: review for git v2.9.0 l10n round 1
Ray Chen [Sun, 5 Jun 2016 16:06:17 +0000 (00:06 +0800)] 
l10n: zh_CN: review for git v2.9.0 l10n round 1

Signed-off-by: Ray Chen <oldsharp@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
8 years agosend-pack: use buffered I/O to talk to pack-objects
Jeff King [Wed, 8 Jun 2016 19:42:16 +0000 (15:42 -0400)] 
send-pack: use buffered I/O to talk to pack-objects

We start a pack-objects process and then write all of the
positive and negative sha1s to it over a pipe. We do so by
formatting each item into a fixed-size buffer and then
writing each individually. This has two drawbacks:

  1. There's some manual computation of the buffer size,
     which is not immediately obvious is correct (though it
     is).

  2. We write() once per sha1, which means a lot more system
     calls than are necessary.

We can solve both by wrapping the pipe descriptor in a stdio
handle; this is the same technique used by upload-pack when
serving fetches.

Note that we can also simplify and improve the error
handling here. The original detected a single write error
and broke out of the loop (presumably to avoid writing the
error message over and over), but never actually acted on
seeing an error; we just fed truncated input and took
whatever pack-objects returned.

In practice, this probably didn't matter, as the likely
errors would be caused by pack-objects dying (and we'd
probably just die with SIGPIPE anyway). But we can easily
make this simpler and more robust; the stdio handle keeps an
error flag, which we can check at the end.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodoc: change configuration variables format
Tom Russello [Wed, 8 Jun 2016 17:23:16 +0000 (19:23 +0200)] 
doc: change configuration variables format

This change configuration variables that where in italic style
to monospace font according to the guideline. It was obtained with

grep '[[:alpha:]]*\.[[:alpha:]]*::$' config.txt | \
sed -e 's/::$//' -e 's/\./\\\\./' | \
xargs -iP perl -pi -e "s/\'P\'/\`P\`/g" ./*.txt

Signed-off-by: Tom Russello <tom.russello@grenoble-inp.org>
Signed-off-by: Erwan Mathoniere <erwan.mathoniere@grenoble-inp.org>
Signed-off-by: Samuel Groot <samuel.groot@grenoble-inp.org>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodoc: more consistency in environment variables format
Tom Russello [Tue, 7 Jun 2016 22:35:07 +0000 (00:35 +0200)] 
doc: more consistency in environment variables format

Wrap with backticks (monospaced font) unwrapped or single-quotes wrapped
(italic type) environment variables which are followed by the word
"environment". It was obtained with:

perl -pi -e "s/\'?(\\\$?[0-9A-Z\_]+)\'?(?= environment ?)/\`\1\`/g" *.txt

One of the main purposes is to stick to the CodingGuidelines as possible so
that people writting new documentation by mimicking the existing are more likely
to have it right (even if they didn't read the CodingGuidelines).

Signed-off-by: Tom Russello <tom.russello@grenoble-inp.org>
Signed-off-by: Erwan Mathoniere <erwan.mathoniere@grenoble-inp.org>
Signed-off-by: Samuel Groot <samuel.groot@grenoble-inp.org>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodoc: change environment variables format
Tom Russello [Tue, 7 Jun 2016 22:35:06 +0000 (00:35 +0200)] 
doc: change environment variables format

This change GIT_* variables that where in italic style to monospaced font
according to the guideline. It was obtained with

perl -pi -e "s/\'(GIT_.*?)\'/\`\1\`/g" *.txt

One of the main purposes is to stick to the CodingGuidelines as possible so
that people writting new documentation by mimicking the existing are more likely
to have it right (even if they didn't read the CodingGuidelines).

Signed-off-by: Tom Russello <tom.russello@grenoble-inp.org>
Signed-off-by: Erwan Mathoniere <erwan.mathoniere@grenoble-inp.org>
Signed-off-by: Samuel Groot <samuel.groot@grenoble-inp.org>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodoc: clearer rule about formatting literals
Tom Russello [Tue, 7 Jun 2016 22:35:05 +0000 (00:35 +0200)] 
doc: clearer rule about formatting literals

Make the guideline text that we want for our documentation clearer.

Signed-off-by: Tom Russello <tom.russello@grenoble-inp.org>
Signed-off-by: Erwan Mathoniere <erwan.mathoniere@grenoble-inp.org>
Signed-off-by: Samuel Groot <samuel.groot@grenoble-inp.org>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotree-diff: avoid alloca for large allocations
Jeff King [Tue, 7 Jun 2016 22:53:00 +0000 (18:53 -0400)] 
tree-diff: avoid alloca for large allocations

Commit 72441af (tree-diff: rework diff_tree() to generate
diffs for multiparent cases as well, 2014-04-07) introduced
the use of alloca so that the common cases of commits with 1
or 2 parents would not be adversely affected by going
through the multi-parent code.

However, our xalloca is not ideal when the number of parents
grows very large:

  1. If the requested size is too large for our stack,
     alloca() has no way to tell us, and we simply segfault
     while trying to access the memory.

  2. It does not use our usual memory_limit_check() logic.

I measured, and alloca is indeed buying us a very small
speedup over xmalloc()/free(). So we'd want to keep
something like it.

This patch simply puts a conditional in place at each
callsite: we use alloca for common known-small numbers of
parents, and otherwise use the heap. We are technically
still vulnerable to (1), but no more so than if we simply
put a few dozen bytes on the stack, which we must do all the
time anyway. And likewise, we technically miss a memory
limit check if it is tiny, but such a limit is pointless.

An alternative to this would be implement something like:

  struct tree *tp, tp_fallback[2];
  if (nparent <= ARRAY_SIZE(tp_fallback))
          tp = tp_fallback;
  else
  ALLOC_ARRAY(tp, nparent);
  ...
  if (tp != tp_fallback)
  free(tp);

That would let us drop our xalloca() portability code
entirely. But in my measurements, this seemed to perform
slightly worse than the xalloca solution.

Note in the example above, and in the patch below, I've used
ALLOC_ARRAY() to replace the manual xmalloc(nr * sizeof(*x)).
Besides being shorter, this has the bonus that one cannot
accidentally overflow a size_t during that computation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoadd: add --chmod=+x / --chmod=-x options
Edward Thomson [Tue, 31 May 2016 22:08:18 +0000 (17:08 -0500)] 
add: add --chmod=+x / --chmod=-x options

The executable bit will not be detected (and therefore will not be
set) for paths in a repository with `core.filemode` set to false,
though the users may still wish to add files as executable for
compatibility with other users who _do_ have `core.filemode`
functionality.  For example, Windows users adding shell scripts may
wish to add them as executable for compatibility with users on
non-Windows.

Although this can be done with a plumbing command
(`git update-index --add --chmod=+x foo`), teaching the `git-add`
command allows users to set a file executable with a command that
they're already familiar with.

Signed-off-by: Edward Thomson <ethomson@edwardthomson.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoregex: fix a SIZE_MAX macro redefinition warning
Ramsay Jones [Tue, 7 Jun 2016 00:35:33 +0000 (01:35 +0100)] 
regex: fix a SIZE_MAX macro redefinition warning

Since commit 56a1a3ab ("Silence GCC's \"cast of pointer to integer of a
different size\" warning", 26-10-2015), sparse has been issuing a macro
redefinition warning for the SIZE_MAX macro. However, gcc did not issue
any such warning.

After commit 56a1a3ab, in terms of the order of #includes and #defines,
the code looked something like:

  $ cat -n junk.c
       1 #include <stddef.h>
       2
       3 #define SIZE_MAX ((size_t) -1)
       4
       5 #include <stdint.h>
       6
       7 int main(int argc, char *argv[])
       8 {
       9 return 0;
      10 }
  $
  $ gcc junk.c
  $

However, if you compile that file with -Wsystem-headers, then it will
also issue a warning. Having set -Wsystem-headers in CFLAGS, using the
config.mak file, then (on cygwin):

  $ make compat/regex/regex.o
      CC compat/regex/regex.o
  In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/stdint.h:9:0,
                   from compat/regex/regcomp.c:21,
                   from compat/regex/regex.c:77:
  /usr/include/stdint.h:362:0: warning: "SIZE_MAX" redefined
   #define SIZE_MAX (__SIZE_MAX__)
   ^
  In file included from compat/regex/regex.c:69:0:
  compat/regex/regex_internal.h:108:0: note: this is the location of the previous definition
   # define SIZE_MAX ((size_t) -1)
   ^
  $

The compilation of the compat/regex code is somewhat unusual in that the
regex.c file directly #includes the other c files (regcomp.c, regexec.c
and regex_internal.c). Commit 56a1a3ab added an #include of <stdint.h>
to the regcomp.c file, which results in the redefinition, since this is
included after the regex_internal.h header. This header file contains a
'fallback' definition for SIZE_MAX, in order to support systems which do
not have the <stdint.h> header (the HAVE_STDINT_H macro is not defined).

In order to suppress the warning, we move the #include of <stdint.h>
from regcomp.c to the start of the compilation unit, close to the top
of regex.c, prior to the #include of the regex_internal.h header.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoreflog: continue walking the reflog past root commits
SZEDER Gábor [Fri, 3 Jun 2016 20:42:35 +0000 (22:42 +0200)] 
reflog: continue walking the reflog past root commits

If a repository contains more than one root commit, then its HEAD
reflog may contain multiple "creation events", i.e. entries whose
"from" value is the null sha1.  Listing such a reflog currently stops
prematurely at the first such entry, even when the reflog still
contains older entries.  This can scare users into thinking that their
reflog got truncated after 'git checkout --orphan'.

Continue walking the reflog past such creation events based on the
preceeding reflog entry's "new" value.

The test 'symbolic-ref writes reflog entry' in t1401-symbolic-ref
implicitly relies on the current behavior of the reflog walker to stop
at a root commit and thus to list only the reflog entries that are
relevant for that test.  Adjust the test to explicitly specify the
number of relevant reflog entries to be listed.

Reported-by: Patrik Gustafsson <pvn@textalk.se>
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoGit 2.9-rc2 v2.9.0-rc2
Junio C Hamano [Mon, 6 Jun 2016 21:19:45 +0000 (14:19 -0700)] 
Git 2.9-rc2

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