Commit graph

48208 commits

Author SHA1 Message Date
Michael Haggerty ac7da78ede for_each_string_list_item: avoid undefined behavior for empty list
If you pass a newly initialized or newly cleared `string_list` to
`for_each_string_list_item()`, then the latter does

    for (
            item = (list)->items; /* NULL */
            item < (list)->items + (list)->nr; /* NULL + 0 */
            ++item)

Even though this probably works almost everywhere, it is undefined
behavior, and it could plausibly cause highly-optimizing compilers to
misbehave.  C99 section 6.5.6 paragraph 8 explains:

    If both the pointer operand and the result point to elements
    of the same array object, or one past the last element of the
    array object, the evaluation shall not produce an overflow;
    otherwise, the behavior is undefined.

and (6.3.2.3.3) a null pointer does not point to anything.

Guard the loop with a NULL check to make the intent crystal clear to
even the most pedantic compiler.  A suitably clever compiler could let
the NULL check only run in the first iteration, but regardless, this
overhead is likely to be dwarfed by the work to be done on each item.

This problem was noticed by Coverity.

[jn: using a NULL check instead of a placeholder empty list;
 fleshed out the commit message based on mailing list discussion]

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-20 14:41:08 +09:00
Junio C Hamano 94c9fd268d RelNotes: further fixes for 2.14.2 from the master front
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-10 17:06:09 +09:00
Junio C Hamano 60f4851bb2 Merge branch 'jt/doc-pack-objects-fix' into maint
Doc updates.

* jt/doc-pack-objects-fix:
  Doc: clarify that pack-objects makes packs, plural
2017-09-10 17:03:10 +09:00
Junio C Hamano 8134746d1d Merge branch 'jn/vcs-svn-cleanup' into maint
Code clean-up.

* jn/vcs-svn-cleanup:
  vcs-svn: move remaining repo_tree functions to fast_export.h
  vcs-svn: remove repo_delete wrapper function
  vcs-svn: remove custom mode constants
  vcs-svn: remove more unused prototypes and declarations
2017-09-10 17:03:09 +09:00
Junio C Hamano 044aa0eb7f Merge branch 'bc/vcs-svn-cleanup' into maint
Code clean-up.

* bc/vcs-svn-cleanup:
  vcs-svn: rename repo functions to "svn_repo"
  vcs-svn: remove unused prototypes
2017-09-10 17:03:08 +09:00
Junio C Hamano 5e03ae4594 Merge branch 'jk/doc-the-this' into maint
Doc clean-up.

* jk/doc-the-this:
  doc: fix typo in sendemail.identity
2017-09-10 17:03:07 +09:00
Junio C Hamano 02a19e9a48 Merge branch 'rs/commit-h-single-parent-cleanup' into maint
Code clean-up.

* rs/commit-h-single-parent-cleanup:
  commit: remove unused inline function single_parent()
2017-09-10 17:03:07 +09:00
Junio C Hamano d2ef4bedf9 Merge branch 'mg/format-ref-doc-fix' into maint
Doc fix.

* mg/format-ref-doc-fix:
  Documentation/git-for-each-ref: clarify peeling of tags for --format
  Documentation: use proper wording for ref format strings
2017-09-10 17:03:06 +09:00
Junio C Hamano 95d25c412d Merge branch 'sb/submodule-parallel-update' into maint
Code clean-up.

* sb/submodule-parallel-update:
  submodule.sh: remove unused variable
2017-09-10 17:03:06 +09:00
Junio C Hamano b3c2280960 Merge branch 'hv/t5526-andand-chain-fix' into maint
Test fix.

* hv/t5526-andand-chain-fix:
  t5526: fix some broken && chains
2017-09-10 17:03:05 +09:00
Junio C Hamano f04f860dfa Merge branch 'sb/sha1-file-cleanup' into maint
Code clean-up.

* sb/sha1-file-cleanup:
  sha1_file: make read_info_alternates static
2017-09-10 17:03:04 +09:00
Junio C Hamano 1a8a328654 Merge branch 'rs/t1002-do-not-use-sum' into maint
Test simplification.

* rs/t1002-do-not-use-sum:
  t1002: stop using sum(1)
2017-09-10 17:03:04 +09:00
Junio C Hamano b438722c06 Merge branch 'ah/doc-empty-string-is-false' into maint
Doc update.

* ah/doc-empty-string-is-false:
  doc: clarify "config --bool" behaviour with empty string
2017-09-10 17:03:03 +09:00
Junio C Hamano afa6608b93 Merge branch 'rs/merge-microcleanup' into maint
Code clean-up.

* rs/merge-microcleanup:
  merge: use skip_prefix()
2017-09-10 17:03:02 +09:00
Junio C Hamano c580ce194f Merge branch 'rs/find-pack-entry-bisection' into maint
Code clean-up.

* rs/find-pack-entry-bisection:
  sha1_file: avoid comparison if no packed hash matches the first byte
2017-09-10 17:03:02 +09:00
Junio C Hamano c7759cd60a Merge branch 'rs/apply-lose-prefix-length' into maint
Code clean-up.

* rs/apply-lose-prefix-length:
  apply: remove prefix_length member from apply_state
2017-09-10 17:03:01 +09:00
Junio C Hamano 70def2c47f Merge branch 'rj/add-chmod-error-message' into maint
Message fix.

* rj/add-chmod-error-message:
  builtin/add: add detail to a 'cannot chmod' error message
2017-09-10 17:03:00 +09:00
Junio C Hamano 822a4d4178 Merge branch 'jk/hashcmp-memcmp' into maint
Code clean-up.

* jk/hashcmp-memcmp:
  hashcmp: use memcmp instead of open-coded loop
2017-09-10 17:02:59 +09:00
Junio C Hamano f35a1d75b5 Merge branch 'rs/t3700-clean-leftover' into maint
A test fix.

* rs/t3700-clean-leftover:
  t3700: fix broken test under !POSIXPERM
2017-09-10 17:02:58 +09:00
Junio C Hamano 8f3d48e14e Merge branch 'jc/perl-git-comment-typofix' into maint
A comment fix.

* jc/perl-git-comment-typofix:
  perl/Git.pm: typofix in a comment
2017-09-10 17:02:57 +09:00
Junio C Hamano 036e1274a2 Merge branch 'mf/no-dashed-subcommands' into maint
Code clean-up.

* mf/no-dashed-subcommands:
  scripts: use "git foo" not "git-foo"
2017-09-10 17:02:56 +09:00
Junio C Hamano 1eb539a9b3 Merge branch 'ab/ref-filter-no-contains' into maint
A test fix.

* ab/ref-filter-no-contains:
  tests: don't give unportable ">" to "test" built-in, use -gt
2017-09-10 17:02:56 +09:00
Junio C Hamano ea8bf00095 Merge branch 'rs/archive-excluded-directory' into maint
"git archive" did not work well with pathspecs and the
export-ignore attribute.

We may want to resurrect the "we don't archive an empty directory"
bonus patch, but I do not mind merging the above early to 'next'
and leave it as a separate follow-up enhancement.
cf. <20170820090629.tumvqwzkromcykjf@sigill.intra.peff.net>

* rs/archive-excluded-directory:
  archive: don't queue excluded directories
  archive: factor out helper functions for handling attributes
  t5001: add tests for export-ignore attributes and exclude pathspecs
2017-09-10 17:02:55 +09:00
Junio C Hamano 78ad09403c Merge branch 'mg/killed-merge' into maint
Killing "git merge --edit" before the editor returns control left
the repository in a state with MERGE_MSG but without MERGE_HEAD,
which incorrectly tells the subsequent "git commit" that there was
a squash merge in progress.  This has been fixed.

* mg/killed-merge:
  merge: save merge state earlier
  merge: split write_merge_state in two
  merge: clarify call chain
  Documentation/git-merge: explain --continue
2017-09-10 17:02:55 +09:00
Junio C Hamano 648a50a08a Merge branch 'tb/apply-with-crlf' into maint
"git apply" that is used as a better "patch -p1" failed to apply a
taken from a file with CRLF line endings to a file with CRLF line
endings.  The root cause was because it misused convert_to_git()
that tried to do "safe-crlf" processing by looking at the index
entry at the same path, which is a nonsense---in that mode, "apply"
is not working on the data in (or derived from) the index at all.
This has been fixed.

* tb/apply-with-crlf:
  apply: file commited with CRLF should roundtrip diff and apply
  convert: add SAFE_CRLF_KEEP_CRLF
2017-09-10 17:02:55 +09:00
Junio C Hamano 27015b4f95 Merge branch 'cc/subprocess-handshake-missing-capabilities' into maint
When handshake with a subprocess filter notices that the process
asked for an unknown capability, Git did not report what program
the offending subprocess was running.  This has been corrected.

We may want a follow-up fix to tighten the error checking, though.

* cc/subprocess-handshake-missing-capabilities:
  sub-process: print the cmd when a capability is unsupported
2017-09-10 17:02:55 +09:00
Junio C Hamano f1b64e8e64 Merge branch 'as/grep-quiet-no-match-exit-code-fix' into maint
"git grep -L" and "git grep --quiet -L" reported different exit
codes; this has been corrected.

* as/grep-quiet-no-match-exit-code-fix:
  git-grep: correct exit code with --quiet and -L
2017-09-10 17:02:55 +09:00
Junio C Hamano 8388f986b6 Merge branch 'kd/stash-with-bash-4.4' into maint
bash 4.4 or newer gave a warning on NUL byte in command
substitution done in "git stash"; this has been squelched.

* kd/stash-with-bash-4.4:
  stash: prevent warning about null bytes in input
2017-09-10 17:02:54 +09:00
Junio C Hamano fbded00b0d Merge branch 'rs/win32-syslog-leakfix' into maint
Memory leak in an error codepath has been plugged.

* rs/win32-syslog-leakfix:
  win32: plug memory leak on realloc() failure in syslog()
2017-09-10 17:02:54 +09:00
Junio C Hamano 438776e3d4 Merge branch 'rs/unpack-entry-leakfix' into maint
Memory leak in an error codepath has been plugged.

* rs/unpack-entry-leakfix:
  sha1_file: release delta_stack on error in unpack_entry()
2017-09-10 17:02:53 +09:00
Junio C Hamano c3b931e162 Merge branch 'rs/fsck-obj-leakfix' into maint
Memory leak in an error codepath has been plugged.

* rs/fsck-obj-leakfix:
  fsck: free buffers on error in fsck_obj()
2017-09-10 17:02:53 +09:00
Junio C Hamano e0d52ec4ab Merge branch 'ur/svn-local-zone' into maint
"git svn" used with "--localtime" option did not compute the tz
offset for the timestamp in question and instead always used the
current time, which has been corrected.

* ur/svn-local-zone:
  git svn fetch: Create correct commit timestamp when using --localtime
2017-09-10 17:02:52 +09:00
Junio C Hamano 00fd0afefd Merge branch 'pw/am-signoff' into maint
"git am -s" has been taught that some input may end with a trailer
block that is not Signed-off-by: and it should refrain from adding
an extra blank line before adding a new sign-off in such a case.

* pw/am-signoff:
  am: fix signoff when other trailers are present
2017-09-10 17:02:51 +09:00
Junio C Hamano 0f80fb185e Merge branch 'rs/in-obsd-basename-dirname-take-const' into maint
Portability fix.

* rs/in-obsd-basename-dirname-take-const:
  test-path-utils: handle const parameter of basename and dirname
2017-09-10 17:02:51 +09:00
Junio C Hamano b3a19e060c Merge branch 'rs/t4062-obsd' into maint
Test portability fix.

* rs/t4062-obsd:
  t4062: use less than 256 repetitions in regex
2017-09-10 17:02:51 +09:00
Junio C Hamano c2e19411a7 Merge branch 'rs/obsd-getcwd-workaround' into maint
Test portability fix for BSDs.

* rs/obsd-getcwd-workaround:
  t0001: skip test with restrictive permissions if getpwd(3) respects them
2017-09-10 17:02:50 +09:00
Junio C Hamano 277194a280 Merge branch 'bw/clone-recursive-quiet' into maint
"git clone --recurse-submodules --quiet" did not pass the quiet
option down to submodules.

* bw/clone-recursive-quiet:
  clone: teach recursive clones to respect -q
2017-09-10 17:02:49 +09:00
Junio C Hamano 86c726f0d1 Merge branch 'pw/sequence-rerere-autoupdate' into maint
Commands like "git rebase" accepted the --rerere-autoupdate option
from the command line, but did not always use it.  This has been
fixed.

* pw/sequence-rerere-autoupdate:
  cherry-pick/revert: reject --rerere-autoupdate when continuing
  cherry-pick/revert: remember --rerere-autoupdate
  t3504: use test_commit
  rebase -i: honor --rerere-autoupdate
  rebase: honor --rerere-autoupdate
  am: remember --rerere-autoupdate setting
2017-09-10 17:02:49 +09:00
Junio C Hamano eba2a68f25 Merge branch 'bw/push-options-recursively-to-submodules' into maint
"git push --recurse-submodules $there HEAD:$target" was not
propagated down to the submodules, but now it is.

* bw/push-options-recursively-to-submodules:
  submodule--helper: teach push-check to handle HEAD
2017-09-10 17:02:49 +09:00
Junio C Hamano 702239d049 Merge branch 'ma/pager-per-subcommand-action' into maint
The "tag.pager" configuration variable was useless for those who
actually create tag objects, as it interfered with the use of an
editor.  A new mechanism has been introduced for commands to enable
pager depending on what operation is being carried out to fix this,
and then "git tag -l" is made to run pager by default.

If this works out OK, I think there are low-hanging fruits in
other commands like "git branch" that outputs long list in one mode
while taking input in another.

* ma/pager-per-subcommand-action:
  git.c: ignore pager.* when launching builtin as dashed external
  tag: change default of `pager.tag` to "on"
  tag: respect `pager.tag` in list-mode only
  t7006: add tests for how git tag paginates
  git.c: provide setup_auto_pager()
  git.c: let builtins opt for handling `pager.foo` themselves
  builtin.h: take over documentation from api-builtin.txt
2017-09-10 17:02:48 +09:00
Junio C Hamano c2a3bb47f0 Merge branch 'jk/rev-list-empty-input' into maint
"git log --tag=no-such-tag" showed log starting from HEAD, which
has been fixed---it now shows nothing.

* jk/rev-list-empty-input:
  revision: do not fallback to default when rev_input_given is set
  rev-list: don't show usage when we see empty ref patterns
  revision: add rev_input_given flag
  t6018: flesh out empty input/output rev-list tests
2017-09-10 17:02:48 +09:00
Junio C Hamano 638eb4e701 Merge branch 'st/lib-gpg-kill-stray-agent' into maint
Some versions of GnuPG fails to kill gpg-agent it auto-spawned
and such a left-over agent can interfere with a test.  Work it
around by attempting to kill one before starting a new test.

* st/lib-gpg-kill-stray-agent:
  t: lib-gpg: flush gpg agent on startup
2017-09-10 17:02:48 +09:00
Junio C Hamano edc74bc7f0 Prepare for 2.14.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-23 14:36:03 -07:00
Junio C Hamano 0f41b92c79 Merge branch 'jt/t1450-fsck-corrupt-packfile' into maint
A test update.

* jt/t1450-fsck-corrupt-packfile:
  tests: ensure fsck fails on corrupt packfiles
2017-08-23 14:33:52 -07:00
Junio C Hamano 86bf8e45b2 Merge branch 'jb/t8008-cleanup' into maint
Code clean-up.

* jb/t8008-cleanup:
  t8008: rely on rev-parse'd HEAD instead of sha1 value
2017-08-23 14:33:52 -07:00
Junio C Hamano df2dd28316 Merge branch 'jt/subprocess-handshake' into maint
Code cleanup.

* jt/subprocess-handshake:
  sub-process: refactor handshake to common function
  Documentation: migrate sub-process docs to header
  convert: add "status=delayed" to filter process protocol
  convert: refactor capabilities negotiation
  convert: move multiple file filter error handling to separate function
  convert: put the flags field before the flag itself for consistent style
  t0021: write "OUT <size>" only on success
  t0021: make debug log file name configurable
  t0021: keep filter log files on comparison
2017-08-23 14:33:52 -07:00
Junio C Hamano de55703672 Merge branch 'dc/fmt-merge-msg-microcleanup' into maint
Code cleanup.

* dc/fmt-merge-msg-microcleanup:
  fmt-merge-msg: fix coding style
2017-08-23 14:33:52 -07:00
Junio C Hamano b55b936038 Merge branch 'ah/doc-wserrorhighlight' into maint
Doc update.

* ah/doc-wserrorhighlight:
  doc: add missing values "none" and "default" for diff.wsErrorHighlight
2017-08-23 14:33:51 -07:00
Junio C Hamano d0dffcacf3 Merge branch 'cc/ref-is-hidden-microcleanup' into maint
Code cleanup.

* cc/ref-is-hidden-microcleanup:
  refs: use skip_prefix() in ref_is_hidden()
2017-08-23 14:33:50 -07:00
Junio C Hamano 0869277033 Merge branch 'js/run-process-parallel-api-fix' into maint
API fix.

* js/run-process-parallel-api-fix:
  run_processes_parallel: change confusing task_cb convention
2017-08-23 14:33:49 -07:00