git
7 years agoMerge branch 'jk/daemon-path-ok-check-truncation'
Junio C Hamano [Thu, 27 Oct 2016 21:58:50 +0000 (14:58 -0700)] 
Merge branch 'jk/daemon-path-ok-check-truncation'

"git daemon" used fixed-length buffers to turn URL to the
repository the client asked for into the server side directory
path, using snprintf() to avoid overflowing these buffers, but
allowed possibly truncated paths to the directory.  This has been
tightened to reject such a request that causes overlong path to be
required to serve.

* jk/daemon-path-ok-check-truncation:
  daemon: detect and reject too-long paths

7 years agoMerge branch 'rs/ring-buffer-wraparound'
Junio C Hamano [Thu, 27 Oct 2016 21:58:49 +0000 (14:58 -0700)] 
Merge branch 'rs/ring-buffer-wraparound'

The code that we have used for the past 10+ years to cycle
4-element ring buffers turns out to be not quite portable in
theoretical world.

* rs/ring-buffer-wraparound:
  hex: make wraparound of the index into ring-buffer explicit

7 years agoMerge branch 'sb/submodule-ignore-trailing-slash'
Junio C Hamano [Thu, 27 Oct 2016 21:58:49 +0000 (14:58 -0700)] 
Merge branch 'sb/submodule-ignore-trailing-slash'

A minor regression fix for "git submodule".

* sb/submodule-ignore-trailing-slash:
  t0060: sidestep surprising path mangling results on Windows
  submodule: ignore trailing slash in relative url
  submodule: ignore trailing slash on superproject URL

7 years agoMerge branch 'jk/no-looking-at-dotgit-outside-repo'
Junio C Hamano [Thu, 27 Oct 2016 21:58:48 +0000 (14:58 -0700)] 
Merge branch 'jk/no-looking-at-dotgit-outside-repo'

Update "git diff --no-index" codepath not to try to peek into .git/
directory that happens to be under the current directory, when we
know we are operating outside any repository.

* jk/no-looking-at-dotgit-outside-repo:
  diff: handle sha1 abbreviations outside of repository
  diff_aligned_abbrev: use "struct oid"
  diff_unique_abbrev: rename to diff_aligned_abbrev
  find_unique_abbrev: use 4-buffer ring
  test-*-cache-tree: setup git dir
  read info/{attributes,exclude} only when in repository

7 years agoMerge branch 'jc/abbrev-auto'
Junio C Hamano [Thu, 27 Oct 2016 21:58:48 +0000 (14:58 -0700)] 
Merge branch 'jc/abbrev-auto'

"git push" and "git fetch" reports from what old object to what new
object each ref was updated, using abbreviated refnames, and they
attempt to align the columns for this and other pieces of
information.  The way these codepaths compute how many display
columns to allocate for the object names portion of this output has
been updated to match the recent "auto scale the default
abbreviation length" change.

* jc/abbrev-auto:
  transport: compute summary-width dynamically
  transport: allow summary-width to be computed dynamically
  fetch: pass summary_width down the callchain
  transport: pass summary_width down the callchain

7 years agoMerge branch 'jk/abbrev-auto'
Junio C Hamano [Thu, 27 Oct 2016 21:58:47 +0000 (14:58 -0700)] 
Merge branch 'jk/abbrev-auto'

Updates the way approximate count of total objects is computed
while attempting to come up with a unique abbreviated object name,
which in turn needs to estimate how many hexdigits are necessary to
ensure uniqueness.

* jk/abbrev-auto:
  find_unique_abbrev: move logic out of get_short_sha1()

7 years agoMerge branch 'lt/abbrev-auto'
Junio C Hamano [Thu, 27 Oct 2016 21:58:47 +0000 (14:58 -0700)] 
Merge branch 'lt/abbrev-auto'

Allow the default abbreviation length, which has historically been
7, to scale as the repository grows.  The logic suggests to use 12
hexdigits for the Linux kernel, and 9 to 10 for Git itself.

* lt/abbrev-auto:
  abbrev: auto size the default abbreviation
  abbrev: prepare for new world order
  abbrev: add FALLBACK_DEFAULT_ABBREV to prepare for auto sizing

7 years agodiff: handle sha1 abbreviations outside of repository
Jeff King [Thu, 20 Oct 2016 06:21:25 +0000 (02:21 -0400)] 
diff: handle sha1 abbreviations outside of repository

When generating diffs outside a repository (e.g., with "diff
--no-index"), we may write abbreviated sha1s as part of
"--raw" output or the "index" lines of "--patch" output.
Since we have no object database, we never find any
collisions, and these sha1s get whatever static abbreviation
length is configured (typically 7).

However, we do blindly look in ".git/objects" to see if any
objects exist, even though we know we are not in a
repository. This is usually harmless because such a
directory is unlikely to exist, but could be wrong in rare
circumstances.

Let's instead notice when we are not in a repository and
behave as if the object database is empty (i.e., just use
the default abbrev length). It would perhaps make sense to
be conservative and show full sha1s in that case, but
showing the default abbreviation is what we've always done
(and is certainly less ugly).

Note that this does mean that:

  cd /not/a/repo
  GIT_OBJECT_DIRECTORY=/some/real/objdir git diff --no-index ...

used to look for collisions in /some/real/objdir but now
does not. This could be considered either a bugfix (we do
not look at objects if we have no repository) or a
regression, but it seems unlikely that anybody would care
much either way.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff_aligned_abbrev: use "struct oid"
Jeff King [Thu, 20 Oct 2016 06:20:07 +0000 (02:20 -0400)] 
diff_aligned_abbrev: use "struct oid"

Since we're modifying this function anyway, it's a good time
to update it to the more modern "struct oid". We can also
drop some of the magic numbers in favor of GIT_SHA1_HEXSZ,
along with some descriptive comments.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff_unique_abbrev: rename to diff_aligned_abbrev
Jeff King [Thu, 20 Oct 2016 06:19:43 +0000 (02:19 -0400)] 
diff_unique_abbrev: rename to diff_aligned_abbrev

The word "align" describes how the function actually differs
from find_unique_abbrev, and will make it less confusing
when we add more diff-specific abbrevation functions that do
not do this alignment.

Since this is a globally available function, let's also move
its descriptive comment to the header file, where we
typically document function interfaces.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofind_unique_abbrev: use 4-buffer ring
Jeff King [Thu, 20 Oct 2016 06:19:19 +0000 (02:19 -0400)] 
find_unique_abbrev: use 4-buffer ring

Some code paths want to format multiple abbreviated sha1s in
the same output line. Because we use a single static buffer
for our return value, they have to either break their output
into several calls or allocate their own arrays and use
find_unique_abbrev_r().

Intead, let's mimic sha1_to_hex() and use a ring of several
buffers, so that the return value stays valid through
multiple calls. This shortens some of the callers, and makes
it harder to for them to make a silly mistake.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-*-cache-tree: setup git dir
Jeff King [Thu, 20 Oct 2016 06:16:59 +0000 (02:16 -0400)] 
test-*-cache-tree: setup git dir

These test helper programs access the index, but do not ever
setup_git_directory(), meaning we just blindly looked in
".git/index". This happened to work for the purposes of our
tests (which do not run from subdirectories, nor in
non-repos), but it's a bad habit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoread info/{attributes,exclude} only when in repository
Jeff King [Thu, 20 Oct 2016 06:16:41 +0000 (02:16 -0400)] 
read info/{attributes,exclude} only when in repository

The low-level attribute and gitignore code will try to look
in $GIT_DIR/info for any repo-level configuration files,
even if we have not actually determined that we are in a
repository (e.g., running "git grep --no-index"). In such a
case they end up looking for ".git/info/attributes", etc.

This is generally harmless, as such a file is unlikely to
exist outside of a repository, but it's still conceptually
the wrong thing to do.

Let's detect this situation explicitly and skip reading the
file (i.e., the same behavior we'd get if we were in a
repository and the file did not exist).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoEleventh batch for 2.11
Junio C Hamano [Wed, 26 Oct 2016 20:28:47 +0000 (13:28 -0700)] 
Eleventh batch for 2.11

There still are a few topics that need to go in before -rc0 which
would make the shape of the upcoming release clearer, but here is
the final batch before it happens.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'ex/deprecate-empty-pathspec-as-match-all'
Junio C Hamano [Wed, 26 Oct 2016 20:14:56 +0000 (13:14 -0700)] 
Merge branch 'ex/deprecate-empty-pathspec-as-match-all'

An empty string used as a pathspec element has always meant
'everything matches', but it is too easy to write a script that
finds a path to remove in $path and run 'git rm "$paht"', which
ends up removing everything.  Start warning about this use of an
empty string used for 'everything matches' and ask users to use a
more explicit '.' for that instead.

The hope is that existing users will not mind this change, and
eventually the warning can be turned into a hard error, upgrading
the deprecation into removal of this (mis)feature.

* ex/deprecate-empty-pathspec-as-match-all:
  pathspec: warn on empty strings as pathspec

7 years agoMerge branch 'po/fix-doc-merge-base-illustration'
Junio C Hamano [Wed, 26 Oct 2016 20:14:55 +0000 (13:14 -0700)] 
Merge branch 'po/fix-doc-merge-base-illustration'

Some AsciiDoc formatter mishandles a displayed illustration with
tabs in it.  Adjust a few of them in merge-base documentation to
work around them.

* po/fix-doc-merge-base-illustration:
  doc: fix the 'revert a faulty merge' ASCII art tab spacing
  doc: fix merge-base ASCII art tab spacing

7 years agoMerge branch 'jk/tap-verbose-fix'
Junio C Hamano [Wed, 26 Oct 2016 20:14:54 +0000 (13:14 -0700)] 
Merge branch 'jk/tap-verbose-fix'

The Travis CI configuration we ship ran the tests with --verbose
option but this risks non-TAP output that happens to be "ok" to be
misinterpreted as TAP signalling a test that passed.  This resulted
in unnecessary failure.  This has been corrected by introducing a
new mode to run our tests in the test harness to send the verbose
output separately to the log file.

* jk/tap-verbose-fix:
  test-lib: bail out when "-v" used under "prove"
  travis: use --verbose-log test option
  test-lib: add --verbose-log option
  test-lib: handle TEST_OUTPUT_DIRECTORY with spaces

7 years agoMerge branch 'mm/send-email-cc-cruft-after-address'
Junio C Hamano [Wed, 26 Oct 2016 20:14:53 +0000 (13:14 -0700)] 
Merge branch 'mm/send-email-cc-cruft-after-address'

"git send-email" attempts to pick up valid e-mails from the
trailers, but people in real world write non-addresses there, like
"Cc: Stable <add@re.ss> # 4.8+", which broke the output depending
on the availability and vintage of Mail::Address perl module.

* mm/send-email-cc-cruft-after-address:
  Git.pm: add comment pointing to t9000
  t9000-addresses: update expected results after fix
  parse_mailboxes: accept extra text after <...> address

7 years agoMerge branch 'yk/git-tag-remove-mention-of-old-layout-in-doc'
Junio C Hamano [Wed, 26 Oct 2016 20:14:52 +0000 (13:14 -0700)] 
Merge branch 'yk/git-tag-remove-mention-of-old-layout-in-doc'

Shorten description of auto-following in "git tag" by removing a
mention of historical remotes layout which is not relevant to the
main topic.

* yk/git-tag-remove-mention-of-old-layout-in-doc:
  doc: remove reference to the traditional layout in git-tag.txt

7 years agoMerge branch 'pt/gitgui-updates'
Junio C Hamano [Wed, 26 Oct 2016 20:14:51 +0000 (13:14 -0700)] 
Merge branch 'pt/gitgui-updates'

A new version of git-gui, now at its 0.21.0 tag.

* pt/gitgui-updates: (22 commits)
  git-gui: set version 0.21
  git-gui: Mark 'All' in remote.tcl for translation
  git-gui i18n: Updated Bulgarian translation (565,0f,0u)
  git-gui: avoid persisting modified author identity
  git-gui: handle the encoding of Git's output correctly
  git-gui: unicode file name support on windows
  git-gui: Update Russian translation
  git-gui: maintain backwards compatibility for merge syntax
  git-gui i18n: mark string in lib/error.tcl for translation
  git-gui: fix incorrect use of Tcl append command
  git-gui i18n: mark "usage:" strings for translation
  git-gui i18n: internationalize use of colon punctuation
  git-gui: ensure the file in the diff pane is in the list of selected files
  git-gui: support for $FILENAMES in tool definitions
  git-gui: fix initial git gui message encoding
  git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution
  git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`
  git-gui: fix detection of Cygwin
  Amend tab ordering and text widget border and highlighting.
  Allow keyboard control to work in the staging widgets.
  ...

7 years agoMerge branch 'jk/diff-submodule-diff-inline'
Junio C Hamano [Wed, 26 Oct 2016 20:14:51 +0000 (13:14 -0700)] 
Merge branch 'jk/diff-submodule-diff-inline'

A recently graduated topic regressed "git rev-list --header"
output, breaking "gitweb".  This has been fixed.

* jk/diff-submodule-diff-inline:
  rev-list: use hdr_termination instead of a always using a newline

7 years agoMerge branch 'tg/add-chmod+x-fix'
Junio C Hamano [Wed, 26 Oct 2016 20:14:50 +0000 (13:14 -0700)] 
Merge branch 'tg/add-chmod+x-fix'

A hot-fix for a test added by a recent topic that went to both
'master' and 'maint' already.

* tg/add-chmod+x-fix:
  t3700: fix broken test under !SANITY

7 years agoMerge branch 'bw/submodule-branch-dot-doc'
Junio C Hamano [Wed, 26 Oct 2016 20:14:49 +0000 (13:14 -0700)] 
Merge branch 'bw/submodule-branch-dot-doc'

Recent git allows submodule.<name>.branch to use a special token
"." instead of the branch name; the documentation has been updated
to describe it.

* bw/submodule-branch-dot-doc:
  submodules doc: update documentation for "." used for submodule branches

7 years agoMerge branch 'pb/test-parse-options-expect'
Junio C Hamano [Wed, 26 Oct 2016 20:14:48 +0000 (13:14 -0700)] 
Merge branch 'pb/test-parse-options-expect'

Test clean-up.

* pb/test-parse-options-expect:
  t0040: convert all possible tests to use `test-parse-options --expect`

7 years agoMerge branch 'jk/tighten-alloc'
Junio C Hamano [Wed, 26 Oct 2016 20:14:48 +0000 (13:14 -0700)] 
Merge branch 'jk/tighten-alloc'

Protect our code from over-eager compilers.

* jk/tighten-alloc:
  inline xalloc_flex() into FLEXPTR_ALLOC_MEM
  avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM

7 years agoMerge branch 'va/i18n'
Junio C Hamano [Wed, 26 Oct 2016 20:14:47 +0000 (13:14 -0700)] 
Merge branch 'va/i18n'

More i18n.

* va/i18n:
  i18n: diff: mark warnings for translation
  i18n: credential-cache--daemon: mark advice for translation
  i18n: convert mark error messages for translation
  i18n: apply: mark error message for translation
  i18n: apply: mark error messages for translation
  i18n: apply: mark info messages for translation
  i18n: apply: mark plural string for translation

7 years agoMerge branch 'jk/fetch-quick-tag-following'
Junio C Hamano [Wed, 26 Oct 2016 20:14:47 +0000 (13:14 -0700)] 
Merge branch 'jk/fetch-quick-tag-following'

When fetching from a remote that has many tags that are irrelevant
to branches we are following, we used to waste way too many cycles
when checking if the object pointed at by a tag (that we are not
going to fetch!) exists in our repository too carefully.

* jk/fetch-quick-tag-following:
  fetch: use "quick" has_sha1_file for tag following

7 years agoMerge branch 'jk/merge-base-fork-point-without-reflog'
Junio C Hamano [Wed, 26 Oct 2016 20:14:46 +0000 (13:14 -0700)] 
Merge branch 'jk/merge-base-fork-point-without-reflog'

"git rebase" immediately after "git clone" failed to find the fork
point from the upstream.

* jk/merge-base-fork-point-without-reflog:
  merge-base: handle --fork-point without reflog

7 years agoMerge branch 'jk/ambiguous-short-object-names'
Junio C Hamano [Wed, 26 Oct 2016 20:14:46 +0000 (13:14 -0700)] 
Merge branch 'jk/ambiguous-short-object-names'

A test fixup to recently graduated topic.

* jk/ambiguous-short-object-names:
  t1512: become resilient to GETTEXT_POISON build

7 years agoMerge branch 'jk/upload-pack-use-prio-queue'
Junio C Hamano [Wed, 26 Oct 2016 20:14:46 +0000 (13:14 -0700)] 
Merge branch 'jk/upload-pack-use-prio-queue'

Code clean-up and performance improvement to reduce use of
timestamp-ordered commit-list by replacing it with a priority
queue.

* jk/upload-pack-use-prio-queue:
  upload-pack: use priority queue in reachable() check

7 years agoMerge branch 'ab/gitweb-abbrev-links'
Junio C Hamano [Wed, 26 Oct 2016 20:14:45 +0000 (13:14 -0700)] 
Merge branch 'ab/gitweb-abbrev-links'

In addition to purely abbreviated commit object names, "gitweb"
learned to turn "git describe" output (e.g. v2.9.3-599-g2376d31787)
into clickable links in its output.

* ab/gitweb-abbrev-links:
  gitweb: link to "git describe"'d commits in log messages
  gitweb: link to 7-char+ SHA-1s, not only 8-char+
  gitweb: fix a typo in a comment

7 years agoMerge branch 'dk/worktree-dup-checkout-with-bare-is-ok'
Junio C Hamano [Wed, 26 Oct 2016 20:14:45 +0000 (13:14 -0700)] 
Merge branch 'dk/worktree-dup-checkout-with-bare-is-ok'

In a worktree connected to a repository elsewhere, created via "git
worktree", "git checkout" attempts to protect users from confusion
by refusing to check out a branch that is already checked out in
another worktree.  However, this also prevented checking out a
branch, which is designated as the primary branch of a bare
reopsitory, in a worktree that is connected to the bare
repository.  The check has been corrected to allow it.

* dk/worktree-dup-checkout-with-bare-is-ok:
  worktree: allow the main brach of a bare repository to be checked out

7 years agoMerge branch 'mg/gpg-richer-status'
Junio C Hamano [Wed, 26 Oct 2016 20:14:45 +0000 (13:14 -0700)] 
Merge branch 'mg/gpg-richer-status'

The GPG verification status shown in "%G?" pretty format specifier
was not rich enough to differentiate a signature made by an expired
key, a signature made by a revoked key, etc.  New output letters
have been assigned to express them.

* mg/gpg-richer-status:
  gpg-interface: use more status letters

7 years agoMerge branch 'jc/cocci-xstrdup-or-null'
Junio C Hamano [Wed, 26 Oct 2016 20:14:45 +0000 (13:14 -0700)] 
Merge branch 'jc/cocci-xstrdup-or-null'

Code cleanup.

* jc/cocci-xstrdup-or-null:
  cocci: refactor common patterns to use xstrdup_or_null()

7 years agoMerge branch 'mm/credential-libsecret'
Junio C Hamano [Wed, 26 Oct 2016 20:14:45 +0000 (13:14 -0700)] 
Merge branch 'mm/credential-libsecret'

A new credential helper that talks via "libsecret" with
implementations of XDG Secret Service API has been added to
contrib/credential/.

* mm/credential-libsecret:
  contrib: add credential helper for libsecret

7 years agoMerge branch 'bw/ls-files-recurse-submodules'
Junio C Hamano [Wed, 26 Oct 2016 20:14:44 +0000 (13:14 -0700)] 
Merge branch 'bw/ls-files-recurse-submodules'

"git ls-files" learned "--recurse-submodules" option that can be
used to get a listing of tracked files across submodules (i.e. this
only works with "--cached" option, not for listing untracked or
ignored files).  This would be a useful tool to sit on the upstream
side of a pipe that is read with xargs to work on all working tree
files from the top-level superproject.

* bw/ls-files-recurse-submodules:
  ls-files: add pathspec matching for submodules
  ls-files: pass through safe options for --recurse-submodules
  ls-files: optionally recurse into submodules
  git: make super-prefix option

7 years agoMerge branch 'js/libify-require-clean-work-tree'
Junio C Hamano [Wed, 26 Oct 2016 20:14:44 +0000 (13:14 -0700)] 
Merge branch 'js/libify-require-clean-work-tree'

The require_clean_work_tree() helper was recreated in C when "git
pull" was rewritten from shell; the helper is now made available to
other callers in preparation for upcoming "rebase -i" work.

* js/libify-require-clean-work-tree:
  wt-status: begin error messages with lower-case
  wt-status: teach has_{unstaged,uncommitted}_changes() about submodules
  wt-status: export also the has_un{staged,committed}_changes() functions
  wt-status: make the require_clean_work_tree() function reusable
  pull: make code more similar to the shell script again
  pull: drop confusing prefix parameter of die_on_unclean_work_tree()

7 years agoMerge branch 'jc/ws-error-highlight'
Junio C Hamano [Wed, 26 Oct 2016 20:14:43 +0000 (13:14 -0700)] 
Merge branch 'jc/ws-error-highlight'

"git diff/log --ws-error-highlight=<kind>" lacked the corresponding
configuration variable to set it by default.

* jc/ws-error-highlight:
  diff: introduce diff.wsErrorHighlight option
  diff.c: move ws-error-highlight parsing helpers up
  diff.c: refactor parse_ws_error_highlight()
  t4015: split out the "setup" part of ws-error-highlight test

7 years agoMerge branch 'jc/diff-unique-abbrev-comments'
Junio C Hamano [Wed, 26 Oct 2016 20:14:42 +0000 (13:14 -0700)] 
Merge branch 'jc/diff-unique-abbrev-comments'

A bit more comments in a tricky code.

* jc/diff-unique-abbrev-comments:
  diff_unique_abbrev(): document its assumption and limitation

7 years agohex: make wraparound of the index into ring-buffer explicit
René Scharfe [Sun, 23 Oct 2016 17:57:30 +0000 (19:57 +0200)] 
hex: make wraparound of the index into ring-buffer explicit

Overflow is defined for unsigned integers, but not for signed ones.

We could make the ring-buffer index in sha1_to_hex() and
get_pathname() unsigned to be on the safe side to resolve this, but
let's make it explicit that we are wrapping around at whatever the
number of elements the ring-buffer has.  The compiler is smart enough
to turn modulus into bitmask for these codepaths that use
ring-buffers of a size that is a power of 2.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot0060: sidestep surprising path mangling results on Windows
Johannes Sixt [Tue, 18 Oct 2016 20:06:07 +0000 (22:06 +0200)] 
t0060: sidestep surprising path mangling results on Windows

When an MSYS program (such as the bash that drives the test suite)
invokes git on Windows, absolute Unix style paths are transformed into
Windows native absolute paths (drive letter form). However, this
transformation also includes some simplifications that are not just
straight-forward textual substitutions:

- When the path ends in "/.", then the dot is stripped, but not the
  directory separator.

- When the path contains "..", then it is optimized away if possible,
  e.g., "/c/dir/foo/../bar" becomes "c:/dir/bar".

These additional transformations violate the assumptions of some
submodule path tests. We can avoid them when the input is already a
Windows native path, because then MSYS leaves the path unmolested.

Convert the uses of $PWD to $(pwd); the latter returns a native Windows
path.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc: fix the 'revert a faulty merge' ASCII art tab spacing
Philip Oakley [Mon, 24 Oct 2016 21:54:32 +0000 (22:54 +0100)] 
doc: fix the 'revert a faulty merge' ASCII art tab spacing

The asciidoctor doc-tool stack does not always respect the 'tab = 8 spaces' rule
expectation, particularly for the Git-for-Windows generated html pages. This
follows on from the 'doc: fix merge-base ASCII art tab spacing' fix.

Use just spaces within the block of the ascii art.

All other *.txt ascii art containing three dashes has been checked.
Asciidoctor correctly formats the other art blocks that do contain tabs.

Signed-off-by: Philip Oakley <philipoakley@iee.org
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodaemon: detect and reject too-long paths
Jeff King [Sat, 22 Oct 2016 04:59:38 +0000 (00:59 -0400)] 
daemon: detect and reject too-long paths

When we are checking the path via path_ok(), we use some
fixed PATH_MAX buffers. We write into them via snprintf(),
so there's no possibility of overflow, but it does mean we
may silently truncate the path, leading to potentially
confusing errors when the partial path does not exist.

We're better off to reject the path explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-lib: bail out when "-v" used under "prove"
Jeff King [Sat, 22 Oct 2016 04:45:06 +0000 (00:45 -0400)] 
test-lib: bail out when "-v" used under "prove"

When there is a TAP harness consuming the output of our test
scripts, the "--verbose" breaks the output by mingling
test command output with TAP. Because the TAP::Harness
module used by "prove" is fairly lenient, this _usually_
works, but it violates the spec, and things get very
confusing if the commands happen to output a line that looks
like TAP (e.g., the word "ok" on its own line).

Let's detect this situation and complain. Just calling
error() isn't great, though; prove will tell us that the
script failed, but the message doesn't make it through to
the user. Instead, we can use the special TAP signal "Bail
out!". This not only shows the message to the user, but
instructs the harness to stop running the tests entirely.
This is exactly what we want here, as the problem is in the
command-line options, and every test script would produce
the same error.

The result looks like this (the first "Bailout called" line
is in red if prove uses color on your terminal):

 $ make GIT_TEST_OPTS='--verbose --tee'
 rm -f -r 'test-results'
 *** prove ***
 Bailout called.  Further testing stopped:  verbose mode forbidden under TAP harness; try --verbose-log
 FAILED--Further testing stopped: verbose mode forbidden under TAP harness; try --verbose-log
 Makefile:39: recipe for target 'prove' failed
 make: *** [prove] Error 255

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotransport: compute summary-width dynamically
Junio C Hamano [Sat, 22 Oct 2016 04:33:06 +0000 (21:33 -0700)] 
transport: compute summary-width dynamically

Now all that is left to do is to actually iterate over the refs
and measure the display width needed to show their abbreviation.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotransport: allow summary-width to be computed dynamically
Junio C Hamano [Fri, 21 Oct 2016 22:28:07 +0000 (15:28 -0700)] 
transport: allow summary-width to be computed dynamically

Now we have identified three callchains that have a set of refs that
they want to show their <old, new> object names in an aligned output,
we can replace their reference to the constant TRANSPORT_SUMMARY_WIDTH
with a helper function call to transport_summary_width() that takes
the set of ref as a parameter.  This step does not yet iterate over
the refs and compute, which is left as an exercise to the readers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofetch: pass summary_width down the callchain
Junio C Hamano [Fri, 21 Oct 2016 22:22:55 +0000 (15:22 -0700)] 
fetch: pass summary_width down the callchain

The leaf function on the "fetch" side that uses TRANSPORT_SUMMARY_WIDTH
constant is builtin/fetch.c::format_display() and it has two distinct
callchains.  The one that reports the primary result of fetch originates
at store_updated_refs(); the other one that reports the pruning of
the remote-tracking refs originates at prune_refs().

Teach these two places to pass summary_width down the callchain,
just like we did for the "push" side in the previous commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotransport: pass summary_width down the callchain
Junio C Hamano [Fri, 21 Oct 2016 21:39:41 +0000 (14:39 -0700)] 
transport: pass summary_width down the callchain

The callchain that originates at transport_print_push_status()
eventually hits a single leaf function, print_ref_status(), that is
used to show from what old object to what new object a ref got
updated, and the width of the part that shows old and new object
names used a constant TRANSPORT_SUMMARY_WIDTH.

Teach the callchain to pass the width down from the top instead.
This allows a future enhancement to compute the necessary display
width before calling down this callchain.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotravis: use --verbose-log test option
Jeff King [Fri, 21 Oct 2016 10:48:12 +0000 (06:48 -0400)] 
travis: use --verbose-log test option

Because we run the tests via "prove", the output from
"--verbose" may interfere with our TAP output. Using
"--verbose-log" solves this while letting us retain our
on-disk log.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-lib: add --verbose-log option
Jeff King [Fri, 21 Oct 2016 10:48:00 +0000 (06:48 -0400)] 
test-lib: add --verbose-log option

The "--verbose" option redirects output from arbitrary
test commands to stdout. This is useful for examining the
output manually, like:

  ./t5547-push-quarantine.sh -v | less

But it also means that the output is intermingled with the
TAP directives, which can confuse a TAP parser like "prove".
This has always been a potential problem, but became an
issue recently when one test happened to output the word
"ok" on a line by itself, which prove interprets as a test
success:

  $ prove t5547-push-quarantine.sh :: -v
  t5547-push-quarantine.sh .. 1/? To dest.git
   * [new branch]      HEAD -> master
  To dest.git
   ! [remote rejected] reject -> reject (pre-receive hook declined)
  error: failed to push some refs to 'dest.git'
  fatal: git cat-file d08c8eba97f4e683ece08654c7c8d2ba0c03b129: bad file
  t5547-push-quarantine.sh .. Failed -1/4 subtests

  Test Summary Report
  -------------------
  t5547-push-quarantine.sh (Wstat: 0 Tests: 5 Failed: 0)
    Parse errors: Tests out of sequence.  Found (2) but expected (3)
                  Tests out of sequence.  Found (3) but expected (4)
                  Tests out of sequence.  Found (4) but expected (5)
                  Bad plan.  You planned 4 tests but ran 5.
  Files=1, Tests=5,  0 wallclock secs ( 0.01 usr +  0.01 sys =  0.02 CPU)
  Result: FAIL

One answer is "if it hurts, don't do it", but that's not
quite the whole story. The Travis tests use "--verbose
--tee" so that they can get the benefit of prove's parallel
options, along with a verbose log in case there is a
failure. We just need the verbose output to go to the log,
but keep stdout clean.

Getting this right turns out to be surprisingly difficult.
Here's the progression of alternatives I considered:

 1. Add an option to write verbose output to stderr. This is
    hard to capture, though, because we want each test to
    have its own log (because they're all run in parallel
    and the jumbled output would be useless).

 2. Add an option to write verbose output to a file in
    test-results. This works, but the log is missing all of
    the non-verbose output, which gives context.

 3. Like (2), but teach say_color() to additionally output
    to the log. This mostly works, but misses any output
    that happens outside of the say() functions (which isn't
    a lot, but is a potential maintenance headache).

 4. Like (2), but make the log file the same as the "--tee"
    file. That almost works, but now we have two processes
    opening the same file. That gives us two separate
    descriptors, each with their own idea of the current
    position. They'll each start writing at offset 0, and
    overwrite each other's data.

 5. Like (4), but in each case open the file for appending.
    That atomically positions each write at the end of the
    file.

    It's possible we may still get sheared writes between
    the two processes, but this is already the case when
    writing to stdout. It's not a problem in practice
    because the test harness generally waits for snippets to
    finish before writing the TAP output.

    We can ignore buffering issues with tee, because POSIX
    mandates that it does not buffer. Likewise, POSIX
    specifies "tee -a", so it should be available
    everywhere.

This patch implements option (5), which seems to work well
in practice.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-lib: handle TEST_OUTPUT_DIRECTORY with spaces
Jeff King [Fri, 21 Oct 2016 10:42:10 +0000 (06:42 -0400)] 
test-lib: handle TEST_OUTPUT_DIRECTORY with spaces

We are careful in test_done to handle a results directory
with a space in it, but the "--tee" code path does not.
Doing:

  export TEST_OUTPUT_DIRECTORY='/tmp/path with spaces'
  ./t000-init.sh --tee

results in errors. Let's consistently double-quote our path
variables so that this works.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoGit.pm: add comment pointing to t9000
Matthieu Moy [Fri, 21 Oct 2016 09:20:24 +0000 (11:20 +0200)] 
Git.pm: add comment pointing to t9000

parse_mailboxes should probably eventually be completely equivalent to
Mail::Address, and if this happens we can drop the Mail::Address
dependency. Add a comment in the code reminding the current state of the
code, and point to the corresponding failing test to help future
contributors to get it right.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot9000-addresses: update expected results after fix
Matthieu Moy [Fri, 21 Oct 2016 09:20:23 +0000 (11:20 +0200)] 
t9000-addresses: update expected results after fix

e3fdbcc8e1 (parse_mailboxes: accept extra text after <...> address,
2016-10-13) improved our in-house address parser and made it closer to
Mail::Address. As a consequence, some tests comparing it to
Mail::Address now pass, but e3fdbcc8e1 forgot to update the test.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc: fix merge-base ASCII art tab spacing
Philip Oakley [Thu, 20 Oct 2016 23:40:09 +0000 (00:40 +0100)] 
doc: fix merge-base ASCII art tab spacing

The doc-tool stack does not always respect the 'tab = 8 spaces' rule,
particularly the git-scm doc pages https://git-scm.com/docs/git-merge-base
and the Git generated html pages.

Use just spaces within the block of the ascii art.

Noticed when reviewing Junio's suggested update to `git merge-base`
https://public-inbox.org/git/xmqqmvi2sj8f.fsf@gitster.mtv.corp.google.com/T/#u

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorev-list: use hdr_termination instead of a always using a newline
Jacob Keller [Thu, 20 Oct 2016 20:41:00 +0000 (13:41 -0700)] 
rev-list: use hdr_termination instead of a always using a newline

When adding support for prefixing output of log and other commands using
--line-prefix, commit 660e113ce118 ("graph: add support for
--line-prefix on all graph-aware output", 2016-08-31) accidentally
broke rev-list --header output.

In order to make the output appear with a line-prefix, the flow was
changed to always use the graph subsystem for display. Unfortunately
the graph flow in rev-list did not use info->hdr_termination as it was
assumed that graph output would never need to putput NULs.

Since we now always use the graph code in order to handle the case of
line-prefix, simply replace putchar('\n') with
putchar(info->hdr_termination) which will correct this issue.

Add a test for the --header case to make sure we don't break it in the
future.

Reported-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui
Junio C Hamano [Thu, 20 Oct 2016 16:33:17 +0000 (09:33 -0700)] 
Merge tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui

git-gui 0.21.0

* tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui: (22 commits)
  git-gui: set version 0.21
  git-gui: Mark 'All' in remote.tcl for translation
  git-gui i18n: Updated Bulgarian translation (565,0f,0u)
  git-gui: avoid persisting modified author identity
  git-gui: handle the encoding of Git's output correctly
  git-gui: unicode file name support on windows
  git-gui: Update Russian translation
  git-gui: maintain backwards compatibility for merge syntax
  git-gui i18n: mark string in lib/error.tcl for translation
  git-gui: fix incorrect use of Tcl append command
  git-gui i18n: mark "usage:" strings for translation
  git-gui i18n: internationalize use of colon punctuation
  git-gui: ensure the file in the diff pane is in the list of selected files
  git-gui: support for $FILENAMES in tool definitions
  git-gui: fix initial git gui message encoding
  git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution
  git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`
  git-gui: fix detection of Cygwin
  Amend tab ordering and text widget border and highlighting.
  Allow keyboard control to work in the staging widgets.
  ...

7 years agodoc: remove reference to the traditional layout in git-tag.txt
Younes Khoudli [Thu, 20 Oct 2016 13:21:44 +0000 (15:21 +0200)] 
doc: remove reference to the traditional layout in git-tag.txt

This is the only place in the documentation that the traditional layout
is mentioned, and it is confusing. Remove it.

* Documentation/git-tag.txt: Here.

Signed-off-by: Younes Khoudli <younes.khoudli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot3700: fix broken test under !SANITY
Junio C Hamano [Mon, 10 Oct 2016 17:41:51 +0000 (10:41 -0700)] 
t3700: fix broken test under !SANITY

An "add --chmod=+x" test recently added by 610d55af0f ("add: modify
already added files when --chmod is given", 2016-09-14) used "xfoo3"
as a test file.  The paths xfoo[1-3] were used by earlier tests for
symbolic links but they were expected to have been removed by the
time the execution reached this new test.

The removal with "git reset --hard" however happened in a pair of
earlier tests, both of which are protected by POSIXPERM,SANITY
prerequisites.  Platforms and test environments that lacked these
would have seen xfoo3 as a leftover symbolic link that points at
somewhere else at this point of the sequence, and the chmod test
would have given a wrong result.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-gui: set version 0.21 gitgui-0.21.0
Pat Thoyts [Thu, 20 Oct 2016 10:19:43 +0000 (11:19 +0100)] 
git-gui: set version 0.21

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
7 years agoMerge branch 'as/bulgarian' into pu
Pat Thoyts [Thu, 20 Oct 2016 10:13:42 +0000 (11:13 +0100)] 
Merge branch 'as/bulgarian' into pu

7 years agogit-gui: Mark 'All' in remote.tcl for translation
Alexander Shopov [Thu, 13 Oct 2016 18:43:48 +0000 (21:43 +0300)] 
git-gui: Mark 'All' in remote.tcl for translation

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
7 years agogit-gui i18n: Updated Bulgarian translation (565,0f,0u)
Alexander Shopov [Thu, 13 Oct 2016 18:43:49 +0000 (21:43 +0300)] 
git-gui i18n: Updated Bulgarian translation (565,0f,0u)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
7 years agoMerge branch 'os/preserve-author' into pu
Pat Thoyts [Thu, 20 Oct 2016 10:07:24 +0000 (11:07 +0100)] 
Merge branch 'os/preserve-author' into pu

7 years agoMerge branch 'kb/unicode' into pu
Pat Thoyts [Thu, 20 Oct 2016 10:06:28 +0000 (11:06 +0100)] 
Merge branch 'kb/unicode' into pu

7 years agosubmodules doc: update documentation for "." used for submodule branches
Brandon Williams [Wed, 19 Oct 2016 20:42:54 +0000 (13:42 -0700)] 
submodules doc: update documentation for "." used for submodule branches

4d7bc52b17 ("submodule update: allow '.' for branch value",
2016-08-03) adopted from Gerrit a feature to set "." as a special
value of "submodule.<name>.branch" in .gitmodules file to indicate
that the tracking branch in the submodule should be the same as the
current branch in the superproject.

Update the documentation to describe this.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: diff: mark warnings for translation
Vasco Almeida [Mon, 17 Oct 2016 13:15:29 +0000 (13:15 +0000)] 
i18n: diff: mark warnings for translation

Mark rename_limit_warning and degrade_cc_to_c_warning and
rename_limit_warning for translation.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: credential-cache--daemon: mark advice for translation
Vasco Almeida [Mon, 17 Oct 2016 13:15:28 +0000 (13:15 +0000)] 
i18n: credential-cache--daemon: mark advice for translation

Mark permissions_advice for translation.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: convert mark error messages for translation
Vasco Almeida [Mon, 17 Oct 2016 13:15:27 +0000 (13:15 +0000)] 
i18n: convert mark error messages for translation

Mark error messages about CRLF for translation.

Update test to reflect changes.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: apply: mark error message for translation
Vasco Almeida [Mon, 17 Oct 2016 13:15:26 +0000 (13:15 +0000)] 
i18n: apply: mark error message for translation

Update test to reflect changes.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot0040: convert all possible tests to use `test-parse-options --expect`
Pranit Bauva [Sat, 15 Oct 2016 12:28:13 +0000 (12:28 +0000)] 
t0040: convert all possible tests to use `test-parse-options --expect`

Use "test-parse-options --expect" to rewrite the tests to avoid checking
the whole variable dump by just testing what is required.

This commit is a follow-up to 8ca65aebad ("t0040: convert a few
tests to use test-parse-options --expect", 2016-05-06).

Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoinline xalloc_flex() into FLEXPTR_ALLOC_MEM
René Scharfe [Sun, 16 Oct 2016 10:06:02 +0000 (12:06 +0200)] 
inline xalloc_flex() into FLEXPTR_ALLOC_MEM

Allocate and copy directly in FLEXPTR_ALLOC_MEM and remove the now
unused helper function xalloc_flex().  The resulting code is shorter
and the offset arithmetic is a bit simpler.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoavoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM
René Scharfe [Sat, 15 Oct 2016 16:23:11 +0000 (18:23 +0200)] 
avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM

Calculating offsets involving a NULL pointer is undefined.  It works in
practice (for now?), but we should not rely on it.  Allocate first and
then simply refer to the flexible array member by its name instead of
performing pointer arithmetic up front.  The resulting code is slightly
shorter, easier to read and doesn't rely on undefined behaviour.

NB: The cast to a (non-const) void pointer is necessary to keep support
for flexible array members declared as const.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoSync with maint
Junio C Hamano [Mon, 17 Oct 2016 20:52:26 +0000 (13:52 -0700)] 
Sync with maint

* maint:
  l10n: de.po: translate 260 new messages
  l10n: de.po: fix translation of autostash
  l10n: ru.po: update Russian translation

7 years agoMerge tag 'l10n-2.10.0-rnd2.4' of git://github.com/git-l10n/git-po into maint
Junio C Hamano [Mon, 17 Oct 2016 20:27:38 +0000 (13:27 -0700)] 
Merge tag 'l10n-2.10.0-rnd2.4' of git://github.com/git-l10n/git-po into maint

l10n-2.10.0-rnd2.4

* tag 'l10n-2.10.0-rnd2.4' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 260 new messages
  l10n: de.po: fix translation of autostash
  l10n: ru.po: update Russian translation

7 years agoTenth batch for 2.11
Junio C Hamano [Mon, 17 Oct 2016 20:26:27 +0000 (13:26 -0700)] 
Tenth batch for 2.11

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'sb/submodule-config-doc-drop-path'
Junio C Hamano [Mon, 17 Oct 2016 20:25:23 +0000 (13:25 -0700)] 
Merge branch 'sb/submodule-config-doc-drop-path'

The "submodule.<name>.path" stored in .gitmodules is never copied
to .git/config and such a key in .git/config has no meaning, but
the documentation described it and submodule.<name>.url next to
each other as if both belong to .git/config.  This has been fixed.

* sb/submodule-config-doc-drop-path:
  documentation: improve submodule.<name>.{url, path} description

7 years agoMerge branch 'rs/pretty-format-color-doc-fix'
Junio C Hamano [Mon, 17 Oct 2016 20:25:23 +0000 (13:25 -0700)] 
Merge branch 'rs/pretty-format-color-doc-fix'

* rs/pretty-format-color-doc-fix:
  pretty: fix document link for color specification

7 years agoMerge branch 'js/reset-usage'
Junio C Hamano [Mon, 17 Oct 2016 20:25:22 +0000 (13:25 -0700)] 
Merge branch 'js/reset-usage'

* js/reset-usage:
  reset: fix usage

7 years agoMerge branch 'da/mergetool-diff-order'
Junio C Hamano [Mon, 17 Oct 2016 20:25:21 +0000 (13:25 -0700)] 
Merge branch 'da/mergetool-diff-order'

"git mergetool" learned to honor "-O<orderfile>" to control the
order of paths to present to the end user.

* da/mergetool-diff-order:
  mergetool: honor -O<orderfile>
  mergetool: honor diff.orderFile
  mergetool: move main program flow into a main() function
  mergetool: add copyright

7 years agoMerge branch 'rs/cocci'
Junio C Hamano [Mon, 17 Oct 2016 20:25:21 +0000 (13:25 -0700)] 
Merge branch 'rs/cocci'

Code cleanup.

* rs/cocci:
  use strbuf_add_unique_abbrev() for adding short hashes, part 3
  remove unnecessary NULL check before free(3)

7 years agoMerge branch 'js/regexec-buf'
Junio C Hamano [Mon, 17 Oct 2016 20:25:21 +0000 (13:25 -0700)] 
Merge branch 'js/regexec-buf'

* js/regexec-buf:
  configure.ac: improve description of NO_REGEX test

7 years agoMerge branch 'jk/ref-symlink-loop'
Junio C Hamano [Mon, 17 Oct 2016 20:25:20 +0000 (13:25 -0700)] 
Merge branch 'jk/ref-symlink-loop'

A stray symbolic link in $GIT_DIR/refs/ directory could make name
resolution loop forever, which has been corrected.

* jk/ref-symlink-loop:
  files_read_raw_ref: prevent infinite retry loops in general
  files_read_raw_ref: avoid infinite loop on broken symlinks

7 years agoMerge branch 'jk/quarantine-received-objects'
Junio C Hamano [Mon, 17 Oct 2016 20:25:20 +0000 (13:25 -0700)] 
Merge branch 'jk/quarantine-received-objects'

In order for the receiving end of "git push" to inspect the
received history and decide to reject the push, the objects sent
from the sending end need to be made available to the hook and
the mechanism for the connectivity check, and this was done
traditionally by storing the objects in the receiving repository
and letting "git gc" to expire it.  Instead, store the newly
received objects in a temporary area, and make them available by
reusing the alternate object store mechanism to them only while we
decide if we accept the check, and once we decide, either migrate
them to the repository or purge them immediately.

* jk/quarantine-received-objects:
  tmp-objdir: do not migrate files starting with '.'
  tmp-objdir: put quarantine information in the environment
  receive-pack: quarantine objects until pre-receive accepts
  tmp-objdir: introduce API for temporary object directories
  check_connected: accept an env argument

7 years agoMerge branch 'jk/alt-odb-cleanup'
Junio C Hamano [Mon, 17 Oct 2016 20:25:19 +0000 (13:25 -0700)] 
Merge branch 'jk/alt-odb-cleanup'

Codepaths involved in interacting alternate object store have
been cleaned up.

* jk/alt-odb-cleanup:
  alternates: use fspathcmp to detect duplicates
  sha1_file: always allow relative paths to alternates
  count-objects: report alternates via verbose mode
  fill_sha1_file: write into a strbuf
  alternates: store scratch buffer as strbuf
  fill_sha1_file: write "boring" characters
  alternates: use a separate scratch space
  alternates: encapsulate alt->base munging
  alternates: provide helper for allocating alternate
  alternates: provide helper for adding to alternates list
  link_alt_odb_entry: refactor string handling
  link_alt_odb_entry: handle normalize_path errors
  t5613: clarify "too deep" recursion tests
  t5613: do not chdir in main process
  t5613: whitespace/style cleanups
  t5613: use test_must_fail
  t5613: drop test_valid_repo function
  t5613: drop reachable_via function

7 years agoMerge branch 'nd/commit-p-doc'
Junio C Hamano [Mon, 17 Oct 2016 20:25:19 +0000 (13:25 -0700)] 
Merge branch 'nd/commit-p-doc'

Documentation for "git commit" was updated to clarify that "commit
-p <paths>" adds to the current contents of the index to come up
with what to commit.

* nd/commit-p-doc:
  git-commit.txt: clarify --patch mode with pathspec

7 years agoMerge branch 'jk/clone-copy-alternates-fix'
Junio C Hamano [Mon, 17 Oct 2016 20:25:18 +0000 (13:25 -0700)] 
Merge branch 'jk/clone-copy-alternates-fix'

"git clone" of a local repository can be done at the filesystem
level, but the codepath did not check errors while copying and
adjusting the file that lists alternate object stores.

* jk/clone-copy-alternates-fix:
  clone: detect errors in normalize_path_copy

7 years agoMerge branch 'dt/http-empty-auth'
Junio C Hamano [Mon, 17 Oct 2016 20:25:18 +0000 (13:25 -0700)] 
Merge branch 'dt/http-empty-auth'

http.emptyauth configuration is a way to allow an empty username to
pass when attempting to authenticate using mechanisms like
Kerberos.  We took an unspecified (NULL) username and sent ":"
(i.e. no username, no password) to CURLOPT_USERPWD, but did not do
the same when the username is explicitly set to an empty string.

* dt/http-empty-auth:
  http: http.emptyauth should allow empty (not just NULL) usernames

7 years agoMerge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ru
Jiang Xin [Sun, 16 Oct 2016 12:11:41 +0000 (20:11 +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

7 years agogitweb: link to "git describe"'d commits in log messages
Ævar Arnfjörð Bjarmason [Thu, 6 Oct 2016 09:11:35 +0000 (09:11 +0000)] 
gitweb: link to "git describe"'d commits in log messages

Change the log formatting function to know about "git describe" output
such as "v2.8.0-4-g867ad08", in addition to just plain "867ad08".

There are still many valid refnames that we don't link to
e.g. v2.10.0-rc1~2^2~1 is also a valid way to refer to
v2.8.0-4-g867ad08, but I'm not supporting that with this commit,
similarly it's trivially possible to create some refnames like
"æ/var-gf6727b0" or which won't be picked up by this regex.

There's surely room for improvement here, but I just wanted to address
the very common case of sticking "git describe" output into commit
messages without trying to link to all possible refnames, that's going
to be a rather futile exercise given that this is free text, and it
would be prohibitively expensive to look up whether the references in
question exist in our repository.

There was on-list discussion about how we could do better than this
patch. Junio suggested to update parse_commits() to call a new
"gitweb--helper" command which would pass each of the revision
candidates through "rev-parse --verify --quiet". That would cut down
on our false positives (e.g. we'll link to "deadbeef"), and also allow
us to be more aggressive in selecting candidate revisions.

That may be too expensive to work in practice, or it may
not. Investigating that would be a good follow-up to this patch.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogitweb: link to 7-char+ SHA-1s, not only 8-char+
Ævar Arnfjörð Bjarmason [Thu, 6 Oct 2016 09:11:34 +0000 (09:11 +0000)] 
gitweb: link to 7-char+ SHA-1s, not only 8-char+

Change the minimum length of an abbreviated object identifier in the
commit message gitweb tries to turn into link from 8 hexchars to 7.

This arbitrary minimum length of 8 was introduced in bfe2191 ("gitweb:
SHA-1 in commit log message links to "object" view", 2006-12-10), but
the default abbreviation length is 7, and has been for a long time.

It's still possible to reference SHA-1s down to 4 characters in length,
see v1.7.4-1-gdce9648's MINIMUM_ABBREV, but I can't see how to make
git actually produce that, so I doubt anyone is putting that into log
messages in practice, but people definitely do put 7 character SHA-1s
into log messages.

I think it's fairly dubious to link to things matching [0-9a-fA-F]
here as opposed to just [0-9a-f], that dates back to the initial
version of gitweb from 161332a ("first working version",
2005-08-07). Git will accept all-caps SHA-1s, but didn't ever produce
them as far as I can tell.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogitweb: fix a typo in a comment
Ævar Arnfjörð Bjarmason [Thu, 6 Oct 2016 09:11:33 +0000 (09:11 +0000)] 
gitweb: fix a typo in a comment

Change a typo'd MIME type in a comment. The Content-Type is
application/xhtml+xml, not application/xhtm+xml.

Fixes up code originally added in 53c4031 ("gitweb: Strip
non-printable characters from syntax highlighter output", 2011-09-16).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofetch: use "quick" has_sha1_file for tag following
Jeff King [Thu, 13 Oct 2016 16:53:44 +0000 (12:53 -0400)] 
fetch: use "quick" has_sha1_file for tag following

When we auto-follow tags in a fetch, we look at all of the
tags advertised by the remote and fetch ones where we don't
already have the tag, but we do have the object it peels to.
This involves a lot of calls to has_sha1_file(), some of
which we can reasonably expect to fail. Since 45e8a74
(has_sha1_file: re-check pack directory before giving up,
2013-08-30), this may cause many calls to
reprepare_packed_git(), which is potentially expensive.

This has gone unnoticed for several years because it
requires a fairly unique setup to matter:

  1. You need to have a lot of packs on the client side to
     make reprepare_packed_git() expensive (the most
     expensive part is finding duplicates in an unsorted
     list, which is currently quadratic).

  2. You need a large number of tag refs on the server side
     that are candidates for auto-following (i.e., that the
     client doesn't have). Each one triggers a re-read of
     the pack directory.

  3. Under normal circumstances, the client would
     auto-follow those tags and after one large fetch, (2)
     would no longer be true. But if those tags point to
     history which is disconnected from what the client
     otherwise fetches, then it will never auto-follow, and
     those candidates will impact it on every fetch.

So when all three are true, each fetch pays an extra
O(nr_tags * nr_packs^2) cost, mostly in string comparisons
on the pack names. This was exacerbated by 47bf4b0
(prepare_packed_git_one: refactor duplicate-pack check,
2014-06-30) which uses a slightly more expensive string
check, under the assumption that the duplicate check doesn't
happen very often (and it shouldn't; the real problem here
is how often we are calling reprepare_packed_git()).

This patch teaches fetch to use HAS_SHA1_QUICK to sacrifice
accuracy for speed, in cases where we might be racy with a
simultaneous repack. This is similar to the fix in 0eeb077
(index-pack: avoid excessive re-reading of pack directory,
2015-06-09). As with that case, it's OK for has_sha1_file()
occasionally say "no I don't have it" when we do, because
the worst case is not a corruption, but simply that we may
fail to auto-follow a tag that points to it.

Here are results from the included perf script, which sets
up a situation similar to the one described above:

Test            HEAD^               HEAD
----------------------------------------------------------
5550.4: fetch   11.21(10.42+0.78)   0.08(0.04+0.02) -99.3%

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: apply: mark error messages for translation
Vasco Almeida [Fri, 14 Oct 2016 11:43:37 +0000 (11:43 +0000)] 
i18n: apply: mark error messages for translation

Mark error messages for translation passed to error() and die()
functions.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: apply: mark info messages for translation
Vasco Almeida [Fri, 14 Oct 2016 11:43:36 +0000 (11:43 +0000)] 
i18n: apply: mark info messages for translation

Mark messages for translation printed to stderr.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: apply: mark plural string for translation
Vasco Almeida [Fri, 14 Oct 2016 11:43:35 +0000 (11:43 +0000)] 
i18n: apply: mark plural string for translation

Mark plural string for translation using Q_().

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoparse_mailboxes: accept extra text after <...> address
Matthieu Moy [Thu, 13 Oct 2016 05:47:27 +0000 (07:47 +0200)] 
parse_mailboxes: accept extra text after <...> address

The test introduced in this commit succeeds without the patch to Git.pm
if Mail::Address is installed, but fails otherwise because our in-house
parser does not accept any text after the email address. They succeed
both with and without Mail::Address after this commit.

Mail::Address accepts extra text and considers it as part of the name,
iff the address is surrounded with <...>. The implementation mimics
this behavior as closely as possible.

This mostly restores the behavior we had before b1c8a11 (send-email:
allow multiple emails using --cc, --to and --bcc, 2015-06-30), but we
keep the possibility to handle comma-separated lists.

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoworktree: allow the main brach of a bare repository to be checked out
Dennis Kaarsemaker [Wed, 12 Oct 2016 16:41:07 +0000 (18:41 +0200)] 
worktree: allow the main brach of a bare repository to be checked out

In bare repositories, get_worktrees() still returns the main repository,
so git worktree list can show it. ignore it in find_shared_symref so we
can still check out the main branch.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomerge-base: handle --fork-point without reflog
Jeff King [Wed, 12 Oct 2016 20:10:40 +0000 (16:10 -0400)] 
merge-base: handle --fork-point without reflog

The --fork-point option looks in the reflog to try to find
where a derived branch forked from a base branch. However,
if the reflog for the base branch is totally empty (as it
commonly is right after cloning, which does not write a
reflog entry), then our for_each_reflog call will not find
any entries, and we will come up with no merge base, even
though there may be one with the current tip of the base.

We can fix this by just adding the current tip to
our list of collected entries.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agococci: refactor common patterns to use xstrdup_or_null()
Junio C Hamano [Wed, 12 Oct 2016 18:20:23 +0000 (11:20 -0700)] 
cocci: refactor common patterns to use xstrdup_or_null()

d64ea0f83b ("git-compat-util: add xstrdup_or_null helper",
2015-01-12) added a handy wrapper that allows us to get a duplicate
of a string or NULL if the original is NULL, but a handful of
codepath predate its introduction or just weren't aware of it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogpg-interface: use more status letters
Michael J Gruber [Wed, 12 Oct 2016 13:04:15 +0000 (15:04 +0200)] 
gpg-interface: use more status letters

According to gpg2's doc/DETAILS:

    For each signature only one of the codes GOODSIG, BADSIG,
    EXPSIG, EXPKEYSIG, REVKEYSIG or ERRSIG will be emitted.

gpg1 ("classic") behaves the same (although doc/DETAILS differs).

Currently, we parse gpg's status output for GOODSIG, BADSIG and
trust information and translate that into status codes G, B, U, N
for the %G?  format specifier.

git-verify-* returns success in the GOODSIG case only. This is
somewhat in disagreement with gpg, which considers the first 5 of
the 6 above as VALIDSIG, but we err on the very safe side.

Introduce additional status codes E, X, Y, R for ERRSIG, EXPSIG,
EXPKEYSIG, and REVKEYSIG so that a user of %G? gets more information
about the absence of a 'G' on first glance.

Requested-by: Alex <agrambot@gmail.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>