]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 years agoMerge branch 'dl/doc-diff-no-index-implies-exit-code'
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)] 
Merge branch 'dl/doc-diff-no-index-implies-exit-code'

Doc update.

* dl/doc-diff-no-index-implies-exit-code:
  git-diff.txt: document return code of `--no-index`

4 years agoMerge branch 'js/vreportf-wo-buffering'
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)] 
Merge branch 'js/vreportf-wo-buffering'

Messages from die() etc. can be mixed up from multiple processes
without even line buffering on Windows, which has been worked
around.

* js/vreportf-wo-buffering:
  vreportf(): avoid relying on stdio buffering

4 years agoMerge branch 'pb/no-recursive-reset-hard-in-worktree-add'
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)] 
Merge branch 'pb/no-recursive-reset-hard-in-worktree-add'

"git worktree add" internally calls "reset --hard" that should not
descend into submodules, even when submodule.recurse configuration
is set, but it was affected.  This has been corrected.

* pb/no-recursive-reset-hard-in-worktree-add:
  worktree: teach "add" to ignore submodule.recurse config

4 years agoMerge branch 'pb/help-list-gitsubmodules-among-guides'
Junio C Hamano [Sun, 1 Dec 2019 17:04:30 +0000 (09:04 -0800)] 
Merge branch 'pb/help-list-gitsubmodules-among-guides'

Help update.

* pb/help-list-gitsubmodules-among-guides:
  help: add gitsubmodules to the list of guides

4 years agoMerge branch 'sg/blame-indent-heuristics-is-now-the-default'
Junio C Hamano [Sun, 1 Dec 2019 17:04:30 +0000 (09:04 -0800)] 
Merge branch 'sg/blame-indent-heuristics-is-now-the-default'

Message update.

* sg/blame-indent-heuristics-is-now-the-default:
  builtin/blame.c: remove '--indent-heuristic' from usage string

4 years agoMerge branch 'mr/clone-dir-exists-to-path-exists'
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)] 
Merge branch 'mr/clone-dir-exists-to-path-exists'

Code cleanup.

* mr/clone-dir-exists-to-path-exists:
  clone: rename static function `dir_exists()`.

4 years agoMerge branch 'ma/bisect-doc-sample-update'
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)] 
Merge branch 'ma/bisect-doc-sample-update'

"git merge --no-commit" needs "--no-ff" if you do not want to move
HEAD, which has been corrected in the manual page for "git bisect".

* ma/bisect-doc-sample-update:
  Documentation/git-bisect.txt: add --no-ff to merge command

4 years agoMerge branch 'js/git-path-head-dot-lock-fix'
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)] 
Merge branch 'js/git-path-head-dot-lock-fix'

"git rev-parse --git-path HEAD.lock" did not give the right path
when run in a secondary worktree.

* js/git-path-head-dot-lock-fix:
  git_path(): handle `.lock` files correctly
  t1400: wrap setup code in test case

4 years agoMerge branch 'jc/log-graph-simplify'
Junio C Hamano [Sun, 1 Dec 2019 17:04:28 +0000 (09:04 -0800)] 
Merge branch 'jc/log-graph-simplify'

The implementation of "git log --graph" got refactored and then its
output got simplified.

* jc/log-graph-simplify:
  t4215: use helper function to check output
  graph: fix coloring of octopus dashes
  graph: flatten edges that fuse with their right neighbor
  graph: smooth appearance of collapsing edges on commit lines
  graph: rename `new_mapping` to `old_mapping`
  graph: commit and post-merge lines for left-skewed merges
  graph: tidy up display of left-skewed merges
  graph: example of graph output that can be simplified
  graph: extract logic for moving to GRAPH_PRE_COMMIT state
  graph: remove `mapping_idx` and `graph_update_width()`
  graph: reduce duplication in `graph_insert_into_new_columns()`
  graph: reuse `find_new_column_by_commit()`
  graph: handle line padding in `graph_next_line()`
  graph: automatically track display width of graph lines

4 years agoMerge branch 'jk/cleanup-object-parsing-and-fsck'
Junio C Hamano [Sun, 1 Dec 2019 17:04:28 +0000 (09:04 -0800)] 
Merge branch 'jk/cleanup-object-parsing-and-fsck'

Crufty code and logic accumulated over time around the object
parsing and low-level object access used in "git fsck" have been
cleaned up.

* jk/cleanup-object-parsing-and-fsck: (23 commits)
  fsck: accept an oid instead of a "struct tree" for fsck_tree()
  fsck: accept an oid instead of a "struct commit" for fsck_commit()
  fsck: accept an oid instead of a "struct tag" for fsck_tag()
  fsck: rename vague "oid" local variables
  fsck: don't require an object struct in verify_headers()
  fsck: don't require an object struct for fsck_ident()
  fsck: drop blob struct from fsck_finish()
  fsck: accept an oid instead of a "struct blob" for fsck_blob()
  fsck: don't require an object struct for report()
  fsck: only require an oid for skiplist functions
  fsck: only provide oid/type in fsck_error callback
  fsck: don't require object structs for display functions
  fsck: use oids rather than objects for object_name API
  fsck_describe_object(): build on our get_object_name() primitive
  fsck: unify object-name code
  fsck: require an actual buffer for non-blobs
  fsck: stop checking tag->tagged
  fsck: stop checking commit->parent counts
  fsck: stop checking commit->tree value
  commit, tag: don't set parsed bit for parse failures
  ...

4 years agot4215: use helper function to check output
Denton Liu [Tue, 12 Nov 2019 18:56:22 +0000 (10:56 -0800)] 
t4215: use helper function to check output

When git commands are placed in the upstream of a pipe, their return
codes are lost. In this particular case, it is especially bad since we
are testing the intricacies of `git log --graph` behavior and if we hit
an unexpected failure or segfault, we want to know this.

Extract the common output checking logic into check_graph() where we
redirect the output of git commands upstream of pipe into a file and
have sed read from that file so that git failures are detected.

This patch is best viewed with `--color-moved`.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe first batch post 2.24 cycle
Junio C Hamano [Sun, 10 Nov 2019 09:00:59 +0000 (18:00 +0900)] 
The first batch post 2.24 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'bc/hash-independent-tests-part-6'
Junio C Hamano [Sun, 10 Nov 2019 09:02:17 +0000 (18:02 +0900)] 
Merge branch 'bc/hash-independent-tests-part-6'

Test updates to prepare for SHA-2 transition continues.

* bc/hash-independent-tests-part-6:
  t4048: abstract away SHA-1-specific constants
  t4045: make hash-size independent
  t4044: update test to work with SHA-256
  t4039: abstract away SHA-1-specific constants
  t4038: abstract away SHA-1 specific constants
  t4034: abstract away SHA-1-specific constants
  t4027: make hash-size independent
  t4015: abstract away SHA-1-specific constants
  t4011: abstract away SHA-1-specific constants
  t4010: abstract away SHA-1-specific constants
  t3429: remove SHA1 annotation
  t1305: avoid comparing extensions
  rev-parse: add a --show-object-format option
  t/oid-info: add empty tree and empty blob values
  t/oid-info: allow looking up hash algorithm name

4 years agoMerge branch 'js/update-index-ignore-removal-for-skip-worktree'
Junio C Hamano [Sun, 10 Nov 2019 09:02:16 +0000 (18:02 +0900)] 
Merge branch 'js/update-index-ignore-removal-for-skip-worktree'

"git stash save" in a working tree that is sparsely checked out
mistakenly removed paths that are outside the area of interest.

* js/update-index-ignore-removal-for-skip-worktree:
  stash: handle staged changes in skip-worktree files correctly
  update-index: optionally leave skip-worktree entries alone

4 years agoMerge branch 'pb/pretty-email-without-domain-part'
Junio C Hamano [Sun, 10 Nov 2019 09:02:16 +0000 (18:02 +0900)] 
Merge branch 'pb/pretty-email-without-domain-part'

The custom format for "git log --format=<format>" learned the l/L
placeholder that is similar to e/E that fills in the e-mail
address, but only the local part on the left side of '@'.

* pb/pretty-email-without-domain-part:
  pretty: add "%aL" etc. to show local-part of email addresses
  t4203: use test-lib.sh definitions
  t6006: use test-lib.sh definitions

4 years agoMerge branch 'hw/remove-api-docs-placeholder'
Junio C Hamano [Sun, 10 Nov 2019 09:02:15 +0000 (18:02 +0900)] 
Merge branch 'hw/remove-api-docs-placeholder'

Docfix.

* hw/remove-api-docs-placeholder:
  documentation: remove empty doc files

4 years agoMerge branch 'sg/commit-graph-usage-fix'
Junio C Hamano [Sun, 10 Nov 2019 09:02:15 +0000 (18:02 +0900)] 
Merge branch 'sg/commit-graph-usage-fix'

Message fix.

* sg/commit-graph-usage-fix:
  builtin/commit-graph.c: remove subcommand-less usage string

4 years agoMerge branch 'dl/apply-3way-diff3'
Junio C Hamano [Sun, 10 Nov 2019 09:02:15 +0000 (18:02 +0900)] 
Merge branch 'dl/apply-3way-diff3'

"git apply --3way" learned to honor merge.conflictStyle
configuration variable, like merges would.

* dl/apply-3way-diff3:
  apply: respect merge.conflictStyle in --3way
  t4108: demonstrate bug in apply
  t4108: use `test_config` instead of `git config`
  t4108: remove git command upstream of pipe
  t4108: replace create_file with test_write_lines

4 years agoMerge branch 'sg/dir-trie-fixes'
Junio C Hamano [Sun, 10 Nov 2019 09:02:14 +0000 (18:02 +0900)] 
Merge branch 'sg/dir-trie-fixes'

Code clean-up and a bugfix in the logic used to tell worktree local
and repository global refs apart.

* sg/dir-trie-fixes:
  path.c: don't call the match function without value in trie_find()
  path.c: clarify two field names in 'struct common_dir'
  path.c: mark 'logs/HEAD' in 'common_list' as file
  path.c: clarify trie_find()'s in-code comment
  Documentation: mention more worktree-specific exceptions

4 years agoMerge branch 'jc/am-show-current-patch-docfix'
Junio C Hamano [Sun, 10 Nov 2019 09:02:14 +0000 (18:02 +0900)] 
Merge branch 'jc/am-show-current-patch-docfix'

Doc update.

* jc/am-show-current-patch-docfix:
  doc: am --show-current-patch gives an entire e-mail message

4 years agoMerge branch 'wb/midx-progress'
Junio C Hamano [Sun, 10 Nov 2019 09:02:14 +0000 (18:02 +0900)] 
Merge branch 'wb/midx-progress'

The code to generate multi-pack index learned to show (or not to
show) progress indicators.

* wb/midx-progress:
  multi-pack-index: add [--[no-]progress] option.
  midx: honor the MIDX_PROGRESS flag in midx_repack
  midx: honor the MIDX_PROGRESS flag in verify_midx_file
  midx: add progress to expire_midx_packs
  midx: add progress to write_midx_file
  midx: add MIDX_PROGRESS flag

4 years agoMerge branch 'en/merge-recursive-directory-rename-fixes'
Junio C Hamano [Sun, 10 Nov 2019 09:02:13 +0000 (18:02 +0900)] 
Merge branch 'en/merge-recursive-directory-rename-fixes'

When all files from some subdirectory were renamed to the root
directory, the directory rename heuristics would fail to detect that
as a rename/merge of the subdirectory to the root directory, which has
been corrected.

* en/merge-recursive-directory-rename-fixes:
  t604[236]: do not run setup in separate tests
  merge-recursive: fix merging a subdirectory into the root directory
  merge-recursive: clean up get_renamed_dir_portion()

4 years agoMerge branch 'js/rebase-deprecate-preserve-merges'
Junio C Hamano [Sun, 10 Nov 2019 09:02:13 +0000 (18:02 +0900)] 
Merge branch 'js/rebase-deprecate-preserve-merges'

"git rebase --preserve-merges" has been marked as deprecated; this
release stops advertising it in the "git rebase -h" output.

* js/rebase-deprecate-preserve-merges:
  rebase: hide --preserve-merges option

4 years agoMerge branch 'hv/bitshift-constants-in-blame'
Junio C Hamano [Sun, 10 Nov 2019 09:02:12 +0000 (18:02 +0900)] 
Merge branch 'hv/bitshift-constants-in-blame'

Move the definition of a set of bitmask constants from 0ctal
literal to (1U<<count) notation.

* hv/bitshift-constants-in-blame:
  builtin/blame.c: constants into bit shift format

4 years agoMerge branch 'dd/notes-copy-default-dst-to-head'
Junio C Hamano [Sun, 10 Nov 2019 09:02:12 +0000 (18:02 +0900)] 
Merge branch 'dd/notes-copy-default-dst-to-head'

"git notes copy $original" ought to copy the notes attached to the
original object to HEAD, but a mistaken tightening to command line
parameter validation made earlier disabled that feature by mistake.

* dd/notes-copy-default-dst-to-head:
  notes: fix minimum number of parameters to "copy" subcommand
  t3301: test diagnose messages for too few/many paramters

4 years agoMerge branch 'pw/post-commit-from-sequencer'
Junio C Hamano [Sun, 10 Nov 2019 09:02:12 +0000 (18:02 +0900)] 
Merge branch 'pw/post-commit-from-sequencer'

"rebase -i" ceased to run post-commit hook by mistake in an earlier
update, which has been corrected.

* pw/post-commit-from-sequencer:
  sequencer: run post-commit hook
  move run_commit_hook() to libgit and use it there
  sequencer.h fix placement of #endif
  t3404: remove uneeded calls to set_fake_editor
  t3404: set $EDITOR in subshell
  t3404: remove unnecessary subshell

4 years agoMerge branch 'dl/format-patch-cover-from-desc'
Junio C Hamano [Sun, 10 Nov 2019 09:02:11 +0000 (18:02 +0900)] 
Merge branch 'dl/format-patch-cover-from-desc'

The branch description ("git branch --edit-description") has been
used to fill the body of the cover letters by the format-patch
command; this has been enhanced so that the subject can also be
filled.

* dl/format-patch-cover-from-desc:
  format-patch: teach --cover-from-description option
  format-patch: use enum variables
  format-patch: replace erroneous and condition

4 years agoMerge branch 'es/walken-tutorial'
Junio C Hamano [Sun, 10 Nov 2019 09:02:11 +0000 (18:02 +0900)] 
Merge branch 'es/walken-tutorial'

A tutorial on object enumeration.

* es/walken-tutorial:
  documentation: add tutorial for object walking

4 years agoMerge branch 'jt/fetch-pack-record-refs-in-the-dot-promisor'
Junio C Hamano [Sun, 10 Nov 2019 09:02:10 +0000 (18:02 +0900)] 
Merge branch 'jt/fetch-pack-record-refs-in-the-dot-promisor'

Debugging support for lazy cloning has been a bit improved.

* jt/fetch-pack-record-refs-in-the-dot-promisor:
  fetch-pack: write fetched refs to .promisor

4 years agoGit 2.24 v2.24.0
Junio C Hamano [Mon, 4 Nov 2019 04:32:41 +0000 (13:32 +0900)] 
Git 2.24

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'bc/doc-use-docbook-5'
Junio C Hamano [Mon, 4 Nov 2019 04:33:06 +0000 (13:33 +0900)] 
Merge branch 'bc/doc-use-docbook-5'

Finishing touches to the recent update to the build procedure for
the documentation.

* bc/doc-use-docbook-5:
  manpage-bold-literal.xsl: match for namespaced "d:literal" in template

4 years agoMerge branch 'ds/commit-graph-on-fetch'
Junio C Hamano [Mon, 4 Nov 2019 04:33:06 +0000 (13:33 +0900)] 
Merge branch 'ds/commit-graph-on-fetch'

Regression fix.

* ds/commit-graph-on-fetch:
  commit-graph: fix writing first commit-graph during fetch
  t5510-fetch.sh: demonstrate fetch.writeCommitGraph bug

4 years agoMerge branch 'jt/delay-fetch-if-missing'
Junio C Hamano [Mon, 4 Nov 2019 04:33:05 +0000 (13:33 +0900)] 
Merge branch 'jt/delay-fetch-if-missing'

Work-around a lazy fetch glitch.

* jt/delay-fetch-if-missing:
  fetch: delay fetch_if_missing=0 until after config

4 years agoMerge https://github.com/prati0100/git-gui
Junio C Hamano [Mon, 4 Nov 2019 04:29:38 +0000 (13:29 +0900)] 
Merge https://github.com/prati0100/git-gui

* https://github.com/prati0100/git-gui:
  git-gui: improve Japanese translation
  git-gui: add a readme
  git-gui: support for diff3 conflict style
  git-gui: use existing interface to query a path's attribute
  git-gui (Windows): use git-bash.exe if it is available
  treewide: correct several "up-to-date" to "up to date"
  Fix build with core.autocrlf=true

4 years agoMerge tag 'l10n-2.24.0-rnd2' of https://github.com/git-l10n/git-po
Junio C Hamano [Mon, 4 Nov 2019 04:25:13 +0000 (13:25 +0900)] 
Merge tag 'l10n-2.24.0-rnd2' of https://github.com/git-l10n/git-po

l10n-2.24.0-rnd2

* tag 'l10n-2.24.0-rnd2' of https://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.24.0 l10n round 1~2
  l10n: de.po: Update German translation
  l10n: sv.po: Update Swedish translation (4695t0f0u)
  l10n: bg.po: Updated Bulgarian translation (4694)
  l10n: vi(4694t): Updated translation for v2.24.0
  l10n: es: 2.24.0 round 2
  l10n: it.po: update the Italian translation for Git 2.24.0 round #2
  l10n: fr v2.24.0 rnd2
  l10n: git.pot: v2.24.0 round 2 (1 new)
  l10n: it.po: update the Italian translation for Git 2.24.0
  l10n: fr 2.24.0 rnd 1
  l10n: git.pot: v2.24.0 round 1 (35 new, 16 removed)
  l10n: bg.po: Updated Bulgarian translation (4693)
  l10n: sv.po: Update Swedish translation (4674t0f0u)
  l10n: Update Catalan translation

4 years agol10n: zh_CN: for git v2.24.0 l10n round 1~2
Jiang Xin [Tue, 29 Oct 2019 02:50:30 +0000 (10:50 +0800)] 
l10n: zh_CN: for git v2.24.0 l10n round 1~2

Translate 36 new messages (4694t0f0u) for git 2.24.0.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
4 years agostash: handle staged changes in skip-worktree files correctly
Johannes Schindelin [Wed, 30 Oct 2019 10:49:38 +0000 (10:49 +0000)] 
stash: handle staged changes in skip-worktree files correctly

When calling `git stash` while changes were staged for files that are
marked with the `skip-worktree` bit (e.g. files that are excluded in a
sparse checkout), the files are recorded as _deleted_ instead.

The reason is that `git stash` tries to construct the tree reflecting
the worktree essentially by copying the index to a temporary one and
then updating the files from the worktree. Crucially, it calls `git
diff-index` to update also those files that are in the HEAD but have
been unstaged in the index.

However, when the temporary index is updated via `git update-index --add
--remove`, skip-worktree entries mark the files as deleted by mistake.

Let's use the newly-introduced `--ignore-skip-worktree-entries` option
of `git update-index` to prevent exactly this from happening.

Note that the regression test case deliberately avoids replicating the
scenario described above and instead tries to recreate just the symptom.

Reported by Dan Thompson.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoupdate-index: optionally leave skip-worktree entries alone
Johannes Schindelin [Wed, 30 Oct 2019 10:49:37 +0000 (10:49 +0000)] 
update-index: optionally leave skip-worktree entries alone

While `git update-index` mostly ignores paths referring to index entries
whose skip-worktree bit is set, in b4d1690df11 (Teach Git to respect
skip-worktree bit (reading part), 2009-08-20), for reasons that are not
entirely obvious, the `--remove` option was made special: it _does_
remove index entries even if their skip-worktree bit is set.

Seeing as this behavior has been in place for a decade now, it does not
make sense to change it.

However, in preparation for fixing a bug in `git stash` where it
pretends that skip-worktree entries have actually been removed, we need
a mode where `git update-index` leaves all skip-worktree entries alone,
even if the `--remove` option was passed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agovreportf(): avoid relying on stdio buffering
Johannes Schindelin [Wed, 30 Oct 2019 10:44:36 +0000 (10:44 +0000)] 
vreportf(): avoid relying on stdio buffering

The MSVC runtime behavior differs from glibc's with respect to
`fprintf(stderr, ...)` in that the former writes out the message
character by character.

In t5516, this leads to a funny problem where a `git fetch` process as
well as the `git upload-pack` process spawned by it _both_ call `die()`
at the same time. The output can look like this:

fatal: git uploadfata-lp: raemcokte :error:  upload-pnot our arcef k6: n4ot our ea4cr1e3f 36d45ea94fca1398e86a771eda009872d63adb28598f6a9
8e86a771eda009872d6ab2886

Let's avoid this predicament altogether by rendering the entire message,
including the prefix and the trailing newline, into the buffer we
already have (and which is still fixed size) and then write it out via
`write_in_full()`.

We still clip the message to at most 4095 characters.

The history of `vreportf()` with regard to this issue includes the
following commits:

d048a96e (2007-11-09) - 'char msg[256]' is introduced to avoid interleaving
389d1767 (2009-03-25) - Buffer size increased to 1024 to avoid truncation
625a860c (2009-11-22) - Buffer size increased to 4096 to avoid truncation
f4c3edc0 (2015-08-11) - Buffer removed to avoid truncation
b5a9e435 (2017-01-11) - Reverts f4c3edc0 to be able to replace control
                        chars before sending to stderr
9ac13ec9 (2006-10-11) - Another attempt to solve interleaving.
                        This is seemingly related to d048a96e.
137a0d0e (2007-11-19) - Addresses out-of-order for display()
34df8aba (2009-03-10) - Switches xwrite() to fprintf() in recv_sideband()
                        to support UTF-8 emulation
eac14f89 (2012-01-14) - Removes the need for fprintf() for UTF-8 emulation,
                        so it's safe to use xwrite() again
5e5be9e2 (2016-06-28) - recv_sideband() uses xwrite() again

Note that we print nothing if the `vsnprintf()` call failed to render
the error message; There is little we can do in that case, and it should
not happen anyway.

The process may have written to `stderr` and there may be something left
in the buffer kept in the stdio layer. Call `fflush(stderr)` before
writing the message we prepare in this function.

Helped-by: Jeff King <peff@peff.net>
Helped-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoRelNotes/2.24.0: fix self-contradictory note
Elijah Newren [Wed, 30 Oct 2019 20:21:18 +0000 (20:21 +0000)] 
RelNotes/2.24.0: fix self-contradictory note

As per Wikipedia, "In current technical usage, for one to state that a
feature is deprecated is merely a recommendation against using it."  It
is thus contradictory to claim that something is not "officially
deprecated" and then to immediately state that we are both discouraging
its use and pointing people elsewhere.

Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomanpage-bold-literal.xsl: match for namespaced "d:literal" in template
Martin Ågren [Thu, 31 Oct 2019 06:22:27 +0000 (07:22 +0100)] 
manpage-bold-literal.xsl: match for namespaced "d:literal" in template

We recently regressed our rendering with Asciidoctor of "literal"
elements in our manpages, i.e, stuff we have placed within `backticks`
in order to render as monospace. In particular, we lost the bold
rendering of such literal text.

The culprit is f6461b82b9 ("Documentation: fix build with Asciidoctor 2",
2019-09-15), where we switched from DocBook 4.5 to DocBook 5 with
Asciidoctor. As part of the switch, we started using the namespaced
DocBook XSLT stylesheets rather than the non-namespaced ones. (See
f6461b82b9 for more details on why we changed to the namespaced ones.)

The bold literals are implemented as an XSLT snippet <xsl:template
match="literal">...</xsl:template>. Now that we use namespaces, this
doesn't pick up our literals like it used to.

Match for "d:literal" in addition to just "literal", after defining the
d namespace. ("d" is what
http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
uses.) Note that we need to keep matching without the namespace for
AsciiDoc.

This boldness was introduced by 5121a6d993 ("Documentation: option to
render literal text as bold for manpages", 2009-03-27) and made the
default in 5945717009 ("Documentation: bold literals in man",
2016-05-31).

One reason this was not caught in review is that our doc-diff tool diffs
without any boldness, i.e., it "only" compares text. As pointed out by
Peff in review of this patch, one can use `MAN_KEEP_FORMATTING=1
./doc-diff <...>`

This has been optically tested with AsciiDoc 8.6.10, Asciidoctor 1.5.5
and Asciidoctor 2.0.10. I've also verified that doc-diff produces the
empty output for all three programs, as expected, and that with the
MAN_KEEP_FORMATTING trick, AsciiDoc yields no diff, whereas with
Asciidoctor, we get bold literals, just like we want.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoRelNotes/2.24.0: typofix
Elijah Newren [Wed, 30 Oct 2019 20:21:17 +0000 (20:21 +0000)] 
RelNotes/2.24.0: typofix

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogit-diff.txt: document return code of `--no-index`
Denton Liu [Tue, 29 Oct 2019 16:54:32 +0000 (09:54 -0700)] 
git-diff.txt: document return code of `--no-index`

Within diff_no_index(), we have the following:

revs->diffopt.flags.exit_with_status = 1;

...

/*
 * The return code for --no-index imitates diff(1):
 * 0 = no changes, 1 = changes, else error
 */
return diff_result_code(&revs->diffopt, 0);

Which means when `git diff` is run in `--no-index` mode, `--exit-code`
is implied. However, the documentation for this is missing in
git-diff.txt.

Add a note about how `--exit-code` is implied in the `--no-index`
documentation to cover this documentation blindspot.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agol10n: de.po: Update German translation
Matthias Rüster [Wed, 23 Oct 2019 17:13:19 +0000 (19:13 +0200)] 
l10n: de.po: Update German translation

Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
4 years agol10n: sv.po: Update Swedish translation (4695t0f0u)
Peter Krefting [Wed, 30 Oct 2019 22:22:13 +0000 (23:22 +0100)] 
l10n: sv.po: Update Swedish translation (4695t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
4 years agoGit 2.24-rc2 v2.24.0-rc2
Junio C Hamano [Wed, 30 Oct 2019 06:12:53 +0000 (15:12 +0900)] 
Git 2.24-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'wb/fsmonitor-bitmap-fix'
Junio C Hamano [Wed, 30 Oct 2019 06:13:13 +0000 (15:13 +0900)] 
Merge branch 'wb/fsmonitor-bitmap-fix'

Comment update.

* wb/fsmonitor-bitmap-fix:
  t7519-status-fsmonitor: improve comments

4 years agoMerge branch 'rl/gitweb-blame-prev-fix'
Junio C Hamano [Wed, 30 Oct 2019 06:13:13 +0000 (15:13 +0900)] 
Merge branch 'rl/gitweb-blame-prev-fix'

Fix a rather old bug in gitweb---incremental blame output in
javascript actions mode never worked.

* rl/gitweb-blame-prev-fix:
  gitweb: correctly store previous rev in javascript-actions mode

4 years agoMerge branch 'js/mingw-needs-hiding-fix'
Junio C Hamano [Wed, 30 Oct 2019 06:13:13 +0000 (15:13 +0900)] 
Merge branch 'js/mingw-needs-hiding-fix'

Fix for a (rather old) buffer-overrun bug.

* js/mingw-needs-hiding-fix:
  mingw: avoid a buffer overrun in `needs_hiding()`

4 years agoMerge branch 'master' of github.com:vnwildman/git
Jiang Xin [Wed, 30 Oct 2019 06:07:58 +0000 (14:07 +0800)] 
Merge branch 'master' of github.com:vnwildman/git

* 'master' of github.com:vnwildman/git:
  l10n: vi(4694t): Updated translation for v2.24.0

4 years agoMerge branch 'next' of github.com:ChrisADR/git-po
Jiang Xin [Wed, 30 Oct 2019 06:02:22 +0000 (14:02 +0800)] 
Merge branch 'next' of github.com:ChrisADR/git-po

* 'next' of github.com:ChrisADR/git-po:
  l10n: es: 2.24.0 round 2

4 years agot7519-status-fsmonitor: improve comments
William Baker [Wed, 16 Oct 2019 19:35:47 +0000 (19:35 +0000)] 
t7519-status-fsmonitor: improve comments

The comments for the staging/unstaging test did not accurately
describe the scenario being tested.  It is not essential that
the test files being staged/unstaged appear at the end of the
index.  All that is required is that the test files are not
flagged with CE_FSMONITOR_VALID and have a position in the
index greater than the number of entries in the index after
unstaging.

The comment for this test has been updated to be more
accurate with respect to the scenario that's being tested.

Signed-off-by: William Baker <William.Baker@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopretty: add "%aL" etc. to show local-part of email addresses
Prarit Bhargava [Tue, 29 Oct 2019 12:09:14 +0000 (08:09 -0400)] 
pretty: add "%aL" etc. to show local-part of email addresses

In many projects the number of contributors is low enough that users know
each other and the full email address doesn't need to be displayed.
Displaying only the author's username saves a lot of columns on the screen.

Existing 'e/E' (as in "%ae" and "%aE") placeholders would show the
author's address as "prarit@redhat.com", which would waste columns to show
the same domain-part for all contributors when used in a project internal
to redhat.  Introduce 'l/L' placeholders that strip '@' and domain part from
the e-mail address.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoworktree: teach "add" to ignore submodule.recurse config
Philippe Blain [Sun, 27 Oct 2019 17:16:25 +0000 (17:16 +0000)] 
worktree: teach "add" to ignore submodule.recurse config

"worktree add" internally calls "reset --hard", but if
submodule.recurse is set, reset tries to recurse into
initialized submodules, which makes start_command try to
cd into non-existing submodule paths and die.

Fix that by making sure that the call to reset in "worktree add"
does not recurse.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agol10n: bg.po: Updated Bulgarian translation (4694)
Alexander Shopov [Tue, 29 Oct 2019 10:37:45 +0000 (11:37 +0100)] 
l10n: bg.po: Updated Bulgarian translation (4694)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
4 years agol10n: vi(4694t): Updated translation for v2.24.0
Tran Ngoc Quan [Tue, 29 Oct 2019 07:38:42 +0000 (14:38 +0700)] 
l10n: vi(4694t): Updated translation for v2.24.0

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
4 years agohelp: add gitsubmodules to the list of guides
Philippe Blain [Mon, 28 Oct 2019 13:05:46 +0000 (13:05 +0000)] 
help: add gitsubmodules to the list of guides

The guide "gitsubmodules" was added in d480345 (submodules: overhaul
documentation, 2017-06-22), but it was not added to
command-list.txt when commit 1b81d8c (help: use command-list.txt
for the source of guides, 2018-05-20) taught "git help" to obtain the
guide list from this file.

Add it now, and capitalize the first word of the description of
gitsubmodules, as was done in 1b81d8c (help: use command-list.txt
for the source of guides, 2018-05-20) for the other guides.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogit_path(): handle `.lock` files correctly
Johannes Schindelin [Mon, 28 Oct 2019 12:57:18 +0000 (12:57 +0000)] 
git_path(): handle `.lock` files correctly

Ever since worktrees were introduced, the `git_path()` function _really_
needed to be called e.g. to get at the path to `logs/HEAD` (`HEAD` is
specific to the worktree, and therefore so is its reflog). However, the
wrong path is returned for `logs/HEAD.lock`.

This does not matter as long as the Git executable is doing the asking,
as the path for that `logs/HEAD.lock` file is constructed from
`git_path("logs/HEAD")` by appending the `.lock` suffix.

However, Git GUI just learned to use `--git-path` instead of appending
relative paths to what `git rev-parse --git-dir` returns (and as a
consequence not only using the correct hooks directory, but also using
the correct paths in worktrees other than the main one). While it does
not seem as if Git GUI in particular is asking for `logs/HEAD.lock`,
let's be safe rather than sorry.

Side note: Git GUI _does_ ask for `index.lock`, but that is already
resolved correctly, due to `update_common_dir()` preferring to leave
unknown paths in the (worktree-specific) git directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot1400: wrap setup code in test case
Johannes Schindelin [Mon, 28 Oct 2019 12:57:17 +0000 (12:57 +0000)] 
t1400: wrap setup code in test case

Without this, you cannot use `--run=<...>` to skip that part, and a run
with `--run=0` (which is a common way to determine the test case number
corresponding to a given test case title).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobuiltin/blame.c: remove '--indent-heuristic' from usage string
SZEDER Gábor [Mon, 28 Oct 2019 10:52:41 +0000 (11:52 +0100)] 
builtin/blame.c: remove '--indent-heuristic' from usage string

The indent heuristic is our default diff heuristic since 33de716387
(diff: enable indent heuristic by default, 2017-05-08), but the usage
string of 'git blame' still mentions it as "experimental heuristic".

We could simply update the short help associated with the option, but
according to the comment above the option's declaration it was "only
included here to get included in the "-h" output".  That made sense
while the feature was still experimental and we wanted to give it more
exposure, but nowadays it's unnecessary.

So let's rather remove the '--indent-heuristic' option from 'git
blame's usage string.  Note that 'git blame' will still accept this
option, as it is parsed in parse_revision_opt().

Astute readers may notice that this patch removes a comment mentioning
"the following two options", but it only removes one option.  The
reason is that the comment is outdated: that other options was
'--compaction-heuristic', and it has already been removed in
3cde4e02ee (diff: retire "compaction" heuristics, 2016-12-23), but
that commit forgot to update this comment.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoclone: rename static function `dir_exists()`.
Miriam Rubio [Mon, 28 Oct 2019 16:55:23 +0000 (17:55 +0100)] 
clone: rename static function `dir_exists()`.

builtin/clone.c has a static function dir_exists() that
checks if a given path exists on the filesystem.  It returns
true (and it is correct for it to return true) when the
given path exists as a non-directory (e.g. a regular file).

This is confusing.  What the caller wants to check, and what
this function wants to return, is if the path exists, so
rename it to path_exists().

Signed-off-by: Miriam Rubio <mirucam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoDocumentation/git-bisect.txt: add --no-ff to merge command
Mihail Atanassov [Mon, 28 Oct 2019 22:01:22 +0000 (22:01 +0000)] 
Documentation/git-bisect.txt: add --no-ff to merge command

The hotfix application example uses `git merge --no-commit` to apply
temporary changes to the working tree during a bisect operation. In some
situations this can be a fast-forward and `merge` will apply the hotfix
branch's commits regardless of `--no-commit` (as documented in the `git
merge` manual).

In the pathological case this will make a `git bisect run` invocation
loop indefinitely between the first bisect step and the fast-forwarded
post-merge HEAD.

Add `--no-ff` to the merge command to avoid this issue.

Signed-off-by: Mihail Atanassov <m.atanassov92@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agol10n: es: 2.24.0 round 2
Christopher Diaz Riveros [Sun, 15 Sep 2019 21:56:56 +0000 (23:56 +0200)] 
l10n: es: 2.24.0 round 2

Signed-off-by: Christopher Diaz Riveros <christopher.diaz.riv@gmail.com>
4 years agoMerge branch 'l10n/it/update-italian-translation'
Jiang Xin [Mon, 28 Oct 2019 23:27:51 +0000 (07:27 +0800)] 
Merge branch 'l10n/it/update-italian-translation'

* 'update-italian-translation' of github.com:AlessandroMenti/git-po:
  l10n: it.po: update the Italian translation for Git 2.24.0 round #2

4 years agol10n: it.po: update the Italian translation for Git 2.24.0 round #2
Alessandro Menti [Mon, 28 Oct 2019 19:44:05 +0000 (20:44 +0100)] 
l10n: it.po: update the Italian translation for Git 2.24.0 round #2

Signed-off-by: Alessandro Menti <alessandro.menti@alessandromenti.it>
4 years agol10n: fr v2.24.0 rnd2
Jean-Noël Avila [Mon, 28 Oct 2019 19:36:01 +0000 (20:36 +0100)] 
l10n: fr v2.24.0 rnd2

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
4 years agol10n: git.pot: v2.24.0 round 2 (1 new)
Jiang Xin [Mon, 28 Oct 2019 05:16:31 +0000 (13:16 +0800)] 
l10n: git.pot: v2.24.0 round 2 (1 new)

Generate po/git.pot from v2.24.0-rc1 for git v2.24.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
4 years agoMerge tag 'v2.24.0-rc1' of github.com:git/git into master
Jiang Xin [Mon, 28 Oct 2019 05:18:55 +0000 (13:18 +0800)] 
Merge tag 'v2.24.0-rc1' of github.com:git/git into master

Git 2.24-rc1

* tag 'v2.24.0-rc1' of github.com:git/git:
  Git 2.24-rc1
  repo-settings: read an int for index.version
  ci: fix GCC install in the Travis CI GCC OSX job
  Eleventh batch
  ci(osx): use new location of the `perforce` cask
  t7419: change test_must_fail to ! for grep
  t4014: make output-directory tests self-contained
  ci(visual-studio): actually run the tests in parallel
  ci(visual-studio): use strict compile flags, and optimization
  userdiff: fix some corner cases in dts regex
  test-progress: fix test failures on big-endian systems
  completion: clarify installation instruction for zsh
  grep: avoid leak of chartables in PCRE2
  grep: make PCRE2 aware of custom allocator
  grep: make PCRE1 aware of custom allocator
  remote-curl: pass on atomic capability to remote side
  diff-highlight: fix a whitespace nit
  fsmonitor: don't fill bitmap with entries to be removed

4 years agofsck: accept an oid instead of a "struct tree" for fsck_tree()
Jeff King [Fri, 18 Oct 2019 05:02:08 +0000 (01:02 -0400)] 
fsck: accept an oid instead of a "struct tree" for fsck_tree()

We don't actually look at the tree struct in fsck_tree() beyond its oid
and type (which is obviously OBJ_TREE). Just taking an oid gives our
callers more flexibility to avoid creating a struct, and makes it clear
that we are fscking just what is in the buffer, not any pre-parsed bits
from the struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: accept an oid instead of a "struct commit" for fsck_commit()
Jeff King [Fri, 18 Oct 2019 05:01:48 +0000 (01:01 -0400)] 
fsck: accept an oid instead of a "struct commit" for fsck_commit()

We don't actually look at the commit struct in fsck_commit() beyond its
oid and type (which is obviously OBJ_COMMIT). Just taking an oid gives
our callers more flexibility to avoid creating or parsing a struct, and
makes it clear that we are fscking just what is in the buffer, not any
pre-parsed bits from the struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: accept an oid instead of a "struct tag" for fsck_tag()
Jeff King [Fri, 18 Oct 2019 05:01:26 +0000 (01:01 -0400)] 
fsck: accept an oid instead of a "struct tag" for fsck_tag()

We don't actually look at the tag struct in fsck_tag() beyond its oid
and type (which is obviously OBJ_TAG). Just taking an oid gives our
callers more flexibility to avoid creating or parsing a struct, and
makes it clear that we are fscking just what is in the buffer, not any
pre-parsed bits from the struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: rename vague "oid" local variables
Jeff King [Fri, 18 Oct 2019 05:00:59 +0000 (01:00 -0400)] 
fsck: rename vague "oid" local variables

In fsck_commit() and fsck_tag(), we have local "oid" variables used for
parsing parent and tagged-object oids. Let's give these more specific
names in preparation for the functions taking an "oid" parameter for the
object we're checking.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: don't require an object struct in verify_headers()
Jeff King [Fri, 18 Oct 2019 05:00:50 +0000 (01:00 -0400)] 
fsck: don't require an object struct in verify_headers()

We only need the oid and type to pass on to report(). Let's accept the
broken-out parameters to give our callers more flexibility.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: don't require an object struct for fsck_ident()
Jeff King [Fri, 18 Oct 2019 05:00:04 +0000 (01:00 -0400)] 
fsck: don't require an object struct for fsck_ident()

The only thing we do with the struct is pass its oid and type to
report(). We can just take those explicitly, which gives our callers
more flexibility.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: drop blob struct from fsck_finish()
Jeff King [Fri, 18 Oct 2019 04:59:54 +0000 (00:59 -0400)] 
fsck: drop blob struct from fsck_finish()

Since fsck_blob() no longer requires us to have a "struct blob", we
don't need to create one. Which also means we don't need to worry about
handling the case that lookup_blob() returns NULL (we'll still catch
wrongly-identified blobs when we read the actual object contents and
type from disk).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: accept an oid instead of a "struct blob" for fsck_blob()
Jeff King [Fri, 18 Oct 2019 04:59:29 +0000 (00:59 -0400)] 
fsck: accept an oid instead of a "struct blob" for fsck_blob()

We don't actually need any information from the object struct except its
oid (and the type, of course, but that's implicitly OBJ_BLOB). This
gives our callers more flexibility to drop the object structs, too.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: don't require an object struct for report()
Jeff King [Fri, 18 Oct 2019 04:59:15 +0000 (00:59 -0400)] 
fsck: don't require an object struct for report()

The report() function really only cares about the oid and type of the
object, not the full object struct. Let's convert it to take those two
items separately, which gives our callers more flexibility.

This makes some already-long lines even longer. I've mostly left them,
as our eventual goal is to shrink these down as we continue refactoring
(e.g., "&item->object" becomes "&item->object.oid, item->object.type",
but will eventually shrink down to "oid, type").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: only require an oid for skiplist functions
Jeff King [Fri, 18 Oct 2019 04:58:51 +0000 (00:58 -0400)] 
fsck: only require an oid for skiplist functions

The skiplist is inherently an oidset, so we don't need a full object
struct. Let's take just the oid to give our callers more flexibility.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: only provide oid/type in fsck_error callback
Jeff King [Fri, 18 Oct 2019 04:58:40 +0000 (00:58 -0400)] 
fsck: only provide oid/type in fsck_error callback

None of the callbacks actually care about having a "struct object";
they're happy with just the oid and type information. So let's give
ourselves more flexibility to avoid having a "struct object" by just
passing the broken-down fields.

Note that the callback already takes a "type" field for the fsck message
type. We'll rename that to "msg_type" (and use "object_type" for the
object type) to make the distinction explicit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: don't require object structs for display functions
Jeff King [Fri, 18 Oct 2019 04:58:07 +0000 (00:58 -0400)] 
fsck: don't require object structs for display functions

Our printable_type() and describe_object() functions take whole object
structs, but they really only care about the oid and type. Let's take
those individually in order to give our callers more flexibility.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: use oids rather than objects for object_name API
Jeff King [Fri, 18 Oct 2019 04:57:37 +0000 (00:57 -0400)] 
fsck: use oids rather than objects for object_name API

We don't actually care about having object structs; we only need to look
up decorations by oid. Let's accept this more limited form, which will
give our callers more flexibility.

Note that the decoration API we rely on uses object structs itself (even
though it only looks at their oids). We can solve this by switching to
a kh_oid_map (we could also use the hashmap oidmap, but it's more
awkward for the simple case of just storing a void pointer).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck_describe_object(): build on our get_object_name() primitive
Jeff King [Fri, 18 Oct 2019 04:56:38 +0000 (00:56 -0400)] 
fsck_describe_object(): build on our get_object_name() primitive

This isolates the implementation detail of using the decoration code to
our put/get functions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: unify object-name code
Jeff King [Fri, 18 Oct 2019 04:56:13 +0000 (00:56 -0400)] 
fsck: unify object-name code

Commit 90cf590f53 (fsck: optionally show more helpful info for broken
links, 2016-07-17) added a system for decorating objects with names. The
code is split across builtin/fsck.c (which gives the initial names) and
fsck.c (which adds to the names as it traverses the object graph). This
leads to some duplication, where both sites have near-identical
describe_object() functions (the difference being that the one in
builtin/fsck.c uses a circular array of buffers to allow multiple calls
in a single printf).

Let's provide a unified object_name API for fsck. That lets us drop the
duplication, as well as making the interface boundaries more clear
(which will let us refactor the implementation more in a future patch).

We'll leave describe_object() in builtin/fsck.c as a thin wrapper around
the new API, as it relies on a static global to make its many callers a
bit shorter.

We'll also convert the bare add_decoration() calls in builtin/fsck.c to
put_object_name(). This fixes two minor bugs:

  1. We leak many small strings. add_decoration() has a last-one-wins
     approach: it updates the decoration to the new string and returns
     the old one. But we ignore the return value, leaking the old
     string. This is quite common to trigger, since we look at reflogs:
     the tip of any ref will be described both by looking at the actual
     ref, as well as the latest reflog entry. So we'd always end up
     leaking one of those strings.

  2. The last-one-wins approach gives us lousy names. For instance, we
     first look at all of the refs, and then all of the reflogs. So
     rather than seeing "refs/heads/master", we're likely to overwrite
     it with "HEAD@{12345678}". We're generally better off using the
     first name we find.

     And indeed, the test in t1450 expects this ugly HEAD@{} name. After
     this patch, we've switched to using fsck_put_object_name()'s
     first-one-wins semantics, and we output the more human-friendly
     "refs/tags/julius" (and the test is updated accordingly).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: require an actual buffer for non-blobs
Jeff King [Fri, 18 Oct 2019 04:54:12 +0000 (00:54 -0400)] 
fsck: require an actual buffer for non-blobs

The fsck_object() function takes in a buffer, but also a "struct
object". The rules for using these vary between types:

  - for a commit, we'll use the provided buffer; if it's NULL, we'll
    fall back to get_commit_buffer(), which loads from either an
    in-memory cache or from disk. If the latter fails, we'd die(), which
    is non-ideal for fsck.

  - for a tag, a NULL buffer will fall back to loading the object from
    disk (and failure would lead to an fsck error)

  - for a tree, we _never_ look at the provided buffer, and always use
    tree->buffer

  - for a blob, we usually don't look at the buffer at all, unless it
    has been marked as a .gitmodule file. In that case we check the
    buffer given to us, or assume a NULL buffer is a very large blob
    (and complain about it)

This is much more complex than it needs to be. It turns out that nobody
ever feeds a NULL buffer that isn't a blob:

  - git-fsck calls fsck_object() only from fsck_obj(). That in turn is
    called by one of:

      - fsck_obj_buffer(), which is a callback to verify_pack(), which
unpacks everything except large blobs into a buffer (see
pack-check.c, lines 131-141).

      - fsck_loose(), which hits a BUG() on non-blobs with a NULL buffer
(builtin/fsck.c, lines 639-640)

    And in either case, we'll have just called parse_object_buffer()
    anyway, which would segfault on a NULL buffer for commits or tags
    (not for trees, but it would install a NULL tree->buffer which would
    later cause a segfault)

  - git-index-pack asserts that the buffer is non-NULL unless the object
    is a blob (see builtin/index-pack.c, line 832)

  - git-unpack-objects always writes a non-NULL buffer into its
    obj_buffer hash, which is then fed to fsck_object(). (There is
    actually a funny thing here where it does not store blob buffers at
    all, nor does it call fsck on them; it does check any needed blobs
    via fsck_finish() though).

Let's make the rules simpler, which reduces the amount of code and gives
us more flexibility in refactoring the fsck code. The new rules are:

  - only blobs are allowed to pass a NULL buffer

  - we always use the provided buffer, never pulling information from
    the object struct

We don't have to adjust any callers, because they were already adhering
to these. Note that we do drop a few fsck identifiers for missing tags,
but that was all dead code (because nobody passed a NULL tag buffer).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: stop checking tag->tagged
Jeff King [Fri, 18 Oct 2019 04:51:19 +0000 (00:51 -0400)] 
fsck: stop checking tag->tagged

Way back in 92d4c85d24 (fsck-cache: fix SIGSEGV on bad tag object,
2005-05-03), we added an fsck check that the "tagged" field of a tag
struct isn't NULL. But that was mainly protecting the printing code for
"--tags", and that code wasn't moved along with the check as part of
ba002f3b28 (builtin-fsck: move common object checking code to fsck.c,
2008-02-25).

It could also serve to detect type mismatch problems (where a tag points
to object X as a commit, but really X is a blob), but it couldn't do so
reliably (we'd call lookup_commit(X), but it will only notice the
problem if we happen to have previously called lookup_blob(X) in the
same process). And as of a commit earlier in this series, we'd consider
that a parse error and complain about the object even before getting to
this point anyway.

So let's drop this "tag->tagged" check. It's not helping anything, and
getting rid of it makes the function conceptually cleaner, as it really
is just checking the buffer we feed it. In fact, we can get rid of our
one-line wrapper and just unify fsck_tag() and fsck_tag_buffer().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: stop checking commit->parent counts
Jeff King [Fri, 18 Oct 2019 04:49:10 +0000 (00:49 -0400)] 
fsck: stop checking commit->parent counts

In 4516338243 (builtin-fsck: reports missing parent commits,
2008-02-25), we added code to check that fsck found the same number of
parents from parsing the commit itself as we see in the commit struct we
got from parse_commit_buffer(). Back then the rationale was that the
normal commit parser might skip some bad parents.

But earlier in this series, we started treating that reliably as a
parsing error, meaning that we'd complain about it before we even hit
the code in fsck.c.

Let's drop this code, which now makes fsck_commit_buffer() completely
independent of any parsed values in the commit struct (that's
conceptually cleaner, and also opens up more refactoring options).

Note that we can also drop the MISSING_PARENT and MISSING_GRAFT fsck
identifiers. This is no loss, as these would not trigger reliably
anyway.  We'd hit them only when lookup_commit() failed, which occurs
only if we happen to have seen the object with another type already in
the same process. In most cases, we'd actually run into the problem
during the connectivity walk, not here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agofsck: stop checking commit->tree value
Jeff King [Fri, 18 Oct 2019 04:48:20 +0000 (00:48 -0400)] 
fsck: stop checking commit->tree value

We check in fsck_commit_buffer() that commit->tree isn't NULL, which in
turn generally comes from a previous parse by parse_commit(). But this
isn't really accomplishing anything. The two things we might care about
are:

  - was there a syntactically valid "tree <oid>" line in the object? But
    we've just done our own parse in fsck_commit_buffer() to check this.

  - does it point to a valid tree object? But checking the "tree"
    pointer here doesn't actually accomplish that; it just shows that
    lookup_tree() didn't return NULL, which only means that we haven't
    yet seen that oid as a non-tree in this process.

    A real connectivity check would exhaustively walk all graph links,
    and we do that already in a separate function.

So this code isn't helping anything. And it makes the fsck code slightly
more confusing and rigid (e.g., it requires that any commit structs have
already been parsed). Let's drop it.

As a bit of history, the presence of this code looks like a leftover
from early fsck code (which did rely on parse_commit() to do most of the
parsing). The check comes from ff5ebe39b0 (Port fsck-cache to use
parsing functions, 2005-04-18), but we later added an explicit walk in
355885d531 (add generic, type aware object chain walker, 2008-02-25).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agocommit, tag: don't set parsed bit for parse failures
Jeff King [Fri, 25 Oct 2019 21:20:20 +0000 (17:20 -0400)] 
commit, tag: don't set parsed bit for parse failures

If we can't parse a commit, then parse_commit() will return an error
code. But it _also_ sets the "parsed" flag, which tells us not to bother
trying to re-parse the object. That means that subsequent parses have no
idea that the information in the struct may be bogus.  I.e., doing this:

  parse_commit(commit);
  ...
  if (parse_commit(commit) < 0)
          die("commit is broken");

will never trigger the die(). The second parse_commit() will see the
"parsed" flag and quietly return success.

There are two obvious ways to fix this:

  1. Stop setting "parsed" until we've successfully parsed.

  2. Keep a second "corrupt" flag to indicate that we saw an error (and
     when the parsed flag is set, return 0/-1 depending on the corrupt
     flag).

This patch does option 1. The obvious downside versus option 2 is that
we might continually re-parse a broken object. But in practice,
corruption like this is rare, and we typically die() or return an error
in the caller. So it's OK not to worry about optimizing for corruption.
And it's much simpler: we don't need to use an extra bit in the object
struct, and callers which check the "parsed" flag don't need to learn
about the corrupt bit, too.

There's no new test here, because this case is already covered in t5318.
Note that we do need to update the expected message there, because we
now detect the problem in the return from "parse_commit()", and not with
a separate check for a NULL tree. In fact, we can now ditch that
explicit tree check entirely, as we're covered robustly by this change
(and the previous recent change to treat a NULL tree as a parse error).

We'll also give tags the same treatment. I don't know offhand of any
cases where the problem can be triggered (it implies somebody ignoring a
parse error earlier in the process), but consistently returning an error
should cause the least surprise.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomingw: avoid a buffer overrun in `needs_hiding()`
Johannes Schindelin [Fri, 25 Oct 2019 14:13:36 +0000 (14:13 +0000)] 
mingw: avoid a buffer overrun in `needs_hiding()`

When this function is passed a path with a trailing slash, it runs right
over the end of that path.

Let's fix this.

Co-authored-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agobuiltin/commit-graph.c: remove subcommand-less usage string
SZEDER Gábor [Fri, 25 Oct 2019 16:49:09 +0000 (18:49 +0200)] 
builtin/commit-graph.c: remove subcommand-less usage string

The first line in 'git commit-graph's usage string indicates that this
command can be invoked without specifying a subcommand.  However, this
is not the case:

  $ git commit-graph
  usage: git commit-graph [--object-dir <objdir>]
     or: git commit-graph read [--object-dir <objdir>]
  [...]
  $ echo $?
  129

Remove this line from the usage string.

The synopsis in the manpage doesn't contain this line.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4048: abstract away SHA-1-specific constants
brian m. carlson [Mon, 28 Oct 2019 00:59:07 +0000 (00:59 +0000)] 
t4048: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4045: make hash-size independent
brian m. carlson [Mon, 28 Oct 2019 00:59:06 +0000 (00:59 +0000)] 
t4045: make hash-size independent

Replace a hard-coded all-zeros object ID with a use of $ZERO_OID.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4044: update test to work with SHA-256
brian m. carlson [Mon, 28 Oct 2019 00:59:05 +0000 (00:59 +0000)] 
t4044: update test to work with SHA-256

This test produces pseudo-collisions and tests git diff's behavior with
them, and is therefore sensitive to the hash in use. Update the test to
compute the collisions for both SHA-1 and SHA-256 using appropriate
constants. Move the heredocs inside the setup block so that all of the
setup code can be tested for failure.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4039: abstract away SHA-1-specific constants
brian m. carlson [Mon, 28 Oct 2019 00:59:04 +0000 (00:59 +0000)] 
t4039: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4038: abstract away SHA-1 specific constants
brian m. carlson [Mon, 28 Oct 2019 00:59:03 +0000 (00:59 +0000)] 
t4038: abstract away SHA-1 specific constants

Compute several object IDs that exist in expected output, since we don't
care about the specific object IDs, only that the format of the output
is syntactically correct.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4034: abstract away SHA-1-specific constants
brian m. carlson [Mon, 28 Oct 2019 00:59:02 +0000 (00:59 +0000)] 
t4034: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.  Move some expected result heredocs around so
that they can use computed variables.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4027: make hash-size independent
brian m. carlson [Mon, 28 Oct 2019 00:59:01 +0000 (00:59 +0000)] 
t4027: make hash-size independent

Instead of hard-coding the length of an object ID, look this value up
using the translation tables.  Similarly, compute input data for invalid
submodule entries using the tables as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4015: abstract away SHA-1-specific constants
brian m. carlson [Mon, 28 Oct 2019 00:59:00 +0000 (00:59 +0000)] 
t4015: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4011: abstract away SHA-1-specific constants
brian m. carlson [Mon, 28 Oct 2019 00:58:59 +0000 (00:58 +0000)] 
t4011: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot4010: abstract away SHA-1-specific constants
brian m. carlson [Mon, 28 Oct 2019 00:58:58 +0000 (00:58 +0000)] 
t4010: abstract away SHA-1-specific constants

Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>