]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
8 years agoMerge branch 'nf/mergetool-prompt' into HEAD
Junio C Hamano [Wed, 18 May 2016 21:40:07 +0000 (14:40 -0700)] 
Merge branch 'nf/mergetool-prompt' into HEAD

UI consistency improvements.

* nf/mergetool-prompt:
  difftool/mergetool: make the form of yes/no questions consistent

8 years agoMerge branch 'jd/send-email-to-whom' into HEAD
Junio C Hamano [Wed, 18 May 2016 21:40:07 +0000 (14:40 -0700)] 
Merge branch 'jd/send-email-to-whom' into HEAD

A question by "git send-email" to ask the identity of the sender
has been updated.

* jd/send-email-to-whom:
  send-email: fix grammo in the prompt that asks e-mail recipients

8 years agoMerge branch 'js/win32-mmap' into HEAD
Junio C Hamano [Wed, 18 May 2016 21:40:06 +0000 (14:40 -0700)] 
Merge branch 'js/win32-mmap' into HEAD

mmap emulation on Windows has been optimized and work better without
consuming paging store when not needed.

* js/win32-mmap:
  mmap(win32): avoid expensive fstat() call
  mmap(win32): avoid copy-on-write when it is unnecessary
  win32mmap: set errno appropriately

8 years agoMerge branch 'jk/push-client-deadlock-fix' into HEAD
Junio C Hamano [Wed, 18 May 2016 21:40:06 +0000 (14:40 -0700)] 
Merge branch 'jk/push-client-deadlock-fix' into HEAD

Some Windows SDK lacks pthread_sigmask() implementation and fails
to compile the recently updated "git push" codepath that uses it.

* jk/push-client-deadlock-fix:
  Windows: only add a no-op pthread_sigmask() when needed
  Windows: add pthread_sigmask() that does nothing
  t5504: drop sigpipe=ok from push tests
  fetch-pack: isolate sigpipe in demuxer thread
  send-pack: isolate sigpipe in demuxer thread
  run-command: teach async threads to ignore SIGPIPE
  send-pack: close demux pipe before finishing async process

8 years agoMerge branch 'sb/mv-submodule-fix' into HEAD
Junio C Hamano [Wed, 18 May 2016 21:40:05 +0000 (14:40 -0700)] 
Merge branch 'sb/mv-submodule-fix' into HEAD

"git mv old new" did not adjust the path for a submodule that lives
as a subdirectory inside old/ directory correctly.

* sb/mv-submodule-fix:
  mv: allow moving nested submodules

8 years agoMerge branch 'da/user-useconfigonly' into HEAD
Junio C Hamano [Wed, 18 May 2016 21:40:05 +0000 (14:40 -0700)] 
Merge branch 'da/user-useconfigonly' into HEAD

The "user.useConfigOnly" configuration variable makes it an error
if users do not explicitly set user.name and user.email.  However,
its check was not done early enough and allowed another error to
trigger, reporting that the default value we guessed from the
system setting was unusable.  This was a suboptimal end-user
experience as we want the users to set user.name/user.email without
relying on the auto-detection at all.

* da/user-useconfigonly:
  ident: give "please tell me" message upon useConfigOnly error
  ident: check for useConfigOnly before auto-detection of name/email

8 years agoMerge branch 'ld/p4-test-py3' into HEAD
Junio C Hamano [Wed, 18 May 2016 21:40:04 +0000 (14:40 -0700)] 
Merge branch 'ld/p4-test-py3' into HEAD

The test scripts for "git p4" (but not "git p4" implementation
itself) has been updated so that they would work even on a system
where the installed version of Python is python 3.

* ld/p4-test-py3:
  git-p4 tests: time_in_seconds should use $PYTHON_PATH
  git-p4 tests: work with python3 as well as python2
  git-p4 tests: cd to / before running python

8 years agoWindows: only add a no-op pthread_sigmask() when needed
Johannes Schindelin [Wed, 11 May 2016 15:10:30 +0000 (17:10 +0200)] 
Windows: only add a no-op pthread_sigmask() when needed

In f924b52 (Windows: add pthread_sigmask() that does nothing,
2016-05-01), we introduced a no-op for Windows. However, this breaks
building Git in Git for Windows' SDK because pthread_sigmask() is
already a no-op there, #define'd in the pthread_signal.h header in
/mingw64/x86_64-w64-mingw32/include/.

Let's wrap the definition of pthread_sigmask() in a guard that skips
it when compiling with MinGW-w64' headers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoAlmost ready for 2.8.3
Junio C Hamano [Fri, 6 May 2016 21:53:36 +0000 (14:53 -0700)] 
Almost ready for 2.8.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'sb/submodule-path-misc-bugs' into maint
Junio C Hamano [Fri, 6 May 2016 21:53:24 +0000 (14:53 -0700)] 
Merge branch 'sb/submodule-path-misc-bugs' into maint

"git submodule" reports the paths of submodules the command
recurses into, but this was incorrect when the command was not run
from the root level of the superproject.

* sb/submodule-path-misc-bugs:
  t7407: make expectation as clear as possible
  submodule update: test recursive path reporting from subdirectory
  submodule update: align reporting path for custom command execution
  submodule status: correct path handling in recursive submodules
  submodule update --init: correct path handling in recursive submodules
  submodule foreach: correct path display in recursive submodules

8 years agoMerge branch 'ky/imap-send-openssl-1.1.0' into maint
Junio C Hamano [Fri, 6 May 2016 21:53:24 +0000 (14:53 -0700)] 
Merge branch 'ky/imap-send-openssl-1.1.0' into maint

Upcoming OpenSSL 1.1.0 will break compilation b updating a few APIs
we use in imap-send, which has been adjusted for the change.

* ky/imap-send-openssl-1.1.0:
  configure: remove checking for HMAC_CTX_cleanup
  imap-send: avoid deprecated TLSv1_method()
  imap-send: check NULL return of SSL_CTX_new()
  imap-send: use HMAC() function provided by OpenSSL

8 years agoMerge branch 'js/replace-edit-use-editor-configuration' into maint
Junio C Hamano [Fri, 6 May 2016 21:53:24 +0000 (14:53 -0700)] 
Merge branch 'js/replace-edit-use-editor-configuration' into maint

"git replace -e" did not honour "core.editor" configuration.

* js/replace-edit-use-editor-configuration:
  replace --edit: respect core.editor

8 years agoMerge branch 'cc/apply' into maint
Junio C Hamano [Fri, 6 May 2016 21:53:23 +0000 (14:53 -0700)] 
Merge branch 'cc/apply' into maint

Minor code clean-up.

* cc/apply:
  builtin/apply: free patch when parse_chunk() fails
  builtin/apply: handle parse_binary() failure
  apply: remove unused call to free() in gitdiff_{old,new}name()
  builtin/apply: get rid of useless 'name' variable

8 years agoMerge branch 'kn/for-each-tag-branch' into maint
Junio C Hamano [Fri, 6 May 2016 21:53:23 +0000 (14:53 -0700)] 
Merge branch 'kn/for-each-tag-branch' into maint

A minor documentation update.

* kn/for-each-tag-branch:
  for-each-ref: fix description of '--contains' in manpage

8 years agogit-multimail: update to release 1.3.0
Matthieu Moy [Tue, 3 May 2016 08:31:42 +0000 (10:31 +0200)] 
git-multimail: update to release 1.3.0

The changes are described in CHANGES.

Contributions-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Contributions-by: Stefan Tatschner <rumpelsepp@sevenbyte.org>
Contributions-by: Simon P <simon.git@le-huit.fr>
Contributions-by: Leander Hasty <leander@1stplayable.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoStart preparing for 2.8.3
Junio C Hamano [Mon, 2 May 2016 21:23:48 +0000 (14:23 -0700)] 
Start preparing for 2.8.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/use-write-script-more' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:14 +0000 (14:24 -0700)] 
Merge branch 'jk/use-write-script-more' into maint

Code clean-up.

* jk/use-write-script-more:
  t3404: use write_script
  t1020: do not overuse printf and use write_script
  t5532: use write_script

8 years agoMerge branch 'jc/xstrfmt-null-with-prec-0' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:14 +0000 (14:24 -0700)] 
Merge branch 'jc/xstrfmt-null-with-prec-0' into maint

Code cleanup.

* jc/xstrfmt-null-with-prec-0:
  setup.c: do not feed NULL to "%.*s" even with precision 0

8 years agoMerge branch 'ew/send-email-drop-data-dumper' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:13 +0000 (14:24 -0700)] 
Merge branch 'ew/send-email-drop-data-dumper' into maint

Code clean-up.

* ew/send-email-drop-data-dumper:
  send-email: do not load Data::Dumper

8 years agoMerge branch 'ad/cygwin-wants-rename' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:11 +0000 (14:24 -0700)] 
Merge branch 'ad/cygwin-wants-rename' into maint

On Cygwin, object creation uses the "create a temporary and then
rename it to the final name" pattern, not "create a temporary,
hardlink it to the final name and then unlink the temporary"
pattern.

This is necessary to use Git on Windows shared directories, and is
already enabled for the MinGW and plain Windows builds.  It also
has been used in Cygwin packaged versions of Git for quite a while.
See http://thread.gmane.org/gmane.comp.version-control.git/291853
($gmane/275680, $gmane/291853).

* ad/cygwin-wants-rename:
  config.mak.uname: Cygwin needs OBJECT_CREATION_USES_RENAMES

8 years agoMerge branch 'jk/do-not-printf-NULL' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:10 +0000 (14:24 -0700)] 
Merge branch 'jk/do-not-printf-NULL' into maint

"git config" had a codepath that tried to pass a NULL to
printf("%s"), which nobody seems to have noticed.

* jk/do-not-printf-NULL:
  git_config_set_multivar_in_file: handle "unset" errors
  git_config_set_multivar_in_file: all non-zero returns are errors
  config: lower-case first word of error strings

8 years agoMerge branch 'jc/http-socks5h' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:10 +0000 (14:24 -0700)] 
Merge branch 'jc/http-socks5h' into maint

The socks5:// proxy support added back in 2.6.4 days was not aware
that socks5h:// proxies behave differently.

* jc/http-socks5h:
  http: differentiate socks5:// and socks5h://

8 years agoMerge branch 'ky/imap-send' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:09 +0000 (14:24 -0700)] 
Merge branch 'ky/imap-send' into maint

Support for CRAM-MD5 authentication method in "git imap-send" did
not work well.

* ky/imap-send:
  imap-send: fix CRAM-MD5 response calculation
  imap-send: check for NOLOGIN capability only when using LOGIN command

8 years agoMerge branch 'ad/commit-have-m-option' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:09 +0000 (14:24 -0700)] 
Merge branch 'ad/commit-have-m-option' into maint

"git commit" misbehaved in a few minor ways when an empty message
is given via -m '', all of which has been corrected.

* ad/commit-have-m-option:
  commit: do not ignore an empty message given by -m ''
  commit: --amend -m '' silently fails to wipe message

8 years agoMerge branch 'sb/submodule-helper-clone-regression-fix' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:08 +0000 (14:24 -0700)] 
Merge branch 'sb/submodule-helper-clone-regression-fix' into maint

A partial rewrite of "git submodule" in the 2.7 timeframe changed
the way the gitdir: pointer in the submodules point at the real
repository location to use absolute paths by accident.  This has
been corrected.

* sb/submodule-helper-clone-regression-fix:
  submodule--helper, module_clone: catch fprintf failure
  submodule--helper: do not borrow absolute_path() result for too long
  submodule--helper, module_clone: always operate on absolute paths
  submodule--helper clone: create the submodule path just once
  submodule--helper: fix potential NULL-dereference
  recursive submodules: test for relative paths

8 years agoMerge branch 'jk/branch-shortening-funny-symrefs' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:07 +0000 (14:24 -0700)] 
Merge branch 'jk/branch-shortening-funny-symrefs' into maint

A change back in version 2.7 to "git branch" broke display of a
symbolic ref in a non-standard place in the refs/ hierarchy (we
expect symbolic refs to appear in refs/remotes/*/HEAD to point at
the primary branch the remote has, and as .git/HEAD to point at the
branch we locally checked out).

* jk/branch-shortening-funny-symrefs:
  branch: fix shortening of non-remote symrefs

8 years agoMerge branch 'es/format-patch-doc-hide-no-patch' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:06 +0000 (14:24 -0700)] 
Merge branch 'es/format-patch-doc-hide-no-patch' into maint

"git format-patch --help" showed `-s` and `--no-patch` as if these
are valid options to the command.  We already hide `--patch` option
from the documentation, because format-patch is about showing the
diff, and the documentation now hides these options as well.

* es/format-patch-doc-hide-no-patch:
  git-format-patch.txt: don't show -s as shorthand for multiple options

8 years agoMerge branch 'ky/branch-m-worktree' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:05 +0000 (14:24 -0700)] 
Merge branch 'ky/branch-m-worktree' into maint

When "git worktree" feature is in use, "git branch -m" renamed a
branch that is checked out in another worktree without adjusting
the HEAD symbolic ref for the worktree.

* ky/branch-m-worktree:
  set_worktree_head_symref(): fix error message
  branch -m: update all per-worktree HEADs
  refs: add a new function set_worktree_head_symref

8 years agoMerge branch 'ky/branch-d-worktree' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:05 +0000 (14:24 -0700)] 
Merge branch 'ky/branch-d-worktree' into maint

When "git worktree" feature is in use, "git branch -d" allowed
deletion of a branch that is checked out in another worktree

* ky/branch-d-worktree:
  branch -d: refuse deleting a branch which is currently checked out

8 years agoMerge branch 'jk/check-repository-format' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:04 +0000 (14:24 -0700)] 
Merge branch 'jk/check-repository-format' into maint

The repository set-up sequence has been streamlined (the biggest
change is that there is no longer git_config_early()), so that we
do not attempt to look into refs/* when we know we do not have a
Git repository.

* jk/check-repository-format:
  verify_repository_format: mark messages for translation
  setup: drop repository_format_version global
  setup: unify repository version callbacks
  init: use setup.c's repo version verification
  setup: refactor repo format reading and verification
  config: drop git_config_early
  check_repository_format_gently: stop using git_config_early
  lazily load core.sharedrepository
  wrap shared_repository global in get/set accessors
  setup: document check_repository_format()

8 years agoMerge branch 'ew/send-email-readable-message-id' into maint
Junio C Hamano [Mon, 2 May 2016 21:24:04 +0000 (14:24 -0700)] 
Merge branch 'ew/send-email-readable-message-id' into maint

"git send-email" now uses a more readable timestamps when
formulating a message ID.

* ew/send-email-readable-message-id:
  send-email: more meaningful Message-ID

8 years agoWindows: add pthread_sigmask() that does nothing
Johannes Sixt [Sun, 1 May 2016 19:08:21 +0000 (21:08 +0200)] 
Windows: add pthread_sigmask() that does nothing

A previous change introduced a call to pthread_sigmask() in order to block
SIGPIPE in a thread. Since there are no signal facilities on Windows that
are similar to POSIX signals, just ignore the request to block the signal.
In the particular case, the effect of blocking SIGPIPE on POSIX is that
write() calls return EPIPE when the reader closes the pipe. This is how
write() behaves on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoGit 2.8.2 v2.8.2
Junio C Hamano [Fri, 29 Apr 2016 21:18:16 +0000 (14:18 -0700)] 
Git 2.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'js/mingw-tests-2.8' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:16:01 +0000 (14:16 -0700)] 
Merge branch 'js/mingw-tests-2.8' into maint

Code clean-up.

* js/mingw-tests-2.8:
  Windows: shorten code by re-using convert_slashes()

8 years agoMerge branch 'ep/trace-doc-sample-fix' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:16:00 +0000 (14:16 -0700)] 
Merge branch 'ep/trace-doc-sample-fix' into maint

Fix a typo in an example in the trace API documentation.

* ep/trace-doc-sample-fix:
  api-trace.txt: fix typo

8 years agoMerge branch 'jc/makefile-redirection-stderr' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:15:59 +0000 (14:15 -0700)] 
Merge branch 'jc/makefile-redirection-stderr' into maint

A minor fix in the Makefile.

* jc/makefile-redirection-stderr:
  Makefile: fix misdirected redirections

8 years agoMerge branch 'ak/use-hashmap-iter-first-in-submodule-config' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:15:58 +0000 (14:15 -0700)] 
Merge branch 'ak/use-hashmap-iter-first-in-submodule-config' into maint

Minor code cleanup.

* ak/use-hashmap-iter-first-in-submodule-config:
  submodule-config: use hashmap_iter_first()

8 years agoMerge branch 'tb/blame-force-read-cache-to-workaround-safe-crlf' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:15:58 +0000 (14:15 -0700)] 
Merge branch 'tb/blame-force-read-cache-to-workaround-safe-crlf' into maint

When running "git blame $path" with unnormalized data in the index
for the path, the data in the working tree was blamed, even though
"git add" would not have changed what is already in the index, due
to "safe crlf" that disables the line-end conversion.  It has been
corrected.

* tb/blame-force-read-cache-to-workaround-safe-crlf:
  correct blame for files commited with CRLF

8 years agoMerge branch 'sk/send-pack-all-fix' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:15:56 +0000 (14:15 -0700)] 
Merge branch 'sk/send-pack-all-fix' into maint

"git send-pack --all <there>" was broken when its command line
option parsing was written in the 2.6 timeframe.

* sk/send-pack-all-fix:
  git-send-pack: fix --all option when used with directory

8 years agoMerge branch 'sg/diff-multiple-identical-renames' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:15:55 +0000 (14:15 -0700)] 
Merge branch 'sg/diff-multiple-identical-renames' into maint

"git diff -M" used to work better when two originally identical
files A and B got renamed to X/A and X/B by pairing A to X/A and B
to X/B, but this was broken in the 2.0 timeframe.

* sg/diff-multiple-identical-renames:
  diffcore: fix iteration order of identical files during rename detection

8 years agoMerge branch 'ss/msvc' into maint
Junio C Hamano [Fri, 29 Apr 2016 21:15:54 +0000 (14:15 -0700)] 
Merge branch 'ss/msvc' into maint

Build updates for MSVC.

* ss/msvc:
  MSVC: use shipped headers instead of fallback definitions
  MSVC: vsnprintf in Visual Studio 2015 doesn't need SNPRINTF_SIZE_CORR any more

8 years agogit-p4 tests: time_in_seconds should use $PYTHON_PATH
Luke Diamand [Tue, 26 Apr 2016 07:51:01 +0000 (08:51 +0100)] 
git-p4 tests: time_in_seconds should use $PYTHON_PATH

The time_in_seconds script should use $PYTHON_PATH, rather than
just hard-coded python, so that users can override which version
gets used, as is done for other python invocations.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-p4 tests: work with python3 as well as python2
Luke Diamand [Tue, 26 Apr 2016 07:51:00 +0000 (08:51 +0100)] 
git-p4 tests: work with python3 as well as python2

Update the git-p4 tests so that they work with both
Python2 and Python3.

We have to be explicit about the difference between
Unicode text strings (Python3 default) and raw binary
strings which will be exchanged with Perforce.

Additionally, print always takes parentheses in Python3.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-p4 tests: cd to / before running python
Luke Diamand [Tue, 26 Apr 2016 07:50:59 +0000 (08:50 +0100)] 
git-p4 tests: cd to / before running python

The python one-liner for getting the current time prints out
error messages if the current directory is deleted while it is
running if using python3.

Avoid these messages by switching to "/" before running it.

This problem does not arise if using python2.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodifftool/mergetool: make the form of yes/no questions consistent
Nikola Forró [Tue, 12 Apr 2016 14:44:20 +0000 (16:44 +0200)] 
difftool/mergetool: make the form of yes/no questions consistent

Every yes/no question in difftool/mergetool scripts has slightly
different form, and none of them is consistent with the form git
itself uses.

Make the form of all the questions consistent with the form used
by git.

Reviewed-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Nikola Forró <nforro@redhat.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge tag 'l10n-2.8.0-rnd3-fr' of git://github.com/git-l10n/git-po into maint
Junio C Hamano [Mon, 25 Apr 2016 20:36:26 +0000 (13:36 -0700)] 
Merge tag 'l10n-2.8.0-rnd3-fr' of git://github.com/git-l10n/git-po into maint

l10n-2.8.0-rnd3-fr

* tag 'l10n-2.8.0-rnd3-fr' of git://github.com/git-l10n/git-po:
  l10n: fr: don't translate "merge" as a parameter
  l10n: fr: change "id de clé" to match "id-clé"
  l10n: fr: fix wrongly translated option name
  l10n: fr: fix transcation of "dir"

8 years agosend-email: fix grammo in the prompt that asks e-mail recipients
Junio C Hamano [Sun, 24 Apr 2016 19:31:44 +0000 (12:31 -0700)] 
send-email: fix grammo in the prompt that asks e-mail recipients

The message, which dates back to the very original version 83b24437
made in 2005, sounds clumsy, grammatically incorrect, and is hard to
understand.

Reported-by: John Darrington <john@darrington.wattle.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'fr_v2.8.0_r3' of git://github.com/jnavila/git into maint
Jiang Xin [Sun, 24 Apr 2016 12:36:34 +0000 (20:36 +0800)] 
Merge branch 'fr_v2.8.0_r3' of git://github.com/jnavila/git into maint

* 'fr_v2.8.0_r3' of git://github.com/jnavila/git:
  l10n: fr: don't translate "merge" as a parameter
  l10n: fr: change "id de clé" to match "id-clé"
  l10n: fr: fix wrongly translated option name
  l10n: fr: fix transcation of "dir"

8 years agommap(win32): avoid expensive fstat() call
Johannes Schindelin [Fri, 22 Apr 2016 14:31:32 +0000 (16:31 +0200)] 
mmap(win32): avoid expensive fstat() call

On Windows, we have to emulate the fstat() call to fill out information
that takes extra effort to obtain, such as the file permissions/type.

If all we want is the file size, we can use the much cheaper
GetFileSizeEx() function (available since Windows XP).

Suggested by Philip Kelley.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agommap(win32): avoid copy-on-write when it is unnecessary
Johannes Schindelin [Fri, 22 Apr 2016 14:31:26 +0000 (16:31 +0200)] 
mmap(win32): avoid copy-on-write when it is unnecessary

Often we are mmap()ing read-only. In those cases, it is wasteful to map in
copy-on-write mode. Even worse: it can cause errors where we run out of
space in the page file.

So let's be extra careful to map files in read-only mode whenever
possible.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agowin32mmap: set errno appropriately
Johannes Schindelin [Fri, 22 Apr 2016 14:31:22 +0000 (16:31 +0200)] 
win32mmap: set errno appropriately

It is not really helpful when a `git fetch` fails with the message:

fatal: mmap failed: No error

In the particular instance encountered by a colleague of yours truly,
the Win32 error code was ERROR_COMMITMENT_LIMIT which means that the
page file is not big enough.

Let's make the message

fatal: mmap failed: File too large

instead, which is only marginally better, but which can be associated
with the appropriate work-around: setting `core.packedGitWindowSize` to
a relatively small value.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5504: drop sigpipe=ok from push tests
Jeff King [Tue, 19 Apr 2016 22:51:25 +0000 (18:51 -0400)] 
t5504: drop sigpipe=ok from push tests

These were added by 8bf4bec (add "ok=sigpipe" to
test_must_fail and use it to fix flaky tests, 2015-11-27)
because we would racily die via SIGPIPE when the pack was
rejected by the other side.

But since we have recently de-flaked send-pack, we should be
able to tighten up these tests (including re-adding the
expected output checks).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofetch-pack: isolate sigpipe in demuxer thread
Jeff King [Tue, 19 Apr 2016 22:50:29 +0000 (18:50 -0400)] 
fetch-pack: isolate sigpipe in demuxer thread

In commit 9ff18fa (fetch-pack: ignore SIGPIPE in sideband
demuxer, 2016-02-24), we started using sigchain_push() to
ignore SIGPIPE in the async demuxer thread. However, this is
rather clumsy, as it ignores SIGPIPE for the entire process,
including the main thread. At the time we didn't have any
per-thread signal support, but we now we do. Let's use it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosend-pack: isolate sigpipe in demuxer thread
Jeff King [Tue, 19 Apr 2016 22:50:17 +0000 (18:50 -0400)] 
send-pack: isolate sigpipe in demuxer thread

If we get an error from pack-objects, we may exit
send_pack() early, before reading the server's status
response. In such a case, we may racily see SIGPIPE from our
async demuxer (which is trying to write that status back to
us), and we'd prefer to continue pushing the error up the
call stack, rather than taking down the whole process with
signal death.

This is safe to do because our demuxer just calls
recv_sideband, whose data writes are all done with
write_or_die(), which will notice SIGPIPE.

We do also write sideband 2 to stderr, and we would no
longer die on SIGPIPE there (if it were piped in the first
place, and if the piped program went away). But that's
probably a good thing, as it likewise should not abort the
push process at all (neither immediately by signal, nor
eventually by reporting failure back to the main thread).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorun-command: teach async threads to ignore SIGPIPE
Jeff King [Tue, 19 Apr 2016 22:49:41 +0000 (18:49 -0400)] 
run-command: teach async threads to ignore SIGPIPE

Async processes can be implemented as separate forked
processes, or as threads (depending on the NO_PTHREADS
setting). In the latter case, if an async thread gets
SIGPIPE, it takes down the whole process. This is obviously
bad if the main process was not otherwise going to die, but
even if we were going to die, it means the main process does
not have a chance to report a useful error message.

There's also the small matter that forked async processes
will not take the main process down on a signal, meaning git
will behave differently depending on the NO_PTHREADS
setting.

This patch fixes it by adding a new flag to "struct async"
to block SIGPIPE just in the async thread. In theory, this
should always be on (which makes async threads behave more
like async processes), but we would first want to make sure
that each async process we spawn is careful about checking
return codes from write() and would not spew endlessly into
a dead pipe. So let's start with it as optional, and we can
enable it for specific sites in future patches.

The natural name for this option would be "ignore_sigpipe",
since that's what it does for the threaded case. But since
that name might imply that we are ignoring it in all cases
(including the separate-process one), let's call it
"isolate_sigpipe". What we are really asking for is
isolation. I.e., not to have our main process taken down by
signals spawned by the async process. How that is
implemented is up to the run-command code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosend-pack: close demux pipe before finishing async process
Jeff King [Tue, 19 Apr 2016 22:45:17 +0000 (18:45 -0400)] 
send-pack: close demux pipe before finishing async process

This fixes a deadlock on the client side when pushing a
large number of refs from a corrupted repo.  There's a
reproduction script below, but let's start with a
human-readable explanation.

The client side of a push goes something like this:

  1. Start an async process to demux sideband coming from
     the server.

  2. Run pack-objects to send the actual pack, and wait for
     its status via finish_command().

  3. If pack-objects failed, abort immediately.

  4. If pack-objects succeeded, read the per-ref status from
     the server, which is actually coming over a pipe from
     the demux process started in step 1.

We run finish_async() to wait for and clean up the demux
process in two places. In step 3, if we see an error, we
want it to end early. And after step 4, it should be done
writing any data and we are just cleaning it up.

Let's focus on the error case first. We hand the output
descriptor to the server over to pack-objects. So by the
time it has returned an error to us, it has closed the
descriptor and the server has gotten EOF. The server will
mark all refs as failed with "unpacker error" and send us
back the status for each (followed by EOF).

This status goes to the demuxer thread, which relays it over
a pipe to the main thread. But the main thread never even
tries reading the status. It's trying to bail because of the
pack-objects error, and is waiting for the demuxer thread to
finish. If there are a small number of refs, that's OK; the
demuxer thread writes into the pipe buffer, sees EOF from
the server, and quits. But if there are a large number of
refs, it may block on write() back to the main thread,
leading to a deadlock (the main thread is waiting for the
demuxer to finish, the demuxer is waiting for the main
thread to read).

We can break this deadlock by closing the pipe between the
demuxer and the main thread before calling finish_async().
Then the demuxer gets a write() error and exits.

The non-error case usually just works, because we will have
read all of the data from the other side. We do close
demux.out already, but we only do so _after_ calling
finish_async(). This is OK because there shouldn't be any
more data coming from the server. But technically we've only
read to a flush packet, and a broken or malicious server
could be sending more cruft. In such a case, we would hit
the same deadlock. Closing the pipe first doesn't affect the
normal case, and means that for a cruft-sending server,
we'll notice a write() error rather than deadlocking.

Note that when write() sees this error, we'll actually
deliver SIGPIPE to the thread, which will take down the
whole process (unless we're compiled with NO_PTHREADS). This
isn't ideal, but it's an improvement over the status quo,
which is deadlocking. And SIGPIPE handling in async threads
is a bigger problem that we can deal with separately.

A simple reproduction for the error case is below. It's
technically racy (we could exit the main process and take
down the async thread with us before it even reads the
status), though in practice it seems to fail pretty
consistently.

    git init repo &&
    cd repo &&

    # make some commits; we need two so we can simulate corruption
    # in the history later.
    git commit --allow-empty -m one &&
    one=$(git rev-parse HEAD) &&
    git commit --allow-empty -m two &&
    two=$(git rev-parse HEAD) &&

    # now make a ton of refs; our goal here is to overflow the pipe buffer
    # when reporting the ref status, which will cause the demuxer to block
    # on write()
    for i in $(seq 20000); do
     echo "create refs/heads/this-is-a-really-long-branch-name-$i $two"
    done |
    git update-ref --stdin &&

    # now make a corruption in the history such that pack-objects will fail
    rm -vf .git/objects/$(echo $one | sed 's}..}&/}') &&

    # and then push the result
    git init --bare dst.git &&
    git push --mirror dst.git

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoreplace --edit: respect core.editor
Johannes Schindelin [Wed, 20 Apr 2016 06:38:03 +0000 (08:38 +0200)] 
replace --edit: respect core.editor

We simply need to read the config, is all.

This fixes https://github.com/git-for-windows/git/issues/733

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agomv: allow moving nested submodules
Stefan Beller [Tue, 19 Apr 2016 18:32:04 +0000 (11:32 -0700)] 
mv: allow moving nested submodules

When directories are moved using `git mv` all files in the directory
have been just moved, but no further action was taken on them. This
was done by assigning the mode = WORKING_DIRECTORY to the files
inside a moved directory.

submodules however need to update their link to the git directory as
well as updates to the .gitmodules file. By removing the condition of
`mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for
the required submodule actions, we perform these for submodules in a
moved directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoPrepare for 2.8.2
Junio C Hamano [Fri, 15 Apr 2016 01:58:11 +0000 (18:58 -0700)] 
Prepare for 2.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jv/merge-nothing-into-void' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:49 +0000 (18:57 -0700)] 
Merge branch 'jv/merge-nothing-into-void' into maint

"git merge FETCH_HEAD" dereferenced NULL pointer when merging
nothing into an unborn history (which is arguably unusual usage,
which perhaps was the reason why nobody noticed it).

* jv/merge-nothing-into-void:
  merge: fix NULL pointer dereference when merging nothing into void

8 years agoMerge branch 'ss/commit-squash-msg' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:48 +0000 (18:57 -0700)] 
Merge branch 'ss/commit-squash-msg' into maint

When "git merge --squash" stopped due to conflict, the concluding
"git commit" failed to read in the SQUASH_MSG that shows the log
messages from all the squashed commits.

* ss/commit-squash-msg:
  commit: do not lose SQUASH_MSG contents

8 years agoMerge branch 'jk/send-email-rtrim-mailrc-alias' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:47 +0000 (18:57 -0700)] 
Merge branch 'jk/send-email-rtrim-mailrc-alias' into maint

"git send-email" had trouble parsing alias file in mailrc format
when lines in it had trailing whitespaces on them.

* jk/send-email-rtrim-mailrc-alias:
  send-email: ignore trailing whitespace in mailrc alias file

8 years agoMerge branch 'da/mergetool-delete-delete-conflict' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:47 +0000 (18:57 -0700)] 
Merge branch 'da/mergetool-delete-delete-conflict' into maint

"git mergetool" did not work well with conflicts that both sides
deleted.

* da/mergetool-delete-delete-conflict:
  mergetool: honor tempfile configuration when resolving delete conflicts
  mergetool: support delete/delete conflicts

8 years agoMerge branch 'jk/startup-info' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:46 +0000 (18:57 -0700)] 
Merge branch 'jk/startup-info' into maint

The startup_info data, which records if we are working inside a
repository (among other things), are now uniformly available to Git
subcommand implementations, and Git avoids attempting to touch
references when we are not in a repository.

* jk/startup-info:
  use setup_git_directory() in test-* programs
  grep: turn off gitlink detection for --no-index
  mailmap: do not resolve blobs in a non-repository
  remote: don't resolve HEAD in non-repository
  setup: set startup_info->have_repository more reliably
  setup: make startup_info available everywhere

8 years agoMerge branch 'jk/getwholeline-getdelim-empty' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:46 +0000 (18:57 -0700)] 
Merge branch 'jk/getwholeline-getdelim-empty' into maint

strbuf_getwholeline() did not NUL-terminate the buffer on certain
corner cases in its error codepath.

* jk/getwholeline-getdelim-empty:
  strbuf_getwholeline: NUL-terminate getdelim buffer on error

8 years agoMerge branch 'rj/xdiff-prepare-plug-leak-on-error-codepath' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:45 +0000 (18:57 -0700)] 
Merge branch 'rj/xdiff-prepare-plug-leak-on-error-codepath' into maint

A small memory leak in an error codepath has been plugged in xdiff
code.

* rj/xdiff-prepare-plug-leak-on-error-codepath:
  xdiff/xprepare: fix a memory leak
  xdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bits

8 years agoMerge branch 'gf/fetch-pack-direct-object-fetch' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:44 +0000 (18:57 -0700)] 
Merge branch 'gf/fetch-pack-direct-object-fetch' into maint

Fetching of history by naming a commit object name directly didn't
work across remote-curl transport.

* gf/fetch-pack-direct-object-fetch:
  fetch-pack: update the documentation for "<refs>..." arguments
  fetch-pack: fix object_id of exact sha1

8 years agoMerge branch 'jk/rev-parse-local-env-vars' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:44 +0000 (18:57 -0700)] 
Merge branch 'jk/rev-parse-local-env-vars' into maint

The "--local-env-vars" and "--resolve-git-dir" options of "git
rev-parse" failed to work outside a repository when the command's
option parsing was rewritten in 1.8.5 era.

* jk/rev-parse-local-env-vars:
  rev-parse: let some options run outside repository
  t1515: add tests for rev-parse out-of-repo helpers

8 years agoMerge branch 'jk/config-get-urlmatch' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:57:43 +0000 (18:57 -0700)] 
Merge branch 'jk/config-get-urlmatch' into maint

"git config --get-urlmatch", unlike other variants of the "git
config --get" family, did not signal error with its exit status
when there was no matching configuration.

* jk/config-get-urlmatch:
  Documentation/git-config: fix --get-all description
  Documentation/git-config: use bulleted list for exit codes
  config: fail if --get-urlmatch finds no value

8 years agoMerge branch 'pb/t7502-drop-dup' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:18 +0000 (18:37 -0700)] 
Merge branch 'pb/t7502-drop-dup' into maint

Code clean-up.

* pb/t7502-drop-dup:
  t/t7502 : drop duplicate test

8 years agoMerge branch 'jk/test-httpd-config-nosystem' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:17 +0000 (18:37 -0700)] 
Merge branch 'jk/test-httpd-config-nosystem' into maint

The tests that involve running httpd leaked the system-wide
configuration in /etc/gitconfig to the tested environment.

* jk/test-httpd-config-nosystem:
  t/lib-httpd: pass through GIT_CONFIG_NOSYSTEM env

8 years agoMerge branch 'sb/clone-t57-t56' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:16 +0000 (18:37 -0700)] 
Merge branch 'sb/clone-t57-t56' into maint

Rename bunch of tests on "git clone" for better organization.

* sb/clone-t57-t56:
  clone tests: rename t57* => t56*

8 years agoMerge branch 'jk/credential-cache-comment-exit' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:16 +0000 (18:37 -0700)] 
Merge branch 'jk/credential-cache-comment-exit' into maint

A code clarification.

* jk/credential-cache-comment-exit:
  credential-cache--daemon: clarify "exit" action semantics

8 years agoMerge branch 'jc/index-pack' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:15 +0000 (18:37 -0700)] 
Merge branch 'jc/index-pack' into maint

Code clean-up.

* jc/index-pack:
  index-pack: add a helper function to derive .idx/.keep filename
  index-pack: correct --keep[=<msg>]

8 years agoMerge branch 'ss/exc-flag-is-a-collection-of-bits' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:15 +0000 (18:37 -0700)] 
Merge branch 'ss/exc-flag-is-a-collection-of-bits' into maint

Code clean-up.

* ss/exc-flag-is-a-collection-of-bits:
  dir: store EXC_FLAG_* values in unsigned integers

8 years agoMerge branch 'mp/upload-pack-use-embedded-args' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:14 +0000 (18:37 -0700)] 
Merge branch 'mp/upload-pack-use-embedded-args' into maint

The embedded args argv-array in the child process is used to build
the command line to run pack-objects instead of using a separate
array of strings.

* mp/upload-pack-use-embedded-args:
  upload-pack: use argv_array for pack_objects

8 years agoMerge branch 'oa/doc-diff-check' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:14 +0000 (18:37 -0700)] 
Merge branch 'oa/doc-diff-check' into maint

A minor documentation update.

* oa/doc-diff-check:
  Documentation: git diff --check detects conflict markers

8 years agoMerge branch 'pb/opt-cmdmode-doc' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:13 +0000 (18:37 -0700)] 
Merge branch 'pb/opt-cmdmode-doc' into maint

Minor API documentation update.

* pb/opt-cmdmode-doc:
  api-parse-options.txt: document OPT_CMDMODE()

8 years agoMerge branch 'nd/apply-doc' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:13 +0000 (18:37 -0700)] 
Merge branch 'nd/apply-doc' into maint

A minor documentation update.

* nd/apply-doc:
  git-apply.txt: mention the behavior inside a subdir
  git-apply.txt: remove a space

8 years agoMerge branch 'cc/doc-recommend-performance-trace-to-file' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:12 +0000 (18:37 -0700)] 
Merge branch 'cc/doc-recommend-performance-trace-to-file' into maint

A minor documentation update.

* cc/doc-recommend-performance-trace-to-file:
  Documentation: talk about pager in api-trace.txt

8 years agoMerge branch 'mm/lockfile-error-message' into maint
Junio C Hamano [Fri, 15 Apr 2016 01:37:12 +0000 (18:37 -0700)] 
Merge branch 'mm/lockfile-error-message' into maint

* mm/lockfile-error-message:
  lockfile: improve error message when lockfile exists
  lockfile: mark strings for translation

8 years agoStart preparing for 2.8.2
Junio C Hamano [Wed, 13 Apr 2016 23:30:00 +0000 (16:30 -0700)] 
Start preparing for 2.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoimap-send: fix CRAM-MD5 response calculation
Kazuki Yamaguchi [Fri, 8 Apr 2016 14:02:30 +0000 (23:02 +0900)] 
imap-send: fix CRAM-MD5 response calculation

Remove extra + 1 from resp_len, the length of the byte sequence to be
Base64 encoded and passed to the server as the response. Or the response
incorrectly contains an extra \0.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoimap-send: check for NOLOGIN capability only when using LOGIN command
Kazuki Yamaguchi [Fri, 8 Apr 2016 14:02:24 +0000 (23:02 +0900)] 
imap-send: check for NOLOGIN capability only when using LOGIN command

Don't check for NOLOGIN (LOGINDISABLED) capability when imap.authMethod
is specified.

LOGINDISABLED capability doesn't forbid using AUTHENTICATE, so it should
be allowed, or we can't connect to IMAP servers which only accepts
AUTHENTICATE command.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot3404: use write_script
Junio C Hamano [Tue, 12 Apr 2016 16:59:59 +0000 (09:59 -0700)] 
t3404: use write_script

The test uses hardcoded #!/bin/sh to create a pre-commit hook
script.  Because the generated script uses $(command substitution),
which is not supported by /bin/sh on some platforms (e.g. Solaris),
the resulting pre-commit always fails.

Which is not noticeable as the test that uses the hook is about
checking the behaviour of the command when the hook fails ;-), but
nevertheless it is not testing what we wanted to test.

Use write_script so that the resulting script is run under the same
shell our scripted Porcelain commands are run, which must support
the necessary $(construct).

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot1020: do not overuse printf and use write_script
Junio C Hamano [Sun, 10 Apr 2016 19:01:30 +0000 (12:01 -0700)] 
t1020: do not overuse printf and use write_script

The test prepares a sample file "dir/two" with a single incomplete
line in it with "printf", and also prepares a small helper script
"diff" to create a file with a single incomplete line in it, again
with "printf".  The output from the latter is compared with an
expected output, again prepared with "printf" hence lacking the
final LF.  There is no reason for this test to be using files with
an incomplete line at the end, and these look more like a mistake
of not using

printf "%s\n" "string to be written"

and using

printf "string to be written"

Depending on what would be in $GIT_PREFIX, using the latter form
could be a bug waiting to happen.  Correct them.

Also, the test uses hardcoded #!/bin/sh to create a small helper
script.  For a small task like what the generated script does, it
does not matter too much in that what appears as /bin/sh would not
be _so_ broken, but while we are at it, use write_script instead,
which happens to make the result easier to read by reducing need
of one level of quoting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5532: use write_script
Jeff King [Sat, 9 Apr 2016 21:04:30 +0000 (17:04 -0400)] 
t5532: use write_script

The recent cleanup in b7cbbff switched t5532's use of
backticks to $(). This matches our normal shell style, which
is good. But it also breaks the test on Solaris, where
/bin/sh does not understand $().

Our normal shell style assumes a modern-ish shell which
knows about $(). However, some tests create small helper
scripts and just write "#!/bin/sh" into them. These scripts
either need to go back to using backticks, or they need to
respect $SHELL_PATH. The easiest way to do the latter is to
use write_script.

While we're at it, let's also stick the script creation
inside a test_expect block (our usual style), and split the
perl snippet into its own script (to prevent quoting
madness).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit_config_set_multivar_in_file: handle "unset" errors
Jeff King [Sat, 9 Apr 2016 17:43:54 +0000 (13:43 -0400)] 
git_config_set_multivar_in_file: handle "unset" errors

We pass off to the "_gently" form to do the real work, and
just die() if it returned an error. However, our die message
de-references "value", which may be NULL if the request was
to unset a variable. Nobody using glibc noticed, because it
simply prints "(null)", which is good enough for the test
suite (and presumably very few people run across this in
practice). But other libc implementations (like Solaris) may
segfault.

Let's not only fix that, but let's make the message more
clear about what is going on in the "unset" case.

Reported-by: "Tom G. Christensen" <tgc@jupiterrise.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit_config_set_multivar_in_file: all non-zero returns are errors
Jeff King [Sat, 9 Apr 2016 17:42:54 +0000 (13:42 -0400)] 
git_config_set_multivar_in_file: all non-zero returns are errors

This function is just a thin wrapper for the "_gently" form
of the function. But the gently form is designed to feed
builtin/config.c, which passes our return code directly to
its exit status, and thus uses positive error values for
some cases. We check only negative values, meaning we would
fail to die in some cases (e.g., a malformed key).

This may or may not be triggerable in practice; we tend to
use this non-gentle form only when setting internal
variables, which would not have malformed keys.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoconfig: lower-case first word of error strings
Jeff King [Sat, 9 Apr 2016 17:42:31 +0000 (13:42 -0400)] 
config: lower-case first word of error strings

This follows our usual style (both throughout git, and
throughout the rest of this file).

This covers the whole file, but note that I left the capitalization in
the multi-sentence:

  error: malformed value...
  error: Must be one of ...

because it helps make it clear that we are starting a new sentence in
the second one.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agohttp: differentiate socks5:// and socks5h://
Junio C Hamano [Fri, 8 Apr 2016 19:16:06 +0000 (12:16 -0700)] 
http: differentiate socks5:// and socks5h://

Felix Ruess <felix.ruess@gmail.com> noticed that with configuration

    $ git config --global 'http.proxy=socks5h://127.0.0.1:1080'

connections to remote sites time out, waiting for DNS resolution.

The logic to detect various flavours of SOCKS proxy and ask the
libcurl layer to use appropriate one understands the proxy string
that begin with socks5, socks4a, etc., but does not know socks5h,
and we end up using CURLPROXY_SOCKS5.  The correct one to use is
CURLPROXY_SOCKS5_HOSTNAME.

https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html says

  ..., socks5h:// (the last one to enable socks5 and asking the
  proxy to do the resolving, also known as CURLPROXY_SOCKS5_HOSTNAME
  type).

which is consistent with the way the breakage was reported.

Tested-by: Felix Ruess <felix.ruess@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoconfigure: remove checking for HMAC_CTX_cleanup
Kazuki Yamaguchi [Fri, 8 Apr 2016 16:22:16 +0000 (01:22 +0900)] 
configure: remove checking for HMAC_CTX_cleanup

We don't need it, as we no longer use HMAC_CTX_cleanup() directly.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoimap-send: avoid deprecated TLSv1_method()
Kazuki Yamaguchi [Fri, 8 Apr 2016 16:22:15 +0000 (01:22 +0900)] 
imap-send: avoid deprecated TLSv1_method()

Use SSLv23_method always and disable SSL if needed.

TLSv1_method() function is deprecated in OpenSSL 1.1.0 and the compiler
emits a warning.

SSLv23_method() is also deprecated, but the alternative, TLS_method(),
is new in OpenSSL 1.1.0 so requires checking by configure. Stick to
SSLv23_method() for now (this is aliased to TLS_method()).

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoimap-send: check NULL return of SSL_CTX_new()
Kazuki Yamaguchi [Fri, 8 Apr 2016 16:22:14 +0000 (01:22 +0900)] 
imap-send: check NULL return of SSL_CTX_new()

SSL_CTX_new() may fail with return value NULL.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoimap-send: use HMAC() function provided by OpenSSL
Kazuki Yamaguchi [Fri, 8 Apr 2016 16:22:13 +0000 (01:22 +0900)] 
imap-send: use HMAC() function provided by OpenSSL

Fix compile errors with OpenSSL 1.1.0.

HMAC_CTX is made opaque and HMAC_CTX_cleanup is removed in OpenSSL
1.1.0. But since we just want to calculate one HMAC, we can use HMAC()
here, which exists since OpenSSL 0.9.6 at least.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoset_worktree_head_symref(): fix error message
Kazuki Yamaguchi [Fri, 8 Apr 2016 08:03:07 +0000 (17:03 +0900)] 
set_worktree_head_symref(): fix error message

Emit an informative error when failed to hold lock of HEAD.

2233066e (refs: add a new function set_worktree_head_symref,
2016-03-27) added set_worktree_head_symref(), but this is missing a
call to unable_to_lock_message() after hold_lock_file_for_update()
fails, so it emits an empty error message:

  % git branch -m oldname newname
  error:
  error: HEAD of working tree /path/to/wt is not updated
  fatal: Branch renamed to newname, but HEAD is not updated!

Thanks to Eric Sunshine for pointing this out.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocommit: do not ignore an empty message given by -m ''
Jeff King [Thu, 7 Apr 2016 19:56:26 +0000 (12:56 -0700)] 
commit: do not ignore an empty message given by -m ''

When f9568530 (builtin-commit: resurrect behavior for multiple -m
options, 2007-11-11) converted a "char *message" to "struct strbuf
message" to hold the messages given with the "-m" option, it
incorrectly changed the checks "did we get a message with the -m
option?" to "is message.len 0?".  Later, we noticed one breakage
from this change and corrected it with 25206778 (commit: don't start
editor if empty message is given with -m, 2013-05-25).

However, "we got a message with -m, even though an empty one, so we
shouldn't be launching an editor" was not the only breakage.

 * "git commit --amend -m '' --allow-empty", even though it looks
   strange, is a valid request to amend the commit to have no
   message at all.  Due to the misdetection of the presence of -m on
   the command line, we ended up keeping the log messsage from the
   original commit.

 * "git commit -m "$msg" -F file" should be rejected whether $msg is
   an empty string or not, but due to the same bug, was not rejected
   when $msg is empty.

 * "git -c template=file -m "$msg"" should ignore the template even
   when $msg is empty, but it didn't and instead used the contents
   from the template file.

Correct these by checking have_option_m, which the earlier 25206778
introduced to fix the same bug.

Reported-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocommit: --amend -m '' silently fails to wipe message
Adam Dinwoodie [Wed, 6 Apr 2016 17:15:03 +0000 (18:15 +0100)] 
commit: --amend -m '' silently fails to wipe message

`git commit --amend -m ''` seems to be an unambiguous request to blank a
commit message, but it actually leaves the commit message as-is.  That's
the case regardless of whether `--allow-empty-message` is specified, and
doesn't so much as drop a non-zero return code.

Add failing tests to show this behaviour.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosetup.c: do not feed NULL to "%.*s" even with precision 0
Junio C Hamano [Thu, 7 Apr 2016 19:38:18 +0000 (12:38 -0700)] 
setup.c: do not feed NULL to "%.*s" even with precision 0

A recent update 75faa45a (replace trivial malloc + sprintf / strcpy
calls with xstrfmt, 2015-09-24) rewrote

prepare an empty buffer
if (len)
         append the first len bytes of "prefix" to the buffer
append "path" to the buffer

that computed "path", optionally prefixed by "prefix", into

xstrfmt("%.*s%s", len, prefix, path);

However, passing a NULL pointer to the printf(3) family of functions
to format it with %s conversion, even with the precision set to 0,
i.e.

xstrfmt("%.*s", 0, NULL)

yields undefined results, at least on some platforms.

Avoid this problem by substituting prefix with "" when len==0, as
prefix can legally be NULL in that case.  This would mimick the
intent of the original code better.

Reported-by: Tom G. Christensen <tgc@jupiterrise.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosend-email: do not load Data::Dumper
Eric Wong [Wed, 6 Apr 2016 20:25:38 +0000 (20:25 +0000)] 
send-email: do not load Data::Dumper

We never used Data::Dumper in this script.  The only reference
of it was always commented out and removed over a decade ago in
commit 4bc87a28be020a6bf7387161c65ea3d8e4a0228b
("send-email: Change from Mail::Sendmail to Net::SMTP")

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>