git
8 years agosubmodule: stop sanitizing config options
Jeff King [Thu, 5 May 2016 01:22:19 +0000 (21:22 -0400)] 
submodule: stop sanitizing config options

The point of having a whitelist of command-line config
options to pass to submodules was two-fold:

  1. It prevented obvious nonsense like using core.worktree
     for multiple repos.

  2. It could prevent surprise when the user did not mean
     for the options to leak to the submodules (e.g.,
     http.sslverify=false).

For case 1, the answer is mostly "if it hurts, don't do
that". For case 2, we can note that any such example has a
matching inverted surprise (e.g., a user who meant
http.sslverify=true to apply everywhere, but it didn't).

So this whitelist is probably not giving us any benefit, and
is already creating a hassle as people propose things to put
on it. Let's just drop it entirely.

Note that we still need to keep a special code path for
"prepare the submodule environment", because we still have
to take care to pass through $GIT_CONFIG_PARAMETERS (and
block the rest of the repo-specific environment variables).

We can do this easily from within the submodule shell
script, which lets us drop the submodule--helper option
entirely (and it's OK to do so because as a "--" program, it
is entirely a private implementation detail).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule: use prepare_submodule_repo_env consistently
Jeff King [Thu, 28 Apr 2016 13:39:15 +0000 (09:39 -0400)] 
submodule: use prepare_submodule_repo_env consistently

Before 14111fc (git: submodule honor -c credential.* from
command line, 2016-02-29), it was sufficient for code which
spawned a process in a submodule to just set the child
process's "env" field to "local_repo_env" to clear the
environment of any repo-specific variables.

That commit introduced a more complicated procedure, in
which we clear most variables but allow through sanitized
config. For C code, we used that procedure only for cloning,
but not for any of the programs spawned by submodule.c. As a
result, things like "git fetch --recurse-submodules" behave
differently than "git clone --recursive"; the former will
not pass through the sanitized config.

We can fix this by using prepare_submodule_repo_env()
everywhere in submodule.c.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule--helper: move config-sanitizing to submodule.c
Jeff King [Thu, 28 Apr 2016 13:38:20 +0000 (09:38 -0400)] 
submodule--helper: move config-sanitizing to submodule.c

These functions should be used by any code which spawns a
submodule process, which may happen in submodule.c (e.g.,
for spawning fetch). Let's move them there and make them
public so that submodule--helper can continue to use them.

Since they're now public, let's also provide a basic overview
of their intended use.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule: export sanitized GIT_CONFIG_PARAMETERS
Jeff King [Thu, 28 Apr 2016 13:37:44 +0000 (09:37 -0400)] 
submodule: export sanitized GIT_CONFIG_PARAMETERS

Commit 14111fc (git: submodule honor -c credential.* from
command line, 2016-02-29) taught git-submodule.sh to save
the sanitized value of $GIT_CONFIG_PARAMETERS when clearing
the environment for a submodule. However, it failed to
export the result, meaning that it had no effect for any
sub-programs.

We didn't catch this in our initial tests because we checked
only the "clone" case, which does not go through the shell
script at all. Provoking "git submodule update" to do a
fetch demonstrates the bug.

Noticed-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5550: break submodule config test into multiple sub-tests
Jeff King [Thu, 28 Apr 2016 13:37:04 +0000 (09:37 -0400)] 
t5550: break submodule config test into multiple sub-tests

Right now we test only the cloning case, but there are other
interesting cases (e.g., fetching). Let's pull the setup
bits into their own test, which will make things flow more
logically once we start adding more tests which use the
setup.

Let's also introduce some whitespace to the clone-test to
split the two parts: making sure it fails without our
cmdline config, and that it succeeds with it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5550: fix typo in $HTTPD_URL
Jeff King [Thu, 28 Apr 2016 13:36:37 +0000 (09:36 -0400)] 
t5550: fix typo in $HTTPD_URL

Commit 14111fc (git: submodule honor -c credential.* from
command line, 2016-02-29) accidentally wrote $HTTP_URL. It
happened to work because we ended up with "credential..helper",
which we treat the same as "credential.helper", applying it
to all URLs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit_config_push_parameter: handle empty GIT_CONFIG_PARAMETERS
Jeff King [Tue, 22 Mar 2016 19:50:51 +0000 (15:50 -0400)] 
git_config_push_parameter: handle empty GIT_CONFIG_PARAMETERS

The "git -c var=value" option stuffs the config value into
$GIT_CONFIG_PARAMETERS, so that sub-processes can see it.
When the config is later read via git_config() or similar,
we parse it back out of that variable.  The parsing end is a
little bit picky; it assumes that each entry was generated
with sq_quote_buf(), and that there is no extraneous
whitespace.

On the generating end, we are careful to append to an
existing $GIT_CONFIG_PARAMETERS variable if it exists.
However, our test for "should we add a space separator" is
too liberal: it will add one even if the environment
variable exists but is empty. As a result, you might end up
with:

   GIT_CONFIG_PARAMETERS=" 'core.foo=bar'"

which the parser will choke on.

This was hard to trigger in older versions of git, since we
only set the variable when we had something to put into it
(though you could certainly trigger it manually). But since
14111fc (git: submodule honor -c credential.* from command
line, 2016-02-29), the submodule code will unconditionally
put the $GIT_CONFIG_PARAMETERS variable into the environment
of any operation in the submodule, whether it is empty or
not. So any of those operations which themselves use "git
-c" will generate the unparseable value and fail.

We can easily fix it by catching this case on the generating
side. While we're adding a test, let's also check that
multiple layers of "git -c" work, which was previously not
tested at all.

Reported-by: Shin Fan <shinfan@google.com>
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Tested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit: submodule honor -c credential.* from command line
Jacob Keller [Mon, 29 Feb 2016 22:58:35 +0000 (14:58 -0800)] 
git: submodule honor -c credential.* from command line

Due to the way that the git-submodule code works, it clears all local
git environment variables before entering submodules. This is normally
a good thing since we want to clear settings such as GIT_WORKTREE and
other variables which would affect the operation of submodule commands.
However, GIT_CONFIG_PARAMETERS is special, and we actually do want to
preserve these settings. However, we do not want to preserve all
configuration as many things should be left specific to the parent
project.

Add a git submodule--helper function, sanitize-config, which shall be
used to sanitize GIT_CONFIG_PARAMETERS, removing all key/value pairs
except a small subset that are known to be safe and necessary.

Replace all the calls to clear_local_git_env with a wrapped function
that filters GIT_CONFIG_PARAMETERS using the new helper and then
restores it to the filtered subset after clearing the rest of the
environment.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoquote: implement sq_quotef()
Jacob Keller [Mon, 29 Feb 2016 22:58:34 +0000 (14:58 -0800)] 
quote: implement sq_quotef()

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule: fix segmentation fault in submodule--helper clone
Jacob Keller [Mon, 29 Feb 2016 22:58:33 +0000 (14:58 -0800)] 
submodule: fix segmentation fault in submodule--helper clone

The git submodule--helper clone command will fail with a segmentation
fault when given a null url or null path variable. Since these are
required for proper functioning of the submodule--helper clone
subcommand, add checks to prevent running and fail gracefully when
missing.

Update the usage string to reflect the requirement that the --url and
--path "options" are required.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule: fix submodule--helper clone usage
Jacob Keller [Mon, 29 Feb 2016 22:58:32 +0000 (14:58 -0800)] 
submodule: fix submodule--helper clone usage

git submodule--helper clone usage stated that paths were added after the
[--] argument. The actual implementation required use of --path argument
and only supports one path at a time. Update the usage string to match
the current implementation.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule: check argc count for git submodule--helper clone
Jacob Keller [Mon, 29 Feb 2016 22:58:31 +0000 (14:58 -0800)] 
submodule: check argc count for git submodule--helper clone

Extra unused arguments to git submodule--helper clone subcommand were
being silently ignored. Add a check to the argc count after options
handling to ensure that no extra arguments were left on the argv array.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule: don't pass empty string arguments to submodule--helper clone
Jacob Keller [Mon, 29 Feb 2016 22:58:30 +0000 (14:58 -0800)] 
submodule: don't pass empty string arguments to submodule--helper clone

When --reference or --depth are unused, the current git-submodule.sh
results in empty "" arguments appended to the end of the argv array
inside git submodule--helper clone. This is not caught because the argc
count is not checked today.

Fix git-submodule.sh to only pass an argument when --reference or
--depth are used, preventing the addition of two empty string arguments
on the tail of the argv array.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot/lib-httpd: load mod_unixd
Michael J Gruber [Mon, 11 May 2015 11:54:17 +0000 (13:54 +0200)] 
t/lib-httpd: load mod_unixd

In contrast to apache 2.2, apache 2.4 does not load mod_unixd in its
default configuration (because there are choices). Thus, with the
current config, apache 2.4.10 will not be started and the httpd tests
will not run on distros with default apache config (RedHat type).

Enable mod_unixd to make the httpd tests run. This does not affect
distros negatively which have that config already in their default
(Debian type). httpd tests will run on these before and after this patch.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoEighth batch for 2.8
Junio C Hamano [Wed, 24 Feb 2016 21:31:57 +0000 (13:31 -0800)] 
Eighth batch for 2.8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jc/am-i-v-fix'
Junio C Hamano [Wed, 24 Feb 2016 21:26:01 +0000 (13:26 -0800)] 
Merge branch 'jc/am-i-v-fix'

The "v(iew)" subcommand of the interactive "git am -i" command was
broken in 2.6.0 timeframe when the command was rewritten in C.

* jc/am-i-v-fix:
  am -i: fix "v"iew
  pager: factor out a helper to prepare a child process to run the pager
  pager: lose a separate argv[]

8 years agoMerge branch 'nd/worktree-add-B'
Junio C Hamano [Wed, 24 Feb 2016 21:26:00 +0000 (13:26 -0800)] 
Merge branch 'nd/worktree-add-B'

"git worktree add -B <branchname>" did not work.

* nd/worktree-add-B:
  worktree add -B: do the checkout test before update branch
  worktree: fix "add -B"

8 years agoMerge branch 'nd/exclusion-regression-fix'
Junio C Hamano [Wed, 24 Feb 2016 21:25:59 +0000 (13:25 -0800)] 
Merge branch 'nd/exclusion-regression-fix'

Another try to add support to the ignore mechanism that lets you
say "this is excluded" and then later say "oh, no, this part (that
is a subset of the previous part) is not excluded".

* nd/exclusion-regression-fix:
  dir.c: don't exclude whole dir prematurely
  dir.c: support marking some patterns already matched
  dir.c: support tracing exclude
  dir.c: fix match_pathname()

8 years agoMerge branch 'ce/https-public-key-pinning'
Junio C Hamano [Wed, 24 Feb 2016 21:25:58 +0000 (13:25 -0800)] 
Merge branch 'ce/https-public-key-pinning'

You can now set http.[<url>.]pinnedpubkey to specify the pinned
public key when building with recent enough versions of libcURL.

* ce/https-public-key-pinning:
  http: implement public key pinning

8 years agoMerge branch 'bc/http-empty-auth'
Junio C Hamano [Wed, 24 Feb 2016 21:25:57 +0000 (13:25 -0800)] 
Merge branch 'bc/http-empty-auth'

Some authentication methods do not need username or password, but
libcurl needs some hint that it needs to perform authentication.
Supplying an empty username and password string is a valid way to
do so, but you can set the http.[<url>.]emptyAuth configuration
variable to achieve the same, if you find it cleaner.

* bc/http-empty-auth:
  http: add option to try authentication without username

8 years agoMerge branch 'sp/remote-curl-ssl-strerror'
Junio C Hamano [Wed, 24 Feb 2016 21:25:56 +0000 (13:25 -0800)] 
Merge branch 'sp/remote-curl-ssl-strerror'

Help those who debug http(s) part of the system.

* sp/remote-curl-ssl-strerror:
  remote-curl: include curl_errorstr on SSL setup failures

8 years agoMerge branch 'jk/lose-name-path'
Junio C Hamano [Wed, 24 Feb 2016 21:25:55 +0000 (13:25 -0800)] 
Merge branch 'jk/lose-name-path'

The "name_path" API was an attempt to reduce the need to construct
the full path out of a series of path components while walking a
tree hierarchy, but over time made less efficient because the path
needs to be flattened, e.g. to be compared with another path that
is already flat.  The API has been removed and its users have been
rewritten to simplify the overall code complexity.

* jk/lose-name-path:
  list-objects: pass full pathname to callbacks
  list-objects: drop name_path entirely
  list-objects: convert name_path to a strbuf
  show_object_with_name: simplify by using path_name()
  http-push: stop using name_path

8 years agoMerge branch 'ew/force-ipv4'
Junio C Hamano [Wed, 24 Feb 2016 21:25:54 +0000 (13:25 -0800)] 
Merge branch 'ew/force-ipv4'

"git fetch" and friends that make network connections can now be
told to only use ipv4 (or ipv6).

* ew/force-ipv4:
  connect & http: support -4 and -6 switches for remote operations

8 years agoMerge branch 'nd/git-common-dir-fix'
Junio C Hamano [Wed, 24 Feb 2016 21:25:53 +0000 (13:25 -0800)] 
Merge branch 'nd/git-common-dir-fix'

"git rev-parse --git-common-dir" used in the worktree feature
misbehaved when run from a subdirectory.

* nd/git-common-dir-fix:
  rev-parse: take prefix into account in --git-common-dir

8 years agoMerge branch 'nd/dwim-wildcards-as-pathspecs'
Junio C Hamano [Wed, 24 Feb 2016 21:25:52 +0000 (13:25 -0800)] 
Merge branch 'nd/dwim-wildcards-as-pathspecs'

"git show 'HEAD:Foo[BAR]Baz'" did not interpret the argument as a
rev, i.e. the object named by the the pathname with wildcard
characters in a tree object.

* nd/dwim-wildcards-as-pathspecs:
  get_sha1: don't die() on bogus search strings
  check_filename: tighten dwim-wildcard ambiguity
  checkout: reorder check_filename conditional

8 years agotests: remove no-op full-svn-test target
Eric Wong [Tue, 23 Feb 2016 06:26:59 +0000 (06:26 +0000)] 
tests: remove no-op full-svn-test target

git-svn has not supported GIT_SVN_NO_OPTIMIZE_COMMITS for
the "set-tree" sub-command in 9 years since commit 490f49ea5899
("git-svn: remove optimized commit stuff for set-tree").

So remove this target and TSVN variable to avoid confusion.

ref: http://mid.gmane.org/56C9B7B7.7030406@f2.dion.ne.jp

Helped-by: Kazutoshi Satoda <k_satoda@f2.dion.ne.jp>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoSync with 2.7.2
Junio C Hamano [Mon, 22 Feb 2016 21:16:12 +0000 (13:16 -0800)] 
Sync with 2.7.2

8 years agoMerge branch 'js/git-remote-add-url-insteadof-test'
Junio C Hamano [Mon, 22 Feb 2016 21:15:01 +0000 (13:15 -0800)] 
Merge branch 'js/git-remote-add-url-insteadof-test'

* js/git-remote-add-url-insteadof-test:
  t5505: 'remote add x y' should work when url.y.insteadOf = x

8 years agoMerge branch 'jk/config-include'
Junio C Hamano [Mon, 22 Feb 2016 21:14:48 +0000 (13:14 -0800)] 
Merge branch 'jk/config-include'

* jk/config-include:
  git-config: better document default behavior for `--include`

8 years agoMerge branch 'ew/connect-verbose'
Junio C Hamano [Mon, 22 Feb 2016 21:14:33 +0000 (13:14 -0800)] 
Merge branch 'ew/connect-verbose'

* ew/connect-verbose:
  t5570: add tests for "git {clone,fetch,pull} -v"

8 years agoGit 2.7.2 v2.7.2
Junio C Hamano [Mon, 22 Feb 2016 21:12:56 +0000 (13:12 -0800)] 
Git 2.7.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'nd/ita-cleanup' into maint
Junio C Hamano [Mon, 22 Feb 2016 21:10:21 +0000 (13:10 -0800)] 
Merge branch 'nd/ita-cleanup' into maint

Paths that have been told the index about with "add -N" are not
quite yet in the index, but a few commands behaved as if they
already are in a harmful way.

* nd/ita-cleanup:
  grep: make it clear i-t-a entries are ignored
  add and use a convenience macro ce_intent_to_add()
  blame: remove obsolete comment

8 years agoMerge branch 'pw/completion-stash' into maint
Junio C Hamano [Mon, 22 Feb 2016 21:10:20 +0000 (13:10 -0800)] 
Merge branch 'pw/completion-stash' into maint

* pw/completion-stash:
  completion: fix mis-indentation in _git_stash()

8 years agoMerge branch 'mm/clean-doc-fix' into maint
Junio C Hamano [Mon, 22 Feb 2016 21:10:20 +0000 (13:10 -0800)] 
Merge branch 'mm/clean-doc-fix' into maint

The documentation for "git clean" has been corrected; it mentioned
that .git/modules/* are removed by giving two "-f", which has never
been the case.

* mm/clean-doc-fix:
  Documentation/git-clean.txt: don't mention deletion of .git/modules/*

8 years agoMerge branch 'dw/mergetool-vim-window-shuffle' into maint
Junio C Hamano [Mon, 22 Feb 2016 21:10:19 +0000 (13:10 -0800)] 
Merge branch 'dw/mergetool-vim-window-shuffle' into maint

The vimdiff backend for "git mergetool" has been tweaked to arrange
and number buffers in the order that would match the expectation of
majority of people who read left to right, then top down and assign
buffers 1 2 3 4 "mentally" to local base remote merge windows based
on that order.

* dw/mergetool-vim-window-shuffle:
  mergetool: reorder vim/gvim buffers in three-way diffs

8 years agoMerge branch 'ah/stripspace-optstring' into maint
Junio C Hamano [Mon, 22 Feb 2016 21:10:19 +0000 (13:10 -0800)] 
Merge branch 'ah/stripspace-optstring' into maint

* ah/stripspace-optstring:
  stripspace: call U+0020 a "space" instead of a "blank"

8 years agoMerge branch 'ks/svn-pathnameencoding-4' of git://git.bogomips.org/git-svn
Junio C Hamano [Mon, 22 Feb 2016 18:29:46 +0000 (10:29 -0800)] 
Merge branch 'ks/svn-pathnameencoding-4' of git://git.bogomips.org/git-svn

* 'ks/svn-pathnameencoding-4' of git://git.bogomips.org/git-svn:
  git-svn: apply "svn.pathnameencoding" before URL encoding
  git-svn: enable "svn.pathnameencoding" on dcommit
  git-svn: hoist out utf8 prep from t9129 to lib-git-svn

8 years agoMerge branch 'pw/completion-stash'
Junio C Hamano [Mon, 22 Feb 2016 18:27:24 +0000 (10:27 -0800)] 
Merge branch 'pw/completion-stash'

* pw/completion-stash:
  completion: fix mis-indentation in _git_stash()

8 years agocompletion: fix mis-indentation in _git_stash()
SZEDER Gábor [Mon, 22 Feb 2016 13:02:50 +0000 (14:02 +0100)] 
completion: fix mis-indentation in _git_stash()

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-svn: apply "svn.pathnameencoding" before URL encoding
Kazutoshi Satoda [Mon, 8 Feb 2016 15:21:02 +0000 (00:21 +0900)] 
git-svn: apply "svn.pathnameencoding" before URL encoding

The conversion from "svn.pathnameencoding" to UTF-8 should be applied
first, and then URL encoding should be applied on the resulting UTF-8
path. The reversed order of these transforms (used before this fix)
makes non-UTF-8 URL which causes error from Subversion such as
"Filesystem has no item: '...' path not found" when sending a rename (or
a copy) from non-ASCII path.

[ew: t9115 test case added (requires SVN_HTTPD_PORT set to test),
 squash LC_ALL=$a_utf8_locale export from Kazutoshi for Cygwin]

Signed-off-by: Kazutoshi SATODA <k_satoda@f2.dion.ne.jp>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
8 years agogit-svn: enable "svn.pathnameencoding" on dcommit
Kazutoshi Satoda [Mon, 8 Feb 2016 15:20:31 +0000 (00:20 +0900)] 
git-svn: enable "svn.pathnameencoding" on dcommit

Without the initialization of $self->{pathnameencoding}, conversion in
repo_path() is always skipped as $self->{pathnameencoding} is undefined
even if "svn.pathnameencoding" is configured.

The lack of conversion results in mysterious failure of dcommit (e.g.
"Malformed XML") which happen only when a commit involves a change on
non-ASCII path.

[ew: add test case to t9115,
 squash LC_ALL=$a_utf8_locale export from Kazutoshi for Cygwin]

Signed-off-by: Kazutoshi SATODA <k_satoda@f2.dion.ne.jp>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
8 years agogit-svn: hoist out utf8 prep from t9129 to lib-git-svn
Eric Wong [Mon, 22 Feb 2016 02:17:51 +0000 (02:17 +0000)] 
git-svn: hoist out utf8 prep from t9129 to lib-git-svn

We will be reusing this in t9115.

Suggested-by: Kazutoshi Satoda <k_satoda@f2.dion.ne.jp>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
8 years agoMerge branch 'maint'
Junio C Hamano [Wed, 17 Feb 2016 18:14:39 +0000 (10:14 -0800)] 
Merge branch 'maint'

* maint:
  Start preparing for 2.7.2
  git-cvsserver.perl: fix typo

8 years agoSeventh batch for the 2.8 cycle
Junio C Hamano [Wed, 17 Feb 2016 18:13:57 +0000 (10:13 -0800)] 
Seventh batch for the 2.8 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'dw/mergetool-vim-window-shuffle'
Junio C Hamano [Wed, 17 Feb 2016 18:13:34 +0000 (10:13 -0800)] 
Merge branch 'dw/mergetool-vim-window-shuffle'

The vimdiff backend for "git mergetool" has been tweaked to arrange
and number buffers in the order that would match the expectation of
majority of people who read left to right, then top down and assign
buffers 1 2 3 4 "mentally" to local base remote merge windows based
on that order.

* dw/mergetool-vim-window-shuffle:
  mergetool: reorder vim/gvim buffers in three-way diffs

8 years agoMerge branch 'ah/stripspace-optstring'
Junio C Hamano [Wed, 17 Feb 2016 18:13:33 +0000 (10:13 -0800)] 
Merge branch 'ah/stripspace-optstring'

* ah/stripspace-optstring:
  stripspace: call U+0020 a "space" instead of a "blank"

8 years agoMerge branch 'mm/clean-doc-fix'
Junio C Hamano [Wed, 17 Feb 2016 18:13:33 +0000 (10:13 -0800)] 
Merge branch 'mm/clean-doc-fix'

The documentation for "git clean" has been corrected; it mentioned
that .git/modules/* are removed by giving two "-f", which has never
been the case.

* mm/clean-doc-fix:
  Documentation/git-clean.txt: don't mention deletion of .git/modules/*

8 years agoMerge branch 'jk/rerere-xsnprintf'
Junio C Hamano [Wed, 17 Feb 2016 18:13:33 +0000 (10:13 -0800)] 
Merge branch 'jk/rerere-xsnprintf'

Some calls to strcpy(3) triggers a false warning from static
analysers that are less intelligent than humans, and reducing the
number of these false hits helps us notice real issues.  A few
calls to strcpy(3) in "git rerere" that are already safe has been
rewritten to avoid false wanings.

* jk/rerere-xsnprintf:
  rerere: replace strcpy with xsnprintf

8 years agoMerge branch 'jk/test-path-utils-xsnprintf'
Junio C Hamano [Wed, 17 Feb 2016 18:13:32 +0000 (10:13 -0800)] 
Merge branch 'jk/test-path-utils-xsnprintf'

Some calls to strcpy(3) triggers a false warning from static
analysers that are less intelligent than humans, and reducing the
number of these false hits helps us notice real issues.  A few
calls to strcpy(3) in test-path-utils that are already safe has
been rewritten to avoid false wanings.

* jk/test-path-utils-xsnprintf:
  test-path-utils: use xsnprintf in favor of strcpy

8 years agoMerge branch 'da/user-useconfigonly'
Junio C Hamano [Wed, 17 Feb 2016 18:13:31 +0000 (10:13 -0800)] 
Merge branch 'da/user-useconfigonly'

The "user.useConfigOnly" configuration variable can be used to
force the user to always set user.email & user.name configuration
variables, serving as a reminder for those who work on multiple
projects and do not want to put these in their $HOME/.gitconfig.

* da/user-useconfigonly:
  ident: add user.useConfigOnly boolean for when ident shouldn't be guessed
  fmt_ident: refactor strictness checks

8 years agoMerge branch 'nd/clear-gitenv-upon-use-of-alias'
Junio C Hamano [Wed, 17 Feb 2016 18:13:31 +0000 (10:13 -0800)] 
Merge branch 'nd/clear-gitenv-upon-use-of-alias'

The automatic typo correction applied to an alias was broken
with a recent change already in 'master'.

* nd/clear-gitenv-upon-use-of-alias:
  restore_env(): free the saved environment variable once we are done
  git: simplify environment save/restore logic
  git: protect against unbalanced calls to {save,restore}_env()
  git: remove an early return from save_env_before_alias()

8 years agoMerge branch 'mg/mingw-test-fix'
Junio C Hamano [Wed, 17 Feb 2016 18:13:29 +0000 (10:13 -0800)] 
Merge branch 'mg/mingw-test-fix'

An earlier adjustment of test mistakenly used write_script
to prepare a file whose exact content matters for the test;
reverting that part fixes the breakage for those who use
SHELL_PATH that is different from /bin/sh.

* mg/mingw-test-fix:
  t9100: fix breakage when SHELL_PATH is not /bin/sh

8 years agoMerge branch 'js/mingw-tests'
Junio C Hamano [Wed, 17 Feb 2016 18:13:28 +0000 (10:13 -0800)] 
Merge branch 'js/mingw-tests'

Test scripts have been updated to remove assumptions that are not
portable between Git for POSIX and Git for Windows, or to skip ones
with expectations that are not satisfiable on Git for Windows.

* js/mingw-tests: (21 commits)
  gitignore: ignore generated test-fake-ssh executable
  mingw: do not bother to test funny file names
  mingw: skip a test in t9130 that cannot pass on Windows
  mingw: handle the missing POSIXPERM prereq in t9124
  mingw: avoid illegal filename in t9118
  mingw: mark t9100's test cases with appropriate prereqs
  t0008: avoid absolute path
  mingw: work around pwd issues in the tests
  mingw: fix t9700's assumption about directory separators
  mingw: skip test in t1508 that fails due to path conversion
  tests: turn off git-daemon tests if FIFOs are not available
  mingw: disable mkfifo-based tests
  mingw: accomodate t0060-path-utils for MSYS2
  mingw: fix t5601-clone.sh
  mingw: let lstat() fail with errno == ENOTDIR when appropriate
  mingw: try to delete target directory before renaming
  mingw: prepare the TMPDIR environment variable for shell scripts
  mingw: factor out Windows specific environment setup
  Git.pm: stop assuming that absolute paths start with a slash
  mingw: do not trust MSYS2's MinGW gettext.sh
  ...

8 years agoMerge branch 'jk/drop-rsync-transport'
Junio C Hamano [Wed, 17 Feb 2016 18:13:28 +0000 (10:13 -0800)] 
Merge branch 'jk/drop-rsync-transport'

It turns out "git clone" over rsync transport has been broken when
the source repository has packed references for a long time, and
nobody noticed nor complained about it.

* jk/drop-rsync-transport:
  transport: drop support for git-over-rsync

8 years agoStart preparing for 2.7.2
Junio C Hamano [Wed, 17 Feb 2016 18:05:44 +0000 (10:05 -0800)] 
Start preparing for 2.7.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'js/test-lib-windows-emulated-yes' into maint
Junio C Hamano [Wed, 17 Feb 2016 18:03:41 +0000 (10:03 -0800)] 
Merge branch 'js/test-lib-windows-emulated-yes' into maint

The emulated "yes" command used in our test scripts has been
tweaked not to spend too much time generating unnecessary output
that is not used, to help those who test on Windows where it would
not stop until it fills the pipe buffer due to lack of SIGPIPE.

* js/test-lib-windows-emulated-yes:
  test-lib: limit the output of the yes utility

8 years agoMerge branch 'aw/push-force-with-lease-reporting' into maint
Junio C Hamano [Wed, 17 Feb 2016 18:03:40 +0000 (10:03 -0800)] 
Merge branch 'aw/push-force-with-lease-reporting' into maint

"git push --force-with-lease" has been taught to report if the push
needed to force (or fast-forwarded).

* aw/push-force-with-lease-reporting:
  push: fix ref status reporting for --force-with-lease

8 years agoMerge branch 'nd/do-not-move-worktree-manually' into maint
Junio C Hamano [Wed, 17 Feb 2016 18:03:40 +0000 (10:03 -0800)] 
Merge branch 'nd/do-not-move-worktree-manually' into maint

"git worktree" had a broken code that attempted to auto-fix
possible inconsistency that results from end-users moving a
worktree to different places without telling Git (the original
repository needs to maintain backpointers to its worktrees, but
"mv" run by end-users who are not familiar with that fact will
obviously not adjust them), which actually made things worse
when triggered.

* nd/do-not-move-worktree-manually:
  worktree: stop supporting moving worktrees manually
  worktree.c: fix indentation

8 years agoMerge branch 'js/xmerge-marker-eol' into maint
Junio C Hamano [Wed, 17 Feb 2016 18:03:39 +0000 (10:03 -0800)] 
Merge branch 'js/xmerge-marker-eol' into maint

The low-level merge machinery has been taught to use CRLF line
termination when inserting conflict markers to merged contents that
are themselves CRLF line-terminated.

* js/xmerge-marker-eol:
  merge-file: ensure that conflict sections match eol style
  merge-file: let conflict markers match end-of-line style of the context

8 years agogit-cvsserver.perl: fix typo
GyuYong Jung [Wed, 17 Feb 2016 02:14:58 +0000 (11:14 +0900)] 
git-cvsserver.perl: fix typo

Signed-off-by: GyuYong Jung <obliviscence@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5505: 'remote add x y' should work when url.y.insteadOf = x
Johannes Schindelin [Wed, 17 Feb 2016 16:20:47 +0000 (17:20 +0100)] 
t5505: 'remote add x y' should work when url.y.insteadOf = x

This is the test missing from fb86e32 (git remote: allow adding
remotes agreeing with url.<...>.insteadOf, 2014-12-23): we should
allow adding a remote with the URL when it agrees with the
url.<...>.insteadOf setting.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam -i: fix "v"iew
Junio C Hamano [Tue, 16 Feb 2016 22:46:39 +0000 (14:46 -0800)] 
am -i: fix "v"iew

The 'v'iew subcommand of the interactive mode of "git am -i" was
broken by the rewrite to C we did at around 2.6.0 timeframe at
7ff26832 (builtin-am: implement -i/--interactive, 2015-08-04); we
used to spawn the pager via the shell, accepting things like

PAGER='less -S'

in the environment, but the rewrite forgot and tried to directly
spawn a command whose name is the entire string.

The previous refactoring of the new helper function makes it easier
for us to do the right thing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agopager: factor out a helper to prepare a child process to run the pager
Junio C Hamano [Tue, 16 Feb 2016 22:34:44 +0000 (14:34 -0800)] 
pager: factor out a helper to prepare a child process to run the pager

When running a pager, we need to run the program git_pager() gave
us, but we need to make sure we spawn it via the shell (i.e. it is
valid to say PAGER='less -S', for example) and give default values
to $LESS and $LV environment variables.  Factor out these details
to a separate helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agopager: lose a separate argv[]
Junio C Hamano [Tue, 16 Feb 2016 22:26:40 +0000 (14:26 -0800)] 
pager: lose a separate argv[]

These days, using the embedded args array in the child_process
structure is the norm.  Follow that practice.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agohttp: implement public key pinning
Christoph Egger [Mon, 15 Feb 2016 14:04:22 +0000 (15:04 +0100)] 
http: implement public key pinning

Add the http.pinnedpubkey configuration option for public key
pinning. It allows any string supported by libcurl --
base64(sha256(pubkey)) or filename of the full public key.

If cURL does not support pinning (is too old) output a warning to the
user.

Signed-off-by: Christoph Egger <christoph@christoph-egger.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoworktree add -B: do the checkout test before update branch
Nguyễn Thái Ngọc Duy [Mon, 15 Feb 2016 13:35:33 +0000 (20:35 +0700)] 
worktree add -B: do the checkout test before update branch

If --force is not given but -B is, we should not proceed if the given
branch is already checked out elsewhere. add_worktree() has this test,
but it kicks in too late when "git branch --force" is already
executed. As a result, even though we correctly refuse to create a new
worktree, we have already updated the branch and mess up the other
checkout.

Repeat the die_if_checked_out() test again for this specific case before
"git branch" runs.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoworktree: fix "add -B"
Nguyễn Thái Ngọc Duy [Mon, 15 Feb 2016 13:35:32 +0000 (20:35 +0700)] 
worktree: fix "add -B"

Current code does not update "symref" when -B is used. This string
contains the new HEAD. Because it's empty "git worktree add -B" fails at
symbolic-ref step.

Because branch creation is already done before calling add_worktree(),
-B is equivalent to -b from add_worktree() point of view. We do not need
the special case for -B.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodir.c: don't exclude whole dir prematurely
Nguyễn Thái Ngọc Duy [Mon, 15 Feb 2016 09:03:39 +0000 (16:03 +0700)] 
dir.c: don't exclude whole dir prematurely

If there is a pattern "!foo/bar", this patch makes it not exclude
"foo" right away. This gives us a chance to examine "foo" and
re-include "foo/bar".

Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Helped-by: Micha Wiedenmann <mw-u2@gmx.de>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodir.c: support marking some patterns already matched
Nguyễn Thái Ngọc Duy [Mon, 15 Feb 2016 09:03:38 +0000 (16:03 +0700)] 
dir.c: support marking some patterns already matched

Given path "a" and the pattern "a", it's matched. But if we throw path
"a/b" to pattern "a", the code fails to realize that if "a" matches
"a" then "a/b" should also be matched.

When the pattern is matched the first time, we can mark it "sticky", so
that all files and dirs inside the matched path also matches. This is a
simpler solution than modify all match scenarios to fix that.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodir.c: support tracing exclude
Nguyễn Thái Ngọc Duy [Mon, 15 Feb 2016 09:03:37 +0000 (16:03 +0700)] 
dir.c: support tracing exclude

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodir.c: fix match_pathname()
Nguyễn Thái Ngọc Duy [Mon, 15 Feb 2016 09:03:36 +0000 (16:03 +0700)] 
dir.c: fix match_pathname()

Given the pattern "1/2/3/4" and the path "1/2/3/4/f", the pattern
prefix is "1/2/3/4". We will compare and remove the prefix from both
pattern and path and come to this code

/*
 * If the whole pattern did not have a wildcard,
 * then our prefix match is all we need; we
 * do not need to call fnmatch at all.
 */
if (!patternlen && !namelen)
return 1;

where patternlen is zero (full pattern consumed) and the remaining
path in "name" is "/f". We fail to realize it's matched in this case
and fall back to fnmatch(), which also fails to catch it. Fix it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agohttp: add option to try authentication without username
brian m. carlson [Mon, 15 Feb 2016 18:44:46 +0000 (18:44 +0000)] 
http: add option to try authentication without username

Performing GSS-Negotiate authentication using Kerberos does not require
specifying a username or password, since that information is already
included in the ticket itself.  However, libcurl refuses to perform
authentication if it has not been provided with a username and password.
Add an option, http.emptyAuth, that provides libcurl with an empty
username and password to make it attempt authentication anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoremote-curl: include curl_errorstr on SSL setup failures
Shawn Pearce [Sun, 14 Feb 2016 01:39:34 +0000 (17:39 -0800)] 
remote-curl: include curl_errorstr on SSL setup failures

For curl error 35 (CURLE_SSL_CONNECT_ERROR) users need the
additional text stored in CURLOPT_ERRORBUFFER to debug why
the connection did not start. This is curl_errorstr inside
of http.c, so include that in the message if it is non-empty.

Sometimes HTTP response codes aren't yet available, such as
when the SSL setup fails. Don't include HTTP 0 in the message.

Signed-off-by: Shawn Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5570: add tests for "git {clone,fetch,pull} -v"
Eric Wong [Sun, 14 Feb 2016 09:26:29 +0000 (09:26 +0000)] 
t5570: add tests for "git {clone,fetch,pull} -v"

Now that git_connect is more information about connectivity
progress after: ("pass transport verbosity down to git_connect")
we should ensure it remains so for future users who need to
to diagnose networking problems.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-config: better document default behavior for `--include`
Jeff King [Mon, 19 Jan 2015 19:58:47 +0000 (14:58 -0500)] 
git-config: better document default behavior for `--include`

As described in the commit message of 9b25a0b (config: add
include directive, 2012-02-06), the `--include` option is
only on by default in some cases. But our documentation
described it as just "defaults to on", which doesn't tell
the whole story.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorev-parse: take prefix into account in --git-common-dir
Nguyễn Thái Ngọc Duy [Fri, 12 Feb 2016 04:31:45 +0000 (11:31 +0700)] 
rev-parse: take prefix into account in --git-common-dir

Most of the time, get_git_common_dir() returns an absolute path so
prefix is irrelevant. If it returns a relative path (e.g. from the
main worktree) then prefixing is required.

Noticed-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agolist-objects: pass full pathname to callbacks
Jeff King [Thu, 11 Feb 2016 22:28:36 +0000 (17:28 -0500)] 
list-objects: pass full pathname to callbacks

When we find a blob at "a/b/c", we currently pass this to
our show_object_fn callbacks as two components: "a/b/" and
"c". Callbacks which want the full value then call
path_name(), which concatenates the two. But this is an
inefficient interface; the path is a strbuf, and we could
simply append "c" to it temporarily, then roll back the
length, without creating a new copy.

So we could improve this by teaching the callsites of
path_name() this trick (and there are only 3). But we can
also notice that no callback actually cares about the
broken-down representation, and simply pass each callback
the full path "a/b/c" as a string. The callback code becomes
even simpler, then, as we do not have to worry about freeing
an allocated buffer, nor rolling back our modification to
the strbuf.

This is theoretically less efficient, as some callbacks
would not bother to format the final path component. But in
practice this is not measurable. Since we use the same
strbuf over and over, our work to grow it is amortized, and
we really only pay to memcpy a few bytes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agolist-objects: drop name_path entirely
Jeff King [Thu, 11 Feb 2016 22:26:44 +0000 (17:26 -0500)] 
list-objects: drop name_path entirely

In the previous commit, we left name_path as a thin wrapper
around a strbuf. This patch drops it entirely. As a result,
every show_object_fn callback needs to be adjusted. However,
none of their code needs to be changed at all, because the
only use was to pass it to path_name(), which now handles
the bare strbuf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agolist-objects: convert name_path to a strbuf
Jeff King [Thu, 11 Feb 2016 22:26:18 +0000 (17:26 -0500)] 
list-objects: convert name_path to a strbuf

The "struct name_path" data is examined in only two places:
we generate it in process_tree(), and we convert it to a
single string in path_name(). Everyone else just passes it
through to those functions.

We can further note that process_tree() already keeps a
single strbuf with the leading tree path, for use with
tree_entry_interesting().

Instead of building a separate name_path linked list, let's
just use the one we already build in "base". This reduces
the amount of code (especially tricky code in path_name()
which did not check for integer overflows caused by deep
or large pathnames).

It is also more efficient in some instances.  Any time we
were using tree_entry_interesting, we were building up the
strbuf anyway, so this is an immediate and obvious win
there. In cases where we were not, we trade off storing
"pathname/" in a strbuf on the heap for each level of the
path, instead of two pointers and an int on the stack (with
one pointer into the tree object). On a 64-bit system, the
latter is 20 bytes; so if path components are less than that
on average, this has lower peak memory usage.  In practice
it probably doesn't matter either way; we are already
holding in memory all of the tree objects leading up to each
pathname, and for normal-depth pathnames, we are only
talking about hundreds of bytes.

This patch leaves "struct name_path" as a thin wrapper
around the strbuf, to avoid disrupting callbacks. We should
fix them, but leaving it out makes this diff easier to view.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoshow_object_with_name: simplify by using path_name()
Jeff King [Thu, 11 Feb 2016 22:24:18 +0000 (17:24 -0500)] 
show_object_with_name: simplify by using path_name()

When "git rev-list" shows an object with its associated path
name, it does so by walking the name_path linked list and
printing each component (stopping at any embedded NULs or
newlines).

We'd like to eventually get rid of name_path entirely in
favor of a single buffer, and dropping this custom printing
code is part of that. As a first step, let's use path_name()
to format the list into a single buffer, and print that.
This is strictly less efficient than the original, but it's
a temporary step in the refactoring; our end game will be to
get the fully formatted name in the first place.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agohttp-push: stop using name_path
Jeff King [Thu, 11 Feb 2016 22:23:48 +0000 (17:23 -0500)] 
http-push: stop using name_path

The graph traversal code here passes along a name_path to
build up the pathname at which we find each blob. But we
never actually do anything with the resulting names, making
it a waste of code and memory.

This usage came in aa1dbc9 (Update http-push functionality,
2006-03-07), and originally the result was passed to
"add_object" (which stored it, but didn't really use it,
either). But we stopped using that function in 1f1e895 (Add
"named object array" concept, 2006-06-19) in favor of
storing just the objects themselves.

Moreover, the generation of the name in process_tree() is
buggy. It sticks "name" onto the end of the name_path linked
list, and then passes it down again as it recurses (instead
of "entry.path"). So it's a good thing this was unused, as
the resulting path for "a/b/c/d" would end up as "a/a/a/a".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoconnect & http: support -4 and -6 switches for remote operations
Eric Wong [Wed, 3 Feb 2016 04:09:14 +0000 (04:09 +0000)] 
connect & http: support -4 and -6 switches for remote operations

Sometimes it is necessary to force IPv4-only or IPv6-only operation
on networks where name lookups may return a non-routable address and
stall remote operations.

The ssh(1) command has an equivalent switches which we may pass when
we run them.  There may be old ssh(1) implementations out there
which do not support these switches; they should report the
appropriate error in that case.

rsync support is untouched for now since it is deprecated and
scheduled to be removed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Reviewed-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agomergetool: reorder vim/gvim buffers in three-way diffs
Dickson Wong [Fri, 29 Jan 2016 02:18:14 +0000 (18:18 -0800)] 
mergetool: reorder vim/gvim buffers in three-way diffs

When invoking default (g)vimdiff three-way merge, the merged file is
loaded as the first buffer but moved to the bottom as the fourth window.
This causes a disconnect between vim commands that operate on window
positions (e.g. CTRL-W_w) and those that operate on buffer index (e.g.
do/dp).

This change reorders the buffers to have the same index as windows while
keeping the cursor default to the merged result as the bottom window.

Signed-off-by: Dickson Wong <dicksonwong@gmail.com>
Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoSixth batch for the 2.8 cycle
Junio C Hamano [Wed, 10 Feb 2016 22:24:14 +0000 (14:24 -0800)] 
Sixth batch for the 2.8 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'js/test-lib-windows-emulated-yes'
Junio C Hamano [Wed, 10 Feb 2016 22:20:10 +0000 (14:20 -0800)] 
Merge branch 'js/test-lib-windows-emulated-yes'

The emulated "yes" command used in our test scripts has been
tweaked not to spend too much time generating unnecessary output
that is not used, to help those who test on Windows where it would
not stop until it fills the pipe buffer due to lack of SIGPIPE.

* js/test-lib-windows-emulated-yes:
  test-lib: limit the output of the yes utility

8 years agoMerge branch 'wp/sha1-name-negative-match'
Junio C Hamano [Wed, 10 Feb 2016 22:20:10 +0000 (14:20 -0800)] 
Merge branch 'wp/sha1-name-negative-match'

A new "<branch>^{/!-<pattern>}" notation can be used to name a
commit that is reachable from <branch> that does not match the
given <pattern>.

* wp/sha1-name-negative-match:
  object name: introduce '^{/!-<negative pattern>}' notation
  test for '!' handling in rev-parse's named commits

8 years agoMerge branch 'jk/options-cleanup'
Junio C Hamano [Wed, 10 Feb 2016 22:20:08 +0000 (14:20 -0800)] 
Merge branch 'jk/options-cleanup'

Various clean-ups to the command line option parsing.

* jk/options-cleanup:
  apply, ls-files: simplify "-z" parsing
  checkout-index: disallow "--no-stage" option
  checkout-index: handle "--no-index" option
  checkout-index: handle "--no-prefix" option
  checkout-index: simplify "-z" option parsing
  give "nbuf" strbuf a more meaningful name

8 years agoMerge branch 'aw/push-force-with-lease-reporting'
Junio C Hamano [Wed, 10 Feb 2016 22:20:08 +0000 (14:20 -0800)] 
Merge branch 'aw/push-force-with-lease-reporting'

"git push --force-with-lease" has been taught to report if the push
needed to force (or fast-forwarded).

* aw/push-force-with-lease-reporting:
  push: fix ref status reporting for --force-with-lease

8 years agoMerge branch 'ls/clean-smudge-override-in-config'
Junio C Hamano [Wed, 10 Feb 2016 22:20:07 +0000 (14:20 -0800)] 
Merge branch 'ls/clean-smudge-override-in-config'

Clean/smudge filters defined in a configuration file of lower
precedence can now be overridden to be a pass-through no-op by
setting the variable to an empty string.

* ls/clean-smudge-override-in-config:
  convert: treat an empty string for clean/smudge filters as "cat"

8 years agoMerge branch 'ew/connect-verbose'
Junio C Hamano [Wed, 10 Feb 2016 22:20:07 +0000 (14:20 -0800)] 
Merge branch 'ew/connect-verbose'

There were a few "now I am doing this thing" progress messages in
the TCP connection code that can be triggered by setting a verbose
option internally in the code, but "git fetch -v" and friends never
passed the verbose option down to that codepath.

There was a brief discussion about the impact on the end-user
experience by not limiting this to "fetch -v -v", but I think the
conclusion is that this is OK to enable with a single "-v" as it is
not too noisy.

* ew/connect-verbose:
  pass transport verbosity down to git_connect

8 years agoMerge branch 'cc/untracked'
Junio C Hamano [Wed, 10 Feb 2016 22:20:06 +0000 (14:20 -0800)] 
Merge branch 'cc/untracked'

Update the untracked cache subsystem and change its primary UI from
"git update-index" to "git config".

* cc/untracked:
  t7063: add tests for core.untrackedCache
  test-dump-untracked-cache: don't modify the untracked cache
  config: add core.untrackedCache
  dir: simplify untracked cache "ident" field
  dir: add remove_untracked_cache()
  dir: add {new,add}_untracked_cache()
  update-index: move 'uc' var declaration
  update-index: add untracked cache notifications
  update-index: add --test-untracked-cache
  update-index: use enum for untracked cache options
  dir: free untracked cache when removing it

8 years agoMerge branch 'js/xmerge-marker-eol'
Junio C Hamano [Wed, 10 Feb 2016 22:20:06 +0000 (14:20 -0800)] 
Merge branch 'js/xmerge-marker-eol'

The low-level merge machinery has been taught to use CRLF line
termination when inserting conflict markers to merged contents that
are themselves CRLF line-terminated.

* js/xmerge-marker-eol:
  merge-file: ensure that conflict sections match eol style
  merge-file: let conflict markers match end-of-line style of the context

8 years agoMerge branch 'nd/do-not-move-worktree-manually'
Junio C Hamano [Wed, 10 Feb 2016 22:20:05 +0000 (14:20 -0800)] 
Merge branch 'nd/do-not-move-worktree-manually'

"git worktree" had a broken code that attempted to auto-fix
possible inconsistency that results from end-users moving a
worktree to different places without telling Git (the original
repository needs to maintain backpointers to its worktrees, but
"mv" run by end-users who are not familiar with that fact will
obviously not adjust them), which actually made things worse
when triggered.

* nd/do-not-move-worktree-manually:
  worktree: stop supporting moving worktrees manually
  worktree.c: fix indentation

8 years agoget_sha1: don't die() on bogus search strings
Jeff King [Wed, 10 Feb 2016 21:19:25 +0000 (16:19 -0500)] 
get_sha1: don't die() on bogus search strings

The get_sha1() function generally returns an error code
rather than dying, and we sometimes speculatively call it
with something that may be a revision or a pathspec, in
order to see which one it might be.

If it sees a bogus ":/" search string, though, it complains,
without giving the caller the opportunity to recover. We can
demonstrate this in t6133 by looking for ":/*.t", which
should mean "*.t at the root of the tree", but instead dies
because of the invalid regex (the "*" has nothing to operate
on).

We can fix this by returning an error rather than calling
die(). Unfortunately, the tradeoff is that the error message
is slightly worse in cases where we _do_ know we have a rev.
E.g., running "git log ':/*.t' --" before yielded:

  fatal: Invalid search pattern: *.t

and now we get only:

  fatal: bad revision ':/*.t'

There's not a simple way to fix this short of passing a
"quiet" flag all the way through the get_sha1() stack.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocheck_filename: tighten dwim-wildcard ambiguity
Jeff King [Wed, 10 Feb 2016 21:14:46 +0000 (16:14 -0500)] 
check_filename: tighten dwim-wildcard ambiguity

When specifying both revisions and pathnames, we allow
"<rev> -- <pathspec>" to be spelled without the "--" as long
as it is not ambiguous. The original logic was something
like:

  1. Resolve each item with get_sha1(). If successful,
     we know it can be a <rev>. Verify that it _isn't_ a
     filename, using verify_non_filename(), and complain of
     ambiguity otherwise.

  2. If get_sha1() didn't succeed, make sure that it _is_
     a file, using verify_filename(). If not, complain
     that it is neither a <rev> nor a <pathspec>.

Both verify_filename() and verify_non_filename() rely on
check_filename(), which definitely said "yes, this is a
file" or "no, it is not" using lstat().

Commit 28fcc0b (pathspec: avoid the need of "--" when
wildcard is used, 2015-05-02) introduced a convenience
feature: check_filename() will consider anything with
wildcard meta-characters as a possible filename, without
even checking the filesystem.

This works well for case 2. For such a wildcard, we would
previously have died and said "it is neither". Post-28fcc0b,
we assume it's a pathspec and proceed.

But it makes some instances of case 1 worse. We may have an
extended sha1 expression that contains meta-characters
(e.g., "HEAD^{/foo.*bar}"), and we now complain that it's
also a filename, due to the wildcard characters (even though
that wildcard would not match anything in the filesystem).

One solution would be to actually expand the pathname and
see if it matches anything on the filesystem. But that's
potentially expensive, and we do not have to be so rigorous
for this DWIM magic (if you want rigor, use "--").

Instead, we can just use different rules for cases 1 and 2.
When we know something is a rev, we will complain only if it
meets a much higher standard for "this is also a file";
namely that it actually exists in the filesystem. Case 2
remains the same: we use the looser "it could be a filename"
standard introduced by 28fcc0b.

We can accomplish this by pulling the wildcard logic out of
check_filename() and putting it into verify_filename(). Its
partner verify_non_filename() does not need a change, since
check_filename() goes back to implementing the "higher
standard".

Besides these two callers of check_filename(), there is one
other: git-checkout does a similar DWIM itself. It hits this
code path only after get_sha1() has returned failure, making
it case 2, which gets the special wildcard treatment.

Note that we drop the tests in t2019 in favor of a more
complete set in t6133. t2019 was not the right place for
them (it's about refname ambiguity, not dwim parsing
ambiguity), and the second test explicitly checked for the
opposite result of the case we are fixing here (which didn't
really make any sense; as shown by the test_must_fail in the
test, it would only serve to annoy people).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocheckout: reorder check_filename conditional
Jeff King [Wed, 10 Feb 2016 21:12:34 +0000 (16:12 -0500)] 
checkout: reorder check_filename conditional

If we have a "--" flag, we should not be doing DWIM magic
based on whether arguments can be filenames. Reorder the
conditional to avoid the check_filename() call entirely in
this case. The outcome is the same, but the short-circuit
makes the dependency more clear.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/git-clean.txt: don't mention deletion of .git/modules/*
Matt McCutchen [Sat, 6 Feb 2016 20:25:41 +0000 (15:25 -0500)] 
Documentation/git-clean.txt: don't mention deletion of .git/modules/*

The latter half of this sentence, the removal of the submodules, was
never done with (or without) double -f back when it was written, and
we still do not do so.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorerere: replace strcpy with xsnprintf
Jeff King [Mon, 8 Feb 2016 22:25:01 +0000 (17:25 -0500)] 
rerere: replace strcpy with xsnprintf

This shouldn't overflow, as we are copying a sha1 hex into a
41-byte buffer. But it does not hurt to use a bound-checking
function, which protects us and makes auditing for overflows
easier.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot9100: fix breakage when SHELL_PATH is not /bin/sh
Michael J Gruber [Sun, 7 Feb 2016 19:11:37 +0000 (20:11 +0100)] 
t9100: fix breakage when SHELL_PATH is not /bin/sh

bcb11f1 (mingw: mark t9100's test cases with appropriate prereqs, 2016-01-27)
replaced "/bin/sh" in exec.sh by the shell specified in SHELL_PATH, but
that breaks the subtest which checks for a specific checksum of a tree
containing.

Revert that change that was not explained in the commit message anyways
(exec.sh is never executed).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotest-path-utils: use xsnprintf in favor of strcpy
Jeff King [Mon, 8 Feb 2016 22:21:55 +0000 (17:21 -0500)] 
test-path-utils: use xsnprintf in favor of strcpy

This strcpy will never overflow because it's copying from
baked-in test data. But we would prefer to avoid strcpy
entirely, as it makes it harder to audit for real security
bugs.

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