Commit graph

44208 commits

Author SHA1 Message Date
Junio C Hamano 3d54b93f40 Merge branch 'jk/squelch-false-warning-from-gcc-o3' into maint
Compilation fix.

* jk/squelch-false-warning-from-gcc-o3:
  color_parse_mem: initialize "struct color" temporary
  error_errno: use constant return similar to error()
2016-09-19 13:51:41 -07:00
Junio C Hamano 1e28677e5b Merge branch 'ep/use-git-trace-curl-in-tests' into maint
Update a few tests that used to use GIT_CURL_VERBOSE to use the
newer GIT_TRACE_CURL.

* ep/use-git-trace-curl-in-tests:
  t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL environment var
  t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL environment var
  test-lib.sh: preserve GIT_TRACE_CURL from the environment
  t5541-http-push-smart.sh: use the GIT_TRACE_CURL environment var
2016-09-19 13:51:41 -07:00
Junio C Hamano 8e26535866 Merge branch 'js/t6026-clean-up' into maint
A test spawned a short-lived background process, which sometimes
prevented the test directory from getting removed at the end of the
script on some platforms.

* js/t6026-clean-up:
  t6026-merge-attr: clean up background process at end of test case
2016-09-19 13:51:41 -07:00
Junio C Hamano d6645312ff Merge branch 'jc/forbid-symbolic-ref-d-HEAD' into maint
"git symbolic-ref -d HEAD" happily removes the symbolic ref, but
the resulting repository becomes an invalid one.  Teach the command
to forbid removal of HEAD.

* jc/forbid-symbolic-ref-d-HEAD:
  symbolic-ref -d: do not allow removal of HEAD
2016-09-19 13:51:41 -07:00
Junio C Hamano 4c10c31137 Merge branch 'jc/submodule-anchor-git-dir' into maint
Having a submodule whose ".git" repository is somehow corrupt
caused a few commands that recurse into submodules loop forever.

* jc/submodule-anchor-git-dir:
  submodule: avoid auto-discovery in prepare_submodule_repo_env()
2016-09-19 13:51:40 -07:00
Junio C Hamano 79b51ebf6f Merge branch 'jk/test-lib-drop-pid-from-results' into maint
The test framework left the number of tests and success/failure
count in the t/test-results directory, keyed by the name of the
test script plus the process ID.  The latter however turned out not
to serve any useful purpose.  The process ID part of the filename
has been removed.

* jk/test-lib-drop-pid-from-results:
  test-lib: drop PID from test-results/*.count
2016-09-19 13:51:39 -07:00
Junio C Hamano 276661ff85 Merge branch 'bh/diff-highlight-graph' into maint
"diff-highlight" script (in contrib/) learned to work better with
"git log -p --graph" output.

* bh/diff-highlight-graph:
  diff-highlight: avoid highlighting combined diffs
  diff-highlight: add multi-byte tests
  diff-highlight: ignore test cruft
  diff-highlight: add support for --graph output
  diff-highlight: add failing test for handling --graph output
  diff-highlight: add some tests
2016-09-19 13:51:38 -07:00
Junio C Hamano f0b2db228b Merge branch 'po/range-doc' into maint
Clarify various ways to specify the "revision ranges" in the
documentation.

* po/range-doc:
  doc: revisions: sort examples and fix alignment of the unchanged
  doc: revisions: show revision expansion in examples
  doc: revisions - clarify reachability examples
  doc: revisions - define `reachable`
  doc: gitrevisions - clarify 'latter case' is revision walk
  doc: gitrevisions - use 'reachable' in page description
  doc: revisions: single vs multi-parent notation comparison
  doc: revisions: extra clarification of <rev>^! notation effects
  doc: revisions: give headings for the two and three dot notations
  doc: show the actual left, right, and boundary marks
  doc: revisions - name the left and right sides
  doc: use 'symmetric difference' consistently
2016-09-19 13:51:38 -07:00
Junio C Hamano 91942260a2 l10n-2.10.0-rnd2.3
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJX1WH0AAoJEMek6Rt1RHooINYP/jcQyV6e06KGcr8hOhOFfxiV
 HYTuaXiMAz/SNB9fu7JGccB0iXfUWWvGS+rVtNWtwn8GFh5MI4jc9qnpNjg7yYSV
 rINCrIEvaTzXt9cBDTKCsxQ4UTno6D7p22bUJNGmyEcyKzowJPWlCYsvSTn2wP4j
 dq2FzAGcvSRteI5wEzp3ZfMWEfSZ12zSWH/SSCMfyp/JgSwNCkxiWzF9uT5aQPUU
 cvc+V0GIkdq/StRuZFPDXHniMBAYPRFfjKpe90skPEwbmudYpJ+x3/O7APqg3lqo
 sM+9IQnqKli1fQeZqF8mAGj8Xi46Ts8l1O9oJJrCtbzmrTSsfVmEi/WmDYzm60S/
 Qcuyd2v8K3zXkxslvgReO7yd7cTeNHLznXhHm1EPPyVf1YVYJM6nbOqmnFNhhs46
 jUIZDVdy2CFsDhj9JljYotxMka4grHLZpyOrijREjKhBHXWuzum54FjPNuNFS7Og
 IjHPwtrtuqI9/NyTYXO3AQQYRLuV5CEDd/HvlYR9S5OlRM3oezdZNfyGive8BdAt
 SCjYiYSlNaLgEvibtmjAnKVFCdt2KMCxtahxPw+hF085Ose+61DZ1dq8R/Wkbc5V
 nrWxMzTdPd0i6AhA7mwXE06KBtEdhOxGc3LvLoDMOy0Qcbp2Pw6ybLI4pwyWvKG/
 0n90tvdNfoSGorklJww1
 =54IT
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.10.0-rnd2.3' of git://github.com/git-l10n/git-po into maint

l10n-2.10.0-rnd2.3

* tag 'l10n-2.10.0-rnd2.3' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: review for git v2.10.0 l10n
  l10n: zh_CN: fixed some typos for git 2.10.0
  l10n: pt_PT: update Portuguese repository info
  l10n: pt_PT: update Portuguese translation
2016-09-12 15:23:42 -07:00
Ray Chen 9a4b694c53 l10n: zh_CN: review for git v2.10.0 l10n
Signed-off-by: Ray Chen <oldsharp@gmail.com>
2016-09-11 21:34:23 +08:00
Jiang Xin 7665d45926 l10n: zh_CN: fixed some typos for git 2.10.0
Reviewed-by: Ray <tvvocold@163.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2016-09-11 21:31:51 +08:00
Junio C Hamano 49981d8a25 Start maintenance track for 2.10.x series 2016-09-08 21:39:38 -07:00
Junio C Hamano 0202c411ed Prepare for 2.9.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-08 21:37:59 -07:00
Junio C Hamano 3e8e69a695 Merge branch 'hv/doc-commit-reference-style' into maint
A small doc update.

* hv/doc-commit-reference-style:
  SubmittingPatches: use gitk's "Copy commit summary" format
  SubmittingPatches: document how to reference previous commits
2016-09-08 21:36:03 -07:00
Junio C Hamano b5abd302ef Merge branch 'sg/reflog-past-root' into maint
A small test clean-up for a topic introduced in v2.9.1 and later.

* sg/reflog-past-root:
  t1410: remove superfluous 'git reflog' from the 'walk past root' test
2016-09-08 21:36:02 -07:00
Junio C Hamano 71165f027f Merge branch 'rs/mailinfo-lib' into maint
Small code clean-up.

* rs/mailinfo-lib:
  mailinfo: recycle strbuf in check_header()
2016-09-08 21:36:01 -07:00
Junio C Hamano 9bef642236 Merge branch 'jk/tighten-alloc' into maint
Small code and comment clean-up.

* jk/tighten-alloc:
  receive-pack: use FLEX_ALLOC_MEM in queue_command()
  correct FLEXPTR_* example in comment
2016-09-08 21:36:00 -07:00
Junio C Hamano 5e469ab66c Merge branch 'rs/use-strbuf-add-unique-abbrev' into maint
A small code clean-up.

* rs/use-strbuf-add-unique-abbrev:
  use strbuf_add_unique_abbrev() for adding short hashes
2016-09-08 21:36:00 -07:00
Junio C Hamano f14883b972 Merge branch 'rs/merge-recursive-string-list-init' into maint
A small code clean-up.

* rs/merge-recursive-string-list-init:
  merge-recursive: use STRING_LIST_INIT_NODUP
2016-09-08 21:35:59 -07:00
Junio C Hamano 24c88ad8d1 Merge branch 'rs/merge-add-strategies-simplification' into maint
A small code clean-up.

* rs/merge-add-strategies-simplification:
  merge: use string_list_split() in add_strategies()
2016-09-08 21:35:58 -07:00
Junio C Hamano a75341c75a Merge branch 'ls/packet-line-protocol-doc-fix' into maint
Correct an age-old calco (is that a typo-like word for calc)
in the documentation.

* ls/packet-line-protocol-doc-fix:
  pack-protocol: fix maximum pkt-line size
2016-09-08 21:35:57 -07:00
Junio C Hamano c0e8b3b444 Merge branch 'bw/mingw-avoid-inheriting-fd-to-lockfile' into maint
The tempfile (hence its user lockfile) API lets the caller to open
a file descriptor to a temporary file, write into it and then
finalize it by first closing the filehandle and then either
removing or renaming the temporary file.  When the process spawns a
subprocess after obtaining the file descriptor, and if the
subprocess has not exited when the attempt to remove or rename is
made, the last step fails on Windows, because the subprocess has
the file descriptor still open.  Open tempfile with O_CLOEXEC flag
to avoid this (on Windows, this is mapped to O_NOINHERIT).

* bw/mingw-avoid-inheriting-fd-to-lockfile:
  mingw: ensure temporary file handles are not inherited by child processes
  t6026-merge-attr: child processes must not inherit index.lock handles
2016-09-08 21:35:56 -07:00
Junio C Hamano 15a27298fc Merge branch 'dg/document-git-c-in-git-config-doc' into maint
The "git -c var[=val] cmd" facility to append a configuration
variable definition at the end of the search order was described in
git(1) manual page, but not in git-config(1), which was more likely
place for people to look for when they ask "can I make a one-shot
override, and if so how?"

* dg/document-git-c-in-git-config-doc:
  doc: mention `git -c` in git-config(1)
2016-09-08 21:35:56 -07:00
Junio C Hamano ba22efd8f5 Merge branch 'js/no-html-bypass-on-windows' into maint
On Windows, help.browser configuration variable used to be ignored,
which has been corrected.

* js/no-html-bypass-on-windows:
  Revert "display HTML in default browser using Windows' shell API"
2016-09-08 21:35:55 -07:00
Junio C Hamano bde42f081e Merge branch 'jk/difftool-command-not-found' into maint
"git difftool" by default ignores the error exit from the backend
commands it spawns, because often they signal that they found
differences by exiting with a non-zero status code just like "diff"
does; the exit status codes 126 and above however are special in
that they are used to signal that the command is not executable,
does not exist, or killed by a signal.  "git difftool" has been
taught to notice these exit status codes.

* jk/difftool-command-not-found:
  difftool: always honor fatal error exit codes
2016-09-08 21:35:54 -07:00
Junio C Hamano 7c96471947 Merge branch 'sb/checkout-explit-detach-no-advice' into maint
"git checkout --detach <branch>" used to give the same advice
message as that is issued when "git checkout <tag>" (or anything
that is not a branch name) is given, but asking with "--detach" is
an explicit enough sign that the user knows what is going on.  The
advice message has been squelched in this case.

* sb/checkout-explit-detach-no-advice:
  checkout: do not mention detach advice for explicit --detach option
2016-09-08 21:35:54 -07:00
Junio C Hamano 69307312d1 Merge branch 'rs/pull-signed-tag' into maint
When "git merge-recursive" works on history with many criss-cross
merges in "verbose" mode, the names the command assigns to the
virtual merge bases could have overwritten each other by unintended
reuse of the same piece of memory.

* rs/pull-signed-tag:
  commit: use FLEX_ARRAY in struct merge_remote_desc
  merge-recursive: fix verbose output for multiple base trees
  commit: factor out set_merge_remote_desc()
  commit: use xstrdup() in get_merge_parent()
2016-09-08 21:35:54 -07:00
Junio C Hamano 86df11b1a4 Merge branch 'js/test-lint-pathname' into maint
The "t/" hierarchy is prone to get an unusual pathname; "make test"
has been taught to make sure they do not contain paths that cannot
be checked out on Windows (and the mechanism can be reusable to
catch pathnames that are not portable to other platforms as need
arises).

* js/test-lint-pathname:
  t/Makefile: ensure that paths are valid on platforms we care
2016-09-08 21:35:54 -07:00
Junio C Hamano 8e7c580e34 Merge branch 'js/mv-dir-to-new-directory' into maint
"git mv dir non-existing-dir/" did not work in some environments
the same way as existing mainstream platforms.  The code now moves
"dir" to "non-existing-dir", without relying on rename("A", "B/")
that strips the trailing slash of '/'.

* js/mv-dir-to-new-directory:
  git mv: do not keep slash in `git mv dir non-existing-dir/`
2016-09-08 21:35:54 -07:00
Junio C Hamano 5e09f1dd30 Merge branch 'js/import-tars-hardlinks' into maint
"import-tars" fast-import script (in contrib/) used to ignore a
hardlink target and replaced it with an empty file, which has been
corrected to record the same blob as the other file the hardlink is
shared with.

* js/import-tars-hardlinks:
  import-tars: support hard links
2016-09-08 21:35:54 -07:00
Junio C Hamano c343e4919e Merge branch 'ms/document-pack-window-memory-is-per-thread' into maint
* ms/document-pack-window-memory-is-per-thread:
  document git-repack interaction of pack.threads and pack.windowMemory
2016-09-08 21:35:53 -07:00
Junio C Hamano f34d900aa7 Merge branch 'jk/push-force-with-lease-creation' into maint
"git push --force-with-lease" already had enough logic to allow
ensuring that such a push results in creation of a ref (i.e. the
receiving end did not have another push from sideways that would be
discarded by our force-pushing), but didn't expose this possibility
to the users.  It does so now.

* jk/push-force-with-lease-creation:
  t5533: make it pass on case-sensitive filesystems
  push: allow pushing new branches with --force-with-lease
  push: add shorthand for --force-with-lease branch creation
  Documentation/git-push: fix placeholder formatting
2016-09-08 21:35:53 -07:00
Junio C Hamano f59c6e6ccb Merge branch 'jk/reflog-date' into maint
The reflog output format is documented better, and a new format
--date=unix to report the seconds-since-epoch (without timezone)
has been added.

* jk/reflog-date:
  date: clarify --date=raw description
  date: add "unix" format
  date: document and test "raw-local" mode
  doc/pretty-formats: explain shortening of %gd
  doc/pretty-formats: describe index/time formats for %gd
  doc/rev-list-options: explain "-g" output formats
  doc/rev-list-options: clarify "commit@{Nth}" for "-g" option
2016-09-08 21:35:52 -07:00
Junio C Hamano 7f5885ad2a Merge branch 'jc/renormalize-merge-kill-safer-crlf' into maint
"git merge" with renormalization did not work well with
merge-recursive, due to "safer crlf" conversion kicking in when it
shouldn't.

* jc/renormalize-merge-kill-safer-crlf:
  merge: avoid "safer crlf" during recording of merge results
  convert: unify the "auto" handling of CRLF
2016-09-08 21:35:52 -07:00
Junio C Hamano faacc8efe5 Merge branch 'jk/common-main' into maint
There are certain house-keeping tasks that need to be performed at
the very beginning of any Git program, and programs that are not
built-in commands had to do them exactly the same way as "git"
potty does.  It was easy to make mistakes in one-off standalone
programs (like test helpers).  A common "main()" function that
calls cmd_main() of individual program has been introduced to
make it harder to make mistakes.

* jk/common-main:
  mingw: declare main()'s argv as const
  common-main: call git_setup_gettext()
  common-main: call restore_sigpipe_to_default()
  common-main: call sanitize_stdfds()
  common-main: call git_extract_argv0_path()
  add an extra level of indirection to main()
2016-09-08 21:35:51 -07:00
Elia Pinto 14e24114d9 t5551-http-fetch-smart.sh: use the GIT_TRACE_CURL environment var
Use the new GIT_TRACE_CURL environment variable instead
of the deprecated GIT_CURL_VERBOSE.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-07 11:41:45 -07:00
Elia Pinto 81590bf77d t5550-http-fetch-dumb.sh: use the GIT_TRACE_CURL environment var
Use the new GIT_TRACE_CURL environment variable instead
of the deprecated GIT_CURL_VERBOSE.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-07 11:41:42 -07:00
Elia Pinto 4527aa10a6 test-lib.sh: preserve GIT_TRACE_CURL from the environment
Turning on this variable can be useful when debugging http
tests. It can break a few tests in t5541 if not set
to an absolute path but it is not a variable
that the user is likely to have enabled accidentally.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-07 11:41:40 -07:00
Elia Pinto 4eee6c6ddc t5541-http-push-smart.sh: use the GIT_TRACE_CURL environment var
Use the new GIT_TRACE_CURL environment variable instead
of the deprecated GIT_CURL_VERBOSE.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-07 11:41:39 -07:00
Johannes Sixt 5babb5bdb3 t6026-merge-attr: clean up background process at end of test case
The process spawned in the hook uses the test's trash directory as CWD.
As long as it is alive, the directory cannot be removed on Windows.
Although the test succeeds, the 'test_done' that follows produces an
error message and leaves the trash directory around. Kill the process
before the test case advances.

Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-07 11:40:22 -07:00
Vasco Almeida a1277f2071 l10n: pt_PT: update Portuguese repository info
Change Portuguese l10n leadership to Vasco Almeida.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
2016-09-03 12:16:19 +00:00
Vasco Almeida bb7106334c l10n: pt_PT: update Portuguese translation
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
2016-09-03 12:02:22 +00:00
Junio C Hamano 6ebdac1bab Git 2.10
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-02 09:05:47 -07:00
Junio C Hamano 12cfa792b8 symbolic-ref -d: do not allow removal of HEAD
If you delete the symbolic-ref HEAD from a repository, Git no longer
considers the repository valid, and even "git symbolic-ref HEAD
refs/heads/master" would not be able to recover from that state
(although "git init" can, but that is a sure sign that you are
talking about a "broken" repository).

In the spirit similar to afe5d3d5 ("symbolic ref: refuse non-ref
targets in HEAD", 2009-01-29), forbid removal of HEAD to avoid
corrupting a repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-02 09:01:38 -07:00
Junio C Hamano dd39dfcf8a l10n-2.10.0-rnd2.2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXyYCAAAoJEMek6Rt1RHoouFkP/0n836xBjmhMQAd7ksJ6UrVO
 YoWMq1Qa7Ox4FLSgpmxS+Q80/vgWgI4ESN9kAoyfR4axbhaK8WzRTkR8F5LA1jmf
 0k2EXXNrJqf1LTTztx+fEleSMptMlVun0NJnHT7w0dQcXoeH9dHDbO/p7WZKCxXO
 qQ7KkmHMVW1EnO+QkUtujehfI1oUggc3Crc1pxSG1BvCyodtXYIjUD6wUN00yyeI
 PFzsPyLjk1uVUQESiiSMwr2kj5EqEKx/S8g0I+kLxiEnVCww8Or5a5TYPKG1IDiR
 jnlmCQF8Y3hoNdOyHHV2xaSPIA6OsoJcvYzmMOIDcp2IbGFnGc5ceaTQs5SlS3wP
 GTjwaA0ttYB1JOYjvojlsUIEOYNopaZvphws02iYv10kIL1gkbaBLlXj+roTJ0wP
 6huthQhjYpVu11iCBnRH8/dXwbIs2h86V5l9e5Yj/OVyK9R08LVnV0RaEWrPnwgd
 FdGC1JdOgczIE6tBMoJSRtIf1pbQiEsh0wgj+Vh0bPqB6nJJSCa605Lamhm61FyU
 eoH6pEG+14CmPMpbP8jkctj17FlIQcYaR6LyR/qBLgcYkt9EpxTH1n9RTv+C0bRx
 yR2w/uCwrhSBFmaTQW2cPKrHYdGpyBdvLXUiT1ewCEJgffFun5IT+r6Qhg7B1yXb
 AbAJfibXGeCVgZuRKIQC
 =e4TB
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.10.0-rnd2.2' of git://github.com/git-l10n/git-po

l10n-2.10.0-rnd2.2

* tag 'l10n-2.10.0-rnd2.2' of git://github.com/git-l10n/git-po:
  l10n: Updated Vietnamese translation for v2.10.0-rc2 (2757t)
2016-09-02 08:48:14 -07:00
Jiang Xin e8e349249c Merge branch 'master' of https://github.com/vnwildman/git
* 'master' of https://github.com/vnwildman/git:
  l10n: Updated Vietnamese translation for v2.10.0-rc2 (2757t)
2016-09-02 21:29:48 +08:00
Junio C Hamano 10f5c52656 submodule: avoid auto-discovery in prepare_submodule_repo_env()
The function is used to set up the environment variable used in a
subprocess we spawn in a submodule directory.  The callers set up a
child_process structure, find the working tree path of one submodule
and set .dir field to it, and then use start_command() API to spawn
the subprocess like "status", "fetch", etc.

When this happens, we expect that the ".git" (either a directory or
a gitfile that points at the real location) in the current working
directory of the subprocess MUST be the repository for the submodule.

If this ".git" thing is a corrupt repository, however, because
prepare_submodule_repo_env() unsets GIT_DIR and GIT_WORK_TREE, the
subprocess will see ".git", thinks it is not a repository, and
attempt to find one by going up, likely to end up in finding the
repository of the superproject.  In some codepaths, this will cause
a command run with the "--recurse-submodules" option to recurse
forever.

By exporting GIT_DIR=.git, disable the auto-discovery logic in the
subprocess, which would instead stop it and report an error.

The test illustrates existing problems in a few callsites of this
function.  Without this fix, "git fetch --recurse-submodules", "git
status" and "git diff" keep recursing forever.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-01 14:01:29 -07:00
Jeff King 3e1952ed96 color_parse_mem: initialize "struct color" temporary
Compiling color.c with gcc 6.2.0 using -O3 produces some
-Wmaybe-uninitialized false positives:

    color.c: In function ‘color_parse_mem’:
    color.c:189:10: warning: ‘bg.blue’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       out += xsnprintf(out, len, "%c8;2;%d;%d;%d", type,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          c->red, c->green, c->blue);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~
    color.c:208:15: note: ‘bg.blue’ was declared here
      struct color bg = { COLOR_UNSPECIFIED };
                   ^~
    [ditto for bg.green, bg.red, fg.blue, etc]

This is doubly confusing, because the declaration shows it
being initialized! Even though we do not explicitly
initialize the color components, an incomplete initializer
sets the unmentioned members to zero.

What the warning doesn't show is that we later do this:

  struct color c;
  if (!parse_color(&c, ...)) {
          if (fg.type == COLOR_UNSPECIFIED)
                fg = c;
          ...
  }

gcc is clever enough to realize that a struct assignment
from an uninitialized variable taints the destination. But
unfortunately it's _not_ clever enough to realize that we
only look at those members when type is set to COLOR_RGB, in
which case they are always initialized.

With -O2, gcc does not look into parse_color() and must
assume that "c" emerges fully initialized. With -O3, it
inlines parse_color(), and learns just enough to get
confused.

We can silence the false positive by initializing the
temporary "c". This also future-proofs us against
violating the type assumptions (the result would probably
still be buggy, but in a deterministic way).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-31 11:11:55 -07:00
Jeff King 4df5e91867 error_errno: use constant return similar to error()
Commit e208f9c (make error()'s constant return value more
visible, 2012-12-15) introduced some macro trickery to make
the constant return from error() more visible to callers,
which in turn can help gcc produce better warnings (and
possibly even better code).

Later, fd1d672 (usage.c: add warning_errno() and
error_errno(), 2016-05-08) introduced another variant, and
subsequent commits converted some uses of error() to
error_errno(), losing the magic from e208f9c for those
sites.

As a result, compiling vcs-svn/svndiff.c with "gcc -O3"
produces -Wmaybe-uninitialized false positives (at least
with gcc 6.2.0). Let's give error_errno() the same
treatment, which silences these warnings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-31 11:11:54 -07:00
Junio C Hamano 5b18e70009 A few more fixes before the final 2.10
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-31 10:21:05 -07:00