OSDN Git Service

git-core/git.git
8 years agoMerge branch 'ak/t7800-wo-readlink'
Junio C Hamano [Wed, 6 Jul 2016 20:38:16 +0000 (13:38 -0700)]
Merge branch 'ak/t7800-wo-readlink'

One among four invocations of readlink(1) in our test suite has
been rewritten so that the test can run on systems without the
command (others are in valgrind test framework and t9802).

* ak/t7800-wo-readlink:
  t7800: readlink may not be available

8 years agoMerge branch 'jk/tzoffset-fix'
Junio C Hamano [Wed, 6 Jul 2016 20:38:15 +0000 (13:38 -0700)]
Merge branch 'jk/tzoffset-fix'

The internal code used to show local timezone offset is not
prepared to handle timestamps beyond year 2100, and gave a
bogus offset value to the caller.  Use a more benign looking
+0000 instead and let "git log" going in such a case, instead
of aborting.

* jk/tzoffset-fix:
  local_tzoffset: detect errors from tm_to_time_t
  t0006: test various date formats
  t0006: rename test-date's "show" to "relative"

8 years agoMerge branch 'js/mingw-parameter-less-c-functions'
Junio C Hamano [Wed, 6 Jul 2016 20:38:14 +0000 (13:38 -0700)]
Merge branch 'js/mingw-parameter-less-c-functions'

Some platform-specific code had non-ANSI strict declarations of C
functions that do not take any parameters, which has been
corrected.

* js/mingw-parameter-less-c-functions:
  mingw: let the build succeed with DEVELOPER=1

8 years agoMerge branch 'lc/shell-default-value-noexpand'
Junio C Hamano [Wed, 6 Jul 2016 20:38:14 +0000 (13:38 -0700)]
Merge branch 'lc/shell-default-value-noexpand'

Fix unnecessarily waste in the idiomatic use of ': ${VAR=default}'
to set the default value, without enclosing it in double quotes.

* lc/shell-default-value-noexpand:
  sh-setup: enclose setting of ${VAR=default} in double-quotes

8 years agoMerge branch 'sb/clone-shallow-passthru'
Junio C Hamano [Wed, 6 Jul 2016 20:38:13 +0000 (13:38 -0700)]
Merge branch 'sb/clone-shallow-passthru'

Fix an unintended regression in v2.9 that breaks "clone --depth"
that recurses down to submodules by forcing the submodules to also
be cloned shallowly, which many server instances that host upstream
of the submodules are not prepared for.

* sb/clone-shallow-passthru:
  clone: do not let --depth imply --shallow-submodules

8 years agoMerge branch 'jk/gpg-interface-cleanup'
Junio C Hamano [Wed, 6 Jul 2016 20:38:12 +0000 (13:38 -0700)]
Merge branch 'jk/gpg-interface-cleanup'

A new run-command API function pipe_command() is introduced to
sanely feed data to the standard input while capturing data from
the standard output and the standard error of an external process,
which is cumbersome to hand-roll correctly without deadlocking.

The codepath to sign data in a prepared buffer with GPG has been
updated to use this API to read from the status-fd to check for
errors (instead of relying on GPG's exit status).

* jk/gpg-interface-cleanup:
  gpg-interface: check gpg signature creation status
  sign_buffer: use pipe_command
  verify_signed_buffer: use pipe_command
  run-command: add pipe_command helper
  verify_signed_buffer: use tempfile object
  verify_signed_buffer: drop pbuf variable
  gpg-interface: use child_process.args

8 years agoMerge branch 'mg/signature-doc'
Junio C Hamano [Wed, 6 Jul 2016 20:38:12 +0000 (13:38 -0700)]
Merge branch 'mg/signature-doc'

Formats of the various data (and how to validate them) where we use
GPG signature have been documented.

* mg/signature-doc:
  Documentation/technical: signed merge tag format
  Documentation/technical: signed commit format
  Documentation/technical: signed tag format
  Documentation/technical: describe signature formats

8 years agoMerge branch 'nd/graph-width-padded'
Junio C Hamano [Wed, 6 Jul 2016 20:38:12 +0000 (13:38 -0700)]
Merge branch 'nd/graph-width-padded'

"log --graph --format=" learned that "%>|(N)" specifies the width
relative to the terminal's left edge, not relative to the area to
draw text that is to the right of the ancestry-graph section.  It
also now accepts negative N that means the column limit is relative
to the right border.

* nd/graph-width-padded:
  pretty.c: support <direction>|(<negative number>) forms
  pretty: pass graph width to pretty formatting for use in '%>|(N)'

8 years agoMerge branch 'jk/repack-keep-unreachable'
Junio C Hamano [Wed, 6 Jul 2016 20:38:11 +0000 (13:38 -0700)]
Merge branch 'jk/repack-keep-unreachable'

"git repack" learned the "--keep-unreachable" option, which sends
loose unreachable objects to a pack instead of leaving them loose.
This helps heuristics based on the number of loose objects
(e.g. "gc --auto").

* jk/repack-keep-unreachable:
  repack: extend --keep-unreachable to loose objects
  repack: add --keep-unreachable option
  repack: document --unpack-unreachable option

8 years agoMerge branch 'ew/mboxrd-format-am'
Junio C Hamano [Wed, 6 Jul 2016 20:38:11 +0000 (13:38 -0700)]
Merge branch 'ew/mboxrd-format-am'

Teach format-patch and mailsplit (hence "am") how a line that
happens to begin with "From " in the e-mail message is quoted with
">", so that these lines can be restored to their original shape.

* ew/mboxrd-format-am:
  am: support --patch-format=mboxrd
  mailsplit: support unescaping mboxrd messages
  pretty: support "mboxrd" output format

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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 agot7800: readlink may not be available
Armin Kunaschik [Tue, 31 May 2016 00:26:12 +0000 (02:26 +0200)]
t7800: readlink may not be available

The readlink(1) command is not available on all platforms (notably
not on AIX and HP-UX) and can be replaced in this test with the
"workaround"

ls -ld <name> | sed -e 's/.* -> //'

This is no universal readlink replacement but works in the
controlled test environment well enough.

Signed-off-by: Armin Kunaschik <megabreit@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agolocal_tzoffset: detect errors from tm_to_time_t
Jeff King [Mon, 20 Jun 2016 21:14:14 +0000 (17:14 -0400)]
local_tzoffset: detect errors from tm_to_time_t

When we want to know the local timezone offset at a given
timestamp, we compute it by asking for localtime() at the
given time, and comparing the offset to GMT at that time.
However, there's some juggling between time_t and "struct
tm" which happens, which involves calling our own
tm_to_time_t().

If that function returns an error (e.g., because it only
handles dates up to the year 2099), it returns "-1", which
we treat as a time_t, and is clearly bogus, leading to
bizarre timestamps (that seem to always adjust the time back
to (time_t)(uint32_t)-1, in the year 2106).

It's not a good idea for local_tzoffset() to simply die
here; it would make it hard to run "git log" on a repository
with funny timestamps. Instead, let's just treat such cases
as "zero offset".

Reported-by: Norbert Kiesel <nkiesel@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot0006: test various date formats
Jeff King [Mon, 20 Jun 2016 21:11:59 +0000 (17:11 -0400)]
t0006: test various date formats

We ended up testing some of these date formats throughout
the rest of the suite (e.g., via for-each-ref's
"$(authordate:...)" format), but we never did so
systematically. t0006 is the right place for unit-testing of
our date-handling code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot0006: rename test-date's "show" to "relative"
Jeff King [Mon, 20 Jun 2016 21:10:29 +0000 (17:10 -0400)]
t0006: rename test-date's "show" to "relative"

The "show" tests are really only checking relative formats;
we should make that more clear.

This also frees up the "show" name to later check other
formats. We could later fold "relative" into a more generic
"show" command, but it's not worth it.  Relative times are a
special case already because we have to munge the concept of
"now" in our tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agomingw: let the build succeed with DEVELOPER=1
Johannes Schindelin [Sat, 18 Jun 2016 12:38:36 +0000 (14:38 +0200)]
mingw: let the build succeed with DEVELOPER=1

The recently introduced developer flags identified a couple of
old-style function declarations in the Windows-specific code where
the parameter list was left empty instead of specifying "void"
explicitly. Let's just fix them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoclone: do not let --depth imply --shallow-submodules
Junio C Hamano [Sun, 19 Jun 2016 20:51:56 +0000 (13:51 -0700)]
clone: do not let --depth imply --shallow-submodules

In v2.9.0, we prematurely flipped the default to force cloning
submodules shallowly, when the superproject is getting cloned
shallowly.  This is likely to fail when the upstream repositories
submodules are cloned from a repository that is not prepared to
serve histories that ends at a commit that is not at the tip of a
branch, and we know the world is not yet ready.

Use a safer default to clone the submodules fully, unless the user
tells us that she knows that the upstream repository of the
submodules are willing to cooperate with "--shallow-submodules"
option.

Noticed-by: Vadim Eisenberg <VADIME@il.ibm.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agosh-setup: enclose setting of ${VAR=default} in double-quotes
LE Manh Cuong [Sat, 18 Jun 2016 20:26:03 +0000 (03:26 +0700)]
sh-setup: enclose setting of ${VAR=default} in double-quotes

We often make sure an environment variable is set to
something, either set by the user (in which case we do not
molest it) or set it to our default value (otherwise), with

: ${VAR=default value}

i.e. running the no-op command ":" with ${VAR} as its
parameters (or the default value we supply), relying on that
":" is a no-op.

This pattern, even though it is no-op from correctness point
of view, still can be expensive if the existing value in VAR
has shell glob (because they will be expanded against
filesystem entities) and IFS whitespaces (because the value
need to be split into multiple parameters).  Our invocation
of ":" command does not care if the parameter given to it is
after the value in VAR goes through these processing.

Enclosing the whole thing in double-quote, i.e.

: "${VAR=default value}"

avoids paying the unnecessary cost, so let's do so.

Signed-off-by: LE Manh Cuong <cuong.manhle.vn@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogpg-interface: check gpg signature creation status
Michael J Gruber [Fri, 17 Jun 2016 23:38:59 +0000 (19:38 -0400)]
gpg-interface: check gpg signature creation status

When we create a signature, it may happen that gpg returns with
"success" but not with an actual detached signature on stdout.

Check for the correct signature creation status to catch these cases
better. Really, --status-fd parsing is the only way to check gpg status
reliably. We do the same for verify already.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosign_buffer: use pipe_command
Jeff King [Fri, 17 Jun 2016 23:38:55 +0000 (19:38 -0400)]
sign_buffer: use pipe_command

Similar to the prior commit for verify_signed_buffer, the
motivation here is both to make the code simpler, and to
avoid any possible deadlocks with gpg.

In this case we have the same "write to stdin, then read
from stdout" that the verify case had. This is unlikely to
be a problem in practice, since stdout has the detached
signature, which it cannot compute until it has read all of
stdin (if it were a non-detached signature, that would be a
problem, though).

We don't read from stderr at all currently. However, we will
want to in a future patch, so this also prepares us there
(and in that case gpg _does_ write before reading all of the
input, though again, it is unlikely that a key uid will fill
up a pipe buffer).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoverify_signed_buffer: use pipe_command
Jeff King [Fri, 17 Jun 2016 23:38:52 +0000 (19:38 -0400)]
verify_signed_buffer: use pipe_command

This is shorter and should make the function easier to
follow. But more importantly, it removes the possibility of
any deadlocks based on reading or writing to gpg.

It's not clear if such a deadlock is possible in practice.

We do write the whole payload before reading anything, so we
could deadlock there. However, in practice gpg will need to
read our whole input to verify the signature, so it will
drain our payload first. It could write an error to stderr
before reading, but it's unlikely that such an error
wouldn't be followed by it immediately exiting, or that the
error would actually be larger than a pipe buffer.

On the writing side, we drain stderr (with the
human-readable output) in its entirety before reading stdout
(with the status-fd data). Running strace on "gpg --verify"
does show interleaved output on the two descriptors:

  write(2, "gpg: ", 5)                    = 5
  write(2, "Signature made Thu 16 Jun 2016 0"..., 73) = 73
  write(1, "[GNUPG:] SIG_ID tQw8KGcs9rBfLvAj"..., 66) = 66
  write(1, "[GNUPG:] GOODSIG 69808639F9430ED"..., 60) = 60
  write(2, "gpg: ", 5)                    = 5
  write(2, "Good signature from \"Jeff King <"..., 47) = 47
  write(2, "\n", 1)                       = 1
  write(2, "gpg: ", 5)                    = 5
  write(2, "                aka \"Jeff King <"..., 49) = 49
  write(2, "\n", 1)                       = 1
  write(1, "[GNUPG:] VALIDSIG C49CE24156AF08"..., 135) = 135
  write(1, "[GNUPG:] TRUST_ULTIMATE\n", 24) = 24

The second line written to stdout there contains the
signer's UID, which can be arbitrarily long. If it fills the
pipe buffer, then gpg would block writing to its stdout,
while we are blocked trying to read its stderr.

In practice, GPG seems to limit UIDs to 2048 bytes, so
unless your pipe buffer size is quite small, or unless gpg
does not enforce the limit under some conditions, this seems
unlikely in practice.

Still, it is not hard for us to be cautious and just use
pipe_command.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorun-command: add pipe_command helper
Jeff King [Fri, 17 Jun 2016 23:38:47 +0000 (19:38 -0400)]
run-command: add pipe_command helper

We already have capture_command(), which captures the stdout
of a command in a way that avoids deadlocks. But sometimes
we need to do more I/O, like capturing stderr as well, or
sending data to stdin. It's easy to write code that
deadlocks racily in these situations depending on how fast
the command reads its input, or in which order it writes its
output.

Let's give callers an easy interface for doing this the
right way, similar to what capture_command() did for the
simple case.

The whole thing is backed by a generic poll() loop that can
feed an arbitrary number of buffers to descriptors, and fill
an arbitrary number of strbufs from other descriptors. This
seems like overkill, but the resulting code is actually a
bit cleaner than just handling the three descriptors
(because the output code for stdout/stderr is effectively
duplicated, so being able to loop is a benefit).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoverify_signed_buffer: use tempfile object
Jeff King [Fri, 17 Jun 2016 23:38:43 +0000 (19:38 -0400)]
verify_signed_buffer: use tempfile object

We use git_mkstemp to create a temporary file, and try to
clean it up in all exit paths from the function. But that
misses any cases where we die by signal, or by calling die()
in a sub-function. In addition, we missed one of the exit
paths.

Let's convert to using a tempfile object, which handles the
hard cases for us, and add the missing cleanup call. Note
that we would not simply want to rely on program exit to
catch our missed cleanup, as this function may be called
many times in a single program (for the same reason, we use
a static tempfile instead of heap-allocating a new one; that
gives an upper bound on our memory usage).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoverify_signed_buffer: drop pbuf variable
Jeff King [Fri, 17 Jun 2016 23:38:39 +0000 (19:38 -0400)]
verify_signed_buffer: drop pbuf variable

If our caller gave us a non-NULL gpg_status parameter, we
write the gpg status into their strbuf. If they didn't, then
we write it to a temporary local strbuf (since we still need
to look at it).  The variable "pbuf" adds an extra layer of
indirection so that the rest of the function can just access
whichever is appropriate.

However, the name "pbuf" isn't very descriptive, and it's
easy to get confused about what is supposed to be in it
(especially because we are reading both "status" and
"output" from gpg).

Rather than give it a more descriptive name, we can just use
gpg_status as our indirection pointer. Either it points to
the caller's input, or we can point it directly to our
temporary buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogpg-interface: use child_process.args
Jeff King [Fri, 17 Jun 2016 23:38:35 +0000 (19:38 -0400)]
gpg-interface: use child_process.args

Our argv allocations are relatively straightforward, but
this avoids us having to manually keep the count up to date
(or create new to-be-replaced slots in the declaration) when
we add new arguments.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/technical: signed merge tag format
Michael J Gruber [Fri, 17 Jun 2016 07:46:11 +0000 (09:46 +0200)]
Documentation/technical: signed merge tag format

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/technical: signed commit format
Michael J Gruber [Fri, 17 Jun 2016 07:46:10 +0000 (09:46 +0200)]
Documentation/technical: signed commit format

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/technical: signed tag format
Michael J Gruber [Fri, 17 Jun 2016 07:46:09 +0000 (09:46 +0200)]
Documentation/technical: signed tag format

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/technical: describe signature formats
Michael J Gruber [Fri, 17 Jun 2016 07:46:08 +0000 (09:46 +0200)]
Documentation/technical: describe signature formats

We use different types of signature formats in different places.
Set up the infrastructure and overview to describe them systematically
in our technical documentation.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 agopretty.c: support <direction>|(<negative number>) forms
Nguyễn Thái Ngọc Duy [Thu, 16 Jun 2016 13:18:38 +0000 (20:18 +0700)]
pretty.c: support <direction>|(<negative number>) forms

%>|(num), %><|(num) and %<|(num), where num is a positive number, sets a
fixed column from the screen's left border. There is no way for us to
specifiy a column relative to the right border, which is useful when you
want to make use of all terminal space (on big screens). Use negative
num for that. Inspired by Go's array syntax (*).

(*) I know Python has this first (or before Go, at least) but the idea
didn't occur to me until I learned Go.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agopretty: pass graph width to pretty formatting for use in '%>|(N)'
Josef Kufner [Thu, 16 Jun 2016 13:18:37 +0000 (20:18 +0700)]
pretty: pass graph width to pretty formatting for use in '%>|(N)'

Pass graph width to pretty formatting, to make N in '%>|(N)'
include columns consumed by graph rendered when --graph option
is in use.

For example, in the output of

  git log --all --graph --pretty='format: [%>|(20)%h] %ar%d'

this change will make all commit hashes align at 20th column from
the edge of the terminal, not from the edge of the graph.

Signed-off-by: Josef Kufner <josef@kufner.cz>
Signed-off-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>
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 agorepack: extend --keep-unreachable to loose objects
Jeff King [Mon, 13 Jun 2016 04:38:04 +0000 (00:38 -0400)]
repack: extend --keep-unreachable to loose objects

If you use "repack -adk" currently, we will pack all objects
that are already packed into the new pack, and then drop the
old packs. However, loose unreachable objects will be left
as-is. In theory these are meant to expire eventually with
"git prune". But if you are using "repack -k", you probably
want to keep things forever and therefore do not run "git
prune" at all. Meaning those loose objects may build up over
time and end up fooling any object-count heuristics (such as
the one done by "gc --auto", though since git-gc does not
support "repack -k", this really applies to whatever custom
scripts people might have driving "repack -k").

With this patch, we instead stuff any loose unreachable
objects into the pack along with the already-packed
unreachable objects. This may seem wasteful, but it is
really no more so than using "repack -k" in the first place.
We are at a slight disadvantage, in that we have no useful
ordering for the result, or names to hand to the delta code.
However, this is again no worse than what "repack -k" is
already doing for the packed objects. The packing of these
objects doesn't matter much because they should not be
accessed frequently (unless they actually _do_ become
referenced, but then they would get moved to a different
part of the packfile during the next repack).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorepack: add --keep-unreachable option
Jeff King [Mon, 13 Jun 2016 04:36:28 +0000 (00:36 -0400)]
repack: add --keep-unreachable option

The usual way to do a full repack (and what is done by
git-gc) is to run "repack -Ad --unpack-unreachable=<when>",
which will loosen any unreachable objects newer than
"<when>", and drop any older ones.

This is a safer alternative to "repack -ad", because
"<when>" becomes a grace period during which we will not
drop any new objects that are about to be referenced.
However, it isn't perfectly safe. It's always possible that
a process is about to reference an old object. Even if that
process were to take care to update the timestamp on the
object, there is no atomicity with a simultaneously running
"repack" process.

So while unlikely, there is a small race wherein we may drop
an object that is in the process of being referenced. If you
do automated repacking on a large number of active
repositories, you may hit it eventually, and the result is a
corrupted repository.

It would be nice to fix that race in the long run, but it's
complicated.  In the meantime, there is a much simpler
strategy for automated repository maintenance: do not drop
objects at all. We already have a "--keep-unreachable"
option in pack-objects; we just need to plumb it through
from git-repack.

Note that this _isn't_ plumbed through from git-gc, so at
this point it's strictly a tool for people doing their own
advanced repository maintenance strategy.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorepack: document --unpack-unreachable option
Jeff King [Mon, 13 Jun 2016 04:33:54 +0000 (00:33 -0400)]
repack: document --unpack-unreachable option

This was added back in 7e52f56 (gc: do not explode objects
which will be immediately pruned, 2012-04-07), but not
documented at the time, since it was an internal detail
between git-gc and git-repack. However, as people with
complicated setups may want to effectively reimplement the
steps of git-gc themselves, it is nice for us to document
these interfaces.

Signed-off-by: Jeff King <peff@peff.net>
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