]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
5 years agoMerge branch 'jk/xmalloc'
Junio C Hamano [Thu, 25 Apr 2019 07:41:23 +0000 (16:41 +0900)] 
Merge branch 'jk/xmalloc'

The code is updated to check the result of memory allocation before
it is used in more places, by using xmalloc and/or xcalloc calls.

* jk/xmalloc:
  progress: use xmalloc/xcalloc
  xdiff: use xmalloc/xrealloc
  xdiff: use git-compat-util
  test-prio-queue: use xmalloc

5 years agoMerge branch 'km/t3000-retitle'
Junio C Hamano [Thu, 25 Apr 2019 07:41:22 +0000 (16:41 +0900)] 
Merge branch 'km/t3000-retitle'

A test update.

* km/t3000-retitle:
  t3000 (ls-files -o): widen description to reflect current tests

5 years agoMerge branch 'js/untracked-cache-allocfix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:22 +0000 (16:41 +0900)] 
Merge branch 'js/untracked-cache-allocfix'

An underallocation in the code to read the untracked cache
extension has been corrected.

* js/untracked-cache-allocfix:
  untracked cache: fix off-by-one

5 years agoMerge branch 'js/t3301-unbreak-notes-test'
Junio C Hamano [Thu, 25 Apr 2019 07:41:21 +0000 (16:41 +0900)] 
Merge branch 'js/t3301-unbreak-notes-test'

Test fix.

* js/t3301-unbreak-notes-test:
  t3301: fix false negative

5 years agoMerge branch 'tz/doc-apostrophe-no-longer-needed'
Junio C Hamano [Thu, 25 Apr 2019 07:41:21 +0000 (16:41 +0900)] 
Merge branch 'tz/doc-apostrophe-no-longer-needed'

Doc formatting fix.

* tz/doc-apostrophe-no-longer-needed:
  Documentation/git-show-branch: avoid literal {apostrophe}

5 years agoMerge branch 'sg/blame-in-bare-start-at-head'
Junio C Hamano [Thu, 25 Apr 2019 07:41:21 +0000 (16:41 +0900)] 
Merge branch 'sg/blame-in-bare-start-at-head'

"git blame -- path" in a non-bare repository starts blaming from
the working tree, and the same command in a bare repository errors
out because there is no working tree by definition.  The command
has been taught to instead start blaming from the commit at HEAD,
which is more useful.

* sg/blame-in-bare-start-at-head:
  blame: default to HEAD in a bare repo when no start commit is given

5 years agoMerge branch 'tg/ls-files-debug-format-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:20 +0000 (16:41 +0900)] 
Merge branch 'tg/ls-files-debug-format-fix'

Debugging code fix.

* tg/ls-files-debug-format-fix:
  ls-files: use correct format string

5 years agoMerge branch 'po/describe-not-necessarily-7'
Junio C Hamano [Thu, 25 Apr 2019 07:41:20 +0000 (16:41 +0900)] 
Merge branch 'po/describe-not-necessarily-7'

Docfix.

* po/describe-not-necessarily-7:
  describe doc: remove '7-char' abbreviation reference

5 years agoMerge branch 'po/rerere-doc-fmt'
Junio C Hamano [Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)] 
Merge branch 'po/rerere-doc-fmt'

Docfix.

* po/rerere-doc-fmt:
  rerere doc: quote `rerere.enabled`

5 years agoMerge branch 'sg/overlong-progress-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)] 
Merge branch 'sg/overlong-progress-fix'

Updating the display with progress message has been cleaned up to
deal better with overlong messages.

* sg/overlong-progress-fix:
  progress: break too long progress bar lines
  progress: clear previous progress update dynamically
  progress: assemble percentage and counters in a strbuf before printing
  progress: make display_progress() return void

5 years agoMerge branch 'jt/batch-fetch-blobs-in-diff'
Junio C Hamano [Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)] 
Merge branch 'jt/batch-fetch-blobs-in-diff'

While running "git diff" in a lazy clone, we can upfront know which
missing blobs we will need, instead of waiting for the on-demand
machinery to discover them one by one.  Aim to achieve better
performance by batching the request for these promised blobs.

* jt/batch-fetch-blobs-in-diff:
  diff: batch fetching of missing blobs
  sha1-file: support OBJECT_INFO_FOR_PREFETCH

5 years agoMerge branch 'ab/gc-docs'
Junio C Hamano [Thu, 25 Apr 2019 07:41:18 +0000 (16:41 +0900)] 
Merge branch 'ab/gc-docs'

Update docs around "gc".

* ab/gc-docs:
  gc docs: remove incorrect reference to gc.auto=0
  gc docs: clarify that "gc" doesn't throw away referenced objects
  gc docs: note "gc --aggressive" in "fast-import"
  gc docs: downplay the usefulness of --aggressive
  gc docs: note how --aggressive impacts --window & --depth
  gc docs: fix formatting for "gc.writeCommitGraph"
  gc docs: re-flow the "gc.*" section in "config"
  gc docs: include the "gc.*" section from "config" in "gc"
  gc docs: clean grammar for "gc.bigPackThreshold"
  gc docs: stop noting "repack" flags
  gc docs: modernize the advice for manually running "gc"

5 years agoMerge branch 'dl/submodule-set-branch'
Junio C Hamano [Thu, 25 Apr 2019 07:41:18 +0000 (16:41 +0900)] 
Merge branch 'dl/submodule-set-branch'

"git submodule" learns "set-branch" subcommand that allows the
submodule.*.branch settings to be modified.

* dl/submodule-set-branch:
  submodule: teach set-branch subcommand
  submodule--helper: teach config subcommand --unset
  git-submodule.txt: "--branch <branch>" option defaults to 'master'

5 years agoMerge branch 'jk/revision-rewritten-parents-in-prio-queue'
Junio C Hamano [Thu, 25 Apr 2019 07:41:18 +0000 (16:41 +0900)] 
Merge branch 'jk/revision-rewritten-parents-in-prio-queue'

Performance fix for "rev-list --parents -- pathspec".

* jk/revision-rewritten-parents-in-prio-queue:
  revision: use a prio_queue to hold rewritten parents

5 years agoMerge branch 'dk/blame-keep-origin-blob'
Junio C Hamano [Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)] 
Merge branch 'dk/blame-keep-origin-blob'

Performance fix around "git blame", especially in a linear history
(which is the norm we should optimize for).

* dk/blame-keep-origin-blob:
  blame.c: don't drop origin blobs as eagerly

5 years agoMerge branch 'bc/hash-transition-16'
Junio C Hamano [Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)] 
Merge branch 'bc/hash-transition-16'

Conversion from unsigned char[20] to struct object_id continues.

* bc/hash-transition-16: (35 commits)
  gitweb: make hash size independent
  Git.pm: make hash size independent
  read-cache: read data in a hash-independent way
  dir: make untracked cache extension hash size independent
  builtin/difftool: use parse_oid_hex
  refspec: make hash size independent
  archive: convert struct archiver_args to object_id
  builtin/get-tar-commit-id: make hash size independent
  get-tar-commit-id: parse comment record
  hash: add a function to lookup hash algorithm by length
  remote-curl: make hash size independent
  http: replace sha1_to_hex
  http: compute hash of downloaded objects using the_hash_algo
  http: replace hard-coded constant with the_hash_algo
  http-walker: replace sha1_to_hex
  http-push: remove remaining uses of sha1_to_hex
  http-backend: allow 64-character hex names
  http-push: convert to use the_hash_algo
  builtin/pull: make hash-size independent
  builtin/am: make hash size independent
  ...

5 years agoMerge branch 'en/fast-import-parsing-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:16 +0000 (16:41 +0900)] 
Merge branch 'en/fast-import-parsing-fix'

"git fast-import" update.

* en/fast-import-parsing-fix:
  fast-import: fix erroneous handling of get-mark with empty orphan commits
  fast-import: only allow cat-blob requests where it makes sense
  fast-import: check most prominent commands first
  git-fast-import.txt: fix wording about where ls command can appear
  t9300: demonstrate bug with get-mark and empty orphan commits

5 years agoMerge branch 'jt/fetch-no-update-shallow-in-proto-v2'
Junio C Hamano [Thu, 25 Apr 2019 07:41:16 +0000 (16:41 +0900)] 
Merge branch 'jt/fetch-no-update-shallow-in-proto-v2'

Fix for protocol v2 support in "git fetch-pack" of shallow clones.

* jt/fetch-no-update-shallow-in-proto-v2:
  fetch-pack: respect --no-update-shallow in v2
  fetch-pack: call prepare_shallow_info only if v0

5 years agoMerge branch 'jt/fetch-pack-wanted-refs-optim'
Junio C Hamano [Thu, 25 Apr 2019 07:41:16 +0000 (16:41 +0900)] 
Merge branch 'jt/fetch-pack-wanted-refs-optim'

Performance fix around "git fetch" that grabs many refs.

* jt/fetch-pack-wanted-refs-optim:
  fetch-pack: binary search when storing wanted-refs

5 years agoMerge branch 'ab/test-lib-pass-trace2-env'
Junio C Hamano [Thu, 25 Apr 2019 07:41:15 +0000 (16:41 +0900)] 
Merge branch 'ab/test-lib-pass-trace2-env'

Allow tracing of Git executable while running the testsuite.

* ab/test-lib-pass-trace2-env:
  test-lib: whitelist GIT_TR2_* in the environment

5 years agoMerge branch 'sg/index-pack-progress'
Junio C Hamano [Thu, 25 Apr 2019 07:41:15 +0000 (16:41 +0900)] 
Merge branch 'sg/index-pack-progress'

A progress indicator has been added to the "index-pack" step, which
often makes users wait for completion during "git clone".

* sg/index-pack-progress:
  index-pack: show progress while checking objects

5 years agoMerge branch 'ab/commit-graph-fixes'
Junio C Hamano [Thu, 25 Apr 2019 07:41:15 +0000 (16:41 +0900)] 
Merge branch 'ab/commit-graph-fixes'

Code cleanup with more careful error checking before using data
read from the commit-graph file.

* ab/commit-graph-fixes:
  commit-graph: improve & i18n error messages
  commit-graph write: don't die if the existing graph is corrupt
  commit-graph verify: detect inability to read the graph
  commit-graph: don't pass filename to load_commit_graph_one_fd_st()
  commit-graph: don't early exit(1) on e.g. "git status"
  commit-graph: fix segfault on e.g. "git status"
  commit-graph tests: test a graph that's too small
  commit-graph tests: split up corrupt_graph_and_verify()

5 years agoMerge branch 'ab/gc-reflog'
Junio C Hamano [Thu, 25 Apr 2019 07:41:14 +0000 (16:41 +0900)] 
Merge branch 'ab/gc-reflog'

Fix various glitches in "git gc" around reflog handling.

* ab/gc-reflog:
  gc: handle & check gc.reflogExpire config
  reflog tests: assert lack of early exit with expiry="never"
  reflog tests: test for the "points nowhere" warning
  reflog tests: make use of "test_config" idiom
  gc: refactor a "call me once" pattern
  gc: convert to using the_hash_algo
  gc: remove redundant check for gc_auto_threshold

5 years agoMerge branch 'nd/checkout-m'
Junio C Hamano [Thu, 25 Apr 2019 07:41:14 +0000 (16:41 +0900)] 
Merge branch 'nd/checkout-m'

"git checkout -m <other>" was about carrying the differences
between HEAD and the working-tree files forward while checking out
another branch, and ignored the differences between HEAD and the
index.  The command has been taught to abort when the index and the
HEAD are different.

* nd/checkout-m:
  checkout: prevent losing staged changes with --merge
  read-tree: add --quiet
  unpack-trees: rename "gently" flag to "quiet"
  unpack-trees: keep gently check inside add_rejected_path

5 years agoMerge branch 'js/difftool-no-index'
Junio C Hamano [Thu, 25 Apr 2019 07:41:14 +0000 (16:41 +0900)] 
Merge branch 'js/difftool-no-index'

"git difftool" can now run outside a repository.

* js/difftool-no-index:
  difftool: allow running outside Git worktrees with --no-index
  parse-options: make OPT_ARGUMENT() more useful
  difftool: remove obsolete (and misleading) comment

5 years agoMerge branch 'pw/cherry-pick-continue'
Junio C Hamano [Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)] 
Merge branch 'pw/cherry-pick-continue'

"git cherry-pick --options A..B", after giving control back to the
user to ask help resolving a conflicted step, did not honor the
options it originally received, which has been corrected.

* pw/cherry-pick-continue:
  cherry-pick --continue: remember options
  cherry-pick: demonstrate option amnesia
  sequencer: break some long lines

5 years agoMerge branch 'nd/commit-a-with-paths-msg-update'
Junio C Hamano [Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)] 
Merge branch 'nd/commit-a-with-paths-msg-update'

The message given when "git commit -a <paths>" errors out has been
updated.

* nd/commit-a-with-paths-msg-update:
  commit: improve error message in "-a <paths>" case

5 years agoMerge branch 'jk/server-info-rabbit-hole'
Junio C Hamano [Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)] 
Merge branch 'jk/server-info-rabbit-hole'

Code clean-up around a much-less-important-than-it-used-to-be
update_server_info() funtion.

* jk/server-info-rabbit-hole:
  update_info_refs(): drop unused force parameter
  server-info: drop objdirlen pointer arithmetic
  server-info: drop nr_alloc struct member
  server-info: use strbuf to read old info/packs file
  server-info: simplify cleanup in parse_pack_def()
  server-info: fix blind pointer arithmetic
  http: simplify parsing of remote objects/info/packs
  packfile: fix pack basename computation
  midx: check both pack and index names for containment
  t5319: drop useless --buffer from cat-file
  t5319: fix bogus cat-file argument
  pack-revindex: open index if necessary
  packfile.h: drop extern from function declarations

5 years agoMerge branch 'nd/diff-parseopt-4'
Junio C Hamano [Thu, 25 Apr 2019 07:41:12 +0000 (16:41 +0900)] 
Merge branch 'nd/diff-parseopt-4'

Fourth batch to teach the diff machinery to use the parse-options
API.

* nd/diff-parseopt-4:
  am: avoid diff_opt_parse()
  diff --no-index: use parse_options() instead of diff_opt_parse()
  range-diff: use parse_options() instead of diff_opt_parse()
  diff.c: allow --no-color-moved-ws
  diff-parseopt: convert --color-moved-ws
  diff-parseopt: convert --[no-]color-moved
  diff-parseopt: convert --inter-hunk-context
  diff-parseopt: convert --no-prefix
  diff-parseopt: convert --line-prefix
  diff-parseopt: convert --[src|dst]-prefix
  diff-parseopt: convert --[no-]abbrev
  diff-parseopt: convert --diff-filter
  diff-parseopt: convert --find-object
  diff-parseopt: convert -O
  diff-parseopt: convert --pickaxe-all|--pickaxe-regex
  diff-parseopt: convert -S|-G
  diff-parseopt: convert -l
  diff-parseopt: convert -z
  diff-parseopt: convert --ita-[in]visible-in-index
  diff-parseopt: convert --ws-error-highlight

5 years agoMerge branch 'jk/unused-params-even-more'
Junio C Hamano [Thu, 25 Apr 2019 07:41:12 +0000 (16:41 +0900)] 
Merge branch 'jk/unused-params-even-more'

Code cleanup.

* jk/unused-params-even-more:
  parse_opt_ref_sorting: always use with NONEG flag
  pretty: drop unused strbuf from parse_padding_placeholder()
  pretty: drop unused "type" parameter in needs_rfc2047_encoding()
  parse-options: drop unused ctx parameter from show_gitcomp()
  fetch_pack(): drop unused parameters
  report_path_error(): drop unused prefix parameter
  unpack-trees: drop unused error_type parameters
  unpack-trees: drop name_entry from traverse_by_cache_tree()
  test-date: drop unused "now" parameter from parse_dates()
  update-index: drop unused prefix_length parameter from do_reupdate()
  log: drop unused "len" from show_tagger()
  log: drop unused rev_info from early output
  revision: drop some unused "revs" parameters

5 years agoMerge branch 'sg/test-atexit'
Junio C Hamano [Thu, 25 Apr 2019 07:41:12 +0000 (16:41 +0900)] 
Merge branch 'sg/test-atexit'

Test framework update to more robustly clean up leftover files and
processes after tests are done.

* sg/test-atexit:
  t9811-git-p4-label-import: fix pipeline negation
  git p4 test: disable '-x' tracing in the p4d watchdog loop
  git p4 test: simplify timeout handling
  git p4 test: clean up the p4d cleanup functions
  git p4 test: use 'test_atexit' to kill p4d and the watchdog process
  t0301-credential-cache: use 'test_atexit' to stop the credentials helper
  tests: use 'test_atexit' to stop httpd
  git-daemon: use 'test_atexit` to stop 'git-daemon'
  test-lib: introduce 'test_atexit'
  t/lib-git-daemon: make sure to kill the 'git-daemon' process
  test-lib: fix interrupt handling with 'dash' and '--verbose-log -x'

5 years agoMerge branch 'ag/sequencer-reduce-rewriting-todo'
Junio C Hamano [Thu, 25 Apr 2019 07:41:11 +0000 (16:41 +0900)] 
Merge branch 'ag/sequencer-reduce-rewriting-todo'

The scripted version of "git rebase -i" wrote and rewrote the todo
list many times during a single step of its operation, and the
recent C-rewrite made a faithful conversion of the logic to C.  The
implementation has been updated to carry necessary information
around in-core to avoid rewriting the same file over and over
unnecessarily.

* ag/sequencer-reduce-rewriting-todo:
  rebase--interactive: move transform_todo_file()
  sequencer: use edit_todo_list() in complete_action()
  rebase-interactive: rewrite edit_todo_list() to handle the initial edit
  rebase-interactive: append_todo_help() changes
  rebase-interactive: use todo_list_write_to_file() in edit_todo_list()
  sequencer: refactor skip_unnecessary_picks() to work on a todo_list
  rebase--interactive: move rearrange_squash_in_todo_file()
  rebase--interactive: move sequencer_add_exec_commands()
  sequencer: change complete_action() to use the refactored functions
  sequencer: make sequencer_make_script() write its script to a strbuf
  sequencer: refactor rearrange_squash() to work on a todo_list
  sequencer: refactor sequencer_add_exec_commands() to work on a todo_list
  sequencer: refactor check_todo_list() to work on a todo_list
  sequencer: introduce todo_list_write_to_file()
  sequencer: refactor transform_todos() to work on a todo_list
  sequencer: remove the 'arg' field from todo_item
  sequencer: make the todo_list structure public
  sequencer: changes in parse_insn_buffer()

5 years agoMerge branch 'bp/post-index-change-hook'
Junio C Hamano [Thu, 25 Apr 2019 07:41:10 +0000 (16:41 +0900)] 
Merge branch 'bp/post-index-change-hook'

A new hook "post-index-change" is called when the on-disk index
file changes, which can help e.g. a virtualized working tree
implementation.

* bp/post-index-change-hook:
  read-cache: add post-index-change hook

5 years agoThe sixth batch
Junio C Hamano [Mon, 22 Apr 2019 02:14:24 +0000 (11:14 +0900)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'da/smerge'
Junio C Hamano [Mon, 22 Apr 2019 02:14:48 +0000 (11:14 +0900)] 
Merge branch 'da/smerge'

"git mergetool" learned to offer Sublime Merge (smerge) as one of
its backends.

* da/smerge:
  contrib/completion: add smerge to the mergetool completion candidates
  mergetools: add support for smerge (Sublime Merge)

5 years agoMerge branch 'dl/flex-str-cocci'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'dl/flex-str-cocci'

Code clean-up.

* dl/flex-str-cocci:
  cocci: FLEX_ALLOC_MEM to FLEX_ALLOC_STR
  midx.c: convert FLEX_ALLOC_MEM to FLEX_ALLOC_STR

5 years agoMerge branch 'js/spell-out-options-in-tests'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'js/spell-out-options-in-tests'

The tests have been updated not to rely on the abbreviated option
names the parse-options API offers, to protect us from an
abbreviated form of an option that used to be unique within the
command getting non-unique when a new option that share the same
prefix is added.

* js/spell-out-options-in-tests:
  tests: disallow the use of abbreviated options (by default)
  tests (pack-objects): use the full, unabbreviated `--revs` option
  tests (status): spell out the `--find-renames` option in full
  tests (push): do not abbreviate the `--follow-tags` option
  t5531: avoid using an abbreviated option
  t7810: do not abbreviate `--no-exclude-standard` nor `--invert-match`
  tests (rebase): spell out the `--force-rebase` option
  tests (rebase): spell out the `--keep-empty` option

5 years agoMerge branch 'nd/read-tree-reset-doc'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'nd/read-tree-reset-doc'

The documentation for "git read-tree --reset -u" has been updated.

* nd/read-tree-reset-doc:
  read-tree.txt: clarify --reset and worktree changes

5 years agoMerge branch 'nd/interpret-trailers-docfix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'nd/interpret-trailers-docfix'

Doc update.

* nd/interpret-trailers-docfix:
  interpret-trailers.txt: start the desc line with a capital letter

5 years agoMerge branch 'sg/asciidoctor-in-ci'
Junio C Hamano [Mon, 22 Apr 2019 02:14:46 +0000 (11:14 +0900)] 
Merge branch 'sg/asciidoctor-in-ci'

Update our support to format documentation in the CI environment,
either with AsciiDoc ro Asciidoctor.

* sg/asciidoctor-in-ci:
  ci: fix AsciiDoc/Asciidoctor stderr check in the documentation build job
  ci: stick with Asciidoctor v1.5.8 for now
  ci: install Asciidoctor in 'ci/install-dependencies.sh'
  Documentation/technical/protocol-v2.txt: fix formatting
  Documentation/technical/api-config.txt: fix formatting
  Documentation/git-diff-tree.txt: fix formatting

5 years agoMerge branch 'tz/asciidoctor-fixes'
Junio C Hamano [Mon, 22 Apr 2019 02:14:46 +0000 (11:14 +0900)] 
Merge branch 'tz/asciidoctor-fixes'

Doc updates.

* tz/asciidoctor-fixes:
  Documentation/git-status: fix titles in porcelain v2 section
  Documentation/rev-list-options: wrap --date=<format> block with "--"

5 years agoMerge branch 'js/check-docs-exe'
Junio C Hamano [Mon, 22 Apr 2019 02:14:46 +0000 (11:14 +0900)] 
Merge branch 'js/check-docs-exe'

Dev support update.

* js/check-docs-exe:
  check-docs: fix for setups where executables have an extension
  check-docs: do not expect guide pages to correspond to commands
  check-docs: really look at the documented commands again
  docs: do not document the `git remote-testgit` command
  docs: move gitremote-helpers into section 7

5 years agoMerge branch 'nd/include-if-wildmatch'
Junio C Hamano [Mon, 22 Apr 2019 02:14:45 +0000 (11:14 +0900)] 
Merge branch 'nd/include-if-wildmatch'

A buglet in configuration parser has been fixed.

* nd/include-if-wildmatch:
  config: correct '**' matching in includeIf patterns

5 years agoMerge branch 'cb/doco-mono'
Junio C Hamano [Mon, 22 Apr 2019 02:14:45 +0000 (11:14 +0900)] 
Merge branch 'cb/doco-mono'

Clean-up markup in the documentation suite.

* cb/doco-mono:
  doc: format pathnames and URLs as monospace.
  doc/CodingGuidelines: URLs and paths as monospace

5 years agoMerge branch 'tg/stash-in-c-show-default-to-p-fix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:45 +0000 (11:14 +0900)] 
Merge branch 'tg/stash-in-c-show-default-to-p-fix'

A regression fix.

* tg/stash-in-c-show-default-to-p-fix:
  stash: setup default diff output format if necessary

5 years agoMerge branch 'js/stash-in-c-pathspec-fix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:44 +0000 (11:14 +0900)] 
Merge branch 'js/stash-in-c-pathspec-fix'

Further fixes to "git stash" reimplemented in C.

* js/stash-in-c-pathspec-fix:
  stash: pass pathspec as pointer
  built-in stash: handle :(glob) pathspecs again
  legacy stash: fix "rudimentary backport of -q"

5 years agoMerge branch 'tb/stash-in-c-unused-param-fix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:44 +0000 (11:14 +0900)] 
Merge branch 'tb/stash-in-c-unused-param-fix'

Code clean-up.

* tb/stash-in-c-unused-param-fix:
  stash: drop unused parameter

5 years agoMerge branch 'ps/stash-in-c'
Junio C Hamano [Mon, 22 Apr 2019 02:14:43 +0000 (11:14 +0900)] 
Merge branch 'ps/stash-in-c'

"git stash" rewritten in C.

* ps/stash-in-c: (28 commits)
  tests: add a special setup where stash.useBuiltin is off
  stash: optionally use the scripted version again
  stash: add back the original, scripted `git stash`
  stash: convert `stash--helper.c` into `stash.c`
  stash: replace all `write-tree` child processes with API calls
  stash: optimize `get_untracked_files()` and `check_changes()`
  stash: convert save to builtin
  stash: make push -q quiet
  stash: convert push to builtin
  stash: convert create to builtin
  stash: convert store to builtin
  stash: convert show to builtin
  stash: convert list to builtin
  stash: convert pop to builtin
  stash: convert branch to builtin
  stash: convert drop and clear to builtin
  stash: convert apply to builtin
  stash: mention options in `show` synopsis
  stash: add tests for `git stash show` config
  stash: rename test cases to be more descriptive
  ...

5 years agoThe fifth batch
Junio C Hamano [Tue, 16 Apr 2019 10:33:35 +0000 (19:33 +0900)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'sg/t5318-cleanup'
Junio C Hamano [Tue, 16 Apr 2019 10:28:12 +0000 (19:28 +0900)] 
Merge branch 'sg/t5318-cleanup'

Code cleanup.

* sg/t5318-cleanup:
  t5318-commit-graph: remove unused variable

5 years agoMerge branch 'jt/t5551-protocol-v2-does-not-have-half-auth'
Junio C Hamano [Tue, 16 Apr 2019 10:28:12 +0000 (19:28 +0900)] 
Merge branch 'jt/t5551-protocol-v2-does-not-have-half-auth'

Test update.

* jt/t5551-protocol-v2-does-not-have-half-auth:
  t5551: mark half-auth no-op fetch test as v0-only

5 years agoMerge branch 'jk/http-walker-status-fix'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'jk/http-walker-status-fix'

dumb-http walker has been updated to share more error recovery
strategy with the normal codepath.

* jk/http-walker-status-fix:
  http: use normalize_curl_result() instead of manual conversion
  http: normalize curl results for dumb loose and alternates fetches
  http: factor out curl result code normalization

5 years agoMerge branch 'jh/midx-verify-too-many-packs'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'jh/midx-verify-too-many-packs'

"git multi-pack-index verify" did not scale well with the number of
packfiles, which is being improved.

* jh/midx-verify-too-many-packs:
  midx: during verify group objects by packfile to speed verification
  midx: add progress indicators in multi-pack-index verify
  trace2:data: add trace2 data to midx
  progress: add sparse mode to force 100% complete message

5 years agoMerge branch 'bb/unicode-12'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'bb/unicode-12'

Unicode update.

* bb/unicode-12:
  unicode: update the width tables to Unicode 12

5 years agoMerge branch 'jk/refs-double-abort'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'jk/refs-double-abort'

A corner case bug in the refs API has been corrected.

* jk/refs-double-abort:
  refs/files-backend: don't look at an aborted transaction
  refs/files-backend: handle packed transaction prepare failure

5 years agoMerge branch 'nd/checkout-m-doc-update'
Junio C Hamano [Tue, 16 Apr 2019 10:28:10 +0000 (19:28 +0900)] 
Merge branch 'nd/checkout-m-doc-update'

Doc about the above.

* nd/checkout-m-doc-update:
  checkout.txt: note about losing staged changes with --merge

5 years agoMerge branch 'tb/trace2-va-list-fix'
Junio C Hamano [Tue, 16 Apr 2019 10:28:10 +0000 (19:28 +0900)] 
Merge branch 'tb/trace2-va-list-fix'

Fix some code that passed a NULL when a va_list was expected.

* tb/trace2-va-list-fix:
  trace2: NULL is not allowed for va_list

5 years agoMerge branch 'tz/completion'
Junio C Hamano [Tue, 16 Apr 2019 10:28:09 +0000 (19:28 +0900)] 
Merge branch 'tz/completion'

The completion helper code now pays attention to repository-local
configuration (when available), which allows --list-cmds to honour
a repository specific setting of completion.commands, for example.

* tz/completion:
  completion: use __git when calling --list-cmds
  completion: fix multiple command removals
  t9902: test multiple removals via completion.commands
  git: read local config in --list-cmds

5 years agoMerge branch 'ma/doc-diff-doc-vs-doctor-comparison'
Junio C Hamano [Tue, 16 Apr 2019 10:28:09 +0000 (19:28 +0900)] 
Merge branch 'ma/doc-diff-doc-vs-doctor-comparison'

Dev support update to make it easier to compare two formatted
results from our documentation.

* ma/doc-diff-doc-vs-doctor-comparison:
  doc-diff: add `--cut-header-footer`
  doc-diff: support diffing from/to AsciiDoc(tor)
  doc-diff: let `render_tree()` take an explicit directory name
  Doc: auto-detect changed build flags

5 years agoMerge branch 'tz/t4038-bash-redirect-target-workaround'
Junio C Hamano [Tue, 16 Apr 2019 10:28:09 +0000 (19:28 +0900)] 
Merge branch 'tz/t4038-bash-redirect-target-workaround'

Work-around extra warning from bash in our tests.

* tz/t4038-bash-redirect-target-workaround:
  t4038-diff-combined: quote paths with whitespace

5 years agoMerge branch 'ab/drop-scripted-rebase'
Junio C Hamano [Tue, 16 Apr 2019 10:28:09 +0000 (19:28 +0900)] 
Merge branch 'ab/drop-scripted-rebase'

Retire scripted "git rebase" implementation.

* ab/drop-scripted-rebase:
  rebase: remove the rebase.useBuiltin setting

5 years agoMerge branch 'jk/perf-lib-tee'
Junio C Hamano [Tue, 16 Apr 2019 10:28:08 +0000 (19:28 +0900)] 
Merge branch 'jk/perf-lib-tee'

Code cleanup in the test framework.

* jk/perf-lib-tee:
  perf-lib.sh: rely on test-lib.sh for --tee handling

5 years agoMerge branch 'ab/doc-misc-typofixes'
Junio C Hamano [Tue, 16 Apr 2019 10:28:08 +0000 (19:28 +0900)] 
Merge branch 'ab/doc-misc-typofixes'

Typofixes.

* ab/doc-misc-typofixes:
  doc: fix typos in man pages

5 years agoMerge branch 'mh/pack-protocol-doc-fix'
Junio C Hamano [Tue, 16 Apr 2019 10:28:08 +0000 (19:28 +0900)] 
Merge branch 'mh/pack-protocol-doc-fix'

Docfix.

* mh/pack-protocol-doc-fix:
  fix pack protocol example client/server communication

5 years agoMerge branch 'tg/glossary-overlay'
Junio C Hamano [Tue, 16 Apr 2019 10:28:07 +0000 (19:28 +0900)] 
Merge branch 'tg/glossary-overlay'

Doc update.

* tg/glossary-overlay:
  glossary: add definition for overlay

5 years agoMerge branch 'nd/checkout-f-while-conflicted-fix'
Junio C Hamano [Tue, 16 Apr 2019 10:28:07 +0000 (19:28 +0900)] 
Merge branch 'nd/checkout-f-while-conflicted-fix'

"git checkout -f <branch>" while the index has an unmerged path
incorrectly left some paths in an unmerged state, which has been
corrected.

* nd/checkout-f-while-conflicted-fix:
  unpack-trees: fix oneway_merge accidentally carry over stage index

5 years agoMerge branch 'pw/rerere-autoupdate'
Junio C Hamano [Tue, 16 Apr 2019 10:28:07 +0000 (19:28 +0900)] 
Merge branch 'pw/rerere-autoupdate'

Doc updates.

* pw/rerere-autoupdate:
  merge: tweak --rerere-autoupdate documentation
  am/cherry-pick/rebase/revert: document --rerere-autoupdate

5 years agoMerge branch 'jc/format-patch-error-check'
Junio C Hamano [Tue, 16 Apr 2019 10:28:06 +0000 (19:28 +0900)] 
Merge branch 'jc/format-patch-error-check'

"git format-patch" used overwrite an existing patch/cover-letter
file.  A new "--no-clobber" option stops it.

* jc/format-patch-error-check:
  format-patch: notice failure to open cover letter for writing
  builtin/log: downcase the beginning of error messages

5 years agoMerge branch 'js/get-short-oid-drop-cache'
Junio C Hamano [Tue, 16 Apr 2019 10:28:06 +0000 (19:28 +0900)] 
Merge branch 'js/get-short-oid-drop-cache'

A corner-case object name ambiguity while the sequencer machinery
is working (e.g. "rebase -i -x") has been (half) fixed.

* js/get-short-oid-drop-cache:
  get_oid(): when an object was not found, try harder
  sequencer: move stale comment into correct location
  sequencer: improve error message when an OID could not be parsed
  rebase -i: demonstrate obscure loose object cache bug

5 years agoMerge branch 'dl/subtree-limit-to-one-rev'
Junio C Hamano [Tue, 16 Apr 2019 10:28:06 +0000 (19:28 +0900)] 
Merge branch 'dl/subtree-limit-to-one-rev'

"git subtree" (in contrib/) update.

* dl/subtree-limit-to-one-rev:
  contrib/subtree: ensure only one rev is provided

5 years agoMerge branch 'js/init-db-update-for-mingw'
Junio C Hamano [Tue, 16 Apr 2019 10:28:05 +0000 (19:28 +0900)] 
Merge branch 'js/init-db-update-for-mingw'

"git init" forgot to read platform-specific repository
configuration, which made Windows port to ignore settings of
core.hidedotfiles, for example.

* js/init-db-update-for-mingw:
  mingw: respect core.hidedotfiles = false in git-init again

5 years agoMerge branch 'js/remote-curl-i18n'
Junio C Hamano [Tue, 16 Apr 2019 10:28:05 +0000 (19:28 +0900)] 
Merge branch 'js/remote-curl-i18n'

Error messages given from the http transport have been updated so
that they can be localized.

* js/remote-curl-i18n:
  remote-curl: mark all error messages for translation

5 years agoMerge branch 'js/anonymize-remote-curl-diag'
Junio C Hamano [Tue, 16 Apr 2019 10:28:04 +0000 (19:28 +0900)] 
Merge branch 'js/anonymize-remote-curl-diag'

remote-http transport did not anonymize URLs reported in its error
messages at places.

* js/anonymize-remote-curl-diag:
  curl: anonymize URLs in error messages and warnings

5 years agoMerge branch 'ma/asciidoctor-fixes-more'
Junio C Hamano [Tue, 16 Apr 2019 10:28:04 +0000 (19:28 +0900)] 
Merge branch 'ma/asciidoctor-fixes-more'

Documentation mark-up fixes.

* ma/asciidoctor-fixes-more:
  Documentation: turn middle-of-line tabs into spaces
  git-svn.txt: drop escaping '\' that ends up being rendered
  git.txt: remove empty line before list continuation
  config/fsck.txt: avoid starting line with dash
  config/diff.txt: drop spurious backtick

5 years agoMerge branch 'ma/asciidoctor-fixes'
Junio C Hamano [Tue, 16 Apr 2019 10:28:03 +0000 (19:28 +0900)] 
Merge branch 'ma/asciidoctor-fixes'

Build fix around use of asciidoctor instead of asciidoc

* ma/asciidoctor-fixes:
  asciidoctor-extensions: fix spurious space after linkgit
  Documentation/Makefile: add missing dependency on asciidoctor-extensions
  Documentation/Makefile: add missing xsl dependencies for manpages

5 years agoMerge branch 'jt/test-protocol-version'
Junio C Hamano [Tue, 16 Apr 2019 10:28:03 +0000 (19:28 +0900)] 
Merge branch 'jt/test-protocol-version'

Help developers by making it easier to run most of the tests under
different versions of over-the-wire protocols.

* jt/test-protocol-version:
  t5552: compensate for v2 filtering ref adv.
  tests: fix protocol version for overspecifications
  t5700: only run with protocol version 1
  t5512: compensate for v0 only sending HEAD symrefs
  t5503: fix overspecification of trace expectation
  tests: always test fetch of unreachable with v0
  t5601: check ssh command only with protocol v0
  tests: define GIT_TEST_PROTOCOL_VERSION

5 years agoMerge branch 'nd/diff-parseopt-3'
Junio C Hamano [Tue, 16 Apr 2019 10:28:03 +0000 (19:28 +0900)] 
Merge branch 'nd/diff-parseopt-3'

Third batch to teach the diff machinery to use the parse-options
API.

* nd/diff-parseopt-3:
  diff-parseopt: convert --submodule
  diff-parseopt: convert --ignore-submodules
  diff-parseopt: convert --textconv
  diff-parseopt: convert --ext-diff
  diff-parseopt: convert --quiet
  diff-parseopt: convert --exit-code
  diff-parseopt: convert --color-words
  diff-parseopt: convert --word-diff-regex
  diff-parseopt: convert --word-diff
  diff-parseopt: convert --[no-]color
  diff-parseopt: convert --[no-]follow
  diff-parseopt: convert -R
  diff-parseopt: convert -a|--text
  diff-parseopt: convert --full-index
  diff-parseopt: convert --binary
  diff-parseopt: convert --anchored
  diff-parseopt: convert --diff-algorithm
  diff-parseopt: convert --histogram
  diff-parseopt: convert --patience
  diff-parseopt: convert --[no-]indent-heuristic

5 years agoupdate_info_refs(): drop unused force parameter
Jeff King [Fri, 5 Apr 2019 18:14:07 +0000 (14:14 -0400)] 
update_info_refs(): drop unused force parameter

Once upon a time the force flag meant something when writing info/refs,
but it hasn't done anything since 60d0526aaa (Unoptimize info/refs
creation., 2005-09-14).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoserver-info: drop objdirlen pointer arithmetic
Jeff King [Fri, 5 Apr 2019 18:14:04 +0000 (14:14 -0400)] 
server-info: drop objdirlen pointer arithmetic

When writing objects/info/packs, we use the basename of each pack
(i.e., just the "pack-1234abcd.pack" part). We compute that manually by
adding "objdirlen + 6" to the name.

This _should_ work consistently, as we do not include non-local packs,
meaning everything should be in $objdir/pack/. Before f13d7db4af
(server-info.c: use pack_local like everybody else., 2005-12-05), this
was definitely true, since we computed "local" based on comparing the
objdir string.  Since then, we're relying on the code on packfile.c to
match our expectations of p->pack_name and p->local.

I think our expectations do still hold today, but we can be a bit more
defensive by just using pack_basename() to get the base. That
future-proofs us, and should hopefully be more obviously safe to
somebody reading the code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoserver-info: drop nr_alloc struct member
Jeff King [Fri, 5 Apr 2019 18:14:00 +0000 (14:14 -0400)] 
server-info: drop nr_alloc struct member

We keep an array of struct pointers, with each one representing a single
packfile. But for some reason there is a nr_alloc parameter inside each
struct, which has never been used.

This is probably cruft left over from development, where we might have
wanted a nr_alloc to dynamically grow the list. But as it turns out, we
do not dynamically grow the list at all, but rather count up the total
number of packs and use that as a maximum size. So while we're thinking
of this, let's add an assert() that documents (and checks!) that our
allocation and fill loops stay in sync.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoserver-info: use strbuf to read old info/packs file
Jeff King [Fri, 5 Apr 2019 18:13:56 +0000 (14:13 -0400)] 
server-info: use strbuf to read old info/packs file

This old code uses fgets with a fixed-size buffer. Let's use a strbuf
instead, so we don't have to wonder if "1000" is big enough, or what
happens if we see a long line.

This also lets us drop our custom code to trim the newline.

Probably nobody actually cares about the 1000-char limit (after all, the
lines generally only say "P pack-[0-9a-f]{40}.pack"), so this is mostly
just about cleanup/readability.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoserver-info: simplify cleanup in parse_pack_def()
Jeff King [Fri, 5 Apr 2019 18:13:14 +0000 (14:13 -0400)] 
server-info: simplify cleanup in parse_pack_def()

We have two exits from the function: either we jump to the out_stale
label or not. But in both exits we repeat our cleanup, and the only
difference is our return value. Let's just use a variable for the return
value to avoid repeating ourselves.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoserver-info: fix blind pointer arithmetic
Jeff King [Fri, 5 Apr 2019 18:13:10 +0000 (14:13 -0400)] 
server-info: fix blind pointer arithmetic

When we're writing out a new objects/info/packs file, we read back the
old one to try to keep the ordering the same. When we see a line
starting with "P", we expect "P pack-1234..." and blindly jump to "line
+ 2" to parse the pack name. If we saw a line with _just_ "P" and
nothing else, we'd jump past the end of the buffer and start reading
arbitrary memory.

This shouldn't be a big attack vector, as the files are local to the
repository and written by us, but it's clearly worth fixing (we do read
remote copies of the file for dumb-http fetches, but using a totally
different parser!).

Let's instead use skip_prefix() here, which avoids pointer arithmetic
altogether. Note that this converts our switch statement to an if/else
chain, making it slightly more verbose. But it will also make it easier
to do a few follow-on cleanups.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agohttp: simplify parsing of remote objects/info/packs
Jeff King [Fri, 5 Apr 2019 18:12:55 +0000 (14:12 -0400)] 
http: simplify parsing of remote objects/info/packs

We can use skip_prefix() and parse_oid_hex() to continuously increment
our pointer, rather than dealing with magic numbers. This also fixes a
few small shortcomings:

  - if we see a line with the right prefix, suffix, and length, i.e.
    matching /P pack-.{40}.pack\n/, we'll interpret the middle part as
    hex without checking if it could be parsed. This could lead to us
    looking at uninitialized garbage in the hash array. In practice this
    means we'll just make a garbage request to the server which will
    fail, though it's interesting that a malicious server could convince
    us to leak 40 bytes of uninitialized stack to them.

  - the current code is picky about seeing a newline at the end of file,
    but we can easily be more liberal

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agopackfile: fix pack basename computation
Jeff King [Fri, 5 Apr 2019 18:06:22 +0000 (14:06 -0400)] 
packfile: fix pack basename computation

When we have a multi-pack-index that covers many packfiles, we try to
avoid opening the .idx for those packfiles. To do that we feed the pack
name to midx_contains_pack(). But that function wants to see only the
basename, which we compute using strrchr() to find the final slash. But
that leaves an extra "/" at the start of our string.

We can fix this by incrementing the pointer. That also raises the
question of what to do when the name does not have a '/' at all. This
should generally not happen (we always find files in "pack/"), but it
doesn't hurt to be defensive here.

Let's wrap all of that up in a helper function and make it publicly
available, since a later patch will need to use it, too.

The tests don't notice because there's nothing about opening those .idx
files that would cause us to give incorrect output. It's just a little
slower. The new test checks this case by corrupting the covered .idx,
and then making sure we don't complain about it.

We also have to tweak t5570, which intentionally corrupts a .idx file
and expects us to notice it. When run with GIT_TEST_MULTI_PACK_INDEX,
this will fail since we now will (correctly) not bother opening the .idx
at all. We can fix that by unconditionally dropping any midx that's
there, which ensures we'll have to read the .idx.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomidx: check both pack and index names for containment
Jeff King [Fri, 5 Apr 2019 18:06:04 +0000 (14:06 -0400)] 
midx: check both pack and index names for containment

A midx file (and the struct we parse from it) contains a list of all of
the covered packfiles, mentioned by their ".idx" names (e.g.,
"pack-1234.idx", etc). And thus calls to midx_contains_pack() expect
callers to provide the idx name.

This works for most of the calls, but the one in open_packed_git_1()
tries to feed a packed_git->pack_name, which is the ".pack" name,
meaning we'll never find a match (even if the pack is covered by the
midx).

We can fix this by converting the ".pack" to ".idx" in the caller.
However, that requires allocating a new string. Instead, let's make
midx_contains_pack() a bit friendlier, and allow it take _either_ the
.pack or .idx variant.

All cleverness in the matching code is credited to René. Bugs are mine.

There's no test here, because while this does fix _a_ bug, it's masked
by another bug in that same caller. That will be covered (with a test)
in the next patch.

Helped-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot5319: drop useless --buffer from cat-file
Jeff King [Fri, 5 Apr 2019 18:05:03 +0000 (14:05 -0400)] 
t5319: drop useless --buffer from cat-file

The cat-file --buffer option is the default already when using
--batch-all-objects. It doesn't hurt to specify it, but it's nice for
the test scripts to model good usage.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot5319: fix bogus cat-file argument
Jeff King [Fri, 5 Apr 2019 18:04:56 +0000 (14:04 -0400)] 
t5319: fix bogus cat-file argument

There's no such argument as "--unsorted"; it's spelled "--unordered".
But our test failed to notice that cat-file didn't run at all because:

  1. It lost the exit code of git on the left-hand side of a pipe.

  2. It was comparing two runs of the broken invocation with and without
     a particular config variable (and indeed, both cases produced no
     output!).

Let's fix the option, but also tweak the helper function to check the
exit code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agopack-revindex: open index if necessary
Jeff King [Fri, 5 Apr 2019 18:04:24 +0000 (14:04 -0400)] 
pack-revindex: open index if necessary

We can't create a pack revindex if we haven't actually looked at the
index. Normally we would never get as far as creating a revindex without
having already been looking in the pack, so this code never bothered to
double-check that pack->index_data had been loaded.

But with the new multi-pack-index feature, many code paths might not
load the individual pack .idx at all (they'd find objects via the midx
and then open the .pack, but not its index).

This can't yet be triggered in practice, because a bug in the midx code
means we accidentally open up the individual .idx files anyway. But in
preparation for fixing that, let's have the revindex code check that
everything it needs has been loaded.

In most cases this will just be a quick noop. But note that this does
introduce a possibility of error (if we have to open the index and it's
corrupt), so load_pack_revindex() now returns a result code, and callers
need to handle the error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agopackfile.h: drop extern from function declarations
Jeff King [Fri, 5 Apr 2019 18:03:41 +0000 (14:03 -0400)] 
packfile.h: drop extern from function declarations

As CodingGuidelines recommends, we do not need an "extern" when
declaring a public function. Let's drop these. Note that we leave the
extern on report_garbage(), as that is actually a function pointer, not
a function itself.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoprogress: break too long progress bar lines
SZEDER Gábor [Fri, 12 Apr 2019 19:45:15 +0000 (21:45 +0200)] 
progress: break too long progress bar lines

Some of the recently added progress indicators have quite long titles,
which might be even longer when translated to some languages, and when
they are shown while operating on bigger repositories, then the
progress bar grows longer than the default 80 column terminal width.

When the progress bar exceeds the width of the terminal it gets
line-wrapped, and after that the CR at the end doesn't return to the
beginning of the progress bar, but to the first column of its last
line.  Consequently, the first line of the previously shown progress
bar is not overwritten by the next, and we end up with a bunch of
truncated progress bar lines scrolling past:

  $ LANG=es_ES.UTF-8 git commit-graph write
  Encontrando commits para commit graph entre los objetos empaquetados:   2% (1599
  Encontrando commits para commit graph entre los objetos empaquetados:   3% (1975
  Encontrando commits para commit graph entre los objetos empaquetados:   4% (2633
  Encontrando commits para commit graph entre los objetos empaquetados:   5% (3292
  [...]

Prevent this by breaking progress bars after the title once they
exceed the width of the terminal, so the counter and optional
percentage and throughput, i.e. all changing parts, are on the last
line.  Subsequent updates will from then on only refresh the changing
parts, but not the title, and it will look like this:

  $ LANG=es_ES.UTF-8 ~/src/git/git commit-graph write
  Encontrando commits para commit graph entre los objetos empaquetados:
    100% (6584502/6584502), listo.
  Calculando números de generación de commit graph: 100% (824705/824705), listo.
  Escribiendo commit graph en 4 pasos: 100% (3298820/3298820), listo.

Note that the number of columns in the terminal is cached by
term_columns(), so this might not kick in when it should when a
terminal window is resized while the operation is running.
Furthermore, this change won't help if the terminal is so narrow that
the counters don't fit on one line, but I would put this in the "If it
hurts, don't do it" box.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoprogress: clear previous progress update dynamically
SZEDER Gábor [Fri, 12 Apr 2019 19:45:14 +0000 (21:45 +0200)] 
progress: clear previous progress update dynamically

When the progress bar includes throughput, its length can shorten as
the unit of display changes from KiB to MiB.  To cover up remnants of
the previous progress bar when such a change of units happens we
always print three spaces at the end of the progress bar.

Alas, covering only three characters is not quite enough: when both
the total and the throughput happen to change units from KiB to MiB in
the same update, then the progress bar's length is shortened by four
characters (or maybe even more!):

  Receiving objects:  25% (2901/11603), 772.01 KiB | 733.00 KiB/s
  Receiving objects:  27% (3133/11603), 1.43 MiB | 1.16 MiB/s   s

and a stray 's' is left behind.

So instead of hard-coding the three characters to cover, let's compare
the length of the current progress bar with the previous one, and
cover up as many characters as needed.

Sure, it would be much simpler to just print more spaces at the end of
the progress bar, but this approach is more future-proof, and it won't
print extra spaces when none are needed, notably when the progress bar
doesn't show throughput and thus never shrinks.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotests: disallow the use of abbreviated options (by default)
Johannes Schindelin [Fri, 12 Apr 2019 09:37:24 +0000 (02:37 -0700)] 
tests: disallow the use of abbreviated options (by default)

Git's command-line parsers support uniquely abbreviated options, e.g.
`git init --ba` would automatically expand `--ba` to `--bare`.

This is a very convenient feature in every day life for Git users, in
particular when tab completion is not available.

However, it is not a good idea to rely on that in Git's test suite, as
something that is a unique abbreviation of a command line option today
might no longer be a unique abbreviation tomorrow.

For example, if a future contribution added a new mode
`git init --babyproofing` and a previously-introduced test case used the
fact that `git init --ba` expanded to `git init --bare`, that future
contribution would now have to touch seemingly unrelated tests just to
keep the test suite from failing.

So let's disallow abbreviated options in the test suite by default.

Note: for ease of implementation, this patch really only touches the
`parse-options` machinery: more and more hand-rolled option parsers are
converted to use that internal API, and more and more scripts are
converted to built-ins (naturally using the parse-options API, too), so
in practice this catches most issues, and is definitely the biggest bang
for the buck.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoprogress: use xmalloc/xcalloc
Jeff King [Thu, 11 Apr 2019 13:49:57 +0000 (09:49 -0400)] 
progress: use xmalloc/xcalloc

Since the early days of Git, the progress code allocates its struct with
a bare malloc(), not xmalloc(). If the allocation fails, we just avoid
showing progress at all.

While perhaps a noble goal not to fail the whole operation because of
optional progress, in practice:

  1. Any failure to allocate a few dozen bytes here means critical path
     allocations are likely to fail, too.

  2. These days we use a strbuf for throughput progress (and there's a
     patch under discussion to do the same for non-throughput cases,
     too). And that uses xmalloc() under the hood, which means we'd
     still die on some allocation failures.

Let's switch to xmalloc(). That makes us consistent with the rest of Git
and makes it easier to audit for other (less careful) bare mallocs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoxdiff: use xmalloc/xrealloc
Jeff King [Thu, 11 Apr 2019 13:49:25 +0000 (09:49 -0400)] 
xdiff: use xmalloc/xrealloc

Most of xdiff uses a bare malloc() to allocate memory, and returns an
error when we get NULL. However, there are a few spots which don't check
the return value and may segfault, including at least xdl_merge() and
xpatience.c's find_longest_common_sequence().

Let's use xmalloc() everywhere instead, so that we get a graceful die()
for these cases, without having to do further auditing. This does mean
the existing cases which check errors will now die() instead of
returning an error up the stack. But:

  - that's how the rest of Git behaves already for malloc errors

  - all of the callers of xdi_diff(), etc, die upon seeing an error

So while we might one day want to fully lib-ify the diff code and make
it possible to use as part of a long-running process, we're not close to
that now. And because we're just tweaking the xdl_malloc() macro here,
we're not really moving ourselves any further away from that. We
could, for example, simplify some of the functions which handle malloc()
errors which can no longer occur. But that would probably be taking us
in the wrong direction.

This also makes our malloc handling more consistent with the rest of
Git, including enforcing GIT_ALLOC_LIMIT and trying to reclaim pack
memory when needed.

Reported-by: 王健强 <jianqiang.wang@securitygossip.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoxdiff: use git-compat-util
Jeff King [Thu, 11 Apr 2019 13:48:33 +0000 (09:48 -0400)] 
xdiff: use git-compat-util

Since the xdiff library was not originally part of Git, it does its own
system includes. Let's instead use git-compat-util, which has two
benefits:

  1. It adjusts for any system-specific quirks in how or what we should
     include (though xdiff's needs are light enough that this hasn't
     been a problem in the past).

  2. It lets us use wrapper functions like xmalloc().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-prio-queue: use xmalloc
Jeff King [Thu, 11 Apr 2019 13:48:14 +0000 (09:48 -0400)] 
test-prio-queue: use xmalloc

test-prio-queue.c doesn't check the return value of malloc, and could
segfault.

It's unlikely for this to matter in practice; it's a small allocation,
and this code isn't even installed alongside the rest of Git. But let's
use xmalloc(), which makes auditing for other accidental uses of bare
malloc() easier.

Reported-by: 王健强 <jianqiang.wang@securitygossip.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot3000 (ls-files -o): widen description to reflect current tests
Kyle Meyer [Wed, 10 Apr 2019 15:28:57 +0000 (11:28 -0400)] 
t3000 (ls-files -o): widen description to reflect current tests

Remove the mention of symlinks from the test description because
several tests that are not related to symlinks have been added since
this file was introduced long ago.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agountracked cache: fix off-by-one
Johannes Schindelin [Wed, 10 Apr 2019 12:56:48 +0000 (05:56 -0700)] 
untracked cache: fix off-by-one

In f9e6c649589e (untracked cache: load from UNTR index extension,
2015-03-08), code was added to read back the untracked cache from an
index extension.

Probably in the endeavor to avoid the `calloc()` implied by
`FLEX_ALLOC_STR()` (it is hard to know why exactly, the commit message
of that commit is a bit parsimonious with information), it calls
`malloc()` manually and then `memcpy()`s the bits and pieces into place.

It allocates the size of `struct untracked_cache_dir` plus the string
length of the untracked file name, then copies the information in two
steps: first the fixed-size metadata, then the name. And here lies the
rub: it includes the trailing NUL byte in the name.

If `FLEX_ARRAY` is defined as 0, this results in a buffer overrun.

To fix this, let's just add 1, for the trailing NUL byte. Technically,
this overallocates on platforms where `FLEX_ARRAY` is 1, but it should
not matter much in reality, as `malloc()` usually overallocates anyway,
unless the size to allocate aligns exactly with some internal chunk size
(see below for more on that).

The real strange thing is that neither valgrind nor DrMemory catches
this bug. In this developer's tests, a `memcpy()` (but not a
`memset()`!) could write up to 4 bytes after the allocated memory range
before valgrind would start reporting an issue.

However, when running Git built with nedmalloc as allocator, under rare
conditions (and inconsistently at that), this bug triggered an `abort()`
because nedmalloc rounds up the size to be `malloc()`ed to a multiple of
a certain chunk size, then adds a few bytes to be used for storing some
internal state. If there is no rounding up to do (because the size is
already a multiple of that chunk size), and if the buffer is overrun as
in the code patched in this commit, the internal state is corrupted.

The scenario that triggered this here bug fix entailed a git.git
checkout with an extra copy of the source code in an untracked
subdirectory, meaning that there was an untracked subdirectory called
"thunderbird-patch-inline" whose name's length is exactly 24 bytes,
which, added to the size of above-mentioned `struct untracked_cache_dir`
that weighs in with 104 bytes on a 64-bit system, amounts to 128,
aligning perfectly with nedmalloc's chunk size.

As there is no obvious way to trigger this bug reliably, on all
platforms supported by Git, and as the bug is obvious enough, this patch
comes without a regression test.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosubmodule: teach set-branch subcommand
Denton Liu [Fri, 8 Feb 2019 11:21:34 +0000 (03:21 -0800)] 
submodule: teach set-branch subcommand

This teaches git-submodule the set-branch subcommand which allows the
branch of a submodule to be set through a porcelain command without
having to manually manipulate the .gitmodules file.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>