git
7 years agoMerge branch 'ak/sh-setup-dot-source-i18n-fix' into maint
Junio C Hamano [Tue, 29 Nov 2016 21:27:56 +0000 (13:27 -0800)] 
Merge branch 'ak/sh-setup-dot-source-i18n-fix' into maint

Recent update to git-sh-setup (a library of shell functions that
are used by our in-tree scripted Porcelain commands) included
another shell library git-sh-i18n without specifying where it is,
relying on the $PATH.  This has been fixed to be more explicit by
prefixing $(git --exec-path) output in front.

* ak/sh-setup-dot-source-i18n-fix:
  git-sh-setup: be explicit where to dot-source git-sh-i18n from.

7 years agoMerge branch 'jk/daemon-path-ok-check-truncation' into maint
Junio C Hamano [Tue, 29 Nov 2016 21:27:55 +0000 (13:27 -0800)] 
Merge branch 'jk/daemon-path-ok-check-truncation' into maint

"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' into maint
Junio C Hamano [Tue, 29 Nov 2016 21:27:55 +0000 (13:27 -0800)] 
Merge branch 'rs/ring-buffer-wraparound' into maint

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 'mm/send-email-cc-cruft-after-address' into maint
Junio C Hamano [Tue, 29 Nov 2016 21:27:54 +0000 (13:27 -0800)] 
Merge branch 'mm/send-email-cc-cruft-after-address' into maint

"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 'cp/completion-negative-refs' into maint
Junio C Hamano [Tue, 29 Nov 2016 21:27:53 +0000 (13:27 -0800)] 
Merge branch 'cp/completion-negative-refs' into maint

The command-line completion script (in contrib/) learned to
complete "git cmd ^mas<HT>" to complete the negative end of
reference to "git cmd ^master".

* cp/completion-negative-refs:
  completion: support excluding refs

7 years agoMerge branch 'jc/am-read-author-file' into maint
Junio C Hamano [Tue, 29 Nov 2016 21:27:53 +0000 (13:27 -0800)] 
Merge branch 'jc/am-read-author-file' into maint

Extract a small helper out of the function that reads the authors
script file "git am" internally uses.
This by itself is not useful until a second caller appears in the
future for "rebase -i" helper.

* jc/am-read-author-file:
  am: refactor read_author_script()

7 years agogit-sh-setup: be explicit where to dot-source git-sh-i18n from.
Anders Kaseorg [Sun, 30 Oct 2016 02:10:02 +0000 (22:10 -0400)] 
git-sh-setup: be explicit where to dot-source git-sh-i18n from.

d323c6b641 ("i18n: git-sh-setup.sh: mark strings for translation",
2016-06-17) started to dot-source git-sh-i18n shell script library,
assuming that $PATH is already adjusted for our scripts, namely,
$GIT_EXEC_PATH is at the beginning of $PATH.

Old contrib scripts like contrib/convert-grafts-to-replace-refs.sh
and contrib/rerere-train.sh and third-party scripts like guilt may
however be using this as ". $(git --exec-path)/git-sh-setup",
without satisfying that assumption.  Be more explicit by specifying
its path prefixed with "$(git --exec-path)/". to be safe.

While we’re here, move the sourcing of git-sh-i18n below the shell
portability fixes.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoGit 2.10.2 v2.10.2
Junio C Hamano [Fri, 28 Oct 2016 16:02:44 +0000 (09:02 -0700)] 
Git 2.10.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'pb/test-parse-options-expect' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:24 +0000 (09:01 -0700)] 
Merge branch 'pb/test-parse-options-expect' into maint

Test clean-up.

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

7 years agoMerge branch 'jc/cocci-xstrdup-or-null' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)] 
Merge branch 'jc/cocci-xstrdup-or-null' into maint

Code cleanup.

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

7 years agoMerge branch 'rs/cocci' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)] 
Merge branch 'rs/cocci' into maint

Code cleanup.

* rs/cocci:
  use strbuf_add_unique_abbrev() for adding short hashes, part 3
  remove unnecessary NULL check before free(3)
  coccicheck: make transformation for strbuf_addf(sb, "...") more precise
  use strbuf_add_unique_abbrev() for adding short hashes, part 2
  use strbuf_addstr() instead of strbuf_addf() with "%s", part 2
  gitignore: ignore output files of coccicheck make target
  use strbuf_addstr() for adding constant strings to a strbuf, part 2
  add coccicheck make target
  contrib/coccinelle: fix semantic patch for oid_to_hex_r()

7 years agoMerge branch 'jc/diff-unique-abbrev-comments' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)] 
Merge branch 'jc/diff-unique-abbrev-comments' into maint

A bit more comments in a tricky code.

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

7 years agoMerge branch 'rs/pretty-format-color-doc-fix' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)] 
Merge branch 'rs/pretty-format-color-doc-fix' into maint

Small doc update.

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

7 years agoMerge branch 'js/reset-usage' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:22 +0000 (09:01 -0700)] 
Merge branch 'js/reset-usage' into maint

Message fix-up.

* js/reset-usage:
  reset: fix usage

7 years agoMerge branch 'po/fix-doc-merge-base-illustration' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:21 +0000 (09:01 -0700)] 
Merge branch 'po/fix-doc-merge-base-illustration' into maint

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' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:20 +0000 (09:01 -0700)] 
Merge branch 'jk/tap-verbose-fix' into maint

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 'tg/add-chmod+x-fix' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:19 +0000 (09:01 -0700)] 
Merge branch 'tg/add-chmod+x-fix' into maint

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' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:19 +0000 (09:01 -0700)] 
Merge branch 'bw/submodule-branch-dot-doc' into maint

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 'jk/tighten-alloc' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:18 +0000 (09:01 -0700)] 
Merge branch 'jk/tighten-alloc' into maint

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 'jk/fetch-quick-tag-following' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:17 +0000 (09:01 -0700)] 
Merge branch 'jk/fetch-quick-tag-following' into maint

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' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:17 +0000 (09:01 -0700)] 
Merge branch 'jk/merge-base-fork-point-without-reflog' into maint

"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 'dk/worktree-dup-checkout-with-bare-is-ok' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:16 +0000 (09:01 -0700)] 
Merge branch 'dk/worktree-dup-checkout-with-bare-is-ok' into maint

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 'sb/submodule-config-doc-drop-path' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:16 +0000 (09:01 -0700)] 
Merge branch 'sb/submodule-config-doc-drop-path' into maint

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 'jk/ref-symlink-loop' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:15 +0000 (09:01 -0700)] 
Merge branch 'jk/ref-symlink-loop' into maint

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 'nd/commit-p-doc' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:15 +0000 (09:01 -0700)] 
Merge branch 'nd/commit-p-doc' into maint

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' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:14 +0000 (09:01 -0700)] 
Merge branch 'jk/clone-copy-alternates-fix' into maint

"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' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:14 +0000 (09:01 -0700)] 
Merge branch 'dt/http-empty-auth' into maint

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 'dp/autoconf-curl-ssl' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:13 +0000 (09:01 -0700)] 
Merge branch 'dp/autoconf-curl-ssl' into maint

The ./configure script generated from configure.ac was taught how
to detect support of SSL by libcurl better.

* dp/autoconf-curl-ssl:
  ./configure.ac: detect SSL in libcurl using curl-config

7 years agoMerge branch 'ak/curl-imap-send-explicit-scheme' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:13 +0000 (09:01 -0700)] 
Merge branch 'ak/curl-imap-send-explicit-scheme' into maint

When we started cURL to talk to imap server when a new enough
version of cURL library is available, we forgot to explicitly add
imap(s):// before the destination.  To some folks, that didn't work
and the library tried to make HTTP(s) requests instead.

* ak/curl-imap-send-explicit-scheme:
  imap-send: Tell cURL to use imap:// or imaps://

7 years agoMerge branch 'jt/fetch-pack-in-vain-count-with-stateless' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:12 +0000 (09:01 -0700)] 
Merge branch 'jt/fetch-pack-in-vain-count-with-stateless' into maint

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

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

7 years agoMerge branch 'js/regexec-buf' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:12 +0000 (09:01 -0700)] 
Merge branch 'js/regexec-buf' into maint

A follow-up to an already graduated topic.

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

7 years agoMerge branch 'rs/c-auto-resets-attributes' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:11 +0000 (09:01 -0700)] 
Merge branch 'rs/c-auto-resets-attributes' into maint

When "%C(auto)" appears at the very beginning of the pretty format
string, it did not need to issue the reset sequence, but it did.
This is a small optimization to already graduated topic.

* rs/c-auto-resets-attributes:
  pretty: avoid adding reset for %C(auto) if output is empty
  pretty: let %C(auto) reset all attributes

7 years agoMerge branch 'yk/git-tag-remove-mention-of-old-layout-in-doc' into maint
Junio C Hamano [Fri, 28 Oct 2016 16:01:10 +0000 (09:01 -0700)] 
Merge branch 'yk/git-tag-remove-mention-of-old-layout-in-doc' into maint

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 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 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 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 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 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 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 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 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 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 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 agol10n: de.po: translate 260 new messages
Ralf Thielow [Wed, 12 Oct 2016 16:31:13 +0000 (18:31 +0200)] 
l10n: de.po: translate 260 new messages

Translate 260 new message came from git.pot updates in 9fa976f (l10n:
git.pot: v2.10.0 round 1 (248 new, 56 removed)) and 5bd166d (l10n:
git.pot: v2.10.0 round 2 (12 new, 44 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
7 years agoStart preparing for 2.10.2
Junio C Hamano [Tue, 11 Oct 2016 21:24:02 +0000 (14:24 -0700)] 
Start preparing for 2.10.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jk/verify-packfile-gently' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:21:35 +0000 (14:21 -0700)] 
Merge branch 'jk/verify-packfile-gently' into maint

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

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

7 years agoMerge branch 'jc/worktree-config' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:21:17 +0000 (14:21 -0700)] 
Merge branch 'jc/worktree-config' into maint

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

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

7 years agoMerge branch 'jc/verify-loose-object-header' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:21:03 +0000 (14:21 -0700)] 
Merge branch 'jc/verify-loose-object-header' into maint

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

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

7 years agoMerge branch 'rs/git-gui-use-modern-git-merge-syntax' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:20:37 +0000 (14:20 -0700)] 
Merge branch 'rs/git-gui-use-modern-git-merge-syntax' into maint

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

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

7 years agoMerge branch 'kd/mailinfo-quoted-string' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:20:31 +0000 (14:20 -0700)] 
Merge branch 'kd/mailinfo-quoted-string' into maint

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

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

7 years agoMerge branch 'pb/rev-list-reverse-with-count' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:20:05 +0000 (14:20 -0700)] 
Merge branch 'pb/rev-list-reverse-with-count' into maint

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

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

7 years agoMerge branch 'jc/blame-abbrev' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:19:52 +0000 (14:19 -0700)] 
Merge branch 'jc/blame-abbrev' into maint

Almost everybody uses DEFAULT_ABBREV to refer to the default
setting for the abbreviation, but "git blame" peeked into
underlying variable bypassing the macro for no good reason.

* jc/blame-abbrev:
  blame: use DEFAULT_ABBREV macro

7 years agoMerge branch 'jk/graph-padding-fix' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:19:03 +0000 (14:19 -0700)] 
Merge branch 'jk/graph-padding-fix' into maint

The "graph" API used in "git log --graph" miscounted the number of
output columns consumed so far when drawing a padding line, which
has been fixed; this did not affect any existing code as nobody
tried to write anything after the padding on such a line, though.

* jk/graph-padding-fix:
  graph: fix extra spaces in graph_padding_line

7 years agoMerge branch 'sg/ref-filter-parse-optim' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:18:57 +0000 (14:18 -0700)] 
Merge branch 'sg/ref-filter-parse-optim' into maint

The code that parses the format parameter of for-each-ref command
has seen a micro-optimization.

* sg/ref-filter-parse-optim:
  ref-filter: strip format option after a field name only once while parsing

7 years agoMerge branch 'rs/copy-array' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:18:32 +0000 (14:18 -0700)] 
Merge branch 'rs/copy-array' into maint

Code cleanup.

* rs/copy-array:
  use COPY_ARRAY
  add COPY_ARRAY

7 years agoMerge branch 'dt/mailinfo' into maint
Junio C Hamano [Tue, 11 Oct 2016 21:17:52 +0000 (14:17 -0700)] 
Merge branch 'dt/mailinfo' into maint

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

7 years agoreset: fix usage
Johannes Schindelin [Tue, 11 Oct 2016 16:09:03 +0000 (18:09 +0200)] 
reset: fix usage

The <tree-ish> parameter is actually optional (see man page).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopretty: fix document link for color specification
René Scharfe [Tue, 11 Oct 2016 03:41:14 +0000 (05:41 +0200)] 
pretty: fix document link for color specification

Helped-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 agodocumentation: improve submodule.<name>.{url, path} description
Stefan Beller [Mon, 10 Oct 2016 19:36:41 +0000 (12:36 -0700)] 
documentation: improve submodule.<name>.{url, path} description

Unlike the url variable a user cannot override the the path variable,
as it is part of the content together with the gitlink at the given
path. To avoid confusion do not mention the .path variable in the config
section and rely on the documentation provided in gitmodules[5].

Enhance the description of submodule.<name>.url and mention its two use
cases separately.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfigure.ac: improve description of NO_REGEX test
Jakub Narębski [Fri, 7 Oct 2016 11:30:52 +0000 (13:30 +0200)] 
configure.ac: improve description of NO_REGEX test

The commit 2f8952250a ("regex: add regexec_buf() that can work on a
non NUL-terminated string", 2016-09-21) changed description of
NO_REGEX build config variable to be more neutral, and actually say
that it is about support for REG_STARTEND.  Change description in
configure.ac to match.

Change also the test message and variable name to match.  The test
just checks that REG_STARTEND is #defined.

Issue-found-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agouse strbuf_add_unique_abbrev() for adding short hashes, part 3
René Scharfe [Sat, 8 Oct 2016 15:38:47 +0000 (17:38 +0200)] 
use strbuf_add_unique_abbrev() for adding short hashes, part 3

Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
instead of taking detours through find_unique_abbrev() and its static
buffer.  This is shorter in most cases and a bit more efficient.

The changes here are not easily handled by a semantic patch because
they involve removing temporary variables and deconstructing format
strings for strbuf_addf().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoremove unnecessary NULL check before free(3)
René Scharfe [Sat, 8 Oct 2016 14:14:57 +0000 (16:14 +0200)] 
remove unnecessary NULL check before free(3)

free(3) handles NULL pointers just fine.  Add a semantic patch for
removing unnecessary NULL checks before calling this function, and
apply it on the code base.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofiles_read_raw_ref: prevent infinite retry loops in general
Jeff King [Thu, 6 Oct 2016 16:48:42 +0000 (12:48 -0400)] 
files_read_raw_ref: prevent infinite retry loops in general

Limit the number of retries to 3. That should be adequate to
prevent any races, while preventing the possibility of
infinite loops if the logic fails to handle any other
possible error modes correctly.

After the fix in the previous commit, there's no known way
to trigger an infinite loop, but I did manually verify that
this fixes the test in that commit even when the code change
is not applied.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofiles_read_raw_ref: avoid infinite loop on broken symlinks
Jeff King [Thu, 6 Oct 2016 19:41:08 +0000 (15:41 -0400)] 
files_read_raw_ref: avoid infinite loop on broken symlinks

Our ref resolution first runs lstat() on any path we try to
look up, because we want to treat symlinks specially (by
resolving them manually and considering them symrefs). But
if the results of `readlink` do _not_ look like a ref, we
fall through to treating it like a normal file, and just
read the contents of the linked path.

Since fcb7c76 (resolve_ref_unsafe(): close race condition
reading loose refs, 2013-06-19), that "normal file" code
path will stat() the file and if we see ENOENT, will jump
back to the lstat(), thinking we've seen inconsistent
results between the two calls. But for a symbolic ref, this
isn't a race: the lstat() found the symlink, and the stat()
is looking at the path it points to. We end up in an
infinite loop calling lstat() and stat().

We can fix this by avoiding the retry-on-inconsistent jump
when we know that we found a symlink. While we're at it,
let's add a comment explaining why the symlink case gets to
this code in the first place; without that, it is not
obvious that the correct solution isn't to avoid the stat()
code path entirely.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoclone: detect errors in normalize_path_copy
Jeff King [Wed, 5 Oct 2016 14:29:29 +0000 (10:29 -0400)] 
clone: detect errors in normalize_path_copy

When we are copying the alternates from the source
repository, if we find a relative path that is too deep for
the source (e.g., "../../../objects" from "/repo.git/objects"),
then normalize_path_copy will report an error and leave
trash in the buffer, which we will add to our new alternates
file. Instead, let's detect the error, print a warning, and
skip copying that alternate.

There's no need to die. The relative path is probably just
broken cruft in the source repo. If it turns out to have
been important for accessing some objects, we rely on other
parts of the clone to detect that, just as they would with a
missing object in the source repo itself (though note that
clones with "-s" are inherently local, which may do fewer
object-quality checks in the first place).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-commit.txt: clarify --patch mode with pathspec
Duy Nguyen [Wed, 5 Oct 2016 10:26:33 +0000 (17:26 +0700)] 
git-commit.txt: clarify --patch mode with pathspec

How pathspec is used, with and without --interactive/--patch, is
different. But this is not clear from the document. These changes hint
the user to keep reading (to option #5) instead of stopping at #2 and
assuming --patch/--interactive behaves the same way.

And since all the options listed here always mention how the index is
involved (or not) in the final commit, add that bit for #5 as well. This
"on top of the index" is implied when you head over git-add(1), but if
you just go straight to the "Interactive mode" and not read what git-add
is for, you may miss it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agohttp: http.emptyauth should allow empty (not just NULL) usernames
David Turner [Tue, 4 Oct 2016 14:53:52 +0000 (10:53 -0400)] 
http: http.emptyauth should allow empty (not just NULL) usernames

When using Kerberos authentication with newer versions of libcurl,
CURLOPT_USERPWD must be set to a value, even if it is an empty value.
The value is never sent to the server.  Previous versions of libcurl
did not require this variable to be set.  One way that some users
express the empty username/password is http://:@gitserver.example.com,
which http.emptyauth was designed to support.  Another, equivalent,
URL is http://@gitserver.example.com.  The latter leads to a username
of zero-length, rather than a NULL username, but CURLOPT_USERPWD still
needs to be set (if http.emptyauth is set).  Do so.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoGit 2.10.1 v2.10.1
Junio C Hamano [Mon, 3 Oct 2016 20:24:18 +0000 (13:24 -0700)] 
Git 2.10.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jk/ident-ai-canonname-could-be-null' into maint
Junio C Hamano [Mon, 3 Oct 2016 20:22:32 +0000 (13:22 -0700)] 
Merge branch 'jk/ident-ai-canonname-could-be-null' into maint

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

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

7 years agoMerge branch 'jk/doc-cvs-update' into maint
Junio C Hamano [Mon, 3 Oct 2016 20:22:25 +0000 (13:22 -0700)] 
Merge branch 'jk/doc-cvs-update' into maint

Documentation around tools to import from CVS was fairly outdated.

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

7 years agoMerge branch 'jk/pack-tag-of-tag' into maint
Junio C Hamano [Mon, 3 Oct 2016 20:22:13 +0000 (13:22 -0700)] 
Merge branch 'jk/pack-tag-of-tag' into maint

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

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

7 years agoref-filter: strip format option after a field name only once while parsing
SZEDER Gábor [Sun, 2 Oct 2016 16:35:11 +0000 (18:35 +0200)] 
ref-filter: strip format option after a field name only once while parsing

When parse_ref_filter_atom() iterates over a list of valid atoms to
check that a field name is one of them, it has to strip the optional
colon-separated format option suffix that might follow the field name.
However, it does so inside the loop, i.e. it performs the exact same
stripping over and over again.

Move stripping the format option suffix out of that loop, so it's only
performed once for each parsed field name.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agococcicheck: make transformation for strbuf_addf(sb, "...") more precise
René Scharfe [Sun, 2 Oct 2016 22:58:21 +0000 (00:58 +0200)] 
coccicheck: make transformation for strbuf_addf(sb, "...") more precise

We can replace strbuf_addf() calls that just add a simple string with
calls to strbuf_addstr() to make the intent clearer.  We need to be
careful if that string contains printf format specifications like %%,
though, as a simple replacement would change the output.

Add checks to the semantic patch to make sure we only perform the
transformation if the second argument is a string constant (possibly
translated) that doesn't contain any percent signs.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff_unique_abbrev(): document its assumption and limitation
Junio C Hamano [Fri, 30 Sep 2016 17:42:05 +0000 (10:42 -0700)] 
diff_unique_abbrev(): document its assumption and limitation

This function is used to add "..." to displayed object names in
"diff --raw --abbrev[=<n>]" output.  It bases its behaviour on an
untold assumption that the abbreviation length requested by the
caller is "reasonble", i.e. most of the objects will abbreviate
within the requested length and the resulting length would never
exceed it by more than a few hexdigits (otherwise the resulting
columns would not align).  Explain that in a comment.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopretty: avoid adding reset for %C(auto) if output is empty
René Scharfe [Thu, 29 Sep 2016 18:13:05 +0000 (20:13 +0200)] 
pretty: avoid adding reset for %C(auto) if output is empty

We emit an escape sequence for resetting color and attribute for
%C(auto) to make sure automatic coloring is displayed as intended.
Stop doing that if the output strbuf is empty, i.e. when %C(auto)
appears at the start of the format string, because then there is no
need for a reset and we save a few bytes in the output.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoPrepare for 2.10.1
Junio C Hamano [Thu, 29 Sep 2016 23:51:09 +0000 (16:51 -0700)] 
Prepare for 2.10.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'tg/add-chmod+x-fix' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:47 +0000 (16:49 -0700)] 
Merge branch 'tg/add-chmod+x-fix' into maint

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

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

7 years agoMerge branch 'et/add-chmod-x' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:46 +0000 (16:49 -0700)] 
Merge branch 'et/add-chmod-x' into maint

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

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

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

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

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

7 years agoMerge branch 'ls/travis-homebrew-path-fix' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:45 +0000 (16:49 -0700)] 
Merge branch 'ls/travis-homebrew-path-fix' into maint

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

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

7 years agoMerge branch 'js/regexec-buf' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:44 +0000 (16:49 -0700)] 
Merge branch 'js/regexec-buf' into maint

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

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

7 years agoMerge branch 'nd/checkout-disambiguation' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:43 +0000 (16:49 -0700)] 
Merge branch 'nd/checkout-disambiguation' into maint

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

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

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

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

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

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

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

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

7 years agoMerge branch 'jk/reduce-gc-aggressive-depth' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:42 +0000 (16:49 -0700)] 
Merge branch 'jk/reduce-gc-aggressive-depth' into maint

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

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

7 years agoMerge branch 'jk/rebase-i-drop-ident-check' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:41 +0000 (16:49 -0700)] 
Merge branch 'jk/rebase-i-drop-ident-check' into maint

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

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

7 years agoMerge branch 'jt/format-patch-base-info-above-sig' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:40 +0000 (16:49 -0700)] 
Merge branch 'jt/format-patch-base-info-above-sig' into maint

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

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