]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'eb/hash-transition'
authorJunio C Hamano <gitster@pobox.com>
Thu, 28 Mar 2024 21:13:50 +0000 (14:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Mar 2024 21:13:50 +0000 (14:13 -0700)
Work to support a repository that work with both SHA-1 and SHA-256
hash algorithms has started.

* eb/hash-transition: (30 commits)
  t1016-compatObjectFormat: add tests to verify the conversion between objects
  t1006: test oid compatibility with cat-file
  t1006: rename sha1 to oid
  test-lib: compute the compatibility hash so tests may use it
  builtin/ls-tree: let the oid determine the output algorithm
  object-file: handle compat objects in check_object_signature
  tree-walk: init_tree_desc take an oid to get the hash algorithm
  builtin/cat-file: let the oid determine the output algorithm
  rev-parse: add an --output-object-format parameter
  repository: implement extensions.compatObjectFormat
  object-file: update object_info_extended to reencode objects
  object-file-convert: convert commits that embed signed tags
  object-file-convert: convert commit objects when writing
  object-file-convert: don't leak when converting tag objects
  object-file-convert: convert tag objects when writing
  object-file-convert: add a function to convert trees between algorithms
  object: factor out parse_mode out of fast-import and tree-walk into in object.h
  cache: add a function to read an OID of a specific algorithm
  tag: sign both hashes
  commit: export add_header_signature to support handling signatures on tags
  ...

1175 files changed:
.cirrus.yml
.clang-format
.github/PULL_REQUEST_TEMPLATE.md
.github/workflows/check-whitespace.yml
.github/workflows/coverity.yml [new file with mode: 0644]
.github/workflows/l10n.yml
.github/workflows/main.yml
.gitignore
.gitlab-ci.yml [new file with mode: 0644]
.mailmap
CODE_OF_CONDUCT.md
Documentation/CodingGuidelines
Documentation/Makefile
Documentation/MyFirstContribution.txt
Documentation/RelNotes/1.6.2.txt
Documentation/RelNotes/1.6.3.txt
Documentation/RelNotes/1.6.4.txt
Documentation/RelNotes/1.6.5.txt
Documentation/RelNotes/1.6.6.txt
Documentation/RelNotes/2.42.1.txt [new file with mode: 0644]
Documentation/RelNotes/2.43.0.txt [new file with mode: 0644]
Documentation/RelNotes/2.43.1.txt [new file with mode: 0644]
Documentation/RelNotes/2.43.2.txt [new file with mode: 0644]
Documentation/RelNotes/2.43.3.txt [new file with mode: 0644]
Documentation/RelNotes/2.44.0.txt [new file with mode: 0644]
Documentation/RelNotes/2.45.0.txt [new file with mode: 0644]
Documentation/ReviewingGuidelines.txt
Documentation/SubmittingPatches
Documentation/ToolsForGit.txt
Documentation/config.txt
Documentation/config/advice.txt
Documentation/config/alias.txt
Documentation/config/apply.txt
Documentation/config/attr.txt [new file with mode: 0644]
Documentation/config/branch.txt
Documentation/config/checkout.txt
Documentation/config/clean.txt
Documentation/config/clone.txt
Documentation/config/color.txt
Documentation/config/column.txt
Documentation/config/commit.txt
Documentation/config/core.txt
Documentation/config/credential.txt
Documentation/config/diff.txt
Documentation/config/extensions.txt
Documentation/config/fastimport.txt
Documentation/config/feature.txt
Documentation/config/fetch.txt
Documentation/config/format.txt
Documentation/config/fsck.txt
Documentation/config/fsmonitor--daemon.txt
Documentation/config/gc.txt
Documentation/config/gpg.txt
Documentation/config/gui.txt
Documentation/config/http.txt
Documentation/config/i18n.txt
Documentation/config/imap.txt
Documentation/config/index.txt
Documentation/config/init.txt
Documentation/config/interactive.txt
Documentation/config/log.txt
Documentation/config/mailinfo.txt
Documentation/config/maintenance.txt
Documentation/config/man.txt
Documentation/config/merge.txt
Documentation/config/mergetool.txt
Documentation/config/notes.txt
Documentation/config/pack.txt
Documentation/config/push.txt
Documentation/config/rebase.txt
Documentation/config/receive.txt
Documentation/config/rerere.txt
Documentation/config/safe.txt
Documentation/config/sendemail.txt
Documentation/config/sequencer.txt
Documentation/config/splitindex.txt
Documentation/config/stash.txt
Documentation/config/status.txt
Documentation/config/submodule.txt
Documentation/config/trace2.txt
Documentation/config/transfer.txt
Documentation/config/user.txt
Documentation/config/versionsort.txt
Documentation/diff-generate-patch.txt
Documentation/diff-options.txt
Documentation/fetch-options.txt
Documentation/fsck-msgids.txt
Documentation/git-add.txt
Documentation/git-am.txt
Documentation/git-apply.txt
Documentation/git-archive.txt
Documentation/git-bisect.txt
Documentation/git-blame.txt
Documentation/git-branch.txt
Documentation/git-bugreport.txt
Documentation/git-cat-file.txt
Documentation/git-check-attr.txt
Documentation/git-check-ignore.txt
Documentation/git-check-ref-format.txt
Documentation/git-checkout-index.txt
Documentation/git-checkout.txt
Documentation/git-clean.txt
Documentation/git-clone.txt
Documentation/git-commit-graph.txt
Documentation/git-commit.txt
Documentation/git-config.txt
Documentation/git-count-objects.txt
Documentation/git-credential-cache.txt
Documentation/git-credential-store.txt
Documentation/git-credential.txt
Documentation/git-cvsimport.txt
Documentation/git-cvsserver.txt
Documentation/git-daemon.txt
Documentation/git-diagnose.txt
Documentation/git-diff-files.txt
Documentation/git-diff-index.txt
Documentation/git-diff-tree.txt
Documentation/git-diff.txt
Documentation/git-difftool.txt
Documentation/git-fast-export.txt
Documentation/git-fast-import.txt
Documentation/git-fetch-pack.txt
Documentation/git-fetch.txt
Documentation/git-filter-branch.txt
Documentation/git-for-each-ref.txt
Documentation/git-format-patch.txt
Documentation/git-fsck.txt
Documentation/git-fsmonitor--daemon.txt
Documentation/git-gc.txt
Documentation/git-get-tar-commit-id.txt
Documentation/git-grep.txt
Documentation/git-hash-object.txt
Documentation/git-help.txt
Documentation/git-hook.txt
Documentation/git-http-backend.txt
Documentation/git-http-fetch.txt
Documentation/git-http-push.txt
Documentation/git-imap-send.txt
Documentation/git-index-pack.txt
Documentation/git-init.txt
Documentation/git-interpret-trailers.txt
Documentation/git-log.txt
Documentation/git-ls-files.txt
Documentation/git-mailsplit.txt
Documentation/git-maintenance.txt
Documentation/git-merge-base.txt
Documentation/git-merge-file.txt
Documentation/git-merge-tree.txt
Documentation/git-merge.txt
Documentation/git-mergetool--lib.txt
Documentation/git-mergetool.txt
Documentation/git-mktag.txt
Documentation/git-mktree.txt
Documentation/git-mv.txt
Documentation/git-name-rev.txt
Documentation/git-notes.txt
Documentation/git-pack-objects.txt
Documentation/git-prune-packed.txt
Documentation/git-prune.txt
Documentation/git-pull.txt
Documentation/git-push.txt
Documentation/git-quiltimport.txt
Documentation/git-range-diff.txt
Documentation/git-read-tree.txt
Documentation/git-rebase.txt
Documentation/git-receive-pack.txt
Documentation/git-reflog.txt
Documentation/git-remote-ext.txt
Documentation/git-remote-fd.txt
Documentation/git-remote.txt
Documentation/git-repack.txt
Documentation/git-replace.txt
Documentation/git-replay.txt [new file with mode: 0644]
Documentation/git-request-pull.txt
Documentation/git-restore.txt
Documentation/git-rev-list.txt
Documentation/git-rev-parse.txt
Documentation/git-revert.txt
Documentation/git-rm.txt
Documentation/git-send-email.txt
Documentation/git-send-pack.txt
Documentation/git-sh-setup.txt
Documentation/git-show-branch.txt
Documentation/git-show-ref.txt
Documentation/git-show.txt
Documentation/git-status.txt
Documentation/git-stripspace.txt
Documentation/git-submodule.txt
Documentation/git-svn.txt
Documentation/git-switch.txt
Documentation/git-symbolic-ref.txt
Documentation/git-tag.txt
Documentation/git-update-index.txt
Documentation/git-update-ref.txt
Documentation/git-update-server-info.txt
Documentation/git-upload-pack.txt
Documentation/git-var.txt
Documentation/git-verify-pack.txt
Documentation/git-whatchanged.txt
Documentation/git-worktree.txt
Documentation/git.txt
Documentation/gitattributes.txt
Documentation/gitcli.txt
Documentation/gitcore-tutorial.txt
Documentation/gitdiffcore.txt
Documentation/giteveryday.txt
Documentation/gitformat-bundle.txt
Documentation/gitformat-chunk.txt
Documentation/gitformat-index.txt
Documentation/gitformat-pack.txt
Documentation/githooks.txt
Documentation/gitk.txt
Documentation/gitprotocol-capabilities.txt
Documentation/gitprotocol-common.txt
Documentation/gitprotocol-http.txt
Documentation/gitprotocol-pack.txt
Documentation/gitprotocol-v2.txt
Documentation/gitremote-helpers.txt
Documentation/gitrepository-layout.txt
Documentation/gitsubmodules.txt
Documentation/gittutorial.txt
Documentation/gitweb.conf.txt
Documentation/gitweb.txt
Documentation/glossary-content.txt
Documentation/howto/coordinate-embargoed-releases.txt
Documentation/howto/keep-canonical-history-correct.txt
Documentation/howto/maintain-git.txt
Documentation/howto/update-hook-example.txt
Documentation/howto/use-git-daemon.txt
Documentation/howto/using-merge-subtree.txt
Documentation/i18n.txt
Documentation/merge-options.txt
Documentation/mergetools/vimdiff.txt
Documentation/pretty-formats.txt
Documentation/pretty-options.txt
Documentation/pull-fetch-param.txt
Documentation/ref-storage-format.txt [new file with mode: 0644]
Documentation/rev-list-options.txt
Documentation/scalar.txt
Documentation/signoff-option.txt
Documentation/technical/api-index-skel.txt
Documentation/technical/api-simple-ipc.txt
Documentation/technical/bitmap-format.txt
Documentation/technical/commit-graph.txt
Documentation/technical/parallel-checkout.txt
Documentation/technical/partial-clone.txt
Documentation/technical/racy-git.txt
Documentation/technical/reftable.txt
Documentation/technical/repository-version.txt
Documentation/technical/rerere.txt
Documentation/technical/unit-tests.txt [new file with mode: 0644]
Documentation/trace2-target-values.txt
Documentation/urls-remotes.txt
Documentation/urls.txt
Documentation/user-manual.txt
GIT-VERSION-GEN
INSTALL
Makefile
README.md
RelNotes
add-interactive.c
add-patch.c
advice.c
advice.h
apply.c
archive-tar.c
archive-zip.c
archive.c
archive.h
attr.c
attr.h
bisect.c
blame.c
blame.h
blob.c
bloom.c
branch.c
builtin.h
builtin/add.c
builtin/am.c
builtin/apply.c
builtin/archive.c
builtin/bisect.c
builtin/blame.c
builtin/branch.c
builtin/bugreport.c
builtin/cat-file.c
builtin/check-attr.c
builtin/checkout-index.c
builtin/checkout.c
builtin/clean.c
builtin/clone.c
builtin/column.c
builtin/commit-graph.c
builtin/commit-tree.c
builtin/commit.c
builtin/config.c
builtin/credential-cache.c
builtin/describe.c
builtin/diff-files.c
builtin/diff-index.c
builtin/diff-tree.c
builtin/diff.c
builtin/difftool.c
builtin/fast-export.c
builtin/fast-import.c
builtin/fetch.c
builtin/for-each-ref.c
builtin/fsck.c
builtin/fsmonitor--daemon.c
builtin/gc.c
builtin/get-tar-commit-id.c
builtin/grep.c
builtin/hash-object.c
builtin/hook.c
builtin/index-pack.c
builtin/init-db.c
builtin/interpret-trailers.c
builtin/log.c
builtin/ls-files.c
builtin/ls-remote.c
builtin/ls-tree.c
builtin/mailinfo.c
builtin/merge-base.c
builtin/merge-file.c
builtin/merge-recursive.c
builtin/merge-tree.c
builtin/merge.c
builtin/mktag.c
builtin/mv.c
builtin/name-rev.c
builtin/notes.c
builtin/pack-objects.c
builtin/pull.c
builtin/push.c
builtin/range-diff.c
builtin/read-tree.c
builtin/rebase.c
builtin/receive-pack.c
builtin/reflog.c
builtin/remote.c
builtin/repack.c
builtin/replay.c [new file with mode: 0644]
builtin/rerere.c
builtin/reset.c
builtin/rev-list.c
builtin/rev-parse.c
builtin/revert.c
builtin/rm.c
builtin/send-pack.c
builtin/show-ref.c
builtin/sparse-checkout.c
builtin/stash.c
builtin/submodule--helper.c
builtin/tag.c
builtin/unpack-objects.c
builtin/update-index.c
builtin/update-ref.c
builtin/upload-pack.c
builtin/var.c
builtin/verify-commit.c
builtin/verify-tag.c
builtin/worktree.c
bulk-checkin.c
bulk-checkin.h
bundle-uri.c
cache-tree.c
chunk-format.c
chunk-format.h
ci/config/README [new file with mode: 0644]
ci/config/allow-ref.sample [deleted file]
ci/install-dependencies.sh
ci/install-docker-dependencies.sh
ci/lib.sh
ci/print-test-failures.sh
ci/run-build-and-minimal-fuzzers.sh [new file with mode: 0755]
ci/run-build-and-tests.sh
ci/run-test-slice.sh
color.c
column.c
combine-diff.c
command-list.txt
commit-graph.c
commit-graph.h
commit-reach.c
commit-reach.h
commit.c
commit.h
compat/compiler.h
compat/disk.h
compat/fsmonitor/fsm-health-darwin.c
compat/fsmonitor/fsm-health-win32.c
compat/fsmonitor/fsm-ipc-win32.c
compat/fsmonitor/fsm-listen-darwin.c
compat/fsmonitor/fsm-listen-win32.c
compat/fsmonitor/fsm-path-utils-win32.c
compat/fsmonitor/fsm-settings-win32.c
compat/mingw.c
compat/simple-ipc/ipc-shared.c
compat/simple-ipc/ipc-unix-socket.c
compat/terminal.c
config.c
config.h
config.mak.uname
configure.ac
contrib/README
contrib/buildsystems/CMakeLists.txt
contrib/coccinelle/xstrncmpz.cocci [new file with mode: 0644]
contrib/completion/git-completion.bash
contrib/completion/git-prompt.sh
contrib/coverage-diff.sh
contrib/credential/libsecret/git-credential-libsecret.c
contrib/credential/wincred/git-credential-wincred.c
contrib/diff-highlight/DiffHighlight.pm
contrib/git-jump/git-jump
contrib/mw-to-git/Git/Mediawiki.pm
contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh
contrib/subtree/git-subtree.sh
contrib/subtree/t/t7900-subtree.sh
contrib/workdir/git-new-workdir
convert.c
convert.h
credential.c
csum-file.c
daemon.c
date.c
decorate.c
decorate.h
delta-islands.c
diagnose.c
diff-lib.c
diff-merges.c
diff-no-index.c
diff.c
diff.h
diffcore-break.c
diffcore-delta.c
dir-iterator.c
dir-iterator.h
dir.c
dir.h
entry.c
entry.h
environment.c
environment.h
ewah/bitmap.c
ewah/ewok.h
exec-cmd.c
fetch-pack.c
fetch-pack.h
fsck.c
fsck.h
fsmonitor--daemon.h
fsmonitor-ipc.c
fsmonitor-settings.c
fsmonitor.c
gettext.c
git-archimport.perl
git-compat-util.h
git-cvsexportcommit.perl
git-cvsimport.perl
git-cvsserver.perl
git-difftool--helper.sh
git-gui/Makefile
git-gui/README.md
git-gui/git-gui.sh
git-gui/lib/choose_repository.tcl
git-gui/lib/encoding.tcl
git-gui/lib/shortcut.tcl
git-gui/po/README
git-instaweb.sh
git-p4.py
git-quiltimport.sh
git-send-email.perl
git-svn.perl
git.c
gitk-git/gitk
gitweb/INSTALL
gitweb/gitweb.perl
gitweb/static/gitweb.css
gitweb/static/js/lib/common-lib.js
gpg-interface.c
gpg-interface.h
graph.c
graph.h
grep.c
help.c
hex-ll.c [new file with mode: 0644]
hex-ll.h [new file with mode: 0644]
hex.c
hex.h
http-backend.c
http-fetch.c
http-push.c
http-walker.c
http.c
http.h
imap-send.c
json-writer.h
kwset.c
kwset.h
line-log.c
line-log.h
line-range.c
list-objects-filter-options.c
list-objects-filter.c
list-objects.c
list.h
lockfile.h
log-tree.c
log-tree.h
ls-refs.c
mailinfo.c
mem-pool.c
mem-pool.h
merge-blobs.c
merge-ll.c
merge-ort.c
merge-recursive.c
merge-recursive.h
merge.c
mergetools/vimdiff
midx.c
midx.h
name-hash.c
name-hash.h
negotiator/noop.c
notes-merge.c
notes-utils.c
notes.c
object-file.c
object-name.c
object.c
object.h
oidset.c
oidset.h
oss-fuzz/.gitignore
oss-fuzz/dummy-cmd-main.c [new file with mode: 0644]
oss-fuzz/fuzz-date.c [new file with mode: 0644]
pack-bitmap-write.c
pack-bitmap.c
pack-bitmap.h
pack-check.c
pack-objects.c
pack-objects.h
pack-revindex.c
pack-revindex.h
pack-write.c
packfile.c
packfile.h
parse-options-cb.c
parse-options.c
parse-options.h
parse.c [new file with mode: 0644]
parse.h [new file with mode: 0644]
patch-ids.c
path.c
path.h
pathspec.c
perl/FromCPAN/Error.pm
perl/Git.pm
perl/Git/I18N.pm
perl/Git/LoadCPAN.pm
perl/Git/LoadCPAN/Error.pm
perl/Git/LoadCPAN/Mail/Address.pm
perl/Git/Packet.pm
perl/Git/SVN.pm
pkt-line.c
pkt-line.h
po/README.md
po/bg.po
po/ca.po
po/de.po
po/fr.po
po/id.po
po/sv.po
po/tr.po
po/uk.po
po/zh_CN.po
po/zh_TW.po
preload-index.c
pretty.c
progress.c
prompt.c
protocol-caps.c
protocol.h
range-diff.c
reachable.c
read-cache-ll.h
read-cache.c
rebase.c
ref-filter.c
ref-filter.h
reflog.c
refs.c
refs.h
refs/debug.c
refs/files-backend.c
refs/iterator.c
refs/packed-backend.c
refs/ref-cache.c
refs/refs-internal.h
refs/reftable-backend.c [new file with mode: 0644]
reftable/basics.c
reftable/basics.h
reftable/block.c
reftable/block.h
reftable/block_test.c
reftable/blocksource.c
reftable/dump.c
reftable/generic.c
reftable/iter.c
reftable/iter.h
reftable/merged.c
reftable/merged.h
reftable/merged_test.c
reftable/pq.c
reftable/pq.h
reftable/pq_test.c
reftable/publicbasics.c
reftable/reader.c
reftable/readwrite_test.c
reftable/record.c
reftable/record.h
reftable/record_test.c
reftable/refname.c
reftable/refname_test.c
reftable/reftable-merged.h
reftable/reftable-record.h
reftable/reftable-writer.h
reftable/stack.c
reftable/stack.h
reftable/stack_test.c
reftable/system.h
reftable/test_framework.c
reftable/test_framework.h
reftable/tree.c
reftable/tree_test.c
reftable/writer.c
reftable/writer.h
remote-curl.c
remote.c
remote.h
repo-settings.c
repository.c
repository.h
rerere.c
reset.c
resolve-undo.c
resolve-undo.h
revision.c
revision.h
run-command.c
scalar.c
send-pack.c
sequencer.c
sequencer.h
serve.c
setup.c
setup.h
sh-i18n--envsubst.c
sha1dc/sha1.c
shallow.c
shared.mak
shell.c
sideband.c
sparse-index.c
statinfo.c
statinfo.h
strbuf.c
strbuf.h
strvec.c
strvec.h
submodule-config.c
submodule-config.h
submodule.c
t/Makefile
t/README
t/annotate-tests.sh
t/chainlint/blank-line-before-esac.expect
t/chainlint/blank-line.expect
t/chainlint/block.expect
t/chainlint/chain-break-background.expect
t/chainlint/chain-break-return-exit.expect
t/chainlint/chain-break-status.expect
t/chainlint/chained-subshell.expect
t/chainlint/command-substitution-subsubshell.expect
t/chainlint/dqstring-line-splice.expect
t/chainlint/dqstring-no-interpolate.expect
t/chainlint/empty-here-doc.expect
t/chainlint/exclamation.expect
t/chainlint/for-loop-abbreviated.expect
t/chainlint/for-loop.expect
t/chainlint/function.expect
t/chainlint/here-doc.expect
t/chainlint/loop-detect-status.expect
t/chainlint/nested-cuddled-subshell.expect
t/chainlint/nested-loop-detect-failure.expect
t/chainlint/nested-subshell.expect
t/chainlint/pipe.expect
t/chainlint/subshell-here-doc.expect
t/chainlint/subshell-one-liner.expect
t/chainlint/t7900-subtree.expect
t/chainlint/token-pasting.expect
t/chainlint/while-loop.expect
t/helper/test-bloom.c
t/helper/test-bundle-uri.c
t/helper/test-ctype.c [deleted file]
t/helper/test-env-helper.c
t/helper/test-example-decorate.c
t/helper/test-fast-rebase.c [deleted file]
t/helper/test-find-pack.c [new file with mode: 0644]
t/helper/test-index-version.c [deleted file]
t/helper/test-parse-options.c
t/helper/test-pkt-line.c
t/helper/test-prio-queue.c [deleted file]
t/helper/test-reach.c
t/helper/test-read-midx.c
t/helper/test-ref-store.c
t/helper/test-regex.c
t/helper/test-repository.c
t/helper/test-simple-ipc.c
t/helper/test-submodule.c
t/helper/test-tool.c
t/helper/test-tool.h
t/helper/test-trace2.c
t/helper/test-truncate.c [new file with mode: 0644]
t/lib-chunk.sh [new file with mode: 0644]
t/lib-chunk/corrupt-chunk-file.pl [new file with mode: 0644]
t/lib-credential.sh
t/lib-cvs.sh
t/lib-gpg.sh
t/lib-httpd.sh
t/lib-httpd/apache.conf
t/lib-httpd/passwd
t/lib-httpd/proxy-passwd
t/lib-rebase.sh
t/lib-submodule-update.sh
t/perf/p2000-sparse-operations.sh
t/perf/p5332-multi-pack-reuse.sh [new file with mode: 0755]
t/perf/p6300-for-each-ref.sh [new file with mode: 0755]
t/perf/perf-lib.sh
t/perf/repos/inflate-repo.sh
t/perf/run
t/t0001-init.sh
t/t0002-gitfile.sh
t/t0003-attributes.sh
t/t0006-date.sh
t/t0007-git-var.sh
t/t0008-ignores.sh
t/t0009-prio-queue.sh [deleted file]
t/t0010-racy-git.sh
t/t0011-hashmap.sh
t/t0012-help.sh
t/t0013-sha1dc.sh
t/t0014-alias.sh
t/t0018-advice.sh
t/t0021-conversion.sh
t/t0024-crlf-archive.sh
t/t0028-working-tree-encoding.sh
t/t0035-safe-bare-repository.sh
t/t0040-parse-options.sh
t/t0041-usage.sh
t/t0061-run-command.sh
t/t0070-fundamental.sh
t/t0080-unit-test-output.sh [new file with mode: 0755]
t/t0081-find-pack.sh [new file with mode: 0755]
t/t0091-bugreport.sh
t/t0202/test.pl
t/t0204-gettext-reencode-sanity.sh
t/t0210-trace2-normal.sh
t/t0211-trace2-perf.sh
t/t0212-trace2-event.sh
t/t0300-credentials.sh
t/t0301-credential-cache.sh
t/t0303-credential-external.sh
t/t0410-partial-clone.sh
t/t0600-reffiles-backend.sh [new file with mode: 0755]
t/t0601-reffiles-pack-refs.sh [moved from t/t3210-pack-refs.sh with 80% similarity]
t/t0610-reftable-basics.sh [new file with mode: 0755]
t/t0611-reftable-httpd.sh [new file with mode: 0755]
t/t1006-cat-file.sh
t/t1007-hash-object.sh
t/t1060-object-corruption.sh
t/t1091-sparse-checkout-builtin.sh
t/t1092-sparse-checkout-compatibility.sh
t/t1300-config.sh
t/t1301-shared-repo.sh
t/t1302-repo-version.sh
t/t1307-config-blob.sh
t/t1308-config-set.sh
t/t1309-early-config.sh
t/t1310-config-default.sh
t/t1400-update-ref.sh
t/t1401-symbolic-ref.sh
t/t1403-show-ref.sh
t/t1404-update-ref-errors.sh
t/t1405-main-ref-store.sh
t/t1406-submodule-ref-store.sh
t/t1407-worktree-ref-store.sh
t/t1409-avoid-packing-refs.sh
t/t1410-reflog.sh
t/t1414-reflog-walk.sh
t/t1415-worktree-refs.sh
t/t1416-ref-transaction-hooks.sh
t/t1417-reflog-updateref.sh
t/t1419-exclude-refs.sh
t/t1430-bad-ref-name.sh
t/t1450-fsck.sh
t/t1500-rev-parse.sh
t/t1502-rev-parse-parseopt.sh
t/t1502/.gitattributes [new file with mode: 0644]
t/t1502/optionspec-neg [new file with mode: 0644]
t/t1502/optionspec-neg.help [new file with mode: 0644]
t/t1502/optionspec.help [new file with mode: 0755]
t/t1503-rev-parse-verify.sh
t/t1506-rev-parse-diagnosis.sh
t/t1509/prepare-chroot.sh
t/t1512-rev-parse-disambiguation.sh
t/t1600-index.sh
t/t1700-split-index.sh
t/t2004-checkout-cache-temp.sh
t/t2006-checkout-index-basic.sh
t/t2010-checkout-ambiguous.sh
t/t2011-checkout-invalid-head.sh
t/t2016-checkout-patch.sh
t/t2017-checkout-orphan.sh
t/t2018-checkout-branch.sh
t/t2019-checkout-ambiguous-ref.sh
t/t2020-checkout-detach.sh
t/t2024-checkout-dwim.sh
t/t2025-checkout-no-overlay.sh
t/t2026-checkout-pathspec-file.sh
t/t2027-checkout-track.sh
t/t2030-unresolve-info.sh
t/t2060-switch.sh
t/t2070-restore.sh
t/t2071-restore-patch.sh
t/t2072-restore-pathspec-file.sh
t/t2104-update-index-skip-worktree.sh
t/t2106-update-index-assume-unchanged.sh
t/t2107-update-index-basic.sh
t/t2203-add-intent.sh
t/t2204-add-ignored.sh
t/t2400-worktree-add.sh
t/t2401-worktree-prune.sh
t/t2402-worktree-list.sh
t/t2403-worktree-move.sh
t/t2406-worktree-repair.sh
t/t2407-worktree-heads.sh
t/t3004-ls-files-basic.sh
t/t3007-ls-files-recurse-submodules.sh
t/t3200-branch.sh
t/t3202-show-branch.sh
t/t3206-range-diff.sh
t/t3301-notes.sh
t/t3310-notes-merge-manual-resolve.sh
t/t3320-notes-merge-worktrees.sh
t/t3321-notes-stripspace.sh
t/t3400-rebase.sh
t/t3402-rebase-merge.sh
t/t3403-rebase-skip.sh
t/t3404-rebase-interactive.sh
t/t3406-rebase-message.sh
t/t3407-rebase-abort.sh
t/t3415-rebase-autosquash.sh
t/t3418-rebase-continue.sh
t/t3420-rebase-autostash.sh
t/t3422-rebase-incompatible-options.sh
t/t3430-rebase-merges.sh
t/t3431-rebase-fork-point.sh
t/t3501-revert-cherry-pick.sh
t/t3507-cherry-pick-conflict.sh
t/t3510-cherry-pick-sequence.sh
t/t3600-rm.sh
t/t3601-rm-pathspec-file.sh
t/t3650-replay-basics.sh [new file with mode: 0755]
t/t3700-add.sh
t/t3701-add-interactive.sh
t/t3704-add-pathspec-file.sh
t/t3900-i18n-commit.sh
t/t3901-i18n-patch.sh
t/t3903-stash.sh
t/t3904-stash-patch.sh
t/t3905-stash-include-untracked.sh
t/t3909-stash-pathspec-file.sh
t/t3920-crlf-messages.sh
t/t4001-diff-rename.sh
t/t4002-diff-basic.sh
t/t4013-diff-various.sh
t/t4014-format-patch.sh
t/t4015-diff-whitespace.sh
t/t4017-diff-retval.sh
t/t4018-diff-funcname.sh
t/t4020-diff-external.sh
t/t4031-diff-rewrite-binary.sh
t/t4040-whitespace-status.sh
t/t4042-diff-textconv-caching.sh
t/t4047-diff-dirstat.sh
t/t4052-stat-output.sh
t/t4053-diff-no-index.sh
t/t4055-diff-context.sh
t/t4068-diff-symmetric-merge-base.sh
t/t4115-apply-symlink.sh
t/t4120-apply-popt.sh
t/t4122-apply-symlink-inside.sh
t/t4129-apply-samemode.sh
t/t4133-apply-filenames.sh
t/t4150-am.sh
t/t4151-am-abort.sh
t/t4153-am-resume-override-opts.sh
t/t4200-rerere.sh
t/t4201-shortlog.sh
t/t4202-log.sh
t/t4203-mailmap.sh
t/t4205-log-pretty-formats.sh
t/t4207-log-decoration-colors.sh
t/t4208-log-magic-pathspec.sh
t/t4209-log-pickaxe.sh
t/t4211-line-log.sh
t/t4212-log-corrupt.sh
t/t4214-log-graph-octopus.sh
t/t4215-log-skewed-merges.sh
t/t4216-log-bloom.sh
t/t4217-log-limit.sh
t/t4256-am-format-flowed.sh
t/t4300-merge-tree.sh
t/t4301-merge-tree-write-tree.sh
t/t5000-tar-tree.sh
t/t5001-archive-attr.sh
t/t5003-archive-zip.sh
t/t5100-mailinfo.sh
t/t5100/comment.expect
t/t5100/comment.in
t/t5300-pack-object.sh
t/t5302-pack-index.sh
t/t5304-prune.sh
t/t5310-pack-bitmaps.sh
t/t5311-pack-bitmaps-shallow.sh
t/t5312-prune-corruption.sh
t/t5317-pack-objects-filter-objects.sh
t/t5318-commit-graph.sh
t/t5319-multi-pack-index.sh
t/t5324-split-commit-graph.sh
t/t5328-commit-graph-64bit-time.sh
t/t5329-pack-objects-cruft.sh
t/t5331-pack-objects-stdin.sh
t/t5332-multi-pack-reuse.sh [new file with mode: 0755]
t/t5401-update-hooks.sh
t/t5407-post-rewrite-hook.sh
t/t5411/test-0026-push-options.sh
t/t5411/test-0027-push-options--porcelain.sh
t/t5500-fetch-pack.sh
t/t5504-fetch-receive-strict.sh
t/t5505-remote.sh
t/t5510-fetch.sh
t/t5512-ls-remote.sh
t/t5514-fetch-multiple.sh
t/t5516-fetch-push.sh
t/t5520-pull.sh
t/t5521-pull-options.sh
t/t5523-push-upstream.sh
t/t5526-fetch-submodules.sh
t/t5528-push-default.sh
t/t5530-upload-pack-error.sh
t/t5531-deep-submodule-push.sh
t/t5534-push-signed.sh
t/t5536-fetch-conflicts.sh
t/t5541-http-push-smart.sh
t/t5545-push-options.sh
t/t5546-receive-limits.sh
t/t5550-http-fetch-dumb.sh
t/t5551-http-fetch-smart.sh
t/t5555-http-smart-common.sh
t/t5558-clone-bundle-uri.sh
t/t5562/invoke-with-content-length.pl
t/t5570-git-daemon.sh
t/t5571-pre-push-hook.sh
t/t5572-pull-submodule.sh
t/t5573-pull-verify-signatures.sh
t/t5574-fetch-output.sh
t/t5580-unc-paths.sh
t/t5583-push-branches.sh
t/t5601-clone.sh
t/t5604-clone-reference.sh
t/t5605-clone-local.sh
t/t5606-clone-options.sh
t/t5607-clone-bundle.sh
t/t5611-clone-config.sh
t/t5616-partial-clone.sh
t/t5701-git-serve.sh
t/t5702-protocol-v2.sh
t/t5703-upload-pack-ref-in-want.sh
t/t5704-protocol-violations.sh
t/t5801-remote-helpers.sh
t/t5801/git-remote-testgit
t/t5811-proto-disable-git.sh
t/t5812-proto-disable-http.sh
t/t6000-rev-list-misc.sh
t/t6001-rev-list-graft.sh
t/t6005-rev-list-count.sh
t/t6009-rev-list-parent.sh
t/t6017-rev-list-stdin.sh
t/t6018-rev-list-glob.sh
t/t6021-rev-list-exclude-hidden.sh
t/t6022-rev-list-missing.sh [new file with mode: 0755]
t/t6030-bisect-porcelain.sh
t/t6040-tracking-info.sh
t/t6050-replace.sh
t/t6102-rev-list-unexpected-objects.sh
t/t6112-rev-list-filters-objects.sh
t/t6113-rev-list-bitmap-filters.sh
t/t6115-rev-list-du.sh
t/t6120-describe.sh
t/t6134-pathspec-in-submodule.sh
t/t6135-pathspec-with-attrs.sh
t/t6136-pathspec-in-bare.sh
t/t6300-for-each-ref.sh
t/t6301-for-each-ref-errors.sh
t/t6302-for-each-ref-filter.sh
t/t6402-merge-rename.sh
t/t6403-merge-file.sh
t/t6406-merge-attr.sh
t/t6413-merge-crlf.sh
t/t6416-recursive-corner-cases.sh
t/t6418-merge-text-auto.sh
t/t6422-merge-rename-corner-cases.sh
t/t6423-merge-rename-directories.sh
t/t6424-merge-unrelated-index-changes.sh
t/t6425-merge-rename-delete.sh
t/t6426-merge-skip-unneeded-updates.sh
t/t6429-merge-sequence-rename-caching.sh
t/t6430-merge-recursive.sh
t/t6433-merge-toplevel.sh
t/t6436-merge-overwrite.sh
t/t6437-submodule-merge.sh
t/t6500-gc.sh
t/t6700-tree-depth.sh [new file with mode: 0755]
t/t7001-mv.sh
t/t7003-filter-branch.sh
t/t7004-tag.sh
t/t7102-reset.sh
t/t7105-reset-patch.sh
t/t7106-reset-unborn-branch.sh
t/t7107-reset-pathspec-file.sh
t/t7110-reset-merge.sh
t/t7201-co.sh
t/t7300-clean.sh
t/t7301-clean-interactive.sh
t/t7400-submodule-basic.sh
t/t7402-submodule-rebase.sh
t/t7403-submodule-sync.sh
t/t7406-submodule-update.sh
t/t7411-submodule-config.sh
t/t7414-submodule-mistakes.sh
t/t7416-submodule-dash-url.sh
t/t7417-submodule-path-url.sh
t/t7419-submodule-set-branch.sh
t/t7420-submodule-set-url.sh
t/t7450-bad-git-dotfiles.sh
t/t7500-commit-template-squash-signoff.sh
t/t7501-commit-basic-functionality.sh
t/t7502-commit-porcelain.sh
t/t7506-status-submodule.sh
t/t7507-commit-verbose.sh
t/t7508-status.sh
t/t7509-commit-authorship.sh
t/t7512-status-help.sh
t/t7513-interpret-trailers.sh
t/t7514-commit-patch.sh
t/t7516-commit-races.sh
t/t7518-ident-corner-cases.sh
t/t7519-status-fsmonitor.sh
t/t7520-ignored-hook-warning.sh
t/t7525-status-rename.sh
t/t7526-commit-pathspec-file.sh
t/t7527-builtin-fsmonitor.sh
t/t7600-merge.sh
t/t7601-merge-pull-config.sh
t/t7602-merge-octopus-many.sh
t/t7603-merge-reduce-heads.sh
t/t7607-merge-state.sh
t/t7608-merge-messages.sh
t/t7611-merge-abort.sh
t/t7612-merge-verify-signatures.sh
t/t7700-repack.sh
t/t7703-repack-geometric.sh
t/t7704-repack-cruft.sh [new file with mode: 0755]
t/t7800-difftool.sh
t/t7810-grep.sh
t/t7811-grep-open.sh
t/t7814-grep-recurse-submodules.sh
t/t7816-grep-binary-pattern.sh
t/t7900-maintenance.sh
t/t8003-blame-corner-cases.sh
t/t8010-cat-file-filters.sh
t/t8013-blame-ignore-revs.sh
t/t9001-send-email.sh
t/t9002-column.sh
t/t9004-example.sh
t/t9114-git-svn-dcommit-merge.sh
t/t9117-git-svn-init-clone.sh
t/t9118-git-svn-funky-branch-names.sh
t/t9133-git-svn-nested-git-repo.sh
t/t9146-git-svn-empty-dirs.sh
t/t9164-git-svn-dcommit-concurrent.sh
t/t9210-scalar.sh
t/t9211-scalar-clone.sh
t/t9300-fast-import.sh
t/t9350-fast-export.sh
t/t9400-git-cvsserver-server.sh
t/t9500-gitweb-standalone-no-errors.sh
t/t9700/test.pl
t/t9800-git-p4-basic.sh
t/t9801-git-p4-branch.sh
t/t9802-git-p4-filetype.sh
t/t9807-git-p4-submit.sh
t/t9815-git-p4-submit-fail.sh
t/t9816-git-p4-locked.sh
t/t9824-git-p4-git-lfs.sh
t/t9902-completion.sh
t/test-lib-functions.sh
t/test-lib-github-workflow-markup.sh
t/test-lib-junit.sh
t/test-lib.sh
t/test-terminal.perl
t/unit-tests/.gitignore [new file with mode: 0644]
t/unit-tests/t-basic.c [new file with mode: 0644]
t/unit-tests/t-ctype.c [new file with mode: 0644]
t/unit-tests/t-mem-pool.c [new file with mode: 0644]
t/unit-tests/t-prio-queue.c [new file with mode: 0644]
t/unit-tests/t-strbuf.c [new file with mode: 0644]
t/unit-tests/test-lib.c [new file with mode: 0644]
t/unit-tests/test-lib.h [new file with mode: 0644]
t/valgrind/valgrind.sh
tempfile.c
tempfile.h
templates/hooks--pre-commit.sample
tmp-objdir.c
trace.c
trace2.c
trace2.h
trace2/tr2_ctr.c
trace2/tr2_sysenv.c
trace2/tr2_tgt_event.c
trace2/tr2_tgt_normal.c
trace2/tr2_tls.c
trace2/tr2_tls.h
trace2/tr2_tmr.c
trailer.c
trailer.h
transport-helper.c
transport.c
tree-diff.c
tree-walk.c
tree-walk.h
tree.c
tree.h
unicode-width.h
unpack-trees.c
unpack-trees.h
upload-pack.c
url.c
urlmatch.c
userdiff.c
utf8.c
utf8.h
worktree.c
worktree.h
wrapper.c
wrapper.h
write-or-die.c
wt-status.c
wt-status.h
xdiff-interface.c

index 4860bebd32f8d3f34c2382f097ac50c0b972d3a0..77346a4929d4eb6af398cbf0761016d8c6d34347 100644 (file)
@@ -1,7 +1,7 @@
 env:
   CIRRUS_CLONE_DEPTH: 1
 
-freebsd_12_task:
+freebsd_task:
   env:
     GIT_PROVE_OPTS: "--timer --jobs 10"
     GIT_TEST_OPTS: "--no-chain-lint --no-bin-wrappers"
@@ -9,7 +9,7 @@ freebsd_12_task:
     DEFAULT_TEST_TARGET: prove
     DEVELOPER: 1
   freebsd_instance:
-    image_family: freebsd-12-3
+    image_family: freebsd-13-2
     memory: 2G
   install_script:
     pkg install -y gettext gmake perl5
@@ -19,4 +19,4 @@ freebsd_12_task:
   build_script:
     - su git -c gmake
   test_script:
-    - su git -c 'gmake test'
+    - su git -c 'gmake DEFAULT_UNIT_TEST_TARGET=unit-tests-prove test unit-tests'
index c592dda681fecfaa6bf64fb3f539eafaf4123ed8..3ed4fac753a7c119bb988918cf8f8eb18ac926d9 100644 (file)
@@ -83,9 +83,9 @@ BinPackParameters: true
 BreakBeforeBraces: Linux
 
 # Break after operators
-# int valuve = aaaaaaaaaaaaa +
-#              bbbbbb -
-#              ccccccccccc;
+# int value = aaaaaaaaaaaaa +
+#             bbbbbb -
+#             ccccccccccc;
 BreakBeforeBinaryOperators: None
 BreakBeforeTernaryOperators: false
 
index 952c7c3a2aa11ea1087390be61eab6f7c0013599..37654cdfd7abcf7ca310ecf2c67c694fb94ad113 100644 (file)
@@ -4,4 +4,7 @@ a mailing list (git@vger.kernel.org) for code submissions, code reviews, and
 bug reports. Nevertheless, you can use GitGitGadget (https://gitgitgadget.github.io/)
 to conveniently send your Pull Requests commits to our mailing list.
 
+For a single-commit pull request, please *leave the pull request description
+empty*: your commit message itself should describe your changes.
+
 Please read the "guidelines for contributing" linked above!
index a58e2dc8ad6279d792635c4034ed0d113d489695..a241a63428bd20e0c28a61ab6de56cbb39966c42 100644 (file)
@@ -19,7 +19,7 @@ jobs:
   check-whitespace:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
       with:
         fetch-depth: 0
 
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
new file mode 100644 (file)
index 0000000..53cf12f
--- /dev/null
@@ -0,0 +1,163 @@
+name: Coverity
+
+# This GitHub workflow automates submitting builds to Coverity Scan. To enable it,
+# set the repository variable `ENABLE_COVERITY_SCAN_FOR_BRANCHES` (for details, see
+# https://docs.github.com/en/actions/learn-github-actions/variables) to a JSON
+# string array containing the names of the branches for which the workflow should be
+# run, e.g. `["main", "next"]`.
+#
+# In addition, two repository secrets must be set (for details how to add secrets, see
+# https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions):
+# `COVERITY_SCAN_EMAIL` and `COVERITY_SCAN_TOKEN`. The former specifies the
+# email to which the Coverity reports should be sent and the latter can be
+# obtained from the Project Settings tab of the Coverity project).
+#
+# The workflow runs on `ubuntu-latest` by default. This can be overridden by setting
+# the repository variable `ENABLE_COVERITY_SCAN_ON_OS` to a JSON string array specifying
+# the operating systems, e.g. `["ubuntu-latest", "windows-latest"]`.
+#
+# By default, the builds are submitted to the Coverity project `git`. To override this,
+# set the repository variable `COVERITY_PROJECT`.
+
+on:
+  push:
+
+defaults:
+  run:
+    shell: bash
+
+jobs:
+  coverity:
+    if: contains(fromJSON(vars.ENABLE_COVERITY_SCAN_FOR_BRANCHES || '[""]'), github.ref_name)
+    strategy:
+      matrix:
+        os: ${{ fromJSON(vars.ENABLE_COVERITY_SCAN_ON_OS || '["ubuntu-latest"]') }}
+    runs-on: ${{ matrix.os }}
+    env:
+      COVERITY_PROJECT: ${{ vars.COVERITY_PROJECT || 'git' }}
+      COVERITY_LANGUAGE: cxx
+      COVERITY_PLATFORM: overridden-below
+    steps:
+      - uses: actions/checkout@v4
+      - name: install minimal Git for Windows SDK
+        if: contains(matrix.os, 'windows')
+        uses: git-for-windows/setup-git-for-windows-sdk@v1
+      - run: ci/install-dependencies.sh
+        if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
+        env:
+          runs_on_pool: ${{ matrix.os }}
+
+      # The Coverity site says the tool is usually updated twice yearly, so the
+      # MD5 of download can be used to determine whether there's been an update.
+      - name: get the Coverity Build Tool hash
+        id: lookup
+        run: |
+          case "${{ matrix.os }}" in
+          *windows*)
+            COVERITY_PLATFORM=win64
+            COVERITY_TOOL_FILENAME=cov-analysis.zip
+            MAKEFLAGS=-j$(nproc)
+            ;;
+          *macos*)
+            COVERITY_PLATFORM=macOSX
+            COVERITY_TOOL_FILENAME=cov-analysis.dmg
+            MAKEFLAGS=-j$(sysctl -n hw.physicalcpu)
+            ;;
+          *ubuntu*)
+            COVERITY_PLATFORM=linux64
+            COVERITY_TOOL_FILENAME=cov-analysis.tgz
+            MAKEFLAGS=-j$(nproc)
+            ;;
+          *)
+            echo '::error::unhandled OS ${{ matrix.os }}' >&2
+            exit 1
+            ;;
+          esac
+          echo "COVERITY_PLATFORM=$COVERITY_PLATFORM" >>$GITHUB_ENV
+          echo "COVERITY_TOOL_FILENAME=$COVERITY_TOOL_FILENAME" >>$GITHUB_ENV
+          echo "MAKEFLAGS=$MAKEFLAGS" >>$GITHUB_ENV
+          MD5=$(curl https://scan.coverity.com/download/$COVERITY_LANGUAGE/$COVERITY_PLATFORM \
+                   --fail \
+                   --form token='${{ secrets.COVERITY_SCAN_TOKEN }}' \
+                   --form project="$COVERITY_PROJECT" \
+                   --form md5=1)
+          case $? in
+          0) ;; # okay
+          22) # 40x, i.e. access denied
+            echo "::error::incorrect token or project?" >&2
+            exit 1
+            ;;
+          *) # other error
+            echo "::error::Failed to retrieve MD5" >&2
+            exit 1
+            ;;
+          esac
+          echo "hash=$MD5" >>$GITHUB_OUTPUT
+
+      # Try to cache the tool to avoid downloading 1GB+ on every run.
+      # A cache miss will add ~30s to create, but a cache hit will save minutes.
+      - name: restore the Coverity Build Tool
+        id: cache
+        uses: actions/cache/restore@v4
+        with:
+          path: ${{ runner.temp }}/cov-analysis
+          key: cov-build-${{ env.COVERITY_LANGUAGE }}-${{ env.COVERITY_PLATFORM }}-${{ steps.lookup.outputs.hash }}
+      - name: download the Coverity Build Tool (${{ env.COVERITY_LANGUAGE }} / ${{ env.COVERITY_PLATFORM}})
+        if: steps.cache.outputs.cache-hit != 'true'
+        run: |
+          curl https://scan.coverity.com/download/$COVERITY_LANGUAGE/$COVERITY_PLATFORM \
+            --fail --no-progress-meter \
+            --output $RUNNER_TEMP/$COVERITY_TOOL_FILENAME \
+            --form token='${{ secrets.COVERITY_SCAN_TOKEN }}' \
+            --form project="$COVERITY_PROJECT"
+      - name: extract the Coverity Build Tool
+        if: steps.cache.outputs.cache-hit != 'true'
+        run: |
+          case "$COVERITY_TOOL_FILENAME" in
+          *.tgz)
+            mkdir $RUNNER_TEMP/cov-analysis &&
+            tar -xzf $RUNNER_TEMP/$COVERITY_TOOL_FILENAME --strip 1 -C $RUNNER_TEMP/cov-analysis
+            ;;
+          *.dmg)
+            cd $RUNNER_TEMP &&
+            attach="$(hdiutil attach $COVERITY_TOOL_FILENAME)" &&
+            volume="$(echo "$attach" | cut -f 3 | grep /Volumes/)" &&
+            mkdir cov-analysis &&
+            cd cov-analysis &&
+            sh "$volume"/cov-analysis-macosx-*.sh &&
+            ls -l &&
+            hdiutil detach "$volume"
+            ;;
+          *.zip)
+            cd $RUNNER_TEMP &&
+            mkdir cov-analysis-tmp &&
+            unzip -d cov-analysis-tmp $COVERITY_TOOL_FILENAME &&
+            mv cov-analysis-tmp/* cov-analysis
+            ;;
+          *)
+            echo "::error::unhandled archive type: $COVERITY_TOOL_FILENAME" >&2
+            exit 1
+            ;;
+          esac
+      - name: cache the Coverity Build Tool
+        if: steps.cache.outputs.cache-hit != 'true'
+        uses: actions/cache/save@v4
+        with:
+          path: ${{ runner.temp }}/cov-analysis
+          key: cov-build-${{ env.COVERITY_LANGUAGE }}-${{ env.COVERITY_PLATFORM }}-${{ steps.lookup.outputs.hash }}
+      - name: build with cov-build
+        run: |
+          export PATH="$RUNNER_TEMP/cov-analysis/bin:$PATH" &&
+          cov-configure --gcc &&
+          cov-build --dir cov-int make
+      - name: package the build
+        run: tar -czvf cov-int.tgz cov-int
+      - name: submit the build to Coverity Scan
+        run: |
+          curl \
+            --fail \
+            --form token='${{ secrets.COVERITY_SCAN_TOKEN }}' \
+            --form email='${{ secrets.COVERITY_SCAN_EMAIL }}' \
+            --form file=@cov-int.tgz \
+            --form version='${{ github.sha }}' \
+            "https://scan.coverity.com/builds?project=$COVERITY_PROJECT"
index 6c3849658aa061b89ced8e0464b3b580519c3a34..e2c3dbdcb50f0cedbf990677e234e7114ecd7746 100644 (file)
@@ -63,9 +63,10 @@ jobs:
             origin \
             ${{ github.ref }} \
             $args
-      - uses: actions/setup-go@v2
+      - uses: actions/setup-go@v5
         with:
           go-version: '>=1.16'
+          cache: false
       - name: Install git-po-helper
         run: go install github.com/git-l10n/git-po-helper@main
       - name: Install other dependencies
@@ -91,14 +92,13 @@ jobs:
           cat git-po-helper.out
           exit $exit_code
       - name: Create comment in pull request for report
-        uses: mshick/add-pr-comment@v1
+        uses: mshick/add-pr-comment@v2
         if: >-
           always() &&
           github.event_name == 'pull_request_target' &&
           env.COMMENT_BODY != ''
         with:
           repo-token: ${{ secrets.GITHUB_TOKEN }}
-          repo-token-user-login: 'github-actions[bot]'
           message: >
             ${{ steps.check-commits.outcome == 'failure' && 'Errors and warnings' || 'Warnings' }}
             found by [git-po-helper](https://github.com/git-l10n/git-po-helper#readme) in workflow
index 079645b7760887af4cf93b821270f7368c8e5f50..3428773b096e9ea0da0488b9d75171f09b7ca961 100644 (file)
@@ -5,9 +5,23 @@ on: [push, pull_request]
 env:
   DEVELOPER: 1
 
+# If more than one workflow run is triggered for the very same commit hash
+# (which happens when multiple branches pointing to the same commit), only
+# the first one is allowed to run, the second will be kept in the "queued"
+# state. This allows a successful completion of the first run to be reused
+# in the second run via the `skip-if-redundant` logic in the `config` job.
+#
+# The only caveat is that if a workflow run is triggered for the same commit
+# hash that another run is already being held, that latter run will be
+# canceled. For more details about the `concurrency` attribute, see:
+# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
+concurrency:
+  group: ${{ github.sha }}
+
 jobs:
   ci-config:
     name: config
+    if: vars.CI_BRANCHES == '' || contains(vars.CI_BRANCHES, github.ref_name)
     runs-on: ubuntu-latest
     outputs:
       enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
@@ -30,10 +44,13 @@ jobs:
         name: check whether CI is enabled for ref
         run: |
           enabled=yes
-          if test -x config-repo/ci/config/allow-ref &&
-             ! config-repo/ci/config/allow-ref '${{ github.ref }}'
+          if test -x config-repo/ci/config/allow-ref
           then
-            enabled=no
+            echo "::warning::ci/config/allow-ref is deprecated; use CI_BRANCHES instead"
+            if ! config-repo/ci/config/allow-ref '${{ github.ref }}'
+            then
+              enabled=no
+            fi
           fi
 
           skip_concurrent=yes
@@ -46,7 +63,7 @@ jobs:
           echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT
       - name: skip if the commit or tree was already tested
         id: skip-if-redundant
-        uses: actions/github-script@v6
+        uses: actions/github-script@v7
         if: steps.check-ref.outputs.enabled == 'yes'
         with:
           github-token: ${{secrets.GITHUB_TOKEN}}
@@ -95,7 +112,7 @@ jobs:
       group: windows-build-${{ github.ref }}
       cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - uses: git-for-windows/setup-git-for-windows-sdk@v1
     - name: build
       shell: bash
@@ -106,7 +123,7 @@ jobs:
     - name: zip up tracked files
       run: git archive -o artifacts/tracked.tar.gz HEAD
     - name: upload tracked files and build artifacts
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: windows-artifacts
         path: artifacts
@@ -123,7 +140,7 @@ jobs:
       cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
     steps:
     - name: download tracked files and build artifacts
-      uses: actions/download-artifact@v3
+      uses: actions/download-artifact@v4
       with:
         name: windows-artifacts
         path: ${{github.workspace}}
@@ -140,9 +157,9 @@ jobs:
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
-        name: failed-tests-windows
+        name: failed-tests-windows-${{ matrix.nr }}
         path: ${{env.FAILED_TEST_ARTIFACTS}}
   vs-build:
     name: win+VS build
@@ -156,10 +173,10 @@ jobs:
       group: vs-build-${{ github.ref }}
       cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - uses: git-for-windows/setup-git-for-windows-sdk@v1
     - name: initialize vcpkg
-      uses: actions/checkout@v3
+      uses: actions/checkout@v4
       with:
         repository: 'microsoft/vcpkg'
         path: 'compat/vcbuild/vcpkg'
@@ -195,7 +212,7 @@ jobs:
     - name: zip up tracked files
       run: git archive -o artifacts/tracked.tar.gz HEAD
     - name: upload tracked files and build artifacts
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: vs-artifacts
         path: artifacts
@@ -213,7 +230,7 @@ jobs:
     steps:
     - uses: git-for-windows/setup-git-for-windows-sdk@v1
     - name: download tracked files and build artifacts
-      uses: actions/download-artifact@v3
+      uses: actions/download-artifact@v4
       with:
         name: vs-artifacts
         path: ${{github.workspace}}
@@ -231,9 +248,9 @@ jobs:
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
-        name: failed-tests-windows
+        name: failed-tests-windows-vs-${{ matrix.nr }}
         path: ${{env.FAILED_TEST_ARTIFACTS}}
   regular:
     name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
@@ -249,6 +266,9 @@ jobs:
           - jobname: linux-sha256
             cc: clang
             pool: ubuntu-latest
+          - jobname: linux-reftable
+            cc: clang
+            pool: ubuntu-latest
           - jobname: linux-gcc
             cc: gcc
             cc_package: gcc-8
@@ -259,17 +279,23 @@ jobs:
             pool: ubuntu-20.04
           - jobname: osx-clang
             cc: clang
-            pool: macos-12
+            pool: macos-13
+          - jobname: osx-reftable
+            cc: clang
+            pool: macos-13
           - jobname: osx-gcc
             cc: gcc
-            cc_package: gcc-9
-            pool: macos-12
+            cc_package: gcc-13
+            pool: macos-13
           - jobname: linux-gcc-default
             cc: gcc
             pool: ubuntu-latest
           - jobname: linux-leaks
             cc: gcc
             pool: ubuntu-latest
+          - jobname: linux-reftable-leaks
+            cc: gcc
+            pool: ubuntu-latest
           - jobname: linux-asan-ubsan
             cc: clang
             pool: ubuntu-latest
@@ -280,7 +306,7 @@ jobs:
       runs_on_pool: ${{matrix.vector.pool}}
     runs-on: ${{matrix.vector.pool}}
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: ci/install-dependencies.sh
     - run: ci/run-build-and-tests.sh
     - name: print test failures
@@ -288,10 +314,21 @@ jobs:
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: failed-tests-${{matrix.vector.jobname}}
         path: ${{env.FAILED_TEST_ARTIFACTS}}
+  fuzz-smoke-test:
+    name: fuzz smoke test
+    needs: ci-config
+    if: needs.ci-config.outputs.enabled == 'yes'
+    env:
+      CC: clang
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v4
+    - run: ci/install-dependencies.sh
+    - run: ci/run-build-and-minimal-fuzzers.sh
   dockerized:
     name: ${{matrix.vector.jobname}} (${{matrix.vector.image}})
     needs: ci-config
@@ -314,9 +351,9 @@ jobs:
     runs-on: ubuntu-latest
     container: ${{matrix.vector.image}}
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
       if: matrix.vector.jobname != 'linux32'
-    - uses: actions/checkout@v1
+    - uses: actions/checkout@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
       if: matrix.vector.jobname == 'linux32'
     - run: ci/install-docker-dependencies.sh
     - run: ci/run-build-and-tests.sh
@@ -325,13 +362,13 @@ jobs:
       run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname != 'linux32'
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: failed-tests-${{matrix.vector.jobname}}
         path: ${{env.FAILED_TEST_ARTIFACTS}}
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname == 'linux32'
-      uses: actions/upload-artifact@v1
+      uses: actions/upload-artifact@v1 # cannot be upgraded because Node.js Actions aren't supported in this container
       with:
         name: failed-tests-${{matrix.vector.jobname}}
         path: ${{env.FAILED_TEST_ARTIFACTS}}
@@ -345,7 +382,7 @@ jobs:
       group: static-analysis-${{ github.ref }}
       cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: ci/install-dependencies.sh
     - run: ci/run-static-analysis.sh
     - run: ci/check-directional-formatting.bash
@@ -368,7 +405,7 @@ jobs:
         artifact: sparse-20.04
     - name: Install the current `sparse` package
       run: sudo dpkg -i sparse-20.04/sparse_*.deb
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - name: Install other dependencies
       run: ci/install-dependencies.sh
     - run: make sparse
@@ -383,6 +420,6 @@ jobs:
       jobname: Documentation
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - run: ci/install-dependencies.sh
     - run: ci/test-documentation.sh
index 5e56e471b344ef45e026847a6865645d61908be7..612c0f6a0ff1aa37415b275424a4e01942f5a2dd 100644 (file)
 /git-remote-ext
 /git-repack
 /git-replace
+/git-replay
 /git-request-pull
 /git-rerere
 /git-reset
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..c0fa2fe
--- /dev/null
@@ -0,0 +1,104 @@
+default:
+  timeout: 2h
+
+workflow:
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+    - if: $CI_COMMIT_TAG
+    - if: $CI_COMMIT_REF_PROTECTED == "true"
+
+test:linux:
+  image: $image
+  before_script:
+    - ./ci/install-docker-dependencies.sh
+  script:
+    - useradd builder --create-home
+    - chown -R builder "${CI_PROJECT_DIR}"
+    - sudo --preserve-env --set-home --user=builder ./ci/run-build-and-tests.sh
+  after_script:
+    - |
+      if test "$CI_JOB_STATUS" != 'success'
+      then
+        sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
+      fi
+  parallel:
+    matrix:
+      - jobname: linux-sha256
+        image: ubuntu:latest
+        CC: clang
+      - jobname: linux-reftable
+        image: ubuntu:latest
+        CC: clang
+      - jobname: linux-gcc
+        image: ubuntu:20.04
+        CC: gcc
+        CC_PACKAGE: gcc-8
+      - jobname: linux-TEST-vars
+        image: ubuntu:20.04
+        CC: gcc
+        CC_PACKAGE: gcc-8
+      - jobname: linux-gcc-default
+        image: ubuntu:latest
+        CC: gcc
+      - jobname: linux-leaks
+        image: ubuntu:latest
+        CC: gcc
+      - jobname: linux-reftable-leaks
+        image: ubuntu:latest
+        CC: gcc
+      - jobname: linux-asan-ubsan
+        image: ubuntu:latest
+        CC: clang
+      - jobname: pedantic
+        image: fedora:latest
+      - jobname: linux-musl
+        image: alpine:latest
+  artifacts:
+    paths:
+      - t/failed-test-artifacts
+    when: on_failure
+
+test:osx:
+  image: $image
+  tags:
+    - saas-macos-medium-m1
+  variables:
+    TEST_OUTPUT_DIRECTORY: "/Volumes/RAMDisk"
+  before_script:
+    # Create a 4GB RAM disk that we use to store test output on. This small hack
+    # significantly speeds up tests by more than a factor of 2 because the
+    # macOS runners use network-attached storage as disks, which is _really_
+    # slow with the many small writes that our tests do.
+    - sudo diskutil apfs create $(hdiutil attach -nomount ram://8192000) RAMDisk
+    - ./ci/install-dependencies.sh
+  script:
+    - ./ci/run-build-and-tests.sh
+  after_script:
+    - |
+      if test "$CI_JOB_STATUS" != 'success'
+      then
+        ./ci/print-test-failures.sh
+        mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
+      fi
+  parallel:
+    matrix:
+      - jobname: osx-clang
+        image: macos-13-xcode-14
+        CC: clang
+      - jobname: osx-reftable
+        image: macos-13-xcode-14
+        CC: clang
+  artifacts:
+    paths:
+      - t/failed-test-artifacts
+    when: on_failure
+
+static-analysis:
+  image: ubuntu:22.04
+  variables:
+    jobname: StaticAnalysis
+  before_script:
+    - ./ci/install-docker-dependencies.sh
+  script:
+    - ./ci/run-static-analysis.sh
+    - ./ci/check-directional-formatting.bash
index dc31d70b8c1e98b14a4e76d5fa0e35cfd0bccc34..82129be449f94b9872087717a03f1e3d5e2fac1a 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -59,9 +59,9 @@ David Reiss <dreiss@facebook.com> <dreiss@dreiss-vmware.(none)>
 David S. Miller <davem@davemloft.net>
 David Turner <novalis@novalis.org> <dturner@twopensource.com>
 David Turner <novalis@novalis.org> <dturner@twosigma.com>
-Derrick Stolee <derrickstolee@github.com> <stolee@gmail.com>
-Derrick Stolee <derrickstolee@github.com> Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
-Derrick Stolee <derrickstolee@github.com> <dstolee@microsoft.com>
+Derrick Stolee <stolee@gmail.com> <derrickstolee@github.com>
+Derrick Stolee <stolee@gmail.com> Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
+Derrick Stolee <stolee@gmail.com> <dstolee@microsoft.com>
 Deskin Miller <deskinm@umich.edu>
 Đoàn Trần Công Danh <congdanhqx@gmail.com> Doan Tran Cong Danh
 Dirk Süsserott <newsletter@dirk.my1.cc>
index 0215b1fd4c05e668f37973549384aae24dcc65cf..e58917c50a96dc9457a983bbf2b46ed00f2f3e90 100644 (file)
@@ -130,11 +130,11 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
 version 2.0, available at
 [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
 
-Community Impact Guidelines were inspired by 
+Community Impact Guidelines were inspired by
 [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
 
 For answers to common questions about this code of conduct, see the FAQ at
-[https://www.contributor-covenant.org/faq][FAQ]. Translations are available 
+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
 at [https://www.contributor-covenant.org/translations][translations].
 
 [homepage]: https://www.contributor-covenant.org
index 65af8d82cedd5fdfd46005d4b4e75114a74810fb..32e69f798ee7da4174c1f73910c899adf14ca63c 100644 (file)
@@ -1,5 +1,5 @@
-Like other projects, we also have some guidelines to keep to the
-code.  For Git in general, a few rough rules are:
+Like other projects, we also have some guidelines for our code.  For
+Git in general, a few rough rules are:
 
  - Most importantly, we never say "It's in POSIX; we'll happily
    ignore your needs should your system not conform to it."
@@ -24,7 +24,7 @@ code.  For Git in general, a few rough rules are:
 
    "Once it _is_ in the tree, it's not really worth the patch noise to
    go and fix it up."
-   Cf. http://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html
+   Cf. https://lore.kernel.org/all/20100126160632.3bdbe172.akpm@linux-foundation.org/
 
  - Log messages to explain your changes are as important as the
    changes themselves.  Clearly written code and in-code comments
@@ -40,7 +40,7 @@ As for more concrete guidelines, just imitate the existing code
 contributing to). It is always preferable to match the _local_
 convention. New code added to Git suite is expected to match
 the overall style of existing code. Modifications to existing
-code is expected to match the style the surrounding code already
+code are expected to match the style the surrounding code already
 uses (even if it doesn't match the overall style of existing code).
 
 But if you must have a list of rules, here are some language
@@ -446,12 +446,41 @@ For C programs:
    detail.
 
  - The first #include in C files, except in platform specific compat/
-   implementations and sha1dc/, must be either "git-compat-util.h" or
-   one of the approved headers that includes it first for you.  (The
-   approved headers currently include "builtin.h",
-   "t/helper/test-tool.h", "xdiff/xinclude.h", or
-   "reftable/system.h").  You do not have to include more than one of
-   these.
+   implementations and sha1dc/, must be <git-compat-util.h>.  This
+   header file insulates other header files and source files from
+   platform differences, like which system header files must be
+   included in what order, and what C preprocessor feature macros must
+   be defined to trigger certain features we expect out of the system.
+   A collorary to this is that C files should not directly include
+   system header files themselves.
+
+   There are some exceptions, because certain group of files that
+   implement an API all have to include the same header file that
+   defines the API and it is convenient to include <git-compat-util.h>
+   there.  Namely:
+
+   - the implementation of the built-in commands in the "builtin/"
+     directory that include "builtin.h" for the cmd_foo() prototype
+     definition,
+
+   - the test helper programs in the "t/helper/" directory that include
+     "t/helper/test-tool.h" for the cmd__foo() prototype definition,
+
+   - the xdiff implementation in the "xdiff/" directory that includes
+     "xdiff/xinclude.h" for the xdiff machinery internals,
+
+   - the unit test programs in "t/unit-tests/" directory that include
+     "t/unit-tests/test-lib.h" that gives them the unit-tests
+     framework, and
+
+   - the source files that implement reftable in the "reftable/"
+     directory that include "reftable/system.h" for the reftable
+     internals,
+
+   are allowed to assume that they do not have to include
+   <git-compat-util.h> themselves, as it is included as the first
+   '#include' in these header files.  These headers must be the first
+   header file to be "#include"d in them, though.
 
  - A C file must directly include the header files that declare the
    functions and the types it uses, except for the functions and types
@@ -490,7 +519,7 @@ For Perl programs:
 
  - Most of the C guidelines above apply.
 
- - We try to support Perl 5.8 and later ("use Perl 5.008").
+ - We try to support Perl 5.8.1 and later ("use Perl 5.008001").
 
  - use strict and use warnings are strongly preferred.
 
@@ -518,7 +547,7 @@ For Perl programs:
 
 For Python scripts:
 
- - We follow PEP-8 (http://www.python.org/dev/peps/pep-0008/).
+ - We follow PEP-8 (https://peps.python.org/pep-0008/).
 
  - As a minimum, we aim to be compatible with Python 2.7.
 
@@ -578,7 +607,7 @@ Externally Visible Names
    . The variable name describes the effect of tweaking this knob.
 
    The section and variable names that consist of multiple words are
-   formed by concatenating the words without punctuations (e.g. `-`),
+   formed by concatenating the words without punctuation marks (e.g. `-`),
    and are broken using bumpyCaps in documentation as a hint to the
    reader.
 
@@ -666,6 +695,11 @@ Writing Documentation:
    <new-branch-name>
    --template=<template-directory>
 
+ When a placeholder is cited in text paragraph, it is enclosed in angle
+ brackets to remind the reader the reference in the synopsis section.
+ For better visibility, the placeholder is typeset in italics:
+   The _<file>_ to be added.
+
  Possibility of multiple occurrences is indicated by three dots:
    <file>...
    (One or more of <file>.)
@@ -751,6 +785,8 @@ Writing Documentation:
    Incorrect:
       `\--pretty=oneline`
 
+A placeholder is not enclosed in backticks, as it is not a literal.
+
  If some place in the documentation needs to typeset a command usage
  example with inline substitutions, it is fine to use +monospaced and
  inline substituted text+ instead of `monospaced literal text`, and with
index b629176d7d2d6776e0a66fbda466915219f32bc2..3f2383a12c77d04f027c64a0b6aed5ad7305e271 100644 (file)
@@ -122,6 +122,7 @@ TECH_DOCS += technical/scalar
 TECH_DOCS += technical/send-pack-pipeline
 TECH_DOCS += technical/shallow
 TECH_DOCS += technical/trivial-merge
+TECH_DOCS += technical/unit-tests
 SP_ARTICLES += $(TECH_DOCS)
 SP_ARTICLES += technical/api-index
 
index 62d11a5cd7f909e2e038e1f768bafddc82be210d..f06563e98174604d339e3ded16b762e13b41534a 100644 (file)
@@ -35,8 +35,9 @@ announcements, design discussions, and more take place. Those interested in
 contributing are welcome to post questions here. The Git list requires
 plain-text-only emails and prefers inline and bottom-posting when replying to
 mail; you will be CC'd in all replies to you. Optionally, you can subscribe to
-the list by sending an email to majordomo@vger.kernel.org with "subscribe git"
-in the body. The https://lore.kernel.org/git[archive] of this mailing list is
+the list by sending an email to <git+subscribe@vger.kernel.org>
+(see https://subspace.kernel.org/subscribing.html for details).
+The https://lore.kernel.org/git[archive] of this mailing list is
 available to view in a browser.
 
 ==== https://groups.google.com/forum/#!forum/git-mentoring[git-mentoring@googlegroups.com]
@@ -160,10 +161,11 @@ in order to keep the declarations alphabetically sorted:
 int cmd_psuh(int argc, const char **argv, const char *prefix);
 ----
 
-Be sure to `#include "builtin.h"` in your `psuh.c`.
+Be sure to `#include "builtin.h"` in your `psuh.c`. You'll also need to
+`#include "gettext.h"` to use functions related to printing output text.
 
-Go ahead and add some throwaway printf to that function. This is a decent
-starting point as we can now add build rules and register the command.
+Go ahead and add some throwaway printf to the `cmd_psuh` function. This is a
+decent starting point as we can now add build rules and register the command.
 
 NOTE: Your throwaway text, as well as much of the text you will be adding over
 the course of this tutorial, is user-facing. That means it needs to be
@@ -832,7 +834,7 @@ Johannes Schindelin to make life as a Git contributor easier for those used to
 the GitHub PR workflow. It allows contributors to open pull requests against its
 mirror of the Git project, and does some magic to turn the PR into a set of
 emails and send them out for you. It also runs the Git continuous integration
-suite for you. It's documented at http://gitgitgadget.github.io.
+suite for you. It's documented at https://gitgitgadget.github.io/.
 
 [[create-fork]]
 === Forking `git/git` on GitHub
index 980adfb31546974b69e4aff8ef91ab05e00da41f..166d73c60fb11e021b77afc0b759de52cfba0495 100644 (file)
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index 4bcff945e019d92f58cef08517fa1e7a70553b66..bbf177fc3c5ba4f76a1e002623e32b9106204ee5 100644 (file)
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index a2a34b43a75d1b213eb51afae09d06454607e644..0fccfb0bf0bddf99a181653648d0af630d631b95 100644 (file)
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index 6c7f7da7eb9a10971c42552cafc5e85f6b226319..79cb1b2b6df88a5ccdf9a237f83379839227057b 100644 (file)
@@ -21,7 +21,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index 3ed1e01433745aed586a5de3770f88b8cdf08233..88b86a827e807e5463a3a353ec004a47b52ecb52 100644 (file)
@@ -63,7 +63,7 @@ users will fare this time.
 
    Please refer to:
 
-   http://git.or.cz/gitwiki/GitFaq#non-bare
+   https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
    https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
    for more details on the reason why this change is needed and the
diff --git a/Documentation/RelNotes/2.42.1.txt b/Documentation/RelNotes/2.42.1.txt
new file mode 100644 (file)
index 0000000..3d391b7
--- /dev/null
@@ -0,0 +1,88 @@
+Git 2.42.1 Release Notes
+========================
+
+There is nothing exciting to see here.  Relative to Git 2.42, this
+release contains the fixes that have already been merged to the
+'master' branch of the development towards Git 2.43 that has been
+tagged as Git 2.43.0-rc0.
+
+Fixes since Git 2.42.0
+----------------------
+
+ * Tests that are known to pass with LSan are now marked as such.
+
+ * Flaky "git p4" tests, as well as "git svn" tests, are now skipped
+   in the (rather expensive) sanitizer CI job.
+
+ * Tests with LSan from time to time seem to emit harmless message
+   that makes our tests unnecessarily flaky; we work it around by
+   filtering the uninteresting output.
+
+ * GitHub CI workflow has learned to trigger Coverity check.
+
+ * Overly long label names used in the sequencer machinery are now
+   chopped to fit under filesystem limitation.
+
+ * Scalar updates.
+
+ * Tweak GitHub Actions CI so that pushing the same commit to multiple
+   branch tips at the same time will not waste building and testing
+   the same thing twice.
+
+ * The commit-graph verification code that detects mixture of zero and
+   non-zero generation numbers has been updated.
+
+ * "git diff -w --exit-code" with various options did not work
+   correctly, which is being addressed.
+
+ * transfer.unpackLimit ought to be used as a fallback, but overrode
+   fetch.unpackLimit and receive.unpackLimit instead.
+
+ * The use of API between two calls to require_clean_work_tree() from
+   the sequencer code has been cleaned up for consistency.
+
+ * "git diff --no-such-option" and other corner cases around the exit
+   status of the "diff" command has been corrected.
+
+ * "git for-each-ref --sort='contents:size'" sorts the refs according
+   to size numerically, giving a ref that points at a blob twelve-byte
+   (12) long before showing a blob hundred-byte (100) long.
+
+ * Various fixes to the behavior of "rebase -i" when the command got
+   interrupted by conflicting changes.
+
+ * References from description of the `--patch` option in various
+   manual pages have been simplified and improved.
+
+ * "git grep -e A --no-or -e B" is accepted, even though the negation
+   of "or" did not mean anything, which has been tightened.
+
+ * The completion script (in contrib/) has been taught to treat the
+   "-t" option to "git checkout" and "git switch" just like the
+   "--track" option, to complete remote-tracking branches.
+
+ * "git diff --no-index -R <(one) <(two)" did not work correctly,
+   which has been corrected.
+
+ * Update "git maintenance" timers' implementation based on systemd
+   timers to work with WSL.
+
+ * "git diff --cached" codepath did not fill the necessary stat
+   information for a file when fsmonitor knows it is clean and ended
+   up behaving as if it is not clean, which has been corrected.
+
+ * Clarify how "alias.foo = : git cmd ; aliased-command-string" should
+   be spelled with necessary whitespaces around punctuation marks to
+   work.
+
+ * HTTP Header redaction code has been adjusted for a newer version of
+   cURL library that shows its traces differently from earlier
+   versions.
+
+ * An error message given by "git send-email" when given a malformed
+   address did not give correct information, which has been corrected.
+
+ * UBSan options were not propagated through the test framework to git
+   run via the httpd, unlike ASan options, which has been corrected.
+
+Also contains various documentation updates, code clean-ups and minor fixups.
diff --git a/Documentation/RelNotes/2.43.0.txt b/Documentation/RelNotes/2.43.0.txt
new file mode 100644 (file)
index 0000000..e0e5b53
--- /dev/null
@@ -0,0 +1,323 @@
+Git v2.43 Release Notes
+=======================
+
+Backward Compatibility Notes
+
+ * The "--rfc" option of "git format-patch" used to be a valid way to
+   override an earlier "--subject-prefix=<something>" on the command
+   line and replace it with "[RFC PATCH]", but from this release, it
+   merely prefixes the string "RFC " in front of the given subject
+   prefix.  If you are negatively affected by this change, please use
+   "--subject-prefix=PATCH --rfc" as a replacement.
+
+ * In Git 2.42, "git rev-list --stdin" learned to take non-revisions
+   (like "--not") from the standard input, but the way such a "--not" was
+   handled was quite confusing, which has been rethought.  The updated
+   rule is that "--not" given from the command line only affects revs
+   given from the command line that comes but not revs read from the
+   standard input, and "--not" read from the standard input affects
+   revs given from the standard input and not revs given from the
+   command line.
+
+UI, Workflows & Features
+
+ * A message written in olden time prevented a branch from getting
+   checked out, saying it is already checked out elsewhere. But these
+   days, we treat a branch that is being bisected or rebased just like
+   a branch that is checked out and protect it from getting modified
+   with the same codepath.  The message has been rephrased to say that
+   the branch is "in use" to avoid confusion.
+
+ * Hourly and other schedules of "git maintenance" jobs are randomly
+   distributed now.
+
+ * "git cmd -h" learned to signal which options can be negated by
+   listing such options like "--[no-]opt".
+
+ * The way authentication related data other than passwords (e.g.,
+   oauth token and password expiration data) are stored in libsecret
+   keyrings has been rethought.
+
+ * Update the libsecret and wincred credential helpers to correctly
+   match which credential to erase; they erased the wrong entry in
+   some cases.
+
+ * Git GUI updates.
+
+ * "git format-patch" learned a new "--description-file" option that
+   lets cover letter description to be fed; this can be used on
+   detached HEAD where there is no branch description available, and
+   also can override the branch description if there is one.
+
+ * Use of the "--max-pack-size" option to allow multiple packfiles to
+   be created is now supported even when we are sending unreachable
+   objects to cruft packs.
+
+ * "git format-patch --rfc --subject-prefix=<foo>" used to ignore the
+   "--subject-prefix" option and used "[RFC PATCH]"; now we will add
+   "RFC" prefix to whatever subject prefix is specified.
+
+ * "git log --format" has been taught the %(decorate) placeholder for
+   further customization over what the "--decorate" option offers.
+
+ * The default log message created by "git revert", when reverting a
+   commit that records a revert, has been tweaked, to encourage people
+   to describe complex "revert of revert of revert" situations better in
+   their own words.
+
+ * The command-line completion support (in contrib/) learned to
+   complete "git commit --trailer=" for possible trailer keys.
+
+ * "git update-index" learned the "--show-index-version" option to
+   inspect the index format version used by the on-disk index file.
+
+ * "git diff" learned the "diff.statNameWidth" configuration variable,
+   to give the default width for the name part in the "--stat" output.
+
+ * "git range-diff --notes=foo" compared "log --notes=foo --notes" of
+   the two ranges, instead of using just the specified notes tree,
+   which has been corrected to use only the specified notes tree.
+
+ * The command line completion script (in contrib/) can be told to
+   complete aliases by including ": git <cmd> ;" in the alias to tell
+   it that the alias should be completed in a similar way to how "git
+   <cmd>" is completed.  The parsing code for the alias has been
+   loosened to allow ';' without an extra space before it.
+
+ * "git for-each-ref" and friends learned to apply mailmap to
+   authorname and other fields in a more flexible way than using
+   separate placeholder letters like %a[eElL] every time we want to
+   come up with small variants.
+
+ * "git repack" machinery learned to pay attention to the "--filter="
+   option.
+
+ * "git repack" learned the "--max-cruft-size" option to prevent cruft
+   packs from growing without bounds.
+
+ * "git merge-tree" learned to take strategy backend specific options
+   via the "-X" option, like "git merge" does.
+
+ * "git log" and friends learned the "--dd" option that is a
+   short-hand for "--diff-merges=first-parent -p".
+
+ * The attribute subsystem learned to honor the "attr.tree"
+   configuration variable that specifies which tree to read the
+   .gitattributes files from.
+
+ * "git merge-file" learns a mode to read three variants of the
+   contents to be merged from blob objects.
+
+
+Performance, Internal Implementation, Development Support etc.
+
+ * "git check-attr" has been taught to work better with sparse-index.
+
+ * It may be tempting to leave the help text NULL for a command line
+   option that is either hidden or too obvious, but "git subcmd -h"
+   and "git subcmd --help-all" would have segfaulted if done so.  Now
+   the help text is truly optional.
+
+ * Tests that are known to pass with LSan are now marked as such.
+
+ * Flaky "git p4" tests, as well as "git svn" tests, are now skipped
+   in the (rather expensive) sanitizer CI job.
+
+ * Tests with LSan from time to time seem to emit harmless messages
+   that make our tests unnecessarily flaky; we work around it by
+   filtering the uninteresting output.
+
+ * Unused parameters to functions are marked as such, and/or removed,
+   in order to bring us closer to "-Wunused-parameter" clean.
+
+ * The code to keep track of existing packs in the repository while
+   repacking has been refactored.
+
+ * The "streaming" interface used for bulk-checkin codepath has been
+   narrowed to take only blob objects for now, with no real loss of
+   functionality.
+
+ * GitHub CI workflow has learned to trigger Coverity check.
+
+ * Test coverage for trailers has been improved.
+
+ * The code to iterate over loose references has been optimized to
+   reduce the number of lstat() system calls.
+
+ * The codepaths that read "chunk" formatted files have been corrected
+   to pay attention to the chunk size and notice broken files.
+
+ * Replace macos-12 used at GitHub CI with macos-13.
+   (merge 682a868f67 js/ci-use-macos-13 later to maint).
+
+
+Fixes since v2.42
+-----------------
+
+ * Overly long label names used in the sequencer machinery are now
+   chopped to fit under filesystem limitation.
+
+ * Scalar updates.
+
+ * Tweak GitHub Actions CI so that pushing the same commit to multiple
+   branch tips at the same time will not waste building and testing
+   the same thing twice.
+
+ * The commit-graph verification code that detects a mixture of zero and
+   non-zero generation numbers has been updated.
+
+ * "git diff -w --exit-code" with various options did not work
+   correctly, which has been corrected.
+
+ * The "transfer.unpackLimit" configuration variable ought to be used
+   as a fallback, but overrode the more specific "fetch.unpackLimit"
+   and "receive.unpackLimit" configuration variables by mistake, which
+   has been corrected.
+
+ * The use of API between two calls to require_clean_work_tree() from
+   the sequencer code has been cleaned up for consistency.
+
+ * "git diff --no-such-option" and other corner cases around the exit
+   status of the "diff" command have been corrected.
+
+ * "git for-each-ref --sort='contents:size'" sorted the refs according
+   to size numerically, giving a ref that points at a blob twelve-byte
+   (12) long before showing a blob hundred-byte (100) long, which has
+   been corrected.
+
+ * We now limit the depth of the tree objects and maximum length of
+   pathnames recorded in tree objects.
+   (merge 4d5693ba05 jk/tree-name-and-depth-limit later to maint).
+
+ * Various fixes to the behavior of "rebase -i", when the command got
+   interrupted by conflicting changes, have been made.
+
+ * References from a description of the `--patch` option in various
+   manual pages have been simplified and improved.
+
+ * "git grep -e A --no-or -e B" is accepted, even though the negation
+   of the "--or" option did not mean anything, which has been tightened.
+
+ * The completion script (in contrib/) has been taught to treat the
+   "-t" option to "git checkout" and "git switch" just like the
+   "--track" option, to complete remote-tracking branches.
+
+ * "git diff --no-index -R <(one) <(two)" did not work correctly,
+   which has been corrected.
+
+ * "git maintenance" timers' implementation has been updated, based on
+   systemd timers, to work with WSL.
+
+ * "git diff --cached" codepath did not fill the necessary stat
+   information for a file when fsmonitor knows it is clean and ended
+   up behaving as if it were not clean, which has been corrected.
+
+ * How "alias.foo = : git cmd ; aliased-command-string" should be
+   spelled with necessary whitespace around punctuation marks to work
+   has been more clearly documented (but this will be moot with newer
+   versions of Git where the parsing rules have been improved).
+
+ * HTTP Header redaction code has been adjusted for a newer version of
+   cURL library that shows its traces differently from earlier
+   versions.
+
+ * An error message given by "git send-email", when given a malformed
+   address, did not show the offending address, which has been corrected.
+
+ * UBSan options were not propagated through the test framework to git
+   run via the httpd, unlike ASan options, which has been corrected.
+
+ * "checkout --merge -- path" and "update-index --unresolve path" did
+   not resurrect conflicted state that was resolved to remove path,
+   but now they do.
+   (merge 5bdedac3c7 jc/unresolve-removal later to maint).
+
+ * The display width table for unicode characters has been updated for
+   Unicode 15.1
+   (merge 872976c37e bb/unicode-width-table-15 later to maint).
+
+ * Update mailmap entry for Derrick.
+   (merge 6e5457d8c7 ds/mailmap-entry-update later to maint).
+
+ * In the ".gitmodules" files, submodules are keyed by their names,
+   and the path to the submodule whose name is $name is specified by
+   the submodule.$name.path variable.  There were a few codepaths that
+   mixed the name and path up when consulting the submodule database,
+   which have been corrected.  It took long for these bugs to be found
+   as the name of a submodule initially is the same as its path, and
+   the problem does not surface until it is moved to a different path,
+   which apparently happens very rarely.
+
+ * "git diff --merge-base X other args..." insisted that X must be a
+   commit and errored out when given an annotated tag that peels to a
+   commit, but we only need it to be a committish.  This has been
+   corrected.
+   (merge 4adceb5a29 ar/diff-index-merge-base-fix later to maint).
+
+ * "git merge-tree" used to segfault when the "--attr-source"
+   option is used, which has been corrected.
+   (merge e95bafc52f jc/merge-ort-attr-index-fix later to maint).
+
+ * Unlike "git log --pretty=%D", "git log --pretty="%(decorate)" did
+   not auto-initialize the decoration subsystem, which has been
+   corrected.
+
+ * Feeding "git stash store" with a random commit that was not created
+   by "git stash create" now errors out.
+   (merge d9b6634589 jc/fail-stash-to-store-non-stash later to maint).
+
+ * The index file has room only for the lower 32-bit of the file size in
+   the cached stat information, which means cached stat information
+   will have 0 in its sd_size member for a file whose size is a multiple
+   of 4GiB.  This is mistaken for a racily clean path.  Avoid it by
+   storing a bogus sd_size value instead for such files.
+   (merge 5143ac07b1 bc/racy-4gb-files later to maint).
+
+ * "git p4" tried to store symlinks to LFS when told, but has been
+   fixed not to do so, because it does not make sense.
+   (merge 10c89a02b0 mm/p4-symlink-with-lfs later to maint).
+
+ * The codepath to handle recipient addresses `git send-email
+   --compose` learns from the user was completely broken, which has
+   been corrected.
+   (merge 3ec6167567 jk/send-email-fix-addresses-from-composed-messages later to maint).
+
+ * "cd sub && git grep -f patterns" tried to read "patterns" file at
+   the top level of the working tree; it has been corrected to read
+   "sub/patterns" instead.
+
+ * "git reflog expire --single-worktree" has been broken for the past
+   20 months or so, which has been corrected.
+
+ * "git send-email" did not have certain pieces of data computed yet
+   when it tried to validate the outgoing messages and its recipient
+   addresses, which has been sorted out.
+
+ * "git bugreport" learned to complain when it received a command line
+   argument that it will not use.
+
+ * The codepath to traverse the commit-graph learned to notice that a
+   commit is missing (e.g., corrupt repository lost an object), even
+   though it knows something about the commit (like its parents) from
+   what is in commit-graph.
+   (merge 7a5d604443 ps/do-not-trust-commit-graph-blindly-for-existence later to maint).
+
+ * "git rev-list --missing" did not work for missing commit objects,
+   which has been corrected.
+
+ * "git rev-list --unpacked --objects" failed to exclude packed
+   non-commit objects, which has been corrected.
+   (merge 7b3c8e9f38 tb/rev-list-unpacked-fix later to maint).
+
+ * "To dereference" and "to peel" were sometimes used in in-code
+   comments and documentation but without description in the glossary.
+   (merge 893dce2ffb vd/glossary-dereference-peel later to maint).
+
+ * Other code cleanup, docfix, build fix, etc.
+   (merge c2c349a15c xz/commit-title-soft-limit-doc later to maint).
+   (merge 1bd809938a tb/format-pack-doc-update later to maint).
+   (merge 8f81532599 an/clang-format-typofix later to maint).
+   (merge 3ca86adc2d la/strvec-header-fix later to maint).
+   (merge 6789275d37 jc/test-i18ngrep later to maint).
+   (merge 9972cd6004 ps/leakfixes later to maint).
+   (merge 46edab516b tz/send-email-helpfix later to maint).
diff --git a/Documentation/RelNotes/2.43.1.txt b/Documentation/RelNotes/2.43.1.txt
new file mode 100644 (file)
index 0000000..20e96f2
--- /dev/null
@@ -0,0 +1,82 @@
+Git 2.43.1 Release Notes
+========================
+
+There is nothing exciting to see here.  Relative to Git 2.43, this
+release contains the fixes that have already been merged to the
+'master' branch of the development towards the next major release.
+
+Fixes since Git 2.43.0
+----------------------
+
+ * The way CI testing used "prove" could lead to running the test
+   suite twice needlessly, which has been corrected.
+
+ * Newer versions of Getopt::Long started giving warnings against our
+   (ab)use of it in "git send-email".  Bump the minimum version
+   requirement for Perl to 5.8.1 (from September 2002) to allow
+   simplifying our implementation.
+
+ * Earlier we stopped relying on commit-graph that (still) records
+   information about commits that are lost from the object store,
+   which has negative performance implications.  The default has been
+   flipped to disable this pessimization.
+
+ * Stale URLs have been updated to their current counterparts (or
+   archive.org) and HTTP links are replaced with working HTTPS links.
+
+ * trace2 streams used to record the URLs that potentially embed
+   authentication material, which has been corrected.
+
+ * The sample pre-commit hook that tries to catch introduction of new
+   paths that use potentially non-portable characters did not notice
+   an existing path getting renamed to such a problematic path, when
+   rename detection was enabled.
+
+ * The command line parser for the "log" family of commands was too
+   loose when parsing certain numbers, e.g., silently ignoring the
+   extra 'q' in "git log -n 1q" without complaining, which has been
+   tightened up.
+
+ * "git $cmd --end-of-options --rev -- --path" for some $cmd failed
+   to interpret "--rev" as a rev, and "--path" as a path.  This was
+   fixed for many programs like "reset" and "checkout".
+
+ * "git bisect reset" has been taught to clean up state files and refs
+   even when BISECT_START file is gone.
+
+ * Some codepaths did not correctly parse configuration variables
+   specified with valueless "true", which has been corrected.
+
+ * Code clean-up for sanity checking of command line options for "git
+   show-ref".
+
+ * The code to parse the From e-mail header has been updated to avoid
+   recursion.
+
+ * "git fetch --atomic" issued an unnecessary empty error message,
+   which has been corrected.
+
+ * Command line completion script (in contrib/) learned to work better
+   with the reftable backend.
+
+ * "git status" is taught to show both the branch being bisected and
+   being rebased when both are in effect at the same time.
+   cf. <xmqqil76kyov.fsf@gitster.g>
+
+ * "git archive --list extra garbage" silently ignored excess command
+   line parameters, which has been corrected.
+
+ * "git sparse-checkout set" added default patterns even when the
+   patterns are being fed from the standard input, which has been
+   corrected.
+
+ * Unlike other environment variables that took the usual
+   true/false/yes/no as well as 0/1, GIT_FLUSH only understood 0/1,
+   which has been corrected.
+
+ * Clearing in-core repository (happens during e.g., "git fetch
+   --recurse-submodules" with commit graph enabled) made in-core
+   commit object in an inconsistent state by discarding the necessary
+   data from commit-graph too early, which has been corrected.
+
+Also contains various documentation updates, code clean-ups and minor fixups.
diff --git a/Documentation/RelNotes/2.43.2.txt b/Documentation/RelNotes/2.43.2.txt
new file mode 100644 (file)
index 0000000..5895e23
--- /dev/null
@@ -0,0 +1,37 @@
+Git 2.43.2 Release Notes
+========================
+
+Relative to Git 2.43.1, this release has two important fixes to allow
+"git imap-send" to be built with NO_CURL defined, and to restore the
+forced flushing behaviour when GIT_FLUSH=1 is set.  It also contains
+other, unexciting, fixes that have already been merged to the 'master'
+branch of the development towards the next major release.
+
+Fixes since Git 2.43.1
+----------------------
+
+ * Update to a new feature recently added, "git show-ref --exists".
+
+ * Rename detection logic ignored the final line of a file if it is an
+   incomplete line.
+
+ * "git diff --no-rename A B" did not disable rename detection but did
+   not trigger an error from the command line parser.
+
+ * "git diff --no-index file1 file2" segfaulted while invoking the
+   external diff driver, which has been corrected.
+
+ * Rewrite //-comments to /* comments */ in files whose comments
+   prevalently use the latter.
+
+ * A failed "git tag -s" did not necessarily result in an error
+   depending on the crypto backend, which has been corrected.
+
+ * "git stash" sometimes was silent even when it failed due to
+   unwritable index file, which has been corrected.
+
+ * Recent conversion to allow more than 0/1 in GIT_FLUSH broke the
+   mechanism by flipping what yes/no means by mistake, which has been
+   corrected.
+
+Also contains documentation updates, code clean-ups and minor fixups.
diff --git a/Documentation/RelNotes/2.43.3.txt b/Documentation/RelNotes/2.43.3.txt
new file mode 100644 (file)
index 0000000..924f205
--- /dev/null
@@ -0,0 +1,12 @@
+Git 2.43.3 Release Notes
+========================
+
+Relative to Git 2.43.2, this release fixes one regression that
+manifests while running "git commit -v --trailer".
+
+Fixes since Git 2.43.2
+----------------------
+
+ * "git commit -v --trailer=..." was broken with recent update and
+   placed the trailer _after_ the divider line, which has been
+   corrected.
diff --git a/Documentation/RelNotes/2.44.0.txt b/Documentation/RelNotes/2.44.0.txt
new file mode 100644 (file)
index 0000000..14f9ce8
--- /dev/null
@@ -0,0 +1,334 @@
+Git v2.44 Release Notes
+=======================
+
+Backward Compatibility Notes
+
+ * "git checkout -B <branch>" used to allow switching to a branch that
+   is in use on another worktree, but this was by mistake.  The users
+   need to use "--ignore-other-worktrees" option.
+
+
+UI, Workflows & Features
+
+ * "git add" and "git stash" learned to support the ":(attr:...)"
+   magic pathspec.
+
+ * "git rebase --autosquash" is now enabled for non-interactive rebase,
+   but it is still incompatible with the apply backend.
+
+ * Introduce "git replay", a tool meant on the server side without
+   working tree to recreate a history.
+
+ * "git merge-file" learned to take the "--diff-algorithm" option to
+   use algorithm different from the default "myers" diff.
+
+ * Command line completion (in contrib/) learned to complete path
+   arguments to the "add/set" subcommands of "git sparse-checkout"
+   better.
+
+ * "git checkout -B <branch> [<start-point>]" allowed a branch that is
+   in use in another worktree to be updated and checked out, which
+   might be a bit unexpected.  The rule has been tightened, which is a
+   breaking change.  "--ignore-other-worktrees" option is required to
+   unbreak you, if you are used to the current behaviour that "-B"
+   overrides the safety.
+
+ * The builtin_objectmode attribute is populated for each path
+   without adding anything in .gitattributes files, which would be
+   useful in magic pathspec, e.g., ":(attr:builtin_objectmode=100755)"
+   to limit to executables.
+
+ * "git fetch" learned to pay attention to "fetch.all" configuration
+   variable, which pretends as if "--all" was passed from the command
+   line when no remote parameter was given.
+
+ * In addition to (rather cryptic) Security Identifiers, show username
+   and domain in the error message when we barf on mismatch between
+   the Git directory and the current user on Windows.
+
+ * The error message given when "git branch -d branch" fails due to
+   commits unique to the branch has been split into an error and a new
+   conditional advice message.
+
+ * When given an existing but unreadable file as a configuration file,
+   gitweb behaved as if the file did not exist at all, but now it
+   errors out.  This is a change that may break backward compatibility.
+
+ * When $HOME/.gitconfig is missing but XDG config file is available, we
+   should write into the latter, not former.  "git gc" and "git
+   maintenance" wrote into a wrong "global config" file, which have
+   been corrected.
+
+ * Define "special ref" as a very narrow set that consists of
+   FETCH_HEAD and MERGE_HEAD, and clarify everything else that used to
+   be classified as such are actually just pseudorefs.
+
+ * All conditional "advice" messages show how to turn them off, which
+   becomes repetitive.  Setting advice.* configuration explicitly on
+   now omits the instruction part.
+
+ * The "disable repository discovery of a bare repository" check,
+   triggered by setting safe.bareRepository configuration variable to
+   'explicit', has been loosened to exclude the ".git/" directory inside
+   a non-bare repository from the check.  So you can do "cd .git &&
+   git cmd" to run a Git command that works on a bare repository without
+   explicitly specifying $GIT_DIR now.
+
+ * The completion script (in contrib/) learned more options that can
+   be used with "git log".
+
+ * The labels on conflict markers for the common ancestor, our version,
+   and the other version are available to custom 3-way merge driver
+   via %S, %X, and %Y placeholders.
+
+ * The write codepath for the reftable data learned to honor
+   core.fsync configuration.
+
+ * The "--fsck-objects" option of "git index-pack" now can take the
+   optional parameter to tweak severity of different fsck errors.
+
+ * The wincred credential backend has been taught to support oauth
+   refresh token the same way as credential-cache and
+   credential-libsecret backends.
+
+ * Command line completion support (in contrib/) has been
+   updated for "git bisect".
+
+ * "git branch" and friends learned to use the formatted text as
+   sorting key, not the underlying timestamp value, when the --sort
+   option is used with author or committer timestamp with a format
+   specifier (e.g., "--sort=creatordate:format:%H:%M:%S").
+
+ * The command line completion script (in contrib/) learned to
+   complete configuration variable names better.
+
+
+Performance, Internal Implementation, Development Support etc.
+
+ * Process to add some form of low-level unit tests has started.
+
+ * Add support for GitLab CI.
+
+ * "git for-each-ref --no-sort" still sorted the refs alphabetically
+   which paid non-trivial cost.  It has been redefined to show output
+   in an unspecified order, to allow certain optimizations to take
+   advantage of.
+
+ * Simplify API implementation to delete references by eliminating
+   duplication.
+
+ * Subject approxidate() and show_date() machinery to OSS-Fuzz.
+
+ * A new helper to let us pretend that we called lstat() when we know
+   our cache_entry is up-to-date via fsmonitor.
+
+ * The optimization based on fsmonitor in the "diff --cached"
+   codepath is resurrected with the "fake-lstat" introduced earlier.
+
+ * Test balloon to use C99 "bool" type from <stdbool.h> has been
+   added.
+
+ * "git clone" has been prepared to allow cloning a repository with
+   non-default hash function into a repository that uses the reftable
+   backend.
+
+ * Streaming spans of packfile data used to be done only from a
+   single, primary, pack in a repository with multiple packfiles.  It
+   has been extended to allow reuse from other packfiles, too.
+
+ * Comment updates to help developers not to attempt to modify
+   messages from plumbing commands that must stay constant.
+
+   It might make sense to reassess the plumbing needs every few years,
+   but that should be done as a separate effort.
+
+ * Move test-ctype helper to the unit-test framework.
+
+ * Instead of manually creating refs/ hierarchy on disk upon a
+   creation of a secondary worktree, which is only usable via the
+   files backend, use the refs API to populate it.
+
+ * CI for GitLab learned to drive macOS jobs.
+
+ * A few tests to "git commit -o <pathspec>" and "git commit -i
+   <pathspec>" has been added.
+
+ * Tests on ref API are moved around to prepare for reftable.
+
+ * The Makefile often had to say "-L$(path) -R$(path)" that repeats
+   the path to the same library directory for link time and runtime.
+   A Makefile template is used to reduce such repetition.
+
+ * The priority queue test has been migrated to the unit testing
+   framework.
+
+ * Setting `feature.experimental` opts the user into multi-pack reuse
+   experiment
+
+ * Squelch node.js 16 deprecation warnings from GitHub Actions CI
+   by updating actions/github-script and actions/checkout that use
+   node.js 20.
+
+ * The mechanism to report the filename in the source code, used by
+   the unit-test machinery, assumed that the compiler expanded __FILE__
+   to the path to the source given to the $(CC), but some compilers
+   give full path, breaking the output.  This has been corrected.
+
+
+Fixes since v2.43
+-----------------
+
+ * The way CI testing used "prove" could lead to running the test
+   suite twice needlessly, which has been corrected.
+
+ * Update ref-related tests.
+
+ * "git format-patch --encode-email-headers" ignored the option when
+   preparing the cover letter, which has been corrected.
+
+ * Newer versions of Getopt::Long started giving warnings against our
+   (ab)use of it in "git send-email".  Bump the minimum version
+   requirement for Perl to 5.8.1 (from September 2002) to allow
+   simplifying our implementation.
+
+ * Earlier we stopped relying on commit-graph that (still) records
+   information about commits that are lost from the object store,
+   which has negative performance implications.  The default has been
+   flipped to disable this pessimization.
+
+ * Stale URLs have been updated to their current counterparts (or
+   archive.org) and HTTP links are replaced with working HTTPS links.
+
+ * trace2 streams used to record the URLs that potentially embed
+   authentication material, which has been corrected.
+
+ * The sample pre-commit hook that tries to catch introduction of new
+   paths that use potentially non-portable characters did not notice
+   an existing path getting renamed to such a problematic path, when
+   rename detection was enabled.
+
+ * The command line parser for the "log" family of commands was too
+   loose when parsing certain numbers, e.g., silently ignoring the
+   extra 'q' in "git log -n 1q" without complaining, which has been
+   tightened up.
+
+ * "git $cmd --end-of-options --rev -- --path" for some $cmd failed
+   to interpret "--rev" as a rev, and "--path" as a path.  This was
+   fixed for many programs like "reset" and "checkout".
+
+ * "git bisect reset" has been taught to clean up state files and refs
+   even when BISECT_START file is gone.
+
+ * Some codepaths did not correctly parse configuration variables
+   specified with valueless "true", which has been corrected.
+
+ * Code clean-up for sanity checking of command line options for "git
+   show-ref".
+
+ * The code to parse the From e-mail header has been updated to avoid
+   recursion.
+
+ * "git fetch --atomic" issued an unnecessary empty error message,
+   which has been corrected.
+
+ * Command line completion script (in contrib/) learned to work better
+   with the reftable backend.
+
+ * "git status" is taught to show both the branch being bisected and
+   being rebased when both are in effect at the same time.
+
+ * "git archive --list extra garbage" silently ignored excess command
+   line parameters, which has been corrected.
+
+ * "git sparse-checkout set" added default patterns even when the
+   patterns are being fed from the standard input, which has been
+   corrected.
+
+ * "git sparse-checkout (add|set) --[no-]cone --end-of-options" did
+   not handle "--end-of-options" correctly after a recent update.
+
+ * Unlike other environment variables that took the usual
+   true/false/yes/no as well as 0/1, GIT_FLUSH only understood 0/1,
+   which has been corrected.
+
+ * Clearing in-core repository (happens during e.g., "git fetch
+   --recurse-submodules" with commit graph enabled) made in-core
+   commit object in an inconsistent state by discarding the necessary
+   data from commit-graph too early, which has been corrected.
+
+ * Update to a new feature recently added, "git show-ref --exists".
+
+ * oss-fuzz tests are built and run in CI.
+   (merge c4a9cf1df3 js/oss-fuzz-build-in-ci later to maint).
+
+ * Rename detection logic ignored the final line of a file if it is an
+   incomplete line.
+
+ * GitHub CI update.
+   (merge 0188b2c8e0 pb/ci-github-skip-logs-for-broken-tests later to maint).
+
+ * "git diff --no-rename A B" did not disable rename detection but did
+   not trigger an error from the command line parser.
+
+ * "git archive --remote=<remote>" learned to talk over the smart
+   http (aka stateless) transport.
+   (merge 176cd68634 jx/remote-archive-over-smart-http later to maint).
+
+ * Fetching via protocol v0 over Smart HTTP transport sometimes failed
+   to correctly auto-follow tags.
+   (merge fba732c462 jk/fetch-auto-tag-following-fix later to maint).
+
+ * The documentation for the --exclude-per-directory option marked it
+   as deprecated, which confused readers into thinking there may be a
+   plan to remove it in the future, which was not our intention.
+   (merge 0009542cab jc/ls-files-doc-update later to maint).
+
+ * "git diff --no-index file1 file2" segfaulted while invoking the
+   external diff driver, which has been corrected.
+
+ * Rewrite //-comments to /* comments */ in files whose comments
+   prevalently use the latter.
+
+ * Cirrus CI jobs started breaking because we specified version of
+   FreeBSD that is no longer available, which has been corrected.
+   (merge 81fffb66d3 cb/use-freebsd-13-2-at-cirrus-ci later to maint).
+
+ * A caller called index_file_exists() that takes a string expressed
+   as <ptr, length> with a wrong length, which has been corrected.
+   (merge 156e28b36d jh/sparse-index-expand-to-path-fix later to maint).
+
+ * A failed "git tag -s" did not necessarily result in an error
+   depending on the crypto backend, which has been corrected.
+
+ * "git stash" sometimes was silent even when it failed due to
+   unwritable index file, which has been corrected.
+
+ * "git show-ref --verify" did not show things like "CHERRY_PICK_HEAD",
+   which has been corrected.
+
+ * Recent conversion to allow more than 0/1 in GIT_FLUSH broke the
+   mechanism by flipping what yes/no means by mistake, which has been
+   corrected.
+
+ * The sequencer machinery does not use the ref API and instead
+   records names of certain objects it needs for its correct operation
+   in temporary files, which makes these objects susceptible to loss
+   by garbage collection.  These temporary files have been added as
+   starting points for reachability analysis to fix this.
+   (merge bc7f5db896 pw/gc-during-rebase later to maint).
+
+ * "git cherry-pick" invoked during "git rebase -i" session lost
+   the authorship information, which has been corrected.
+   (merge e4301f73ff vn/rebase-with-cherry-pick-authorship later to maint).
+
+ * The code paths that call repo_read_object_file() have been
+   tightened to react to errors.
+   (merge 568459bf5e js/check-null-from-read-object-file later to maint).
+
+ * Other code cleanup, docfix, build fix, etc.
+   (merge 5aea3955bc rj/clarify-branch-doc-m later to maint).
+   (merge 9cce3be2df bk/bisect-doc-fix later to maint).
+   (merge 8430b438f6 vd/fsck-submodule-url-test later to maint).
+   (merge 3cb4384683 jc/t0091-with-unknown-git later to maint).
+   (merge 020456cb74 rs/receive-pack-remove-find-header later to maint).
+   (merge bc47139f4f la/trailer-cleanups later to maint).
diff --git a/Documentation/RelNotes/2.45.0.txt b/Documentation/RelNotes/2.45.0.txt
new file mode 100644 (file)
index 0000000..903c665
--- /dev/null
@@ -0,0 +1,250 @@
+Git v2.45 Release Notes
+=======================
+
+Backward Compatibility Notes
+
+UI, Workflows & Features
+
+ * Integrate the reftable code into the refs framework as a backend.
+   With "git init --ref-format=reftable", hopefully it would be a lot
+   more efficient to manage a repository with many references.
+
+ * "git checkout -p" and friends learned that that "@" is a synonym
+   for "HEAD".
+
+ * Variants of vimdiff learned to honor mergetool.<variant>.layout
+   settings.
+
+ * "git reflog" learned a "list" subcommand that enumerates known reflogs.
+
+ * When a merge conflicted at a submodule, merge-ort backend used to
+   unconditionally give a lengthy message to suggest how to resolve
+   it.  Now the message can be squelched as an advice message.
+
+ * "git for-each-ref" learned "--include-root-refs" option to show
+   even the stuff outside the 'refs/' hierarchy.
+
+ * "git rev-list --missing=print" has learned to optionally take
+   "--allow-missing-tips", which allows the objects at the starting
+   points to be missing.
+
+ * "git merge-tree" has learned that the three trees involved in the
+   3-way merge only need to be trees, not necessarily commits.
+
+ * "git log --merge" learned to pay attention to CHERRY_PICK_HEAD and
+   other kinds of *_HEAD pseudorefs.
+
+ * Platform specific tweaks for OS/390 has been added to
+   config.mak.uname.
+
+ * Users with safe.bareRepository=explicit can still work from within
+   $GIT_DIR of a seconary worktree (which resides at .git/worktrees/$name/)
+   of the primary worktree without explicitly specifying the $GIT_DIR
+   environment variable or the --git-dir=<path> option.
+
+ * The output format for dates "iso-strict" has been tweaked to show
+   a time in the Zulu timezone with "Z" suffix, instead of "+00:00".
+
+
+Performance, Internal Implementation, Development Support etc.
+
+ * The code to iterate over refs with the reftable backend has seen
+   some optimization.
+
+ * More tests that are marked as "ref-files only" have been updated to
+   improve test coverage of reftable backend.
+
+ * Some parts of command line completion script (in contrib/) have
+   been micro-optimized.
+
+ * The way placeholders are to be marked-up in documentation have been
+   specified; use "_<placeholder>_" to typeset the word inside a pair
+   of <angle-brakets> emphasized.
+
+ * "git --no-lazy-fetch cmd" allows to run "cmd" while disabling lazy
+   fetching of objects from the promisor remote, which may be handy
+   for debugging.
+
+ * The implementation in "git clean" that makes "-n" and "-i" ignore
+   clean.requireForce has been simplified, together with the
+   documentation.
+
+ * The code to iterate over refs with the reftable backend has seen
+   some optimization.
+
+ * Uses of xwrite() helper have been audited and updated for better
+   error checking and simpler code.
+
+ * Some trace2 events that lacked def_param have learned to show it,
+   enriching the output.
+
+ * The parse-options code that deals with abbreviated long option
+   names have been cleaned up.
+
+ * The code in reftable backend that creates new table files works
+   better with the tempfile framework to avoid leaving cruft after a
+   failure.
+
+ * The reftable code has its own custom binary search function whose
+   comparison callback has an unusual interface, which caused the
+   binary search to degenerate into a linear search, which has been
+   corrected.
+
+ * The code to iterate over reflogs in the reftable has been optimized
+   to reduce memory allocation and deallocation.
+
+
+Fixes since v2.44
+-----------------
+
+ * "git apply" on a filesystem without filemode support have learned
+   to take a hint from what is in the index for the path, even when
+   not working with the "--index" or "--cached" option, when checking
+   the executable bit match what is required by the preimage in the
+   patch.
+   (merge 45b625142d cp/apply-core-filemode later to maint).
+
+ * "git column" has been taught to reject negative padding value, as
+   it would lead to nonsense behaviour including division by zero.
+   (merge 76fb807faa kh/column-reject-negative-padding later to maint).
+
+ * "git am --help" now tells readers what actions are available in
+   "git am --whitespace=<action>", in addition to saying that the
+   option is passed through to the underlying "git apply".
+   (merge a171dac734 jc/am-whitespace-doc later to maint).
+
+ * "git tag --column" failed to check the exit status of its "git
+   column" invocation, which has been corrected.
+   (merge 92e66478fc rj/tag-column-fix later to maint).
+
+ * Credential helper based on libsecret (in contrib/) has been updated
+   to handle an empty password correctly.
+   (merge 8f1f2023b7 mh/libsecret-empty-password-fix later to maint).
+
+ * "git difftool --dir-diff" learned to honor the "--trust-exit-code"
+   option; it used to always exit with 0 and signalled success.
+   (merge eb84c8b6ce ps/difftool-dir-diff-exit-code later to maint).
+
+ * The code incorrectly attempted to use textconv cache when asked,
+   even when we are not running in a repository, which has been
+   corrected.
+   (merge affe355fe7 jk/textconv-cache-outside-repo-fix later to maint).
+
+ * Remove an empty file that shouldn't have been added in the first
+   place.
+   (merge 4f66942215 js/remove-cruft-files later to maint).
+
+ * The logic to access reflog entries by date and number had ugly
+   corner cases at the boundaries, which have been cleaned up.
+   (merge 5edd126720 jk/reflog-special-cases-fix later to maint).
+
+ * An error message from "git upload-pack", which responds to "git
+   fetch" requests, had a trialing NUL in it, which has been
+   corrected.
+   (merge 3f4c7a0805 sg/upload-pack-error-message-fix later to maint).
+
+ * Clarify wording in the CodingGuidelines that requires <git-compat-util.h>
+   to be the first header file.
+   (merge 4e89f0e07c jc/doc-compat-util later to maint).
+
+ * "git commit -v --cleanup=scissors" used to add the scissors line
+   twice in the log message buffer, which has been corrected.
+   (merge e90cc075cc jt/commit-redundant-scissors-fix later to maint).
+
+ * A custom remote helper no longer cannot access the newly created
+   repository during "git clone", which is a regression in Git 2.44.
+   This has been corrected.
+   (merge 199f44cb2e ps/remote-helper-repo-initialization-fix later to maint).
+
+ * Various parts of upload-pack has been updated to bound the resource
+   consumption relative to the size of the repository to protect from
+   abusive clients.
+   (merge 6cd05e768b jk/upload-pack-bounded-resources later to maint).
+
+ * The upload-pack program, when talking over v2, accepted the
+   packfile-uris protocol extension from the client, even if it did
+   not advertise the capability, which has been corrected.
+   (merge a922bfa3b5 jk/upload-pack-v2-capability-cleanup later to maint).
+
+ * Make sure failure return from merge_bases_many() is properly caught.
+   (merge 25fd20eb44 js/merge-base-with-missing-commit later to maint).
+
+ * FSMonitor client code was confused when FSEvents were given in a
+   different case on a case-insensitive filesystem, which has been
+   corrected.
+   (merge 29c139ce78 jh/fsmonitor-icase-corner-case-fix later to maint).
+
+ * The "core.commentChar" configuration variable only allows an ASCII
+   character, which was not clearly documented, which has been
+   corrected.
+   (merge fb7c556f58 kh/doc-commentchar-is-a-byte later to maint).
+
+ * With release 2.44 we got rid of all uses of test_i18ngrep and there
+   is no in-flight topic that adds a new use of it.  Make a call to
+   test_i18ngrep a hard failure, so that we can remove it at the end
+   of this release cycle.
+   (merge 381a83dfa3 jc/test-i18ngrep later to maint).
+
+ * The command line completion script (in contrib/) learned to
+   complete "git reflog" better.
+   (merge 1284f9cc11 rj/complete-reflog later to maint).
+
+ * The logic to complete the command line arguments to "git worktree"
+   subcommand (in contrib/) has been updated to correctly honor things
+   like "git -C dir" etc.
+   (merge 3574816d98 rj/complete-worktree-paths-fix later to maint).
+
+ * When git refuses to create a branch because the proposed branch
+   name is not a valid refname, an advice message is given to refer
+   the user to exact naming rules.
+   (merge 8fbd903e58 kh/branch-ref-syntax-advice later to maint).
+
+ * Code simplification by getting rid of code that sets an environment
+   variable that is no longer used.
+   (merge 72a8d3f027 pw/rebase-i-ignore-cherry-pick-help-environment later to maint).
+
+ * The code to find the effective end of log message can fall into an
+   endless loop, which has been corrected.
+   (merge 2541cba2d6 fs/find-end-of-log-message-fix later to maint).
+
+ * Mark-ups used in the documentation has been improved for
+   consistency.
+   (merge 45d5ed3e50 ja/doc-markup-fixes later to maint).
+
+ * The status.showUntrackedFiles configuration variable was
+   incorrectly documented to accept "false", which has been corrected.
+
+ * Leaks from "git restore" have been plugged.
+   (merge 2f64da0790 rj/restore-plug-leaks later to maint).
+
+ * "git bugreport --no-suffix" was not supported and instead
+   segfaulted, which has been corrected.
+   (merge b3b57c69da js/bugreport-no-suffix-fix later to maint).
+
+ * The documentation for "%(trailers[:options])" placeholder in the
+   "--pretty" option of commands in the "git log" family has been
+   updated.
+   (merge bff85a338c bl/doc-key-val-sep-fix later to maint).
+
+ * Other code cleanup, docfix, build fix, etc.
+   (merge f0e578c69c rs/use-xstrncmpz later to maint).
+   (merge 83e6eb7d7a ba/credential-test-clean-fix later to maint).
+   (merge 64562d784d jb/doc-interactive-singlekey-do-not-need-perl later to maint).
+   (merge c431a235e2 cp/t9146-use-test-path-helpers later to maint).
+   (merge 82d75402d5 ds/doc-send-email-capitalization later to maint).
+   (merge 41bff66e35 jc/doc-add-placeholder-fix later to maint).
+   (merge 6835f0efe9 jw/remote-doc-typofix later to maint).
+   (merge 244001aa20 hs/rebase-not-in-progress later to maint).
+   (merge 2ca6c07db2 jc/no-include-of-compat-util-from-headers later to maint).
+   (merge 87bd7fbb9c rs/fetch-simplify-with-starts-with later to maint).
+   (merge f39addd0d9 rs/name-rev-with-mempool later to maint).
+   (merge 9a97b43e03 rs/submodule-prefix-simplify later to maint).
+   (merge 40b8076462 ak/rebase-autosquash later to maint).
+   (merge 3223204456 eg/add-uflags later to maint).
+   (merge 5f78d52dce es/config-doc-sort-sections later to maint).
+   (merge 781fb7b4c2 as/option-names-in-messages later to maint).
+   (merge 51d41dc243 jk/doc-remote-helpers-markup-fix later to maint).
+   (merge e1aaf309db pb/ci-win-artifact-names-fix later to maint).
+   (merge ad538c61da jc/index-pack-fsck-levels later to maint).
+   (merge 67471bc704 ja/doc-formatting-fix later to maint).
+   (merge 86f9ce7dd6 bl/doc-config-fixes later to maint).
index 0e323d54779a7c680ee8471330c85609f4644d43..515d470d23c1f178a60a2ea7734ba8930da42cba 100644 (file)
@@ -19,7 +19,7 @@ Principles
 Selecting patch(es) to review
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 If you are looking for a patch series in need of review, start by checking
-latest "What's cooking in git.git" email
+the latest "What's cooking in git.git" email
 (https://lore.kernel.org/git/xmqqilm1yp3m.fsf@gitster.g/[example]). The "What's
 cooking" emails & replies can be found using the query `s:"What's cooking"` on
 the https://lore.kernel.org/git/[`lore.kernel.org` mailing list archive];
@@ -126,7 +126,7 @@ Terminology
 -----------
 nit: ::
        Denotes a small issue that should be fixed, such as a typographical error
-       or mis-alignment of conditions in an `if()` statement.
+       or misalignment of conditions in an `if()` statement.
 
 aside: ::
 optional: ::
index 973d7a81d4492d627c77ce3c6db105ae917fb957..e734a3f0f175795f0633e93c07afd13f9183efc8 100644 (file)
@@ -87,7 +87,7 @@ maintainer.
 Under truly exceptional circumstances where you absolutely must depend
 on a select few topic branches that are already in `next` but not in
 `master`, you may want to create your own custom base-branch by forking
-`master` and merging the required topic branches to it. You could then
+`master` and merging the required topic branches into it. You could then
 work on top of this base-branch.  But keep in mind that this base-branch
 would only be known privately to you.  So when you are ready to send
 your patches to the list, be sure to communicate how you created it in
@@ -266,7 +266,7 @@ date)", like this:
        noticed that ...
 ....
 
-The "Copy commit summary" command of gitk can be used to obtain this
+The "Copy commit reference" command of gitk can be used to obtain this
 format (with the subject enclosed in a pair of double-quotes), or this
 invocation of `git show`:
 
@@ -355,9 +355,21 @@ If you like, you can put extra tags at the end:
   patch after a detailed analysis.
 . `Tested-by:` is used to indicate that the person applied the patch
   and found it to have the desired effect.
-
-You can also create your own tag or use one that's in common usage
-such as "Thanks-to:", "Based-on-patch-by:", or "Mentored-by:".
+. `Co-authored-by:` is used to indicate that people exchanged drafts
+   of a patch before submitting it.
+. `Helped-by:` is used to credit someone who suggested ideas for
+  changes without providing the precise changes in patch form.
+. `Mentored-by:` is used to credit someone with helping develop a
+  patch as part of a mentorship program (e.g., GSoC or Outreachy).
+. `Suggested-by:` is used to credit someone with suggesting the idea
+  for a patch.
+
+While you can also create your own trailer if the situation warrants it, we
+encourage you to instead use one of the common trailers in this project
+highlighted above.
+
+Only capitalize the very first letter of tags, i.e. favor
+"Signed-off-by" over "Signed-Off-By" and "Acked-by:" over "Acked-By".
 
 [[git-tools]]
 === Generate your patch using Git tools out of your commits.
@@ -393,8 +405,8 @@ mailing list{security-ml}, instead of the public mailing list.
 
 Learn to use format-patch and send-email if possible.  These commands
 are optimized for the workflow of sending patches, avoiding many ways
-your existing e-mail client that is optimized for "multipart/*" mime
-type e-mails to corrupt and render your patches unusable.
+your existing e-mail client (often optimized for "multipart/*" MIME
+type e-mails) might render your patches unusable.
 
 People on the Git mailing list need to be able to read and
 comment on the changes you are submitting.  It is important for
@@ -515,8 +527,8 @@ repositories.
 
        git://git.ozlabs.org/~paulus/gitk
 
-   Those who are interested in improve gitk can volunteer to help Paul
-   in maintaining it cf. <YntxL/fTplFm8lr6@cleo>.
+   Those who are interested in improving gitk can volunteer to help Paul
+   maintain it, cf. <YntxL/fTplFm8lr6@cleo>.
 
 - `po/` comes from the localization coordinator, Jiang Xin:
 
@@ -556,7 +568,7 @@ help you find out who they are.
 
 In any time between the (2)-(3) cycle, the maintainer may pick it up
 from the list and queue it to `seen`, in order to make it easier for
-people play with it without having to pick up and apply the patch to
+people to play with it without having to pick up and apply the patch to
 their trees themselves.
 
 [[patch-status]]
@@ -570,7 +582,7 @@ their trees themselves.
   master).
 
 * Read the Git mailing list, the maintainer regularly posts messages
-  entitled "What's cooking in git.git" and "What's in git.git" giving
+  entitled "What's cooking in git.git" giving
   the status of various proposed changes.
 
 == GitHub CI[[GHCI]]
@@ -590,11 +602,12 @@ After the initial setup, CI will run whenever you push new changes
 to your fork of Git on GitHub.  You can monitor the test state of all your
 branches here: `https://github.com/<Your GitHub handle>/git/actions/workflows/main.yml`
 
-If a branch did not pass all test cases then it is marked with a red
-cross. In that case you can click on the failing job and navigate to
-"ci/run-build-and-tests.sh" and/or "ci/print-test-failures.sh". You
-can also download "Artifacts" which are tarred (or zipped) archives
-with test data relevant for debugging.
+If a branch does not pass all test cases then it will be marked with a
+red +x+, instead of a green check. In that case, you can click on the
+failing job and navigate to "ci/run-build-and-tests.sh" and/or
+"ci/print-test-failures.sh". You can also download "Artifacts" which
+are zip archives containing tarred (or zipped) archives with test data
+relevant for debugging.
 
 Then fix the problem and push your fix to your GitHub fork. This will
 trigger a new CI build to ensure all tests pass.
@@ -686,7 +699,7 @@ message to an external program, and this is a handy way to drive
 `git am`.  However, if the message is MIME encoded, what is
 piped into the program is the representation you see in your
 `*Article*` buffer after unwrapping MIME.  This is often not what
-you would want for two reasons.  It tends to screw up non ASCII
+you would want for two reasons.  It tends to screw up non-ASCII
 characters (most notably in people's names), and also
 whitespaces (fatal in patches).  Running "C-u g" to display the
 message in raw form before using "|" to run the pipe can work
index 5060d0d2314c316364b7579236a1c2572c62ba64..ae7690b45d08b3c3ba9775d17d43d0f658a71360 100644 (file)
@@ -5,7 +5,7 @@ Tools for developing Git
 [[summary]]
 == Summary
 
-This document gathers tips, scripts and configuration file to help people
+This document gathers tips, scripts, and configuration files to help people
 working on Git's codebase use their favorite tools while following Git's
 coding style.
 
@@ -32,7 +32,7 @@ information on using the script.
 
 This is adapted from Linux's suggestion in its CodingStyle document:
 
-- To follow rules of the CodingGuideline, it's useful to put the following in
+- To follow the rules in CodingGuidelines, it's useful to put the following in
 GIT_CHECKOUT/.dir-locals.el, assuming you use cperl-mode:
 ----
 ;; note the first part is useful for C editing, too
index 229b63a454c035dcd6fa6797b29788ae67c053a4..782c2bab906cf188e3cb21fa6d9fa8c4fe78663d 100644 (file)
@@ -11,7 +11,7 @@ file. The file `/etc/gitconfig` can be used to store a system-wide
 default configuration.
 
 The configuration variables are used by both the Git plumbing
-and the porcelains. The variables are divided into sections, wherein
+and the porcelain commands. The variables are divided into sections, wherein
 the fully qualified variable name of the variable itself is the last
 dot-separated segment and the section name is everything before the last
 dot. The variable names are case-insensitive, allow only alphanumeric
@@ -103,7 +103,7 @@ was found.  See below for examples.
 Conditional includes
 ~~~~~~~~~~~~~~~~~~~~
 
-You can include a config file from another conditionally by setting a
+You can conditionally include a config file from another by setting an
 `includeIf.<condition>.path` variable to the name of the file to be
 included.
 
@@ -118,7 +118,7 @@ are:
        pattern, the include condition is met.
 +
 The .git location may be auto-discovered, or come from `$GIT_DIR`
-environment variable. If the repository is auto discovered via a .git
+environment variable. If the repository is auto-discovered via a .git
 file (e.g. from submodules, or a linked worktree), the .git location
 would be the final location where the .git directory is, not where the
 .git file is.
@@ -369,18 +369,18 @@ inventing new variables for use in your own tool, make sure their
 names do not conflict with those that are used by Git itself and
 other popular tools, and describe them in your documentation.
 
-include::config/advice.txt[]
-
-include::config/core.txt[]
-
 include::config/add.txt[]
 
+include::config/advice.txt[]
+
 include::config/alias.txt[]
 
 include::config/am.txt[]
 
 include::config/apply.txt[]
 
+include::config/attr.txt[]
+
 include::config/blame.txt[]
 
 include::config/branch.txt[]
@@ -403,10 +403,12 @@ include::config/commit.txt[]
 
 include::config/commitgraph.txt[]
 
-include::config/credential.txt[]
-
 include::config/completion.txt[]
 
+include::config/core.txt[]
+
+include::config/credential.txt[]
+
 include::config/diff.txt[]
 
 include::config/difftool.txt[]
@@ -419,10 +421,10 @@ include::config/feature.txt[]
 
 include::config/fetch.txt[]
 
-include::config/format.txt[]
-
 include::config/filter.txt[]
 
+include::config/format.txt[]
+
 include::config/fsck.txt[]
 
 include::config/fsmonitor--daemon.txt[]
@@ -433,10 +435,10 @@ include::config/gitcvs.txt[]
 
 include::config/gitweb.txt[]
 
-include::config/grep.txt[]
-
 include::config/gpg.txt[]
 
+include::config/grep.txt[]
+
 include::config/gui.txt[]
 
 include::config/guitool.txt[]
@@ -517,10 +519,10 @@ include::config/splitindex.txt[]
 
 include::config/ssh.txt[]
 
-include::config/status.txt[]
-
 include::config/stash.txt[]
 
+include::config/status.txt[]
+
 include::config/submodule.txt[]
 
 include::config/tag.txt[]
index c548a91e6761c762b19f26e2bb1f5a36f8192ba9..f83341165367baac4f02779eedf432822644e615 100644 (file)
@@ -1,30 +1,63 @@
 advice.*::
        These variables control various optional help messages designed to
-       aid new users. All 'advice.*' variables default to 'true', and you
-       can tell Git that you do not need help by setting these to 'false':
+       aid new users.  When left unconfigured, Git will give the message
+       alongside instructions on how to squelch it.  You can tell Git
+       that you do not need the help message by setting these to `false`:
 +
 --
+       addEmbeddedRepo::
+               Shown when the user accidentally adds one
+               git repo inside of another.
+       addEmptyPathspec::
+               Shown when the user runs `git add` without providing
+               the pathspec parameter.
+       addIgnoredFile::
+               Shown when the user attempts to add an ignored file to
+               the index.
+       amWorkDir::
+               Shown when linkgit:git-am[1] fails to apply a patch
+               file, to tell the user the location of the file.
        ambiguousFetchRefspec::
-               Advice shown when fetch refspec for multiple remotes map to
+               Shown when a fetch refspec for multiple remotes maps to
                the same remote-tracking branch namespace and causes branch
                tracking set-up to fail.
+       checkoutAmbiguousRemoteBranchName::
+               Shown when the argument to
+               linkgit:git-checkout[1] and linkgit:git-switch[1]
+               ambiguously resolves to a
+               remote tracking branch on more than one remote in
+               situations where an unambiguous argument would have
+               otherwise caused a remote-tracking branch to be
+               checked out. See the `checkout.defaultRemote`
+               configuration variable for how to set a given remote
+               to be used by default in some situations where this
+               advice would be printed.
+       commitBeforeMerge::
+               Shown when linkgit:git-merge[1] refuses to
+               merge to avoid overwriting local changes.
+       detachedHead::
+               Shown when the user uses
+               linkgit:git-switch[1] or linkgit:git-checkout[1]
+               to move to the detached HEAD state, to tell the user how
+               to create a local branch after the fact.
+       diverging::
+               Shown when a fast-forward is not possible.
        fetchShowForcedUpdates::
-               Advice shown when linkgit:git-fetch[1] takes a long time
+               Shown when linkgit:git-fetch[1] takes a long time
                to calculate forced updates after ref updates, or to warn
                that the check is disabled.
-       pushUpdateRejected::
-               Set this variable to 'false' if you want to disable
-               'pushNonFFCurrent', 'pushNonFFMatching', 'pushAlreadyExists',
-               'pushFetchFirst', 'pushNeedsForce', and 'pushRefNeedsUpdate'
-               simultaneously.
-       pushNonFFCurrent::
-               Advice shown when linkgit:git-push[1] fails due to a
-               non-fast-forward update to the current branch.
-       pushNonFFMatching::
-               Advice shown when you ran linkgit:git-push[1] and pushed
-               'matching refs' explicitly (i.e. you used ':', or
-               specified a refspec that isn't your current branch) and
-               it resulted in a non-fast-forward error.
+       forceDeleteBranch::
+               Shown when the user tries to delete a not fully merged
+               branch without the force option set.
+       ignoredHook::
+               Shown when a hook is ignored because the hook is not
+               set as executable.
+       implicitIdentity::
+               Shown when the user's information is guessed from the
+               system username and domain name, to tell the user how to
+               set their identity configuration.
+       nestedTag::
+               Shown when a user attempts to recursively tag a tag object.
        pushAlreadyExists::
                Shown when linkgit:git-push[1] rejects an update that
                does not qualify for fast-forwarding (e.g., a tag.)
@@ -37,17 +70,45 @@ advice.*::
                tries to overwrite a remote ref that points at an
                object that is not a commit-ish, or make the remote
                ref point at an object that is not a commit-ish.
+       pushNonFFCurrent::
+               Shown when linkgit:git-push[1] fails due to a
+               non-fast-forward update to the current branch.
+       pushNonFFMatching::
+               Shown when the user ran linkgit:git-push[1] and pushed
+               "matching refs" explicitly (i.e. used `:`, or
+               specified a refspec that isn't the current branch) and
+               it resulted in a non-fast-forward error.
+       pushRefNeedsUpdate::
+               Shown when linkgit:git-push[1] rejects a forced update of
+               a branch when its remote-tracking ref has updates that we
+               do not have locally.
        pushUnqualifiedRefname::
                Shown when linkgit:git-push[1] gives up trying to
                guess based on the source and destination refs what
                remote ref namespace the source belongs in, but where
                we can still suggest that the user push to either
-               refs/heads/* or refs/tags/* based on the type of the
+               `refs/heads/*` or `refs/tags/*` based on the type of the
                source object.
-       pushRefNeedsUpdate::
-               Shown when linkgit:git-push[1] rejects a forced update of
-               a branch when its remote-tracking ref has updates that we
-               do not have locally.
+       pushUpdateRejected::
+               Set this variable to `false` if you want to disable
+               `pushNonFFCurrent`, `pushNonFFMatching`, `pushAlreadyExists`,
+               `pushFetchFirst`, `pushNeedsForce`, and `pushRefNeedsUpdate`
+               simultaneously.
+       refSyntax::
+               Shown when the user provides an illegal ref name, to
+               tell the user about the ref syntax documentation.
+       resetNoRefresh::
+               Shown when linkgit:git-reset[1] takes more than 2
+               seconds to refresh the index after reset, to tell the user
+               that they can use the `--no-refresh` option.
+       resolveConflict::
+               Shown by various commands when conflicts
+               prevent the operation from being performed.
+       rmHints::
+               Shown on failure in the output of linkgit:git-rm[1], to
+               give directions on how to proceed from the current state.
+       sequencerInUse::
+               Shown when a sequencer command is already in progress.
        skippedCherryPicks::
                Shown when linkgit:git-rebase[1] skips a commit that has already
                been cherry-picked onto the upstream branch.
@@ -63,83 +124,32 @@ advice.*::
                the template shown when writing commit messages in
                linkgit:git-commit[1], and in the help message shown
                by linkgit:git-switch[1] or
-               linkgit:git-checkout[1] when switching branch.
+               linkgit:git-checkout[1] when switching branches.
        statusUoption::
-               Advise to consider using the `-u` option to linkgit:git-status[1]
-               when the command takes more than 2 seconds to enumerate untracked
-               files.
-       commitBeforeMerge::
-               Advice shown when linkgit:git-merge[1] refuses to
-               merge to avoid overwriting local changes.
-       resetNoRefresh::
-               Advice to consider using the `--no-refresh` option to
-               linkgit:git-reset[1] when the command takes more than 2 seconds
-               to refresh the index after reset.
-       resolveConflict::
-               Advice shown by various commands when conflicts
-               prevent the operation from being performed.
-       sequencerInUse::
-               Advice shown when a sequencer command is already in progress.
-       implicitIdentity::
-               Advice on how to set your identity configuration when
-               your information is guessed from the system username and
-               domain name.
-       detachedHead::
-               Advice shown when you used
-               linkgit:git-switch[1] or linkgit:git-checkout[1]
-               to move to the detach HEAD state, to instruct how to
-               create a local branch after the fact.
-       suggestDetachingHead::
-               Advice shown when linkgit:git-switch[1] refuses to detach HEAD
-               without the explicit `--detach` option.
-       checkoutAmbiguousRemoteBranchName::
-               Advice shown when the argument to
-               linkgit:git-checkout[1] and linkgit:git-switch[1]
-               ambiguously resolves to a
-               remote tracking branch on more than one remote in
-               situations where an unambiguous argument would have
-               otherwise caused a remote-tracking branch to be
-               checked out. See the `checkout.defaultRemote`
-               configuration variable for how to set a given remote
-               to used by default in some situations where this
-               advice would be printed.
-       amWorkDir::
-               Advice that shows the location of the patch file when
-               linkgit:git-am[1] fails to apply it.
-       rmHints::
-               In case of failure in the output of linkgit:git-rm[1],
-               show directions on how to proceed from the current state.
-       addEmbeddedRepo::
-               Advice on what to do when you've accidentally added one
-               git repo inside of another.
-       ignoredHook::
-               Advice shown if a hook is ignored because the hook is not
-               set as executable.
-       waitingForEditor::
-               Print a message to the terminal whenever Git is waiting for
-               editor input from the user.
-       nestedTag::
-               Advice shown if a user attempts to recursively tag a tag object.
+               Shown when linkgit:git-status[1] takes more than 2
+               seconds to enumerate untracked files, to tell the user that
+               they can use the `-u` option.
        submoduleAlternateErrorStrategyDie::
-               Advice shown when a submodule.alternateErrorStrategy option
+               Shown when a submodule.alternateErrorStrategy option
                configured to "die" causes a fatal error.
+       submoduleMergeConflict::
+               Advice shown when a non-trivial submodule merge conflict is
+               encountered.
        submodulesNotUpdated::
-               Advice shown when a user runs a submodule command that fails
+               Shown when a user runs a submodule command that fails
                because `git submodule update --init` was not run.
-       addIgnoredFile::
-               Advice shown if a user attempts to add an ignored file to
-               the index.
-       addEmptyPathspec::
-               Advice shown if a user runs the add command without providing
-               the pathspec parameter.
+       suggestDetachingHead::
+               Shown when linkgit:git-switch[1] refuses to detach HEAD
+               without the explicit `--detach` option.
        updateSparsePath::
-               Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1]
+               Shown when either linkgit:git-add[1] or linkgit:git-rm[1]
                is asked to update index entries outside the current sparse
                checkout.
-       diverging::
-               Advice shown when a fast-forward is not possible.
+       waitingForEditor::
+               Shown when Git is waiting for editor input. Relevant
+               when e.g. the editor is not launched inside the terminal.
        worktreeAddOrphan::
-               Advice shown when a user tries to create a worktree from an
-               invalid reference, to instruct how to create a new orphan
+               Shown when the user tries to create a worktree from an
+               invalid reference, to tell the user how to create a new unborn
                branch instead.
 --
index f1ca739d574293fd001322a2cc272e2cc0510344..01df96fab3df11f1c804e26ed7c312cd7490e2fd 100644 (file)
@@ -4,7 +4,7 @@ alias.*::
        `git last` is equivalent to `git cat-file commit HEAD`. To avoid
        confusion and troubles with script usage, aliases that
        hide existing Git commands are ignored. Arguments are split by
-       spaces, the usual shell quoting and escaping is supported.
+       spaces, the usual shell quoting and escaping are supported.
        A quote pair or a backslash can be used to quote them.
 +
 Note that the first word of an alias does not necessarily have to be a
index 8fb8ef763dfdf2475af3addafa3cefd7d859ad8a..f9908e210a838dfaf78315b1ce146655a7cf19ca 100644 (file)
@@ -2,10 +2,10 @@ apply.ignoreWhitespace::
        When set to 'change', tells 'git apply' to ignore changes in
        whitespace, in the same way as the `--ignore-space-change`
        option.
-       When set to one of: no, none, never, false tells 'git apply' to
+       When set to one of: no, none, never, false, it tells 'git apply' to
        respect all whitespace differences.
        See linkgit:git-apply[1].
 
 apply.whitespace::
-       Tells 'git apply' how to handle whitespaces, in the same way
+       Tells 'git apply' how to handle whitespace, in the same way
        as the `--whitespace` option. See linkgit:git-apply[1].
diff --git a/Documentation/config/attr.txt b/Documentation/config/attr.txt
new file mode 100644 (file)
index 0000000..1a482d6
--- /dev/null
@@ -0,0 +1,7 @@
+attr.tree::
+       A reference to a tree in the repository from which to read attributes,
+       instead of the `.gitattributes` file in the working tree. In a bare
+       repository, this defaults to `HEAD:.gitattributes`. If the value does
+       not resolve to a valid tree object, an empty tree is used instead.
+       When the `GIT_ATTR_SOURCE` environment variable or `--attr-source`
+       command line option are used, this configuration variable has no effect.
index 445341a906b241ab1ed11093b1b0fa908e0954da..432b9cd2c0e66721c135a14bd4e3f09dee6bcc92 100644 (file)
@@ -36,7 +36,7 @@ branch.sort::
 
 branch.<name>.remote::
        When on branch <name>, it tells 'git fetch' and 'git push'
-       which remote to fetch from/push to.  The remote to push to
+       which remote to fetch from or push to.  The remote to push to
        may be overridden with `remote.pushDefault` (for all branches).
        The remote to push to, for the current branch, may be further
        overridden by `branch.<name>.pushRemote`.  If no remote is
@@ -64,7 +64,7 @@ branch.<name>.merge::
        handled like the remote part of a refspec, and must match a
        ref which is fetched from the remote given by
        "branch.<name>.remote".
-       The merge information is used by 'git pull' (which at first calls
+       The merge information is used by 'git pull' (which first calls
        'git fetch') to lookup the default branch for merging. Without
        this option, 'git pull' defaults to merge the first refspec fetched.
        Specify multiple values to get an octopus merge.
@@ -99,5 +99,5 @@ for details).
 branch.<name>.description::
        Branch description, can be edited with
        `git branch --edit-description`. Branch description is
-       automatically added in the format-patch cover letter or
+       automatically added to the format-patch cover letter or
        request-pull summary.
index bfbca90f0e90bdcac2fb814ab90c74d2d7f1b0d7..a3230229938055323ead98e6d6bdfd032b911b1b 100644 (file)
@@ -30,7 +30,7 @@ checkout.workers::
        all commands that perform checkout. E.g. checkout, clone, reset,
        sparse-checkout, etc.
 +
-Note: parallel checkout usually delivers better performance for repositories
+Note: Parallel checkout usually delivers better performance for repositories
 located on SSDs or over NFS. For repositories on spinning disks and/or machines
 with a small number of cores, the default sequential checkout often performs
 better. The size and compression level of a repository might also influence how
@@ -39,6 +39,6 @@ well the parallel version performs.
 checkout.thresholdForParallelism::
        When running parallel checkout with a small number of files, the cost
        of subprocess spawning and inter-process communication might outweigh
-       the parallelization gains. This setting allows to define the minimum
+       the parallelization gains. This setting allows you to define the minimum
        number of files for which parallel checkout should be attempted. The
        default is 100.
index a807c925b9ca8ce4ca783fe2880ec986ef0d5b83..c0188ead4e6cd8b2b38a5feecb20c24897e03161 100644 (file)
@@ -1,3 +1,3 @@
 clean.requireForce::
-       A boolean to make git-clean do nothing unless given -f,
-       -i or -n.   Defaults to true.
+       A boolean to make git-clean refuse to delete files unless -f
+       is given. Defaults to true.
index 26f4fb137a738ead96e0a9848df9a383aa432305..d037b57f729e5e10549235b6278c123754d0aee8 100644 (file)
@@ -4,8 +4,8 @@ clone.defaultRemoteName::
        option to linkgit:git-clone[1].
 
 clone.rejectShallow::
-       Reject to clone a repository if it is a shallow one, can be overridden by
-       passing option `--reject-shallow` in command line. See linkgit:git-clone[1]
+       Reject cloning a repository if it is a shallow one; this can be overridden by
+       passing the `--reject-shallow` option on the command line. See linkgit:git-clone[1]
 
 clone.filterSubmodules::
        If a partial clone filter is provided (see `--filter` in
index 1795b2d16be2f01ba10ecfd6a2128444b99a85ec..2f2275ac6975f2a47cafc719d886e2f2b8c71a71 100644 (file)
@@ -106,7 +106,7 @@ color.grep.<slot>::
        matching text in context lines
 `matchSelected`;;
        matching text in selected lines. Also, used to customize the following
-       linkgit:git-log[1] subcommands: `--grep`, `--author` and `--committer`.
+       linkgit:git-log[1] subcommands: `--grep`, `--author`, and `--committer`.
 `selected`;;
        non-matching text in selected lines. Also, used to customize the
        following linkgit:git-log[1] subcommands: `--grep`, `--author` and
index 76aa2f29dc2108fa20d575c4bc49791bc9c02c96..01e4198429ed46c96b7e25a70ed7b58c4844a29a 100644 (file)
@@ -43,7 +43,7 @@ column.branch::
        See `column.ui` for details.
 
 column.clean::
-       Specify the layout when list items in `git clean -i`, which always
+       Specify the layout when listing items in `git clean -i`, which always
        shows files and directories in columns. See `column.ui` for details.
 
 column.status::
@@ -51,5 +51,5 @@ column.status::
        See `column.ui` for details.
 
 column.tag::
-       Specify whether to output tag listing in `git tag` in columns.
+       Specify whether to output tag listings in `git tag` in columns.
        See `column.ui` for details.
index 2c95573930bedf8d5aed0a0b19927c73ac8e39f7..62f0d92fda51de04a75b4fc074befaa96c554851 100644 (file)
@@ -2,7 +2,7 @@ commit.cleanup::
        This setting overrides the default of the `--cleanup` option in
        `git commit`. See linkgit:git-commit[1] for details. Changing the
        default can be useful when you always want to keep lines that begin
-       with comment character `#` in your log message, in which case you
+       with the comment character `#` in your log message, in which case you
        would do `git config commit.cleanup whitespace` (note that you will
        have to remove the help lines that begin with `#` in the commit log
        template yourself, if you do this).
@@ -25,5 +25,5 @@ commit.template::
        new commit messages.
 
 commit.verbose::
-       A boolean or int to specify the level of verbose with `git commit`.
+       A boolean or int to specify the level of verbosity with `git commit`.
        See linkgit:git-commit[1].
index dfbdaf00b8bc2239e7e106c8b78a2dd90d44ac9b..2d4bbdb25fa3104bf5151ca98be42f0b4c438b2a 100644 (file)
@@ -521,7 +521,7 @@ core.editor::
 
 core.commentChar::
        Commands such as `commit` and `tag` that let you edit
-       messages consider a line that begins with this character
+       messages consider a line that begins with this ASCII character
        commented, and removes them after the editor returns
        (default '#').
 +
@@ -736,3 +736,9 @@ core.abbrev::
        If set to "no", no abbreviation is made and the object names
        are shown in their full length.
        The minimum length is 4.
+
+core.maxTreeDepth::
+       The maximum depth Git is willing to recurse while traversing a
+       tree (e.g., "a/b/cde/f" has a depth of 4). This is a fail-safe
+       to allow Git to abort cleanly, and should not generally need to
+       be adjusted. The default is 4096.
index 512f31876e17ed6892ff7f1858a891f0f7938b29..0221c3e620da89abb62f26110f400ecb0d6ff71a 100644 (file)
@@ -21,7 +21,7 @@ credential.username::
 
 credential.<url>.*::
        Any of the credential.* options above can be applied selectively to
-       some credentials. For example "credential.https://example.com.username"
+       some credentials. For example, "credential.https://example.com.username"
        would set the default username only for https connections to
        example.com. See linkgit:gitcredentials[7] for details on how URLs are
        matched.
@@ -31,6 +31,6 @@ credentialCache.ignoreSIGHUP::
 
 credentialStore.lockTimeoutMS::
        The length of time, in milliseconds, for git-credential-store to retry
-       when trying to lock the credentials file. Value 0 means not to retry at
+       when trying to lock the credentials file. A value of 0 means not to retry at
        all; -1 means to try indefinitely. Default is 1000 (i.e., retry for
        1s).
index 35a7bf86d7774c67dbd129cc29b009aae46c81a9..6c7e09a1ef5eb481b2abb26abd93edf38806cf76 100644 (file)
@@ -1,6 +1,6 @@
 diff.autoRefreshIndex::
        When using 'git diff' to compare with work tree
-       files, do not consider stat-only change as changed.
+       files, do not consider stat-only changes as changed.
        Instead, silently run `git update-index --refresh` to
        update the cached stat information for paths whose
        contents in the work tree match the contents in the
@@ -52,6 +52,10 @@ directories with less than 10% of the total amount of changed files,
 and accumulating child directory counts in the parent directories:
 `files,10,cumulative`.
 
+diff.statNameWidth::
+       Limit the width of the filename part in --stat output. If set, applies
+       to all commands generating --stat output except format-patch.
+
 diff.statGraphWidth::
        Limit the width of the graph part in --stat output. If set, applies
        to all commands generating --stat output except format-patch.
@@ -219,5 +223,5 @@ diff.colorMoved::
 
 diff.colorMovedWS::
        When moved lines are colored using e.g. the `diff.colorMoved` setting,
-       this option controls the `<mode>` how spaces are treated
-       for details of valid modes see '--color-moved-ws' in linkgit:git-diff[1].
+       this option controls the `<mode>` how spaces are treated.
+       For details of valid modes see '--color-moved-ws' in linkgit:git-diff[1].
index 9f72e6d9f4f17ec68a93c803e1dabfc98d3b61be..38dce3df359761b54dca8afcb13f77e1919de098 100644 (file)
@@ -19,6 +19,17 @@ extensions.compatObjectFormat::
        compatObjectFormat in addition to oids encoded with objectFormat to
        locally specify objects.
 
+extensions.refStorage::
+       Specify the ref storage format to use. The acceptable values are:
++
+include::../ref-storage-format.txt[]
++
+It is an error to specify this key unless `core.repositoryFormatVersion` is 1.
++
+Note that this setting should only be set by linkgit:git-init[1] or
+linkgit:git-clone[1]. Trying to change it after initialization will not
+work and will produce hard-to-diagnose issues.
+
 extensions.worktreeConfig::
        If enabled, then worktrees will load config settings from the
        `$GIT_DIR/config.worktree` file in addition to the
index c1166e330d55da332d4fa591b4083f86f2adb606..903677d7efefa03d607c9b076ac1a7bf14304105 100644 (file)
@@ -1,8 +1,8 @@
 fastimport.unpackLimit::
        If the number of objects imported by linkgit:git-fast-import[1]
        is below this limit, then the objects will be unpacked into
-       loose object files.  However if the number of imported objects
-       equals or exceeds this limit then the pack will be stored as a
+       loose object files.  However, if the number of imported objects
+       equals or exceeds this limit, then the pack will be stored as a
        pack.  Storing the pack from a fast-import can make the import
        operation complete faster, especially on slow filesystems.  If
        not set, the value of `transfer.unpackLimit` is used instead.
index bf9546fca4f693f01b39252d12def7df9b51a52f..f061b64b7484497a43fba7aaac67c7f84b012582 100644 (file)
@@ -17,6 +17,9 @@ skipping more commits at a time, reducing the number of round trips.
 +
 * `pack.useBitmapBoundaryTraversal=true` may improve bitmap traversal times by
 walking fewer objects.
++
+* `pack.allowPackReuse=multi` may improve the time it takes to create a pack by
+reusing objects from multiple packs instead of just one.
 
 feature.manyFiles::
        Enable config options that optimize for repos with many files in the
index 568f0f75b3027d374a53857c06cf481ff376c6b7..d7dc461bd16ad782933a40e060c523b063cb1aca 100644 (file)
@@ -50,10 +50,16 @@ fetch.pruneTags::
        refs. See also `remote.<name>.pruneTags` and the PRUNING
        section of linkgit:git-fetch[1].
 
+fetch.all::
+       If true, fetch will attempt to update all available remotes.
+       This behavior can be overridden by passing `--no-all` or by
+       explicitly specifying one or more remote(s) to fetch from.
+       Defaults to false.
+
 fetch.output::
        Control how ref update status is printed. Valid values are
-       `full` and `compact`. Default value is `full`. See section
-       OUTPUT in linkgit:git-fetch[1] for detail.
+       `full` and `compact`. Default value is `full`. See the
+       OUTPUT section in linkgit:git-fetch[1] for details.
 
 fetch.negotiationAlgorithm::
        Control how information about the commits in the local repository
index 8cf6f00d9365cf19b6244ba005d078c5ebed8a05..7410e930e530fdf4b795da076dc6a3b3f1f4b0f1 100644 (file)
@@ -68,7 +68,7 @@ format.encodeEmailHeaders::
        Defaults to true.
 
 format.pretty::
-       The default pretty format for log/show/whatchanged command,
+       The default pretty format for log/show/whatchanged command.
        See linkgit:git-log[1], linkgit:git-show[1],
        linkgit:git-whatchanged[1].
 
@@ -119,7 +119,7 @@ format.notes::
        `--notes=<ref>`, where `ref` is the non-boolean value. Defaults
        to false.
 +
-If one wishes to use the ref `ref/notes/true`, please use that literal
+If one wishes to use the ref `refs/notes/true`, please use that literal
 instead.
 +
 This configuration can be specified multiple times in order to allow
index a3c865df5679e32958b8351076aa80579a067ffb..8e9e508933f8949ff6aa738d3f7460faeaa289db 100644 (file)
@@ -11,13 +11,13 @@ to clone or fetch it set `fetch.fsck.<msg-id>`.
 +
 The rest of the documentation discusses `fsck.*` for brevity, but the
 same applies for the corresponding `receive.fsck.*` and
-`fetch.<msg-id>.*`. variables.
+`fetch.fsck.*`. variables.
 +
-Unlike variables like `color.ui` and `core.editor` the
+Unlike variables like `color.ui` and `core.editor`, the
 `receive.fsck.<msg-id>` and `fetch.fsck.<msg-id>` variables will not
 fall back on the `fsck.<msg-id>` configuration if they aren't set. To
-uniformly configure the same fsck settings in different circumstances
-all three of them they must all set to the same values.
+uniformly configure the same fsck settings in different circumstances,
+all three of them must be set to the same values.
 +
 When `fsck.<msg-id>` is set, errors can be switched to warnings and
 vice versa by configuring the `fsck.<msg-id>` setting where the
@@ -36,19 +36,19 @@ Setting an unknown `fsck.<msg-id>` value will cause fsck to die, but
 doing the same for `receive.fsck.<msg-id>` and `fetch.fsck.<msg-id>`
 will only cause git to warn.
 +
-See `Fsck Messages` section of linkgit:git-fsck[1] for supported
+See the `Fsck Messages` section of linkgit:git-fsck[1] for supported
 values of `<msg-id>`.
 
 
 fsck.skipList::
        The path to a list of object names (i.e. one unabbreviated SHA-1 per
        line) that are known to be broken in a non-fatal way and should
-       be ignored. On versions of Git 2.20 and later comments ('#'), empty
-       lines, and any leading and trailing whitespace is ignored. Everything
+       be ignored. On versions of Git 2.20 and later, comments ('#'), empty
+       lines, and any leading and trailing whitespace are ignored. Everything
        but a SHA-1 per line will error out on older versions.
 +
 This feature is useful when an established project should be accepted
-despite early commits containing errors that can be safely ignored
+despite early commits containing errors that can be safely ignored,
 such as invalid committer email addresses.  Note: corrupt objects
 cannot be skipped with this setting.
 +
@@ -58,11 +58,11 @@ Like `fsck.<msg-id>` this variable has corresponding
 Unlike variables like `color.ui` and `core.editor` the
 `receive.fsck.skipList` and `fetch.fsck.skipList` variables will not
 fall back on the `fsck.skipList` configuration if they aren't set. To
-uniformly configure the same fsck settings in different circumstances
-all three of them they must all set to the same values.
+uniformly configure the same fsck settings in different circumstances,
+all three of them must be set to the same values.
 +
 Older versions of Git (before 2.20) documented that the object names
-list should be sorted. This was never a requirement, the object names
+list should be sorted. This was never a requirement; the object names
 could appear in any order, but when reading the list we tracked whether
 the list was sorted for the purposes of an internal binary search
 implementation, which could save itself some work with an already sorted
index c225c6c9e74cbd043489108ca843c129f0aa98de..671f9b94628446b1ee4704d6e6730c22719ebcaf 100644 (file)
@@ -1,5 +1,5 @@
 fsmonitor.allowRemote::
-    By default, the fsmonitor daemon refuses to work against network-mounted
+    By default, the fsmonitor daemon refuses to work with network-mounted
     repositories. Setting `fsmonitor.allowRemote` to `true` overrides this
     behavior.  Only respected when `core.fsmonitor` is set to `true`.
 
index ca47eb200882a251ddf7ad644151bb6e896b242f..664a3c28747c8e508e78caa97a607aa909e3efa1 100644 (file)
@@ -24,7 +24,7 @@ gc.auto::
        default value is 6700.
 +
 Setting this to 0 disables not only automatic packing based on the
-number of loose objects, but any other heuristic `git gc --auto` will
+number of loose objects, but also any other heuristic `git gc --auto` will
 otherwise use to determine if there's work to do, such as
 `gc.autoPackLimit`.
 
@@ -39,7 +39,7 @@ See the `gc.bigPackThreshold` configuration variable below. When in
 use, it'll affect how the auto pack limit works.
 
 gc.autoDetach::
-       Make `git gc --auto` return immediately and run in background
+       Make `git gc --auto` return immediately and run in the background
        if the system supports it. Default is true.
 
 gc.bigPackThreshold::
@@ -86,6 +86,12 @@ gc.cruftPacks::
        linkgit:git-repack[1]) instead of as loose objects. The default
        is `true`.
 
+gc.maxCruftSize::
+       Limit the size of new cruft packs when repacking. When
+       specified in addition to `--max-cruft-size`, the command line
+       option takes priority. See the `--max-cruft-size` option of
+       linkgit:git-repack[1].
+
 gc.pruneExpire::
        When 'git gc' is run, it will call 'prune --expire 2.weeks.ago'
        (and 'repack --cruft --cruft-expiration 2.weeks.ago' if using
@@ -145,6 +151,22 @@ Multiple hooks are supported, but all must exit successfully, else the
 operation (either generating a cruft pack or unpacking unreachable
 objects) will be halted.
 
+gc.repackFilter::
+       When repacking, use the specified filter to move certain
+       objects into a separate packfile.  See the
+       `--filter=<filter-spec>` option of linkgit:git-repack[1].
+
+gc.repackFilterTo::
+       When repacking and using a filter, see `gc.repackFilter`, the
+       specified location will be used to create the packfile
+       containing the filtered out objects. **WARNING:** The
+       specified location should be accessible, using for example the
+       Git alternates mechanism, otherwise the repo could be
+       considered corrupt by Git as it migh not be able to access the
+       objects in that packfile. See the `--filter-to=<dir>` option
+       of linkgit:git-repack[1] and the `objects/info/alternates`
+       section of linkgit:gitrepository-layout[5].
+
 gc.rerereResolved::
        Records of conflicted merge you resolved earlier are
        kept for this many days when 'git rerere gc' is run.
index 37e2831cd511c8a6f00112f9e357ab58c44ddf98..5cf32b179dc8bd5559be08e040b14a96ce158fd7 100644 (file)
@@ -4,7 +4,7 @@ gpg.program::
        same command-line interface as GPG, namely, to verify a detached
        signature, "`gpg --verify $signature - <$file`" is run, and the
        program is expected to signal a good signature by exiting with
-       code 0, and to generate an ASCII-armored detached signature, the
+       code 0.  To generate an ASCII-armored detached signature, the
        standard input of "`gpg -bsau $key`" is fed with the contents to be
        signed, and the program is expected to send the result to its
        standard output.
@@ -25,7 +25,7 @@ gpg.<format>.program::
 gpg.minTrustLevel::
        Specifies a minimum trust level for signature verification.  If
        this option is unset, then signature verification for merge
-       operations require a key with at least `marginal` trust.  Other
+       operations requires a key with at least `marginal` trust.  Other
        operations that perform signature verification require a key
        with at least `undefined` trust.  Setting this option overrides
        the required trust-level for all operations.  Supported values,
@@ -38,7 +38,7 @@ gpg.minTrustLevel::
 * `ultimate`
 
 gpg.ssh.defaultKeyCommand::
-       This command that will be run when user.signingkey is not set and a ssh
+       This command will be run when user.signingkey is not set and a ssh
        signature is requested. On successful exit a valid ssh public key
        prefixed with `key::` is expected in the first line of its output.
        This allows for a script doing a dynamic lookup of the correct public
index 0c087fd8c9313e5e68dcd7cd7a91b6900936febc..171be774d243fd2822fa51875feab38618d82193 100644 (file)
@@ -24,7 +24,7 @@ gui.matchTrackingBranch::
        not. Default: "false".
 
 gui.newBranchTemplate::
-       Is used as suggested name when creating new branches using the
+       Is used as suggested name when creating new branches using the
        linkgit:git-gui[1].
 
 gui.pruneDuringFetch::
index 51a70781e58cf9923cb0b1b84104c6d011dbd5f8..2d4e0c9b869b567200cfc5805600b51deaa41669 100644 (file)
@@ -254,13 +254,13 @@ http.lowSpeedLimit, http.lowSpeedTime::
 
 http.noEPSV::
        A boolean which disables using of EPSV ftp command by curl.
-       This can helpful with some "poor" ftp servers which don't
+       This can be helpful with some "poor" ftp servers which don't
        support EPSV mode. Can be overridden by the `GIT_CURL_FTP_NO_EPSV`
        environment variable. Default is false (curl will use EPSV).
 
 http.userAgent::
        The HTTP USER_AGENT string presented to an HTTP server.  The default
-       value represents the version of the client Git such as git/1.7.1.
+       value represents the version of the Git client such as git/1.7.1.
        This option allows you to override this value to a more common value
        such as Mozilla/4.0.  This may be necessary, for instance, if
        connecting through a firewall that restricts HTTP connections to a set
index cc256217317c666f79cc8d39604643d1fcb32b6a..6e72fdb45bd0cde5ca5e90ba189d8a6696df8ef2 100644 (file)
@@ -2,7 +2,7 @@ i18n.commitEncoding::
        Character encoding the commit messages are stored in; Git itself
        does not care per se, but this information is necessary e.g. when
        importing commits from emails or in the gitk graphical history
-       browser (and possibly at other places in the future or in other
+       browser (and possibly in other places in the future or in other
        porcelains). See e.g. linkgit:git-mailinfo[1]. Defaults to 'utf-8'.
 
 i18n.logOutputEncoding::
index 06166fb5c04fe9e1d83d51990f945b11ce1877e9..3d28f7264374e69f45afc9efb201136cb2049c8b 100644 (file)
@@ -4,7 +4,7 @@ imap.folder::
        "[Gmail]/Drafts". Required.
 
 imap.tunnel::
-       Command used to setup a tunnel to the IMAP server through which
+       Command used to set up a tunnel to the IMAP server through which
        commands will be piped instead of using a direct network connection
        to the server. Required when imap.host is not set.
 
@@ -37,7 +37,7 @@ imap.preformattedHTML::
        format=fixed email.  Default is `false`.
 
 imap.authMethod::
-       Specify authenticate method for authentication with IMAP server.
+       Specify the authentication method for authenticating with the IMAP server.
        If Git was built with the NO_CURL option, or if your curl version is older
        than 7.34.0, or if you're running git-imap-send with the `--no-curl`
        option, the only supported method is 'CRAM-MD5'. If this is not set
index 23c7985eb40974e2557c8bd3d271073c0b49bc58..3eff42036033ea90fb751b364a14ced17f5a25ad 100644 (file)
@@ -23,7 +23,7 @@ index.threads::
        Specifies the number of threads to spawn when loading the index.
        This is meant to reduce index load time on multiprocessor machines.
        Specifying 0 or 'true' will cause Git to auto-detect the number of
-       CPU's and set the number of threads accordingly. Specifying 1 or
+       CPUs and set the number of threads accordingly. Specifying 1 or
        'false' will disable multithreading. Defaults to 'true'.
 
 index.version::
index 79c79d66174ebd9f2dfb867a6a39a339529b7fc0..dd1d8332737fe89a2feca44ce59adad4f64bce5a 100644 (file)
@@ -1,7 +1,10 @@
-init.templateDir::
-       Specify the directory from which templates will be copied.
-       (See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].)
+:see-git-init:
+ifndef::git-init[]
+:see-git-init: (See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].)
+endif::[]
 
+init.templateDir::
+       Specify the directory from which templates will be copied. {see-git-init}
 init.defaultBranch::
        Allows overriding the default branch name e.g. when initializing
        a new repository.
index a2d3c7ec449e9b943a71f21891c2fd733a695dfc..5cc26555f19a4ff8f8a290a5316bfdd07b506e77 100644 (file)
@@ -4,9 +4,7 @@ interactive.singleKey::
        Currently this is used by the `--patch` mode of
        linkgit:git-add[1], linkgit:git-checkout[1],
        linkgit:git-restore[1], linkgit:git-commit[1],
-       linkgit:git-reset[1], and linkgit:git-stash[1]. Note that this
-       setting is silently ignored if portable keystroke input
-       is not available; requires the Perl module Term::ReadKey.
+       linkgit:git-reset[1], and linkgit:git-stash[1].
 
 interactive.diffFilter::
        When an interactive command (such as `git add --patch`) shows
index 5f96cf87fb96ce7366f11f80b48f9c9bf9fd13f6..9003a8219143ab75524391303df2f88ca8922e86 100644 (file)
@@ -9,7 +9,7 @@ log.date::
        `--date` option.  See linkgit:git-log[1] for details.
 +
 If the format is set to "auto:foo" and the pager is in use, format
-"foo" will be the used for the date format. Otherwise "default" will
+"foo" will be used for the date format. Otherwise, "default" will
 be used.
 
 log.decorate::
index 3854d4ae37cd77efca402a3911220baf4f0eb37d..ec3a5d81f7255aab044eea2b3667bb35c01236f2 100644 (file)
@@ -1,6 +1,6 @@
 mailinfo.scissors::
        If true, makes linkgit:git-mailinfo[1] (and therefore
        linkgit:git-am[1]) act by default as if the --scissors option
-       was provided on the command-line. When active, this features
+       was provided on the command-line. When active, this feature
        removes everything from the message body before a scissors
        line (i.e. consisting mainly of ">8", "8<" and "-").
index 18f056213145e595d0a57792e716f29521122997..69a4f05153e3ba08fda7d181d5d8defc3351cbd4 100644 (file)
@@ -12,7 +12,7 @@ maintenance.strategy::
        then that value is used instead of the one provided by
        `maintenance.strategy`. The possible strategy strings are:
 +
-* `none`: This default setting implies no task are run at any schedule.
+* `none`: This default setting implies no tasks are run at any schedule.
 * `incremental`: This setting optimizes for performing small maintenance
   activities that do not delete any data. This does not schedule the `gc`
   task, but runs the `prefetch` and `commit-graph` tasks hourly, the
index a727d987a8d48c3f4e6b43acd852d77da8f8b108..5a0f82cc2327a2007df24f4582e05a223959e7a0 100644 (file)
@@ -5,7 +5,7 @@ man.viewer::
 man.<tool>.cmd::
        Specify the command to invoke the specified man viewer. The
        specified command is evaluated in shell with the man page
-       passed as argument. (See linkgit:git-help[1].)
+       passed as an argument. (See linkgit:git-help[1].)
 
 man.<tool>.path::
        Override the path for the given tool that may be used to
index 99e83dd36e53e6079721a5a123fdf6392f4fc2b8..8851b6cedef980c106b9e86541862b517aa1f2ad 100644 (file)
@@ -7,7 +7,7 @@ merge.conflictStyle::
        marker and the original text before the `=======` marker.  The
        "merge" style tends to produce smaller conflict regions than diff3,
        both because of the exclusion of the original text, and because
-       when a subset of lines match on the two sides they are just pulled
+       when a subset of lines match on the two sides, they are just pulled
        out of the conflict region.  Another alternate style, "zdiff3", is
        similar to diff3 but removes matching lines on the two sides from
        the conflict region when those matching lines appear near either
index 56a7eeeffb4336ec05c52e96df59b501a41460bf..00bf665aa09bf353dd2c81220d2c83a31086e5b7 100644 (file)
@@ -22,8 +22,8 @@ mergetool.<tool>.trustExitCode::
        For a custom merge command, specify whether the exit code of
        the merge command can be used to determine whether the merge was
        successful.  If this is not set to true then the merge target file
-       timestamp is checked and the merge assumed to have been successful
-       if the file has been updated, otherwise the user is prompted to
+       timestamp is checked, and the merge is assumed to have been successful
+       if the file has been updated; otherwise, the user is prompted to
        indicate the success of the merge.
 
 mergetool.meld.hasOutput::
@@ -37,7 +37,7 @@ mergetool.meld.hasOutput::
 
 mergetool.meld.useAutoMerge::
        When the `--auto-merge` is given, meld will merge all non-conflicting
-       parts automatically, highlight the conflicting parts and wait for
+       parts automatically, highlight the conflicting parts, and wait for
        user decision.  Setting `mergetool.meld.useAutoMerge` to `true` tells
        Git to unconditionally use the `--auto-merge` option with `meld`.
        Setting this value to `auto` makes git detect whether `--auto-merge`
@@ -45,17 +45,24 @@ mergetool.meld.useAutoMerge::
        value of `false` avoids using `--auto-merge` altogether, and is the
        default value.
 
-mergetool.vimdiff.layout::
-       The vimdiff backend uses this variable to control how its split
-       windows look like. Applies even if you are using Neovim (`nvim`) or
-       gVim (`gvim`) as the merge tool. See BACKEND SPECIFIC HINTS section
+mergetool.<vimdiff variant>.layout::
+       Configure the split window layout for vimdiff's `<variant>`, which is any of `vimdiff`,
+       `nvimdiff`, `gvimdiff`.
+       Upon launching `git mergetool` with `--tool=<variant>` (or without `--tool`
+       if `merge.tool` is configured as `<variant>`), Git will consult
+       `mergetool.<variant>.layout` to determine the tool's layout. If the
+       variant-specific configuration is not available, `vimdiff`'s is used as
+       fallback.  If that too is not available, a default layout with 4 windows
+       will be used.  To configure the layout, see the `BACKEND SPECIFIC HINTS`
+ifdef::git-mergetool[]
+       section.
+endif::[]
 ifndef::git-mergetool[]
-       in linkgit:git-mergetool[1].
+       section in linkgit:git-mergetool[1].
 endif::[]
-       for details.
 
 mergetool.hideResolved::
-       During a merge Git will automatically resolve as many conflicts as
+       During a merge, Git will automatically resolve as many conflicts as
        possible and write the 'MERGED' file containing conflict markers around
        any conflicts that it cannot resolve; 'LOCAL' and 'REMOTE' normally
        represent the versions of the file from before Git's conflict
@@ -74,7 +81,7 @@ mergetool.keepTemporaries::
        When invoking a custom merge tool, Git uses a set of temporary
        files to pass to the tool. If the tool returns an error and this
        variable is set to `true`, then these temporary files will be
-       preserved, otherwise they will be removed after the tool has
+       preserved; otherwise, they will be removed after the tool has
        exited. Defaults to `false`.
 
 mergetool.writeToTemp::
index c7c4811734b5c935c89b52eb3b3ddef58f49689d..43db8e808d7ab763898ce5a860b8d4644bbc9f69 100644 (file)
@@ -1,7 +1,7 @@
 notes.mergeStrategy::
        Which merge strategy to choose by default when resolving notes
        conflicts.  Must be one of `manual`, `ours`, `theirs`, `union`, or
-       `cat_sort_uniq`.  Defaults to `manual`.  See "NOTES MERGE STRATEGIES"
+       `cat_sort_uniq`.  Defaults to `manual`.  See the "NOTES MERGE STRATEGIES"
        section of linkgit:git-notes[1] for more information on each strategy.
 +
 This setting can be overridden by passing the `--strategy` option to
index 3748136d141e4193682655559d91f143f31305ec..da527377fafcb629108676ed0becc489ed25095a 100644 (file)
@@ -28,11 +28,16 @@ all existing objects. You can force recompression by passing the -F option
 to linkgit:git-repack[1].
 
 pack.allowPackReuse::
-       When true, and when reachability bitmaps are enabled,
-       pack-objects will try to send parts of the bitmapped packfile
-       verbatim. This can reduce memory and CPU usage to serve fetches,
-       but might result in sending a slightly larger pack. Defaults to
-       true.
+       When true or "single", and when reachability bitmaps are
+       enabled, pack-objects will try to send parts of the bitmapped
+       packfile verbatim. When "multi", and when a multi-pack
+       reachability bitmap is available, pack-objects will try to send
+       parts of all packs in the MIDX.
++
+If only a single pack bitmap is available, and `pack.allowPackReuse`
+is set to "multi", reuse parts of just the bitmapped packfile. This
+can reduce memory and CPU usage to serve fetches, but might result in
+sending a slightly larger pack. Defaults to true.
 
 pack.island::
        An extended regular expression configuring a set of delta
@@ -74,7 +79,7 @@ pack.threads::
        warning. This is meant to reduce packing time on multiprocessor
        machines. The required amount of memory for the delta search window
        is however multiplied by the number of threads.
-       Specifying 0 will cause Git to auto-detect the number of CPU's
+       Specifying 0 will cause Git to auto-detect the number of CPUs
        and set the number of threads accordingly.
 
 pack.indexVersion::
@@ -83,11 +88,11 @@ pack.indexVersion::
        the new pack index with capabilities for packs larger than 4 GB
        as well as proper protection against the repacking of corrupted
        packs.  Version 2 is the default.  Note that version 2 is enforced
-       and this config option ignored whenever the corresponding pack is
+       and this config option is ignored whenever the corresponding pack is
        larger than 2 GB.
 +
 If you have an old Git that does not understand the version 2 `*.idx` file,
-cloning or fetching over a non native protocol (e.g. "http")
+cloning or fetching over a non-native protocol (e.g. "http")
 that will copy both `*.pack` file and corresponding `*.idx` file from the
 other side may give you a repository that cannot be accessed with your
 older version of Git. If the `*.pack` file is smaller than 2 GB, however,
@@ -102,8 +107,8 @@ pack.packSizeLimit::
        in the creation of multiple packfiles.
 +
 Note that this option is rarely useful, and may result in a larger total
-on-disk size (because Git will not store deltas between packs), as well
-as worse runtime performance (object lookup within multiple packs is
+on-disk size (because Git will not store deltas between packs) and
+worse runtime performance (object lookup within multiple packs is
 slower than a single pack, and optimizations like reachability bitmaps
 cannot cope with multiple packs).
 +
index 43338b65e843dd93b6373cc2edfe3600f7bf200d..0acbbea18a320f8adabf08db4f4570ef58a5edaf 100644 (file)
@@ -35,7 +35,7 @@ push.default::
 
 * `tracking` - This is a deprecated synonym for `upstream`.
 
-* `simple` - pushes the current branch with the same name on the remote.
+* `simple` - push the current branch with the same name on the remote.
 +
 If you are working on a centralized workflow (pushing to the same repository you
 pull from, which is typically `origin`), then you need to configure an upstream
@@ -67,7 +67,7 @@ new default).
 --
 
 push.followTags::
-       If set to true enable `--follow-tags` option by default.  You
+       If set to true, enable `--follow-tags` option by default.  You
        may override this configuration at time of push by specifying
        `--no-follow-tags`.
 
index afaf6dad99b5542ab06c31e4276a695128ee6b8a..c6187ab28b2fb731fad341c7d3c193872558645d 100644 (file)
@@ -9,7 +9,9 @@ rebase.stat::
        rebase. False by default.
 
 rebase.autoSquash::
-       If set to true enable `--autosquash` option by default.
+       If set to true, enable the `--autosquash` option of
+       linkgit:git-rebase[1] by default for interactive mode.
+       This can be overridden with the `--no-autosquash` option.
 
 rebase.autoStash::
        When set to true, automatically create a temporary stash entry
@@ -38,7 +40,7 @@ rebase.missingCommitsCheck::
 rebase.instructionFormat::
        A format string, as specified in linkgit:git-log[1], to be used for the
        todo list during an interactive rebase.  The format will
-       automatically have the long commit hash prepended to the format.
+       automatically have the commit hash prepended to the format.
 
 rebase.abbreviateCommands::
        If set to true, `git rebase` will use abbreviated command names in the
@@ -77,3 +79,9 @@ rebase.rebaseMerges::
        equivalent to `--no-rebase-merges`. Passing `--rebase-merges` on the
        command line, with or without an argument, overrides any
        `rebase.rebaseMerges` configuration.
+
+rebase.maxLabelLength::
+       When generating label names from commit subjects, truncate the names to
+       this length. By default, the names are truncated to a little less than
+       `NAME_MAX` (to allow e.g. `.lock` files to be written for the
+       corresponding loose refs).
index 85d5b5a3d2d8bf3952398628c188e4030cc3312d..c77e55b1cdd217e062450679920223a733995f77 100644 (file)
@@ -14,12 +14,12 @@ receive.autogc::
 
 receive.certNonceSeed::
        By setting this variable to a string, `git receive-pack`
-       will accept a `git push --signed` and verifies it by using
+       will accept a `git push --signed` and verify it by using
        a "nonce" protected by HMAC using this string as a secret
        key.
 
 receive.certNonceSlop::
-       When a `git push --signed` sent a push certificate with a
+       When a `git push --signed` sends a push certificate with a
        "nonce" that was issued by a receive-pack serving the same
        repository within this many seconds, export the "nonce"
        found in the certificate to `GIT_PUSH_CERT_NONCE` to the
index 40abdf6a6b5d8872772991c167c879cbb63f0ce5..3a78b5ebb1dc02e1f6cec1647ab94709018df7ff 100644 (file)
@@ -1,7 +1,7 @@
 rerere.autoUpdate::
        When set to true, `git-rerere` updates the index with the
        resulting contents after it cleanly resolves conflicts using
-       previously recorded resolution.  Defaults to false.
+       previously recorded resolutions.  Defaults to false.
 
 rerere.enabled::
        Activate recording of resolved conflicts, so that identical
index bde7f31459b98136a31a7eb1d457c5c43fddea54..577df40223a095b999b38a41df6c3a1cd1252de2 100644 (file)
@@ -14,7 +14,7 @@ repository that contains a bare repository and running a Git command
 within that directory.
 +
 This config setting is only respected in protected configuration (see
-<<SCOPES>>). This prevents the untrusted repository from tampering with
+<<SCOPES>>). This prevents untrusted repositories from tampering with
 this value.
 
 safe.directory::
@@ -32,7 +32,7 @@ override any such directories specified in the system config), add a
 `safe.directory` entry with an empty value.
 +
 This config setting is only respected in protected configuration (see
-<<SCOPES>>). This prevents the untrusted repository from tampering with this
+<<SCOPES>>). This prevents untrusted repositories from tampering with this
 value.
 +
 The value of this setting is interpolated, i.e. `~/<path>` expands to a
index 92a9ebe98c63e5fe75eb98237543d41d9f15c502..6a869d67eb90c9992a1cbcf3efb372d3a6fb2f40 100644 (file)
@@ -8,7 +8,7 @@ sendemail.smtpEncryption::
        See linkgit:git-send-email[1] for description.  Note that this
        setting is not subject to the 'identity' mechanism.
 
-sendemail.smtpsslcertpath::
+sendemail.smtpSSLCertPath::
        Path to ca-certificates (either a directory or a single file).
        Set it to an empty string to disable certificate verification.
 
@@ -36,7 +36,7 @@ sendemail.aliasesFile::
 
 sendemail.aliasFileType::
        Format of the file(s) specified in sendemail.aliasesFile. Must be
-       one of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus', or 'sendmail'.
+       one of 'mutt', 'mailrc', 'pine', 'elm', 'gnus', or 'sendmail'.
 +
 What an alias file in each format looks like can be found in
 the documentation of the email program of the same name. The
@@ -62,12 +62,12 @@ sendemail.chainReplyTo::
 sendemail.envelopeSender::
 sendemail.from::
 sendemail.headerCmd::
-sendemail.signedoffbycc::
+sendemail.signedOffByCc::
 sendemail.smtpPass::
-sendemail.suppresscc::
+sendemail.suppressCc::
 sendemail.suppressFrom::
 sendemail.to::
-sendemail.tocmd::
+sendemail.toCmd::
 sendemail.smtpDomain::
 sendemail.smtpServer::
 sendemail.smtpServerPort::
@@ -81,8 +81,8 @@ sendemail.xmailer::
        linkgit:git-send-email[1] command-line options. See its
        documentation for details.
 
-sendemail.signedoffcc (deprecated)::
-       Deprecated alias for `sendemail.signedoffbycc`.
+sendemail.signedOffCc (deprecated)::
+       Deprecated alias for `sendemail.signedOffByCc`.
 
 sendemail.smtpBatchSize::
        Number of messages to be sent per connection, after that a relogin
@@ -91,7 +91,7 @@ sendemail.smtpBatchSize::
        See also the `--batch-size` option of linkgit:git-send-email[1].
 
 sendemail.smtpReloginDelay::
-       Seconds wait before reconnecting to smtp server.
+       Seconds to wait before reconnecting to the smtp server.
        See also the `--relogin-delay` option of linkgit:git-send-email[1].
 
 sendemail.forbidSendmailVariables::
index b48d532a96976ba2b9d967212f9ec2943291375f..e664eef01d10dede9b6a334e84635346e539955a 100644 (file)
@@ -2,4 +2,4 @@ sequence.editor::
        Text editor used by `git rebase -i` for editing the rebase instruction file.
        The value is meant to be interpreted by the shell when it is used.
        It can be overridden by the `GIT_SEQUENCE_EDITOR` environment variable.
-       When not configured the default commit message editor is used instead.
+       When not configured, the default commit message editor is used instead.
index afdb186df8ba6d39819d75b0542dcf4d89aafa18..cfaa29610b5a0051bed8119337c6f70ca994747d 100644 (file)
@@ -3,10 +3,10 @@ splitIndex.maxPercentChange::
        percent of entries the split index can contain compared to the
        total number of entries in both the split index and the shared
        index before a new shared index is written.
-       The value should be between 0 and 100. If the value is 0 then
-       a new shared index is always written, if it is 100 a new
+       The value should be between 0 and 100. If the value is 0, then
+       a new shared index is always written; if it is 100, a new
        shared index is never written.
-       By default the value is 20, so a new shared index is written
+       By default, the value is 20, so a new shared index is written
        if the number of entries in the split index would be greater
        than 20 percent of the total number of entries.
        See linkgit:git-update-index[1].
index b9f609ed76b7f3ff41aef03ecf0ea22fd1d355ea..ec1edaeba68aa3351331f03f981ceff9412d0899 100644 (file)
@@ -1,14 +1,14 @@
 stash.showIncludeUntracked::
        If this is set to true, the `git stash show` command will show
        the untracked files of a stash entry.  Defaults to false. See
-       description of 'show' command in linkgit:git-stash[1].
+       the description of the 'show' command in linkgit:git-stash[1].
 
 stash.showPatch::
        If this is set to true, the `git stash show` command without an
        option will show the stash entry in patch form.  Defaults to false.
-       See description of 'show' command in linkgit:git-stash[1].
+       See the description of the 'show' command in linkgit:git-stash[1].
 
 stash.showStat::
        If this is set to true, the `git stash show` command without an
-       option will show diffstat of the stash entry.  Defaults to true.
-       See description of 'show' command in linkgit:git-stash[1].
+       option will show diffstat of the stash entry.  Defaults to true.
+       See the description of the 'show' command in linkgit:git-stash[1].
index 0fc704ab80b2239ed03752846158c59dff56c31b..2ff8237f8fc4585e7a2a4c9e7a27f121bbd9d7e2 100644 (file)
@@ -47,7 +47,7 @@ status.showUntrackedFiles::
        contain only untracked files, are shown with the directory name
        only. Showing untracked files means that Git needs to lstat() all
        the files in the whole repository, which might be slow on some
-       systems. So, this variable controls how the commands displays
+       systems. So, this variable controls how the commands display
        the untracked files. Possible values are:
 +
 --
@@ -62,7 +62,7 @@ of linkgit:git-status[1] and linkgit:git-commit[1].
 
 status.submoduleSummary::
        Defaults to false.
-       If this is set to a non zero number or true (identical to -1 or an
+       If this is set to a non-zero number or true (identical to -1 or an
        unlimited number), the submodule summary will be enabled and a
        summary of commits for modified submodules will be shown (see
        --summary-limit option of linkgit:git-submodule[1]). Please note
index 6490527b45bcd4819be3fe412bcfc0aab7740ee6..0672d9911724d184b7b49ee0e50de3e992a0eac5 100644 (file)
@@ -2,7 +2,7 @@ submodule.<name>.url::
        The URL for a submodule. This variable is copied from the .gitmodules
        file to the git config via 'git submodule init'. The user can change
        the configured URL before obtaining the submodule via 'git submodule
-       update'. If neither submodule.<name>.active or submodule.active are
+       update'. If neither submodule.<name>.active nor submodule.active are
        set, the presence of this variable is used as a fallback to indicate
        whether the submodule is of interest to git commands.
        See linkgit:git-submodule[1] and linkgit:gitmodules[5] for details.
@@ -35,7 +35,7 @@ submodule.<name>.ignore::
        a submodule as modified. When set to "all", it will never be considered
        modified (but it will nonetheless show up in the output of status and
        commit when it has been staged), "dirty" will ignore all changes
-       to the submodules work tree and
+       to the submodule's work tree and
        takes only differences between the HEAD of the submodule and the commit
        recorded in the superproject into account. "untracked" will additionally
        let submodules with modified tracked files in their work tree show up.
index fe1642f0d40251d466c78639fff44475edb6b25b..3b6bca2b7ae44c99404699745c4da3bfd2633681 100644 (file)
@@ -66,6 +66,6 @@ trace2.destinationDebug::
 
 trace2.maxFiles::
        Integer.  When writing trace files to a target directory, do not
-       write additional traces if we would exceed this many files. Instead,
+       write additional traces if doing so would exceed this many files. Instead,
        write a sentinel file that will block further tracing to this
        directory. Defaults to 0, which disables this check.
index c3ac767d1e4de152865ec82de6a995a9b4934834..f1ce50f4a6e6baf4ffde131339e8527e34e2e90b 100644 (file)
@@ -7,7 +7,7 @@ transfer.credentialsInUrl::
        and any other direct use of the configured URL.
 +
 Note that this is currently limited to detecting credentials in
-`remote.<name>.url` configuration, it won't detect credentials in
+`remote.<name>.url` configuration; it won't detect credentials in
 `remote.<name>.pushurl` configuration.
 +
 You might want to enable this to prevent inadvertent credentials
@@ -21,12 +21,12 @@ exposure, e.g. because:
   system.
 * The git programs will pass the full URL to one another as arguments
   on the command-line, meaning the credentials will be exposed to other
-  users on OS's or systems that allow other users to see the full
+  unprivileged users on systems that allow them to see the full
   process list of other users. On linux the "hidepid" setting
   documented in procfs(5) allows for configuring this behavior.
 +
 If such concerns don't apply to you then you probably don't need to be
-concerned about credentials exposure due to storing that sensitive
+concerned about credentials exposure due to storing sensitive
 data in git's configuration files. If you do want to use this, set
 `transfer.credentialsInUrl` to one of these values:
 +
@@ -121,3 +121,7 @@ transfer.bundleURI::
        information from the remote server (if advertised) and download
        bundles before continuing the clone through the Git protocol.
        Defaults to `false`.
+
+transfer.advertiseObjectInfo::
+       When `true`, the `object-info` capability is advertised by
+       servers. Defaults to false.
index ec9233b060a82c41dd9a01785a6f1e748ddf0ad9..2ffc38d164786fbe7be6a5d3ee770e6869ba7825 100644 (file)
@@ -5,14 +5,14 @@ author.email::
 committer.name::
 committer.email::
        The `user.name` and `user.email` variables determine what ends
-       up in the `author` and `committer` field of commit
+       up in the `author` and `committer` fields of commit
        objects.
        If you need the `author` or `committer` to be different, the
-       `author.name`, `author.email`, `committer.name` or
+       `author.name`, `author.email`, `committer.name`, or
        `committer.email` variables can be set.
-       Also, all of these can be overridden by the `GIT_AUTHOR_NAME`,
+       All of these can be overridden by the `GIT_AUTHOR_NAME`,
        `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`,
-       `GIT_COMMITTER_EMAIL` and `EMAIL` environment variables.
+       `GIT_COMMITTER_EMAIL`, and `EMAIL` environment variables.
 +
 Note that the `name` forms of these variables conventionally refer to
 some form of a personal name.  See linkgit:git-commit[1] and the
@@ -40,7 +40,7 @@ user.signingKey::
        your private ssh key or the public key when ssh-agent is used.
        Alternatively it can contain a public key prefixed with `key::`
        directly (e.g.: "key::ssh-rsa XXXXXX identifier"). The private key
-       needs to be available via ssh-agent. If not set git will call
+       needs to be available via ssh-agent. If not set Git will call
        gpg.ssh.defaultKeyCommand (e.g.: "ssh-add -L") and try to use the
        first key available. For backward compatibility, a raw key which
        begins with "ssh-", such as "ssh-rsa XXXXXX identifier", is treated
index 6c7cc054fad2503dabf21073624875d2b6035abe..0cff0908193a29ff5e482cbd3a6780460b3399eb 100644 (file)
@@ -19,14 +19,14 @@ with those suffixes.  E.g. if "-pre" appears before "-rc" in the
 configuration, then all "1.0-preX" tags will be listed before any
 "1.0-rcX" tags.  The placement of the main release tag relative to tags
 with various suffixes can be determined by specifying the empty suffix
-among those other suffixes.  E.g. if the suffixes "-rc", "", "-ck" and
+among those other suffixes.  E.g. if the suffixes "-rc", "", "-ck", and
 "-bfs" appear in the configuration in this order, then all "v4.8-rcX" tags
 are listed first, followed by "v4.8", then "v4.8-ckX" and finally
 "v4.8-bfsX".
 +
-If more than one suffixes match the same tagname, then that tagname will
+If more than one suffix matches the same tagname, then that tagname will
 be sorted according to the suffix which starts at the earliest position in
-the tagname.  If more than one different matching suffixes start at
+the tagname.  If more than one different matching suffix starts at
 that earliest position, then that tagname will be sorted according to the
 longest of those suffixes.
 The sorting order between different suffixes is undefined if they are
index 546adf79e5a52cf100c71154bb9710cc5c68aaf6..4b5aa5c2e045f5c135b96fb9ec03b06aad0b91ea 100644 (file)
@@ -17,7 +17,7 @@ You can customize the creation of patch text via the
 What the -p option produces is slightly different from the traditional
 diff format:
 
-1.   It is preceded with a "git diff" header that looks like this:
+1.   It is preceded by a "git diff" header that looks like this:
 
        diff --git a/file1 b/file2
 +
@@ -25,9 +25,9 @@ The `a/` and `b/` filenames are the same unless rename/copy is
 involved.  Especially, even for a creation or a deletion,
 `/dev/null` is _not_ used in place of the `a/` or `b/` filenames.
 +
-When rename/copy is involved, `file1` and `file2` show the
+When rename/copy is involved, `file1` and `file2` show the
 name of the source file of the rename/copy and the name of
-the file that rename/copy produces, respectively.
+the file that the rename/copy produces, respectively.
 
 2.   It is followed by one or more extended header lines:
 
@@ -77,7 +77,7 @@ separate lines indicate the old and the new mode.
 
 5.  Hunk headers mention the name of the function to which the hunk
     applies.  See "Defining a custom hunk-header" in
-    linkgit:gitattributes[5] for details of how to tailor to this to
+    linkgit:gitattributes[5] for details of how to tailor this to
     specific languages.
 
 
@@ -89,7 +89,7 @@ produce a 'combined diff' when showing a merge. This is the default
 format when showing merges with linkgit:git-diff[1] or
 linkgit:git-show[1]. Note also that you can give suitable
 `--diff-merges` option to any of these commands to force generation of
-diffs in specific format.
+diffs in specific format.
 
 A "combined diff" format looks like this:
 
@@ -123,7 +123,7 @@ index fabadb8,cc95eb0..4866510
                for_each_ref(get_name);
 ------------
 
-1.   It is preceded with a "git diff" header, that looks like
+1.   It is preceded by a "git diff" header, that looks like
      this (when the `-c` option is used):
 
        diff --combined file
@@ -142,22 +142,22 @@ or like this (when the `--cc` option is used):
 +
 The `mode <mode>,<mode>..<mode>` line appears only if at least one of
 the <mode> is different from the rest. Extended headers with
-information about detected contents movement (renames and
-copying detection) are designed to work with diff of two
+information about detected content movement (renames and
+copying detection) are designed to work with the diff of two
 <tree-ish> and are not used by combined diff format.
 
-3.   It is followed by two-line from-file/to-file header
+3.   It is followed by a two-line from-file/to-file header:
 
        --- a/file
        +++ b/file
 +
-Similar to two-line header for traditional 'unified' diff
+Similar to the two-line header for the traditional 'unified' diff
 format, `/dev/null` is used to signal created or deleted
 files.
 +
 However, if the --combined-all-paths option is provided, instead of a
-two-line from-file/to-file you get a N+1 line from-file/to-file header,
-where N is the number of parents in the merge commit
+two-line from-file/to-file, you get an N+1 line from-file/to-file header,
+where N is the number of parents in the merge commit:
 
        --- a/file
        --- a/file
@@ -197,7 +197,7 @@ added, from the point of view of that parent).
 In the above example output, the function signature was changed
 from both files (hence two `-` removals from both file1 and
 file2, plus `++` to mean one line that was added does not appear
-in either file1 or file2).  Also eight other lines are the same
+in either file1 or file2).  Also, eight other lines are the same
 from file1 but do not appear in file2 (hence prefixed with `+`).
 
 When shown by `git diff-tree -c`, it compares the parents of a
index 9f33f887711d3ac1d1f0e8933b22d8004b606dc7..aaaff0d46f0c6f04ca4e3182872b47d2bd2f07b6 100644 (file)
@@ -22,13 +22,7 @@ ifndef::git-format-patch[]
 -p::
 -u::
 --patch::
-       Generate patch (see section titled
-ifdef::git-log[]
-<<generate_patch_text_with_p, "Generating patch text with -p">>).
-endif::git-log[]
-ifndef::git-log[]
-"Generating patch text with -p").
-endif::git-log[]
+       Generate patch (see <<generate_patch_text_with_p>>).
 ifdef::git-diff[]
        This is the default.
 endif::git-diff[]
@@ -43,66 +37,79 @@ endif::git-diff[]
 endif::git-format-patch[]
 
 ifdef::git-log[]
---diff-merges=(off|none|on|first-parent|1|separate|m|combined|c|dense-combined|cc|remerge|r)::
+-m::
+       Show diffs for merge commits in the default format. This is
+       similar to '--diff-merges=on', except `-m` will
+       produce no output unless `-p` is given as well.
+
+-c::
+       Produce combined diff output for merge commits.
+       Shortcut for '--diff-merges=combined -p'.
+
+--cc::
+       Produce dense combined diff output for merge commits.
+       Shortcut for '--diff-merges=dense-combined -p'.
+
+--dd::
+       Produce diff with respect to first parent for both merge and
+       regular commits.
+       Shortcut for '--diff-merges=first-parent -p'.
+
+--remerge-diff::
+       Produce remerge-diff output for merge commits.
+       Shortcut for '--diff-merges=remerge -p'.
+
 --no-diff-merges::
+       Synonym for '--diff-merges=off'.
+
+--diff-merges=<format>::
        Specify diff format to be used for merge commits. Default is
-       {diff-merges-default} unless `--first-parent` is in use, in which case
-       `first-parent` is the default.
+       {diff-merges-default} unless `--first-parent` is in use, in
+       which case `first-parent` is the default.
 +
---diff-merges=(off|none):::
---no-diff-merges:::
+The following formats are supported:
++
+--
+off, none::
        Disable output of diffs for merge commits. Useful to override
        implied value.
 +
---diff-merges=on:::
---diff-merges=m:::
--m:::
-       This option makes diff output for merge commits to be shown in
-       the default format. `-m` will produce the output only if `-p`
-       is given as well. The default format could be changed using
-       `log.diffMerges` configuration parameter, which default value
+on, m::
+       Make diff output for merge commits to be shown in the default
+       format. The default format can be changed using
+       `log.diffMerges` configuration variable, whose default value
        is `separate`.
 +
---diff-merges=first-parent:::
---diff-merges=1:::
-       This option makes merge commits show the full diff with
-       respect to the first parent only.
+first-parent, 1::
+       Show full diff with respect to first parent. This is the same
+       format as `--patch` produces for non-merge commits.
 +
---diff-merges=separate:::
-       This makes merge commits show the full diff with respect to
-       each of the parents. Separate log entry and diff is generated
-       for each parent.
+separate::
+       Show full diff with respect to each of parents.
+       Separate log entry and diff is generated for each parent.
 +
---diff-merges=remerge:::
---diff-merges=r:::
---remerge-diff:::
-       With this option, two-parent merge commits are remerged to
-       create a temporary tree object -- potentially containing files
-       with conflict markers and such.  A diff is then shown between
-       that temporary tree and the actual merge commit.
+combined, c::
+       Show differences from each of the parents to the merge
+       result simultaneously instead of showing pairwise diff between
+       a parent and the result one at a time. Furthermore, it lists
+       only files which were modified from all parents.
++
+dense-combined, cc::
+       Further compress output produced by `--diff-merges=combined`
+       by omitting uninteresting hunks whose contents in the parents
+       have only two variants and the merge result picks one of them
+       without modification.
++
+remerge, r::
+       Remerge two-parent merge commits to create a temporary tree
+       object--potentially containing files with conflict markers
+       and such.  A diff is then shown between that temporary tree
+       and the actual merge commit.
 +
 The output emitted when this option is used is subject to change, and
 so is its interaction with other options (unless explicitly
 documented).
-+
---diff-merges=combined:::
---diff-merges=c:::
--c:::
-       With this option, diff output for a merge commit shows the
-       differences from each of the parents to the merge result
-       simultaneously instead of showing pairwise diff between a
-       parent and the result one at a time. Furthermore, it lists
-       only files which were modified from all parents. `-c` implies
-       `-p`.
-+
---diff-merges=dense-combined:::
---diff-merges=cc:::
---cc:::
-       With this option the output produced by
-       `--diff-merges=combined` is further compressed by omitting
-       uninteresting hunks whose contents in the parents have only
-       two variants and the merge result picks one of them without
-       modification.  `--cc` implies `-p`.
+--
 
 --combined-all-paths::
        This flag causes combined diffs (used for merge commits) to
@@ -210,14 +217,15 @@ have to use `--diff-algorithm=default` option.
        part. Maximum width defaults to terminal width, or 80 columns
        if not connected to a terminal, and can be overridden by
        `<width>`. The width of the filename part can be limited by
-       giving another width `<name-width>` after a comma. The width
-       of the graph part can be limited by using
-       `--stat-graph-width=<width>` (affects all commands generating
-       a stat graph) or by setting `diff.statGraphWidth=<width>`
-       (does not affect `git format-patch`).
-       By giving a third parameter `<count>`, you can limit the
-       output to the first `<count>` lines, followed by `...` if
-       there are more.
+       giving another width `<name-width>` after a comma or by setting
+       `diff.statNameWidth=<width>`. The width of the graph part can be
+       limited by using `--stat-graph-width=<width>` or by setting
+       `diff.statGraphWidth=<width>`. Using `--stat` or
+       `--stat-graph-width` affects all commands generating a stat graph,
+       while setting `diff.statNameWidth` or `diff.statGraphWidth`
+       does not affect `git format-patch`.
+       By giving a third parameter `<count>`, you can limit the output to
+       the first `<count>` lines, followed by `...` if there are more.
 +
 These parameters can also be set individually with `--stat-width=<width>`,
 `--stat-name-width=<name-width>` and `--stat-count=<count>`.
@@ -291,7 +299,7 @@ and accumulating child directory counts in the parent directories:
        Synonym for --dirstat=cumulative
 
 --dirstat-by-file[=<param1,param2>...]::
-       Synonym for --dirstat=files,param1,param2...
+       Synonym for --dirstat=files,<param1>,<param2>...
 
 --summary::
        Output a condensed summary of extended header information
@@ -306,7 +314,7 @@ ifndef::git-format-patch[]
 
 -z::
 ifdef::git-log[]
-       Separate the commits with NULs instead of with new newlines.
+       Separate the commits with NULs instead of newlines.
 +
 Also, when `--raw` or `--numstat` has been given, do not munge
 pathnames and use NULs as output field terminators.
@@ -738,7 +746,7 @@ matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
 --rotate-to=<file>::
        Discard the files before the named <file> from the output
        (i.e. 'skip to'), or move them to the end of the output
-       (i.e. 'rotate to').  These were invented primarily for use
+       (i.e. 'rotate to').  These options were invented primarily for the use
        of the `git difftool` command, and may not be very useful
        otherwise.
 
index 41fc7ca3c67f5d31d5a771de906394480f265d9f..e22b217fba9e2c6c30ad1f7becea238d0f2a9916 100644 (file)
@@ -1,5 +1,6 @@
---all::
-       Fetch all remotes.
+--[no-]all::
+       Fetch all remotes. This overrides the configuration variable
+       `fetch.all`.
 
 -a::
 --append::
@@ -43,7 +44,7 @@ the current repository has the same history as the source repository.
 --update-shallow::
        By default when fetching from a shallow repository,
        `git fetch` refuses refs that require updating
-       .git/shallow. This option updates .git/shallow and accept such
+       .git/shallow. This option updates .git/shallow and accepts such
        refs.
 
 --negotiation-tip=<commit|glob>::
@@ -96,7 +97,7 @@ endif::git-pull[]
 
 -f::
 --force::
-       When 'git fetch' is used with `<src>:<dst>` refspec it may
+       When 'git fetch' is used with `<src>:<dst>` refspec, it may
        refuse to update the local branch as discussed
 ifdef::git-pull[]
        in the `<refspec>` part of the linkgit:git-fetch[1]
@@ -201,7 +202,7 @@ endif::git-pull[]
        destination of an explicit refspec; see `--prune`).
 
 ifndef::git-pull[]
---recurse-submodules[=yes|on-demand|no]::
+--recurse-submodules[=(yes|on-demand|no)]::
        This option controls if and under what conditions new commits of
        submodules should be fetched too. When recursing through submodules,
        `git fetch` always attempts to fetch "changed" submodules, that is, a
index 12eae8a2225a3c4d216fd05c874c1ed2930b5545..f643585a34e7617806c63b8f4afa7a4105bb989b 100644 (file)
 `hasDotgit`::
        (WARN) A tree contains an entry named `.git`.
 
+`largePathname`::
+       (WARN) A tree contains an entry with a very long path name. If
+       the value of `fsck.largePathname` contains a colon, that value
+       is used as the maximum allowable length (e.g., "warn:10" would
+       complain about any path component of 11 or more bytes). The
+       default value is 4096.
+
 `mailmapSymlink`::
        (INFO) `.mailmap` is a symlink.
 
        (ERROR) Missing space before date in an author/committer line.
 
 `missingSpaceBeforeEmail`::
-       (ERROR) Missing space before the email in author/committer line.
+       (ERROR) Missing space before the email in an author/committer line.
 
 `missingTag`::
        (ERROR) Unexpected end after `type` line in a tag object.
        (FATAL) Missing end-of-line in the object header.
 
 `zeroPaddedDate`::
-       (ERROR) Found a zero padded date in an author/commiter line.
+       (ERROR) Found a zero padded date in an author/committer line.
 
 `zeroPaddedFilemode`::
        (WARN) Found a zero padded filemode in a tree.
index ed44c1cb31ca6eaf7e63d7920cbc15c3a2e0619f..14a371fff3569eac4fd633ebc945b1d8793b1237 100644 (file)
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git add' [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p]
-         [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]] [--sparse]
+         [--edit | -e] [--[no-]all | -A | --[no-]ignore-removal | [--update | -u]] [--sparse]
          [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--renormalize]
          [--chmod=(+|-)x] [--pathspec-from-file=<file> [--pathspec-file-nul]]
          [--] [<pathspec>...]
@@ -63,7 +63,7 @@ OPTIONS
        to ignore removed files; use `--no-all` option if you want
        to add modified or new files but ignore removed ones.
 +
-For more details about the <pathspec> syntax, see the 'pathspec' entry
+For more details about the _<pathspec>_ syntax, see the 'pathspec' entry
 in linkgit:gitglossary[7].
 
 -n::
@@ -119,10 +119,10 @@ apply to the index. See EDITING PATCHES below.
 -u::
 --update::
        Update the index just where it already has an entry matching
-       <pathspec>.  This removes as well as modifies index entries to
+       _<pathspec>_.  This removes as well as modifies index entries to
        match the working tree, but adds no new files.
 +
-If no <pathspec> is given when `-u` option is used, all
+If no _<pathspec>_ is given when `-u` option is used, all
 tracked files in the entire working tree are updated (old versions
 of Git used to limit the update to the current directory and its
 subdirectories).
@@ -131,11 +131,11 @@ subdirectories).
 --all::
 --no-ignore-removal::
        Update the index not only where the working tree has a file
-       matching <pathspec> but also where the index already has an
+       matching _<pathspec>_ but also where the index already has an
        entry. This adds, modifies, and removes index entries to
        match the working tree.
 +
-If no <pathspec> is given when `-A` option is used, all
+If no _<pathspec>_ is given when `-A` option is used, all
 files in the entire working tree are updated (old versions
 of Git used to limit the update to the current directory and its
 subdirectories).
@@ -145,11 +145,11 @@ subdirectories).
        Update the index by adding new files that are unknown to the
        index and files modified in the working tree, but ignore
        files that have been removed from the working tree.  This
-       option is a no-op when no <pathspec> is used.
+       option is a no-op when no _<pathspec>_ is used.
 +
 This option is primarily to help users who are used to older
-versions of Git, whose "git add <pathspec>..." was a synonym
-for "git add --no-all <pathspec>...", i.e. ignored removed files.
+versions of Git, whose "git add _<pathspec>_..." was a synonym
+for "git add --no-all _<pathspec>_...", i.e. ignored removed files.
 
 -N::
 --intent-to-add::
@@ -198,8 +198,8 @@ for "git add --no-all <pathspec>...", i.e. ignored removed files.
        unchanged.
 
 --pathspec-from-file=<file>::
-       Pathspec is passed in `<file>` instead of commandline args. If
-       `<file>` is exactly `-` then standard input is used. Pathspec
+       Pathspec is passed in _<file>_ instead of commandline args. If
+       _<file>_ is exactly `-` then standard input is used. Pathspec
        elements are separated by LF or CR/LF. Pathspec elements can be
        quoted as explained for the configuration variable `core.quotePath`
        (see linkgit:git-config[1]). See also `--pathspec-file-nul` and
index 900be198b14e933d19f87febd9860cb0c67a6bf0..463a3c660024e08b494caa3e22b4d4c417f46e0c 100644 (file)
@@ -12,7 +12,7 @@ SYNOPSIS
 'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8] [--no-verify]
         [--[no-]3way] [--interactive] [--committer-date-is-author-date]
         [--ignore-date] [--ignore-space-change | --ignore-whitespace]
-        [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
+        [--whitespace=<action>] [-C<n>] [-p<n>] [--directory=<dir>]
         [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]
         [--[no-]scissors] [-S[<keyid>]] [--patch-format=<format>]
         [--quoted-cr=<action>]
@@ -22,8 +22,8 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Splits mail messages in a mailbox into commit log message,
-authorship information and patches, and applies them to the
+Splits mail messages in a mailbox into commit log messages,
+authorship information, and patches, and applies them to the
 current branch. You could think of it as a reverse operation
 of linkgit:git-format-patch[1] run on a branch with a straight
 history without merges.
@@ -69,7 +69,7 @@ OPTIONS
 --empty=(stop|drop|keep)::
        By default, or when the option is set to 'stop', the command
        errors out on an input e-mail message lacking a patch
-       and stops into the middle of the current am session. When this
+       and stops in the middle of the current am session. When this
        option is set to 'drop', skip such an e-mail message instead.
        When this option is set to 'keep', create an empty commit,
        recording the contents of the e-mail message as its log.
@@ -94,7 +94,7 @@ OPTIONS
        Pass `-u` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
        The proposed commit log message taken from the e-mail
        is re-coded into UTF-8 encoding (configuration variable
-       `i18n.commitEncoding` can be used to specify project's
+       `i18n.commitEncoding` can be used to specify the project's
        preferred encoding if it is not UTF-8).
 +
 This was optional in prior versions of git, but now it is the
@@ -118,7 +118,7 @@ include::rerere-options.txt[]
 
 --ignore-space-change::
 --ignore-whitespace::
---whitespace=<option>::
+--whitespace=<action>::
 -C<n>::
 -p<n>::
 --directory=<dir>::
@@ -128,13 +128,16 @@ include::rerere-options.txt[]
        These flags are passed to the 'git apply' (see linkgit:git-apply[1])
        program that applies
        the patch.
++
+Valid <action> for the `--whitespace` option are:
+`nowarn`, `warn`, `fix`, `error`, and `error-all`.
 
 --patch-format::
        By default the command will try to detect the patch format
        automatically. This option allows the user to bypass the automatic
        detection and specify the patch format that the patch(es) should be
        interpreted as. Valid formats are mbox, mboxrd,
-       stgit, stgit-series and hg.
+       stgit, stgit-series, and hg.
 
 -i::
 --interactive::
@@ -192,7 +195,7 @@ include::rerere-options.txt[]
 
 --abort::
        Restore the original branch and abort the patching operation.
-       Revert contents of files involved in the am operation to their
+       Revert the contents of files involved in the am operation to their
        pre-am state.
 
 --quit::
index 5e16e6db7e2e0273dacbb76b5d7f4cd6ee0462ec..9cce68a38be10f3a4ff3130adb1a2b300835cdcb 100644 (file)
@@ -23,8 +23,8 @@ DESCRIPTION
 Reads the supplied diff output (i.e. "a patch") and applies it to files.
 When running from a subdirectory in a repository, patched paths
 outside the directory are ignored.
-With the `--index` option the patch is also applied to the index, and
-with the `--cached` option the patch is only applied to the index.
+With the `--index` option, the patch is also applied to the index, and
+with the `--cached` option, the patch is only applied to the index.
 Without these options, the command applies the patch only to files,
 and does not require them to be in a Git repository.
 
@@ -52,7 +52,7 @@ OPTIONS
 --summary::
        Instead of applying the patch, output a condensed
        summary of information obtained from git diff extended
-       headers, such as creations, renames and mode changes.
+       headers, such as creations, renames, and mode changes.
        Turns off "apply".
 
 --check::
@@ -140,7 +140,7 @@ linkgit:git-config[1]).
        applying a diff generated with `--unified=0`. To bypass these
        checks use `--unidiff-zero`.
 +
-Note, for the reasons stated above usage of context-free patches is
+Note, for the reasons stated above, the usage of context-free patches is
 discouraged.
 
 --apply::
@@ -159,9 +159,9 @@ discouraged.
 
 --allow-binary-replacement::
 --binary::
-       Historically we did not allow binary patch applied
+       Historically we did not allow binary patch application
        without an explicit permission from the user, and this
-       flag was the way to do so.  Currently we always allow binary
+       flag was the way to do so.  Currently, we always allow binary
        patch application, so this is a no-op.
 
 --exclude=<path-pattern>::
@@ -257,7 +257,7 @@ the `--unsafe-paths` option to override this safety check.  This option
 has no effect when `--index` or `--cached` is in use.
 
 --allow-empty::
-       Don't return error for patches containing no diff. This includes
+       Don't return an error for patches containing no diff. This includes
        empty patches and patches with commit text only.
 
 CONFIGURATION
index 6bab201d37548dd5c4f911baf981f3fc1995a889..98526f2bebad16e2814f084005c12c2359378ec2 100644 (file)
@@ -21,14 +21,14 @@ structure for the named tree, and writes it out to the standard
 output.  If <prefix> is specified it is
 prepended to the filenames in the archive.
 
-'git archive' behaves differently when given a tree ID versus when
-given a commit ID or tag ID.  In the first case the current time is
-used as the modification time of each file in the archive.  In the latter
-case the commit time as recorded in the referenced commit object is
-used instead.  Additionally the commit ID is stored in a global
-extended pax header if the tar format is used; it can be extracted
-using 'git get-tar-commit-id'. In ZIP files it is stored as a file
-comment.
+'git archive' behaves differently when given a tree ID as opposed to a
+commit ID or tag ID. When a tree ID is provided, the current time is
+used as the modification time of each file in the archive. On the
+other hand, when a commit ID or tag ID is provided, the commit time as
+recorded in the referenced commit object is used instead.
+Additionally the commit ID is stored in a global extended pax header
+if the tar format is used; it can be extracted using 'git
+get-tar-commit-id'. In ZIP files it is stored as a file comment.
 
 OPTIONS
 -------
index 7872dba3aefa3de62175f0e88bfac1473bbe0723..82f944dc03dffccae2425cb3a250d681ad3ed134 100644 (file)
@@ -16,17 +16,17 @@ DESCRIPTION
 The command takes various subcommands, and different options depending
 on the subcommand:
 
- git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]
-                 [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<paths>...]
+ git bisect start [--term-(bad|new)=<term-new> --term-(good|old)=<term-old>]
+                 [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]
  git bisect (bad|new|<term-new>) [<rev>]
  git bisect (good|old|<term-old>) [<rev>...]
- git bisect terms [--term-good | --term-bad]
+ git bisect terms [--term-(good|old) | --term-(bad|new)]
  git bisect skip [(<rev>|<range>)...]
  git bisect reset [<commit>]
  git bisect (visualize|view)
  git bisect replay <logfile>
  git bisect log
- git bisect run <cmd>...
+ git bisect run <cmd> [<arg>...]
  git bisect help
 
 This command uses a binary search algorithm to find which commit in
@@ -165,8 +165,10 @@ To get a reminder of the currently used terms, use
 git bisect terms
 ------------------------------------------------
 
-You can get just the old (respectively new) term with `git bisect terms
---term-old` or `git bisect terms --term-good`.
+You can get just the old term with `git bisect terms --term-old`
+or `git bisect terms --term-good`; `git bisect terms --term-new`
+and `git bisect terms --term-bad` can be used to learn how to call
+the commits more recent than the sought change.
 
 If you would like to use your own terms instead of "bad"/"good" or
 "new"/"old", you can choose any names you like (except existing bisect
@@ -299,7 +301,7 @@ Cutting down bisection by giving more parameters to bisect start
 
 You can further cut down the number of trials, if you know what part of
 the tree is involved in the problem you are tracking down, by specifying
-path parameters when issuing the `bisect start` command:
+pathspec parameters when issuing the `bisect start` command:
 
 ------------
 $ git bisect start -- arch/i386 include/asm-i386
@@ -362,7 +364,7 @@ OPTIONS
 --no-checkout::
 +
 Do not checkout the new working tree at each iteration of the bisection
-process. Instead just update a special reference named `BISECT_HEAD` to make
+process. Instead just update the reference named `BISECT_HEAD` to make
 it point to the commit that should be tested.
 +
 This option may be useful when the test you would perform in each step
index f69a871a96f7589015c723ccdfdd95c6c1d610ed..b1d7fb539d021664111276e33ed16dfcd2a91f3c 100644 (file)
@@ -77,7 +77,7 @@ include::blame-options.txt[]
 
 -e::
 --show-email::
-       Show the author email instead of author name (Default: off).
+       Show the author email instead of the author name (Default: off).
        This can also be controlled via the `blame.showEmail` config
        option.
 
@@ -100,7 +100,7 @@ When neither `--porcelain` nor `--incremental` option is specified,
 `git blame` will output annotation for each line with:
 
 - abbreviated object name for the commit the line came from;
-- author ident (by default author name and date, unless `-s` or `-e`
+- author ident (by default the author name and date, unless `-s` or `-e`
   is specified); and
 - line number
 
@@ -128,7 +128,7 @@ at least once for each commit:
 - the filename in the commit that the line is attributed to.
 - the first line of the commit log message ("summary").
 
-The contents of the actual line is output after the above
+The contents of the actual line are output after the above
 header, prefixed by a TAB. This is to allow adding more
 header elements later.
 
@@ -170,7 +170,7 @@ which limits the annotation to the body of the `hello` subroutine.
 
 When you are not interested in changes older than version
 v2.6.18, or changes older than 3 weeks, you can use revision
-range specifiers  similar to 'git rev-list':
+range specifiers similar to 'git rev-list':
 
        git blame v2.6.18.. -- foo
        git blame --since=3.weeks -- foo
@@ -210,7 +210,7 @@ annotated.
 
 . Each blame entry always starts with a line of:
 
-       <40-byte hex sha1> <sourceline> <resultline> <num_lines>
+       <40-byte-hex-sha1> <sourceline> <resultline> <num-lines>
 +
 Line numbers count from 1.
 
index d207da9101a5cfe6441a03360191d3b6b8a73a46..0b08442932354fcdcbb321f0c45b80a3a5bc4fdf 100644 (file)
@@ -312,7 +312,8 @@ superproject's "origin/main", but tracks the submodule's "origin/main".
        option is omitted, the current HEAD will be used instead.
 
 <oldbranch>::
-       The name of an existing branch to rename.
+       The name of an existing branch.  If this option is omitted,
+       the name of the current branch will be used instead.
 
 <newbranch>::
        The new name for an existing branch. The same restrictions as for
@@ -324,7 +325,7 @@ superproject's "origin/main", but tracks the submodule's "origin/main".
        multiple times, in which case the last key becomes the primary
        key. The keys supported are the same as those in `git
        for-each-ref`. Sort order defaults to the value configured for the
-       `branch.sort` variable if exists, or to sorting based on the
+       `branch.sort` variable if it exists, or to sorting based on the
        full refname (including `refs/...` prefix). This lists
        detached HEAD (if present) first, then local branches and
        finally remote-tracking branches. See linkgit:git-config[1].
index eca726e57911af2cc1f0643cafdcf887c20bfa32..112658b3c3bb722d91715a32590a3789302feda7 100644 (file)
@@ -8,15 +8,17 @@ git-bugreport - Collect information for user to file a bug report
 SYNOPSIS
 --------
 [verse]
-'git bugreport' [(-o | --output-directory) <path>] [(-s | --suffix) <format>]
+'git bugreport' [(-o | --output-directory) <path>]
+               [(-s | --suffix) <format> | --no-suffix]
                [--diagnose[=<mode>]]
 
 DESCRIPTION
 -----------
-Captures information about the user's machine, Git client, and repository state,
-as well as a form requesting information about the behavior the user observed,
-into a single text file which the user can then share, for example to the Git
-mailing list, in order to report an observed bug.
+Collects information about the user's machine, Git client, and repository
+state, in addition to a form requesting information about the behavior the
+user observed, and stores it in a single text file which the user can then
+share, for example to the Git mailing list, in order to report an observed
+bug.
 
 The following information is requested from the user:
 
@@ -50,16 +52,19 @@ OPTIONS
 
 -s <format>::
 --suffix <format>::
+--no-suffix::
        Specify an alternate suffix for the bugreport name, to create a file
-       named 'git-bugreport-<formatted suffix>'. This should take the form of a
+       named 'git-bugreport-<formatted-suffix>'. This should take the form of a
        strftime(3) format string; the current local time will be used.
+       `--no-suffix` disables the suffix and the file is just named
+       `git-bugreport` without any disambiguation measure.
 
 --no-diagnose::
 --diagnose[=<mode>]::
        Create a zip archive of supplemental information about the user's
        machine, Git client, and repository state. The archive is written to the
        same output directory as the bug report and is named
-       'git-diagnostics-<formatted suffix>'.
+       'git-diagnostics-<formatted-suffix>'.
 +
 Without `mode` specified, the diagnostic archive will contain the default set of
 statistics reported by `git diagnose`. An optional `mode` value may be specified
index 0e4936d182632fb3362376787efd7d633bd623d2..bd95a6c10a7d0b1ee16b619c4b546c8d9c0b0e13 100644 (file)
@@ -3,8 +3,7 @@ git-cat-file(1)
 
 NAME
 ----
-git-cat-file - Provide content or type and size information for repository objects
-
+git-cat-file - Provide contents or details of repository objects
 
 SYNOPSIS
 --------
@@ -12,25 +11,24 @@ SYNOPSIS
 'git cat-file' <type> <object>
 'git cat-file' (-e | -p) <object>
 'git cat-file' (-t | -s) [--allow-unknown-type] <object>
+'git cat-file' (--textconv | --filters)
+            [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]
 'git cat-file' (--batch | --batch-check | --batch-command) [--batch-all-objects]
             [--buffer] [--follow-symlinks] [--unordered]
             [--textconv | --filters] [-Z]
-'git cat-file' (--textconv | --filters)
-            [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]
 
 DESCRIPTION
 -----------
-In its first form, the command provides the content or the type of an object in
-the repository. The type is required unless `-t` or `-p` is used to find the
-object type, or `-s` is used to find the object size, or `--textconv` or
-`--filters` is used (which imply type "blob").
-
-In the second form, a list of objects (separated by linefeeds) is provided on
-stdin, and the SHA-1, type, and size of each object is printed on stdout. The
-output format can be overridden using the optional `<format>` argument. If
-either `--textconv` or `--filters` was specified, the input is expected to
-list the object names followed by the path name, separated by a single
-whitespace, so that the appropriate drivers can be determined.
+Output the contents or other properties such as size, type or delta
+information of one or more objects.
+
+This command can operate in two modes, depending on whether an option
+from the `--batch` family is specified.
+
+In non-batch mode, the command provides information on an object
+named on the command line.
+
+In batch mode, arguments are read from standard input.
 
 OPTIONS
 -------
@@ -51,8 +49,8 @@ OPTIONS
 
 -e::
        Exit with zero status if `<object>` exists and is a valid
-       object. If `<object>` is of an invalid format exit with non-zero and
-       emits an error on stderr.
+       object. If `<object>` is of an invalid format, exit with non-zero
+       status and emit an error on stderr.
 
 -p::
        Pretty-print the contents of `<object>` based on its type.
index 6e4f3aaf34c9579004be4c3f8d644287913f1505..cb5a6c8f335e128408e9b6b54cbb4037751e7932 100644 (file)
@@ -29,7 +29,7 @@ OPTIONS
 
 --stdin::
        Read pathnames from the standard input, one per line,
-       instead of from the command-line.
+       instead of from the command line.
 
 -z::
        The output format is modified to be machine-parsable.
@@ -38,7 +38,7 @@ OPTIONS
 
 --source=<tree-ish>::
        Check attributes against the specified tree-ish. It is common to
-       specify the source tree by naming a commit, branch or tag associated
+       specify the source tree by naming a commit, branch, or tag associated
        with it.
 
 \--::
@@ -60,7 +60,7 @@ unless `-z` is in effect, in which case NUL is used as delimiter:
 
 
 <path> is the path of a file being queried, <attribute> is an attribute
-being queried and <info> can be either:
+being queried, and <info> can be either:
 
 'unspecified';; when the attribute is not defined for the path.
 'unset';;      when the attribute is defined as false.
index 2892799e32f9855bba3b5244e7051d11618fa846..3e3b4e344629d951e7318dace83f38d5752fc76c 100644 (file)
@@ -50,7 +50,7 @@ linkgit:gitignore[5].
        with a NUL character instead of a linefeed character.
 
 -n, --non-matching::
-       Show given paths which don't match any pattern.  This only
+       Show given paths which don't match any pattern.  This only
        makes sense when `--verbose` is enabled, otherwise it would
        not be possible to distinguish between paths which match a
        pattern and those which don't.
index ee6a4144fbef1aebf422c2e393b6d38c8fb4fb60..2aacfd18088d6506bfd8aa3ca7380888e8dbcffa 100644 (file)
@@ -48,7 +48,7 @@ Git imposes the following rules on how references are named:
 
 . They cannot begin or end with a slash `/` or contain multiple
   consecutive slashes (see the `--normalize` option below for an
-  exception to this rule)
+  exception to this rule).
 
 . They cannot end with a dot `.`.
 
@@ -85,7 +85,7 @@ The rule `git check-ref-format --branch $name` implements
 may be stricter than what `git check-ref-format refs/heads/$name`
 says (e.g. a dash may appear at the beginning of a ref component,
 but it is explicitly forbidden at the beginning of a branch name).
-When run with `--branch` option in a repository, the input is first
+When run with the `--branch` option in a repository, the input is first
 expanded for the ``previous checkout syntax''
 `@{-n}`.  For example, `@{-1}` is a way to refer the last thing that
 was checked out using "git switch" or "git checkout" operation.
index 01dbd5cbf540ea96de2a1fd9b9ce0580077c29fa..faf8d6ca36fb7c3bfd7a8e880efe284746cdc94d 100644 (file)
@@ -18,7 +18,7 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Will copy all files listed from the index to the working directory
+Copies all listed files from the index to the working directory
 (not overwriting existing files).
 
 OPTIONS
@@ -53,11 +53,11 @@ OPTIONS
 
 --stage=<number>|all::
        Instead of checking out unmerged entries, copy out the
-       files from named stage.  <number> must be between 1 and 3.
+       files from the named stage.  <number> must be between 1 and 3.
        Note: --stage=all automatically implies --temp.
 
 --temp::
-       Instead of copying the files to the working directory
+       Instead of copying the files to the working directory,
        write the content to temporary files.  The temporary name
        associations will be written to stdout.
 
@@ -66,8 +66,8 @@ OPTIONS
        set.
 
 --stdin::
-       Instead of taking list of paths from the command line,
-       read list of paths from the standard input.  Paths are
+       Instead of taking list of paths from the command line,
+       read the list of paths from the standard input.  Paths are
        separated by LF (i.e. one path per line) by default.
 
 -z::
index 4af0904f4729b463d3b63bf3479f5e4b313773fd..8bdfa54ab09b4c4e8e4cb61767527e2ec06900b2 100644 (file)
@@ -12,8 +12,10 @@ SYNOPSIS
 'git checkout' [-q] [-f] [-m] --detach [<branch>]
 'git checkout' [-q] [-f] [-m] [--detach] <commit>
 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new-branch>] [<start-point>]
-'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>...
-'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] --pathspec-from-file=<file> [--pathspec-file-nul]
+'git checkout' [-f] <tree-ish> [--] <pathspec>...
+'git checkout' [-f] <tree-ish> --pathspec-from-file=<file> [--pathspec-file-nul]
+'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [--] <pathspec>...
+'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] --pathspec-from-file=<file> [--pathspec-file-nul]
 'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]
 
 DESCRIPTION
@@ -41,7 +43,7 @@ $ git checkout -b <branch> --track <remote>/<branch>
 You could omit `<branch>`, in which case the command degenerates to
 "check out the current branch", which is a glorified no-op with
 rather expensive side-effects to show only the tracking information,
-if exists, for the current branch.
+if it exists, for the current branch.
 
 'git checkout' -b|-B <new-branch> [<start-point>]::
 
@@ -61,7 +63,9 @@ $ git checkout <branch>
 ------------
 +
 that is to say, the branch is not reset/created unless "git checkout" is
-successful.
+successful (e.g., when the branch is in use in another worktree, not
+just the current branch stays the same, but the branch is not reset to
+the start-point, either).
 
 'git checkout' --detach [<branch>]::
 'git checkout' [--detach] <commit>::
@@ -213,7 +217,7 @@ variable.
        below for details.
 
 --orphan <new-branch>::
-       Create a new 'orphan' branch, named `<new-branch>`, started from
+       Create a new unborn branch, named `<new-branch>`, started from
        `<start-point>` and switch to it.  The first commit made on this
        new branch will have no parents and it will be the root of a new
        history totally disconnected from all the other branches and
@@ -260,7 +264,8 @@ and mark the resolved paths with `git add` (or `git rm` if the merge
 should result in deletion of the path).
 +
 When checking out paths from the index, this option lets you recreate
-the conflicted merge in the specified paths.
+the conflicted merge in the specified paths.  This option cannot be
+used when checking out paths from a tree-ish.
 +
 When switching branches with `--merge`, staged changes may be lost.
 
index 160d08b86bb8583e9464373aef9cafea638003cb..fd171654163c1fc4e34de3b24cdd4063a604dae1 100644 (file)
@@ -37,7 +37,7 @@ OPTIONS
 --force::
        If the Git configuration variable clean.requireForce is not set
        to false, 'git clean' will refuse to delete files or directories
-       unless given -f or -i.  Git will refuse to modify untracked
+       unless given -f.  Git will refuse to modify untracked
        nested git repositories (directories with a .git subdirectory)
        unless a second -f is given.
 
@@ -45,10 +45,14 @@ OPTIONS
 --interactive::
        Show what would be done and clean files interactively. See
        ``Interactive mode'' for details.
+       Configuration variable `clean.requireForce` is ignored, as
+       this mode gives its own safety protection by going interactive.
 
 -n::
 --dry-run::
        Don't actually remove anything, just show what would be done.
+       Configuration variable `clean.requireForce` is ignored, as
+       nothing will be deleted anyway.
 
 -q::
 --quiet::
@@ -103,7 +107,7 @@ filter by pattern::
    This shows the files and directories to be deleted and issues an
    "Input ignore patterns>>" prompt. You can input space-separated
    patterns to exclude files and directories from deletion.
-   E.g. "*.c *.h" will excludes files end with ".c" and ".h" from
+   E.g. "*.c *.h" will exclude files ending with ".c" and ".h" from
    deletion. When you are satisfied with the filtered result, press
    ENTER (empty) back to the main menu.
 
@@ -127,7 +131,7 @@ ask each::
 
 quit::
 
-  This lets you quit without do cleaning.
+  This lets you quit without doing any cleaning.
 
 help::
 
index c37c4a37f7412c0b712d14067c2d7c7d975933c5..f90977a8519b4c9c057438afa042b4bd25855567 100644 (file)
@@ -102,9 +102,9 @@ its source repository, you can simply run `git repack -a` to copy all
 objects from the source repository into a pack in the cloned repository.
 
 --reference[-if-able] <repository>::
-       If the reference repository is on the local machine,
+       If the reference _<repository>_ is on the local machine,
        automatically setup `.git/objects/info/alternates` to
-       obtain objects from the reference repository.  Using
+       obtain objects from the reference _<repository>_.  Using
        an already existing repository as an alternate will
        require fewer objects to be copied from the repository
        being cloned, reducing network and local storage costs.
@@ -156,13 +156,13 @@ objects from the source repository into a pack in the cloned repository.
 
 --[no-]reject-shallow::
        Fail if the source repository is a shallow repository.
-       The 'clone.rejectShallow' configuration variable can be used to
+       The `clone.rejectShallow` configuration variable can be used to
        specify the default.
 
 --bare::
        Make a 'bare' Git repository.  That is, instead of
-       creating `<directory>` and placing the administrative
-       files in `<directory>/.git`, make the `<directory>`
+       creating _<directory>_ and placing the administrative
+       files in `<directory>/.git`, make the _<directory>_
        itself the `$GIT_DIR`. This obviously implies the `--no-checkout`
        because there is nowhere to check out the working tree.
        Also the branch heads at the remote are copied directly
@@ -180,11 +180,11 @@ objects from the source repository into a pack in the cloned repository.
 --filter=<filter-spec>::
        Use the partial clone feature and request that the server sends
        a subset of reachable objects according to a given object filter.
-       When using `--filter`, the supplied `<filter-spec>` is used for
+       When using `--filter`, the supplied _<filter-spec>_ is used for
        the partial clone filter. For example, `--filter=blob:none` will
        filter out all blobs (file contents) until needed by Git. Also,
        `--filter=blob:limit=<size>` will filter out all blobs of size
-       at least `<size>`. For more details on filter specifications, see
+       at least _<size>_. For more details on filter specifications, see
        the `--filter` option in linkgit:git-rev-list[1].
 
 --also-filter-submodules::
@@ -203,13 +203,13 @@ objects from the source repository into a pack in the cloned repository.
 -o <name>::
 --origin <name>::
        Instead of using the remote name `origin` to keep track of the upstream
-       repository, use `<name>`.  Overrides `clone.defaultRemoteName` from the
+       repository, use _<name>_.  Overrides `clone.defaultRemoteName` from the
        config.
 
 -b <name>::
 --branch <name>::
        Instead of pointing the newly created HEAD to the branch pointed
-       to by the cloned repository's HEAD, point to `<name>` branch
+       to by the cloned repository's HEAD, point to _<name>_ branch
        instead. In a non-bare repository, this is the branch that will
        be checked out.
        `--branch` can also take tags and detaches the HEAD at that commit
@@ -230,7 +230,7 @@ objects from the source repository into a pack in the cloned repository.
        Set a configuration variable in the newly-created repository;
        this takes effect immediately after the repository is
        initialized, but before the remote history is fetched or any
-       files checked out.  The key is in the same format as expected by
+       files checked out.  The _<key>_ is in the same format as expected by
        linkgit:git-config[1] (e.g., `core.eol=true`). If multiple
        values are given for the same key, each value will be written to
        the config file. This makes it safe, for example, to add
@@ -263,7 +263,7 @@ corresponding `--mirror` and `--no-tags` options instead.
        branch remote's `HEAD` points at.
        Further fetches into the resulting repository will only update the
        remote-tracking branch for the branch this option was used for the
-       initial cloning.  If the HEAD at the remote did not point at any
+       initial cloning.  If the `HEAD` at the remote did not point at any
        branch when `--single-branch` clone was made, no remote-tracking
        branch is created.
 
@@ -281,7 +281,7 @@ branch of some repository for search indexing.
 
 --recurse-submodules[=<pathspec>]::
        After the clone is created, initialize and clone submodules
-       within based on the provided pathspec.  If no pathspec is
+       within based on the provided _<pathspec>_.  If no _=<pathspec>_ is
        provided, all submodules are initialized and cloned.
        This option can be given multiple times for pathspecs consisting
        of multiple entries.  The resulting clone has `submodule.active` set to
@@ -311,26 +311,32 @@ or `--mirror` is given)
        The result is Git repository can be separated from working
        tree.
 
+--ref-format=<ref-format>::
+
+Specify the given ref storage format for the repository. The valid values are:
++
+include::ref-storage-format.txt[]
+
 -j <n>::
 --jobs <n>::
        The number of submodules fetched at the same time.
        Defaults to the `submodule.fetchJobs` option.
 
 <repository>::
-       The (possibly remote) repository to clone from.  See the
+       The (possibly remote) _<repository>_ to clone from.  See the
        <<URLS,GIT URLS>> section below for more information on specifying
        repositories.
 
 <directory>::
        The name of a new directory to clone into.  The "humanish"
-       part of the source repository is used if no directory is
+       part of the source repository is used if no _<directory>_ is
        explicitly given (`repo` for `/path/to/repo.git` and `foo`
        for `host.xz:foo/.git`).  Cloning into an existing directory
        is only allowed if the directory is empty.
 
 --bundle-uri=<uri>::
        Before fetching from the remote, fetch a bundle from the given
-       `<uri>` and unbundle the data into the local repository. The refs
+       _<uri>_ and unbundle the data into the local repository. The refs
        in the bundle will be stored under the hidden `refs/bundle/*`
        namespace. This option is incompatible with `--depth`,
        `--shallow-since`, and `--shallow-exclude`.
index c8dbceba014639524ccf2b7b1897190a9fc3c0a0..903b16830ea22529f476f9fadbe0c7aac4b31c12 100644 (file)
@@ -13,7 +13,7 @@ SYNOPSIS
 'git commit-graph write' [--object-dir <dir>] [--append]
                        [--split[=<strategy>]] [--reachable | --stdin-packs | --stdin-commits]
                        [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]
-                       <split options>
+                       <split-options>
 
 
 DESCRIPTION
index 225c6c9f2e5f8f513e1e56ae77bc45d8c2097da4..a6cef5d82038771c5f7e91f788f14de6394de158 100644 (file)
@@ -541,7 +541,7 @@ DISCUSSION
 ----------
 
 Though not required, it's a good idea to begin the commit message
-with a single short (less than 50 character) line summarizing the
+with a single short (no more than 50 characters) line summarizing the
 change, followed by a blank line and then a more thorough description.
 The text up to the first blank line in a commit message is treated
 as the commit title, and that title is used throughout Git.
index 7a2bcb2f6cb6f94b677d47de49ae8c6d0b98f2b8..a6e82b871b52f7a6c8eb282c8c126f00f1917f87 100644 (file)
@@ -103,11 +103,11 @@ OPTIONS
        names are not.
 
 --get-urlmatch <name> <URL>::
-       When given a two-part name section.key, the value for
-       section.<URL>.key whose <URL> part matches the best to the
+       When given a two-part <name> as <section>.<key>, the value for
+       <section>.<URL>.<key> whose <URL> part matches the best to the
        given URL is returned (if no such key exists, the value for
-       section.key is used as a fallback).  When given just the
-       section as name, do so for all the keys in the section and
+       <section>.<key> is used as a fallback).  When given just the
+       <section> as name, do so for all the keys in the section and
        list them.  Returns error code 1 if no value is found.
 
 --global::
@@ -201,7 +201,7 @@ Valid `<type>`'s include:
   1073741824 upon input.
 - 'bool-or-int': canonicalize according to either 'bool' or 'int', as described
   above.
-- 'path': canonicalize by adding a leading `~` to the value of `$HOME` and
+- 'path': canonicalize by expanding a leading `~` to the value of `$HOME` and
   `~user` to the home directory for the specified user. This specifier has no
   effect when setting the value (but you can use `git config section.variable
   ~/` from the command line to let your shell do the expansion.)
@@ -275,7 +275,8 @@ Valid `<type>`'s include:
 -e::
 --edit::
        Opens an editor to modify the specified config file; either
-       `--system`, `--global`, or repository (default).
+       `--system`, `--global`, `--local` (default), `--worktree`, or
+       `--file <config-file>`.
 
 --[no-]includes::
        Respect `include.*` directives in config files when looking up
@@ -285,7 +286,7 @@ Valid `<type>`'s include:
 
 --default <value>::
   When using `--get`, and the requested variable is not found, behave as if
-  <value> were the value assigned to the that variable.
+  <value> were the value assigned to that variable.
 
 CONFIGURATION
 -------------
index cb9b4d2e460adaa46ee863c37283840c2bdb9333..97f9f1261010f5473b6748dc3dc0a2e0a93fd4f5 100644 (file)
@@ -12,7 +12,7 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-This counts the number of unpacked object files and disk space consumed by
+Counts the number of unpacked object files and disk space consumed by
 them, to help you decide when it is a good time to repack.
 
 
@@ -20,7 +20,7 @@ OPTIONS
 -------
 -v::
 --verbose::
-       Report in more detail:
+       Provide more detailed reports:
 +
 count: the number of loose objects
 +
@@ -33,7 +33,7 @@ size-pack: disk space consumed by the packs, in KiB (unless -H is specified)
 prune-packable: the number of loose objects that are also present in
 the packs. These objects could be pruned using `git prune-packed`.
 +
-garbage: the number of files in object database that are neither valid loose
+garbage: the number of files in the object database that are neither valid loose
 objects nor valid packs
 +
 size-garbage: disk space consumed by garbage files, in KiB (unless -H is
index f473994a864e9575d57844e1640e8dfb4eea00dd..487cc557a87feaa688d5e333dcecd2f83eb1ec48 100644 (file)
@@ -16,7 +16,7 @@ DESCRIPTION
 
 This command caches credentials for use by future Git programs.
 The stored credentials are kept in memory of the cache-daemon
-process (instead of written to a file) and are forgotten after a
+process (instead of being written to a file) and are forgotten after a
 configurable timeout. Credentials are forgotten sooner if the
 cache-daemon dies, for example if the system restarts. The cache
 is accessible over a Unix domain socket, restricted to the current
index 76b0798856336fe739e8325ed1b5716abb099bfe..71864a872642e85734d86f1c52479e7a22b1dfe0 100644 (file)
@@ -33,7 +33,7 @@ OPTIONS
 
        Use `<path>` to lookup and store credentials. The file will have its
        filesystem permissions set to prevent other users on the system
-       from reading it, but will not be encrypted or otherwise
+       from reading it, but it will not be encrypted or otherwise
        protected. If not specified, credentials will be searched for from
        `~/.git-credentials` and `$XDG_CONFIG_HOME/git/credentials`, and
        credentials will be written to `~/.git-credentials` if it exists, or
index a220afed4f35ba2a2ea1d7bd68dd07b1353d3522..918a0aa42b24156ce814ba61cd2006928807ee08 100644 (file)
@@ -94,7 +94,7 @@ unlocked) before it returned `password=secr3t`.
      that `git credential` will ask for a new password in its next
      invocation. In either case, `git credential` should be fed with
      the credential description obtained from step (2) (which also
-     contain the ones provided in step (1)).
+     contains the fields provided in step (1)).
 
 [[IOFMT]]
 INPUT/OUTPUT FORMAT
index b3f27671a0c6eb20bfd2bce88bcc74079691fe70..90fdc2551a349939a0cbf9ab12d792ab20f0b765 100644 (file)
@@ -22,7 +22,7 @@ DESCRIPTION
 deprecated; it does not work with cvsps version 3 and later.  If you are
 performing a one-shot import of a CVS repository consider using
 http://cvs2svn.tigris.org/cvs2git.html[cvs2git] or
-http://www.catb.org/esr/cvs-fast-export/[cvs-fast-export].
+https://gitlab.com/esr/cvs-fast-export[cvs-fast-export].
 
 Imports a CVS repository into Git. It will either create a new
 repository, or incrementally import into an existing one.
@@ -221,7 +221,7 @@ Problems related to tags:
 If you suspect that any of these issues may apply to the repository you
 want to import, consider using cvs2git:
 
-* cvs2git (part of cvs2svn), `http://subversion.apache.org/`
+* cvs2git (part of cvs2svn), `https://subversion.apache.org/`
 
 GIT
 ---
index cf4a5a283ecd68f49fb3051b2f27007074eac4ef..4c475efeab976aefafa3dc64d41d3dcf303f63b6 100644 (file)
@@ -197,7 +197,7 @@ allowing access over SSH.
 5. Clients should now be able to check out the project. Use the CVS 'module'
    name to indicate what Git 'head' you want to check out.  This also sets the
    name of your newly checked-out directory, unless you tell it otherwise with
-   `-d <dir_name>`.  For example, this checks out 'master' branch to the
+   `-d <dir-name>`.  For example, this checks out 'master' branch to the
    `project-master` directory:
 +
 ------
@@ -224,7 +224,7 @@ the database to work reliably (otherwise you need to make sure
 that the database is up to date any time 'git-cvsserver' is executed).
 
 By default it uses SQLite databases in the Git directory, named
-`gitcvs.<module_name>.sqlite`. Note that the SQLite backend creates
+`gitcvs.<module-name>.sqlite`. Note that the SQLite backend creates
 temporary files in the same directory as the database file on
 write so it might not be enough to grant the users using
 'git-cvsserver' write access to the database file without granting
index 236df516c7313d702f9908229afa4d4030e154ab..ede7b935d649472534dcc1bd9258c1d12231ca32 100644 (file)
@@ -18,7 +18,7 @@ SYNOPSIS
             [--allow-override=<service>] [--forbid-override=<service>]
             [--access-hook=<path>] [--[no-]informative-errors]
             [--inetd |
-             [--listen=<host_or_ipaddr>] [--port=<n>]
+             [--listen=<host-or-ipaddr>] [--port=<n>]
              [--user=<user> [--group=<group>]]]
             [--log-destination=(stderr|syslog|none)]
             [<directory>...]
@@ -86,10 +86,10 @@ OPTIONS
        Incompatible with --detach, --port, --listen, --user and --group
        options.
 
---listen=<host_or_ipaddr>::
+--listen=<host-or-ipaddr>::
        Listen on a specific IP address or hostname.  IP addresses can
        be either an IPv4 address or an IPv6 address if supported.  If IPv6
-       is not supported, then --listen=hostname is also not supported and
+       is not supported, then --listen=<hostname> is also not supported and
        --listen must be given an IPv4 address.
        Can be given more than once.
        Incompatible with `--inetd` option.
@@ -138,11 +138,11 @@ otherwise `stderr`.
 --user-path::
 --user-path=<path>::
        Allow {tilde}user notation to be used in requests.  When
-       specified with no parameter, requests to
+       specified with no parameter, a request to
        git://host/{tilde}alice/foo is taken as a request to access
        'foo' repository in the home directory of user `alice`.
-       If `--user-path=path` is specified, the same request is
-       taken as a request to access `path/foo` repository in
+       If `--user-path=<path>` is specified, the same request is
+       taken as a request to access `<path>/foo` repository in
        the home directory of user `alice`.
 
 --verbose::
index 3ec8cc7ad72374b9c82db916b95ac0f6d56d5f32..0711959e6f6eaa6af5b8931058760b47189e6ba5 100644 (file)
@@ -45,7 +45,7 @@ OPTIONS
 -s <format>::
 --suffix <format>::
        Specify an alternate suffix for the diagnostics archive name, to create
-       a file named 'git-diagnostics-<formatted suffix>'. This should take the
+       a file named 'git-diagnostics-<formatted-suffix>'. This should take the
        form of a strftime(3) format string; the current local time will be
        used.
 
index 591e3801b7b164cfdf412864cee46a7612b21fd2..bf78e3143138136f4e2c3998799a16a19f2dc3bb 100644 (file)
@@ -26,7 +26,7 @@ include::diff-options.txt[]
 -2 --ours::
 -3 --theirs::
 -0::
-       Diff against the "base" version, "our branch" or "their
+       Diff against the "base" version, "our branch", or "their
        branch" respectively.  With these options, diffs for
        merged entries are not shown.
 +
@@ -37,12 +37,12 @@ omit diff output for unmerged entries and just show "Unmerged".
 -c::
 --cc::
        This compares stage 2 (our branch), stage 3 (their
-       branch) and the working tree file and outputs a combined
+       branch), and the working tree file and outputs a combined
        diff, similar to the way 'diff-tree' shows a merge
        commit with these flags.
 
 -q::
-       Remain silent even on nonexistent files
+       Remain silent even for nonexistent files
 
 
 include::diff-format.txt[]
index c30d8f0da8a28ff309185bf3878e3a462074d627..4de1d4c8f11e6065da2c60c0112b72f85af7daa3 100644 (file)
@@ -13,10 +13,10 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Compares the content and mode of the blobs found in a tree object
+Compare the content and mode of the blobs found in a tree object
 with the corresponding tracked files in the working tree, or with the
 corresponding paths in the index.  When <path> arguments are present,
-compares only paths matching those patterns.  Otherwise all tracked
+compare only paths matching those patterns.  Otherwise all tracked
 files are compared.
 
 OPTIONS
index 274d5eaba93dab2cb0374c64ea95934693c73ddf..143318c411a0761777d8a318450b4a71b69870d7 100644 (file)
@@ -15,7 +15,7 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Compares the content and mode of the blobs found via two tree objects.
+Compare the content and mode of blobs found via two tree objects.
 
 If there is only one <tree-ish> given, the commit is compared with its parents
 (see --stdin below).
@@ -34,10 +34,10 @@ include::diff-options.txt[]
        matching one of the provided pathspecs.
 
 -r::
-        recurse into sub-trees
+       Recurse into sub-trees.
 
 -t::
-       show tree entry itself as well as subtrees.  Implies -r.
+       Show tree entry itself as well as subtrees.  Implies -r.
 
 --root::
        When `--root` is specified the initial commit will be shown as a big
@@ -78,7 +78,7 @@ commits (but not trees).
        By default, 'git diff-tree --stdin' shows differences,
        either in machine-readable form (without `-p`) or in patch
        form (with `-p`).  This output can be suppressed.  It is
-       only useful with `-v` flag.
+       only useful with the `-v` flag.
 
 -v::
        This flag causes 'git diff-tree --stdin' to also show
@@ -104,10 +104,10 @@ include::pretty-options.txt[]
        This flag changes the way a merge commit patch is displayed,
        in a similar way to the `-c` option. It implies the `-c`
        and `-p` options and further compresses the patch output
-       by omitting uninteresting hunks whose the contents in the parents
+       by omitting uninteresting hunks whose contents in the parents
        have only two variants and the merge result picks one of them
        without modification.  When all hunks are uninteresting, the commit
-       itself and the commit log message is not shown, just like in any other
+       itself and the commit log message are not shown, just like in any other
        "empty diff" case.
 
 --combined-all-paths::
index 08087ffad5fe9929cc04629ba4aeaa4240f457e4..c065f023eca3fb1ce60c4c41d60d35c14b5c916b 100644 (file)
@@ -103,7 +103,7 @@ Just in case you are doing something exotic, it should be
 noted that all of the <commit> in the above description, except
 in the `--merge-base` case and in the last two forms that use `..`
 notations, can be any <tree>. A tree of interest is the one pointed to
-by the special ref `AUTO_MERGE`, which is written by the 'ort' merge
+by the ref named `AUTO_MERGE`, which is written by the 'ort' merge
 strategy upon hitting merge conflicts (see linkgit:git-merge[1]).
 Comparing the working tree with `AUTO_MERGE` shows changes you've made
 so far to resolve textual conflicts (see the examples below).
index ac0ac6fa02205a5946beaafc538c0764bee85cb4..a616f8b2e6f349d4fa8f7454c5ba48a219719842 100644 (file)
@@ -36,7 +36,7 @@ OPTIONS
 
 --rotate-to=<file>::
        Start showing the diff for the given path,
-       the paths before it will move to end and output.
+       the paths before it will move to the end and output.
 
 --skip-to=<file>::
        Start showing the diff for the given path, skipping all
@@ -78,7 +78,7 @@ with custom merge tool commands and has the same value as `$MERGED`.
        Print a list of diff tools that may be used with `--tool`.
 
 --[no-]symlinks::
-       'git difftool''s default behavior is create symlinks to the
+       'git difftool''s default behavior is to create symlinks to the
        working tree when run in `--dir-diff` mode and the right-hand
        side of the comparison yields the same content as the file in
        the working tree.
@@ -90,7 +90,7 @@ instead.  `--no-symlinks` is the default on Windows.
 --extcmd=<command>::
        Specify a custom command for viewing diffs.
        'git-difftool' ignores the configured defaults and runs
-       `$command $LOCAL $REMOTE` when this option is specified.
+       `<command> $LOCAL $REMOTE` when this option is specified.
        Additionally, `$BASE` is set in the environment.
 
 -g::
@@ -105,7 +105,6 @@ instead.  `--no-symlinks` is the default on Windows.
        `merge.tool` until a tool is found.
 
 --[no-]trust-exit-code::
-       'git-difftool' invokes a diff tool individually on each file.
        Errors reported by the diff tool are ignored by default.
        Use `--trust-exit-code` to make 'git-difftool' exit when an
        invoked diff tool returns a non-zero exit code.
index 4643ddbe68fd0c0eeb541df356ca3fc2bd2ee9d4..752e4b9b01d7d8a5527d1fe9a615ad8493e3f4bf 100644 (file)
@@ -48,7 +48,7 @@ When asking to 'abort' (which is the default), this program will die
 when encountering such a tag.  With 'drop' it will omit such tags from
 the output.  With 'rewrite', if the tagged object is a commit, it will
 rewrite the tag to tag an ancestor commit (via parent rewriting; see
-linkgit:git-rev-list[1])
+linkgit:git-rev-list[1]).
 
 -M::
 -C::
index 8b5dd6add006d111688fc1193d77ebe6b45422a5..b2607366b91458aabefc5f2e4814959a5ba9555c 100644 (file)
@@ -622,7 +622,7 @@ in octal.  Git only supports the following modes:
 * `100755` or `755`: A normal, but executable, file.
 * `120000`: A symlink, the content of the file will be the link target.
 * `160000`: A gitlink, SHA-1 of the object refers to a commit in
-  another repository. Git links can only be specified by SHA or through
+  another repository. Git links can only be specified either by SHA or through
   a commit mark. They are used to implement submodules.
 * `040000`: A subdirectory.  Subdirectories can only be specified by
   SHA or through a tree mark set with `--import-marks`.
@@ -745,11 +745,11 @@ paths for a commit are encouraged to do so.
 
 `notemodify`
 ^^^^^^^^^^^^
-Included in a `commit` `<notes_ref>` command to add a new note
+Included in a `commit` `<notes-ref>` command to add a new note
 annotating a `<commit-ish>` or change this annotation contents.
 Internally it is similar to filemodify 100644 on `<commit-ish>`
 path (maybe split into subdirectories). It's not advised to
-use any other commands to write to the `<notes_ref>` tree except
+use any other commands to write to the `<notes-ref>` tree except
 `filedeleteall` to delete all existing notes in this tree.
 This command has two different means of specifying the content
 of the note.
@@ -1353,7 +1353,7 @@ the marks back to the source repository, it is easy to verify the
 accuracy and completeness of the import by comparing each Git
 commit to the corresponding source revision.
 
-Coming from a system such as Perforce or Subversion this should be
+Coming from a system such as Perforce or Subversion, this should be
 quite simple, as the fast-import mark can also be the Perforce changeset
 number or the Subversion revision number.
 
index 46747d5f429164f817444cd502d8bff4dc5cbe4d..b3467664d30bde111af06ec0e915e6def2b1b4b2 100644 (file)
@@ -69,7 +69,7 @@ be in a separate packet, and the list must end with a flush packet.
 
 --upload-pack=<git-upload-pack>::
        Use this to specify the path to 'git-upload-pack' on the
-       remote side, if is not found on your $PATH.
+       remote side, if it is not found on your $PATH.
        Installations of sshd ignores the user's environment
        setup scripts for login shells (e.g. .bash_profile) and
        your privately installed git may not be found on the system
index f123139c581001d2bcbd94dcc187775e58e8fd6c..50900a50dabce9cd5fcee479461c42466359cad5 100644 (file)
@@ -186,8 +186,8 @@ origin:
 ------------------------------------------------
 $ git fetch origin --prune --prune-tags
 $ git fetch origin --prune 'refs/tags/*:refs/tags/*'
-$ git fetch <url of origin> --prune --prune-tags
-$ git fetch <url of origin> --prune 'refs/tags/*:refs/tags/*'
+$ git fetch <url-of-origin> --prune --prune-tags
+$ git fetch <url-of-origin> --prune 'refs/tags/*:refs/tags/*'
 ------------------------------------------------
 
 OUTPUT
index 62e482a95e23fd87aa0bc5496a0584a7a7285f85..5a4f853785d119884c41de7f51b4057510f1ccf3 100644 (file)
@@ -14,7 +14,7 @@ SYNOPSIS
        [--msg-filter <command>] [--commit-filter <command>]
        [--tag-name-filter <command>] [--prune-empty]
        [--original <namespace>] [-d <directory>] [-f | --force]
-       [--state-branch <branch>] [--] [<rev-list options>...]
+       [--state-branch <branch>] [--] [<rev-list-options>...]
 
 WARNING
 -------
@@ -32,7 +32,7 @@ listed there as reasonably possible.
 DESCRIPTION
 -----------
 Lets you rewrite Git revision history by rewriting the branches mentioned
-in the <rev-list options>, applying custom filters on each revision.
+in the <rev-list-options>, applying custom filters on each revision.
 Those filters can modify each tree (e.g. removing a file or running
 a perl rewrite on all files) or information about each commit.
 Otherwise, all information (including original commit times or merge
@@ -624,7 +624,7 @@ with:
      real backup; it dereferences tags first.)
 
   ** Running git-filter-branch with either --tags or --all in your
-     <rev-list options>.  In order to retain annotated tags as
+     <rev-list-options>.  In order to retain annotated tags as
      annotated, you must use --tag-name-filter (and must not have
      restored from refs/original/ in a previously botched rewrite).
 
index 11b2bc3121626d047b415f805e98b380be0ef1e4..c1dd12b93cfd5c44a8d3d97c78c5f2f330f7fe3f 100644 (file)
@@ -10,7 +10,7 @@ SYNOPSIS
 [verse]
 'git for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
                   [(--sort=<key>)...] [--format=<format>]
-                  [ --stdin | <pattern>... ]
+                  [--include-root-refs] [ --stdin | <pattern>... ]
                   [--points-at=<object>]
                   [--merged[=<object>]] [--no-merged[=<object>]]
                   [--contains[=<object>]] [--no-contains[=<object>]]
@@ -51,17 +51,14 @@ OPTIONS
        key.
 
 --format=<format>::
-       A string that interpolates `%(fieldname)` from a ref being shown
-       and the object it points at.  If `fieldname`
-       is prefixed with an asterisk (`*`) and the ref points
-       at a tag object, use the value for the field in the object
-       which the tag object refers to (instead of the field in the tag object).
-       When unspecified, `<format>` defaults to
-       `%(objectname) SPC %(objecttype) TAB %(refname)`.
-       It also interpolates `%%` to `%`, and `%xx` where `xx`
-       are hex digits interpolates to character with hex code
-       `xx`; for example `%00` interpolates to `\0` (NUL),
-       `%09` to `\t` (TAB) and `%0a` to `\n` (LF).
+       A string that interpolates `%(fieldname)` from a ref being shown and
+       the object it points at. In addition, the string literal `%%`
+       renders as `%` and `%xx` - where `xx` are hex digits - renders as
+       the character with hex code `xx`. For example, `%00` interpolates to
+       `\0` (NUL), `%09` to `\t` (TAB), and `%0a` to `\n` (LF).
++
+When unspecified, `<format>` defaults to `%(objectname) SPC %(objecttype)
+TAB %(refname)`.
 
 --color[=<when>]::
        Respect any colors specified in the `--format` option. The
@@ -108,6 +105,9 @@ OPTIONS
        any excluded pattern(s) are shown. Matching is done using the
        same rules as `<pattern>` above.
 
+--include-root-refs::
+       List root refs (HEAD and pseudorefs) apart from regular refs.
+
 FIELD NAMES
 -----------
 
@@ -298,12 +298,20 @@ fields will correspond to the appropriate date or name-email-date tuple
 from the `committer` or `tagger` fields depending on the object type.
 These are intended for working on a mix of annotated and lightweight tags.
 
+For tag objects, a `fieldname` prefixed with an asterisk (`*`) expands to
+the `fieldname` value of the peeled object, rather than that of the tag
+object itself.
+
 Fields that have name-email-date tuple as its value (`author`,
 `committer`, and `tagger`) can be suffixed with `name`, `email`,
 and `date` to extract the named component.  For email fields (`authoremail`,
 `committeremail` and `taggeremail`), `:trim` can be appended to get the email
 without angle brackets, and `:localpart` to get the part before the `@` symbol
-out of the trimmed email.
+out of the trimmed email. In addition to these, the `:mailmap` option and the
+corresponding `:mailmap,trim` and `:mailmap,localpart` can be used (order does
+not matter) to get values of the name and email according to the .mailmap file
+or according to the file set in the mailmap.file or mailmap.blob configuration
+variable (see linkgit:gitmailmap[5]).
 
 The raw data in an object is `raw`.
 
@@ -354,9 +362,11 @@ In any case, a field name that refers to a field inapplicable to
 the object referred by the ref does not cause an error.  It
 returns an empty string instead.
 
-As a special case for the date-type fields, you may specify a format for
-the date by adding `:` followed by date format name (see the
-values the `--date` option to linkgit:git-rev-list[1] takes).
+As a special case for the date-type fields, you may specify a format for the
+date by adding `:` followed by date format name (see the values the `--date`
+option to linkgit:git-rev-list[1] takes). If this formatting is provided in
+a `--sort` key, references will be sorted according to the byte-value of the
+formatted string rather than the numeric value of the underlying timestamp.
 
 Some atoms like %(align) and %(if) always require a matching %(end).
 We call them "opening atoms" and sometimes denote them as %($open).
index 373b46fc0de64f4c7426f683b95f24f95ff9cd84..728bb3821c1729dffe7565fa812570c315d0f878 100644 (file)
@@ -17,10 +17,10 @@ SYNOPSIS
                   [--signature-file=<file>]
                   [-n | --numbered | -N | --no-numbered]
                   [--start-number <n>] [--numbered-files]
-                  [--in-reply-to=<message id>] [--suffix=.<sfx>]
+                  [--in-reply-to=<message-id>] [--suffix=.<sfx>]
                   [--ignore-if-in-upstream] [--always]
                   [--cover-from-description=<mode>]
-                  [--rfc] [--subject-prefix=<subject prefix>]
+                  [--rfc] [--subject-prefix=<subject-prefix>]
                   [(--reroll-count|-v) <n>]
                   [--to=<email>] [--cc=<email>]
                   [--[no-]cover-letter] [--quiet]
@@ -30,8 +30,8 @@ SYNOPSIS
                   [--range-diff=<previous> [--creation-factor=<percent>]]
                   [--filename-max-length=<n>]
                   [--progress]
-                  [<common diff options>]
-                  [ <since> | <revision range> ]
+                  [<common-diff-options>]
+                  [ <since> | <revision-range> ]
 
 DESCRIPTION
 -----------
@@ -55,7 +55,7 @@ A "message" generated by the command consists of three parts:
 * The "patch", which is the "diff -p --stat" output (see
   linkgit:git-diff[1]) between the commit and its parent.
 
-The log message and the patch is separated by a line with a
+The log message and the patch are separated by a line with a
 three-dash line.
 
 There are two ways to specify which commits to operate on.
@@ -64,7 +64,7 @@ There are two ways to specify which commits to operate on.
    to the tip of the current branch that are not in the history
    that leads to the <since> to be output.
 
-2. Generic <revision range> expression (see "SPECIFYING
+2. Generic <revision-range> expression (see "SPECIFYING
    REVISIONS" section in linkgit:gitrevisions[7]) means the
    commits in the specified range.
 
@@ -179,9 +179,9 @@ Beware that the default for 'git send-email' is to thread emails
 itself.  If you want `git format-patch` to take care of threading, you
 will want to ensure that threading is disabled for `git send-email`.
 
---in-reply-to=<message id>::
+--in-reply-to=<message-id>::
        Make the first mail (or all the mails with `--no-thread`) appear as a
-       reply to the given <message id>, which avoids breaking threads to
+       reply to the given <message-id>, which avoids breaking threads to
        provide a new patch series.
 
 --ignore-if-in-upstream::
@@ -215,11 +215,21 @@ is greater than 100 bytes, then the mode will be `message`, otherwise
 If `<mode>` is `none`, both the cover letter subject and body will be
 populated with placeholder text.
 
---subject-prefix=<subject prefix>::
+--description-file=<file>::
+       Use the contents of <file> instead of the branch's description
+       for generating the cover letter.
+
+--subject-prefix=<subject-prefix>::
        Instead of the standard '[PATCH]' prefix in the subject
-       line, instead use '[<subject prefix>]'. This
-       allows for useful naming of a patch series, and can be
-       combined with the `--numbered` option.
+       line, instead use '[<subject-prefix>]'. This can be used
+       to name a patch series, and can be combined with the
+       `--numbered` option.
++
+The configuration variable `format.subjectPrefix` may also be used
+to configure a subject prefix to apply to a given repository for
+all patches. This is often useful on mailing lists which receive
+patches for several repositories and can be used to disambiguate
+the patches (with a value of e.g. "PATCH my-project").
 
 --filename-max-length=<n>::
        Instead of the standard 64 bytes, chomp the generated output
@@ -229,9 +239,9 @@ populated with placeholder text.
        variable, or 64 if unconfigured.
 
 --rfc::
-       Alias for `--subject-prefix="RFC PATCH"`. RFC means "Request For
-       Comments"; use this when sending an experimental patch for
-       discussion rather than application.
+       Prepends "RFC" to the subject prefix (producing "RFC PATCH" by
+       default). RFC means "Request For Comments"; use this when sending
+       an experimental patch for discussion rather than application.
 
 -v <n>::
 --reroll-count=<n>::
@@ -393,7 +403,7 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
        `format.useAutoBase` configuration.
 
 --root::
-       Treat the revision argument as a <revision range>, even if it
+       Treat the revision argument as a <revision-range>, even if it
        is just a single commit (that would normally be treated as a
        <since>).  Note that root commits included in the specified
        range are always formatted as creation patches, independently
@@ -600,8 +610,8 @@ Approach #3 (external editor)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 The following Thunderbird extensions are needed:
-AboutConfig from http://aboutconfig.mozdev.org/ and
-External Editor from http://globs.org/articles.php?lng=en&pg=8
+AboutConfig from https://mjg.github.io/AboutConfig/ and
+External Editor from https://globs.org/articles.php?lng=en&pg=8
 
 1. Prepare the patch as a text file using your method of choice.
 
index b6a0f8a085ca14060681b6ed1ec812728d6e799f..5b82e4605c2e91dc647330409af81728b665a80a 100644 (file)
@@ -24,7 +24,7 @@ OPTIONS
        An object to treat as the head of an unreachability trace.
 +
 If no objects are given, 'git fsck' defaults to using the
-index file, all SHA-1 references in `refs` namespace, and all reflogs
+index file, all SHA-1 references in the `refs` namespace, and all reflogs
 (unless --no-reflogs is given) as heads.
 
 --unreachable::
@@ -64,7 +64,7 @@ index file, all SHA-1 references in `refs` namespace, and all reflogs
 --connectivity-only::
        Check only the connectivity of reachable objects, making sure
        that any objects referenced by a reachable tag, commit, or tree
-       is present. This speeds up the operation by avoiding reading
+       are present. This speeds up the operation by avoiding reading
        blobs entirely (though it does still check that referenced blobs
        exist). This will detect corruption in commits and trees, but
        not do any semantic checks (e.g., for format errors). Corruption
@@ -79,7 +79,7 @@ care about this output and want to speed it up further.
        recorded with g+w bit set, which was created by older
        versions of Git.  Existing repositories, including the
        Linux kernel, Git itself, and sparse repository have old
-       objects that triggers this check, but it is recommended
+       objects that trigger this check, but it is recommended
        to check new projects with this flag.
 
 --verbose::
index 8238eadb0e166a97537fdfd28296df6c31e7e342..8585d19f4d89870027df745197d6dc85a1944db4 100644 (file)
@@ -70,10 +70,10 @@ the change (as happening against the super repo).  However, the client
 will properly ignore these extra events, so performance may be affected
 but it will not cause an incorrect result.
 
-By default, the fsmonitor daemon refuses to work against network-mounted
+By default, the fsmonitor daemon refuses to work with network-mounted
 repositories; this may be overridden by setting `fsmonitor.allowRemote` to
 `true`. Note, however, that the fsmonitor daemon is not guaranteed to work
-correctly with all network-mounted repositories and such use is considered
+correctly with all network-mounted repositories, so such use is considered
 experimental.
 
 On Mac OS, the inter-process communication (IPC) between various Git
@@ -83,10 +83,10 @@ but not on network-mounted filesystems, NTFS, or FAT32.  Other filesystems
 may or may not have the needed support; the fsmonitor daemon is not guaranteed
 to work with these filesystems and such use is considered experimental.
 
-By default, the socket is created in the `.git` directory, however, if the
-`.git` directory is on a network-mounted filesystem, it will be instead be
+By default, the socket is created in the `.git` directory.  However, if the
+`.git` directory is on a network-mounted filesystem, it will instead be
 created at `$HOME/.git-fsmonitor-*` unless `$HOME` itself is on a
-network-mounted filesystem in which case you must set the configuration
+network-mounted filesystem, in which case you must set the configuration
 variable `fsmonitor.socketDir` to the path of a directory on a Mac OS native
 filesystem in which to create the socket file.
 
index 90806fd26aa4ac0d1fef93d25384af3799818896..b5561c458a101c32a51ccca8599d4898e166b174 100644 (file)
@@ -59,6 +59,13 @@ be performed as well.
        cruft pack instead of storing them as loose objects. `--cruft`
        is on by default.
 
+--max-cruft-size=<n>::
+       When packing unreachable objects into a cruft pack, limit the
+       size of new cruft packs to be at most `<n>` bytes. Overrides any
+       value specified via the `gc.maxCruftSize` configuration. See
+       the `--max-cruft-size` option of linkgit:git-repack[1] for
+       more.
+
 --prune=<date>::
        Prune loose objects older than date (default is 2 weeks ago,
        overridable by the config variable `gc.pruneExpire`).
index ac44d85b0b5c7f12a2d5473b3be0b0e4511cf58f..b537bb45b138f49e8298a9fdf8f26866fe8e9b72 100644 (file)
@@ -20,7 +20,7 @@ and extract the commit ID stored in it.  It reads only the first
 1024 bytes of input, thus its runtime is not influenced by the size
 of the tar archive very much.
 
-If no commit ID is found, 'git get-tar-commit-id' quietly exists with a
+If no commit ID is found, 'git get-tar-commit-id' quietly exits with a
 return code of 1.  This can happen if the archive had not been created
 using 'git archive' or if the first parameter of 'git archive' had been
 a tree ID instead of a commit ID or tag.
index dabdbe8471de5d36bf55589aa74a270901ff882e..0d0103c780af8c454db02a33c909343fb7bd51be 100644 (file)
@@ -337,7 +337,7 @@ The `--threads` option (and the grep.threads configuration) will be ignored when
 
 When grepping the object store (with `--cached` or giving tree objects), running
 with multiple threads might perform slower than single threaded if `--textconv`
-is given and there're too many text conversions. So if you experience low
+is given and there are too many text conversions. So if you experience low
 performance in this case, it might be desirable to use `--threads=1`.
 
 CONFIGURATION
index 8577f7a7d4087d347bddf39b45c9c5365e2dafa6..ef4719ae41c700f5dde933a69ae6c8cf8c5fd3bf 100644 (file)
@@ -39,10 +39,10 @@ OPTIONS
        of from the command-line.
 
 --path::
-       Hash object as it were located at the given path. The location of
-       file does not directly influence on the hash value, but path is
-       used to determine what Git filters should be applied to the object
-       before it can be placed to the object database, and, as result of
+       Hash object as if it were located at the given path. The location of
+       the file does not directly influence the hash value, but the path is
+       used to determine which Git filters should be applied to the object
+       before it can be placed in the object database.  As a result of
        applying filters, the actual blob put into the object database may
        differ from the given file. This option is mainly useful for hashing
        temporary files located outside of the working directory or files
index 2b0b5e390dcb94a651ca92ded8c1542a175f7f09..f0bedc1f96433e6d7667519c1c7d307c46d17dc3 100644 (file)
@@ -42,13 +42,13 @@ former is internally converted into the latter.
 
 To display the linkgit:git[1] man page, use `git help git`.
 
-This page can be displayed with 'git help help' or `git help --help`
+This page can be displayed with 'git help help' or `git help --help`.
 
 OPTIONS
 -------
 -a::
 --all::
-       Prints all the available commands on the standard output.
+       Print all the available commands on the standard output.
 
 --no-external-commands::
        When used with `--all`, exclude the listing of external "git-*"
@@ -59,7 +59,7 @@ OPTIONS
        aliases.
 
 --verbose::
-       When used with `--all` print description for all recognized
+       When used with `--all`, print description for all recognized
        commands. This is the default.
 
 -c::
@@ -69,10 +69,10 @@ OPTIONS
 
 -g::
 --guides::
-       Prints a list of the Git concept guides on the standard output.
+       Print a list of the Git concept guides on the standard output.
 
 --user-interfaces::
-       Prints a list of the repository, command and file interfaces
+       Print a list of the repository, command and file interfaces
        documentation on the standard output.
 +
 In-repository file interfaces such as `.git/info/exclude` are
@@ -85,7 +85,7 @@ pseudo-configuration such as the file-based `.git/hooks/*` interface
 described in linkgit:githooks[5].
 
 --developer-interfaces::
-       Print list of file formats, protocols and other developer
+       Print list of file formats, protocols and other developer
        interfaces documentation on the standard output.
 
 -i::
@@ -109,7 +109,7 @@ other display programs (see below).
        format. A web browser will be used for that purpose.
 +
 The web browser can be specified using the configuration variable
-`help.browser`, or `web.browser` if the former is not set. If none of
+`help.browser`, or `web.browser` if the former is not set. If neither of
 these config variables is set, the 'git web{litdd}browse' helper script
 (called by 'git help') will pick a suitable default. See
 linkgit:git-web{litdd}browse[1] for more information about this.
@@ -129,8 +129,8 @@ line option:
 * "info" corresponds to '-i|--info',
 * "web" or "html" correspond to '-w|--web'.
 
-help.browser, web.browser and browser.<tool>.path
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+help.browser, web.browser, and browser.<tool>.path
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The `help.browser`, `web.browser` and `browser.<tool>.path` will also
 be checked if the 'web' format is chosen (either by command-line
index 3407f3c2c078264505d28455c93c6ec5424234b1..f6cc72d2ca9c7090c5391618d67abbfe1a1dd8e6 100644 (file)
@@ -13,7 +13,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-A command interface to running git hooks (see linkgit:githooks[5]),
+A command interface for running git hooks (see linkgit:githooks[5]),
 for use by other scripted git commands.
 
 SUBCOMMANDS
@@ -32,7 +32,7 @@ OPTIONS
 -------
 
 --to-stdin::
-       For "run"; Specify a file which will be streamed into the
+       For "run"; specify a file which will be streamed into the
        hook's stdin. The hook will receive the entire file from
        beginning to EOF.
 
index 0c5c0dde19f0b0f4fe271c1d9e7a5dcc01efe48e..f37ddaded82b42b5093ad9b1ea791c2979d743f1 100644 (file)
@@ -23,7 +23,7 @@ discussion of `GIT_PROTOCOL` in the ENVIRONMENT section below.
 It verifies that the directory has the magic file
 "git-daemon-export-ok", and it will refuse to export any Git directory
 that hasn't explicitly been marked for export this way (unless the
-`GIT_HTTP_EXPORT_ALL` environmental variable is set).
+`GIT_HTTP_EXPORT_ALL` environment variable is set).
 
 By default, only the `upload-pack` service is enabled, which serves
 'git fetch-pack' and 'git ls-remote' clients, which are invoked from
@@ -42,12 +42,12 @@ http.getanyfile::
        any file within the repository, including objects that are
        no longer reachable from a branch but are still present.
        It is enabled by default, but a repository can disable it
-       by setting this configuration item to `false`.
+       by setting this configuration value to `false`.
 
 http.uploadpack::
        This serves 'git fetch-pack' and 'git ls-remote' clients.
        It is enabled by default, but a repository can disable it
-       by setting this configuration item to `false`.
+       by setting this configuration value to `false`.
 
 http.receivepack::
        This serves 'git send-pack' clients, allowing push.  It is
@@ -265,12 +265,12 @@ by the invoking web server, including:
 * QUERY_STRING
 * REQUEST_METHOD
 
-The `GIT_HTTP_EXPORT_ALL` environmental variable may be passed to
+The `GIT_HTTP_EXPORT_ALL` environment variable may be passed to
 'git-http-backend' to bypass the check for the "git-daemon-export-ok"
 file in each repository before allowing export of that repository.
 
 The `GIT_HTTP_MAX_REQUEST_BUFFER` environment variable (or the
-`http.maxRequestBuffer` config variable) may be set to change the
+`http.maxRequestBuffer` config option) may be set to change the
 largest ref negotiation request that git will handle during a fetch; any
 fetch requiring a larger buffer will not succeed.  This value should not
 normally need to be changed, but may be helpful if you are fetching from
index 319062c021bb2c44686cd993898d502405531646..4ec7c68d3b9ecd18b3358563c2c1de4addff6eb0 100644 (file)
@@ -31,7 +31,7 @@ commit-id::
        Report what is downloaded.
 
 -w <filename>::
-        Writes the commit-id into the filename under $GIT_DIR/refs/<filename> on
+       Writes the commit-id into the specified filename under $GIT_DIR/refs/<filename> on
         the local end after the transfer is complete.
 
 --stdin::
index 7c6a6dd7f6a7fc9c75bf0ae595b12732d5c17765..ce0d80821259277f9112ad28b002f4c72bdb8348 100644 (file)
@@ -13,12 +13,12 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Sends missing objects to remote repository, and updates the
+Sends missing objects to the remote repository, and updates the
 remote branch.
 
 *NOTE*: This command is temporarily disabled if your libcurl
 is older than 7.16, as the combination has been reported
-not to work and sometimes corrupts repository.
+not to work and sometimes corrupts the repository.
 
 OPTIONS
 -------
@@ -44,7 +44,7 @@ OPTIONS
 -d::
 -D::
        Remove <ref> from remote repository.  The specified branch
-       cannot be the remote HEAD.  If -d is specified the following
+       cannot be the remote HEAD.  If -d is specified, the following
        other conditions must also be met:
 
        - Remote HEAD must resolve to an object that exists locally
@@ -83,8 +83,8 @@ and where it is pushed is determined by using the destination side.
 Without `--force`, the <src> ref is stored at the remote only if
 <dst> does not exist, or <dst> is a proper subset (i.e. an
 ancestor) of <src>.  This check, known as "fast-forward check",
-is performed in order to avoid accidentally overwriting the
-remote ref and lose other peoples' commits from there.
+is performed to avoid accidentally overwriting the
+remote ref and losing other peoples' commits from there.
 
 With `--force`, the fast-forward check is disabled for all refs.
 
index f7b185151415b54b08fb21f54062842baf64e636..c8a89d7243bfbd43d68e3922998a378f68eb6c66 100644 (file)
@@ -135,7 +135,7 @@ flames ridiculing you if you don't check this.
 
 Thunderbird in particular is known to be problematic.  Thunderbird
 users may wish to visit this web page for more information:
-  http://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
+  https://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
 
 SEE ALSO
 --------
index 4e71c256ecb08fe44ef656c85b7246e6f2f458b1..5a20deefd5f5dae5fb4cfbb3ccfaef4ab723f44f 100644 (file)
@@ -16,10 +16,10 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Reads a packed archive (.pack) from the specified file, and
-builds a pack index file (.idx) for it. Optionally writes a
+Reads a packed archive (.pack) from the specified file,
+builds a pack index file (.idx) for it, and optionally writes a
 reverse-index (.rev) for the specified pack. The packed
-archive together with the pack index can then be placed in
+archive, together with the pack index, can then be placed in
 the objects/pack/ directory of a Git repository.
 
 
@@ -68,8 +68,8 @@ OPTIONS
        updated to use objects contained in the pack.
 
 --keep=<msg>::
-       Like --keep create a .keep file before moving the index into
-       its final destination, but rather than creating an empty file
+       Like --keep, create a .keep file before moving the index into
+       its final destination.  However, instead of creating an empty file
        place '<msg>' followed by an LF into the .keep file.  The '<msg>'
        message can later be searched for within all .keep files to
        locate any which have outlived their usefulness.
@@ -79,8 +79,13 @@ OPTIONS
        to force the version for the generated pack index, and to force
        64-bit index entries on objects located above the given offset.
 
---strict::
-       Die, if the pack contains broken objects or links.
+--strict[=<msg-id>=<severity>...]::
+       Die, if the pack contains broken objects or links. An optional
+       comma-separated list of `<msg-id>=<severity>` can be passed to change
+       the severity of some possible issues, e.g.,
+        `--strict="missingEmail=ignore,badTagName=error"`. See the entry for the
+       `fsck.<msg-id>` configuration options in linkgit:git-fsck[1] for more
+       information on the possible values of `<msg-id>` and `<severity>`.
 
 --progress-title::
        For internal use only.
@@ -91,13 +96,18 @@ default and "Indexing objects" when `--stdin` is specified.
 --check-self-contained-and-connected::
        Die if the pack contains broken links. For internal use only.
 
---fsck-objects::
-       For internal use only.
+--fsck-objects[=<msg-id>=<severity>...]::
+       Die if the pack contains broken objects, but unlike `--strict`, don't
+       choke on broken links. If the pack contains a tree pointing to a
+       .gitmodules blob that does not exist, prints the hash of that blob
+       (for the caller to check) after the hash that goes into the name of the
+       pack/idx file (see "Notes").
 +
-Die if the pack contains broken objects. If the pack contains a tree
-pointing to a .gitmodules blob that does not exist, prints the hash of
-that blob (for the caller to check) after the hash that goes into the
-name of the pack/idx file (see "Notes").
+An optional comma-separated list of `<msg-id>=<severity>` can be passed to
+change the severity of some possible issues, e.g.,
+`--fsck-objects="missingEmail=ignore,badTagName=ignore"`. See the entry for the
+`fsck.<msg-id>` configuration options in linkgit:git-fsck[1] for more
+information on the possible values of `<msg-id>` and `<severity>`.
 
 --threads=<n>::
        Specifies the number of threads to spawn when resolving
index 160dea1372cd9ae87f1bad9744e2ae045ed1b5b6..2f864e11ed9719a2443ece695534636fcb6e2631 100644 (file)
@@ -11,6 +11,7 @@ SYNOPSIS
 [verse]
 'git init' [-q | --quiet] [--bare] [--template=<template-directory>]
          [--separate-git-dir <git-dir>] [--object-format=<format>]
+         [--ref-format=<format>]
          [-b <branch-name> | --initial-branch=<branch-name>]
          [--shared[=<permissions>]] [<directory>]
 
@@ -29,13 +30,13 @@ to use instead of `./.git` for the base of the repository.
 
 If the object storage directory is specified via the
 `$GIT_OBJECT_DIRECTORY` environment variable then the sha1 directories
-are created underneath - otherwise the default `$GIT_DIR/objects`
+are created underneath; otherwise, the default `$GIT_DIR/objects`
 directory is used.
 
-Running 'git init' in an existing repository is safe. It will not
+Running `git init` in an existing repository is safe. It will not
 overwrite things that are already there. The primary reason for
-rerunning 'git init' is to pick up newly added templates (or to move
-the repository to another place if --separate-git-dir is given).
+rerunning `git init` is to pick up newly added templates (or to move
+the repository to another place if `--separate-git-dir` is given).
 
 OPTIONS
 -------
@@ -52,11 +53,17 @@ current working directory.
 
 --object-format=<format>::
 
-Specify the given object format (hash algorithm) for the repository.  The valid
-values are 'sha1' and (if enabled) 'sha256'.  'sha1' is the default.
+Specify the given object _<format>_ (hash algorithm) for the repository.  The valid
+values are `sha1` and (if enabled) `sha256`.  `sha1` is the default.
 +
 include::object-format-disclaimer.txt[]
 
+--ref-format=<format>::
+
+Specify the given ref storage _<format>_ for the repository. The valid values are:
++
+include::ref-storage-format.txt[]
+
 --template=<template-directory>::
 
 Specify the directory from which templates will be used.  (See the "TEMPLATE
@@ -66,15 +73,15 @@ DIRECTORY" section below.)
 
 Instead of initializing the repository as a directory to either `$GIT_DIR` or
 `./.git/`, create a text file there containing the path to the actual
-repository.  This file acts as filesystem-agnostic Git symbolic link to the
+repository.  This file acts as filesystem-agnostic Git symbolic link to the
 repository.
 +
-If this is reinitialization, the repository will be moved to the specified path.
+If this is reinitialization, the repository will be moved to the specified path.
 
 -b <branch-name>::
 --initial-branch=<branch-name>::
 
-Use the specified name for the initial branch in the newly created
+Use _<branch-name>_ for the initial branch in the newly created
 repository.  If not specified, fall back to the default name (currently
 `master`, but this is subject to change in the future; the name can be
 customized via the `init.defaultBranch` configuration variable).
@@ -83,40 +90,44 @@ customized via the `init.defaultBranch` configuration variable).
 
 Specify that the Git repository is to be shared amongst several users.  This
 allows users belonging to the same group to push into that
-repository.  When specified, the config variable "core.sharedRepository" is
+repository.  When specified, the config variable `core.sharedRepository` is
 set so that files and directories under `$GIT_DIR` are created with the
 requested permissions.  When not specified, Git will use permissions reported
-by umask(2).
+by `umask(2)`.
 +
-The option can have the following values, defaulting to 'group' if no value
+The option can have the following values, defaulting to `group` if no value
 is given:
 +
 --
-'umask' (or 'false')::
+umask::
+false::
 
 Use permissions reported by umask(2). The default, when `--shared` is not
 specified.
 
-'group' (or 'true')::
+group::
+true::
 
-Make the repository group-writable, (and g+sx, since the git group may be not
+Make the repository group-writable, (and g+sx, since the git group may not be
 the primary group of all users). This is used to loosen the permissions of an
 otherwise safe umask(2) value. Note that the umask still applies to the other
-permission bits (e.g. if umask is '0022', using 'group' will not remove read
-privileges from other (non-group) users). See '0xxx' for how to exactly specify
+permission bits (e.g. if umask is `0022`, using `group` will not remove read
+privileges from other (non-group) users). See `0xxx` for how to exactly specify
 the repository permissions.
 
-'all' (or 'world' or 'everybody')::
+all::
+world::
+everybody::
 
-Same as 'group', but make the repository readable by all users.
+Same as `group`, but make the repository readable by all users.
 
-'<perm>'::
+<perm>::
 
-'<perm>' is a 3-digit octal number prefixed with `0` and each file
-will have mode '<perm>'. '<perm>' will override users' umask(2)
-value (and not only loosen permissions as 'group' and 'all'
-does). '0640' will create a repository which is group-readable, but
-not group-writable or accessible to others. '0660' will create a repo
+_<perm>_ is a 3-digit octal number prefixed with `0` and each file
+will have mode _<perm>_. _<perm>_ will override users'`umask(2)`
+value (and not only loosen permissions as `group` and `all`
+do). `0640` will create a repository which is group-readable, but
+not group-writable or accessible to others. `0660` will create a repo
 that is readable and writable to the current user and group, but
 inaccessible to others (directories and executable files get their
 `x` bit from the `r` bit for corresponding classes of users).
@@ -126,7 +137,7 @@ By default, the configuration flag `receive.denyNonFastForwards` is enabled
 in shared repositories, so that you cannot force a non fast-forwarding push
 into it.
 
-If you provide a 'directory', the command is run inside it. If this directory
+If you provide a _<directory>_, the command is run inside it. If this directory
 does not exist, it will be created.
 
 TEMPLATE DIRECTORY
@@ -165,7 +176,7 @@ $ git add .     <2>
 $ git commit    <3>
 ----------------
 +
-<1> Create a /path/to/my/codebase/.git directory.
+<1> Create a `/path/to/my/codebase/.git` directory.
 <2> Add all existing files to the index.
 <3> Record the pristine state as the first commit in the history.
 
@@ -174,6 +185,8 @@ CONFIGURATION
 
 include::includes/cmd-config-section-all.txt[]
 
+:git-init:
+
 include::config/init.txt[]
 
 GIT
index 55d89614661c5c46c8dd69fb149cfec70d72fc85..d9dfb75fef525f4a8379e0c52a78e2642e843858 100644 (file)
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git interpret-trailers' [--in-place] [--trim-empty]
-                       [(--trailer <token>[(=|:)<value>])...]
+                       [(--trailer (<key>|<key-alias>)[(=|:)<value>])...]
                        [--parse] [<file>...]
 
 DESCRIPTION
@@ -31,10 +31,15 @@ the last two lines starting with "Signed-off-by" are trailers.
 
 This command reads commit messages from either the
 <file> arguments or the standard input if no <file> is specified.
-If `--parse` is specified, the output consists of the parsed trailers.
-Otherwise, this command applies the arguments passed using the
-`--trailer` option, if any, to each input file. The result is emitted on the
-standard output.
+If `--parse` is specified, the output consists of the parsed trailers
+coming from the input, without influencing them with any command line
+options or configuration variables.
+
+Otherwise, this command applies `trailer.*` configuration variables
+(which could potentially add new trailers, as well as reposition them),
+as well as any command line arguments that can override configuration
+variables (such as `--trailer=...` which could also add new trailers),
+to each input file. The result is emitted on the standard output.
 
 This command can also operate on the output of linkgit:git-format-patch[1],
 which is more elaborate than a plain commit message. Namely, such output
@@ -48,22 +53,32 @@ are applied to each input and the way any existing trailer in
 the input is changed. They also make it possible to
 automatically add some trailers.
 
-By default, a '<token>=<value>' or '<token>:<value>' argument given
+By default, a '<key>=<value>' or '<key>:<value>' argument given
 using `--trailer` will be appended after the existing trailers only if
-the last trailer has a different (<token>, <value>) pair (or if there
-is no existing trailer). The <token> and <value> parts will be trimmed
+the last trailer has a different (<key>, <value>) pair (or if there
+is no existing trailer). The <key> and <value> parts will be trimmed
 to remove starting and trailing whitespace, and the resulting trimmed
-<token> and <value> will appear in the output like this:
+<key> and <value> will appear in the output like this:
 
 ------------------------------------------------
-token: value
+key: value
 ------------------------------------------------
 
-This means that the trimmed <token> and <value> will be separated by
-`': '` (one colon followed by one space). For convenience, the <token> can be a
-shortened string key (e.g., "sign") instead of the full string which should
-appear before the separator on the output (e.g., "Signed-off-by"). This can be
-configured using the 'trailer.<token>.key' configuration variable.
+This means that the trimmed <key> and <value> will be separated by
+`': '` (one colon followed by one space).
+
+For convenience, a <key-alias> can be configured to make using `--trailer`
+shorter to type on the command line. This can be configured using the
+'trailer.<key-alias>.key' configuration variable. The <keyAlias> must be a prefix
+of the full <key> string, although case sensitivity does not matter. For
+example, if you have
+
+------------------------------------------------
+trailer.sign.key "Signed-off-by: "
+------------------------------------------------
+
+in your configuration, you only need to specify `--trailer="sign: foo"`
+on the command line instead of `--trailer="Signed-off-by: foo"`.
 
 By default the new trailer will appear at the end of all the existing
 trailers. If there is no existing trailer, the new trailer will appear
@@ -80,14 +95,14 @@ non-whitespace lines before a line that starts with '---' (followed by a
 space or the end of the line).
 
 When reading trailers, there can be no whitespace before or inside the
-<token>, but any number of regular space and tab characters are allowed
-between the <token> and the separator. There can be whitespaces before,
+<key>, but any number of regular space and tab characters are allowed
+between the <key> and the separator. There can be whitespaces before,
 inside or after the <value>. The <value> may be split over multiple lines
 with each subsequent line starting with at least one whitespace, like
 the "folding" in RFC 822. Example:
 
 ------------------------------------------------
-token: This is a very long value, with spaces and
+key: This is a very long value, with spaces and
   newlines in it.
 ------------------------------------------------
 
@@ -104,35 +119,44 @@ OPTIONS
        the whole trailer will be removed from the output.
        This applies to existing trailers as well as new trailers.
 
---trailer <token>[(=|:)<value>]::
-       Specify a (<token>, <value>) pair that should be applied as a
+--trailer <key>[(=|:)<value>]::
+       Specify a (<key>, <value>) pair that should be applied as a
        trailer to the inputs. See the description of this
        command.
 
 --where <placement>::
 --no-where::
        Specify where all new trailers will be added.  A setting
-       provided with '--where' overrides all configuration variables
+       provided with '--where' overrides the `trailer.where` and any
+       applicable `trailer.<keyAlias>.where` configuration variables
        and applies to all '--trailer' options until the next occurrence of
-       '--where' or '--no-where'. Possible values are `after`, `before`,
-       `end` or `start`.
+       '--where' or '--no-where'. Upon encountering '--no-where', clear the
+       effect of any previous use of '--where', such that the relevant configuration
+       variables are no longer overridden. Possible placements are `after`,
+       `before`, `end` or `start`.
 
 --if-exists <action>::
 --no-if-exists::
        Specify what action will be performed when there is already at
-       least one trailer with the same <token> in the input.  A setting
-       provided with '--if-exists' overrides all configuration variables
+       least one trailer with the same <key> in the input.  A setting
+       provided with '--if-exists' overrides the `trailer.ifExists` and any
+       applicable `trailer.<keyAlias>.ifExists` configuration variables
        and applies to all '--trailer' options until the next occurrence of
-       '--if-exists' or '--no-if-exists'. Possible actions are `addIfDifferent`,
+       '--if-exists' or '--no-if-exists'. Upon encountering '--no-if-exists, clear the
+       effect of any previous use of '--if-exists, such that the relevant configuration
+       variables are no longer overridden. Possible actions are `addIfDifferent`,
        `addIfDifferentNeighbor`, `add`, `replace` and `doNothing`.
 
 --if-missing <action>::
 --no-if-missing::
        Specify what action will be performed when there is no other
-       trailer with the same <token> in the input.  A setting
-       provided with '--if-missing' overrides all configuration variables
+       trailer with the same <key> in the input.  A setting
+       provided with '--if-missing' overrides the `trailer.ifMissing` and any
+       applicable `trailer.<keyAlias>.ifMissing` configuration variables
        and applies to all '--trailer' options until the next occurrence of
-       '--if-missing' or '--no-if-missing'. Possible actions are `doNothing`
+       '--if-missing' or '--no-if-missing'. Upon encountering '--no-if-missing,
+       clear the effect of any previous use of '--if-missing, such that the relevant
+       configuration variables are no longer overridden. Possible actions are `doNothing`
        or `add`.
 
 --only-trailers::
@@ -140,16 +164,19 @@ OPTIONS
 
 --only-input::
        Output only trailers that exist in the input; do not add any
-       from the command-line or by following configured `trailer.*`
-       rules.
+       from the command-line or by applying `trailer.*` configuration
+       variables.
 
 --unfold::
-       Remove any whitespace-continuation in trailers, so that each
-       trailer appears on a line by itself with its full content.
+       If a trailer has a value that runs over multiple lines (aka "folded"),
+       reformat the value into a single line.
 
 --parse::
        A convenience alias for `--only-trailers --only-input
-       --unfold`.
+       --unfold`. This makes it easier to only see the trailers coming from the
+       input without influencing them with any command line options or
+       configuration variables, while also making the output machine-friendly with
+       --unfold.
 
 --no-divider::
        Do not treat `---` as the end of the commit message. Use this
@@ -170,11 +197,11 @@ used when another separator is not specified in the config for this
 trailer.
 +
 For example, if the value for this option is "%=$", then only lines
-using the format '<token><sep><value>' with <sep> containing '%', '='
+using the format '<key><sep><value>' with <sep> containing '%', '='
 or '$' and then spaces will be considered trailers. And '%' will be
 the default separator used, so by default trailers will appear like:
-'<token>% <value>' (one percent sign and one space will appear between
-the token and the value).
+'<key>% <value>' (one percent sign and one space will appear between
+the key and the value).
 
 trailer.where::
        This option tells where a new trailer will be added.
@@ -188,41 +215,41 @@ If it is `start`, then each new trailer will appear at the start,
 instead of the end, of the existing trailers.
 +
 If it is `after`, then each new trailer will appear just after the
-last trailer with the same <token>.
+last trailer with the same <key>.
 +
 If it is `before`, then each new trailer will appear just before the
-first trailer with the same <token>.
+first trailer with the same <key>.
 
 trailer.ifexists::
        This option makes it possible to choose what action will be
        performed when there is already at least one trailer with the
-       same <token> in the input.
+       same <key> in the input.
 +
 The valid values for this option are: `addIfDifferentNeighbor` (this
 is the default), `addIfDifferent`, `add`, `replace` or `doNothing`.
 +
 With `addIfDifferentNeighbor`, a new trailer will be added only if no
-trailer with the same (<token>, <value>) pair is above or below the line
+trailer with the same (<key>, <value>) pair is above or below the line
 where the new trailer will be added.
 +
 With `addIfDifferent`, a new trailer will be added only if no trailer
-with the same (<token>, <value>) pair is already in the input.
+with the same (<key>, <value>) pair is already in the input.
 +
 With `add`, a new trailer will be added, even if some trailers with
-the same (<token>, <value>) pair are already in the input.
+the same (<key>, <value>) pair are already in the input.
 +
-With `replace`, an existing trailer with the same <token> will be
+With `replace`, an existing trailer with the same <key> will be
 deleted and the new trailer will be added. The deleted trailer will be
-the closest one (with the same <token>) to the place where the new one
+the closest one (with the same <key>) to the place where the new one
 will be added.
 +
 With `doNothing`, nothing will be done; that is no new trailer will be
-added if there is already one with the same <token> in the input.
+added if there is already one with the same <key> in the input.
 
 trailer.ifmissing::
        This option makes it possible to choose what action will be
        performed when there is not yet any trailer with the same
-       <token> in the input.
+       <key> in the input.
 +
 The valid values for this option are: `add` (this is the default) and
 `doNothing`.
@@ -231,34 +258,40 @@ With `add`, a new trailer will be added.
 +
 With `doNothing`, nothing will be done.
 
-trailer.<token>.key::
-       This `key` will be used instead of <token> in the trailer. At
-       the end of this key, a separator can appear and then some
-       space characters. By default the only valid separator is ':',
-       but this can be changed using the `trailer.separators` config
-       variable.
+trailer.<keyAlias>.key::
+       Defines a <keyAlias> for the <key>. The <keyAlias> must be a
+       prefix (case does not matter) of the <key>. For example, in `git
+       config trailer.ack.key "Acked-by"` the "Acked-by" is the <key> and
+       the "ack" is the <keyAlias>. This configuration allows the shorter
+       `--trailer "ack:..."` invocation on the command line using the "ack"
+       <keyAlias> instead of the longer `--trailer "Acked-by:..."`.
++
+At the end of the <key>, a separator can appear and then some
+space characters. By default the only valid separator is ':',
+but this can be changed using the `trailer.separators` config
+variable.
 +
-If there is a separator, then the key will be used instead of both the
-<token> and the default separator when adding the trailer.
+If there is a separator in the key, then it overrides the default
+separator when adding the trailer.
 
-trailer.<token>.where::
+trailer.<keyAlias>.where::
        This option takes the same values as the 'trailer.where'
        configuration variable and it overrides what is specified by
-       that option for trailers with the specified <token>.
+       that option for trailers with the specified <keyAlias>.
 
-trailer.<token>.ifexists::
+trailer.<keyAlias>.ifexists::
        This option takes the same values as the 'trailer.ifexists'
        configuration variable and it overrides what is specified by
-       that option for trailers with the specified <token>.
+       that option for trailers with the specified <keyAlias>.
 
-trailer.<token>.ifmissing::
+trailer.<keyAlias>.ifmissing::
        This option takes the same values as the 'trailer.ifmissing'
        configuration variable and it overrides what is specified by
-       that option for trailers with the specified <token>.
+       that option for trailers with the specified <keyAlias>.
 
-trailer.<token>.command::
-       Deprecated in favor of 'trailer.<token>.cmd'.
-       This option behaves in the same way as 'trailer.<token>.cmd', except
+trailer.<keyAlias>.command::
+       Deprecated in favor of 'trailer.<keyAlias>.cmd'.
+       This option behaves in the same way as 'trailer.<keyAlias>.cmd', except
        that it doesn't pass anything as argument to the specified command.
        Instead the first occurrence of substring $ARG is replaced by the
        <value> that would be passed as argument.
@@ -266,29 +299,29 @@ trailer.<token>.command::
 Note that $ARG in the user's command is
 only replaced once and that the original way of replacing $ARG is not safe.
 +
-When both 'trailer.<token>.cmd' and 'trailer.<token>.command' are given
-for the same <token>, 'trailer.<token>.cmd' is used and
-'trailer.<token>.command' is ignored.
+When both 'trailer.<keyAlias>.cmd' and 'trailer.<keyAlias>.command' are given
+for the same <keyAlias>, 'trailer.<keyAlias>.cmd' is used and
+'trailer.<keyAlias>.command' is ignored.
 
-trailer.<token>.cmd::
+trailer.<keyAlias>.cmd::
        This option can be used to specify a shell command that will be called
-       once to automatically add a trailer with the specified <token>, and then
-       called each time a '--trailer <token>=<value>' argument is specified to
+       once to automatically add a trailer with the specified <keyAlias>, and then
+       called each time a '--trailer <keyAlias>=<value>' argument is specified to
        modify the <value> of the trailer that this option would produce.
 +
 When the specified command is first called to add a trailer
-with the specified <token>, the behavior is as if a special
-'--trailer <token>=<value>' argument was added at the beginning
+with the specified <keyAlias>, the behavior is as if a special
+'--trailer <keyAlias>=<value>' argument was added at the beginning
 of the "git interpret-trailers" command, where <value>
 is taken to be the standard output of the command with any
 leading and trailing whitespace trimmed off.
 +
-If some '--trailer <token>=<value>' arguments are also passed
+If some '--trailer <keyAlias>=<value>' arguments are also passed
 on the command line, the command is called again once for each
-of these arguments with the same <token>. And the <value> part
+of these arguments with the same <keyAlias>. And the <value> part
 of these arguments, if any, will be passed to the command as its
 first argument. This way the command can produce a <value> computed
-from the <value> passed in the '--trailer <token>=<value>' argument.
+from the <value> passed in the '--trailer <keyAlias>=<value>' argument.
 
 EXAMPLES
 --------
index 2a66cf888074656ce775ad93551603c15fed4ddc..579682172fe45816403f4d5ceffc03949eac5b3a 100644 (file)
@@ -120,11 +120,11 @@ By default, `git log` does not generate any diff output. The options
 below can be used to show the changes made by each commit.
 
 Note that unless one of `--diff-merges` variants (including short
-`-m`, `-c`, and `--cc` options) is explicitly given, merge commits
+`-m`, `-c`, `--cc`, and `--dd` options) is explicitly given, merge commits
 will not show a diff, even if a diff format like `--patch` is
 selected, nor will they match search options like `-S`. The exception
 is when `--first-parent` is in use, in which case `first-parent` is
-the default format.
+the default format for merge commits.
 
 :git-log: 1
 :diff-merges-default: `off`
index 1bc0328bb789283461bc1b7143830a6d88e06eb0..d08c7da8f495b3e19fb763535ff742585da9ce3e 100644 (file)
@@ -25,12 +25,12 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-This merges the file listing in the index with the actual working
+This command merges the file listing in the index with the actual working
 directory list, and shows different combinations of the two.
 
-One or more of the options below may be used to determine the files
+Several flags can be used to determine which files are
 shown, and each file may be printed multiple times if there are
-multiple entries in the index or multiple statuses are applicable for
+multiple entries in the index or if multiple statuses are applicable for
 the relevant file selection options.
 
 OPTIONS
@@ -62,7 +62,7 @@ OPTIONS
        matching an exclude pattern.  When showing "other" files
        (i.e. when used with '-o'), show only those matched by an
        exclude pattern.  Standard ignore rules are not automatically
-       activated, therefore at least one of the `--exclude*` options
+       activated; therefore, at least one of the `--exclude*` options
        is required.
 
 -s::
@@ -119,8 +119,10 @@ OPTIONS
 
 --exclude-per-directory=<file>::
        Read additional exclude patterns that apply only to the
-       directory and its subdirectories in <file>.  Deprecated; use
-       --exclude-standard instead.
+       directory and its subdirectories in <file>.  If you are
+       trying to emulate the way Porcelain commands work, using
+       the `--exclude-standard` option instead is easier and more
+       thorough.
 
 --exclude-standard::
        Add the standard Git exclusions: .git/info/exclude, .gitignore
@@ -141,7 +143,7 @@ OPTIONS
        Show status tags together with filenames.  Note that for
        scripting purposes, linkgit:git-status[1] `--porcelain` and
        linkgit:git-diff-files[1] `--name-status` are almost always
-       superior alternatives, and users should look at
+       superior alternatives; users should look at
        linkgit:git-status[1] `--short` or linkgit:git-diff[1]
        `--name-status` for more user-friendly alternatives.
 +
@@ -298,9 +300,8 @@ traversing the directory tree and finding files to show when the
 flags --others or --ignored are specified.  linkgit:gitignore[5]
 specifies the format of exclude patterns.
 
-Generally, you should just use --exclude-standard, but for historical
-reasons the exclude patterns can be specified from the following
-places, in order:
+These exclude patterns can be specified from the following places,
+in order:
 
   1. The command-line flag --exclude=<pattern> specifies a
      single pattern.  Patterns are ordered in the same order
@@ -322,6 +323,18 @@ top of the directory tree.  A pattern read from a file specified
 by --exclude-per-directory is relative to the directory that the
 pattern file appears in.
 
+Generally, you should be able to use `--exclude-standard` when you
+want the exclude rules applied the same way as what Porcelain
+commands do.  To emulate what `--exclude-standard` specifies, you
+can give `--exclude-per-directory=.gitignore`, and then specify:
+
+  1. The file specified by the `core.excludesfile` configuration
+     variable, if exists, or the `$XDG_CONFIG_HOME/git/ignore` file.
+
+  2. The `$GIT_DIR/info/exclude` file.
+
+via the `--exclude-from=` option.
+
 SEE ALSO
 --------
 linkgit:git-read-tree[1], linkgit:gitignore[5]
index e3b2a88c4b75f1f6e23feb8a09030469468d9ca8..3f0a6662c81efb6fee6589aa41c2b8e945c36644 100644 (file)
@@ -34,7 +34,7 @@ OPTIONS
 
 -b::
        If any file doesn't begin with a From line, assume it is a
-       single mail message instead of signaling error.
+       single mail message instead of signaling an error.
 
 -d<prec>::
        Instead of the default 4 digits with leading zeros,
index 805e5a2e3a044b4e1f5a345ecafa2dccb87565ce..51d0f7e94b6a0182089d5d7f48ab9f9d1cb9f572 100644 (file)
@@ -102,9 +102,9 @@ prefetch::
        requested refs within `refs/prefetch/`. Also, tags are not updated.
 +
 This is done to avoid disrupting the remote-tracking branches. The end users
-expect these refs to stay unmoved unless they initiate a fetch.  With prefetch
-task, however, the objects necessary to complete a later real fetch would
-already be obtained, so the real fetch would go faster.  In the ideal case,
+expect these refs to stay unmoved unless they initiate a fetch.  However,
+with the prefetch task, the objects necessary to complete a later real fetch
+would already be obtained, making the real fetch faster.  In the ideal case,
 it will just become an update to a bunch of remote-tracking branches without
 any object transfer.
 
index b01ba3d35650969ff446627e4f2f403eb84c7c0e..5ab957cfbc1420d5dca07a21dbf6708777ee754e 100644 (file)
@@ -18,7 +18,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-'git merge-base' finds best common ancestor(s) between two commits to use
+'git merge-base' finds the best common ancestor(s) between two commits to use
 in a three-way merge.  One common ancestor is 'better' than another common
 ancestor if the latter is an ancestor of the former.  A common ancestor
 that does not have any better common ancestor is a 'best common
@@ -28,7 +28,7 @@ merge base for a pair of commits.
 OPERATION MODES
 ---------------
 
-As the most common special case, specifying only two commits on the
+In the most common special case, specifying only two commits on the
 command line means computing the merge base between the given two commits.
 
 More generally, among the two commits to compute the merge base from,
@@ -64,7 +64,7 @@ from linkgit:git-show-branch[1] when used with the `--merge-base` option.
        the two commits, but also takes into account the reflog of
        <ref> to see if the history leading to <commit> forked from
        an earlier incarnation of the branch <ref> (see discussion
-       on this mode below).
+       of this mode below).
 
 OPTIONS
 -------
@@ -88,7 +88,7 @@ For example, with this topology:
 
 the merge base between 'A' and 'B' is '1'.
 
-Given three commits 'A', 'B' and 'C', `git merge-base A B C` will compute the
+Given three commits 'A', 'B', and 'C', `git merge-base A B C` will compute the
 merge base between 'A' and a hypothetical commit 'M', which is a merge
 between 'B' and 'C'.  For example, with this topology:
 
@@ -130,7 +130,7 @@ When the history involves criss-cross merges, there can be more than one
 ---2---o---o---B
 ....
 
-both '1' and '2' are merge-bases of A and B.  Neither one is better than
+both '1' and '2' are merge bases of A and B.  Neither one is better than
 the other (both are 'best' merge bases).  When the `--all` option is not given,
 it is unspecified which best one is output.
 
@@ -204,7 +204,7 @@ will find B0, and
 
     $ git rebase --onto origin/master $fork_point topic
 
-will replay D0, D1 and D on top of B to create a new history of this
+will replay D0, D1, and D on top of B to create a new history of this
 shape:
 
 ....
index 7e9093fab60d267fa795e3d3fddd26cdfacfb557..71915a00fa472e73f5fadd2205f964919d3262db 100644 (file)
@@ -11,19 +11,20 @@ SYNOPSIS
 [verse]
 'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
        [--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]
-       [--[no-]diff3] <current-file> <base-file> <other-file>
+       [--[no-]diff3] [--object-id] <current> <base> <other>
 
 
 DESCRIPTION
 -----------
-'git merge-file' incorporates all changes that lead from the `<base-file>`
-to `<other-file>` into `<current-file>`. The result ordinarily goes into
-`<current-file>`. 'git merge-file' is useful for combining separate changes
-to an original. Suppose `<base-file>` is the original, and both
-`<current-file>` and `<other-file>` are modifications of `<base-file>`,
+Given three files `<current>`, `<base>` and `<other>`,
+'git merge-file' incorporates all changes that lead from `<base>`
+to `<other>` into `<current>`. The result ordinarily goes into
+`<current>`. 'git merge-file' is useful for combining separate changes
+to an original. Suppose `<base>` is the original, and both
+`<current>` and `<other>` are modifications of `<base>`,
 then 'git merge-file' combines both changes.
 
-A conflict occurs if both `<current-file>` and `<other-file>` have changes
+A conflict occurs if both `<current>` and `<other>` have changes
 in a common segment of lines. If a conflict is found, 'git merge-file'
 normally outputs a warning and brackets the conflict with lines containing
 <<<<<<< and >>>>>>> markers. A typical conflict will look like this:
@@ -36,10 +37,14 @@ normally outputs a warning and brackets the conflict with lines containing
 
 If there are conflicts, the user should edit the result and delete one of
 the alternatives.  When `--ours`, `--theirs`, or `--union` option is in effect,
-however, these conflicts are resolved favouring lines from `<current-file>`,
-lines from `<other-file>`, or lines from both respectively.  The length of the
+however, these conflicts are resolved favouring lines from `<current>`,
+lines from `<other>`, or lines from both respectively.  The length of the
 conflict markers can be given with the `--marker-size` option.
 
+If `--object-id` is specified, exactly the same behavior occurs, except that
+instead of specifying what to merge as files, it is specified as a list of
+object IDs referring to blobs.
+
 The exit value of this program is negative on error, and the number of
 conflicts otherwise (truncated to 127 if there are more than that many
 conflicts). If the merge was clean, the exit value is 0.
@@ -52,6 +57,14 @@ linkgit:git[1].
 OPTIONS
 -------
 
+--object-id::
+       Specify the contents to merge as blobs in the current repository instead of
+       files.  In this case, the operation must take place within a valid repository.
++
+If the `-p` option is specified, the merged file (including conflicts, if any)
+goes to standard output as normal; otherwise, the merged file is written to the
+object store and the object ID of its blob is written to standard output.
+
 -L <label>::
        This option may be given up to three times, and
        specifies labels to be used in place of the
@@ -62,7 +75,7 @@ OPTIONS
 
 -p::
        Send results to standard output instead of overwriting
-       `<current-file>`.
+       `<current>`.
 
 -q::
        Quiet; do not warn about conflicts.
@@ -79,6 +92,12 @@ OPTIONS
        Instead of leaving conflicts in the file, resolve conflicts
        favouring our (or their or both) side of the lines.
 
+--diff-algorithm={patience|minimal|histogram|myers}::
+       Use a different diff algorithm while merging. The current default is "myers",
+       but selecting more recent algorithm such as "histogram" can help
+       avoid mismerges that occur due to unimportant matching lines
+       (such as braces from distinct functions). See also
+       linkgit:git-diff[1] `--diff-algorithm`.
 
 EXAMPLES
 --------
@@ -93,6 +112,11 @@ EXAMPLES
        merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
        `a` and `c` instead of `tmp/a123` and `tmp/c345`.
 
+`git merge-file -p --object-id abc1234 def567 890abcd`::
+
+       combines the changes of the blob abc1234 and 890abcd since def567,
+       tries to merge them and writes the result to standard output
+
 GIT
 ---
 Part of the linkgit:git[1] suite
index ffc4fbf7e89a89b075bb00bafcb041c19adc271f..dd388fa21d5a51d1b6c3aca1b1d18b98f69a4f88 100644 (file)
@@ -19,12 +19,12 @@ DESCRIPTION
 This command has a modern `--write-tree` mode and a deprecated
 `--trivial-merge` mode.  With the exception of the
 <<DEPMERGE,DEPRECATED DESCRIPTION>> section at the end, the rest of
-this documentation describes modern `--write-tree` mode.
+this documentation describes the modern `--write-tree` mode.
 
 Performs a merge, but does not make any new commits and does not read
 from or write to either the working tree or index.
 
-The performed merge will use the same feature as the "real"
+The performed merge will use the same features as the "real"
 linkgit:git-merge[1], including:
 
   * three way content merges of individual files
@@ -64,10 +64,13 @@ OPTIONS
        share no common history.  This flag can be given to override that
        check and make the merge proceed anyway.
 
---merge-base=<commit>::
+--merge-base=<tree-ish>::
        Instead of finding the merge-bases for <branch1> and <branch2>,
        specify a merge-base for the merge, and specifying multiple bases is
        currently not supported. This option is incompatible with `--stdin`.
++
+As the merge-base is provided directly, <branch1> and <branch2> do not need
+to specify commits; trees are enough.
 
 [[OUTPUT]]
 OUTPUT
@@ -253,7 +256,7 @@ Do NOT attempt to guess or make the user guess the conflict types from
 the <<CFI,Conflicted file info>> list.  The information there is
 insufficient to do so.  For example: Rename/rename(1to2) conflicts (both
 sides renamed the same file differently) will result in three different
-file having higher order stages (but each only has one higher order
+files having higher order stages (but each only has one higher order
 stage), with no way (short of the <<IM,Informational messages>> section)
 to determine which three files are related.  File/directory conflicts
 also result in a file with exactly one higher order stage.
@@ -263,7 +266,7 @@ a file with exactly one higher order stage.  In all cases, the
 <<IM,Informational messages>> section has the necessary info, though it
 is not designed to be machine parseable.
 
-Do NOT assume that each paths from <<CFI,Conflicted file info>>, and
+Do NOT assume that each path from <<CFI,Conflicted file info>>, and
 the logical conflicts in the <<IM,Informational messages>> have a
 one-to-one mapping, nor that there is a one-to-many mapping, nor a
 many-to-one mapping.  Many-to-many mappings exist, meaning that each
index 8625c5cb0ec2d31ac264789d80a80b6c5a0c38b9..1ab69f61f5749a21def2b08d7cd9466f59c3cd5c 100644 (file)
@@ -20,12 +20,12 @@ DESCRIPTION
 -----------
 Incorporates changes from the named commits (since the time their
 histories diverged from the current branch) into the current
-branch.  This command is used by 'git pull' to incorporate changes
+branch.  This command is used by `git pull` to incorporate changes
 from another repository and can be used by hand to merge changes
 from one branch into another.
 
 Assume the following history exists and the current branch is
-"`master`":
+`master`:
 
 ------------
          A---B---C topic
@@ -33,7 +33,7 @@ Assume the following history exists and the current branch is
     D---E---F---G master
 ------------
 
-Then "`git merge topic`" will replay the changes made on the
+Then `git merge topic` will replay the changes made on the
 `topic` branch since it diverged from `master` (i.e., `E`) until
 its current commit (`C`) on top of `master`, and record the result
 in a new commit along with the names of the two parent commits and
@@ -46,21 +46,21 @@ a log message from the user describing the changes. Before the operation,
     D---E---F---G---H master
 ------------
 
-The second syntax ("`git merge --abort`") can only be run after the
-merge has resulted in conflicts. 'git merge --abort' will abort the
-merge process and try to reconstruct the pre-merge state. However,
-if there were uncommitted changes when the merge started (and
-especially if those changes were further modified after the merge
-was started), 'git merge --abort' will in some cases be unable to
-reconstruct the original (pre-merge) changes. Therefore:
+A merge stops if there's a conflict that cannot be resolved
+automatically or if `--no-commit` was provided when initiating the
+merge. At that point you can run `git merge --abort` or `git merge
+--continue`.
 
-*Warning*: Running 'git merge' with non-trivial uncommitted changes is
+`git merge --abort` will abort the merge process and try to reconstruct
+the pre-merge state. However, if there were uncommitted changes when the
+merge started (and especially if those changes were further modified
+after the merge was started), `git merge --abort` will in some cases be
+unable to reconstruct the original (pre-merge) changes. Therefore:
+
+*Warning*: Running `git merge` with non-trivial uncommitted changes is
 discouraged: while possible, it may leave you in a state that is hard to
 back out of in the case of a conflict.
 
-The third syntax ("`git merge --continue`") can only be run after the
-merge has resulted in conflicts.
-
 OPTIONS
 -------
 :git-merge: 1
@@ -74,8 +74,8 @@ include::merge-options.txt[]
 If `--log` is specified, a shortlog of the commits being merged
 will be appended to the specified message.
 +
-The 'git fmt-merge-msg' command can be
-used to give a good default for automated 'git merge'
+The `git fmt-merge-msg` command can be
+used to give a good default for automated `git merge`
 invocations. The automated message can include the branch description.
 
 --into-name <branch>::
@@ -104,14 +104,14 @@ include::rerere-options.txt[]
        present, apply it to the worktree.
 +
 If there were uncommitted worktree changes present when the merge
-started, 'git merge --abort' will in some cases be unable to
+started, `git merge --abort` will in some cases be unable to
 reconstruct these changes. It is therefore recommended to always
-commit or stash your changes before running 'git merge'.
+commit or stash your changes before running `git merge`.
 +
-'git merge --abort' is equivalent to 'git reset --merge' when
+`git merge --abort` is equivalent to `git reset --merge` when
 `MERGE_HEAD` is present unless `MERGE_AUTOSTASH` is also present in
-which case 'git merge --abort' applies the stash entry to the worktree
-whereas 'git reset --merge' will save the stashed changes in the stash
+which case `git merge --abort` applies the stash entry to the worktree
+whereas `git reset --merge` will save the stashed changes in the stash
 list.
 
 --quit::
@@ -120,8 +120,8 @@ list.
        stash entry will be saved to the stash list.
 
 --continue::
-       After a 'git merge' stops due to conflicts you can conclude the
-       merge by running 'git merge --continue' (see "HOW TO RESOLVE
+       After a `git merge` stops due to conflicts you can conclude the
+       merge by running `git merge --continue` (see "HOW TO RESOLVE
        CONFLICTS" section below).
 
 <commit>...::
@@ -144,25 +144,25 @@ PRE-MERGE CHECKS
 Before applying outside changes, you should get your own work in
 good shape and committed locally, so it will not be clobbered if
 there are conflicts.  See also linkgit:git-stash[1].
-'git pull' and 'git merge' will stop without doing anything when
-local uncommitted changes overlap with files that 'git pull'/'git
-merge' may need to update.
+`git pull` and `git merge` will stop without doing anything when
+local uncommitted changes overlap with files that `git pull`/`git
+merge` may need to update.
 
 To avoid recording unrelated changes in the merge commit,
-'git pull' and 'git merge' will also abort if there are any changes
+`git pull` and `git merge` will also abort if there are any changes
 registered in the index relative to the `HEAD` commit.  (Special
 narrow exceptions to this rule may exist depending on which merge
 strategy is in use, but generally, the index must match HEAD.)
 
-If all named commits are already ancestors of `HEAD`, 'git merge'
+If all named commits are already ancestors of `HEAD`, `git merge`
 will exit early with the message "Already up to date."
 
 FAST-FORWARD MERGE
 ------------------
 
 Often the current branch head is an ancestor of the named commit.
-This is the most common case especially when invoked from 'git
-pull': you are tracking an upstream repository, you have committed
+This is the most common case especially when invoked from `git
+pull`: you are tracking an upstream repository, you have committed
 no local changes, and now you want to update to a newer upstream
 revision.  In this case, a new commit is not needed to store the
 combined history; instead, the `HEAD` (along with the index) is
@@ -196,7 +196,7 @@ happens:
    can inspect the stages with `git ls-files -u`).  The working
    tree files contain the result of the merge operation; i.e. 3-way
    merge results with familiar conflict markers `<<<` `===` `>>>`.
-5. A special ref `AUTO_MERGE` is written, pointing to a tree
+5. A ref named `AUTO_MERGE` is written, pointing to a tree
    corresponding to the current content of the working tree (including
    conflict markers for textual conflicts).  Note that this ref is only
    written when the 'ort' merge strategy is used (the default).
@@ -269,7 +269,7 @@ Barbie's remark on your side.  The only thing you can tell is that your
 side wants to say it is hard and you'd prefer to go shopping, while the
 other side wants to claim it is easy.
 
-An alternative style can be used by setting the "merge.conflictStyle"
+An alternative style can be used by setting the `merge.conflictStyle`
 configuration variable to either "diff3" or "zdiff3".  In "diff3"
 style, the above conflict may look like this:
 
@@ -328,15 +328,15 @@ After seeing a conflict, you can do two things:
 
  * Resolve the conflicts.  Git will mark the conflicts in
    the working tree.  Edit the files into shape and
-   'git add' them to the index.  Use 'git commit' or
-   'git merge --continue' to seal the deal. The latter command
+   `git add` them to the index.  Use `git commit` or
+   `git merge --continue` to seal the deal. The latter command
    checks whether there is a (interrupted) merge in progress
-   before calling 'git commit'.
+   before calling `git commit`.
 
 You can work through the conflict with a number of tools:
 
  * Use a mergetool.  `git mergetool` to launch a graphical
-   mergetool which will work you through the merge.
+   mergetool which will work through the merge with you.
 
  * Look at the diffs.  `git diff` will show a three-way diff,
    highlighting changes from both the `HEAD` and `MERGE_HEAD`
@@ -392,7 +392,7 @@ CONFIGURATION
 
 branch.<name>.mergeOptions::
        Sets default options for merging into branch <name>. The syntax and
-       supported options are the same as those of 'git merge', but option
+       supported options are the same as those of `git merge`, but option
        values containing whitespace characters are currently not supported.
 
 include::includes/cmd-config-section-rest.txt[]
index 3e8f59ac0e46abc35b88723492fa2d411b2756ca..0726b560d432884eabc8834a51c2fbd68d74ad92 100644 (file)
@@ -28,22 +28,22 @@ to define the operation mode for the functions listed below.
 FUNCTIONS
 ---------
 get_merge_tool::
-       returns a merge tool. the return code is 1 if we returned a guessed
+       Returns a merge tool. The return code is 1 if we returned a guessed
        merge tool, else 0. '$GIT_MERGETOOL_GUI' may be set to 'true' to
        search for the appropriate guitool.
 
 get_merge_tool_cmd::
-       returns the custom command for a merge tool.
+       Returns the custom command for a merge tool.
 
 get_merge_tool_path::
-       returns the custom path for a merge tool.
+       Returns the custom path for a merge tool.
 
 initialize_merge_tool::
-       bring merge tool specific functions into scope so they can be used or
+       Brings merge tool specific functions into scope so they can be used or
        overridden.
 
 run_merge_tool::
-       launches a merge tool given the tool name and a true/false
+       Launches a merge tool given the tool name and a true/false
        flag to indicate whether a merge base is present.
        '$MERGED', '$LOCAL', '$REMOTE', and '$BASE' must be defined
        for use by the merge tool.
index 07535f6576e81a936c3b65481de7d1b53c4120a8..b9e20c5dcd8c52df8e0782bc5d92e3a5ac5361b2 100644 (file)
@@ -17,7 +17,7 @@ Use `git mergetool` to run one of several merge utilities to resolve
 merge conflicts.  It is typically run after 'git merge'.
 
 If one or more <file> parameters are given, the merge tool program will
-be run to resolve differences on each file (skipping those without
+be run to resolve differences in each file (skipping those without
 conflicts).  Specifying a directory will include all unresolved files in
 that path.  If no <file> names are specified, 'git mergetool' will run
 the merge tool program on every file with merge conflicts.
@@ -49,7 +49,7 @@ variable `mergetool.<tool>.cmd`.
 +
 When 'git mergetool' is invoked with this tool (either through the
 `-t` or `--tool` option or the `merge.tool` configuration
-variable) the configured command line will be invoked with `$BASE`
+variable), the configured command line will be invoked with `$BASE`
 set to the name of a temporary file containing the common base for
 the merge, if available; `$LOCAL` set to the name of a temporary
 file containing the contents of the file on the current branch;
@@ -81,7 +81,7 @@ success of the resolution after the custom tool has exited.
 
 -g::
 --gui::
-       When 'git-mergetool' is invoked with the `-g` or `--gui` option
+       When 'git-mergetool' is invoked with the `-g` or `--gui` option,
        the default merge tool will be read from the configured
        `merge.guitool` variable instead of `merge.tool`. If
        `merge.guitool` is not set, we will fallback to the tool
@@ -115,7 +115,7 @@ These are safe to remove once a file has been merged and its
 `git mergetool` session has completed.
 
 Setting the `mergetool.keepBackup` configuration variable to `false`
-causes `git mergetool` to automatically remove the backup as files
+causes `git mergetool` to automatically remove the backup files as files
 are successfully merged.
 
 BACKEND SPECIFIC HINTS
index b2a2e80d42143a928380bf93e98ac6203442fcc8..006d759962ac61a927d2a08bfa831d1692cc63c4 100644 (file)
@@ -14,7 +14,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-Reads a tag contents on standard input and creates a tag object. The
+Reads a tag's contents on standard input and creates a tag object. The
 output is the new tag's <object> identifier.
 
 This command is mostly equivalent to linkgit:git-hash-object[1]
@@ -27,7 +27,7 @@ write a tag found in `my-tag`:
 The difference is that mktag will die before writing the tag if the
 tag doesn't pass a linkgit:git-fsck[1] check.
 
-The "fsck" check done mktag is stricter than what linkgit:git-fsck[1]
+The "fsck" check done by mktag is stricter than what linkgit:git-fsck[1]
 would run by default in that all `fsck.<msg-id>` messages are promoted
 from warnings to errors (so e.g. a missing "tagger" line is an error).
 
@@ -56,7 +56,7 @@ has a very simple fixed format: four lines of
   tagger <tagger>
 
 followed by some 'optional' free-form message (some tags created
-by older Git may not have `tagger` line).  The message, when it
+by older Git may not have `tagger` line).  The message, when it
 exists, is separated by a blank line from the header.  The
 message part may contain a signature that Git itself doesn't
 care about, but that can be verified with gpg.
index 76b44f4da103872d9b39c893b62286d37b159693..383f09dd333f86d96288a776a1395696473b0fdb 100644 (file)
@@ -25,13 +25,13 @@ OPTIONS
 
 --missing::
        Allow missing objects.  The default behaviour (without this option)
-       is to verify that each tree entry's sha1 identifies an existing
+       is to verify that each tree entry's hash identifies an existing
        object.  This option has no effect on the treatment of gitlink entries
        (aka "submodules") which are always allowed to be missing.
 
 --batch::
        Allow building of more than one tree object before exiting.  Each
-       tree is separated by a single blank line. The final new-line is
+       tree is separated by a single blank line. The final newline is
        optional.  Note - if the `-z` option is used, lines are terminated
        with NUL.
 
index fb0220fd18dc2b99cab472f5b52dfe9930d4bdf9..dc1bf61534106ac8c9e916ba47bb7fb0f1bf97f0 100644 (file)
@@ -13,10 +13,10 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Move or rename a file, directory or symlink.
+Move or rename a file, directory, or symlink.
 
  git mv [-v] [-f] [-n] [-k] <source> <destination>
- git mv [-v] [-f] [-n] [-k] <source> ... <destination directory>
+ git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory>
 
 In the first form, it renames <source>, which must exist and be either
 a file, symlink or directory, to <destination>.
index 5c56c870253505395ce3a68216b5b9d329fb02e0..d4f1c4d5945e8ed38c243ecee0920bd6e38219a5 100644 (file)
@@ -26,7 +26,7 @@ OPTIONS
 
 --refs=<pattern>::
        Only use refs whose names match a given shell pattern.  The pattern
-       can be one of branch name, tag name or fully qualified ref name. If
+       can be a branch name, a tag name, or a fully qualified ref name. If
        given multiple times, use refs whose names match any of the given shell
        patterns. Use `--no-refs` to clear any previous ref patterns given.
 
index f8310e56a85ab0f6f211d68b1886ec68ae126b9f..c9221a68ccedc828672917576d317c42f9e3647c 100644 (file)
@@ -56,7 +56,7 @@ SUBCOMMANDS
 list::
        List the notes object for a given object. If no object is
        given, show a list of all note objects and the objects they
-       annotate (in the format "<note object> <annotated object>").
+       annotate (in the format "<note-object> <annotated-object>").
        This is the default subcommand if no subcommand is given.
 
 add::
index a9995a932ca2d246db2bf756792c92b2431970eb..e32404c6aaee30f39f3f128839171601999bccb3 100644 (file)
@@ -116,9 +116,7 @@ unreachable object whose mtime is newer than the `--cruft-expiration`).
 +
 Incompatible with `--unpack-unreachable`, `--keep-unreachable`,
 `--pack-loose-unreachable`, `--stdin-packs`, as well as any other
-options which imply `--revs`. Also incompatible with `--max-pack-size`;
-when this option is set, the maximum pack size is not inferred from
-`pack.packSizeLimit`.
+options which imply `--revs`.
 
 --cruft-expiration=<approxidate>::
        If specified, objects are eliminated from the cruft pack if they
@@ -298,8 +296,8 @@ So does `git bundle` (see linkgit:git-bundle[1]) when it creates a bundle.
        nevertheless.
 
 --filter=<filter-spec>::
-       Requires `--stdout`.  Omits certain objects (usually blobs) from
-       the resulting packfile.  See linkgit:git-rev-list[1] for valid
+       Omits certain objects (usually blobs) from the resulting
+       packfile.  See linkgit:git-rev-list[1] for valid
        `<filter-spec>` forms.
 
 --no-filter::
index 844d6f808a0c2f740d62ac7dbe5ed0c328546262..db742dcfeea84f0afe1eef8a4fdeb939b4e0dadf 100644 (file)
@@ -15,7 +15,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 This program searches the `$GIT_OBJECT_DIRECTORY` for all objects that currently
-exist in a pack file as well as the independent object directories.
+exist in a pack file as well as in the independent object directories.
 
 All such extra objects are removed.
 
index 03552dd86fc412b622aff2bcf8feda8e71711b3e..9a45571b901b1579e6c377a73359d7e4002438db 100644 (file)
@@ -18,7 +18,7 @@ NOTE: In most cases, users should run 'git gc', which calls
 'git prune'. See the section "NOTES", below.
 
 This runs 'git fsck --unreachable' using all the refs
-available in `refs/`, optionally with additional set of
+available in `refs/`, optionally with an additional set of
 objects specified on the command line, and prunes all unpacked
 objects unreachable from any of these head objects from the object database.
 In addition, it
index 0e14f8b5b25924c98c4bda92729787f2361ada9c..b2ae496e488c1ebf3aaf79609987ab0bdbc5f34a 100644 (file)
@@ -87,7 +87,7 @@ OPTIONS
 --verbose::
        Pass --verbose to git-fetch and git-merge.
 
---[no-]recurse-submodules[=yes|on-demand|no]::
+--[no-]recurse-submodules[=(yes|on-demand|no)]::
        This option controls if new commits of populated submodules should
        be fetched, and if the working trees of active submodules should be
        updated, too (see linkgit:git-fetch[1], linkgit:git-config[1] and
@@ -105,7 +105,7 @@ Options related to merging
 include::merge-options.txt[]
 
 -r::
---rebase[=false|true|merges|interactive]::
+--rebase[=(false|true|merges|interactive)]::
        When true, rebase the current branch on top of the upstream
        branch after fetching. If there is a remote-tracking branch
        corresponding to the upstream branch and the upstream branch
index 297927d866789c16fdb7f50bf05e735e376166bc..9b7cfbc5c1d8496c2649b4d6375e699b546fa6c5 100644 (file)
@@ -10,7 +10,7 @@ SYNOPSIS
 --------
 [verse]
 'git push' [--all | --branches | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
-          [--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]
+          [--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-q | --quiet] [-v | --verbose]
           [-u | --set-upstream] [-o <string> | --push-option=<string>]
           [--[no-]signed|--signed=(true|false|if-asked)]
           [--force-with-lease[=<refname>[:<expect>]] [--force-if-includes]]
@@ -37,7 +37,7 @@ the default `<refspec>` by consulting `remote.*.push` configuration,
 and if it is not found, honors `push.default` configuration to decide
 what to push (See linkgit:git-config[1] for the meaning of `push.default`).
 
-When neither the command-line nor the configuration specify what to
+When neither the command-line nor the configuration specifies what to
 push, the default behavior is used, which corresponds to the `simple`
 value for `push.default`: the current branch is pushed to the
 corresponding upstream branch, but as a safety measure, the push is
@@ -48,7 +48,7 @@ local one.
 OPTIONS[[OPTIONS]]
 ------------------
 <repository>::
-       The "remote" repository that is destination of a push
+       The "remote" repository that is the destination of a push
        operation.  This parameter can be either a URL
        (see the section <<URLS,GIT URLS>> below) or the name
        of a remote (see the section <<REMOTES,REMOTES>> below).
index 70562dc4c0235d53501bab56ff98af6169b8f968..40e02d92eb2419c32be66a69afb353c6d384c717 100644 (file)
@@ -38,14 +38,14 @@ OPTIONS
        a patch.  At the time of this writing only missing author
        information is warned about.
 
---author Author Name <Author Email>::
+--author 'Author Name <Author Email>'::
        The author name and email address to use when no author
        information can be found in the patch description.
 
 --patches <dir>::
        The directory to find the quilt patches.
 +
-The default for the patch directory is patches
+The default for the patch directory is 'patches'
 or the value of the `$QUILT_PATCHES` environment
 variable.
 
index 0b393715d707015a245eb1afe26dfbe044e8fcd6..fbdbe0befebab63b0316a29aaf420f9538cce43c 100644 (file)
@@ -70,7 +70,7 @@ to revert to color all lines according to the outer diff markers
        Defaults to 60. Try a larger value if `git range-diff` erroneously
        considers a large change a total rewrite (deletion of one commit
        and addition of another), and a smaller one in the reverse case.
-       See the ``Algorithm`` section below for an explanation why this is
+       See the ``Algorithm`` section below for an explanation of why this is
        needed.
 
 --left-only::
@@ -166,7 +166,7 @@ A typical output of `git range-diff` would look like this:
 
 In this example, there are 3 old and 3 new commits, where the developer
 removed the 3rd, added a new one before the first two, and modified the
-commit message of the 2nd commit as well its diff.
+commit message of the 2nd commit as well as its diff.
 
 When the output goes to a terminal, it is color-coded by default, just
 like regular `git diff`'s output. In addition, the first line (adding a
index b09707474df0ec523ac7e53192103a6edf0dca51..1c48c289963063c2e0db605bbb27c35dd803270c 100644 (file)
@@ -25,15 +25,15 @@ fast-forward (i.e. 2-way) merge, or a 3-way merge, with the `-m`
 flag.  When used with `-m`, the `-u` flag causes it to also update
 the files in the work tree with the result of the merge.
 
-Trivial merges are done by 'git read-tree' itself.  Only conflicting paths
-will be in unmerged state when 'git read-tree' returns.
+Only trivial merges are done by 'git read-tree' itself.  Only conflicting paths
+will be in an unmerged state when 'git read-tree' returns.
 
 OPTIONS
 -------
 -m::
        Perform a merge, not just a read.  The command will
        refuse to run if your index file has unmerged entries,
-       indicating that you have not finished previous merge you
+       indicating that you have not finished previous merge you
        started.
 
 --reset::
index e7b39ad244a4bebc90e9c1974e4239ae771c56d4..03d5e9936a0113896b456afc16e365e540f4c78b 100644 (file)
@@ -12,7 +12,7 @@ SYNOPSIS
        [--onto <newbase> | --keep-base] [<upstream> [<branch>]]
 'git rebase' [-i | --interactive] [<options>] [--exec <cmd>] [--onto <newbase>]
        --root [<branch>]
-'git rebase' (--continue | --skip | --abort | --quit | --edit-todo | --show-current-patch)
+'git rebase' (--continue|--skip|--abort|--quit|--edit-todo|--show-current-patch)
 
 DESCRIPTION
 -----------
@@ -289,7 +289,7 @@ See also INCOMPATIBLE OPTIONS below.
 +
 See also INCOMPATIBLE OPTIONS below.
 
---empty={drop,keep,ask}::
+--empty=(drop|keep|ask)::
        How to handle commits that are not empty to start and are not
        clean cherry-picks of any upstream commit, but which become
        empty after rebasing (because they contain a subset of already
@@ -523,7 +523,7 @@ See also INCOMPATIBLE OPTIONS below.
 +
 The commit list format can be changed by setting the configuration option
 rebase.instructionFormat.  A customized instruction format will automatically
-have the long commit hash prepended to the format.
+have the commit hash prepended to the format.
 +
 See also INCOMPATIBLE OPTIONS below.
 
@@ -589,21 +589,27 @@ See also INCOMPATIBLE OPTIONS below.
 
 --autosquash::
 --no-autosquash::
-       When the commit log message begins with "squash! ..." or "fixup! ..."
-       or "amend! ...", and there is already a commit in the todo list that
-       matches the same `...`, automatically modify the todo list of
-       `rebase -i`, so that the commit marked for squashing comes right after
-       the commit to be modified, and change the action of the moved commit
-       from `pick` to `squash` or `fixup` or `fixup -C` respectively. A commit
-       matches the `...` if the commit subject matches, or if the `...` refers
-       to the commit's hash. As a fall-back, partial matches of the commit
-       subject work, too. The recommended way to create fixup/amend/squash
-       commits is by using the `--fixup`, `--fixup=amend:` or `--fixup=reword:`
-       and `--squash` options respectively of linkgit:git-commit[1].
+       Automatically squash commits with specially formatted messages into
+       previous commits being rebased.  If a commit message starts with
+       "squash! ", "fixup! " or "amend! ", the remainder of the subject line
+       is taken as a commit specifier, which matches a previous commit if it
+       matches the subject line or the hash of that commit.  If no commit
+       matches fully, matches of the specifier with the start of commit
+       subjects are considered.
 +
-If the `--autosquash` option is enabled by default using the
-configuration variable `rebase.autoSquash`, this option can be
-used to override and disable this setting.
+In the rebase todo list, the actions of squash, fixup and amend commits are
+changed from `pick` to `squash`, `fixup` or `fixup -C`, respectively, and they
+are moved right after the commit they modify.  The `--interactive` option can
+be used to review and edit the todo list before proceeding.
++
+The recommended way to create commits with squash markers is by using the
+`--squash`, `--fixup`, `--fixup=amend:` or `--fixup=reword:` options of
+linkgit:git-commit[1], which take the target commit as an argument and
+automatically fill in the subject line of the new commit from that.
++
+Setting configuration variable `rebase.autoSquash` to true enables
+auto-squashing by default for interactive rebase.  The `--no-autosquash`
+option can be used to override that setting.
 +
 See also INCOMPATIBLE OPTIONS below.
 
@@ -620,13 +626,16 @@ See also INCOMPATIBLE OPTIONS below.
        Automatically reschedule `exec` commands that failed. This only makes
        sense in interactive mode (or when an `--exec` option was provided).
 +
-Even though this option applies once a rebase is started, it's set for
-the whole rebase at the start based on either the
-`rebase.rescheduleFailedExec` configuration (see linkgit:git-config[1]
-or "CONFIGURATION" below) or whether this option is
-provided. Otherwise an explicit `--no-reschedule-failed-exec` at the
-start would be overridden by the presence of
-`rebase.rescheduleFailedExec=true` configuration.
+This option applies once a rebase is started. It is preserved for the whole
+rebase based on, in order, the command line option provided to the initial `git
+rebase`, the `rebase.rescheduleFailedExec` configuration (see
+linkgit:git-config[1] or "CONFIGURATION" below), or it defaults to false.
++
+Recording this option for the whole rebase is a convenience feature. Otherwise
+an explicit `--no-reschedule-failed-exec` at the start would be overridden by
+the presence of a `rebase.rescheduleFailedExec=true` configuration when `git
+rebase --continue` is invoked. Currently, you cannot pass
+`--[no-]reschedule-failed-exec` to `git rebase --continue`.
 
 --update-refs::
 --no-update-refs::
@@ -695,7 +704,7 @@ be dropped automatically with `--no-keep-empty`).
 Similar to the apply backend, by default the merge backend drops
 commits that become empty unless `-i`/`--interactive` is specified (in
 which case it stops and asks the user what to do).  The merge backend
-also has an `--empty={drop,keep,ask}` option for changing the behavior
+also has an `--empty=(drop|keep|ask)` option for changing the behavior
 of handling commits that become empty.
 
 Directory rename detection
@@ -957,10 +966,9 @@ The interactive rebase will stop when a command fails (i.e. exits with
 non-0 status) to give you an opportunity to fix the problem. You can
 continue with `git rebase --continue`.
 
-The "exec" command launches the command in a shell (the one specified
-in `$SHELL`, or the default shell if `$SHELL` is not set), so you can
-use shell features (like "cd", ">", ";" ...). The command is run from
-the root of the working tree.
+The "exec" command launches the command in a shell (the default one, usually
+/bin/sh), so you can use shell features (like "cd", ">", ";" ...). The command
+is run from the root of the working tree.
 
 ----------------------------------
 $ git rebase -i --exec "make test"
index 65ff518ccff49ea65812b70e9e46fac75733b7e6..20aca92073d8c9d65fc78ce5f3f48a02239333f5 100644 (file)
@@ -18,10 +18,10 @@ information fed from the remote end.
 
 This command is usually not invoked directly by the end user.
 The UI for the protocol is on the 'git send-pack' side, and the
-program pair is meant to be used to push updates to remote
+program pair is meant to be used to push updates to remote
 repository.  For pull operations, see linkgit:git-fetch-pack[1].
 
-The command allows for creation and fast-forwarding of sha1 refs
+The command allows for the creation and fast-forwarding of sha1 refs
 (heads/tags) on the remote end (strictly speaking, it is the
 local end 'git-receive-pack' runs, but to the user who is sitting at
 the send-pack end, it is updating the remote.  Confused?)
index ec64cbff4c6529d23fcf885ed5fa6f018404952f..a929c52982ff7629fdd32df1d008a0fb824847d0 100644 (file)
@@ -10,6 +10,7 @@ SYNOPSIS
 --------
 [verse]
 'git reflog' [show] [<log-options>] [<ref>]
+'git reflog list'
 'git reflog expire' [--expire=<time>] [--expire-unreachable=<time>]
        [--rewrite] [--updateref] [--stale-fix]
        [--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
@@ -39,6 +40,8 @@ actions, and in addition the `HEAD` reflog records branch switching.
 `git reflog show` is an alias for `git log -g --abbrev-commit
 --pretty=oneline`; see linkgit:git-log[1] for more information.
 
+The "list" subcommand lists all refs which have a corresponding reflog.
+
 The "expire" subcommand prunes older reflog entries. Entries older
 than `expire` time, or entries older than `expire-unreachable` time
 and not reachable from the current tip, are removed from the reflog.
index 88ea7e1cc01201ccf68ec1e2b8ccd2cda633903a..b33ee3c9e863b6bb3e5924ee021aeaa9b408466b 100644 (file)
@@ -44,15 +44,15 @@ The following sequences have a special meaning:
        This argument will not be passed to '<command>'. Instead, it
        will cause the helper to start by sending git:// service requests to
        the remote side with the service field set to an appropriate value and
-       the repository field set to rest of the argument. Default is not to send
+       the repository field set to the rest of the argument. Default is not to send
        such a request.
 +
-This is useful if remote side is git:// server accessed over
+This is useful if the remote side is git:// server accessed over
 some tunnel.
 
 '%V' (must be first characters in argument)::
        This argument will not be passed to '<command>'. Instead it sets
-       the vhost field in the git:// service request (to rest of the argument).
+       the vhost field in the git:// service request (to the rest of the argument).
        Default is not to send vhost in such request (if sent).
 
 ENVIRONMENT VARIABLES
@@ -82,12 +82,12 @@ begins with `ext::`.  Examples:
 
 "ext::ssh -i /home/foo/.ssh/somekey user&#64;host.example %S 'foo/repo'"::
        Like host.example:foo/repo, but use /home/foo/.ssh/somekey as
-       keypair and user as user on remote side. This avoids needing to
+       keypair and user as the user on the remote side. This avoids the need to
        edit .ssh/config.
 
 "ext::socat -t3600 - ABSTRACT-CONNECT:/git-server %G/somerepo"::
        Represents repository with path /somerepo accessible over
-       git protocol at abstract namespace address /git-server.
+       git protocol at the abstract namespace address /git-server.
 
 "ext::git-server-alias foo %G/repo"::
        Represents a repository with path /repo accessed using the
index 0451ceb8a26dfc0b4ef06dced69a2005bc4e5448..1dd2648a7904bb73c626019e9ab66e0db009ecf5 100644 (file)
@@ -13,19 +13,19 @@ DESCRIPTION
 -----------
 This helper uses specified file descriptors to connect to a remote Git server.
 This is not meant for end users but for programs and scripts calling git
-fetch, push or archive.
+fetch, push, or archive.
 
 If only <infd> is given, it is assumed to be a bidirectional socket connected
-to remote Git server (git-upload-pack, git-receive-pack or
+to a remote Git server (git-upload-pack, git-receive-pack, or
 git-upload-archive). If both <infd> and <outfd> are given, they are assumed
 to be pipes connected to a remote Git server (<infd> being the inbound pipe
-and <outfd> being the outbound pipe.
+and <outfd> being the outbound pipe).
 
 It is assumed that any handshaking procedures have already been completed
 (such as sending service request for git://) before this helper is started.
 
 <anything> can be any string. It is ignored. It is meant for providing
-information to user in the URL in case that URL is displayed in some
+information to the user in the URL in case that URL is displayed in some
 context.
 
 ENVIRONMENT VARIABLES
@@ -45,7 +45,7 @@ EXAMPLES
 `git push fd::7,8 master (as URL)`::
        Push master, using file descriptor #7 to read data from
        git-receive-pack and file descriptor #8 to write data to
-       same service.
+       the same service.
 
 `git push fd::7,8/bar master`::
        Same as above.
index 1dec3148348350bc6f26a53ca2add524d3f8b9bf..932a5c3ea4741c2abbfab9b7070a51fcf0b58a37 100644 (file)
@@ -35,7 +35,7 @@ OPTIONS
 -v::
 --verbose::
        Be a little more verbose and show remote url after name.
-       For promisor remotes, also show which filter (`blob:none` etc.)
+       For promisor remotes, also show which filters (`blob:none` etc.)
        are configured.
        NOTE: This must be placed between `remote` and subcommand.
 
index 4017157949e6d764a619f870c0eed538d3e99f64..c902512a9e89b07446a606b95cdff52ecc385c44 100644 (file)
@@ -74,6 +74,17 @@ to the new separate pack will be written.
        immediately instead of waiting for the next `git gc` invocation.
        Only useful with `--cruft -d`.
 
+--max-cruft-size=<n>::
+       Repack cruft objects into packs as large as `<n>` bytes before
+       creating new packs. As long as there are enough cruft packs
+       smaller than `<n>`, repacking will cause a new cruft pack to
+       be created containing objects from any combined cruft packs,
+       along with any new unreachable objects. Cruft packs larger than
+       `<n>` will not be modified. When the new cruft pack is larger
+       than `<n>` bytes, it will be split into multiple packs, all of
+       which are guaranteed to be at most `<n>` bytes in size. Only
+       useful with `--cruft -d`.
+
 --expire-to=<dir>::
        Write a cruft pack containing pruned objects (if any) to the
        directory `<dir>`. This option is useful for keeping a copy of
@@ -143,6 +154,29 @@ depth is 4095.
        a larger and slower repository; see the discussion in
        `pack.packSizeLimit`.
 
+--filter=<filter-spec>::
+       Remove objects matching the filter specification from the
+       resulting packfile and put them into a separate packfile. Note
+       that objects used in the working directory are not filtered
+       out. So for the split to fully work, it's best to perform it
+       in a bare repo and to use the `-a` and `-d` options along with
+       this option.  Also `--no-write-bitmap-index` (or the
+       `repack.writebitmaps` config option set to `false`) should be
+       used otherwise writing bitmap index will fail, as it supposes
+       a single packfile containing all the objects. See
+       linkgit:git-rev-list[1] for valid `<filter-spec>` forms.
+
+--filter-to=<dir>::
+       Write the pack containing filtered out objects to the
+       directory `<dir>`. Only useful with `--filter`. This can be
+       used for putting the pack on a separate object directory that
+       is accessed through the Git alternates mechanism. **WARNING:**
+       If the packfile containing the filtered out objects is not
+       accessible, the repo can become corrupt as it might not be
+       possible to access the objects in that packfile. See the
+       `objects` and `objects/info/alternates` sections of
+       linkgit:gitrepository-layout[5].
+
 -b::
 --write-bitmap-index::
        Write a reachability bitmap index as part of the repack. This
@@ -165,7 +199,7 @@ depth is 4095.
        Exclude the given pack from repacking. This is the equivalent
        of having `.keep` file on the pack. `<pack-name>` is the
        pack file name without leading directory (e.g. `pack-123.pack`).
-       The option could be specified multiple times to keep multiple
+       The option can be specified multiple times to keep multiple
        packs.
 
 --unpack-unreachable=<when>::
@@ -186,7 +220,7 @@ depth is 4095.
        Pass the `--delta-islands` option to `git-pack-objects`, see
        linkgit:git-pack-objects[1].
 
--g=<factor>::
+-g<factor>::
 --geometric=<factor>::
        Arrange resulting pack structure so that each successive pack
        contains at least `<factor>` times the number of objects as the
@@ -203,11 +237,8 @@ uniquely by the set of packs being "rolled-up"; in other words, the
 packs determined to need to be combined in order to restore a geometric
 progression.
 +
-When `--unpacked` is specified, loose objects are implicitly included in
-this "roll-up", without respect to their reachability. This is subject
-to change in the future. This option (implying a drastically different
-repack mode) is not guaranteed to work with all other combinations of
-option to `git repack`.
+Loose objects are implicitly included in this "roll-up", without respect to
+their reachability. This is subject to change in the future.
 +
 When writing a multi-pack bitmap, `git repack` selects the largest resulting
 pack as the preferred pack for object selection by the MIDX (see
index f271d758c38230410165238de266db7de2d73f71..0a65460adbded52c7d699228a7b3247c5fdf7fad 100644 (file)
@@ -35,7 +35,7 @@ Replacement references will be used by default by all Git commands
 except those doing reachability traversal (prune, pack transfer and
 fsck).
 
-It is possible to disable use of replacement references for any
+It is possible to disable the use of replacement references for any
 command using the `--no-replace-objects` option just after 'git'.
 
 For example if commit 'foo' has been replaced by commit 'bar':
@@ -111,14 +111,14 @@ OPTIONS
 FORMATS
 -------
 
-The following format are available:
+The following formats are available:
 
 * 'short':
-       <replaced sha1>
+       <replaced-sha1>
 * 'medium':
-       <replaced sha1> -> <replacement sha1>
+       <replaced-sha1> -> <replacement-sha1>
 * 'long':
-       <replaced sha1> (<replaced type>) -> <replacement sha1> (<replacement type>)
+       <replaced-sha1> (<replaced-type>) -> <replacement-sha1> (<replacement-type>)
 
 CREATING REPLACEMENT OBJECTS
 ----------------------------
diff --git a/Documentation/git-replay.txt b/Documentation/git-replay.txt
new file mode 100644 (file)
index 0000000..f6c269c
--- /dev/null
@@ -0,0 +1,127 @@
+git-replay(1)
+=============
+
+NAME
+----
+git-replay - EXPERIMENTAL: Replay commits on a new base, works with bare repos too
+
+
+SYNOPSIS
+--------
+[verse]
+(EXPERIMENTAL!) 'git replay' ([--contained] --onto <newbase> | --advance <branch>) <revision-range>...
+
+DESCRIPTION
+-----------
+
+Takes ranges of commits and replays them onto a new location. Leaves
+the working tree and the index untouched, and updates no references.
+The output of this command is meant to be used as input to
+`git update-ref --stdin`, which would update the relevant branches
+(see the OUTPUT section below).
+
+THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
+
+OPTIONS
+-------
+
+--onto <newbase>::
+       Starting point at which to create the new commits.  May be any
+       valid commit, and not just an existing branch name.
++
+When `--onto` is specified, the update-ref command(s) in the output will
+update the branch(es) in the revision range to point at the new
+commits, similar to the way how `git rebase --update-refs` updates
+multiple branches in the affected range.
+
+--advance <branch>::
+       Starting point at which to create the new commits; must be a
+       branch name.
++
+When `--advance` is specified, the update-ref command(s) in the output
+will update the branch passed as an argument to `--advance` to point at
+the new commits (in other words, this mimics a cherry-pick operation).
+
+<revision-range>::
+       Range of commits to replay. More than one <revision-range> can
+       be passed, but in `--advance <branch>` mode, they should have
+       a single tip, so that it's clear where <branch> should point
+       to. See "Specifying Ranges" in linkgit:git-rev-parse and the
+       "Commit Limiting" options below.
+
+include::rev-list-options.txt[]
+
+OUTPUT
+------
+
+When there are no conflicts, the output of this command is usable as
+input to `git update-ref --stdin`.  It is of the form:
+
+       update refs/heads/branch1 ${NEW_branch1_HASH} ${OLD_branch1_HASH}
+       update refs/heads/branch2 ${NEW_branch2_HASH} ${OLD_branch2_HASH}
+       update refs/heads/branch3 ${NEW_branch3_HASH} ${OLD_branch3_HASH}
+
+where the number of refs updated depends on the arguments passed and
+the shape of the history being replayed.  When using `--advance`, the
+number of refs updated is always one, but for `--onto`, it can be one
+or more (rebasing multiple branches simultaneously is supported).
+
+EXIT STATUS
+-----------
+
+For a successful, non-conflicted replay, the exit status is 0.  When
+the replay has conflicts, the exit status is 1.  If the replay is not
+able to complete (or start) due to some kind of error, the exit status
+is something other than 0 or 1.
+
+EXAMPLES
+--------
+
+To simply rebase `mybranch` onto `target`:
+
+------------
+$ git replay --onto target origin/main..mybranch
+update refs/heads/mybranch ${NEW_mybranch_HASH} ${OLD_mybranch_HASH}
+------------
+
+To cherry-pick the commits from mybranch onto target:
+
+------------
+$ git replay --advance target origin/main..mybranch
+update refs/heads/target ${NEW_target_HASH} ${OLD_target_HASH}
+------------
+
+Note that the first two examples replay the exact same commits and on
+top of the exact same new base, they only differ in that the first
+provides instructions to make mybranch point at the new commits and
+the second provides instructions to make target point at them.
+
+What if you have a stack of branches, one depending upon another, and
+you'd really like to rebase the whole set?
+
+------------
+$ git replay --contained --onto origin/main origin/main..tipbranch
+update refs/heads/branch1 ${NEW_branch1_HASH} ${OLD_branch1_HASH}
+update refs/heads/branch2 ${NEW_branch2_HASH} ${OLD_branch2_HASH}
+update refs/heads/tipbranch ${NEW_tipbranch_HASH} ${OLD_tipbranch_HASH}
+------------
+
+When calling `git replay`, one does not need to specify a range of
+commits to replay using the syntax `A..B`; any range expression will
+do:
+
+------------
+$ git replay --onto origin/main ^base branch1 branch2 branch3
+update refs/heads/branch1 ${NEW_branch1_HASH} ${OLD_branch1_HASH}
+update refs/heads/branch2 ${NEW_branch2_HASH} ${OLD_branch2_HASH}
+update refs/heads/branch3 ${NEW_branch3_HASH} ${OLD_branch3_HASH}
+------------
+
+This will simultaneously rebase `branch1`, `branch2`, and `branch3`,
+all commits they have since `base`, playing them on top of
+`origin/main`. These three branches may have commits on top of `base`
+that they have in common, but that does not need to be the case.
+
+GIT
+---
+Part of the linkgit:git[1] suite
index fa5a42670929a9994b7d3580e1e3c76a69b0ab6a..15dcbb6d91c89eac48623f119e417824b5154e26 100644 (file)
@@ -16,7 +16,7 @@ DESCRIPTION
 Generate a request asking your upstream project to pull changes into
 their tree.  The request, printed to the standard output,
 begins with the branch description, summarizes
-the changes and indicates from where they can be pulled.
+the changes, and indicates from where they can be pulled.
 
 The upstream project is expected to have the commit named by
 `<start>` and the output asks it to integrate the changes you made
@@ -50,7 +50,7 @@ EXAMPLES
 --------
 
 Imagine that you built your work on your `master` branch on top of
-the `v1.0` release, and want it to be integrated to the project.
+the `v1.0` release, and want it to be integrated into the project.
 First you push that change to your public repository for others to
 see:
 
index 5964810caa4153a6628ca312669a77a90b41943a..975825b44aa4d01309c46c1923228c372a50e886 100644 (file)
@@ -78,6 +78,8 @@ all modified paths.
 --theirs::
        When restoring files in the working tree from the index, use
        stage #2 ('ours') or #3 ('theirs') for unmerged paths.
+       This option cannot be used when checking out paths from a
+       tree-ish (i.e. with the `--source` option).
 +
 Note that during `git rebase` and `git pull --rebase`, 'ours' and
 'theirs' may appear swapped. See the explanation of the same options
@@ -87,6 +89,8 @@ in linkgit:git-checkout[1] for details.
 --merge::
        When restoring files on the working tree from the index,
        recreate the conflicted merge in the unmerged paths.
+       This option cannot be used when checking out paths from a
+       tree-ish (i.e. with the `--source` option).
 
 --conflict=<style>::
        The same as `--merge` option above, but changes the way the
@@ -101,7 +105,7 @@ in linkgit:git-checkout[1] for details.
        specified. Unmerged paths on the working tree are left alone.
 
 --ignore-skip-worktree-bits::
-       In sparse checkout mode, by default is to only update entries
+       In sparse checkout mode, the default is to only update entries
        matched by `<pathspec>` and sparse patterns in
        $GIT_DIR/info/sparse-checkout. This option ignores the sparse
        patterns and unconditionally restores any files in
@@ -195,7 +199,7 @@ the same as using linkgit:git-reset[1])
 $ git restore --staged hello.c
 ------------
 
-or you can restore both the index and the working tree (this the same
+or you can restore both the index and the working tree (this is the same
 as using linkgit:git-checkout[1])
 
 ------------
index 51029a22715cb3b52fdad8cb868070d9ac626246..2e05c4b510927a66560ade549d9b7a05987e9d33 100644 (file)
@@ -17,9 +17,9 @@ DESCRIPTION
 :git-rev-list: 1
 include::rev-list-description.txt[]
 
-'rev-list' is a very essential Git command, since it
+'rev-list' is an essential Git command, since it
 provides the ability to build and traverse commit ancestry graphs. For
-this reason, it has a lot of different options that enables it to be
+this reason, it has a lot of different options that enable it to be
 used by commands as different as 'git bisect' and
 'git repack'.
 
index f0f9021f2a5a0b6a51798b71d61729efcc0be969..f9d5a35fa00d7b779e43e884ca228e5a8a23425e 100644 (file)
@@ -9,12 +9,12 @@ git-rev-parse - Pick out and massage parameters
 SYNOPSIS
 --------
 [verse]
-'git rev-parse' [<options>] <args>...
+'git rev-parse' [<options>] <arg>...
 
 DESCRIPTION
 -----------
 
-Many Git porcelainish commands take mixture of flags
+Many Git porcelainish commands take mixture of flags
 (i.e. parameters that begin with a dash '-') and parameters
 meant for the underlying 'git rev-list' command they use internally
 and flags and parameters for the other commands they use
@@ -36,7 +36,7 @@ Each of these options must appear first on the command line.
 --sq-quote::
        Use 'git rev-parse' in shell quoting mode (see SQ-QUOTE
        section below). In contrast to the `--sq` option below, this
-       mode does only quoting. Nothing else is done to command input.
+       mode only does quoting. Nothing else is done to command input.
 
 Options for --parseopt
 ~~~~~~~~~~~~~~~~~~~~~~
@@ -130,7 +130,7 @@ for another option.
        'git diff-{asterisk}'). In contrast to the `--sq-quote` option,
        the command input is still interpreted as usual.
 
---short[=length]::
+--short[=<length>]::
        Same as `--verify` but shortens the object name to a unique
        prefix with at least `length` characters. The minimum length
        is 4, the default is the effective value of the `core.abbrev`
@@ -156,7 +156,7 @@ for another option.
        are not refs (i.e. branch or tag names; or more
        explicitly disambiguating "heads/master" form, when you
        want to name the "master" branch when there is an
-       unfortunately named tag "master"), and show them as full
+       unfortunately named tag "master"), and shows them as full
        refnames (e.g. "refs/heads/master").
 
 --output-object-format=(sha1|sha256|storage)::
@@ -177,9 +177,9 @@ Options for Objects
 --all::
        Show all refs found in `refs/`.
 
---branches[=pattern]::
---tags[=pattern]::
---remotes[=pattern]::
+--branches[=<pattern>]::
+--tags[=<pattern>]::
+--remotes[=<pattern>]::
        Show all branches, tags, or remote-tracking branches,
        respectively (i.e., refs found in `refs/heads`,
        `refs/tags`, or `refs/remotes`, respectively).
@@ -188,7 +188,7 @@ If a `pattern` is given, only refs matching the given shell glob are
 shown.  If the pattern does not contain a globbing character (`?`,
 `*`, or `[`), it is turned into a prefix match by appending `/*`.
 
---glob=pattern::
+--glob=<pattern>::
        Show all refs matching the shell glob pattern `pattern`. If
        the pattern does not start with `refs/`, this is automatically
        prepended.  If the pattern does not contain a globbing
@@ -209,7 +209,7 @@ respectively, and they must begin with `refs/` when applied to `--glob`
 or `--all`. If a trailing '/{asterisk}' is intended, it must be given
 explicitly.
 
---exclude-hidden=[fetch|receive|uploadpack]::
+--exclude-hidden=(fetch|receive|uploadpack)::
        Do not include refs that would be hidden by `git-fetch`,
        `git-receive-pack` or `git-upload-pack` by consulting the appropriate
        `fetch.hideRefs`, `receive.hideRefs` or `uploadpack.hideRefs`
@@ -319,21 +319,24 @@ The following options are unaffected by `--path-format`:
        input, multiple algorithms may be printed, space-separated.
        If not specified, the default is "storage".
 
+--show-ref-format::
+       Show the reference storage format used for the repository.
+
 
 Other Options
 ~~~~~~~~~~~~~
 
---since=datestring::
---after=datestring::
+--since=<datestring>::
+--after=<datestring>::
        Parse the date string, and output the corresponding
        --max-age= parameter for 'git rev-list'.
 
---until=datestring::
---before=datestring::
+--until=<datestring>::
+--before=<datestring>::
        Parse the date string, and output the corresponding
        --min-age= parameter for 'git rev-list'.
 
-<args>...::
+<arg>...::
        Flags and parameters to be parsed.
 
 
@@ -395,7 +398,7 @@ Each line of options has this format:
        dash to separate words in a multi-word argument hint.
 
 The remainder of the line, after stripping the spaces, is used
-as the help associated to the option.
+as the help associated with the option.
 
 Blank lines are ignored, and lines that don't match this specification are used
 as option group headers (start the line with a space to create such
@@ -410,7 +413,7 @@ some-command [<options>] <args>...
 
 some-command does foo and bar!
 --
-h,help    show the help
+h,help!   show the help
 
 foo       some nifty option --foo
 bar=      some cool option --bar with an argument
@@ -436,10 +439,10 @@ usage: some-command [<options>] <args>...
     some-command does foo and bar!
 
     -h, --help            show the help
-    --foo                 some nifty option --foo
-    --bar ...             some cool option --bar with an argument
-    --baz <arg>           another cool option --baz with a named argument
-    --qux[=<path>]        qux may take a path argument but has meaning by itself
+    --[no-]foo            some nifty option --foo
+    --[no-]bar ...        some cool option --bar with an argument
+    --[no-]baz <arg>      another cool option --baz with a named argument
+    --[no-]qux[=<path>]   qux may take a path argument but has meaning by itself
 
 An option group Header
     -C[...]               option C with an optional argument
index d2e10d3dceb60e0a6c8322a47f8017701338710e..568925db533879697304459d6e47fe5f48861cf1 100644 (file)
@@ -116,7 +116,7 @@ include::rerere-options.txt[]
 
 --reference::
        Instead of starting the body of the log message with "This
-       reverts <full object name of the commit being reverted>.",
+       reverts <full-object-name-of-the-commit-being-reverted>.",
        refer to the commit using "--pretty=reference" format
        (cf. linkgit:git-log[1]).  The `revert.reference`
        configuration variable can be used to enable this option by
@@ -142,6 +142,16 @@ EXAMPLES
        changes. The revert only modifies the working tree and the
        index.
 
+DISCUSSION
+----------
+
+While git creates a basic commit message automatically, it is
+_strongly_ recommended to explain why the original commit is being
+reverted.
+In addition, repeatedly reverting reverts will result in increasingly
+unwieldy subject lines, for example 'Reapply "Reapply "<original-subject>""'.
+Please consider rewording these to be shorter and more unique.
+
 CONFIGURATION
 -------------
 
index 81bc23f3cdbb56fbb8e0bd79c2bae40d35772cac..363a26934f54e06a4870cd1b7657082591f80f21 100644 (file)
@@ -163,7 +163,7 @@ will be staged (unless --cached or -n are used).
 
 A submodule is considered up to date when the HEAD is the same as
 recorded in the index, no tracked files are modified and no untracked
-files that aren't ignored are present in the submodules work tree.
+files that aren't ignored are present in the submodule's work tree.
 Ignored files are deemed expendable and won't stop a submodule's work
 tree from being removed.
 
index 492a82323dab8e144e96897a78e1daf22c76be6e..c5d664f4519ba61824c212a8fb2510df17c8bf03 100644 (file)
@@ -9,8 +9,8 @@ git-send-email - Send a collection of patches as emails
 SYNOPSIS
 --------
 [verse]
-'git send-email' [<options>] <file|directory>...
-'git send-email' [<options>] <format-patch options>
+'git send-email' [<options>] (<file>|<directory>)...
+'git send-email' [<options>] <format-patch-options>
 'git send-email' --dump-aliases
 
 
@@ -68,11 +68,12 @@ This option may be specified multiple times.
        Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
        to edit an introductory message for the patch series.
 +
-When `--compose` is used, git send-email will use the From, Subject, and
-In-Reply-To headers specified in the message. If the body of the message
-(what you type after the headers and a blank line) only contains blank
-(or Git: prefixed) lines, the summary won't be sent, but From, Subject,
-and In-Reply-To headers will be used unless they are removed.
+When `--compose` is used, git send-email will use the From, To, Cc, Bcc,
+Subject, Reply-To, and In-Reply-To headers specified in the message. If
+the body of the message (what you type after the headers and a blank
+line) only contains blank (or Git: prefixed) lines, the summary won't be
+sent, but the headers mentioned above will be used unless they are
+removed.
 +
 Missing From or In-Reply-To headers will be prompted for.
 +
@@ -137,7 +138,7 @@ Note that no attempts whatsoever are made to validate the encoding.
 
 --compose-encoding=<encoding>::
        Specify encoding of compose message. Default is the value of the
-       'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
+       'sendemail.composeEncoding'; if that is unspecified, UTF-8 is assumed.
 
 --transfer-encoding=(7bit|8bit|quoted-printable|base64|auto)::
        Specify the transfer encoding to be used to send the message over SMTP.
@@ -173,7 +174,7 @@ Sending
        Specify a command to run to send the email. The command should
        be sendmail-like; specifically, it must support the `-i` option.
        The command will be executed in the shell if necessary.  Default
-       is the value of `sendemail.sendmailcmd`.  If unspecified, and if
+       is the value of `sendemail.sendmailCmd`.  If unspecified, and if
        --smtp-server is also unspecified, git-send-email will search
        for `sendmail` in `/usr/sbin`, `/usr/lib` and $PATH.
 
@@ -268,7 +269,7 @@ must be used for each option.
        certificates concatenated together: see verify(1) -CAfile and
        -CApath for more information on these). Set it to an empty string
        to disable certificate verification. Defaults to the value of the
-       `sendemail.smtpsslcertpath` configuration variable, if set, or the
+       `sendemail.smtpSSLCertPath` configuration variable, if set, or the
        backing SSL library's compiled-in default otherwise (which should
        be the best choice on most platforms).
 
@@ -277,7 +278,7 @@ must be used for each option.
        if a username is not specified (with `--smtp-user` or `sendemail.smtpUser`),
        then authentication is not attempted.
 
---smtp-debug=0|1::
+--smtp-debug=(0|1)::
        Enable (1) or disable (0) debug output. If enabled, SMTP
        commands and replies will be printed. Useful to debug TLS
        connection and authentication problems.
@@ -300,7 +301,9 @@ must be used for each option.
 Automating
 ~~~~~~~~~~
 
---no-[to|cc|bcc]::
+--no-to::
+--no-cc::
+--no-bcc::
        Clears any list of "To:", "Cc:", "Bcc:" addresses previously
        set via config.
 
@@ -312,7 +315,7 @@ Automating
        Specify a command to execute once per patch file which
        should generate patch file specific "To:" entries.
        Output of this command must be single email address per line.
-       Default is the value of 'sendemail.tocmd' configuration value.
+       Default is the value of 'sendemail.toCmd' configuration value.
 
 --cc-cmd=<command>::
        Specify a command to execute once per patch file which
@@ -347,19 +350,19 @@ Automating
 
 --[no-]signed-off-by-cc::
        If this is set, add emails found in the `Signed-off-by` trailer or Cc: lines to the
-       cc list. Default is the value of `sendemail.signedoffbycc` configuration
+       cc list. Default is the value of `sendemail.signedOffByCc` configuration
        value; if that is unspecified, default to --signed-off-by-cc.
 
 --[no-]cc-cover::
        If this is set, emails found in Cc: headers in the first patch of
        the series (typically the cover letter) are added to the cc list
-       for each email set. Default is the value of 'sendemail.cccover'
+       for each email set. Default is the value of 'sendemail.ccCover'
        configuration value; if that is unspecified, default to --no-cc-cover.
 
 --[no-]to-cover::
        If this is set, emails found in To: headers in the first patch of
        the series (typically the cover letter) are added to the to list
-       for each email set. Default is the value of 'sendemail.tocover'
+       for each email set. Default is the value of 'sendemail.toCover'
        configuration value; if that is unspecified, default to --no-to-cover.
 
 --suppress-cc=<category>::
@@ -383,7 +386,7 @@ Automating
 - 'all' will suppress all auto cc values.
 --
 +
-Default is the value of `sendemail.suppresscc` configuration value; if
+Default is the value of `sendemail.suppressCc` configuration value; if
 that is unspecified, default to 'self' if --suppress-from is
 specified, as well as 'body' if --no-signed-off-cc is specified.
 
@@ -453,7 +456,7 @@ have been specified, in which case default to 'compose'.
                        998 characters unless a suitable transfer encoding
                        ('auto', 'base64', or 'quoted-printable') is used;
                        this is due to SMTP limits as described by
-                       http://www.ietf.org/rfc/rfc5322.txt.
+                       https://www.ietf.org/rfc/rfc5322.txt.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
@@ -468,9 +471,9 @@ Information
 
 --dump-aliases::
        Instead of the normal operation, dump the shorthand alias names from
-       the configured alias file(s), one per line in alphabetical order. Note,
-       this only includes the alias name and not its expanded email addresses.
-       See 'sendemail.aliasesfile' for more information about aliases.
+       the configured alias file(s), one per line in alphabetical order. Note
+       that this only includes the alias name and not its expanded email addresses.
+       See 'sendemail.aliasesFile' for more information about aliases.
 
 
 CONFIGURATION
index 595b002152fda5dbdedbc65d7feda8d0c4f9ec20..b9e73f2e77b1ccd35ac76ce075a59b362fa7f1dd 100644 (file)
@@ -55,7 +55,7 @@ be in a separate packet, and the list must end with a flush packet.
 --force::
        Usually, the command refuses to update a remote ref that
        is not an ancestor of the local ref used to overwrite it.
-       This flag disables the check.  What this means is that
+       This flag disables the check.  This means that
        the remote repository can lose commits; use it with
        care.
 
@@ -106,7 +106,7 @@ SPECIFYING THE REFS
 There are three ways to specify which refs to update on the
 remote end.
 
-With `--all` flag, all refs that exist locally are transferred to
+With the `--all` flag, all refs that exist locally are transferred to
 the remote side.  You cannot specify any '<ref>' if you use
 this flag.
 
@@ -115,9 +115,9 @@ both on the local side and on the remote side are updated.
 
 When one or more '<ref>' are specified explicitly (whether on the
 command line or via `--stdin`), it can be either a
-single pattern, or a pair of such pattern separated by a colon
+single pattern, or a pair of such patterns separated by a colon
 ":" (this means that a ref name cannot have a colon in it).  A
-single pattern '<name>' is just shorthand for '<name>:<name>'.
+single pattern '<name>' is just shorthand for '<name>:<name>'.
 
 Each pattern pair consists of the source side (before the colon)
 and the destination side (after the colon).  The ref to be
@@ -130,7 +130,7 @@ name. See linkgit:git-rev-parse[1].
  - It is an error if <src> does not match exactly one of the
    local refs.
 
- - It is an error if <dst> matches more than one remote refs.
+ - It is an error if <dst> matches more than one remote ref.
 
  - If <dst> does not match any remote ref, either
 
@@ -143,9 +143,9 @@ name. See linkgit:git-rev-parse[1].
 
 Without `--force`, the <src> ref is stored at the remote only if
 <dst> does not exist, or <dst> is a proper subset (i.e. an
-ancestor) of <src>.  This check, known as "fast-forward check",
-is performed in order to avoid accidentally overwriting the
-remote ref and lose other peoples' commits from there.
+ancestor) of <src>.  This check, known as the "fast-forward check",
+is performed to avoid accidentally overwriting the
+remote ref and losing other people's commits from there.
 
 With `--force`, the fast-forward check is disabled for all refs.
 
index 8632612c31d07818659ff4f68ee567c789e5cd48..bdaf6e5fc4fa79f055e7eb1717464716ea420cc8 100644 (file)
@@ -22,7 +22,7 @@ The 'git sh-setup' scriptlet is designed to be sourced (using
 the normal Git directories and a few helper shell functions.
 
 Before sourcing it, your script should set up a few variables;
-`USAGE` (and `LONG_USAGE`, if any) is used to define message
+`USAGE` (and `LONG_USAGE`, if any) is used to define the message
 given by `usage()` shell function.  `SUBDIRECTORY_OK` can be set
 if the script can run from a subdirectory of the working tree
 (some commands do not).
index 58cf6210cde2d3d1889d9fc9ac1b49bafaaa09e2..c771c89770787356193bd4e241b1fae8069f8d48 100644 (file)
@@ -50,7 +50,7 @@ OPTIONS
 
 --current::
        With this option, the command includes the current
-       branch to the list of revs to be shown when it is not
+       branch in the list of revs to be shown when it is not
        given on the command line.
 
 --topo-order::
@@ -125,7 +125,7 @@ OPTIONS
        default to color output.
        Same as `--color=never`.
 
-Note that --more, --list, --independent and --merge-base options
+Note that --more, --list, --independent, and --merge-base options
 are mutually exclusive.
 
 
@@ -137,14 +137,14 @@ their commit message. The branch head that is pointed at by
 $GIT_DIR/HEAD is prefixed with an asterisk `*` character while other
 heads are prefixed with a `!` character.
 
-Following these N lines, one-line log for each commit is
+Following these N lines, one-line log for each commit is
 displayed, indented N places.  If a commit is on the I-th
 branch, the I-th indentation character shows a `+` sign;
 otherwise it shows a space.  Merge commits are denoted by
 a `-` sign.  Each commit shows a short name that
 can be used as an extended SHA-1 to name that commit.
 
-The following example shows three branches, "master", "fixes"
+The following example shows three branches, "master", "fixes",
 and "mhf":
 
 ------------------------------------------------
@@ -154,7 +154,7 @@ $ git show-branch master fixes mhf
   ! [mhf] Allow "+remote:local" refspec to cause --force when fetching.
 ---
   + [mhf] Allow "+remote:local" refspec to cause --force when fetching.
-  + [mhf~1] Use git-octopus when pulling more than one heads.
+  + [mhf~1] Use git-octopus when pulling more than one head.
  +  [fixes] Introduce "reset type" flag to "git reset"
   + [mhf~2] "git fetch --force".
   + [mhf~3] Use .git/remote/origin, not .git/branches/origin.
@@ -197,7 +197,7 @@ $ git show-branch --reflog="10,1 hour ago" --list master
 
 shows 10 reflog entries going back from the tip as of 1 hour ago.
 Without `--list`, the output also shows how these tips are
-topologically related with each other.
+topologically related to each other.
 
 CONFIGURATION
 -------------
index 2fe274b8faa6d304bb27a7bc2bb9b09810a94217..ba7574700593e85ea65ac2e0e8516f286d11dcc8 100644 (file)
@@ -8,10 +8,14 @@ git-show-ref - List references in a local repository
 SYNOPSIS
 --------
 [verse]
-'git show-ref' [-q | --quiet] [--verify] [--head] [-d | --dereference]
+'git show-ref' [--head] [-d | --dereference]
             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]
             [--heads] [--] [<pattern>...]
+'git show-ref' --verify [-q | --quiet] [-d | --dereference]
+            [-s | --hash[=<n>]] [--abbrev[=<n>]]
+            [--] [<ref>...]
 'git show-ref' --exclude-existing[=<pattern>]
+'git show-ref' --exists <ref>
 
 DESCRIPTION
 -----------
@@ -27,6 +31,10 @@ The `--exclude-existing` form is a filter that does the inverse. It reads
 refs from stdin, one ref per line, and shows those that don't exist in
 the local repository.
 
+The `--exists` form can be used to check for the existence of a single
+references. This form does not verify whether the reference resolves to an
+actual object.
+
 Use of this utility is encouraged in favor of directly accessing files under
 the `.git` directory.
 
@@ -62,6 +70,12 @@ OPTIONS
        Aside from returning an error code of 1, it will also print an error
        message if `--quiet` was not specified.
 
+--exists::
+
+       Check whether the given reference exists. Returns an exit code of 0 if
+       it does, 2 if it is missing, and 1 in case looking up the reference
+       failed with an error other than the reference being missing.
+
 --abbrev[=<n>]::
 
        Abbreviate the object name.  When using `--hash`, you do
@@ -70,8 +84,8 @@ OPTIONS
 -q::
 --quiet::
 
-       Do not print any results to stdout. When combined with `--verify`, this
-       can be used to silently check if a reference exists.
+       Do not print any results to stdout. Can be used with `--verify` to
+       silently check if a reference exists.
 
 --exclude-existing[=<pattern>]::
 
@@ -144,7 +158,7 @@ use:
 -----------------------------------------------------------------------------
 
 This will show "refs/heads/master" but also "refs/remote/other-repo/master",
-if such references exists.
+if such references exist.
 
 When using the `--verify` flag, the command requires an exact path:
 
index 2b1bc7288d5f6fd27b92ed8119ef5dfbc89b9d1d..5eb67439affbef1a7fccb6a745220977b6a0a45d 100644 (file)
@@ -26,7 +26,7 @@ with --name-only).
 
 For plain blobs, it shows the plain contents.
 
-The command takes options applicable to the 'git diff-tree' command to
+Some options that 'git log' command understands can be used to
 control how the changes the commit introduces are shown.
 
 This manual page describes only the most frequently used options.
@@ -61,7 +61,7 @@ EXAMPLES
 --------
 
 `git show v1.0.0`::
-       Shows the tag `v1.0.0`, along with the object the tags
+       Shows the tag `v1.0.0`, along with the object the tag
        points at.
 
 `git show v1.0.0^{tree}`::
index a051b1e8f383abc618397ea7e2ac2f173d30a111..b0f36fabfb391c10582a6f0feb63fa596e693ddc 100644 (file)
@@ -245,11 +245,12 @@ U           U    unmerged, both modified
 ....
 
 Submodules have more state and instead report
-               M    the submodule has a different HEAD than
-                    recorded in the index
-               m    the submodule has modified content
-               ?    the submodule has untracked files
-since modified content or untracked files in a submodule cannot be added
+
+* 'M' = the submodule has a different HEAD than recorded in the index
+* 'm' = the submodule has modified content
+* '?' = the submodule has untracked files
+
+This is since modified content or untracked files in a submodule cannot be added
 via `git add` in the superproject to prepare a commit.
 
 'm' and '?' are applied recursively. For example if a nested submodule
@@ -308,7 +309,7 @@ Line                                     Notes
 ------------------------------------------------------------
 # branch.oid <commit> | (initial)        Current commit.
 # branch.head <branch> | (detached)      Current branch.
-# branch.upstream <upstream_branch>      If upstream is set.
+# branch.upstream <upstream-branch>      If upstream is set.
 # branch.ab +<ahead> -<behind>           If upstream is set and
                                         the commit is present.
 ------------------------------------------------------------
@@ -471,7 +472,7 @@ again, because your configuration may already be caching `git status`
 results, so it could be faster on subsequent runs.
 
 * The `--untracked-files=no` flag or the
-       `status.showUntrackedfiles=false` config (see above for both):
+       `status.showUntrackedFiles=no` config (see above for both):
        indicate that `git status` should not report untracked
        files. This is the fastest option. `git status` will not list
        the untracked files, so you need to be careful to remember if
@@ -501,7 +502,7 @@ results, so it could be faster on subsequent runs.
        usually worth the additional size.
 
 * `core.untrackedCache=true` and `core.fsmonitor=true` or
-       `core.fsmonitor=<hook_command_pathname>` (see
+       `core.fsmonitor=<hook-command-pathname>` (see
        linkgit:git-update-index[1]): enable both the untracked cache
        and FSMonitor features and only search directories that have
        been modified since the previous `git status` command.  This
index 2438f76da05ebf013103a08962d634c4baa9ea15..a293327581aa54e120d1edc3b72467e42c250af4 100644 (file)
@@ -29,7 +29,7 @@ With no arguments, this will:
 In the case where the input consists entirely of whitespace characters, no
 output will be produced.
 
-*NOTE*: This is intended for cleaning metadata, prefer the `--whitespace=fix`
+*NOTE*: This is intended for cleaning metadata. Prefer the `--whitespace=fix`
 mode of linkgit:git-apply[1] for correcting whitespace of patches or files in
 the repository.
 
@@ -37,11 +37,11 @@ OPTIONS
 -------
 -s::
 --strip-comments::
-       Skip and remove all lines starting with comment character (default '#').
+       Skip and remove all lines starting with comment character (default '#').
 
 -c::
 --comment-lines::
-       Prepend comment character and blank to each line. Lines will automatically
+       Prepend the comment character and a blank space to each line. Lines will automatically
        be terminated with a newline. On empty lines, only the comment character
        will be prepended.
 
index 695730609aa3ab5a18d45cbff6aba5d1499dfdce..ca0347a37b554d168c918c7144a28e2b0c922c1c 100644 (file)
@@ -136,7 +136,7 @@ If you really want to remove a submodule from the repository and commit
 that use linkgit:git-rm[1] instead. See linkgit:gitsubmodules[7] for removal
 options.
 
-update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--depth <depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter <filter spec>] [--] [<path>...]::
+update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--depth <depth>] [--recursive] [--jobs <n>] [--[no-]single-branch] [--filter <filter-spec>] [--] [<path>...]::
 +
 --
 Update the registered submodules to match what the superproject
@@ -185,7 +185,7 @@ submodule with the `--init` option.
 If `--recursive` is specified, this command will recurse into the
 registered submodules, and update any nested submodules within.
 
-If `--filter <filter spec>` is specified, the given partial clone filter will be
+If `--filter <filter-spec>` is specified, the given partial clone filter will be
 applied to the submodule. See linkgit:git-rev-list[1] for details on filter
 specifications.
 --
index 4e92308e85db5aab3b3e7f591e0ddb1f21afe724..43c68c2ec44f6a055ade52f15c29e36dfed42b45 100644 (file)
@@ -37,12 +37,12 @@ COMMANDS
        argument.  Normally this command initializes the current
        directory.
 
--T<trunk_subdir>;;
---trunk=<trunk_subdir>;;
--t<tags_subdir>;;
---tags=<tags_subdir>;;
--b<branches_subdir>;;
---branches=<branches_subdir>;;
+-T<trunk-subdir>;;
+--trunk=<trunk-subdir>;;
+-t<tags-subdir>;;
+--tags=<tags-subdir>;;
+-b<branches-subdir>;;
+--branches=<branches-subdir>;;
 -s;;
 --stdlayout;;
        These are optional command-line options for init.  Each of
@@ -726,9 +726,9 @@ ADVANCED OPTIONS
        when tracking a single URL.  The 'log' and 'dcommit' commands
        no longer require this switch as an argument.
 
--R<remote name>::
---svn-remote <remote name>::
-       Specify the [svn-remote "<remote name>"] section to use,
+-R<remote-name>::
+--svn-remote <remote-name>::
+       Specify the [svn-remote "<remote-name>"] section to use,
        this allows SVN multiple repositories to be tracked.
        Default: "svn"
 
index c60fc9c138b5981ce5727efa4482350e699dbac5..f38e4c8afa1bcbcfba7bd8b3e1da0bbad9703f77 100644 (file)
@@ -59,13 +59,18 @@ out at most one of `A` and `B`, in which case it defaults to `HEAD`.
 -c <new-branch>::
 --create <new-branch>::
        Create a new branch named `<new-branch>` starting at
-       `<start-point>` before switching to the branch. This is a
-       convenient shortcut for:
+       `<start-point>` before switching to the branch. This is the
+       transactional equivalent of
 +
 ------------
 $ git branch <new-branch>
 $ git switch <new-branch>
 ------------
++
+that is to say, the branch is not reset/created unless "git switch" is
+successful (e.g., when the branch is in use in another worktree, not
+just the current branch stays the same, but the branch is not reset to
+the start-point, either).
 
 -C <new-branch>::
 --force-create <new-branch>::
@@ -171,7 +176,7 @@ name, the guessing is aborted.  You can explicitly give a name with
        `branch.autoSetupMerge` configuration variable is true.
 
 --orphan <new-branch>::
-       Create a new 'orphan' branch, named `<new-branch>`. All
+       Create a new unborn branch, named `<new-branch>`. All
        tracked files are removed.
 
 --ignore-other-worktrees::
index 102c83eb19e98a7c14f8de879cca93d610b5fd34..761b154bcbb58b7c27245fb77e10c4f2e6a8a063 100644 (file)
@@ -27,7 +27,7 @@ symbolic ref.
 
 A symbolic ref is a regular file that stores a string that
 begins with `ref: refs/`.  For example, your `.git/HEAD` is
-a regular file whose contents is `ref: refs/heads/master`.
+a regular file whose content is `ref: refs/heads/master`.
 
 OPTIONS
 -------
index d42efb3112787f943559723b9b19915df8181d5e..5fe519c31ec478e205223dbed919254a7ed4c610 100644 (file)
@@ -224,7 +224,7 @@ it in the repository configuration as follows:
 
 -------------------------------------
 [user]
-    signingKey = <gpg-key_id>
+    signingKey = <gpg-key-id>
 -------------------------------------
 
 `pager.tag` is only respected when listing tags, i.e., when `-l` is
index f4bb9c5daf95c6669210429d7a560565dadc91d5..8c47890a6a89bd7c0dbb2e3d259961262e4db3f7 100644 (file)
@@ -49,7 +49,7 @@ OPTIONS
 --remove::
        If a specified file is in the index but is missing then it's
        removed.
-       Default behavior is to ignore removed file.
+       Default behavior is to ignore removed files.
 
 --refresh::
        Looks at the current index and checks to see if merges or
@@ -95,7 +95,7 @@ OPTIONS
        the index.  If you want to change the working tree file,
        you need to unset the bit to tell Git.  This is
        sometimes helpful when working with a big project on a
-       filesystem that has very slow lstat(2) system call
+       filesystem that has very slow lstat(2) system call
        (e.g. cifs).
 +
 Git will fail (gracefully) in case it needs to modify this file
@@ -108,7 +108,7 @@ you will need to handle the situation manually.
        without regard to the "assume unchanged" setting.
 
 --[no-]skip-worktree::
-       When one of these flags is specified, the object name recorded
+       When one of these flags is specified, the object names recorded
        for the paths are not updated. Instead, these options
        set and unset the "skip-worktree" bit for the paths. See
        section "Skip-worktree bit" below for more information.
@@ -119,7 +119,7 @@ you will need to handle the situation manually.
        the `--remove` option was specified.
 
 --[no-]fsmonitor-valid::
-       When one of these flags is specified, the object name recorded
+       When one of these flags is specified, the object names recorded
        for the paths are not updated. Instead, these options
        set and unset the "fsmonitor valid" bit for the paths. See
        section "File System Monitor" below for more information.
@@ -127,7 +127,7 @@ you will need to handle the situation manually.
 -g::
 --again::
        Runs 'git update-index' itself on the paths whose index
-       entries are different from those from the `HEAD` commit.
+       entries are different from those of the `HEAD` commit.
 
 --unresolve::
        Restores the 'unmerged' or 'needs updating' state of a
@@ -151,24 +151,30 @@ you will need to handle the situation manually.
        automatically removed with warning messages.
 
 --stdin::
-       Instead of taking list of paths from the command line,
-       read list of paths from the standard input.  Paths are
+       Instead of taking list of paths from the command line,
+       read list of paths from the standard input.  Paths are
        separated by LF (i.e. one path per line) by default.
 
 --verbose::
-        Report what is being added and removed from index.
+       Report what is being added and removed from the index.
 
 --index-version <n>::
        Write the resulting index out in the named on-disk format version.
-       Supported versions are 2, 3 and 4. The current default version is 2
+       Supported versions are 2, 3, and 4. The current default version is 2
        or 3, depending on whether extra features are used, such as
-       `git add -N`.
+       `git add -N`.  With `--verbose`, also report the version the index
+       file uses before and after this command.
 +
 Version 4 performs a simple pathname compression that reduces index
 size by 30%-50% on large repositories, which results in faster load
-time. Version 4 is relatively young (first released in 1.8.0 in
-October 2012). Other Git implementations such as JGit and libgit2
-may not support it yet.
+time.  Git supports it since version 1.8.0, released in October 2012,
+and support for it was added to libgit2 in 2016 and to JGit in 2020.
+Older versions of this manual page called it "relatively young", but
+it should be considered mature technology these days.
+
+--show-index-version::
+       Report the index format version used by the on-disk index file.
+       See `--index-version` above.
 
 -z::
        Only meaningful with `--stdin` or `--index-info`; paths are
index 48b6683071e65be1abf29ece20dc90c5f0579ec3..0561808cca04a6873909ad18a6fd5f6e9af8b8de 100644 (file)
@@ -118,7 +118,7 @@ verify::
        <oldvalue> is zero or missing, the ref must not exist.
 
 option::
-       Modify behavior of the next command naming a <ref>.
+       Modify the behavior of the next command naming a <ref>.
        The only valid option is `no-deref` to avoid dereferencing
        a symbolic ref.
 
index 17e429dbd095605835bdf6b67d96bd8a92559cac..6bc9b50d89f7aac6921e6b9fd9b2659d1d81d3af 100644 (file)
@@ -23,13 +23,13 @@ OPTIONS
 -------
 -f::
 --force::
-       update the info files from scratch.
+       Update the info files from scratch.
 
 OUTPUT
 ------
 
 Currently the command updates the following files.  Please see
-linkgit:gitrepository-layout[5] for description of
+linkgit:gitrepository-layout[5] for description of
 what they are for:
 
 * objects/info/packs
index b656b4756752f6d91098b85d2766a80e86ca092a..7ad60bc3485bc80606fbf38bb13a4ba0e8f0902e 100644 (file)
@@ -26,7 +26,7 @@ OPTIONS
 -------
 
 --[no-]strict::
-       Do not try <directory>/.git/ if <directory> is no Git directory.
+       Do not try <directory>/.git/ if <directory> is not a Git directory.
 
 --timeout=<n>::
        Interrupt transfer after <n> seconds of inactivity.
index c38fb3968bcabc6215f535ec569e3f5e258aee62..0680568dfda732e9786011cd7b8088a91fca1662 100644 (file)
@@ -19,7 +19,7 @@ no value.
 OPTIONS
 -------
 -l::
-       Cause the logical variables to be listed. In addition, all the
+       Display the logical variables. In addition, all the
        variables of the Git configuration file .git/config are listed
        as well. (However, the configuration variables listing functionality
        is deprecated in favor of `git config -l`.)
index b8720dce8abc34fffee6fa1235c48976ad44f1fb..d7e886918aa7af8accc73737e51cacc38118f747 100644 (file)
@@ -15,7 +15,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 Reads given idx file for packed Git archive created with the
-'git pack-objects' command and verifies idx file and the
+'git pack-objects' command and verifies the idx file and the
 corresponding pack file.
 
 OPTIONS
@@ -25,13 +25,13 @@ OPTIONS
 
 -v::
 --verbose::
-       After verifying the pack, show list of objects contained
+       After verifying the pack, show the list of objects contained
        in the pack and a histogram of delta chain length.
 
 -s::
 --stat-only::
        Do not verify the pack contents; only show the histogram of delta
-       chain length.  With `--verbose`, list of objects is also shown.
+       chain length.  With `--verbose`, the list of objects is also shown.
 
 \--::
        Do not interpret any more arguments as options.
index 8b63ceb00e71a5e2f09cf7686b0978dcf71d1e03..8e55e0bb1ec8a6aaeaef5f6b615929850f63c358 100644 (file)
@@ -3,7 +3,7 @@ git-whatchanged(1)
 
 NAME
 ----
-git-whatchanged - Show logs with difference each commit introduces
+git-whatchanged - Show logs with differences each commit introduces
 
 
 SYNOPSIS
@@ -18,11 +18,11 @@ Shows commit logs and diff output each commit introduces.
 
 New users are encouraged to use linkgit:git-log[1] instead.  The
 `whatchanged` command is essentially the same as linkgit:git-log[1]
-but defaults to show the raw format diff output and to skip merges.
+but defaults to showing the raw format diff output and skipping merges.
 
-The command is kept primarily for historical reasons; fingers of
+The command is primarily kept for historical reasons; fingers of
 many people who learned Git long before `git log` was invented by
-reading Linux kernel mailing list are trained to type it.
+reading the Linux kernel mailing list are trained to type it.
 
 
 Examples
index a4fbf5e8386d7d4ae58230b17b534a90461ff421..2a240f53ba7f987b367a7fef689fe916543dedfd 100644 (file)
@@ -99,7 +99,7 @@ command will refuse to create the worktree (unless `--force` is used).
 If `<commit-ish>` is omitted, neither `--detach`, or `--orphan` is
 used, and there are no valid local branches (or remote branches if
 `--guess-remote` is specified) then, as a convenience, the new worktree is
-associated with a new orphan branch named `<branch>` (after
+associated with a new unborn branch named `<branch>` (after
 `$(basename <path>)` if neither `-b` or `-B` is used) as if `--orphan` was
 passed to the command. In the event the repository has a remote and
 `--guess-remote` is used, but no remote or local branches exist, then the
@@ -234,7 +234,7 @@ This can also be set up as the default behaviour by using the
 
 --orphan::
        With `add`, make the new worktree and index empty, associating
-       the worktree with a new orphan/unborn branch named `<new-branch>`.
+       the worktree with a new unborn branch named `<new-branch>`.
 
 --porcelain::
        With `list`, output in an easy-to-parse format for scripts.
@@ -286,7 +286,8 @@ rules and how to access refs of one worktree from another.
 In general, all pseudo refs are per-worktree and all refs starting with
 `refs/` are shared. Pseudo refs are ones like `HEAD` which are directly
 under `$GIT_DIR` instead of inside `$GIT_DIR/refs`. There are exceptions,
-however: refs inside `refs/bisect` and `refs/worktree` are not shared.
+however: refs inside `refs/bisect`, `refs/worktree` and `refs/rewritten` are
+not shared.
 
 Refs that are per-worktree can still be accessed from another worktree via
 two special paths, `main-worktree` and `worktrees`. The former gives
@@ -363,8 +364,8 @@ linked worktree `git rev-parse --git-path HEAD` returns
 `/path/other/test-next/.git/HEAD` or `/path/main/.git/HEAD`) while `git
 rev-parse --git-path refs/heads/master` uses
 `$GIT_COMMON_DIR` and returns `/path/main/.git/refs/heads/master`,
-since refs are shared across all worktrees, except `refs/bisect` and
-`refs/worktree`.
+since refs are shared across all worktrees, except `refs/bisect`,
+`refs/worktree` and `refs/rewritten`.
 
 See linkgit:gitrepository-layout[5] for more information. The rule of
 thumb is do not make any assumption about whether a path belongs to
index 11228956cd5ec400b498d7483b8a4f71ec433ab2..7a1b112a3e70203a8294952333c05845bfcb4da6 100644 (file)
@@ -96,9 +96,9 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
        to avoid ambiguity with `<name>` containing one.
 +
 This is useful for cases where you want to pass transitory
-configuration options to git, but are doing so on OS's where
-other processes might be able to read your cmdline
-(e.g. `/proc/self/cmdline`), but not your environ
+configuration options to git, but are doing so on operating systems
+where other processes might be able to read your command line
+(e.g. `/proc/self/cmdline`), but not your environment
 (e.g. `/proc/self/environ`). That behavior is the default on
 Linux, but may not be on your system.
 +
@@ -174,8 +174,17 @@ If you just want to run git as if it was started in `<path>` then use
        directory.
 
 --no-replace-objects::
-       Do not use replacement refs to replace Git objects. See
-       linkgit:git-replace[1] for more information.
+       Do not use replacement refs to replace Git objects.
+       This is equivalent to exporting the `GIT_NO_REPLACE_OBJECTS`
+       environment variable with any value.
+       See linkgit:git-replace[1] for more information.
+
+--no-lazy-fetch::
+       Do not fetch missing objects from the promisor remote on
+       demand.  Useful together with `git cat-file -e <object>` to
+       see if the object is locally available.
+       This is equivalent to setting the `GIT_NO_LAZY_FETCH`
+       environment variable to `1`.
 
 --literal-pathspecs::
        Treat pathspecs literally (i.e. no globbing, no pathspec magic).
@@ -202,7 +211,7 @@ If you just want to run git as if it was started in `<path>` then use
        Do not perform optional operations that require locks. This is
        equivalent to setting the `GIT_OPTIONAL_LOCKS` to `0`.
 
---list-cmds=group[,group...]::
+--list-cmds=<group>[,<group>...]::
        List commands by group. This is an internal/experimental
        option and may change or be removed in the future. Supported
        groups are: builtins, parseopt (builtin commands that use
@@ -556,6 +565,11 @@ double-quotes and respecting backslash escapes. E.g., the value
        is always used. The default is "sha1".
        See `--object-format` in linkgit:git-init[1].
 
+`GIT_DEFAULT_REF_FORMAT`::
+       If this variable is set, the default reference backend format for new
+       repositories will be set to this value. The default is "files".
+       See `--ref-format` in linkgit:git-init[1].
+
 Git Commits
 ~~~~~~~~~~~
 `GIT_AUTHOR_NAME`::
@@ -724,13 +738,12 @@ for further details.
        waiting for someone with sufficient permissions to fix it.
 
 `GIT_FLUSH`::
-// NEEDSWORK: make it into a usual Boolean environment variable
-       If this environment variable is set to "1", then commands such
+       If this Boolean environment variable is set to true, then commands such
        as 'git blame' (in incremental mode), 'git rev-list', 'git log',
        'git check-attr' and 'git check-ignore' will
        force a flush of the output stream after each record have been
        flushed. If this
-       variable is set to "0", the output of these commands will be done
+       variable is set to false, the output of these commands will be done
        using completely buffered I/O.   If this environment variable is
        not set, Git will choose buffered or record-oriented flushing
        based on whether stdout appears to be redirected to a file or not.
@@ -838,7 +851,7 @@ of the SID and an optional counter (to avoid filename
 collisions).
 +
 In addition, if the variable is set to
-`af_unix:[<socket_type>:]<absolute-pathname>`, Git will try
+`af_unix:[<socket-type>:]<absolute-pathname>`, Git will try
 to open the path as a Unix Domain Socket.  The socket type
 can be either `stream` or `dgram`.
 +
@@ -868,6 +881,10 @@ for full details.
        header and packfile URIs. Set this Boolean environment variable to false to prevent this
        redaction.
 
+`GIT_NO_REPLACE_OBJECTS`::
+       Setting and exporting this environment variable tells Git to
+       ignore replacement refs and do not replace Git objects.
+
 `GIT_LITERAL_PATHSPECS`::
        Setting this Boolean environment variable to true will cause Git to treat all
        pathspecs literally, rather than as glob patterns. For example,
@@ -889,6 +906,11 @@ for full details.
        Setting this Boolean environment variable to true will cause Git to treat all
        pathspecs as case-insensitive.
 
+`GIT_NO_LAZY_FETCH`::
+       Setting this Boolean environment variable to true tells Git
+       not to lazily fetch missing objects from the promisor remote
+       on demand.
+
 `GIT_REFLOG_ACTION`::
        When a ref is updated, reflog entries are created to keep
        track of the reason why the ref was updated (which is
@@ -911,6 +933,16 @@ for full details.
        should not normally need to set this to `0`, but it may be
        useful when trying to salvage data from a corrupted repository.
 
+`GIT_COMMIT_GRAPH_PARANOIA`::
+       When loading a commit object from the commit-graph, Git performs an
+       existence check on the object in the object database. This is done to
+       avoid issues with stale commit-graphs that contain references to
+       already-deleted commits, but comes with a performance penalty.
++
+The default is "false", which disables the aforementioned behavior.
+Setting this to "true" enables the existence check so that stale commits
+will never be returned from the commit-graph at the cost of performance.
+
 `GIT_ALLOW_PROTOCOL`::
        If set to a colon-separated list of protocols, behave as if
        `protocol.allow` is set to `never`, and each of the listed
@@ -928,7 +960,7 @@ for full details.
 `GIT_PROTOCOL`::
        For internal use only.  Used in handshaking the wire protocol.
        Contains a colon ':' separated list of keys with optional values
-       'key[=value]'.  Presence of unknown keys and values must be
+       '<key>[=<value>]'.  Presence of unknown keys and values must be
        ignored.
 +
 Note that servers may need to be configured to allow this variable to
@@ -1015,10 +1047,11 @@ When first created, objects are stored in individual files, but for
 efficiency may later be compressed together into "pack files".
 
 Named pointers called refs mark interesting points in history.  A ref
-may contain the SHA-1 name of an object or the name of another ref.  Refs
-with names beginning `ref/head/` contain the SHA-1 name of the most
+may contain the SHA-1 name of an object or the name of another ref (the
+latter is called a "symbolic ref").
+Refs with names beginning `refs/head/` contain the SHA-1 name of the most
 recent commit (or "head") of a branch under development.  SHA-1 names of
-tags of interest are stored under `ref/tags/`.  A special ref named
+tags of interest are stored under `refs/tags/`.  A symbolic ref named
 `HEAD` contains the name of the currently checked-out branch.
 
 The index file is initialized with a list of all paths and, for each
@@ -1061,7 +1094,7 @@ Authors
 -------
 Git was started by Linus Torvalds, and is currently maintained by Junio
 C Hamano. Numerous contributions have come from the Git mailing list
-<git@vger.kernel.org>.  http://www.openhub.net/p/git/contributors/summary
+<git@vger.kernel.org>.  https://openhub.net/p/git/contributors/summary
 gives you a more complete list of contributors.
 
 If you have a clone of git.git itself, the
index 6deb89a2967708dfc2c560ac72c29907a5b6334a..4338d023d9a313edae0bae8b2ac8087a3d15a003 100644 (file)
@@ -100,6 +100,21 @@ for a path to `Unspecified` state.  This can be done by listing
 the name of the attribute prefixed with an exclamation point `!`.
 
 
+RESERVED BUILTIN_* ATTRIBUTES
+-----------------------------
+
+builtin_* is a reserved namespace for builtin attribute values. Any
+user defined attributes under this namespace will be ignored and
+trigger a warning.
+
+`builtin_objectmode`
+~~~~~~~~~~~~~~~~~~~~
+This attribute is for filtering files by their file bit modes (40000,
+120000, 160000, 100755, 100644). e.g. ':(attr:builtin_objectmode=160000)'.
+You may also check these values with `git check-attr builtin_objectmode -- <file>`.
+If the object is not in the index `git check-attr --cached` will return unspecified.
+
+
 EFFECTS
 -------
 
@@ -1122,11 +1137,11 @@ The `merge.*.name` variable gives the driver a human-readable
 name.
 
 The `merge.*.driver` variable's value is used to construct a
-command to run to merge ancestor's version (`%O`), current
+command to run to common ancestor's version (`%O`), current
 version (`%A`) and the other branches' version (`%B`).  These
 three tokens are replaced with the names of temporary files that
 hold the contents of these versions when the command line is
-built. Additionally, %L will be replaced with the conflict marker
+built. Additionally, `%L` will be replaced with the conflict marker
 size (see below).
 
 The merge driver is expected to leave the result of the merge in
@@ -1144,15 +1159,16 @@ When left unspecified, the driver itself is used for both
 internal merge and the final merge.
 
 The merge driver can learn the pathname in which the merged result
-will be stored via placeholder `%P`.
-
+will be stored via placeholder `%P`. The conflict labels to be used
+for the common ancestor, local head and other head can be passed by
+using '%S', '%X' and '%Y` respectively.
 
 `conflict-marker-size`
 ^^^^^^^^^^^^^^^^^^^^^^
 
 This attribute controls the length of conflict markers left in
-the work tree file during a conflicted merge.  Only setting to
-the value to a positive integer has any meaningful effect.
+the work tree file during a conflicted merge.  Only a positive
+integer has a meaningful effect.
 
 For example, this line in `.gitattributes` can be used to tell the merge
 machinery to leave much longer (instead of the usual 7-character-long)
index 1819a5a1859c5479064823bd786e98267f7037b5..7c709324ba904efe5f6a544086c767fbc1ab7cb4 100644 (file)
@@ -23,10 +23,10 @@ arguments.  Here are the rules:
     A subcommand may take dashed options (which may take their own
     arguments, e.g. "--max-parents 2") and arguments.  You SHOULD
     give dashed options first and then arguments.  Some commands may
-    accept dashed options after you have already gave non-option
+    accept dashed options after you have already given non-option
     arguments (which may make the command ambiguous), but you should
     not rely on it (because eventually we may find a way to fix
-    these ambiguity by enforcing the "options then args" rule).
+    these ambiguities by enforcing the "options then args" rule).
 
  * Revisions come first and then paths.
    E.g. in `git diff v1.0 v2.0 arch/x86 include/asm-x86`,
@@ -37,12 +37,12 @@ arguments.  Here are the rules:
    they can be disambiguated by placing `--` between them.
    E.g. `git diff -- HEAD` is, "I have a file called HEAD in my work
    tree.  Please show changes between the version I staged in the index
-   and what I have in the work tree for that file", not "show difference
+   and what I have in the work tree for that file", not "show the difference
    between the HEAD commit and the work tree as a whole".  You can say
    `git diff HEAD --` to ask for the latter.
 
  * Without disambiguating `--`, Git makes a reasonable guess, but errors
-   out and asking you to disambiguate when ambiguous.  E.g. if you have a
+   out and asks you to disambiguate when ambiguous.  E.g. if you have a
    file called HEAD in your work tree, `git diff HEAD` is ambiguous, and
    you have to say either `git diff HEAD --` or `git diff -- HEAD` to
    disambiguate.
@@ -81,9 +81,6 @@ you will.
 Here are the rules regarding the "flags" that you should follow when you are
 scripting Git:
 
- * It's preferred to use the non-dashed form of Git commands, which means that
-   you should prefer `git foo` to `git-foo`.
-
  * Splitting short options to separate words (prefer `git foo -a -b`
    to `git foo -ab`, the latter may not even work).
 
index c0b95256cc8c8d640d284f77b23d63c8785601d1..2122aeb976915750b843b89d49210e7c934cf2c8 100644 (file)
@@ -1089,7 +1089,7 @@ the remote repository URL in the local repository's config file
 like this:
 
 ------------------------------------------------
-$ git config remote.linus.url http://www.kernel.org/pub/scm/git/git.git/
+$ git config remote.linus.url https://git.kernel.org/pub/scm/git/git.git/
 ------------------------------------------------
 
 and use the "linus" keyword with 'git pull' instead of the full URL.
index 0d57f86abc4a51c9665f88ff34103bbe94f09009..642c51227b5a0b1990c374bac4f815dac0b04c22 100644 (file)
@@ -173,7 +173,7 @@ Note that when rename detection is on but both copy and break
 detection are off, rename detection adds a preliminary step that first
 checks if files are moved across directories while keeping their
 filename the same.  If there is a file added to a directory whose
-contents is sufficiently similar to a file with the same name that got
+contents are sufficiently similar to a file with the same name that got
 deleted from a different directory, it will mark them as renames and
 exclude them from the later quadratic step (the one that pairwise
 compares all unmatched files to find the "best" matches, determined by
@@ -213,7 +213,7 @@ from the original, and does not count insertion.  If you removed
 only 10 lines from a 100-line document, even if you added 910
 new lines to make a new 1000-line document, you did not do a
 complete rewrite.  diffcore-break breaks such a case in order to
-help diffcore-rename to consider such filepairs as candidate of
+help diffcore-rename to consider such filepairs as candidate of
 rename/copy detection, but if filepairs broken that way were not
 matched with other filepairs to create rename/copy, then this
 transformation merges them back into the original
@@ -230,13 +230,13 @@ like these:
 
 * -B/60 (the same as above, since diffcore-break defaults to 50%).
 
-Note that earlier implementation left a broken pair as separate
-creation and deletion patches.  This was an unnecessary hack and
+Note that earlier implementation left a broken pair as separate
+creation and deletion patches.  This was an unnecessary hack, and
 the latest implementation always merges all the broken pairs
 back into modifications, but the resulting patch output is
 formatted differently for easier review in case of such
-a complete rewrite by showing the entire contents of old version
-prefixed with '-', followed by the entire contents of new
+a complete rewrite by showing the entire contents of the old version
+prefixed with '-', followed by the entire contents of the new
 version prefixed with '+'.
 
 
@@ -245,25 +245,25 @@ diffcore-pickaxe: For Detecting Addition/Deletion of Specified String
 
 This transformation limits the set of filepairs to those that change
 specified strings between the preimage and the postimage in a certain
-way.  -S<block of text> and -G<regular expression> options are used to
+way.  -S<block-of-text> and -G<regular-expression> options are used to
 specify different ways these strings are sought.
 
-"-S<block of text>" detects filepairs whose preimage and postimage
+"-S<block-of-text>" detects filepairs whose preimage and postimage
 have different number of occurrences of the specified block of text.
 By definition, it will not detect in-file moves.  Also, when a
 changeset moves a file wholesale without affecting the interesting
 string, diffcore-rename kicks in as usual, and `-S` omits the filepair
 (since the number of occurrences of that string didn't change in that
 rename-detected filepair).  When used with `--pickaxe-regex`, treat
-the <block of text> as an extended POSIX regular expression to match,
+the <block-of-text> as an extended POSIX regular expression to match,
 instead of a literal string.
 
-"-G<regular expression>" (mnemonic: grep) detects filepairs whose
+"-G<regular-expression>" (mnemonic: grep) detects filepairs whose
 textual diff has an added or a deleted line that matches the given
 regular expression.  This means that it will detect in-file (or what
 rename-detection considers the same file) moves, which is noise.  The
 implementation runs diff twice and greps, and this can be quite
-expensive.  To speed things up binary files without textconv filters
+expensive.  To speed things up, binary files without textconv filters
 will be ignored.
 
 When `-S` or `-G` are used without `--pickaxe-all`, only filepairs
index faba2ef0881c52e8c6c2e5ec0f5702c0b1ba5028..6cfdd0e07b46f269c059e38409dffe45d44a59f9 100644 (file)
@@ -14,7 +14,7 @@ DESCRIPTION
 -----------
 
 Git users can broadly be grouped into four categories for the purposes of
-describing here a small set of useful command for everyday Git.
+describing here a small set of useful commands for everyday Git.
 
 *      <<STANDALONE,Individual Developer (Standalone)>> commands are essential
        for anybody who makes a commit, even for somebody who works alone.
@@ -229,7 +229,7 @@ without a formal "merging". Or longhand +
   git am -3 -k`
 
 An alternate participant submission mechanism is using the
-`git request-pull` or pull-request mechanisms (e.g as used on
+`git request-pull` or pull-request mechanisms (e.g. as used on
 GitHub (www.github.com) to notify your upstream of your
 contribution.
 
index 00e0a20e6571969ebeabca8da5d9815be65d682b..1b75cf71cec103f8a5e36056532f888d1ac58e71 100644 (file)
@@ -67,7 +67,7 @@ A Git bundle consists of several parts.
 * "Capabilities", which are only in the v3 format, indicate functionality that
        the bundle requires to be read properly.
 
-* "Prerequisites" lists the objects that are NOT included in the bundle and the
+* "Prerequisites" list the objects that are NOT included in the bundle and the
   reader of the bundle MUST already have, in order to use the data in the
   bundle. The objects stored in the bundle may refer to prerequisite objects and
   anything reachable from them (e.g. a tree object in the bundle can reference
@@ -86,10 +86,10 @@ In the bundle format, there can be a comment following a prerequisite obj-id.
 This is a comment and it has no specific meaning. The writer of the bundle MAY
 put any string here. The reader of the bundle MUST ignore the comment.
 
-Note on the shallow clone and a Git bundle
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Note on shallow clones and Git bundles
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Note that the prerequisites does not represent a shallow-clone boundary. The
+Note that the prerequisites do not represent a shallow-clone boundary. The
 semantics of the prerequisites and the shallow-clone boundaries are different,
 and the Git bundle v2 format cannot represent a shallow clone repository.
 
index 57202ede273ad266be910045294fd74853dd193c..3315df6201dc964886652c494b2123260de9f434 100644 (file)
@@ -42,7 +42,7 @@ Each row consists of a 4-byte chunk identifier (ID) and an 8-byte offset.
 Each integer is stored in network-byte order.
 
 The chunk identifier `ID[i]` is a label for the data stored within this
-fill from `OFFSET[i]` (inclusive) to `OFFSET[i+1]` (exclusive). Thus, the
+file from `OFFSET[i]` (inclusive) to `OFFSET[i+1]` (exclusive). Thus, the
 size of the `i`th chunk is equal to the difference between `OFFSET[i+1]`
 and `OFFSET[i]`. This requires that the chunk data appears contiguously
 in the same order as the table of contents.
@@ -67,7 +67,7 @@ caller is responsible for opening the `hashfile` and writing header
 information so the file format is identifiable before the chunk-based
 format begins.
 
-Then, call `add_chunk()` for each chunk that is intended for write. This
+Then, call `add_chunk()` for each chunk that is intended for writing. This
 populates the `chunkfile` with information about the order and size of
 each chunk to write. Provide a `chunk_write_fn` function pointer to
 perform the write of the chunk data upon request.
index 0773e5c3800392b8d4a548519b70379501207054..145cace1fe9fd3a583aaa7c0f605b64b78ef7554 100644 (file)
@@ -386,8 +386,8 @@ The remaining data of each directory block is grouped by type:
        long, "REUC" extension that is M-bytes long, followed by "EOIE",
        then the hash would be:
 
-       Hash("TREE" + <binary representation of N> +
-               "REUC" + <binary representation of M>)
+       Hash("TREE" + <binary-representation-of-N> +
+               "REUC" + <binary-representation-of-M>)
 
 == Index Entry Offset Table
 
index 0c1be2dbe85caf3300a314c374dd12d54b7434a7..d6ae229be5685950da9a8cff4bbe215c62e0c17c 100644 (file)
@@ -17,8 +17,8 @@ $GIT_DIR/objects/pack/multi-pack-index
 DESCRIPTION
 -----------
 
-The Git pack format is now Git stores most of its primary repository
-data. Over the lietime af a repository loose objects (if any) and
+The Git pack format is how Git stores most of its primary repository
+data. Over the lifetime of a repository, loose objects (if any) and
 smaller packs are consolidated into larger pack(s). See
 linkgit:git-gc[1] and linkgit:git-pack-objects[1].
 
@@ -48,7 +48,7 @@ Similarly, in SHA-256 repositories, these values are computed using SHA-256.
      Observation: we cannot have more than 4G versions ;-) and
      more than 4G objects in a pack.
 
-   - The header is followed by number of object entries, each of
+   - The header is followed by number of object entries, each of
      which looks like this:
 
      (undeltified representation)
@@ -62,7 +62,7 @@ Similarly, in SHA-256 repositories, these values are computed using SHA-256.
         is an OBJ_OFS_DELTA object
      compressed delta data
 
-     Observation: length of each object is encoded in a variable
+     Observation: the length of each object is encoded in a variable
      length format and is not constrained to 32-bit or anything.
 
   - The trailer records a pack checksum of all of the above.
@@ -117,7 +117,7 @@ the delta data is a sequence of instructions to reconstruct the object
 from the base object. If the base object is deltified, it must be
 converted to canonical form first. Each instruction appends more and
 more data to the target object until it's complete. There are two
-supported instructions so far: one for copy a byte range from the
+supported instructions so far: one for copying a byte range from the
 source object and one for inserting new data embedded in the
 instruction itself.
 
@@ -137,7 +137,7 @@ copy. Offset and size are in little-endian order.
 
 All offset and size bytes are optional. This is to reduce the
 instruction size when encoding small offsets or sizes. The first seven
-bits in the first octet determines which of the next seven octets is
+bits in the first octet determine which of the next seven octets is
 present. If bit zero is set, offset1 is present. If bit one is set
 offset2 is present and so on.
 
@@ -161,9 +161,9 @@ converted to 0x10000.
   | 0xxxxxxx |    data    |
   +----------+============+
 
-This is the instruction to construct target object without the base
+This is the instruction to construct the target object without the base
 object. The following data is appended to the target object. The first
-seven bits of the first octet determines the size of data in
+seven bits of the first octet determine the size of data in
 bytes. The size must be non-zero.
 
 ==== Reserved instruction
@@ -294,7 +294,7 @@ Pack file entry: <+
 
   - The same trailer as a v1 pack file:
 
-    A copy of the pack checksum at the end of
+    A copy of the pack checksum at the end of the
     corresponding packfile.
 
     Index checksum of all of the above.
@@ -390,10 +390,20 @@ CHUNK LOOKUP:
 CHUNK DATA:
 
        Packfile Names (ID: {'P', 'N', 'A', 'M'})
-           Stores the packfile names as concatenated, null-terminated strings.
-           Packfiles must be listed in lexicographic order for fast lookups by
-           name. This is the only chunk not guaranteed to be a multiple of four
-           bytes in length, so should be the last chunk for alignment reasons.
+           Store the names of packfiles as a sequence of NUL-terminated
+           strings. There is no extra padding between the filenames,
+           and they are listed in lexicographic order. The chunk itself
+           is padded at the end with between 0 and 3 NUL bytes to make the
+           chunk size a multiple of 4 bytes.
+
+       Bitmapped Packfiles (ID: {'B', 'T', 'M', 'P'})
+           Stores a table of two 4-byte unsigned integers in network order.
+           Each table entry corresponds to a single pack (in the order that
+           they appear above in the `PNAM` chunk). The values for each table
+           entry are as follows:
+           - The first bit position (in pseudo-pack order, see below) to
+             contain an object from that pack.
+           - The number of bits whose objects are selected from that pack.
 
        OID Fanout (ID: {'O', 'I', 'D', 'F'})
            The ith entry, F[i], stores the number of OIDs with first
@@ -508,6 +518,73 @@ packs arranged in MIDX order (with the preferred pack coming first).
 The MIDX's reverse index is stored in the optional 'RIDX' chunk within
 the MIDX itself.
 
+=== `BTMP` chunk
+
+The Bitmapped Packfiles (`BTMP`) chunk encodes additional information
+about the objects in the multi-pack index's reachability bitmap. Recall
+that objects from the MIDX are arranged in "pseudo-pack" order (see
+above) for reachability bitmaps.
+
+From the example above, suppose we have packs "a", "b", and "c", with
+10, 15, and 20 objects, respectively. In pseudo-pack order, those would
+be arranged as follows:
+
+    |a,0|a,1|...|a,9|b,0|b,1|...|b,14|c,0|c,1|...|c,19|
+
+When working with single-pack bitmaps (or, equivalently, multi-pack
+reachability bitmaps with a preferred pack), linkgit:git-pack-objects[1]
+performs ``verbatim'' reuse, attempting to reuse chunks of the bitmapped
+or preferred packfile instead of adding objects to the packing list.
+
+When a chunk of bytes is reused from an existing pack, any objects
+contained therein do not need to be added to the packing list, saving
+memory and CPU time. But a chunk from an existing packfile can only be
+reused when the following conditions are met:
+
+  - The chunk contains only objects which were requested by the caller
+    (i.e. does not contain any objects which the caller didn't ask for
+    explicitly or implicitly).
+
+  - All objects stored in non-thin packs as offset- or reference-deltas
+    also include their base object in the resulting pack.
+
+The `BTMP` chunk encodes the necessary information in order to implement
+multi-pack reuse over a set of packfiles as described above.
+Specifically, the `BTMP` chunk encodes three pieces of information (all
+32-bit unsigned integers in network byte-order) for each packfile `p`
+that is stored in the MIDX, as follows:
+
+`bitmap_pos`:: The first bit position (in pseudo-pack order) in the
+  multi-pack index's reachability bitmap occupied by an object from `p`.
+
+`bitmap_nr`:: The number of bit positions (including the one at
+  `bitmap_pos`) that encode objects from that pack `p`.
+
+For example, the `BTMP` chunk corresponding to the above example (with
+packs ``a'', ``b'', and ``c'') would look like:
+
+[cols="1,2,2"]
+|===
+| |`bitmap_pos` |`bitmap_nr`
+
+|packfile ``a''
+|`0`
+|`10`
+
+|packfile ``b''
+|`10`
+|`15`
+
+|packfile ``c''
+|`25`
+|`20`
+|===
+
+With this information in place, we can treat each packfile as
+individually reusable in the same fashion as verbatim pack reuse is
+performed on individual packs prior to the implementation of the `BTMP`
+chunk.
+
 == cruft packs
 
 The cruft packs feature offer an alternative to Git's traditional mechanism of
@@ -588,51 +665,17 @@ later on.
 It is linkgit:git-gc[1] that is typically responsible for removing expired
 unreachable objects.
 
-=== Caution for mixed-version environments
-
-Repositories that have cruft packs in them will continue to work with any older
-version of Git. Note, however, that previous versions of Git which do not
-understand the `.mtimes` file will use the cruft pack's mtime as the mtime for
-all of the objects in it. In other words, do not expect older (pre-cruft pack)
-versions of Git to interpret or even read the contents of the `.mtimes` file.
-
-Note that having mixed versions of Git GC-ing the same repository can lead to
-unreachable objects never being completely pruned. This can happen under the
-following circumstances:
-
-  - An older version of Git running GC explodes the contents of an existing
-    cruft pack loose, using the cruft pack's mtime.
-  - A newer version running GC collects those loose objects into a cruft pack,
-    where the .mtime file reflects the loose object's actual mtimes, but the
-    cruft pack mtime is "now".
-
-Repeating this process will lead to unreachable objects not getting pruned as a
-result of repeatedly resetting the objects' mtimes to the present time.
-
-If you are GC-ing repositories in a mixed version environment, consider omitting
-the `--cruft` option when using linkgit:git-repack[1] and linkgit:git-gc[1], and
-setting the `gc.cruftPacks` configuration to "false" until all writers
-understand cruft packs.
-
 === Alternatives
 
 Notable alternatives to this design include:
 
-  - The location of the per-object mtime data, and
-  - Storing unreachable objects in multiple cruft packs.
+  - The location of the per-object mtime data.
 
 On the location of mtime data, a new auxiliary file tied to the pack was chosen
 to avoid complicating the `.idx` format. If the `.idx` format were ever to gain
 support for optional chunks of data, it may make sense to consolidate the
 `.mtimes` format into the `.idx` itself.
 
-Storing unreachable objects among multiple cruft packs (e.g., creating a new
-cruft pack during each repacking operation including only unreachable objects
-which aren't already stored in an earlier cruft pack) is significantly more
-complicated to construct, and so aren't pursued here. The obvious drawback to
-the current implementation is that the entire cruft pack must be re-written from
-scratch.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 86f804720ae71fc3d0db94623663539bd05a06f2..37f91d5b50ca3ac9053bd687ee540ca87de21083 100644 (file)
@@ -80,7 +80,7 @@ If it exits with non-zero status, then the working tree will not be
 committed after applying the patch.
 
 It can be used to inspect the current working tree and refuse to
-make a commit if it does not pass certain test.
+make a commit if it does not pass certain tests.
 
 The default 'pre-applypatch' hook, when enabled, runs the
 'pre-commit' hook, if the latter is enabled.
@@ -157,7 +157,7 @@ If the exit status is non-zero, `git commit` will abort.
 The purpose of the hook is to edit the message file in place, and
 it is not suppressed by the `--no-verify` option.  A non-zero exit
 means a failure of the hook and aborts the commit.  It should not
-be used as replacement for pre-commit hook.
+be used as a replacement for the pre-commit hook.
 
 The sample `prepare-commit-msg` hook that comes with Git removes the
 help message found in the commented portion of the commit template.
@@ -243,7 +243,7 @@ named remote is not being used both values will be the same.
 Information about what is to be pushed is provided on the hook's standard
 input with lines of the form:
 
-  <local ref> SP <local object name> SP <remote ref> SP <remote object name> LF
+  <local-ref> SP <local-object-name> SP <remote-ref> SP <remote-object-name> LF
 
 For instance, if the command +git push origin master:foreign+ were run the
 hook would receive a line like the following:
@@ -251,9 +251,9 @@ hook would receive a line like the following:
   refs/heads/master 67890 refs/heads/foreign 12345
 
 although the full object name would be supplied.  If the foreign ref does not
-yet exist the `<remote object name>` will be the all-zeroes object name.  If a
-ref is to be deleted, the `<local ref>` will be supplied as `(delete)` and the
-`<local object name>` will be the all-zeroes object name.  If the local commit
+yet exist the `<remote-object-name>` will be the all-zeroes object name.  If a
+ref is to be deleted, the `<local-ref>` will be supplied as `(delete)` and the
+`<local-object-name>` will be the all-zeroes object name.  If the local commit
 was specified by something other than a name which could be expanded (such as
 `HEAD~`, or an object name) it will be supplied as it was originally given.
 
@@ -345,7 +345,7 @@ for the user.
 
 The default 'update' hook, when enabled--and with
 `hooks.allowunannotated` config option unset or set to false--prevents
-unannotated tags to be pushed.
+unannotated tags from being pushed.
 
 [[proc-receive]]
 proc-receive
@@ -379,12 +379,12 @@ following example for the protocol, the letter 'S' stands for
     S: ... ...
     S: flush-pkt
 
-    # Receive result from the hook.
+    # Receive results from the hook.
     # OK, run this command successfully.
     H: PKT-LINE(ok <ref>)
     # NO, I reject it.
     H: PKT-LINE(ng <ref> <reason>)
-    # Fall through, let 'receive-pack' to execute it.
+    # Fall through, let 'receive-pack' execute it.
     H: PKT-LINE(ok <ref>)
     H: PKT-LINE(option fall-through)
     # OK, but has an alternate reference.  The alternate reference name
index d50e9ed10e04c688b6ee898b20e24a1cd796cc78..35b39960296b69531fff972b6f55c39ed066a655 100644 (file)
@@ -8,7 +8,7 @@ gitk - The Git repository browser
 SYNOPSIS
 --------
 [verse]
-'gitk' [<options>] [<revision range>] [--] [<path>...]
+'gitk' [<options>] [<revision-range>] [--] [<path>...]
 
 DESCRIPTION
 -----------
@@ -26,7 +26,7 @@ changes each commit introduces are shown.  Finally, it supports some
 gitk-specific options.
 
 gitk generally only understands options with arguments in the
-'sticked' form (see linkgit:gitcli[7]) due to limitations in the
+'stuck' form (see linkgit:gitcli[7]) due to limitations in the
 command-line parser.
 
 rev-list options and arguments
@@ -124,7 +124,7 @@ gitk-specific options
        range to show.  The command is expected to print on its
        standard output a list of additional revisions to be shown,
        one per line.  Use this instead of explicitly specifying a
-       '<revision range>' if the set of commits to show may vary
+       '<revision-range>' if the set of commits to show may vary
        between refreshes.
 
 --select-commit=<ref>::
index 0fb5ea0c1ca7547679d060f8fe2be7d2edf58c86..2cf7735be479e6863f4e373bd7cf7794624e0094 100644 (file)
@@ -30,7 +30,7 @@ to be in effect. The client MUST NOT ask for capabilities the server
 did not say it supports.
 
 Server MUST diagnose and abort if capabilities it does not understand
-was sent.  Server MUST NOT ignore capabilities that client requested
+were sent.  Server MUST NOT ignore capabilities that client requested
 and server advertised.  As a consequence of these rules, server MUST
 NOT advertise capabilities it does not understand.
 
@@ -61,8 +61,8 @@ complete cut across the DAG, or the client has said "done".
 Without multi_ack, a client sends have lines in --date-order until
 the server has found a common base.  That means the client will send
 have lines that are already known by the server to be common, because
-they overlap in time with another branch that the server hasn't found
-a common base on yet.
+they overlap in time with another branch on which the server hasn't found
+a common base yet.
 
 For example suppose the client has commits in caps that the server
 doesn't and the server has commits in lower case that the client
@@ -88,7 +88,7 @@ interleaved with S-R-Q.
 
 multi_ack_detailed
 ------------------
-This is an extension of multi_ack that permits client to better
+This is an extension of multi_ack that permits the client to better
 understand the server's in-memory state. See linkgit:gitprotocol-pack[5],
 section "Packfile Negotiation" for more information.
 
@@ -135,7 +135,7 @@ to disable the feature in a backwards-compatible manner.
 side-band, side-band-64k
 ------------------------
 
-This capability means that server can send, and client understand multiplexed
+This capability means that the server can send, and the client can understand, multiplexed
 progress reports and error info interleaved with the packfile itself.
 
 These two options are mutually exclusive. A modern client always
@@ -163,14 +163,14 @@ Further, with side-band and its up to 1000-byte messages, it's actually
 same deal, you have up to 65519 bytes of data and 1 byte for the stream
 code.
 
-The client MUST send only maximum of one of "side-band" and "side-
-band-64k".  Server MUST diagnose it as an error if client requests
+The client MUST send only one of "side-band" and "side-
+band-64k".  The server MUST diagnose it as an error if client requests
 both.
 
 ofs-delta
 ---------
 
-Server can send, and client understand PACKv2 with delta referring to
+The server can send, and the client can understand, PACKv2 with delta referring to
 its base by position in pack rather than by an obj-id.  That is, they can
 send/read OBJ_OFS_DELTA (aka type 6) in a packfile.
 
@@ -252,7 +252,7 @@ the current shallow boundary, instead of the depth from remote refs.
 no-progress
 -----------
 
-The client was started with "git clone -q" or something, and doesn't
+The client was started with "git clone -q" or something similar, and doesn't
 want that side band 2.  Basically the client just says "I do not
 wish to receive stream 2 on sideband, so do not send it to me, and if
 you did, I will drop it on the floor anyway".  However, the sideband
@@ -273,7 +273,7 @@ request include-tag only has to do with the client's desires for tag
 data, whether or not a server had advertised objects in the
 refs/tags/* namespace.
 
-Servers MUST pack the tags if their referrant is packed and the client
+Servers MUST pack the tags if their referent is packed and the client
 has requested include-tags.
 
 Clients MUST be prepared for the case where a server has ignored
@@ -378,7 +378,7 @@ fetch-pack may send "filter" commands to request a partial clone
 or partial fetch and request that the server omit various objects
 from the packfile.
 
-session-id=<session id>
+session-id=<session-id>
 -----------------------
 
 The server may advertise a session ID that can be used to identify this process
index 1486651bd1002f3c121c703caae154caa822fedc..cdc9d6e707586cc1f7c23de318957d2e42ef5d88 100644 (file)
@@ -13,7 +13,7 @@ SYNOPSIS
 DESCRIPTION
 -----------
 
-This document sets defines things common to various over-the-wire
+This document defines things common to various over-the-wire
 protocols and file formats used in Git.
 
 ABNF Notation
index ccc13f0a40758ac5f8268472354998d63331bf92..ec40a550ccab88b35f826e9133635e15c0f6c5ff 100644 (file)
@@ -42,7 +42,7 @@ both the "smart" and "dumb" HTTP protocols used by Git operate
 by appending additional path components onto the end of the user
 supplied `$GIT_URL` string.
 
-An example of a dumb client requesting for a loose object:
+An example of a dumb client requesting a loose object:
 
   $GIT_URL:     http://example.com:8080/git/repo.git
   URL request:  http://example.com:8080/git/repo.git/objects/d0/49f6c27a2244e12041955e262a404c7faba355
@@ -379,7 +379,7 @@ C: Place any object seen into set `advertised`.
 C: Build an empty set, `common`, to hold the objects that are later
    determined to be on both ends.
 
-C: Build a set, `want`, of the objects from `advertised` the client
+C: Build a set, `want`, of the objects from `advertised` that the client
    wants to fetch, based on what it saw during ref discovery.
 
 C: Start a queue, `c_pending`, ordered by commit time (popping newest
@@ -391,14 +391,14 @@ C: Start a queue, `c_pending`, ordered by commit time (popping newest
 
 C: Send one `$GIT_URL/git-upload-pack` request:
 
-   C: 0032want <want #1>...............................
-   C: 0032want <want #2>...............................
+   C: 0032want <want-#1>...............................
+   C: 0032want <want-#2>...............................
    ....
-   C: 0032have <common #1>.............................
-   C: 0032have <common #2>.............................
+   C: 0032have <common-#1>.............................
+   C: 0032have <common-#2>.............................
    ....
-   C: 0032have <have #1>...............................
-   C: 0032have <have #2>...............................
+   C: 0032have <have-#1>...............................
+   C: 0032have <have-#2>...............................
    ....
    C: 0000
 
@@ -423,7 +423,7 @@ multiple commands. Object names MUST be given using the object format
 negotiated through the `object-format` capability (default SHA-1).
 
 The `have` list is created by popping the first 32 commits
-from `c_pending`.  Less can be supplied if `c_pending` empties.
+from `c_pending`.  Fewer can be supplied if `c_pending` empties.
 
 If the client has sent 256 "have" commits and has not yet
 received one of those back from `s_common`, or the client has
@@ -512,7 +512,7 @@ Within the command portion of the request body clients SHOULD send
 the id obtained through ref discovery as old_id.
 
   update_request  =  command_list
-                    "PACK" <binary data>
+                    "PACK" <binary-data>
 
   command_list    =  PKT-LINE(command NUL cap_list LF)
                     *(command_pkt)
@@ -529,8 +529,8 @@ TODO: Document this further.
 REFERENCES
 ----------
 
-http://www.ietf.org/rfc/rfc1738.txt[RFC 1738: Uniform Resource Locators (URL)]
-http://www.ietf.org/rfc/rfc2616.txt[RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1]
+https://www.ietf.org/rfc/rfc1738.txt[RFC 1738: Uniform Resource Locators (URL)]
+https://www.ietf.org/rfc/rfc2616.txt[RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1]
 
 SEE ALSO
 --------
index dd4108b7a3b95456e0887fc41aed4e381261bd41..837b691c892b31e204948c29b986337809683ce1 100644 (file)
@@ -30,7 +30,7 @@ pkt-line Format
 ---------------
 
 The descriptions below build on the pkt-line format described in
-linkgit:gitprotocol-common[5]. When the grammar indicate `PKT-LINE(...)`, unless
+linkgit:gitprotocol-common[5]. When the grammar indicates `PKT-LINE(...)`, unless
 otherwise noted the usual pkt-line LF rules apply: the sender SHOULD
 include a LF, but the receiver MUST NOT complain if it is not present.
 
@@ -137,7 +137,7 @@ an absolute path in the remote filesystem.
                    v
     ssh user@example.com "git-upload-pack '/project.git'"
 
-In a "user@host:path" format URI, its relative to the user's home
+In a "user@host:path" format URI, it's relative to the user's home
 directory, because the Git client will run:
 
      git clone user@example.com:project.git
@@ -325,7 +325,7 @@ a positive depth, this step is skipped.
 
 If the client has requested a positive depth, the server will compute
 the set of commits which are no deeper than the desired depth. The set
-of commits start at the client's wants.
+of commits starts at the client's wants.
 
 The server writes 'shallow' lines for each
 commit whose parents will not be sent as a result. The server writes
index acb97ad0c22440a5039d8cf3da6f00dd60295a24..414bc625d5dd219faefcf7fe06aa93d6443763f4 100644 (file)
@@ -29,7 +29,7 @@ protocol.  Protocol v2 will improve upon v1 in the following ways:
     semantics the http remote helper can simply act as a proxy
 
 In protocol v2 communication is command oriented.  When first contacting a
-server a list of capabilities will advertised.  Some of these capabilities
+server a list of capabilities will be advertised.  Some of these capabilities
 will be commands which a client can request be executed.  Once a command
 has completed, a client can reuse the connection and request that other
 commands be executed.
@@ -199,7 +199,7 @@ which can be used to limit the refs sent from the server.
 
 Additional features not supported in the base command will be advertised
 as the value of the command in the capability advertisement in the form
-of a space separated list of features: "<command>=<feature 1> <feature 2>"
+of a space separated list of features: "<command>=<feature-1> <feature-2>"
 
 ls-refs takes in the following arguments:
 
@@ -245,7 +245,7 @@ addition of future extensions.
 
 Additional features not supported in the base command will be advertised
 as the value of the command in the capability advertisement in the form
-of a space separated list of features: "<command>=<feature 1> <feature 2>"
+of a space separated list of features: "<command>=<feature-1> <feature-2>"
 
 A `fetch` request can take the following arguments:
 
@@ -346,7 +346,8 @@ the 'wanted-refs' section in the server's response as explained below.
     want-ref <ref>
        Indicates to the server that the client wants to retrieve a
        particular ref, where <ref> is the full name of a ref on the
-       server.
+       server.  It is a protocol error to send want-ref for the
+       same ref more than once.
 
 If the 'sideband-all' feature is advertised, the following argument can be
 included in the client's request:
@@ -361,9 +362,10 @@ included in the client's request:
 If the 'packfile-uris' feature is advertised, the following argument
 can be included in the client's request as well as the potential
 addition of the 'packfile-uris' section in the server's response as
-explained below.
+explained below. Note that at most one `packfile-uris` line can be sent
+to the server.
 
-    packfile-uris <comma-separated list of protocols>
+    packfile-uris <comma-separated-list-of-protocols>
        Indicates to the server that the client is willing to receive
        URIs of any of the given protocols in place of objects in the
        sent packfile. Before performing the connectivity check, the
@@ -534,7 +536,7 @@ with objects using hash algorithm X.  If not specified, the server is assumed to
 only handle SHA-1.  If the client would like to use a hash algorithm other than
 SHA-1, it should specify its object-format string.
 
-session-id=<session id>
+session-id=<session-id>
 ~~~~~~~~~~~~~~~~~~~~~~~
 
 The server may advertise a session ID that can be used to identify this process
index ed8da428c98bc96cafdbbcc8543ed0c8479a13a3..07c8439a6f784bc818108fad6fdd82891509dd84 100644 (file)
@@ -526,7 +526,7 @@ set by Git if the remote helper has the 'option' capability.
 'option pushcert' {'true'|'false'}::
        GPG sign pushes.
 
-'option push-option <string>::
+'option push-option' <string>::
        Transmit <string> as a push option. As the push option
        must not contain LF or NUL characters, the string is not encoded.
 
index 1a2ef4c15055a20eaa65cbbf0f40525ba7e2ba48..949cd8a31e9a9e896ccec63d5c7e2f23f740973a 100644 (file)
@@ -23,7 +23,9 @@ A Git repository comes in two different flavours:
 
 *Note*: Also you can have a plain text file `.git` at the root of
 your working tree, containing `gitdir: <path>` to point at the real
-directory that has the repository.  This mechanism is often used for
+directory that has the repository.
+This mechanism is called a 'gitfile' and is usually managed via the
+`git submodule` and `git worktree` commands. It is often used for
 a working tree of a submodule checkout, to allow you in the
 containing superproject to `git checkout` a branch that does not
 have the submodule.  The `checkout` has to remove the entire
index 941858a6ecce88440975f02c2462f6aa8692b0bc..f7b5a25a0caa91c7eec2612d56300af08718c2a6 100644 (file)
@@ -78,7 +78,7 @@ Submodule operations can be configured using the following mechanisms
 
  * The command line for those commands that support taking submodules
    as part of their pathspecs. Most commands have a boolean flag
-   `--recurse-submodules` which specify whether to recurse into submodules.
+   `--recurse-submodules` which specifies whether to recurse into submodules.
    Examples are `grep` and `checkout`.
    Some commands take enums, such as `fetch` and `push`, where you can
    specify how submodules are affected.
@@ -151,7 +151,7 @@ the superproject's `$GIT_DIR/config` file, so the superproject's history
 is not affected. This can be undone using `git submodule init`.
 
  * Deleted submodule: A submodule can be deleted by running
-`git rm <submodule path> && git commit`. This can be undone
+`git rm <submodule-path> && git commit`. This can be undone
 using `git revert`.
 +
 The deletion removes the superproject's tracking data, which are
@@ -192,7 +192,7 @@ For example:
   [submodule "baz"]
     url = https://example.org/baz
 
-In the above config only the submodule 'bar' and 'baz' are active,
+In the above config only the submodules 'bar' and 'baz' are active,
 'bar' due to (1) and 'baz' due to (3). 'foo' is inactive because
 (1) takes precedence over (3)
 
@@ -229,7 +229,7 @@ Workflow for a third party library
   git submodule add <URL> <path>
 
   # Occasionally update the submodule to a new version:
-  git -C <path> checkout <new version>
+  git -C <path> checkout <new-version>
   git add <path>
   git commit -m "update submodule to new version"
 
@@ -274,7 +274,7 @@ will not be checked out by default; you can instruct `clone` to recurse
 into submodules. The `init` and `update` subcommands of `git submodule`
 will maintain submodules checked out and at an appropriate revision in
 your working tree. Alternatively you can set `submodule.recurse` to have
-`checkout` recursing into submodules (note that `submodule.recurse` also
+`checkout` recurse into submodules (note that `submodule.recurse` also
 affects other Git commands, see linkgit:git-config[1] for a complete list).
 
 
index c7cadd8aaf1a0e6606d2b559b674526bc687849a..4759408788070baba26b94e91dde74a9e6c6dda5 100644 (file)
@@ -137,10 +137,10 @@ which will automatically notice any modified (but not new) files, add
 them to the index, and commit, all in one step.
 
 A note on commit messages: Though not required, it's a good idea to
-begin the commit message with a single short (less than 50 character)
-line summarizing the change, followed by a blank line and then a more
-thorough description. The text up to the first blank line in a commit
-message is treated as the commit title, and that title is used
+begin the commit message with a single short (no more than 50
+characters) line summarizing the change, followed by a blank line and
+then a more thorough description. The text up to the first blank line in
+a commit message is treated as the commit title, and that title is used
 throughout Git.  For example, linkgit:git-format-patch[1] turns a
 commit into email, and it uses the title on the Subject line and the
 rest of the commit in the body.
index 34b1d6e224356cd3e9a637d0d5bdbef2f6ee269d..85983587fcffa8a07daf452adc3967d85804a9d4 100644 (file)
@@ -53,7 +53,7 @@ following order:
    `/etc/gitweb-common.conf`),
 
  * either per-instance configuration file (defaults to 'gitweb_config.perl'
-   in the same directory as the installed gitweb), or if it does not exists
+   in the same directory as the installed gitweb), or if it does not exist
    then fallback system-wide configuration file (defaults to `/etc/gitweb.conf`).
 
 Values obtained in later configuration files override values obtained earlier
@@ -242,7 +242,7 @@ $mimetypes_file::
 
 $highlight_bin::
        Path to the highlight executable to use (it must be the one from
-       http://www.andre-simon.de[] due to assumptions about parameters and output).
+       http://andre-simon.de/zip/download.php[] due to assumptions about parameters and output).
        By default set to 'highlight'; set it to full path to highlight
        executable if it is not installed on your web server's PATH.
        Note that 'highlight' feature must be set for gitweb to actually
@@ -343,7 +343,7 @@ $home_link_str::
        Label for the "home link" at the top of all pages, leading to `$home_link`
        (usually the main gitweb page, which contains the projects list).  It is
        used as the first component of gitweb's "breadcrumb trail":
-       `<home link> / <project> / <action>`.  Can be set at build time using
+       `<home-link> / <project> / <action>`.  Can be set at build time using
        the `GITWEB_HOME_LINK_STR` variable.  By default it is set to "projects",
        as this link leads to the list of projects.  Another popular choice is to
        set it to the name of site.  Note that it is treated as raw HTML so it
@@ -604,9 +604,9 @@ Many gitweb features can be enabled (or disabled) and configured using the
 Each `%feature` hash element is a hash reference and has the following
 structure:
 ----------------------------------------------------------------------
-"<feature_name>" => {
-       "sub" => <feature-sub (subroutine)>,
-       "override" => <allow-override (boolean)>,
+"<feature-name>" => {
+       "sub" => <feature-sub-(subroutine)>,
+       "override" => <allow-override-(boolean)>,
        "default" => [ <options>... ]
 },
 ----------------------------------------------------------------------
@@ -614,7 +614,7 @@ Some features cannot be overridden per project.  For those
 features the structure of appropriate `%feature` hash element has a simpler
 form:
 ----------------------------------------------------------------------
-"<feature_name>" => {
+"<feature-name>" => {
        "override" => 0,
        "default" => [ <options>... ]
 },
@@ -820,7 +820,7 @@ filesystem (i.e. "$projectroot/$project"), `%h` to the current hash
 (\'h' gitweb parameter) and `%b` to the current hash base
 (\'hb' gitweb parameter); `%%` expands to \'%'.
 +
-For example, at the time this page was written, the http://repo.or.cz[]
+For example, at the time this page was written, the https://repo.or.cz[]
 Git hosting site set it to the following to enable graphical log
 (using the third party tool *git-browser*):
 +
index af6bf3c45ec1b78c13a0886c2824eb980099c706..56d24a30a3f7b9ccd7046a1d66abd1cee2525ba6 100644 (file)
@@ -8,7 +8,7 @@ gitweb - Git web interface (web frontend to Git repositories)
 SYNOPSIS
 --------
 To get started with gitweb, run linkgit:git-instaweb[1] from a Git repository.
-This would configure and start your web server, and run web browser pointing to
+This will configure and start your web server, and run a web browser pointing to
 gitweb.
 
 
@@ -20,15 +20,15 @@ Gitweb provides a web interface to Git repositories.  Its features include:
 * Browsing every revision of the repository.
 * Viewing the contents of files in the repository at any revision.
 * Viewing the revision log of branches, history of files and directories,
-  see what was changed when, by who.
+  seeing what was changed, when, and by whom.
 * Viewing the blame/annotation details of any file (if enabled).
 * Generating RSS and Atom feeds of commits, for any branch.
   The feeds are auto-discoverable in modern web browsers.
-* Viewing everything that was changed in a revision, and step through
+* Viewing everything that was changed in a revision, and stepping through
   revisions one at a time, viewing the history of the repository.
-* Finding commits which commit messages matches given search term.
+* Finding commits whose commit messages match a given search term.
 
-See http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
+See https://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
 browsed using gitweb itself.
 
 
@@ -41,9 +41,9 @@ for details.
 Repositories
 ~~~~~~~~~~~~
 Gitweb can show information from one or more Git repositories.  These
-repositories have to be all on local filesystem, and have to share common
+repositories have to be all on local filesystem, and have to share common
 repository root, i.e. be all under a single parent repository (but see also
-"Advanced web server setup" section, "Webserver configuration with multiple
+the "Advanced web server setup" section, "Webserver configuration with multiple
 projects' root" subsection).
 
 -----------------------------------------------------------------------
@@ -51,7 +51,7 @@ our $projectroot = '/path/to/parent/directory';
 -----------------------------------------------------------------------
 
 The default value for `$projectroot` is `/pub/git`.  You can change it during
-building gitweb via `GITWEB_PROJECTROOT` build configuration variable.
+building gitweb via the `GITWEB_PROJECTROOT` build configuration variable.
 
 By default all Git repositories under `$projectroot` are visible and available
 to gitweb.  The list of projects is generated by default by scanning the
@@ -66,7 +66,7 @@ found at "$projectroot/$repo".
 
 Projects list file format
 ~~~~~~~~~~~~~~~~~~~~~~~~~
-Instead of having gitweb find repositories by scanning filesystem
+Instead of having gitweb find repositories by scanning the filesystem
 starting from $projectroot, you can provide a pre-generated list of
 visible projects by setting `$projects_list` to point to a plain text
 file with a list of projects (with some additional info).
@@ -305,7 +305,7 @@ pathnames.  In most general form such path_info (component) based gitweb URL
 looks like this:
 
 -----------------------------------------------------------------------
-.../gitweb.cgi/<repo>/<action>/<revision_from>:/<path_from>..<revision_to>:/<path_to>?<arguments>
+.../gitweb.cgi/<repo>/<action>/<revision-from>:/<path-from>..<revision-to>:/<path-to>?<arguments>
 -----------------------------------------------------------------------
 
 
index 5a537268e275e45142640820942004b5cd731dbb..d71b199955e15578c1392448cc5db0ce01240766 100644 (file)
@@ -98,9 +98,8 @@ to point at the new commit.
        revision.
 
 [[def_commit-ish]]commit-ish (also committish)::
-       A <<def_commit_object,commit object>> or an
-       <<def_object,object>> that can be recursively dereferenced to
-       a commit object.
+       A <<def_commit_object,commit object>> or an <<def_object,object>> that
+       can be recursively <<def_dereference,dereferenced>> to a commit object.
        The following are all commit-ishes:
        a commit object,
        a <<def_tag_object,tag object>> that points to a commit
@@ -125,6 +124,25 @@ to point at the new commit.
        dangling object has no references to it from any
        reference or <<def_object,object>> in the <<def_repository,repository>>.
 
+[[def_dereference]]dereference::
+       Referring to a <<def_symref,symbolic ref>>: the action of accessing the
+       <<def_ref,reference>> pointed at by a symbolic ref. Recursive
+       dereferencing involves repeating the aforementioned process on the
+       resulting ref until a non-symbolic reference is found.
++
+Referring to a <<def_tag_object,tag object>>: the action of accessing the
+<<def_object,object>> a tag points at. Tags are recursively dereferenced by
+repeating the operation on the result object until the result has either a
+specified <<def_object_type,object type>> (where applicable) or any non-"tag"
+object type. A synonym for "recursive dereference" in the context of tags is
+"<<def_peel,peel>>".
++
+Referring to a <<def_commit_object,commit object>>: the action of accessing
+the commit's tree object. Commits cannot be dereferenced recursively.
++
+Unless otherwise specified, "dereferencing" as it used in the context of Git
+commands or protocols is implicitly recursive.
+
 [[def_detached_HEAD]]detached HEAD::
        Normally the <<def_HEAD,HEAD>> stores the name of a
        <<def_branch,branch>>, and commands that operate on the
@@ -184,9 +202,11 @@ current branch integrates with) obviously do not work, as there is no
 [[def_gitfile]]gitfile::
        A plain file `.git` at the root of a working tree that
        points at the directory that is the real repository.
+       For proper use see linkgit:git-worktree[1] or linkgit:git-submodule[1].
+       For syntax see linkgit:gitrepository-layout[5].
 
 [[def_grafts]]grafts::
-       Grafts enables two otherwise different lines of development to be joined
+       Grafts enable two otherwise different lines of development to be joined
        together by recording fake ancestry information for commits. This way
        you can make Git pretend the set of <<def_parent,parents>> a <<def_commit,commit>> has
        is different from what was recorded when the commit was
@@ -294,6 +314,12 @@ This commit is referred to as a "merge commit", or sometimes just a
 [[def_octopus]]octopus::
        To <<def_merge,merge>> more than two <<def_branch,branches>>.
 
+[[def_orphan]]orphan::
+       The act of getting on a <<def_branch,branch>> that does not
+       exist yet (i.e., an <<def_unborn,unborn>> branch).  After
+       such an operation, the commit first created becomes a commit
+       without a parent, starting a new history.
+
 [[def_origin]]origin::
        The default upstream <<def_repository,repository>>. Most projects have
        at least one upstream project which they track. By default
@@ -444,6 +470,10 @@ exclude;;
        of the logical predecessor(s) in the line of development, i.e. its
        parents.
 
+[[def_peel]]peel::
+       The action of recursively <<def_dereference,dereferencing>> a
+       <<def_tag_object,tag object>>.
+
 [[def_pickaxe]]pickaxe::
        The term <<def_pickaxe,pickaxe>> refers to an option to the diffcore
        routines that help select changes that add or delete a given text
@@ -608,6 +638,20 @@ The most notable example is `HEAD`.
        An <<def_object,object>> used to temporarily store the contents of a
        <<def_dirty,dirty>> working directory and the index for future reuse.
 
+[[def_special_ref]]special ref::
+       A ref that has different semantics than normal refs. These refs can be
+       accessed via normal Git commands but may not behave the same as a
+       normal ref in some cases.
++
+The following special refs are known to Git:
+
+ - "`FETCH_HEAD`" is written by linkgit:git-fetch[1] or linkgit:git-pull[1]. It
+   may refer to multiple object IDs. Each object ID is annotated with metadata
+   indicating where it was fetched from and its fetch status.
+
+ - "`MERGE_HEAD`" is written by linkgit:git-merge[1] when resolving merge
+   conflicts. It contains all commit IDs which are being merged.
+
 [[def_submodule]]submodule::
        A <<def_repository,repository>> that holds the history of a
        separate project inside another repository (the latter of
@@ -620,12 +664,11 @@ The most notable example is `HEAD`.
        copies of) commit objects of the contained submodules.
 
 [[def_symref]]symref::
-       Symbolic reference: instead of containing the <<def_SHA1,SHA-1>>
-       id itself, it is of the format 'ref: refs/some/thing' and when
-       referenced, it recursively dereferences to this reference.
-       '<<def_HEAD,HEAD>>' is a prime example of a symref. Symbolic
-       references are manipulated with the linkgit:git-symbolic-ref[1]
-       command.
+       Symbolic reference: instead of containing the <<def_SHA1,SHA-1>> id
+       itself, it is of the format 'ref: refs/some/thing' and when referenced,
+       it recursively <<def_dereference,dereferences>> to this reference.
+       '<<def_HEAD,HEAD>>' is a prime example of a symref. Symbolic references
+       are manipulated with the linkgit:git-symbolic-ref[1] command.
 
 [[def_tag]]tag::
        A <<def_ref,ref>> under `refs/tags/` namespace that points to an
@@ -661,11 +704,11 @@ The most notable example is `HEAD`.
        <<def_tree,tree>> is equivalent to a <<def_directory,directory>>.
 
 [[def_tree-ish]]tree-ish (also treeish)::
-       A <<def_tree_object,tree object>> or an <<def_object,object>>
-       that can be recursively dereferenced to a tree object.
-       Dereferencing a <<def_commit_object,commit object>> yields the
-       tree object corresponding to the <<def_revision,revision>>'s
-       top <<def_directory,directory>>.
+       A <<def_tree_object,tree object>> or an <<def_object,object>> that can
+       be recursively <<def_dereference,dereferenced>> to a tree object.
+       Dereferencing a <<def_commit_object,commit object>> yields the tree
+       object corresponding to the <<def_revision,revision>>'s top
+       <<def_directory,directory>>.
        The following are all tree-ishes:
        a <<def_commit-ish,commit-ish>>,
        a tree object,
@@ -674,6 +717,18 @@ The most notable example is `HEAD`.
        object,
        etc.
 
+[[def_unborn]]unborn::
+       The <<def_HEAD,HEAD>> can point at a <<def_branch,branch>>
+       that does not yet exist and that does not have any commit on
+       it yet, and such a branch is called an unborn branch.  The
+       most typical way users encounter an unborn branch is by
+       creating a repository anew without cloning from elsewhere.
+       The HEAD would point at the 'main' (or 'master', depending
+       on your configuration) branch that is yet to be born.  Also
+       some operations can get you on an unborn branch with their
+       <<def_orphan,orphan>> option.
+
+
 [[def_unmerged_index]]unmerged index::
        An <<def_index,index>> which contains unmerged
        <<def_index_entry,index entries>>.
index e653775bab18ddeacb03ec16beaa6d25af5ecf3d..b9cb95e82f0eca994c7a0b9149e028feef83bdec 100644 (file)
@@ -145,7 +145,7 @@ Opening a Security Advisory draft
 
 The first step is to https://github.com/git/git/security/advisories/new[open
 an advisory]. Technically, this is not necessary. However, it is the most
-convenient way to obtain the CVE number and it give us a private repository
+convenient way to obtain the CVE number and it gives us a private repository
 associated with it that can be used to collaborate on a fix.
 
 Notifying the Linux distributions
index 35d48ef714e9b2cddbbff68b63a14901844ded90..5f800fd85a3dbd4218bb0aaa2bd4de08a3c71434 100644 (file)
@@ -213,4 +213,4 @@ The procedure will result in a history that looks like this:
                 B0--B1---------B2
 ------------
 
-See also http://git-blame.blogspot.com/2013/09/fun-with-first-parent-history.html
+See also https://git-blame.blogspot.com/2013/09/fun-with-first-parent-history.html
index d07c6d44e53c3bd0e7805efa036f2cf3eeaf79ac..013014bbef67ac149ea8ebdb3093ed8648b5a469 100644 (file)
@@ -104,7 +104,7 @@ by doing the following:
    files in mbox format).
 
  - Write his own patches to address issues raised on the list but
-   nobody has stepped up solving.  Send it out just like other
+   nobody has stepped up to solve.  Send it out just like other
    contributors do, and pick them up just like patches from other
    contributors (see above).
 
@@ -411,13 +411,13 @@ Preparing a "merge-fix"
 
 A merge of two topics may not textually conflict but still have
 conflict at the semantic level. A classic example is for one topic
-to rename an variable and all its uses, while another topic adds a
+to rename a variable and all its uses, while another topic adds a
 new use of the variable under its old name. When these two topics
 are merged together, the reference to the variable newly added by
 the latter topic will still use the old name in the result.
 
 The Meta/Reintegrate script that is used by redo-jch and redo-seen
-scripts implements a crude but usable way to work this issue around.
+scripts implements a crude but usable way to work around this issue.
 When the script merges branch $X, it checks if "refs/merge-fix/$X"
 exists, and if so, the effect of it is squashed into the result of
 the mechanical merge.  In other words,
index 151ee84cebcef3ca549f3150e69e91b29cc2f372..4e727deedd21235403c4a3b02e8c826780d39d8b 100644 (file)
@@ -100,7 +100,7 @@ info "The user is: '$username'"
 
 if test -f "$allowed_users_file"
 then
-  rc=$(cat $allowed_users_file | grep -v '^#' | grep -v '^$' |
+  rc=$(grep -Ev '^(#|$)' $allowed_users_file |
     while read heads user_patterns
     do
       # does this rule apply to us?
@@ -138,7 +138,7 @@ info "'$groups'"
 
 if test -f "$allowed_groups_file"
 then
-  rc=$(cat $allowed_groups_file | grep -v '^#' | grep -v '^$' |
+  rc=$(grep -Ev '^(#|$)' $allowed_groups_file |
     while read heads group_patterns
     do
       # does this rule apply to us?
index 7af2e52cf312c474d5888855fb86b7456a2d82db..2cad9b3ca5366fd115569e1e8d3b7484fed75bfd 100644 (file)
@@ -4,7 +4,7 @@ How to use git-daemon
 =====================
 
 Git can be run in inetd mode and in stand alone mode. But all you want is
-let a coworker pull from you, and therefore need to set up a Git server
+to let a coworker pull from you, and therefore need to set up a Git server
 real quick, right?
 
 Note that git-daemon is not really chatty at the moment, especially when
index a499a94ac2289ac6664035d339e37914748757d2..3bd581ac3591b6c3bf49a77c60e705539ab8319d 100644 (file)
@@ -11,7 +11,7 @@ Message-ID: <BAYC1-PASMTP12374B54BA370A1E1C6E78AE4E0@CEZ.ICE>
 How to use the subtree merge strategy
 =====================================
 
-There are situations where you want to include contents in your project
+There are situations where you want to include content in your project
 from an independently developed project. You can just pull from the
 other project as long as there are no conflicting paths.
 
index 6c6baeeeb75bd8ff15e7b2ec1f3c394e0c9ef845..3a866af4a4205d0cd101d862c45e7d96bd5718fa 100644 (file)
@@ -34,7 +34,7 @@ project find it more convenient to use legacy encodings, Git
 does not forbid it.  However, there are a few things to keep in
 mind.
 
-. 'git commit' and 'git commit-tree' issues
+. 'git commit' and 'git commit-tree' issue
   a warning if the commit log message given to it does not look
   like a valid UTF-8 string, unless you explicitly say your
   project uses a legacy encoding.  The way to say this is to
@@ -46,7 +46,7 @@ mind.
 ------------
 +
 Commit objects created with the above setting record the value
-of `i18n.commitEncoding` in its `encoding` header.  This is to
+of `i18n.commitEncoding` in their `encoding` header.  This is to
 help other people who look at them later.  Lack of this header
 implies that the commit log message is encoded in UTF-8.
 
index d8f7cd7ca017f4a257129e19ea7ce407aad5c3e8..3eaefc4e940518713e7d140badcd3734ce9abbf0 100644 (file)
@@ -191,7 +191,7 @@ endif::git-pull[]
 --autostash::
 --no-autostash::
        Automatically create a temporary stash entry before the operation
-       begins, record it in the special ref `MERGE_AUTOSTASH`
+       begins, record it in the ref `MERGE_AUTOSTASH`
        and apply it after the operation ends.  This means
        that you can run the operation on a dirty worktree.  However, use
        with care: the final stash application after a successful
index 2d631e9b1f242f334d9751823b5771d8e1d84112..befa86d69278b480610c6d0472c005ad6093cf83 100644 (file)
@@ -32,10 +32,10 @@ have special meaning:
   - `+` is used to "open a new tab"
   - `,` is used to "open a new vertical split"
   - `/` is used to "open a new horizontal split"
-  - `@` is used to indicate which is the file containing the final version after
+  - `@` is used to indicate the file containing the final version after
     solving the conflicts. If not present, `MERGED` will be used by default.
 
-The precedence of the operators is this one (you can use parentheses to change
+The precedence of the operators is as follows (you can use parentheses to change
 it):
 
     `@` > `+` > `/` > `,`
@@ -162,7 +162,7 @@ information as the first tab, with a different layout.
 |       REMOTE        |                     |
 ---------------------------------------------
 ....
-Note how in the third tab definition we need to use parenthesis to make `,`
+Note how in the third tab definition we need to use parentheses to make `,`
 have precedence over `/`.
 --
 
@@ -177,7 +177,8 @@ Instead of `--tool=vimdiff`, you can also use one of these other variants:
 
 When using these variants, in order to specify a custom layout you will have to
 set configuration variables `mergetool.gvimdiff.layout` and
-`mergetool.nvimdiff.layout` instead of `mergetool.vimdiff.layout`
+`mergetool.nvimdiff.layout` instead of `mergetool.vimdiff.layout` (though the
+latter will be used as fallback if the variant-specific one is not set).
 
 In addition, for backwards compatibility with previous Git versions, you can
 also append `1`, `2` or `3` to either `vimdiff` or any of the variants (ex:
index 3b713344597090037bd6cd7bc034aaeed8316656..8ee940b6a452daba6202f1b76747c7eeea8a6f48 100644 (file)
@@ -122,7 +122,9 @@ The placeholders are:
 - Placeholders that expand to a single literal character:
 '%n':: newline
 '%%':: a raw '%'
-'%x00':: print a byte from a hex code
+'%x00':: '%x' followed by two hexadecimal digits is replaced with a
+        byte with the hexadecimal digits' value (we will call this
+        "literal formatting code" in the rest of this document).
 
 - Placeholders that affect formatting of later placeholders:
 '%Cred':: switch color to red
@@ -222,13 +224,30 @@ The placeholders are:
        linkgit:git-rev-list[1])
 '%d':: ref names, like the --decorate option of linkgit:git-log[1]
 '%D':: ref names without the " (", ")" wrapping.
-'%(describe[:options])':: human-readable name, like
-                         linkgit:git-describe[1]; empty string for
-                         undescribable commits.  The `describe` string
-                         may be followed by a colon and zero or more
-                         comma-separated options.  Descriptions can be
-                         inconsistent when tags are added or removed at
-                         the same time.
+'%(decorate[:<options>])'::
+ref names with custom decorations. The `decorate` string may be followed by a
+colon and zero or more comma-separated options. Option values may contain
+literal formatting codes. These must be used for commas (`%x2C`) and closing
+parentheses (`%x29`), due to their role in the option syntax.
++
+** 'prefix=<value>': Shown before the list of ref names.  Defaults to "{nbsp}`(`".
+** 'suffix=<value>': Shown after the list of ref names.  Defaults to "`)`".
+** 'separator=<value>': Shown between ref names.  Defaults to "`,`{nbsp}".
+** 'pointer=<value>': Shown between HEAD and the branch it points to, if any.
+                     Defaults to "{nbsp}`->`{nbsp}".
+** 'tag=<value>': Shown before tag names. Defaults to "`tag:`{nbsp}".
+
++
+For example, to produce decorations with no wrapping
+or tag annotations, and spaces as separators:
++
+`%(decorate:prefix=,suffix=,tag=,separator= )`
+
+'%(describe[:<options>])'::
+human-readable name, like linkgit:git-describe[1]; empty string for
+undescribable commits.  The `describe` string may be followed by a colon and
+zero or more comma-separated options.  Descriptions can be inconsistent when
+tags are added or removed at the same time.
 +
 ** 'tags[=<bool-value>]': Instead of only considering annotated tags,
    consider lightweight tags as well.
@@ -281,13 +300,11 @@ endif::git-rev-list[]
 '%gE':: reflog identity email (respecting .mailmap, see
        linkgit:git-shortlog[1] or linkgit:git-blame[1])
 '%gs':: reflog subject
-'%(trailers[:options])':: display the trailers of the body as
-                         interpreted by
-                         linkgit:git-interpret-trailers[1]. The
-                         `trailers` string may be followed by a colon
-                         and zero or more comma-separated options.
-                         If any option is provided multiple times the
-                         last occurrence wins.
+'%(trailers[:<options>])'::
+display the trailers of the body as interpreted by
+linkgit:git-interpret-trailers[1]. The `trailers` string may be followed by
+a colon and zero or more comma-separated options. If any option is provided
+multiple times, the last occurrence wins.
 +
 ** 'key=<key>': only show trailers with specified <key>. Matching is done
    case-insensitively and trailing colon is optional. If option is
@@ -299,9 +316,8 @@ endif::git-rev-list[]
    `Reviewed-by`.
 ** 'only[=<bool>]': select whether non-trailer lines from the trailer
    block should be included.
-** 'separator=<sep>': specify a separator inserted between trailer
-   lines. When this option is not given each trailer line is
-   terminated with a line feed character. The string <sep> may contain
+** 'separator=<sep>': specify the separator inserted between trailer
+   lines. Defaults to a line feed character. The string <sep> may contain
    the literal formatting codes described above. To use comma as
    separator one must use `%x2C` as it would otherwise be parsed as
    next option. E.g., `%(trailers:key=Ticket,separator=%x2C )`
@@ -312,10 +328,9 @@ endif::git-rev-list[]
    `%(trailers:only,unfold=true)` unfolds and shows all trailer lines.
 ** 'keyonly[=<bool>]': only show the key part of the trailer.
 ** 'valueonly[=<bool>]': only show the value part of the trailer.
-** 'key_value_separator=<sep>': specify a separator inserted between
-   trailer lines. When this option is not given each trailer key-value
-   pair is separated by ": ". Otherwise it shares the same semantics
-   as 'separator=<sep>' above.
+** 'key_value_separator=<sep>': specify the separator inserted between
+   the key and value of each trailer. Defaults to ": ". Otherwise it
+   shares the same semantics as 'separator=<sep>' above.
 
 NOTE: Some placeholders may depend on other options given to the
 revision traversal engine. For example, the `%g*` reflog options will
index dc685be363a674e754dc62f961558d97d5e65a7d..23888cd612c9fb0c18ac1e24ac56a1a6f2a0a149 100644 (file)
@@ -48,7 +48,7 @@ people using 80-column terminals.
 --expand-tabs::
 --no-expand-tabs::
        Perform a tab expansion (replace each tab with enough spaces
-       to fill to the next display column that is multiple of '<n>')
+       to fill to the next display column that is multiple of '<n>')
        in the log message before showing it in the output.
        `--expand-tabs` is a short-hand for `--expand-tabs=8`, and
        `--no-expand-tabs` is a short-hand for `--expand-tabs=0`,
@@ -73,7 +73,7 @@ environment overrides). See linkgit:git-config[1] for more details.
 With an optional '<ref>' argument, use the ref to find the notes
 to display.  The ref can specify the full refname when it begins
 with `refs/notes/`; when it begins with `notes/`, `refs/` and otherwise
-`refs/notes/` is prefixed to form a full name of the ref.
+`refs/notes/` is prefixed to form the full name of the ref.
 +
 Multiple --notes options can be combined to control which notes are
 being displayed. Examples: "--notes=foo" will show only notes from
@@ -87,6 +87,10 @@ being displayed. Examples: "--notes=foo" will show only notes from
        "--notes --notes=foo --no-notes --notes=bar" will only show notes
        from "refs/notes/bar".
 
+--show-notes-by-default::
+       Show the default notes unless options for displaying specific
+       notes are given.
+
 --show-notes[=<ref>]::
 --[no-]standard-notes::
        These options are deprecated. Use the above --notes/--no-notes
index 95a7390b2c78bddfc2c094fa6f0ba82e2b6de417..c718f7946f065d425c818c09bfd11fd641b73b4f 100644 (file)
@@ -71,7 +71,7 @@ refspec (or `--force`).
 Unlike when pushing with linkgit:git-push[1], any updates outside of
 `refs/{tags,heads}/*` will be accepted without `+` in the refspec (or
 `--force`), whether that's swapping e.g. a tree object for a blob, or
-a commit for another commit that's doesn't have the previous commit as
+a commit for another commit that doesn't have the previous commit as
 an ancestor etc.
 +
 Unlike when pushing with linkgit:git-push[1], there is no
@@ -80,7 +80,7 @@ configuration which'll amend these rules, and nothing like a
 +
 As with pushing with linkgit:git-push[1], all of the rules described
 above about what's not allowed as an update can be overridden by
-adding an the optional leading `+` to a refspec (or using `--force`
+adding an optional leading `+` to a refspec (or using the `--force`
 command line option). The only exception to this is that no amount of
 forcing will make the `refs/heads/*` namespace accept a non-commit
 object.
@@ -88,7 +88,7 @@ object.
 [NOTE]
 When the remote branch you want to fetch is known to
 be rewound and rebased regularly, it is expected that
-its new tip will not be descendant of its previous tip
+its new tip will not be descendant of its previous tip
 (as stored in your remote-tracking branch the last time
 you fetched).  You would want
 to use the `+` sign to indicate non-fast-forward updates
diff --git a/Documentation/ref-storage-format.txt b/Documentation/ref-storage-format.txt
new file mode 100644 (file)
index 0000000..14fff8a
--- /dev/null
@@ -0,0 +1,3 @@
+* `files` for loose files with packed-refs. This is the default.
+* `reftable` for the reftable format. This format is experimental and its
+  internals are subject to change.
index a4a0cb93b241b8d5d9c9bc9b200a277a0e4f7992..00ccf68744103d4dc6ffdce5c582c726c2d9ea9d 100644 (file)
@@ -56,7 +56,7 @@ endif::git-rev-list[]
        error to use this option unless `--walk-reflogs` is in use.
 
 --grep=<pattern>::
-       Limit the commits output to ones with log message that
+       Limit the commits output to ones with log message that
        matches the specified pattern (regular expression).  With
        more than one `--grep=<pattern>`, commits whose message
        matches any of the given patterns are chosen (but see
@@ -72,7 +72,7 @@ endif::git-rev-list[]
        instead of ones that match at least one.
 
 --invert-grep::
-       Limit the commits output to ones with log message that do not
+       Limit the commits output to ones with log message that do not
        match the pattern specified with `--grep=<pattern>`.
 
 -i::
@@ -151,6 +151,10 @@ endif::git-log[]
 --not::
        Reverses the meaning of the '{caret}' prefix (or lack thereof)
        for all following revision specifiers, up to the next `--not`.
+       When used on the command line before --stdin, the revisions passed
+       through stdin will not be affected by it. Conversely, when passed
+       via standard input, the revisions passed on the command line will
+       not be affected by it.
 
 --all::
        Pretend as if all the refs in `refs/`, along with `HEAD`, are
@@ -240,7 +244,9 @@ endif::git-rev-list[]
        them from standard input as well. This accepts commits and
        pseudo-options like `--all` and `--glob=`. When a `--` separator
        is seen, the following input is treated as paths and used to
-       limit the result.
+       limit the result. Flags like `--not` which are read via standard input
+       are only respected for arguments passed in the same way and will not
+       influence any subsequent command line arguments.
 
 ifdef::git-rev-list[]
 --quiet::
@@ -310,12 +316,12 @@ list.
 With `--pretty` format other than `oneline` and `reference` (for obvious reasons),
 this causes the output to have two extra lines of information
 taken from the reflog.  The reflog designator in the output may be shown
-as `ref@{Nth}` (where `Nth` is the reverse-chronological index in the
-reflog) or as `ref@{timestamp}` (with the timestamp for that entry),
+as `ref@{<Nth>}` (where _<Nth>_ is the reverse-chronological index in the
+reflog) or as `ref@{<timestamp>}` (with the _<timestamp>_ for that entry),
 depending on a few rules:
 +
 --
-1. If the starting point is specified as `ref@{Nth}`, show the index
+1. If the starting point is specified as `ref@{<Nth>}`, show the index
    format.
 +
 2. If the starting point was specified as `ref@{now}`, show the
@@ -335,8 +341,11 @@ See also linkgit:git-reflog[1].
 Under `--pretty=reference`, this information will not be shown at all.
 
 --merge::
-       After a failed merge, show refs that touch files having a
-       conflict and don't exist on all heads to merge.
+       Show commits touching conflicted paths in the range `HEAD...<other>`,
+       where `<other>` is the first existing pseudoref in `MERGE_HEAD`,
+       `CHERRY_PICK_HEAD`, `REVERT_HEAD` or `REBASE_HEAD`. Only works
+       when the index has unmerged entries. This option can be used to show
+       relevant commits when resolving conflicts from a 3-way merge.
 
 --boundary::
        Output excluded boundary commits. Boundary commits are
@@ -941,10 +950,10 @@ ifdef::git-rev-list[]
 +
 The form '--filter=blob:none' omits all blobs.
 +
-The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes
-or units.  n may be zero.  The suffixes k, m, and g can be used to name
-units in KiB, MiB, or GiB.  For example, 'blob:limit=1k' is the same
-as 'blob:limit=1024'.
+The form '--filter=blob:limit=<n>[kmg]' omits blobs of size at least n
+bytes or units.  n may be zero.  The suffixes k, m, and g can be used
+to name units in KiB, MiB, or GiB.  For example, 'blob:limit=1k'
+is the same as 'blob:limit=1024'.
 +
 The form '--filter=object:type=(tag|commit|tree|blob)' omits all objects
 which are not of the requested type.
@@ -1013,6 +1022,10 @@ Unexpected missing objects will raise an error.
 +
 The form '--missing=print' is like 'allow-any', but will also print a
 list of the missing objects.  Object IDs are prefixed with a ``?'' character.
++
+If some tips passed to the traversal are missing, they will be
+considered as missing too, and the traversal will ignore them. In case
+we cannot get their Object ID though, an error will be raised.
 
 --exclude-promisor-objects::
        (For internal use only.)  Prefilter object traversal at
index f33436c7f65ff9fd46f7ee4fa10975c833a61096..361f51a64736fab34faa8efaa90071c957d74c3b 100644 (file)
@@ -8,7 +8,8 @@ scalar - A tool for managing large Git repositories
 SYNOPSIS
 --------
 [verse]
-scalar clone [--single-branch] [--branch <main-branch>] [--full-clone] <url> [<enlistment>]
+scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]
+       [--[no-]src] <url> [<enlistment>]
 scalar list
 scalar register [<enlistment>]
 scalar unregister [<enlistment>]
@@ -80,6 +81,11 @@ remote-tracking branch for the branch this option was used for the initial
 cloning. If the HEAD at the remote did not point at any branch when
 `--single-branch` clone was made, no remote-tracking branch is created.
 
+--[no-]src::
+       By default, `scalar clone` places the cloned repository within a
+       `<entlistment>/src` directory. Use `--no-src` to place the cloned
+       repository directly in the `<enlistment>` directory.
+
 --[no-]full-clone::
        A sparse-checkout is initialized by default. This behavior can be
        turned off via `--full-clone`.
index 12aa2333e46b02aaf86106705bac722ceeec09f8..d98758f3cb70d7298cb5bd5a18c8fa23bfe2cd6e 100644 (file)
@@ -9,7 +9,7 @@ endif::git-commit[]
        the committer has the rights to submit the work under the
        project's license or agrees to some contributor representation,
        such as a Developer Certificate of Origin.
-       (See http://developercertificate.org for the one used by the
+       (See https://developercertificate.org for the one used by the
        Linux kernel and Git projects.)  Consult the documentation or
        leadership of the project to which you're contributing to
        understand how the signoffs are used in that project.
index eda8c195c19629dfe836b36d9baaa21ec06199d6..7780a76b080e4b7ad2c82dc8eb6616e92fd21c4e 100644 (file)
@@ -1,7 +1,7 @@
 Git API Documents
 =================
 
-Git has grown a set of internal API over time.  This collection
+Git has grown a set of internal APIs over time.  This collection
 documents them.
 
 ////////////////////////////////////////////////////////////////
index d44ada98e7db9ccdd7dd622221ee298af5de5000..c4fb152b23291c3978db623b5ebe5eaea1385442 100644 (file)
@@ -2,7 +2,7 @@ Simple-IPC API
 ==============
 
 The Simple-IPC API is a collection of `ipc_` prefixed library routines
-and a basic communication protocol that allow an IPC-client process to
+and a basic communication protocol that allows an IPC-client process to
 send an application-specific IPC-request message to an IPC-server
 process and receive an application-specific IPC-response message.
 
@@ -20,12 +20,12 @@ IPC-client.
 
 The IPC-client routines within a client application process connect
 to the IPC-server and send a request message and wait for a response.
-When received, the response is returned back the caller.
+When received, the response is returned back to the caller.
 
 For example, the `fsmonitor--daemon` feature will be built as a server
 application on top of the IPC-server library routines.  It will have
 threads watching for file system events and a thread pool waiting for
-client connections.  Clients, such as `git status` will request a list
+client connections.  Clients, such as `git status`, will request a list
 of file system events since a point in time and the server will
 respond with a list of changed files and directories.  The formats of
 the request and response are application-specific; the IPC-client and
@@ -37,7 +37,7 @@ Comparison with sub-process model
 
 The Simple-IPC mechanism differs from the existing `sub-process.c`
 model (Documentation/technical/long-running-process-protocol.txt) and
-used by applications like Git-LFS.  In the LFS-style sub-process model
+used by applications like Git-LFS.  In the LFS-style sub-process model,
 the helper is started by the foreground process, communication happens
 via a pair of file descriptors bound to the stdin/stdout of the
 sub-process, the sub-process only serves the current foreground
@@ -102,4 +102,4 @@ stateless request, receive an application-specific
 response, and disconnect.  It is a one round trip facility for
 querying the server.  The Simple-IPC routines hide the socket,
 named pipe, and thread pool details and allow the application
-layer to focus on the application at hand.
+layer to focus on the task at hand.
index c2e652b71a7f698a6843bbf327535b4692538c0f..f5d200939b056076368d4e8a735772fde114599d 100644 (file)
@@ -114,7 +114,7 @@ result in an empty bitmap (no bits set).
 
     * N entries with compressed bitmaps, one for each indexed commit
 +
-Where `N` is the total amount of entries in this bitmap index.
+Where `N` is the total number of entries in this bitmap index.
 Each entry contains the following:
 
        ** {empty}
@@ -126,7 +126,7 @@ Each entry contains the following:
        ** {empty}
        1-byte XOR-offset: ::
            The xor offset used to compress this bitmap. For an entry
-           in position `x`, a XOR offset of `y` means that the actual
+           in position `x`, an XOR offset of `y` means that the actual
            bitmap representing this commit is composed by XORing the
            bitmap for this entry with the bitmap in entry `x-y` (i.e.
            the bitmap `y` entries before this one).
@@ -239,7 +239,7 @@ bitmaps.
 
 For a `.bitmap` containing `nr_entries` reachability bitmaps, the table
 contains a list of `nr_entries` <commit_pos, offset, xor_row> triplets
-(sorted in the ascending order of `commit_pos`). The content of i'th
+(sorted in the ascending order of `commit_pos`). The content of the i'th
 triplet is -
 
        * {empty}
index 86fed0de0f77f97031621ffd4ca94c1cbd2b5ba1..2c26e95e51ab9aacb147fad022c669a2a17e928b 100644 (file)
@@ -136,7 +136,7 @@ Design Details
 
 - Commit grafts and replace objects can change the shape of the commit
   history. The latter can also be enabled/disabled on the fly using
-  `--no-replace-objects`. This leads to difficultly storing both possible
+  `--no-replace-objects`. This leads to difficulty storing both possible
   interpretations of a commit id, especially when computing generation
   numbers. The commit-graph will not be read or written when
   replace-objects or grafts are present.
index 47c9b6183cfad0f3f8e60df2003cd60657a92b0d..b4a144e5f4758d30e523406596b85009336141b0 100644 (file)
@@ -63,7 +63,7 @@ improvements over the sequential code, but there was still too much lock
 contention. A `perf` profiling indicated that around 20% of the runtime
 during a local Linux clone (on an SSD) was spent in locking functions.
 For this reason this approach was rejected in favor of using multiple
-child processes, which led to better performance.
+child processes, which led to better performance.
 
 Multi-Process Solution
 ----------------------
@@ -126,7 +126,7 @@ Then, for each assigned item, each worker:
 
 * W5: Writes the result to the file descriptor opened at W2.
 
-* W6: Calls `fstat()` or lstat()` on the just-written path, and sends
+* W6: Calls `fstat()` or `lstat()` on the just-written path, and sends
   the result back to the main process, together with the end status of
   the operation and the item's identification number.
 
@@ -148,7 +148,7 @@ information, the main process handles the results in two steps:
 
 - First, it updates the in-memory index with the `lstat()` information
   sent by the workers. (This must be done first as this information
-  might me required in the following step.)
+  might be required in the following step.)
 
 - Then it writes the items which collided on disk (i.e. items marked
   with `PC_ITEM_COLLIDED`). More on this below.
@@ -185,7 +185,7 @@ quite straightforward: for each parallel-eligible entry, the main
 process must remove all files that prevent this entry from being written
 (before enqueueing it). This includes any non-directory file in the
 leading path of the entry. Later, when a worker gets assigned the entry,
-it looks again for the non-directories files and for an already existing
+it looks again for the non-directory files and for an already existing
 file at the entry's path. If any of these checks finds something, the
 worker knows that there was a path collision.
 
@@ -232,7 +232,7 @@ conversion and re-encoding, are eligible for parallel checkout.
 Ineligible entries are checked out by the classic sequential codepath
 *before* spawning workers.
 
-Note: submodules's files are also eligible for parallel checkout (as
+Note: submodules' files are also eligible for parallel checkout (as
 long as they don't fall into any of the excluding categories mentioned
 above). But since each submodule is checked out in its own child
 process, we don't mix the superproject's and the submodules' files in
index 92fcee2bfffff8c42a07f0dd4b87421abd94f2bb..cd948b00722cba5ae9f01b31f6a226f8d4497ea8 100644 (file)
@@ -3,7 +3,7 @@ Partial Clone Design Notes
 
 The "Partial Clone" feature is a performance optimization for Git that
 allows Git to function without having a complete copy of the repository.
-The goal of this work is to allow Git better handle extremely large
+The goal of this work is to allow Git to better handle extremely large
 repositories.
 
 During clone and fetch operations, Git downloads the complete contents
@@ -256,7 +256,7 @@ remote in a specific order.
 - Dynamic object fetching currently uses the existing pack protocol V0
   which means that each object is requested via fetch-pack.  The server
   will send a full set of info/refs when the connection is established.
-  If there are large number of refs, this may incur significant overhead.
+  If there are large number of refs, this may incur significant overhead.
 
 
 Future Work
@@ -265,7 +265,7 @@ Future Work
 - Improve the way to specify the order in which promisor remotes are
   tried.
 +
-For example this could allow to specify explicitly something like:
+For example this could allow specifying explicitly something like:
 "When fetching from this remote, I want to use these promisor remotes
 in this order, though, when pushing or fetching to that remote, I want
 to use those promisor remotes in that order."
@@ -322,7 +322,7 @@ Footnotes
 
 [a] expensive-to-modify list of missing objects:  Earlier in the design of
     partial clone we discussed the need for a single list of missing objects.
-    This would essentially be a sorted linear list of OIDs that the were
+    This would essentially be a sorted linear list of OIDs that were
     omitted by the server during a clone or subsequent fetches.
 
 This file would need to be loaded into memory on every object lookup.
index ceda4bbfda4d27c8138c79f207f0d2adadf8bf50..59bea66c0fc6ef704e0ba9e81809a8ad1c2e9058 100644 (file)
@@ -11,7 +11,7 @@ write out the next tree object to be committed.  The state is
 "virtual" in the sense that it does not necessarily have to, and
 often does not, match the files in the working tree.
 
-There are cases Git needs to examine the differences between the
+There are cases where Git needs to examine the differences between the
 virtual working tree state in the index and the files in the
 working tree.  The most obvious case is when the user asks `git
 diff` (or its low level implementation, `git diff-files`) or
@@ -165,9 +165,9 @@ Avoiding runtime penalty
 
 In order to avoid the above runtime penalty, post 1.4.2 Git used
 to have a code that made sure the index file
-got timestamp newer than the youngest files in the index when
-there are many young files with the same timestamp as the
-resulting index file would otherwise would have by waiting
+got timestamp newer than the youngest files in the index when
+there were many young files with the same timestamp as the
+resulting index file otherwise would have by waiting
 before finishing writing the index file out.
 
 I suspected that in practice the situation where many paths in the
@@ -190,7 +190,7 @@ In a large project where raciness avoidance cost really matters,
 however, the initial computation of all object names in the
 index takes more than one second, and the index file is written
 out after all that happens.  Therefore the timestamp of the
-index file will be more than one seconds later than the
+index file will be more than one second later than the
 youngest file in the working tree.  This means that in these
 cases there actually will not be any racily clean entry in
 the resulting index.
index 6a67cc4174f820931a25bbd40c83959237b2983c..dd0b37c4e34738038b0171038dba6b180739d433 100644 (file)
@@ -46,7 +46,7 @@ search lookup, and range scans.
 
 Storage in the file is organized into variable sized blocks. Prefix
 compression is used within a single block to reduce disk space. Block
-size and alignment is tunable by the writer.
+size and alignment are tunable by the writer.
 
 Performance
 ^^^^^^^^^^^
@@ -115,7 +115,7 @@ Varint encoding
 Varint encoding is identical to the ofs-delta encoding method used
 within pack files.
 
-Decoder works such as:
+Decoder works as follows:
 
 ....
 val = buf[ptr] & 0x7f
@@ -175,7 +175,7 @@ log_index*
 footer
 ....
 
-in a log-only file the first log block immediately follows the file
+In a log-only file, the first log block immediately follows the file
 header, without padding to block alignment.
 
 Block size
@@ -247,7 +247,7 @@ uint32( hash_id )
 ....
 
 The header is identical to `version_number=1`, with the 4-byte hash ID
-("sha1" for SHA1 and "s256" for SHA-256) append to the header.
+("sha1" for SHA1 and "s256" for SHA-256) appended to the header.
 
 For maximum backward compatibility, it is recommended to use version 1 when
 writing SHA1 reftables.
@@ -288,7 +288,7 @@ The 2-byte `restart_count` stores the number of entries in the
 `restart_count` to binary search between restarts before starting a
 linear scan.
 
-Exactly `restart_count` 3-byte `restart_offset` values precedes the
+Exactly `restart_count` 3-byte `restart_offset` values precede the
 `restart_count`. Offsets are relative to the start of the block and
 refer to the first byte of any `ref_record` whose name has not been
 prefix compressed. Entries in the `restart_offset` list must be sorted,
index 8ef664b0b9537ad3c8fc554e68448a69a3b7f439..47281420fc4a0c901d60b2854a8f0a6e8f70587a 100644 (file)
@@ -96,7 +96,13 @@ The value of this key is the name of the promisor remote.
 ==== `worktreeConfig`
 
 If set, by default "git config" reads from both "config" and
-"config.worktree" file from GIT_DIR in that order. In
+"config.worktree" files from GIT_DIR in that order. In
 multiple working directory mode, "config" file is shared while
 "config.worktree" is per-working directory (i.e., it's in
 GIT_COMMON_DIR/worktrees/<id>/config.worktree)
+
+==== `refStorage`
+
+Specifies the file format for the ref database. The valid values are
+`files` (loose references with a packed-refs file) and `reftable` (see
+Documentation/technical/reftable.txt).
index be58f1bee368941cd7f8050fdfc23c55e48e48fa..580f23360a27bf71581ce6d570a041eba62d075a 100644 (file)
@@ -60,7 +60,7 @@ By resolving this conflict, to leave line D, the user declares:
     what AB and AC wanted to do.
 
 As branch AC2 refers to the same commit as AC, the above implies that
-this is also compatible what AB and AC2 wanted to do.
+this is also compatible with what AB and AC2 wanted to do.
 
 By extension, this means that rerere should recognize that the above
 conflicts are the same.  To do this, the labels on the conflict
@@ -76,7 +76,7 @@ examples would both result in the following normalized conflict:
 Sorting hunks
 ~~~~~~~~~~~~~
 
-As before, lets imagine that a common ancestor had a file with line A
+As before, let's imagine that a common ancestor had a file with line A
 its early part, and line X in its late part.  And then four branches
 are forked that do these things:
 
@@ -145,7 +145,7 @@ Nested conflicts
 Nested conflicts are handled very similarly to "simple" conflicts.
 Similar to simple conflicts, the conflict is first normalized by
 stripping the labels from conflict markers, stripping the common ancestor
-version, and the sorting the conflict hunks, both for the outer and the
+version, and sorting the conflict hunks, both for the outer and the
 inner conflict.  This is done recursively, so any number of nested
 conflicts can be handled.
 
diff --git a/Documentation/technical/unit-tests.txt b/Documentation/technical/unit-tests.txt
new file mode 100644 (file)
index 0000000..206037f
--- /dev/null
@@ -0,0 +1,240 @@
+= Unit Testing
+
+In our current testing environment, we spend a significant amount of effort
+crafting end-to-end tests for error conditions that could easily be captured by
+unit tests (or we simply forgo some hard-to-setup and rare error conditions).
+Unit tests additionally provide stability to the codebase and can simplify
+debugging through isolation. Writing unit tests in pure C, rather than with our
+current shell/test-tool helper setup, simplifies test setup, simplifies passing
+data around (no shell-isms required), and reduces testing runtime by not
+spawning a separate process for every test invocation.
+
+We believe that a large body of unit tests, living alongside the existing test
+suite, will improve code quality for the Git project.
+
+== Definitions
+
+For the purposes of this document, we'll use *test framework* to refer to
+projects that support writing test cases and running tests within the context
+of a single executable. *Test harness* will refer to projects that manage
+running multiple executables (each of which may contain multiple test cases) and
+aggregating their results.
+
+In reality, these terms are not strictly defined, and many of the projects
+discussed below contain features from both categories.
+
+For now, we will evaluate projects solely on their framework features. Since we
+are relying on having TAP output (see below), we can assume that any framework
+can be made to work with a harness that we can choose later.
+
+
+== Summary
+
+We believe the best way forward is to implement a custom TAP framework for the
+Git project. We use a version of the framework originally proposed in
+https://lore.kernel.org/git/c902a166-98ce-afba-93f2-ea6027557176@gmail.com/[1].
+
+See the <<framework-selection,Framework Selection>> section below for the
+rationale behind this decision.
+
+
+== Choosing a test harness
+
+During upstream discussion, it was occasionally noted that `prove` provides many
+convenient features, such as scheduling slower tests first, or re-running
+previously failed tests.
+
+While we already support the use of `prove` as a test harness for the shell
+tests, it is not strictly required. The t/Makefile allows running shell tests
+directly (though with interleaved output if parallelism is enabled). Git
+developers who wish to use `prove` as a more advanced harness can do so by
+setting DEFAULT_TEST_TARGET=prove in their config.mak.
+
+We will follow a similar approach for unit tests: by default the test
+executables will be run directly from the t/Makefile, but `prove` can be
+configured with DEFAULT_UNIT_TEST_TARGET=prove.
+
+
+[[framework-selection]]
+== Framework selection
+
+There are a variety of features we can use to rank the candidate frameworks, and
+those features have different priorities:
+
+* Critical features: we probably won't consider a framework without these
+** Can we legally / easily use the project?
+*** <<license,License>>
+*** <<vendorable-or-ubiquitous,Vendorable or ubiquitous>>
+*** <<maintainable-extensible,Maintainable / extensible>>
+*** <<major-platform-support,Major platform support>>
+** Does the project support our bare-minimum needs?
+*** <<tap-support,TAP support>>
+*** <<diagnostic-output,Diagnostic output>>
+*** <<runtime-skippable-tests,Runtime-skippable tests>>
+* Nice-to-have features:
+** <<parallel-execution,Parallel execution>>
+** <<mock-support,Mock support>>
+** <<signal-error-handling,Signal & error-handling>>
+* Tie-breaker stats
+** <<project-kloc,Project KLOC>>
+** <<adoption,Adoption>>
+
+[[license]]
+=== License
+
+We must be able to legally use the framework in connection with Git. As Git is
+licensed only under GPLv2, we must eliminate any LGPLv3, GPLv3, or Apache 2.0
+projects.
+
+[[vendorable-or-ubiquitous]]
+=== Vendorable or ubiquitous
+
+We want to avoid forcing Git developers to install new tools just to run unit
+tests. Any prospective frameworks and harnesses must either be vendorable
+(meaning, we can copy their source directly into Git's repository), or so
+ubiquitous that it is reasonable to expect that most developers will have the
+tools installed already.
+
+[[maintainable-extensible]]
+=== Maintainable / extensible
+
+It is unlikely that any pre-existing project perfectly fits our needs, so any
+project we select will need to be actively maintained and open to accepting
+changes. Alternatively, assuming we are vendoring the source into our repo, it
+must be simple enough that Git developers can feel comfortable making changes as
+needed to our version.
+
+In the comparison table below, "True" means that the framework seems to have
+active developers, that it is simple enough that Git developers can make changes
+to it, and that the project seems open to accepting external contributions (or
+that it is vendorable). "Partial" means that at least one of the above
+conditions holds.
+
+[[major-platform-support]]
+=== Major platform support
+
+At a bare minimum, unit-testing must work on Linux, MacOS, and Windows.
+
+In the comparison table below, "True" means that it works on all three major
+platforms with no issues. "Partial" means that there may be annoyances on one or
+more platforms, but it is still usable in principle.
+
+[[tap-support]]
+=== TAP support
+
+The https://testanything.org/[Test Anything Protocol] is a text-based interface
+that allows tests to communicate with a test harness. It is already used by
+Git's integration test suite. Supporting TAP output is a mandatory feature for
+any prospective test framework.
+
+In the comparison table below, "True" means this is natively supported.
+"Partial" means TAP output must be generated by post-processing the native
+output.
+
+Frameworks that do not have at least Partial support will not be evaluated
+further.
+
+[[diagnostic-output]]
+=== Diagnostic output
+
+When a test case fails, the framework must generate enough diagnostic output to
+help developers find the appropriate test case in source code in order to debug
+the failure.
+
+[[runtime-skippable-tests]]
+=== Runtime-skippable tests
+
+Test authors may wish to skip certain test cases based on runtime circumstances,
+so the framework should support this.
+
+[[parallel-execution]]
+=== Parallel execution
+
+Ideally, we will build up a significant collection of unit test cases, most
+likely split across multiple executables. It will be necessary to run these
+tests in parallel to enable fast develop-test-debug cycles.
+
+In the comparison table below, "True" means that individual test cases within a
+single test executable can be run in parallel. We assume that executable-level
+parallelism can be handled by the test harness.
+
+[[mock-support]]
+=== Mock support
+
+Unit test authors may wish to test code that interacts with objects that may be
+inconvenient to handle in a test (e.g. interacting with a network service).
+Mocking allows test authors to provide a fake implementation of these objects
+for more convenient tests.
+
+[[signal-error-handling]]
+=== Signal & error handling
+
+The test framework should fail gracefully when test cases are themselves buggy
+or when they are interrupted by signals during runtime.
+
+[[project-kloc]]
+=== Project KLOC
+
+The size of the project, in thousands of lines of code as measured by
+https://dwheeler.com/sloccount/[sloccount] (rounded up to the next multiple of
+1,000). As a tie-breaker, we probably prefer a project with fewer LOC.
+
+[[adoption]]
+=== Adoption
+
+As a tie-breaker, we prefer a more widely-used project. We use the number of
+GitHub / GitLab stars to estimate this.
+
+
+=== Comparison
+
+:true: [lime-background]#True#
+:false: [red-background]#False#
+:partial: [yellow-background]#Partial#
+
+:gpl: [lime-background]#GPL v2#
+:isc: [lime-background]#ISC#
+:mit: [lime-background]#MIT#
+:expat: [lime-background]#Expat#
+:lgpl: [lime-background]#LGPL v2.1#
+
+:custom-impl: https://lore.kernel.org/git/c902a166-98ce-afba-93f2-ea6027557176@gmail.com/[Custom Git impl.]
+:greatest: https://github.com/silentbicycle/greatest[Greatest]
+:criterion: https://github.com/Snaipe/Criterion[Criterion]
+:c-tap: https://github.com/rra/c-tap-harness/[C TAP]
+:check: https://libcheck.github.io/check/[Check]
+
+[format="csv",options="header",width="33%",subs="specialcharacters,attributes,quotes,macros"]
+|=====
+Framework,"<<license,License>>","<<vendorable-or-ubiquitous,Vendorable or ubiquitous>>","<<maintainable-extensible,Maintainable / extensible>>","<<major-platform-support,Major platform support>>","<<tap-support,TAP support>>","<<diagnostic-output,Diagnostic output>>","<<runtime--skippable-tests,Runtime- skippable tests>>","<<parallel-execution,Parallel execution>>","<<mock-support,Mock support>>","<<signal-error-handling,Signal & error handling>>","<<project-kloc,Project KLOC>>","<<adoption,Adoption>>"
+{custom-impl},{gpl},{true},{true},{true},{true},{true},{true},{false},{false},{false},1,0
+{greatest},{isc},{true},{partial},{true},{partial},{true},{true},{false},{false},{false},3,1400
+{criterion},{mit},{false},{partial},{true},{true},{true},{true},{true},{false},{true},19,1800
+{c-tap},{expat},{true},{partial},{partial},{true},{false},{true},{false},{false},{false},4,33
+{check},{lgpl},{false},{partial},{true},{true},{true},{false},{false},{false},{true},17,973
+|=====
+
+=== Additional framework candidates
+
+Several suggested frameworks have been eliminated from consideration:
+
+* Incompatible licenses:
+** https://github.com/zorgnax/libtap[libtap] (LGPL v3)
+** https://cmocka.org/[cmocka] (Apache 2.0)
+* Missing source: https://www.kindahl.net/mytap/doc/index.html[MyTap]
+* No TAP support:
+** https://nemequ.github.io/munit/[µnit]
+** https://github.com/google/cmockery[cmockery]
+** https://github.com/lpabon/cmockery2[cmockery2]
+** https://github.com/ThrowTheSwitch/Unity[Unity]
+** https://github.com/siu/minunit[minunit]
+** https://cunit.sourceforge.net/[CUnit]
+
+
+== Milestones
+
+* Add useful tests of library-like code
+* Integrate with
+  https://lore.kernel.org/git/20230502211454.1673000-1-calvinwan@google.com/[stdlib
+  work]
+* Run alongside regular `make test` target
index 3985b6d3c2956f7d0b2c5d16d262a5203afe680e..06f19533134f9d8018b1b1ae924370660ec36d73 100644 (file)
@@ -5,7 +5,7 @@
 * `<absolute-pathname>` - Writes to the file in append mode. If the target
 already exists and is a directory, the traces will be written to files (one
 per process) underneath the given directory.
-* `af_unix:[<socket_type>:]<absolute-pathname>` - Write to a
+* `af_unix:[<socket-type>:]<absolute-pathname>` - Write to a
 Unix DomainSocket (on platforms that support them).  Socket
 type can be either `stream` or `dgram`; if omitted Git will
 try both.
index ae8c2db427bb6a5671b6cf598574e8392c715d97..bf17012241536ceb1c407fea04b7b1a84441923f 100644 (file)
@@ -33,7 +33,7 @@ config file would appear like this:
 ------------
 
 The `<pushurl>` is used for pushes only. It is optional and defaults
-to `<URL>`. Pushing to a remote affects all defined pushurls or to all
+to `<URL>`. Pushing to a remote affects all defined pushurls or all
 defined urls if no pushurls are defined. Fetch, however, will only
 fetch from the first defined url if multiple urls are defined.
 
@@ -48,7 +48,7 @@ provide a refspec on the command line.  This file should have the
 following format:
 
 ------------
-       URL: one of the above URL format
+       URL: one of the above URL formats
        Push: <refspec>
        Pull: <refspec>
 
index 1c229d758152b6377e23125967e2041a5fd5be5a..0b9e0c4302d850a7a38044d03bd1146764bc83ca 100644 (file)
@@ -6,9 +6,9 @@ address of the remote server, and the path to the repository.
 Depending on the transport protocol, some of this information may be
 absent.
 
-Git supports ssh, git, http, and https protocols (in addition, ftp,
+Git supports ssh, git, http, and https protocols (in addition, ftp
 and ftps can be used for fetching, but this is inefficient and
-deprecated; do not use it).
+deprecated; do not use them).
 
 The native transport (i.e. git:// URL) does no authentication and
 should be used with caution on unsecured networks.
@@ -44,26 +44,26 @@ syntaxes may be used:
 
 ifndef::git-clone[]
 These two syntaxes are mostly equivalent, except when cloning, when
-the former implies --local option. See linkgit:git-clone[1] for
+the former implies `--local` option. See linkgit:git-clone[1] for
 details.
 endif::git-clone[]
 
 ifdef::git-clone[]
 These two syntaxes are mostly equivalent, except the former implies
---local option.
+`--local` option.
 endif::git-clone[]
 
-'git clone', 'git fetch' and 'git pull', but not 'git push', will also
+`git clone`, `git fetch` and `git pull`, but not `git push`, will also
 accept a suitable bundle file. See linkgit:git-bundle[1].
 
 When Git doesn't know how to handle a certain transport protocol, it
-attempts to use the 'remote-<transport>' remote helper, if one
+attempts to use the `remote-<transport>` remote helper, if one
 exists. To explicitly request a remote helper, the following syntax
 may be used:
 
-- <transport>::<address>
+- _<transport>_::_<address>_
 
-where <address> may be a path, a server and path, or an arbitrary
+where _<address>_ may be a path, a server and path, or an arbitrary
 URL-like string recognized by the specific remote helper being
 invoked. See linkgit:gitremote-helpers[7] for details.
 
@@ -73,8 +73,8 @@ use will be rewritten into URLs that work), you can create a
 configuration section of the form:
 
 ------------
-       [url "<actual url base>"]
-               insteadOf = <other url base>
+       [url "<actual-url-base>"]
+               insteadOf = <other-url-base>
 ------------
 
 For example, with this:
@@ -92,8 +92,8 @@ If you want to rewrite URLs for push only, you can create a
 configuration section of the form:
 
 ------------
-       [url "<actual url base>"]
-               pushInsteadOf = <other url base>
+       [url "<actual-url-base>"]
+               pushInsteadOf = <other-url-base>
 ------------
 
 For example, with this:
index 4281396093d7c92d22ccf2a8f7dd7c98400445e2..90a4189358300b0b594cdb18a90ce3b25d03de44 100644 (file)
@@ -1122,7 +1122,7 @@ choosing "Stage Hunk For Commit").
 === Creating good commit messages
 
 Though not required, it's a good idea to begin the commit message
-with a single short (less than 50 character) line summarizing the
+with a single short (no more than 50 characters) line summarizing the
 change, followed by a blank line and then a more thorough
 description.  The text up to the first blank line in a commit
 message is treated as the commit title, and that title is used
@@ -1344,7 +1344,7 @@ $ git diff --theirs file.txt      # same as the above.
 -------------------------------------------------
 
 When using the 'ort' merge strategy (the default), before updating the working
-tree with the result of the merge, Git writes a special ref named AUTO_MERGE
+tree with the result of the merge, Git writes a ref named AUTO_MERGE
 reflecting the state of the tree it is about to write. Conflicted paths with
 textual conflicts that could not be automatically merged are written to this
 tree with conflict markers, just as in the working tree. AUTO_MERGE can thus be
@@ -4093,15 +4093,46 @@ that not only specifies their type, but also provides size information
 about the data in the object.  It's worth noting that the SHA-1 hash
 that is used to name the object is the hash of the original data
 plus this header, so `sha1sum` 'file' does not match the object name
-for 'file'.
+for 'file' (the earliest versions of Git hashed slightly differently
+but the conclusion is still the same).
+
+The following is a short example that demonstrates how these hashes
+can be generated manually:
+
+Let's assume a small text file with some simple content:
+
+-------------------------------------------------
+$ echo "Hello world" >hello.txt
+-------------------------------------------------
+
+We can now manually generate the hash Git would use for this file:
+
+- The object we want the hash for is of type "blob" and its size is
+  12 bytes.
+
+- Prepend the object header to the file content and feed this to
+  `sha1sum`:
+
+-------------------------------------------------
+$ { printf "blob 12\0"; cat hello.txt; } | sha1sum
+802992c4220de19a90767f3000a79a31b98d0df7  -
+-------------------------------------------------
+
+This manually constructed hash can be verified using `git hash-object`
+which of course hides the addition of the header:
+
+-------------------------------------------------
+$ git hash-object hello.txt
+802992c4220de19a90767f3000a79a31b98d0df7
+-------------------------------------------------
 
 As a result, the general consistency of an object can always be tested
 independently of the contents or the type of the object: all objects can
 be validated by verifying that (a) their hashes match the content of the
 file and (b) the object successfully inflates to a stream of bytes that
 forms a sequence of
-`<ascii type without space> + <space> + <ascii decimal size> +
-<byte\0> + <binary object data>`.
+`<ascii-type-without-space> + <space> + <ascii-decimal-size> +
+<byte\0> + <binary-object-data>`.
 
 The structured objects can further have their structure and
 connectivity to other objects verified. This is generally done with
@@ -4123,7 +4154,8 @@ $ git switch --detach e83c5163
 ----------------------------------------------------
 
 The initial revision lays the foundation for almost everything Git has
-today, but is small enough to read in one sitting.
+today (even though details may differ in a few places), but is small
+enough to read in one sitting.
 
 Note that terminology has changed since that revision.  For example, the
 README in that revision uses the word "changeset" to describe what we
index 2c8dae398f661b349ebec3734fba135a81cbd67b..df788c764b7bb4cd61a1b2a6da277bfce82cdfca 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.42.0
+DEF_VER=v2.44.GIT
 
 LF='
 '
@@ -11,7 +11,7 @@ LF='
 if test -f version
 then
        VN=$(cat version) || VN="$DEF_VER"
-elif test -d ${GIT_DIR:-.git} -o -f .git &&
+elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
        VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
        case "$VN" in
        *$LF*) (exit 1) ;;
diff --git a/INSTALL b/INSTALL
index 4b422888828d0e99b7398f9e55055525330cf597..c6fb240c91eb9044f1baea43ae29c2991447bbc6 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -119,12 +119,12 @@ Issues of note:
        - A POSIX-compliant shell is required to run some scripts needed
          for everyday use (e.g. "bisect", "request-pull").
 
-       - "Perl" version 5.8 or later is needed to use some of the
+       - "Perl" version 5.8.1 or later is needed to use some of the
          features (e.g. sending patches using "git send-email",
          interacting with svn repositories with "git svn").  If you can
          live without these, use NO_PERL.  Note that recent releases of
          Redhat/Fedora are reported to ship Perl binary package with some
-         core modules stripped away (see http://lwn.net/Articles/477234/),
+         core modules stripped away (see https://lwn.net/Articles/477234/),
          so you might need to install additional packages other than Perl
          itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain,
          Net::SMTP, and Time::HiRes.
index 3e4444fb9ab2dedf5195bcee5366d798ab22e2a3..e9556789087f9fedde4ffeb51d3c52864fd45441 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -186,7 +186,7 @@ include shared.mak
 # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
 #
 # Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
-# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
+# as the compiler can crash (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
 #
 # Define USE_NSEC below if you want git to care about sub-second file mtimes
 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
@@ -682,6 +682,9 @@ TEST_BUILTINS_OBJS =
 TEST_OBJS =
 TEST_PROGRAMS_NEED_X =
 THIRD_PARTY_SOURCES =
+UNIT_TEST_PROGRAMS =
+UNIT_TEST_DIR = t/unit-tests
+UNIT_TEST_BIN = $(UNIT_TEST_DIR)/bin
 
 # Having this variable in your environment would break pipelines because
 # you cause "cd" to echo its destination to stdout.  It can also take
@@ -749,7 +752,12 @@ SCRIPTS = $(SCRIPT_SH_GEN) \
 
 ETAGS_TARGET = TAGS
 
+# If you add a new fuzzer, please also make sure to run it in
+# ci/run-build-and-minimal-fuzzers.sh so that we make sure it still links and
+# runs in the future.
+FUZZ_OBJS += oss-fuzz/dummy-cmd-main.o
 FUZZ_OBJS += oss-fuzz/fuzz-commit-graph.o
+FUZZ_OBJS += oss-fuzz/fuzz-date.o
 FUZZ_OBJS += oss-fuzz/fuzz-pack-headers.o
 FUZZ_OBJS += oss-fuzz/fuzz-pack-idx.o
 .PHONY: fuzz-objs
@@ -758,7 +766,7 @@ fuzz-objs: $(FUZZ_OBJS)
 # Always build fuzz objects even if not testing, to prevent bit-rot.
 all:: $(FUZZ_OBJS)
 
-FUZZ_PROGRAMS += $(patsubst %.o,%,$(FUZZ_OBJS))
+FUZZ_PROGRAMS += $(patsubst %.o,%,$(filter-out %dummy-cmd-main.o,$(FUZZ_OBJS)))
 
 # Empty...
 EXTRA_PROGRAMS =
@@ -788,7 +796,6 @@ TEST_BUILTINS_OBJS += test-chmtime.o
 TEST_BUILTINS_OBJS += test-config.o
 TEST_BUILTINS_OBJS += test-crontab.o
 TEST_BUILTINS_OBJS += test-csprng.o
-TEST_BUILTINS_OBJS += test-ctype.o
 TEST_BUILTINS_OBJS += test-date.o
 TEST_BUILTINS_OBJS += test-delete-gpgsig.o
 TEST_BUILTINS_OBJS += test-delta.o
@@ -800,7 +807,7 @@ TEST_BUILTINS_OBJS += test-dump-split-index.o
 TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
 TEST_BUILTINS_OBJS += test-env-helper.o
 TEST_BUILTINS_OBJS += test-example-decorate.o
-TEST_BUILTINS_OBJS += test-fast-rebase.o
+TEST_BUILTINS_OBJS += test-find-pack.o
 TEST_BUILTINS_OBJS += test-fsmonitor-client.o
 TEST_BUILTINS_OBJS += test-genrandom.o
 TEST_BUILTINS_OBJS += test-genzeros.o
@@ -809,7 +816,6 @@ TEST_BUILTINS_OBJS += test-hash-speed.o
 TEST_BUILTINS_OBJS += test-hash.o
 TEST_BUILTINS_OBJS += test-hashmap.o
 TEST_BUILTINS_OBJS += test-hexdump.o
-TEST_BUILTINS_OBJS += test-index-version.o
 TEST_BUILTINS_OBJS += test-json-writer.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-match-trees.o
@@ -826,7 +832,6 @@ TEST_BUILTINS_OBJS += test-partial-clone.o
 TEST_BUILTINS_OBJS += test-path-utils.o
 TEST_BUILTINS_OBJS += test-pcre2-config.o
 TEST_BUILTINS_OBJS += test-pkt-line.o
-TEST_BUILTINS_OBJS += test-prio-queue.o
 TEST_BUILTINS_OBJS += test-proc-receive.o
 TEST_BUILTINS_OBJS += test-progress.o
 TEST_BUILTINS_OBJS += test-reach.o
@@ -853,6 +858,7 @@ TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
 TEST_BUILTINS_OBJS += test-submodule.o
 TEST_BUILTINS_OBJS += test-subprocess.o
 TEST_BUILTINS_OBJS += test-trace2.o
+TEST_BUILTINS_OBJS += test-truncate.o
 TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
 TEST_BUILTINS_OBJS += test-userdiff.o
 TEST_BUILTINS_OBJS += test-wildmatch.o
@@ -1041,6 +1047,7 @@ LIB_OBJS += hash-lookup.o
 LIB_OBJS += hashmap.o
 LIB_OBJS += help.o
 LIB_OBJS += hex.o
+LIB_OBJS += hex-ll.o
 LIB_OBJS += hook.o
 LIB_OBJS += ident.o
 LIB_OBJS += json-writer.o
@@ -1093,6 +1100,7 @@ LIB_OBJS += pack-write.o
 LIB_OBJS += packfile.o
 LIB_OBJS += pager.o
 LIB_OBJS += parallel-checkout.o
+LIB_OBJS += parse.o
 LIB_OBJS += parse-options-cb.o
 LIB_OBJS += parse-options.o
 LIB_OBJS += patch-delta.o
@@ -1121,6 +1129,7 @@ LIB_OBJS += reflog.o
 LIB_OBJS += refs.o
 LIB_OBJS += refs/debug.o
 LIB_OBJS += refs/files-backend.o
+LIB_OBJS += refs/reftable-backend.o
 LIB_OBJS += refs/iterator.o
 LIB_OBJS += refs/packed-backend.o
 LIB_OBJS += refs/ref-cache.o
@@ -1290,6 +1299,7 @@ BUILTIN_OBJS += builtin/remote-fd.o
 BUILTIN_OBJS += builtin/remote.o
 BUILTIN_OBJS += builtin/repack.o
 BUILTIN_OBJS += builtin/replace.o
+BUILTIN_OBJS += builtin/replay.o
 BUILTIN_OBJS += builtin/rerere.o
 BUILTIN_OBJS += builtin/reset.o
 BUILTIN_OBJS += builtin/rev-list.o
@@ -1335,6 +1345,15 @@ THIRD_PARTY_SOURCES += compat/regex/%
 THIRD_PARTY_SOURCES += sha1collisiondetection/%
 THIRD_PARTY_SOURCES += sha1dc/%
 
+UNIT_TEST_PROGRAMS += t-basic
+UNIT_TEST_PROGRAMS += t-mem-pool
+UNIT_TEST_PROGRAMS += t-strbuf
+UNIT_TEST_PROGRAMS += t-ctype
+UNIT_TEST_PROGRAMS += t-prio-queue
+UNIT_TEST_PROGS = $(patsubst %,$(UNIT_TEST_BIN)/%$X,$(UNIT_TEST_PROGRAMS))
+UNIT_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(UNIT_TEST_PROGRAMS))
+UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o
+
 # xdiff and reftable libs may in turn depend on what is in libgit.a
 GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
 EXTLIBS =
@@ -1575,7 +1594,7 @@ endif
 
 ifdef LIBPCREDIR
        BASIC_CFLAGS += -I$(LIBPCREDIR)/include
-       EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
+       EXTLIBS += $(call libpath_template,$(LIBPCREDIR)/$(lib))
 endif
 
 ifdef HAVE_ALLOCA_H
@@ -1595,7 +1614,7 @@ else
        ifdef CURLDIR
                # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
                CURL_CFLAGS = -I$(CURLDIR)/include
-               CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
+               CURL_LIBCURL = $(call libpath_template,$(CURLDIR)/$(lib))
        else
                CURL_CFLAGS =
                CURL_LIBCURL =
@@ -1631,7 +1650,7 @@ else
        ifndef NO_EXPAT
                ifdef EXPATDIR
                        BASIC_CFLAGS += -I$(EXPATDIR)/include
-                       EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
+                       EXPAT_LIBEXPAT = $(call libpath_template,$(EXPATDIR)/$(lib)) -lexpat
                else
                        EXPAT_LIBEXPAT = -lexpat
                endif
@@ -1644,7 +1663,7 @@ IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
 
 ifdef ZLIB_PATH
        BASIC_CFLAGS += -I$(ZLIB_PATH)/include
-       EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
+       EXTLIBS += $(call libpath_template,$(ZLIB_PATH)/$(lib))
 endif
 EXTLIBS += -lz
 
@@ -1652,7 +1671,7 @@ ifndef NO_OPENSSL
        OPENSSL_LIBSSL = -lssl
        ifdef OPENSSLDIR
                BASIC_CFLAGS += -I$(OPENSSLDIR)/include
-               OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
+               OPENSSL_LINK = $(call libpath_template,$(OPENSSLDIR)/$(lib))
        else
                OPENSSL_LINK =
        endif
@@ -1679,7 +1698,7 @@ ifndef NO_ICONV
        ifdef NEEDS_LIBICONV
                ifdef ICONVDIR
                        BASIC_CFLAGS += -I$(ICONVDIR)/include
-                       ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
+                       ICONV_LINK = $(call libpath_template,$(ICONVDIR)/$(lib))
                else
                        ICONV_LINK =
                endif
@@ -2342,7 +2361,7 @@ profile-fast: profile-clean
 
 all:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
 ifneq (,$X)
-       $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
+       $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_COMMANDS_TO_INSTALL) $(OTHER_PROGRAMS))), if test ! -d '$p' && test ! '$p' -ef '$p$X'; then $(RM) '$p'; fi;)
 endif
 
 all::
@@ -2676,6 +2695,7 @@ OBJECTS += $(TEST_OBJS)
 OBJECTS += $(XDIFF_OBJS)
 OBJECTS += $(FUZZ_OBJS)
 OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
+OBJECTS += $(UNIT_TEST_OBJS)
 
 ifndef NO_CURL
        OBJECTS += http.o http-walker.o remote-curl.o
@@ -2723,7 +2743,7 @@ $(OBJECTS): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
 
 ifdef USE_COMPUTED_HEADER_DEPENDENCIES
 # Take advantage of gcc's on-the-fly dependency generation
-# See <http://gcc.gnu.org/gcc-3.0/features.html>.
+# See <https://gcc.gnu.org/gcc-3.0/features.html>.
 dep_files_present := $(wildcard $(dep_files))
 ifneq ($(dep_files_present),)
 include $(dep_files_present)
@@ -3178,7 +3198,7 @@ endif
 
 test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
 
-all:: $(TEST_PROGRAMS) $(test_bindir_programs)
+all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS)
 
 bin-wrappers/%: wrap-for-bin.sh
        $(call mkdir_p_parent_template)
@@ -3604,12 +3624,12 @@ rpm::
 .PHONY: rpm
 
 ifneq ($(INCLUDE_DLLS_IN_ARTIFACTS),)
-OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll)
+OTHER_PROGRAMS += $(shell echo *.dll t/helper/*.dll t/unit-tests/bin/*.dll)
 endif
 
 artifacts-tar:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) \
                GIT-BUILD-OPTIONS $(TEST_PROGRAMS) $(test_bindir_programs) \
-               $(MOFILES)
+               $(UNIT_TEST_PROGS) $(MOFILES)
        $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) \
                SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
        test -n "$(ARTIFACTS_DIRECTORY)"
@@ -3664,7 +3684,7 @@ cocciclean:
        $(RM) contrib/coccinelle/*.cocci.patch
 
 clean: profile-clean coverage-clean cocciclean
-       $(RM) -r .build
+       $(RM) -r .build $(UNIT_TEST_BIN)
        $(RM) po/git.pot po/git-core.pot
        $(RM) git.res
        $(RM) $(OBJECTS)
@@ -3838,15 +3858,26 @@ cover_db_html: cover_db
 #
 # make CC=clang CXX=clang++ \
 #      CFLAGS="-fsanitize=fuzzer-no-link,address" \
-#      LIB_FUZZING_ENGINE="-fsanitize=fuzzer" \
+#      LIB_FUZZING_ENGINE="-fsanitize=fuzzer,address" \
 #      fuzz-all
 #
-FUZZ_CXXFLAGS ?= $(CFLAGS)
+FUZZ_CXXFLAGS ?= $(ALL_CFLAGS)
 
 .PHONY: fuzz-all
 
-$(FUZZ_PROGRAMS): all
-       $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
-               $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
+$(FUZZ_PROGRAMS): %: %.o oss-fuzz/dummy-cmd-main.o $(GITLIBS) GIT-LDFLAGS
+       $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) -o $@ $(ALL_LDFLAGS) \
+               -Wl,--allow-multiple-definition \
+               $(filter %.o,$^) $(filter %.a,$^) $(LIBS) $(LIB_FUZZING_ENGINE)
 
 fuzz-all: $(FUZZ_PROGRAMS)
+
+$(UNIT_TEST_PROGS): $(UNIT_TEST_BIN)/%$X: $(UNIT_TEST_DIR)/%.o $(UNIT_TEST_DIR)/test-lib.o $(GITLIBS) GIT-LDFLAGS
+       $(call mkdir_p_parent_template)
+       $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+               $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
+
+.PHONY: build-unit-tests unit-tests
+build-unit-tests: $(UNIT_TEST_PROGS)
+unit-tests: $(UNIT_TEST_PROGS)
+       $(MAKE) -C t/ unit-tests
index 7ce4f05bae8120d9fa258e854a8669f6ea9cb7b1..665ce5f5a83647619fba9157fa9b0141ae8b228b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -39,10 +39,10 @@ Those wishing to help with error message, usage and informational message
 string translations (localization l10) should see [po/README.md][]
 (a `po` file is a Portable Object file that holds the translations).
 
-To subscribe to the list, send an email with just "subscribe git" in
-the body to majordomo@vger.kernel.org (not the Git list). The mailing
+To subscribe to the list, send an email to <git+subscribe@vger.kernel.org>
+(see https://subspace.kernel.org/subscribing.html for details). The mailing
 list archives are available at <https://lore.kernel.org/git/>,
-<http://marc.info/?l=git> and other archival sites.
+<https://marc.info/?l=git> and other archival sites.
 
 Issues which are security relevant should be disclosed privately to
 the Git Security mailing list <git-security@googlegroups.com>.
index 0527f30c2d8ff1c8bda66ddbddff0ff436ad0813..ae702771094d287a5dd6b4e183de5d80f46c2686 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.42.0.txt
\ No newline at end of file
+Documentation/RelNotes/2.45.0.txt
\ No newline at end of file
index add9a1ad4364f92833256d5f53dbb3bc85b43ede..6bf87e7ae71b06ea59d42d238c6242a66fdec0b5 100644 (file)
@@ -569,7 +569,7 @@ static int get_modified_files(struct repository *r,
                        copy_pathspec(&rev.prune_data, ps);
 
                if (s.mode == FROM_INDEX)
-                       run_diff_index(&rev, 1);
+                       run_diff_index(&rev, DIFF_INDEX_CACHED);
                else {
                        rev.diffopt.flags.ignore_dirty_submodules = 1;
                        run_diff_files(&rev, 0);
@@ -1021,9 +1021,9 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
        return res;
 }
 
-static int run_help(struct add_i_state *s, const struct pathspec *unused_ps,
-                   struct prefix_item_list *unused_files,
-                   struct list_and_choose_options *unused_opts)
+static int run_help(struct add_i_state *s, const struct pathspec *ps UNUSED,
+                   struct prefix_item_list *files UNUSED,
+                   struct list_and_choose_options *opts UNUSED)
 {
        color_fprintf_ln(stdout, s->help_color, "status        - %s",
                         _("show paths with changes"));
@@ -1074,7 +1074,7 @@ struct print_command_item_data {
        const char *color, *reset;
 };
 
-static void print_command_item(int i, int selected,
+static void print_command_item(int i, int selected UNUSED,
                               struct string_list_item *item,
                               void *print_command_item_data)
 {
index bfe19876cd50c5aca2e465d9334c49e65a1972fc..68f525b35cfe650ebf440a1d879a761d55aa02e6 100644 (file)
@@ -12,7 +12,6 @@
 #include "strvec.h"
 #include "pathspec.h"
 #include "color.h"
-#include "diff.h"
 #include "compat/terminal.h"
 #include "prompt.h"
 
@@ -1730,14 +1729,6 @@ int run_add_p(struct repository *r, enum add_p_mode mode,
        if (mode == ADD_P_STASH)
                s.mode = &patch_mode_stash;
        else if (mode == ADD_P_RESET) {
-               /*
-                * NEEDSWORK: Instead of comparing to the literal "HEAD",
-                * compare the commit objects instead so that other ways of
-                * saying the same thing (such as "@") are also handled
-                * appropriately.
-                *
-                * This applies to the cases below too.
-                */
                if (!revision || !strcmp(revision, "HEAD"))
                        s.mode = &patch_mode_reset_head;
                else
index 50c79443ba749fc56437806c21a20755c1988714..b0e05506871b9c402b75ad7ba52c47776797611d 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -33,52 +33,58 @@ static const char *advise_get_color(enum color_advice ix)
        return "";
 }
 
+enum advice_level {
+       ADVICE_LEVEL_NONE = 0,
+       ADVICE_LEVEL_DISABLED,
+       ADVICE_LEVEL_ENABLED,
+};
+
 static struct {
        const char *key;
-       int enabled;
+       enum advice_level level;
 } advice_setting[] = {
-       [ADVICE_ADD_EMBEDDED_REPO]                      = { "addEmbeddedRepo", 1 },
-       [ADVICE_ADD_EMPTY_PATHSPEC]                     = { "addEmptyPathspec", 1 },
-       [ADVICE_ADD_IGNORED_FILE]                       = { "addIgnoredFile", 1 },
-       [ADVICE_AM_WORK_DIR]                            = { "amWorkDir", 1 },
-       [ADVICE_AMBIGUOUS_FETCH_REFSPEC]                = { "ambiguousFetchRefspec", 1 },
-       [ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME]  = { "checkoutAmbiguousRemoteBranchName", 1 },
-       [ADVICE_COMMIT_BEFORE_MERGE]                    = { "commitBeforeMerge", 1 },
-       [ADVICE_DETACHED_HEAD]                          = { "detachedHead", 1 },
-       [ADVICE_SUGGEST_DETACHING_HEAD]                 = { "suggestDetachingHead", 1 },
-       [ADVICE_DIVERGING]                              = { "diverging", 1 },
-       [ADVICE_FETCH_SHOW_FORCED_UPDATES]              = { "fetchShowForcedUpdates", 1 },
-       [ADVICE_GRAFT_FILE_DEPRECATED]                  = { "graftFileDeprecated", 1 },
-       [ADVICE_IGNORED_HOOK]                           = { "ignoredHook", 1 },
-       [ADVICE_IMPLICIT_IDENTITY]                      = { "implicitIdentity", 1 },
-       [ADVICE_NESTED_TAG]                             = { "nestedTag", 1 },
-       [ADVICE_OBJECT_NAME_WARNING]                    = { "objectNameWarning", 1 },
-       [ADVICE_PUSH_ALREADY_EXISTS]                    = { "pushAlreadyExists", 1 },
-       [ADVICE_PUSH_FETCH_FIRST]                       = { "pushFetchFirst", 1 },
-       [ADVICE_PUSH_NEEDS_FORCE]                       = { "pushNeedsForce", 1 },
-       [ADVICE_PUSH_REF_NEEDS_UPDATE]                  = { "pushRefNeedsUpdate", 1 },
-
-       /* make this an alias for backward compatibility */
-       [ADVICE_PUSH_UPDATE_REJECTED_ALIAS]             = { "pushNonFastForward", 1 },
-
-       [ADVICE_PUSH_NON_FF_CURRENT]                    = { "pushNonFFCurrent", 1 },
-       [ADVICE_PUSH_NON_FF_MATCHING]                   = { "pushNonFFMatching", 1 },
-       [ADVICE_PUSH_UNQUALIFIED_REF_NAME]              = { "pushUnqualifiedRefName", 1 },
-       [ADVICE_PUSH_UPDATE_REJECTED]                   = { "pushUpdateRejected", 1 },
-       [ADVICE_RESET_NO_REFRESH_WARNING]               = { "resetNoRefresh", 1 },
-       [ADVICE_RESOLVE_CONFLICT]                       = { "resolveConflict", 1 },
-       [ADVICE_RM_HINTS]                               = { "rmHints", 1 },
-       [ADVICE_SEQUENCER_IN_USE]                       = { "sequencerInUse", 1 },
-       [ADVICE_SET_UPSTREAM_FAILURE]                   = { "setUpstreamFailure", 1 },
-       [ADVICE_SKIPPED_CHERRY_PICKS]                   = { "skippedCherryPicks", 1 },
-       [ADVICE_STATUS_AHEAD_BEHIND_WARNING]            = { "statusAheadBehindWarning", 1 },
-       [ADVICE_STATUS_HINTS]                           = { "statusHints", 1 },
-       [ADVICE_STATUS_U_OPTION]                        = { "statusUoption", 1 },
-       [ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE] = { "submoduleAlternateErrorStrategyDie", 1 },
-       [ADVICE_SUBMODULES_NOT_UPDATED]                 = { "submodulesNotUpdated", 1 },
-       [ADVICE_UPDATE_SPARSE_PATH]                     = { "updateSparsePath", 1 },
-       [ADVICE_WAITING_FOR_EDITOR]                     = { "waitingForEditor", 1 },
-       [ADVICE_WORKTREE_ADD_ORPHAN]                    = { "worktreeAddOrphan", 1 },
+       [ADVICE_ADD_EMBEDDED_REPO]                      = { "addEmbeddedRepo" },
+       [ADVICE_ADD_EMPTY_PATHSPEC]                     = { "addEmptyPathspec" },
+       [ADVICE_ADD_IGNORED_FILE]                       = { "addIgnoredFile" },
+       [ADVICE_AMBIGUOUS_FETCH_REFSPEC]                = { "ambiguousFetchRefspec" },
+       [ADVICE_AM_WORK_DIR]                            = { "amWorkDir" },
+       [ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME]  = { "checkoutAmbiguousRemoteBranchName" },
+       [ADVICE_COMMIT_BEFORE_MERGE]                    = { "commitBeforeMerge" },
+       [ADVICE_DETACHED_HEAD]                          = { "detachedHead" },
+       [ADVICE_DIVERGING]                              = { "diverging" },
+       [ADVICE_FETCH_SHOW_FORCED_UPDATES]              = { "fetchShowForcedUpdates" },
+       [ADVICE_FORCE_DELETE_BRANCH]                    = { "forceDeleteBranch" },
+       [ADVICE_GRAFT_FILE_DEPRECATED]                  = { "graftFileDeprecated" },
+       [ADVICE_IGNORED_HOOK]                           = { "ignoredHook" },
+       [ADVICE_IMPLICIT_IDENTITY]                      = { "implicitIdentity" },
+       [ADVICE_NESTED_TAG]                             = { "nestedTag" },
+       [ADVICE_OBJECT_NAME_WARNING]                    = { "objectNameWarning" },
+       [ADVICE_PUSH_ALREADY_EXISTS]                    = { "pushAlreadyExists" },
+       [ADVICE_PUSH_FETCH_FIRST]                       = { "pushFetchFirst" },
+       [ADVICE_PUSH_NEEDS_FORCE]                       = { "pushNeedsForce" },
+       [ADVICE_PUSH_NON_FF_CURRENT]                    = { "pushNonFFCurrent" },
+       [ADVICE_PUSH_NON_FF_MATCHING]                   = { "pushNonFFMatching" },
+       [ADVICE_PUSH_REF_NEEDS_UPDATE]                  = { "pushRefNeedsUpdate" },
+       [ADVICE_PUSH_UNQUALIFIED_REF_NAME]              = { "pushUnqualifiedRefName" },
+       [ADVICE_PUSH_UPDATE_REJECTED]                   = { "pushUpdateRejected" },
+       [ADVICE_PUSH_UPDATE_REJECTED_ALIAS]             = { "pushNonFastForward" }, /* backwards compatibility */
+       [ADVICE_REF_SYNTAX]                             = { "refSyntax" },
+       [ADVICE_RESET_NO_REFRESH_WARNING]               = { "resetNoRefresh" },
+       [ADVICE_RESOLVE_CONFLICT]                       = { "resolveConflict" },
+       [ADVICE_RM_HINTS]                               = { "rmHints" },
+       [ADVICE_SEQUENCER_IN_USE]                       = { "sequencerInUse" },
+       [ADVICE_SET_UPSTREAM_FAILURE]                   = { "setUpstreamFailure" },
+       [ADVICE_SKIPPED_CHERRY_PICKS]                   = { "skippedCherryPicks" },
+       [ADVICE_STATUS_AHEAD_BEHIND_WARNING]            = { "statusAheadBehindWarning" },
+       [ADVICE_STATUS_HINTS]                           = { "statusHints" },
+       [ADVICE_STATUS_U_OPTION]                        = { "statusUoption" },
+       [ADVICE_SUBMODULES_NOT_UPDATED]                 = { "submodulesNotUpdated" },
+       [ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE] = { "submoduleAlternateErrorStrategyDie" },
+       [ADVICE_SUBMODULE_MERGE_CONFLICT]               = { "submoduleMergeConflict" },
+       [ADVICE_SUGGEST_DETACHING_HEAD]                 = { "suggestDetachingHead" },
+       [ADVICE_UPDATE_SPARSE_PATH]                     = { "updateSparsePath" },
+       [ADVICE_WAITING_FOR_EDITOR]                     = { "waitingForEditor" },
+       [ADVICE_WORKTREE_ADD_ORPHAN]                    = { "worktreeAddOrphan" },
 };
 
 static const char turn_off_instructions[] =
@@ -118,13 +124,13 @@ void advise(const char *advice, ...)
 
 int advice_enabled(enum advice_type type)
 {
-       switch(type) {
-       case ADVICE_PUSH_UPDATE_REJECTED:
-               return advice_setting[ADVICE_PUSH_UPDATE_REJECTED].enabled &&
-                      advice_setting[ADVICE_PUSH_UPDATE_REJECTED_ALIAS].enabled;
-       default:
-               return advice_setting[type].enabled;
-       }
+       int enabled = advice_setting[type].level != ADVICE_LEVEL_DISABLED;
+
+       if (type == ADVICE_PUSH_UPDATE_REJECTED)
+               return enabled &&
+                      advice_enabled(ADVICE_PUSH_UPDATE_REJECTED_ALIAS);
+
+       return enabled;
 }
 
 void advise_if_enabled(enum advice_type type, const char *advice, ...)
@@ -135,7 +141,8 @@ void advise_if_enabled(enum advice_type type, const char *advice, ...)
                return;
 
        va_start(params, advice);
-       vadvise(advice, 1, advice_setting[type].key, params);
+       vadvise(advice, !advice_setting[type].level, advice_setting[type].key,
+               params);
        va_end(params);
 }
 
@@ -164,7 +171,9 @@ int git_default_advice_config(const char *var, const char *value)
        for (i = 0; i < ARRAY_SIZE(advice_setting); i++) {
                if (strcasecmp(k, advice_setting[i].key))
                        continue;
-               advice_setting[i].enabled = git_config_bool(var, value);
+               advice_setting[i].level = git_config_bool(var, value)
+                                         ? ADVICE_LEVEL_ENABLED
+                                         : ADVICE_LEVEL_DISABLED;
                return 0;
        }
 
index 2affbe142616de0d329c9aaaaee9ca355fb73adf..bf630ee3ac3eae23b05b9554f4cc20ce2ea7a280 100644 (file)
--- a/advice.h
+++ b/advice.h
@@ -10,18 +10,18 @@ struct string_list;
  * Add the new config variable to Documentation/config/advice.txt.
  * Call advise_if_enabled to print your advice.
  */
- enum advice_type {
+enum advice_type {
        ADVICE_ADD_EMBEDDED_REPO,
        ADVICE_ADD_EMPTY_PATHSPEC,
        ADVICE_ADD_IGNORED_FILE,
-       ADVICE_AM_WORK_DIR,
        ADVICE_AMBIGUOUS_FETCH_REFSPEC,
+       ADVICE_AM_WORK_DIR,
        ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
        ADVICE_COMMIT_BEFORE_MERGE,
        ADVICE_DETACHED_HEAD,
        ADVICE_DIVERGING,
-       ADVICE_SUGGEST_DETACHING_HEAD,
        ADVICE_FETCH_SHOW_FORCED_UPDATES,
+       ADVICE_FORCE_DELETE_BRANCH,
        ADVICE_GRAFT_FILE_DEPRECATED,
        ADVICE_IGNORED_HOOK,
        ADVICE_IMPLICIT_IDENTITY,
@@ -32,23 +32,26 @@ struct string_list;
        ADVICE_PUSH_NEEDS_FORCE,
        ADVICE_PUSH_NON_FF_CURRENT,
        ADVICE_PUSH_NON_FF_MATCHING,
+       ADVICE_PUSH_REF_NEEDS_UPDATE,
        ADVICE_PUSH_UNQUALIFIED_REF_NAME,
-       ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
        ADVICE_PUSH_UPDATE_REJECTED,
-       ADVICE_PUSH_REF_NEEDS_UPDATE,
+       ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
+       ADVICE_REF_SYNTAX,
        ADVICE_RESET_NO_REFRESH_WARNING,
        ADVICE_RESOLVE_CONFLICT,
        ADVICE_RM_HINTS,
        ADVICE_SEQUENCER_IN_USE,
        ADVICE_SET_UPSTREAM_FAILURE,
+       ADVICE_SKIPPED_CHERRY_PICKS,
        ADVICE_STATUS_AHEAD_BEHIND_WARNING,
        ADVICE_STATUS_HINTS,
        ADVICE_STATUS_U_OPTION,
-       ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,
        ADVICE_SUBMODULES_NOT_UPDATED,
+       ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,
+       ADVICE_SUBMODULE_MERGE_CONFLICT,
+       ADVICE_SUGGEST_DETACHING_HEAD,
        ADVICE_UPDATE_SPARSE_PATH,
        ADVICE_WAITING_FOR_EDITOR,
-       ADVICE_SKIPPED_CHERRY_PICKS,
        ADVICE_WORKTREE_ADD_ORPHAN,
 };
 
diff --git a/apply.c b/apply.c
index 3d69fec836d41fbae10988606ac20ce96dad562d..432837a674c3cc559f762aa4b7766bd8f43177e0 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -12,7 +12,6 @@
 #include "base85.h"
 #include "config.h"
 #include "object-store-ll.h"
-#include "blob.h"
 #include "delta.h"
 #include "diff.h"
 #include "dir.h"
@@ -78,7 +77,8 @@ static int parse_whitespace_option(struct apply_state *state, const char *option
                return 0;
        }
        /*
-        * Please update $__git_whitespacelist in git-completion.bash
+        * Please update $__git_whitespacelist in git-completion.bash,
+        * Documentation/git-apply.txt, and Documentation/git-am.txt
         * when you add new options.
         */
        return error(_("unrecognized whitespace option '%s'"), option);
@@ -2220,7 +2220,8 @@ static void reverse_patches(struct patch *p)
                struct fragment *frag = p->fragments;
 
                SWAP(p->new_name, p->old_name);
-               SWAP(p->new_mode, p->old_mode);
+               if (p->new_mode)
+                       SWAP(p->new_mode, p->old_mode);
                SWAP(p->is_new, p->is_delete);
                SWAP(p->lines_added, p->lines_deleted);
                SWAP(p->old_oid_prefix, p->new_oid_prefix);
@@ -3778,8 +3779,17 @@ static int check_preimage(struct apply_state *state,
                return error_errno("%s", old_name);
        }
 
-       if (!state->cached && !previous)
-               st_mode = ce_mode_from_stat(*ce, st->st_mode);
+       if (!state->cached && !previous) {
+               if (*ce && !(*ce)->ce_mode)
+                       BUG("ce_mode == 0 for path '%s'", old_name);
+
+               if (trust_executable_bit)
+                       st_mode = ce_mode_from_stat(*ce, st->st_mode);
+               else if (*ce)
+                       st_mode = (*ce)->ce_mode;
+               else
+                       st_mode = patch->old_mode;
+       }
 
        if (patch->is_new < 0)
                patch->is_new = 0;
index 07269968399a5e1b1731fb458d48f4188ed25577..8ae30125f84c463118d70b69eae88d4d21d31905 100644 (file)
@@ -9,6 +9,7 @@
 #include "tar.h"
 #include "archive.h"
 #include "object-store-ll.h"
+#include "strbuf.h"
 #include "streaming.h"
 #include "run-command.h"
 #include "write-or-die.h"
@@ -364,7 +365,7 @@ static struct archiver *find_tar_filter(const char *name, size_t len)
        int i;
        for (i = 0; i < nr_tar_filters; i++) {
                struct archiver *ar = tar_filters[i];
-               if (!strncmp(ar->name, name, len) && !ar->name[len])
+               if (!xstrncmpz(ar->name, name, len))
                        return ar;
        }
        return NULL;
index 7229e3e454feb080509d1587a974925ff1318f31..fd1d3f816d30d696456cf1915bb40f2d325f3010 100644 (file)
@@ -10,6 +10,7 @@
 #include "streaming.h"
 #include "utf8.h"
 #include "object-store-ll.h"
+#include "strbuf.h"
 #include "userdiff.h"
 #include "write-or-die.h"
 #include "xdiff-interface.h"
index b10269aee7bef09c00d87605422c6f108a99bb4b..5287fcdd8e0460063f40e4e3f7a812d248e41afd 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -5,6 +5,7 @@
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
+#include "object-name.h"
 #include "path.h"
 #include "pretty.h"
 #include "setup.h"
@@ -17,7 +18,6 @@
 #include "archive.h"
 #include "parse-options.h"
 #include "unpack-trees.h"
-#include "dir.h"
 #include "quote.h"
 
 static char const * const archive_usage[] = {
@@ -686,6 +686,8 @@ static int parse_archive_args(int argc, const char **argv,
                base = "";
 
        if (list) {
+               if (argc)
+                       die(_("extra command line parameter '%s'"), *argv);
                for (i = 0; i < nr_archivers; i++)
                        if (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE)
                                printf("%s\n", archivers[i]->name);
index 3a4bdfbd078109680dd54143d03ee2567a0cba31..bbe65ba0f900df1367d1d7607300d732a86c5c0c 100644 (file)
--- a/archive.h
+++ b/archive.h
@@ -1,7 +1,6 @@
 #ifndef ARCHIVE_H
 #define ARCHIVE_H
 
-#include "object-name.h"
 #include "pathspec.h"
 #include "string-list.h"
 
diff --git a/attr.c b/attr.c
index ff0a3e7b61ad0468de7d42305ffc723fbfb9c9e1..679e42258c2b205bfceb9d065295c47c375442d4 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -17,6 +17,7 @@
 #include "utf8.h"
 #include "quote.h"
 #include "read-cache-ll.h"
+#include "refs.h"
 #include "revision.h"
 #include "object-store-ll.h"
 #include "setup.h"
@@ -24,6 +25,8 @@
 #include "tree-walk.h"
 #include "object-name.h"
 
+const char *git_attr_tree;
+
 const char git_attr__true[] = "(builtin)true";
 const char git_attr__false[] = "\0(builtin)false";
 static const char git_attr__unknown[] = "(builtin)unknown";
@@ -181,6 +184,15 @@ static void all_attrs_init(struct attr_hashmap *map, struct attr_check *check)
        }
 }
 
+/*
+ * Atribute name cannot begin with "builtin_" which
+ * is a reserved namespace for built in attributes values.
+ */
+static int attr_name_reserved(const char *name)
+{
+       return starts_with(name, "builtin_");
+}
+
 static int attr_name_valid(const char *name, size_t namelen)
 {
        /*
@@ -313,7 +325,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
                        cp++;
                        len--;
                }
-               if (!attr_name_valid(cp, len)) {
+               if (!attr_name_valid(cp, len) || attr_name_reserved(cp)) {
                        report_invalid_attr(cp, len, src, lineno);
                        return NULL;
                }
@@ -377,7 +389,7 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
                name += strlen(ATTRIBUTE_MACRO_PREFIX);
                name += strspn(name, blank);
                namelen = strcspn(name, blank);
-               if (!attr_name_valid(name, namelen)) {
+               if (!attr_name_valid(name, namelen) || attr_name_reserved(name)) {
                        report_invalid_attr(name, namelen, src, lineno);
                        goto fail_return;
                }
@@ -807,35 +819,56 @@ static struct attr_stack *read_attr_from_blob(struct index_state *istate,
 static struct attr_stack *read_attr_from_index(struct index_state *istate,
                                               const char *path, unsigned flags)
 {
+       struct attr_stack *stack = NULL;
        char *buf;
        unsigned long size;
+       int sparse_dir_pos = -1;
 
        if (!istate)
                return NULL;
 
        /*
-        * The .gitattributes file only applies to files within its
-        * parent directory. In the case of cone-mode sparse-checkout,
-        * the .gitattributes file is sparse if and only if all paths
-        * within that directory are also sparse. Thus, don't load the
-        * .gitattributes file since it will not matter.
-        *
-        * In the case of a sparse index, it is critical that we don't go
-        * looking for a .gitattributes file, as doing so would cause the
-        * index to expand.
+        * When handling sparse-checkouts, .gitattributes files
+        * may reside within a sparse directory. We distinguish
+        * whether a path exists directly in the index or not by
+        * evaluating if 'pos' is negative.
+        * If 'pos' is negative, the path is not directly present
+        * in the index and is likely within a sparse directory.
+        * For paths not in the index, The absolute value of 'pos'
+        * minus 1 gives us the position where the path would be
+        * inserted in lexicographic order within the index.
+        * We then subtract another 1 from this value
+        * (sparse_dir_pos = -pos - 2) to find the position of the
+        * last index entry which is lexicographically smaller than
+        * the path. This would be the sparse directory containing
+        * the path. By identifying the sparse directory containing
+        * the path, we can correctly read the attributes specified
+        * in the .gitattributes file from the tree object of the
+        * sparse directory.
         */
-       if (!path_in_cone_mode_sparse_checkout(path, istate))
-               return NULL;
+       if (!path_in_cone_mode_sparse_checkout(path, istate)) {
+               int pos = index_name_pos_sparse(istate, path, strlen(path));
 
-       buf = read_blob_data_from_index(istate, path, &size);
-       if (!buf)
-               return NULL;
-       if (size >= ATTR_MAX_FILE_SIZE) {
-               warning(_("ignoring overly large gitattributes blob '%s'"), path);
-               return NULL;
+               if (pos < 0)
+                       sparse_dir_pos = -pos - 2;
        }
 
-       return read_attr_from_buf(buf, path, flags);
+       if (sparse_dir_pos >= 0 &&
+           S_ISSPARSEDIR(istate->cache[sparse_dir_pos]->ce_mode) &&
+           !strncmp(istate->cache[sparse_dir_pos]->name, path, ce_namelen(istate->cache[sparse_dir_pos]))) {
+               const char *relative_path = path + ce_namelen(istate->cache[sparse_dir_pos]);
+               stack = read_attr_from_blob(istate, &istate->cache[sparse_dir_pos]->oid, relative_path, flags);
+       } else {
+               buf = read_blob_data_from_index(istate, path, &size);
+               if (!buf)
+                       return NULL;
+               if (size >= ATTR_MAX_FILE_SIZE) {
+                       warning(_("ignoring overly large gitattributes blob '%s'"), path);
+                       return NULL;
+               }
+               stack = read_attr_from_buf(buf, path, flags);
+       }
+       return stack;
 }
 
 static struct attr_stack *read_attr(struct index_state *istate,
@@ -1173,6 +1206,7 @@ static void collect_some_attrs(struct index_state *istate,
 }
 
 static const char *default_attr_source_tree_object_name;
+static int ignore_bad_attr_tree;
 
 void set_git_attr_source(const char *tree_object_name)
 {
@@ -1184,10 +1218,24 @@ static void compute_default_attr_source(struct object_id *attr_source)
        if (!default_attr_source_tree_object_name)
                default_attr_source_tree_object_name = getenv(GIT_ATTR_SOURCE_ENVIRONMENT);
 
+       if (!default_attr_source_tree_object_name && git_attr_tree) {
+               default_attr_source_tree_object_name = git_attr_tree;
+               ignore_bad_attr_tree = 1;
+       }
+
+       if (!default_attr_source_tree_object_name &&
+           startup_info->have_repository &&
+           is_bare_repository()) {
+               default_attr_source_tree_object_name = "HEAD";
+               ignore_bad_attr_tree = 1;
+       }
+
        if (!default_attr_source_tree_object_name || !is_null_oid(attr_source))
                return;
 
-       if (repo_get_oid_treeish(the_repository, default_attr_source_tree_object_name, attr_source))
+       if (repo_get_oid_treeish(the_repository,
+                                default_attr_source_tree_object_name,
+                                attr_source) && !ignore_bad_attr_tree)
                die(_("bad --attr-source or GIT_ATTR_SOURCE"));
 }
 
@@ -1202,6 +1250,85 @@ static struct object_id *default_attr_source(void)
        return &attr_source;
 }
 
+static const char *interned_mode_string(unsigned int mode)
+{
+       static struct {
+               unsigned int val;
+               char str[7];
+       } mode_string[] = {
+               { .val = 0040000 },
+               { .val = 0100644 },
+               { .val = 0100755 },
+               { .val = 0120000 },
+               { .val = 0160000 },
+       };
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(mode_string); i++) {
+               if (mode_string[i].val != mode)
+                       continue;
+               if (!*mode_string[i].str)
+                       snprintf(mode_string[i].str, sizeof(mode_string[i].str),
+                                "%06o", mode);
+               return mode_string[i].str;
+       }
+       BUG("Unsupported mode 0%o", mode);
+}
+
+static const char *builtin_object_mode_attr(struct index_state *istate, const char *path)
+{
+       unsigned int mode;
+
+       if (direction == GIT_ATTR_CHECKIN) {
+               struct object_id oid;
+               struct stat st;
+               if (lstat(path, &st))
+                       die_errno(_("unable to stat '%s'"), path);
+               mode = canon_mode(st.st_mode);
+               if (S_ISDIR(mode)) {
+                       /*
+                        *`path` is either a directory or it is a submodule,
+                        * in which case it is already indexed as submodule
+                        * or it does not exist in the index yet and we need to
+                        * check if we can resolve to a ref.
+                       */
+                       int pos = index_name_pos(istate, path, strlen(path));
+                       if (pos >= 0) {
+                                if (S_ISGITLINK(istate->cache[pos]->ce_mode))
+                                        mode = istate->cache[pos]->ce_mode;
+                       } else if (resolve_gitlink_ref(path, "HEAD", &oid) == 0) {
+                               mode = S_IFGITLINK;
+                       }
+               }
+       } else {
+               /*
+                * For GIT_ATTR_CHECKOUT and GIT_ATTR_INDEX we only check
+                * for mode in the index.
+                */
+               int pos = index_name_pos(istate, path, strlen(path));
+               if (pos >= 0)
+                       mode = istate->cache[pos]->ce_mode;
+               else
+                       return ATTR__UNSET;
+       }
+
+       return interned_mode_string(mode);
+}
+
+
+static const char *compute_builtin_attr(struct index_state *istate,
+                                         const char *path,
+                                         const struct git_attr *attr) {
+       static const struct git_attr *object_mode_attr;
+
+       if (!object_mode_attr)
+               object_mode_attr = git_attr("builtin_objectmode");
+
+       if (attr == object_mode_attr)
+               return builtin_object_mode_attr(istate, path);
+       return ATTR__UNSET;
+}
+
 void git_check_attr(struct index_state *istate,
                    const char *path,
                    struct attr_check *check)
@@ -1215,7 +1342,7 @@ void git_check_attr(struct index_state *istate,
                unsigned int n = check->items[i].attr->attr_nr;
                const char *value = check->all_attrs[n].value;
                if (value == ATTR__UNKNOWN)
-                       value = ATTR__UNSET;
+                       value = compute_builtin_attr(istate, path, check->all_attrs[n].attr);
                check->items[i].value = value;
        }
 }
diff --git a/attr.h b/attr.h
index 2b745df4054d7a5fe5e537ac4d894ccbd199b9c4..127998ae013c9de221b700144ad2082a78bfcaba 100644 (file)
--- a/attr.h
+++ b/attr.h
@@ -236,4 +236,6 @@ const char *git_attr_global_file(void);
 /* Return whether the system gitattributes file is enabled and should be used. */
 int git_attr_system_is_enabled(void);
 
+extern const char *git_attr_tree;
+
 #endif /* ATTR_H */
index 1be8e0a2711df9d29c1ba903fd4e8901379ea406..60aae2fe50d4edaa520c9cf9f7e4a23ed6c60085 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -9,7 +9,6 @@
 #include "refs.h"
 #include "list-objects.h"
 #include "quote.h"
-#include "hash-lookup.h"
 #include "run-command.h"
 #include "log-tree.h"
 #include "bisect.h"
@@ -159,6 +158,9 @@ static void show_list(const char *debug, int counted, int nr,
                const char *subject_start;
                int subject_len;
 
+               if (!buf)
+                       die(_("unable to read %s"), oid_to_hex(&commit->object.oid));
+
                fprintf(stderr, "%c%c%c ",
                        (commit_flags & TREESAME) ? ' ' : 'T',
                        (commit_flags & UNINTERESTING) ? 'U' : ' ',
@@ -471,7 +473,6 @@ static int read_bisect_refs(void)
 }
 
 static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
-static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
 static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK")
 static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
 static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
@@ -707,26 +708,10 @@ static enum bisect_error error_if_skipped_commits(struct commit_list *tried,
 
 static int is_expected_rev(const struct object_id *oid)
 {
-       const char *filename = git_path_bisect_expected_rev();
-       struct stat st;
-       struct strbuf str = STRBUF_INIT;
-       FILE *fp;
-       int res = 0;
-
-       if (stat(filename, &st) || !S_ISREG(st.st_mode))
-               return 0;
-
-       fp = fopen_or_warn(filename, "r");
-       if (!fp)
+       struct object_id expected_oid;
+       if (read_ref("BISECT_EXPECTED_REV", &expected_oid))
                return 0;
-
-       if (strbuf_getline_lf(&str, fp) != EOF)
-               res = !strcmp(str.buf, oid_to_hex(oid));
-
-       strbuf_release(&str);
-       fclose(fp);
-
-       return res;
+       return oideq(oid, &expected_oid);
 }
 
 enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
@@ -851,10 +836,11 @@ static void handle_skipped_merge_base(const struct object_id *mb)
 static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int no_checkout)
 {
        enum bisect_error res = BISECT_OK;
-       struct commit_list *result;
+       struct commit_list *result = NULL;
 
-       result = repo_get_merge_bases_many(the_repository, rev[0], rev_nr - 1,
-                                          rev + 1);
+       if (repo_get_merge_bases_many(the_repository, rev[0], rev_nr - 1,
+                                     rev + 1, &result) < 0)
+               exit(128);
 
        for (; result; result = result->next) {
                const struct object_id *mb = &result->item->object.oid;
@@ -1185,10 +1171,10 @@ int bisect_clean_state(void)
        struct string_list refs_for_removal = STRING_LIST_INIT_NODUP;
        for_each_ref_in("refs/bisect", mark_for_removal, (void *) &refs_for_removal);
        string_list_append(&refs_for_removal, xstrdup("BISECT_HEAD"));
+       string_list_append(&refs_for_removal, xstrdup("BISECT_EXPECTED_REV"));
        result = delete_refs("bisect: remove", &refs_for_removal, REF_NO_DEREF);
        refs_for_removal.strdup_strings = 1;
        string_list_clear(&refs_for_removal, 0);
-       unlink_or_warn(git_path_bisect_expected_rev());
        unlink_or_warn(git_path_bisect_ancestors_ok());
        unlink_or_warn(git_path_bisect_log());
        unlink_or_warn(git_path_bisect_names());
diff --git a/blame.c b/blame.c
index 141756975bf5a58a1744eda78c1750d9d949272f..1a16d4eb6a59148325190f8152e13410398177ba 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -3,6 +3,7 @@
 #include "object-store-ll.h"
 #include "cache-tree.h"
 #include "mergesort.h"
+#include "commit.h"
 #include "convert.h"
 #include "diff.h"
 #include "diffcore.h"
@@ -10,6 +11,7 @@
 #include "hex.h"
 #include "path.h"
 #include "read-cache.h"
+#include "revision.h"
 #include "setup.h"
 #include "tag.h"
 #include "trace2.h"
diff --git a/blame.h b/blame.h
index 31ddc85f19e359908710162ad4aa144784dec16b..5b4e47d44c613e31fc4788c12ee9d8dc2a49d571 100644 (file)
--- a/blame.h
+++ b/blame.h
@@ -1,12 +1,9 @@
 #ifndef BLAME_H
 #define BLAME_H
 
-#include "commit.h"
 #include "oidset.h"
 #include "xdiff-interface.h"
-#include "revision.h"
 #include "prio-queue.h"
-#include "diff.h"
 
 #define PICKAXE_BLAME_MOVE             01
 #define PICKAXE_BLAME_COPY             02
diff --git a/blob.c b/blob.c
index 888e28a5594747bd263df0bb8f2179122bccb131..3fb2922b1ae65a552101d625a806e914b99eb339 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -1,6 +1,5 @@
 #include "git-compat-util.h"
 #include "blob.h"
-#include "repository.h"
 #include "alloc.h"
 
 const char *blob_type = "blob";
diff --git a/bloom.c b/bloom.c
index aef6b5fea2d18f521b4812bd017fe685f635be47..e529f7605ca14d3fcb779412fc22e1e20d45ac20 100644 (file)
--- a/bloom.c
+++ b/bloom.c
@@ -2,7 +2,6 @@
 #include "bloom.h"
 #include "diff.h"
 #include "diffcore.h"
-#include "revision.h"
 #include "hashmap.h"
 #include "commit-graph.h"
 #include "commit.h"
@@ -29,6 +28,26 @@ static inline unsigned char get_bitmask(uint32_t pos)
        return ((unsigned char)1) << (pos & (BITS_PER_WORD - 1));
 }
 
+static int check_bloom_offset(struct commit_graph *g, uint32_t pos,
+                             uint32_t offset)
+{
+       /*
+        * Note that we allow offsets equal to the data size, which would set
+        * our pointers at one past the end of the chunk memory. This is
+        * necessary because the on-disk index points to the end of the
+        * entries (so we can compute size by comparing adjacent ones). And
+        * naturally the final entry's end is one-past-the-end of the chunk.
+        */
+       if (offset <= g->chunk_bloom_data_size - BLOOMDATA_CHUNK_HEADER_SIZE)
+               return 0;
+
+       warning("ignoring out-of-range offset (%"PRIuMAX") for changed-path"
+               " filter at pos %"PRIuMAX" of %s (chunk size: %"PRIuMAX")",
+               (uintmax_t)offset, (uintmax_t)pos,
+               g->filename, (uintmax_t)g->chunk_bloom_data_size);
+       return -1;
+}
+
 static int load_bloom_filter_from_graph(struct commit_graph *g,
                                        struct bloom_filter *filter,
                                        uint32_t graph_pos)
@@ -51,6 +70,20 @@ static int load_bloom_filter_from_graph(struct commit_graph *g,
        else
                start_index = 0;
 
+       if (check_bloom_offset(g, lex_pos, end_index) < 0 ||
+           check_bloom_offset(g, lex_pos - 1, start_index) < 0)
+               return 0;
+
+       if (end_index < start_index) {
+               warning("ignoring decreasing changed-path index offsets"
+                       " (%"PRIuMAX" > %"PRIuMAX") for positions"
+                       " %"PRIuMAX" and %"PRIuMAX" of %s",
+                       (uintmax_t)start_index, (uintmax_t)end_index,
+                       (uintmax_t)(lex_pos-1), (uintmax_t)lex_pos,
+                       g->filename);
+               return 0;
+       }
+
        filter->len = end_index - start_index;
        filter->data = (unsigned char *)(g->chunk_bloom_data +
                                        sizeof(unsigned char) * start_index +
index 3e4684f79f693059a6272465dd983e149aee5eb9..621019fcf4bde0a0568dbae2a1055e12cf8df030 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -370,8 +370,12 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
  */
 int validate_branchname(const char *name, struct strbuf *ref)
 {
-       if (strbuf_check_branch_ref(ref, name))
-               die(_("'%s' is not a valid branch name"), name);
+       if (strbuf_check_branch_ref(ref, name)) {
+               int code = die_message(_("'%s' is not a valid branch name"), name);
+               advise_if_enabled(ADVICE_REF_SYNTAX,
+                                 _("See `man git check-ref-format`"));
+               exit(code);
+       }
 
        return ref_exists(ref->buf);
 }
@@ -420,9 +424,9 @@ static void prepare_checked_out_branches(void)
                wt_status_state_free_buffers(&state);
 
                if (wt_status_check_bisect(wt, &state) &&
-                   state.branch) {
+                   state.bisecting_from) {
                        struct strbuf ref = STRBUF_INIT;
-                       strbuf_addf(&ref, "refs/heads/%s", state.branch);
+                       strbuf_addf(&ref, "refs/heads/%s", state.bisecting_from);
                        old = strmap_put(&current_checked_out_branches,
                                         ref.buf,
                                         xstrdup(wt->path));
@@ -817,8 +821,9 @@ void remove_merge_branch_state(struct repository *r)
        unlink(git_path_merge_rr(r));
        unlink(git_path_merge_msg(r));
        unlink(git_path_merge_mode(r));
-       unlink(git_path_auto_merge(r));
-       save_autostash(git_path_merge_autostash(r));
+       refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE",
+                       NULL, REF_NO_DEREF);
+       save_autostash_ref(r, "MERGE_AUTOSTASH");
 }
 
 void remove_branch_state(struct repository *r, int verbose)
@@ -838,7 +843,7 @@ void die_if_checked_out(const char *branch, int ignore_current_worktree)
 
                if (is_shared_symref(worktrees[i], "HEAD", branch)) {
                        skip_prefix(branch, "refs/heads/", &branch);
-                       die(_("'%s' is already checked out at '%s'"),
+                       die(_("'%s' is already used by worktree at '%s'"),
                                branch, worktrees[i]->path);
                }
        }
index d560baa6618ac9e021dc7f957b942466ac6e35b3..28280636da8f52deabea4472d52f574ecb3a4945 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -211,6 +211,7 @@ int cmd_remote(int argc, const char **argv, const char *prefix);
 int cmd_remote_ext(int argc, const char **argv, const char *prefix);
 int cmd_remote_fd(int argc, const char **argv, const char *prefix);
 int cmd_repack(int argc, const char **argv, const char *prefix);
+int cmd_replay(int argc, const char **argv, const char *prefix);
 int cmd_rerere(int argc, const char **argv, const char *prefix);
 int cmd_reset(int argc, const char **argv, const char *prefix);
 int cmd_restore(int argc, const char **argv, const char *prefix);
index 4b0dd798df5909905f7be69479d4b3b2ce1b19ae..393c10cbcf6315efb525b38db26e218bf6b1959d 100644 (file)
 #include "dir.h"
 #include "gettext.h"
 #include "pathspec.h"
-#include "exec-cmd.h"
-#include "cache-tree.h"
 #include "run-command.h"
 #include "parse-options.h"
 #include "path.h"
 #include "preload-index.h"
 #include "diff.h"
-#include "diffcore.h"
 #include "read-cache.h"
 #include "repository.h"
 #include "revision.h"
@@ -118,7 +115,7 @@ static int refresh(int verbose, const struct pathspec *pathspec)
        int i, ret = 0;
        char *skip_worktree_seen = NULL;
        struct string_list only_match_skip_worktree = STRING_LIST_INIT_NODUP;
-       int flags = REFRESH_IGNORE_SKIP_WORKTREE |
+       unsigned int flags = REFRESH_IGNORE_SKIP_WORKTREE |
                    (verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET);
 
        seen = xcalloc(pathspec->nr, 1);
@@ -182,7 +179,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
        git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 
        if (repo_read_index(the_repository) < 0)
-               die(_("Could not read the index"));
+               die(_("could not read the index"));
 
        repo_init_revisions(the_repository, &rev, prefix);
        rev.diffopt.context = 7;
@@ -194,22 +191,21 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
        out = xopen(file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
        rev.diffopt.file = xfdopen(out, "w");
        rev.diffopt.close_file = 1;
-       if (run_diff_files(&rev, 0))
-               die(_("Could not write patch"));
+       run_diff_files(&rev, 0);
 
        if (launch_editor(file, NULL, NULL))
                die(_("editing patch failed"));
 
        if (stat(file, &st))
-               die_errno(_("Could not stat '%s'"), file);
+               die_errno(_("could not stat '%s'"), file);
        if (!st.st_size)
-               die(_("Empty patch. Aborted."));
+               die(_("empty patch. aborted"));
 
        child.git_cmd = 1;
        strvec_pushl(&child.args, "apply", "--recount", "--cached", file,
                     NULL);
        if (run_command(&child))
-               die(_("Could not apply '%s'"), file);
+               die(_("could not apply '%s'"), file);
 
        unlink(file);
        free(file);
@@ -232,6 +228,8 @@ static char *chmod_arg;
 
 static int ignore_removal_cb(const struct option *opt, const char *arg, int unset)
 {
+       BUG_ON_OPT_ARG(arg);
+
        /* if we are told to ignore, we are not adding removals */
        *(int *)opt->value = !unset ? 0 : 1;
        return 0;
@@ -423,7 +421,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
         * Check the "pathspec '%s' did not match any files" block
         * below before enabling new magic.
         */
-       parse_pathspec(&pathspec, PATHSPEC_ATTR,
+       parse_pathspec(&pathspec, 0,
                       PATHSPEC_PREFER_FULL |
                       PATHSPEC_SYMLINK_LEADING_PATH,
                       prefix, argv);
@@ -432,7 +430,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                if (pathspec.nr)
                        die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
 
-               parse_pathspec_file(&pathspec, PATHSPEC_ATTR,
+               parse_pathspec_file(&pathspec, 0,
                                    PATHSPEC_PREFER_FULL |
                                    PATHSPEC_SYMLINK_LEADING_PATH,
                                    prefix, pathspec_from_file, pathspec_file_nul);
@@ -503,7 +501,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                               PATHSPEC_LITERAL |
                               PATHSPEC_GLOB |
                               PATHSPEC_ICASE |
-                              PATHSPEC_EXCLUDE);
+                              PATHSPEC_EXCLUDE |
+                              PATHSPEC_ATTR);
 
                for (i = 0; i < pathspec.nr; i++) {
                        const char *path = pathspec.items[i].match;
@@ -567,7 +566,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 finish:
        if (write_locked_index(&the_index, &lock_file,
                               COMMIT_LOCK | SKIP_IF_UNCHANGED))
-               die(_("Unable to write new index file"));
+               die(_("unable to write new index file"));
 
        dir_clear(&dir);
        clear_pathspec(&pathspec);
index 4dfd714b910e40837a638b19167a25c06ed45124..e8fb27a8ef5d0505e14f53926af789282895d523 100644 (file)
@@ -10,7 +10,6 @@
 #include "config.h"
 #include "editor.h"
 #include "environment.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "hex.h"
 #include "parse-options.h"
@@ -24,7 +23,6 @@
 #include "refs.h"
 #include "commit.h"
 #include "diff.h"
-#include "diffcore.h"
 #include "unpack-trees.h"
 #include "branch.h"
 #include "object-name.h"
 #include "log-tree.h"
 #include "notes-utils.h"
 #include "rerere.h"
-#include "prompt.h"
 #include "mailinfo.h"
 #include "apply.h"
 #include "string-list.h"
-#include "packfile.h"
 #include "pager.h"
 #include "path.h"
 #include "repository.h"
@@ -92,9 +88,16 @@ enum signoff_type {
        SIGNOFF_EXPLICIT /* --signoff was set on the command-line */
 };
 
-enum show_patch_type {
-       SHOW_PATCH_RAW = 0,
-       SHOW_PATCH_DIFF = 1,
+enum resume_type {
+       RESUME_FALSE = 0,
+       RESUME_APPLY,
+       RESUME_RESOLVED,
+       RESUME_SKIP,
+       RESUME_ABORT,
+       RESUME_QUIT,
+       RESUME_SHOW_PATCH_RAW,
+       RESUME_SHOW_PATCH_DIFF,
+       RESUME_ALLOW_EMPTY,
 };
 
 enum empty_action {
@@ -1430,7 +1433,7 @@ static void write_index_patch(const struct am_state *state)
        rev_info.diffopt.close_file = 1;
        add_pending_object(&rev_info, &tree->object, "");
        diff_setup_done(&rev_info.diffopt);
-       run_diff_index(&rev_info, 1);
+       run_diff_index(&rev_info, DIFF_INDEX_CACHED);
        release_revisions(&rev_info);
 }
 
@@ -1593,7 +1596,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
                rev_info.diffopt.filter |= diff_filter_bit('M');
                add_pending_oid(&rev_info, "HEAD", &our_tree, 0);
                diff_setup_done(&rev_info.diffopt);
-               run_diff_index(&rev_info, 1);
+               run_diff_index(&rev_info, DIFF_INDEX_CACHED);
                release_revisions(&rev_info);
        }
 
@@ -2191,7 +2194,7 @@ static void am_abort(struct am_state *state)
        am_destroy(state);
 }
 
-static int show_patch(struct am_state *state, enum show_patch_type sub_mode)
+static int show_patch(struct am_state *state, enum resume_type resume_mode)
 {
        struct strbuf sb = STRBUF_INIT;
        const char *patch_path;
@@ -2206,11 +2209,11 @@ static int show_patch(struct am_state *state, enum show_patch_type sub_mode)
                return run_command(&cmd);
        }
 
-       switch (sub_mode) {
-       case SHOW_PATCH_RAW:
+       switch (resume_mode) {
+       case RESUME_SHOW_PATCH_RAW:
                patch_path = am_path(state, msgnum(state));
                break;
-       case SHOW_PATCH_DIFF:
+       case RESUME_SHOW_PATCH_DIFF:
                patch_path = am_path(state, "patch");
                break;
        default:
@@ -2257,56 +2260,25 @@ static int parse_opt_patchformat(const struct option *opt, const char *arg, int
        return 0;
 }
 
-enum resume_type {
-       RESUME_FALSE = 0,
-       RESUME_APPLY,
-       RESUME_RESOLVED,
-       RESUME_SKIP,
-       RESUME_ABORT,
-       RESUME_QUIT,
-       RESUME_SHOW_PATCH,
-       RESUME_ALLOW_EMPTY,
-};
-
-struct resume_mode {
-       enum resume_type mode;
-       enum show_patch_type sub_mode;
-};
-
 static int parse_opt_show_current_patch(const struct option *opt, const char *arg, int unset)
 {
        int *opt_value = opt->value;
-       struct resume_mode *resume = container_of(opt_value, struct resume_mode, mode);
 
+       BUG_ON_OPT_NEG(unset);
+
+       if (!arg)
+               *opt_value = opt->defval;
+       else if (!strcmp(arg, "raw"))
+               *opt_value = RESUME_SHOW_PATCH_RAW;
+       else if (!strcmp(arg, "diff"))
+               *opt_value = RESUME_SHOW_PATCH_DIFF;
        /*
         * Please update $__git_showcurrentpatch in git-completion.bash
         * when you add new options
         */
-       const char *valid_modes[] = {
-               [SHOW_PATCH_DIFF] = "diff",
-               [SHOW_PATCH_RAW] = "raw"
-       };
-       int new_value = SHOW_PATCH_RAW;
-
-       BUG_ON_OPT_NEG(unset);
-
-       if (arg) {
-               for (new_value = 0; new_value < ARRAY_SIZE(valid_modes); new_value++) {
-                       if (!strcmp(arg, valid_modes[new_value]))
-                               break;
-               }
-               if (new_value >= ARRAY_SIZE(valid_modes))
-                       return error(_("invalid value for '%s': '%s'"),
-                                    "--show-current-patch", arg);
-       }
-
-       if (resume->mode == RESUME_SHOW_PATCH && new_value != resume->sub_mode)
-               return error(_("options '%s=%s' and '%s=%s' "
-                                          "cannot be used together"),
-                                        "--show-current-patch", "--show-current-patch", arg, valid_modes[resume->sub_mode]);
-
-       resume->mode = RESUME_SHOW_PATCH;
-       resume->sub_mode = new_value;
+       else
+               return error(_("invalid value for '%s': '%s'"),
+                            "--show-current-patch", arg);
        return 0;
 }
 
@@ -2316,7 +2288,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
        int binary = -1;
        int keep_cr = -1;
        int patch_format = PATCH_FORMAT_UNKNOWN;
-       struct resume_mode resume = { .mode = RESUME_FALSE };
+       enum resume_type resume_mode = RESUME_FALSE;
        int in_progress;
        int ret = 0;
 
@@ -2387,27 +2359,27 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                        PARSE_OPT_NOARG),
                OPT_STRING(0, "resolvemsg", &state.resolvemsg, NULL,
                        N_("override error message when patch failure occurs")),
-               OPT_CMDMODE(0, "continue", &resume.mode,
+               OPT_CMDMODE(0, "continue", &resume_mode,
                        N_("continue applying patches after resolving a conflict"),
                        RESUME_RESOLVED),
-               OPT_CMDMODE('r', "resolved", &resume.mode,
+               OPT_CMDMODE('r', "resolved", &resume_mode,
                        N_("synonyms for --continue"),
                        RESUME_RESOLVED),
-               OPT_CMDMODE(0, "skip", &resume.mode,
+               OPT_CMDMODE(0, "skip", &resume_mode,
                        N_("skip the current patch"),
                        RESUME_SKIP),
-               OPT_CMDMODE(0, "abort", &resume.mode,
+               OPT_CMDMODE(0, "abort", &resume_mode,
                        N_("restore the original branch and abort the patching operation"),
                        RESUME_ABORT),
-               OPT_CMDMODE(0, "quit", &resume.mode,
+               OPT_CMDMODE(0, "quit", &resume_mode,
                        N_("abort the patching operation but keep HEAD where it is"),
                        RESUME_QUIT),
-               { OPTION_CALLBACK, 0, "show-current-patch", &resume.mode,
+               { OPTION_CALLBACK, 0, "show-current-patch", &resume_mode,
                  "(diff|raw)",
                  N_("show the patch being applied"),
                  PARSE_OPT_CMDMODE | PARSE_OPT_OPTARG | PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP,
-                 parse_opt_show_current_patch, RESUME_SHOW_PATCH },
-               OPT_CMDMODE(0, "allow-empty", &resume.mode,
+                 parse_opt_show_current_patch, RESUME_SHOW_PATCH_RAW },
+               OPT_CMDMODE(0, "allow-empty", &resume_mode,
                        N_("record the empty patch as an empty commit"),
                        RESUME_ALLOW_EMPTY),
                OPT_BOOL(0, "committer-date-is-author-date",
@@ -2419,7 +2391,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                { OPTION_STRING, 'S', "gpg-sign", &state.sign_commit, N_("key-id"),
                  N_("GPG-sign commits"),
                  PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
-               OPT_CALLBACK_F(STOP_ON_EMPTY_COMMIT, "empty", &state.empty_type, "{stop,drop,keep}",
+               OPT_CALLBACK_F(0, "empty", &state.empty_type, "(stop|drop|keep)",
                  N_("how to handle empty patches"),
                  PARSE_OPT_NONEG, am_option_parse_empty),
                OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,
@@ -2462,12 +2434,12 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                 *    intend to feed us a patch but wanted to continue
                 *    unattended.
                 */
-               if (argc || (resume.mode == RESUME_FALSE && !isatty(0)))
+               if (argc || (resume_mode == RESUME_FALSE && !isatty(0)))
                        die(_("previous rebase directory %s still exists but mbox given."),
                                state.dir);
 
-               if (resume.mode == RESUME_FALSE)
-                       resume.mode = RESUME_APPLY;
+               if (resume_mode == RESUME_FALSE)
+                       resume_mode = RESUME_APPLY;
 
                if (state.signoff == SIGNOFF_EXPLICIT)
                        am_append_signoff(&state);
@@ -2481,7 +2453,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                 * stray directories.
                 */
                if (file_exists(state.dir) && !state.rebasing) {
-                       if (resume.mode == RESUME_ABORT || resume.mode == RESUME_QUIT) {
+                       if (resume_mode == RESUME_ABORT || resume_mode == RESUME_QUIT) {
                                am_destroy(&state);
                                am_state_release(&state);
                                return 0;
@@ -2492,7 +2464,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                                state.dir);
                }
 
-               if (resume.mode)
+               if (resume_mode)
                        die(_("Resolve operation not in progress, we are not resuming."));
 
                for (i = 0; i < argc; i++) {
@@ -2510,7 +2482,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                strvec_clear(&paths);
        }
 
-       switch (resume.mode) {
+       switch (resume_mode) {
        case RESUME_FALSE:
                am_run(&state, 0);
                break;
@@ -2519,7 +2491,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                break;
        case RESUME_RESOLVED:
        case RESUME_ALLOW_EMPTY:
-               am_resolve(&state, resume.mode == RESUME_ALLOW_EMPTY ? 1 : 0);
+               am_resolve(&state, resume_mode == RESUME_ALLOW_EMPTY ? 1 : 0);
                break;
        case RESUME_SKIP:
                am_skip(&state);
@@ -2531,8 +2503,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
                am_rerere_clear();
                am_destroy(&state);
                break;
-       case RESUME_SHOW_PATCH:
-               ret = show_patch(&state, resume.sub_mode);
+       case RESUME_SHOW_PATCH_RAW:
+       case RESUME_SHOW_PATCH_DIFF:
+               ret = show_patch(&state, resume_mode);
                break;
        default:
                BUG("invalid resume value");
index c18b7ea5d3da4aa66d82c9fa0e911274308ad598..861a01910ca20bcb9bd18279ebd10f9d94032fe1 100644 (file)
@@ -1,6 +1,5 @@
 #include "builtin.h"
 #include "gettext.h"
-#include "parse-options.h"
 #include "repository.h"
 #include "apply.h"
 
index 90761fdfee0f58f0d2d8cca9c7b0bcd6e0ee7fe9..15ee1ec7bb765fe6307dc3f17cde238242169cc4 100644 (file)
@@ -9,7 +9,6 @@
 #include "parse-options.h"
 #include "pkt-line.h"
 #include "repository.h"
-#include "sideband.h"
 
 static void create_output_file(const char *output_file)
 {
index 65478ef40f54e35cbed33234209fc3fac8b4e99b..f69c3f7e43df4623be83509b7c9070d69072dc2a 100644 (file)
@@ -7,7 +7,6 @@
 #include "parse-options.h"
 #include "bisect.h"
 #include "refs.h"
-#include "dir.h"
 #include "strvec.h"
 #include "run-command.h"
 #include "oid-array.h"
@@ -17,7 +16,6 @@
 #include "revision.h"
 
 static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
-static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
 static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK")
 static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
 static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
@@ -26,7 +24,7 @@ static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT")
 static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
 
 #define BUILTIN_GIT_BISECT_START_USAGE \
-       N_("git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]" \
+       N_("git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]" \
           "    [--no-checkout] [--first-parent] [<bad> [<good>...]] [--]" \
           "    [<pathspec>...]")
 #define BUILTIN_GIT_BISECT_STATE_USAGE \
@@ -46,7 +44,7 @@ static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
 #define BUILTIN_GIT_BISECT_LOG_USAGE \
        "git bisect log"
 #define BUILTIN_GIT_BISECT_RUN_USAGE \
-       N_("git bisect run <cmd>...")
+       N_("git bisect run <cmd> [<arg>...]")
 
 static const char * const git_bisect_usage[] = {
        BUILTIN_GIT_BISECT_START_USAGE,
@@ -233,11 +231,10 @@ static int bisect_reset(const char *commit)
        struct strbuf branch = STRBUF_INIT;
 
        if (!commit) {
-               if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1) {
+               if (!strbuf_read_file(&branch, git_path_bisect_start(), 0))
                        printf(_("We are not bisecting.\n"));
-                       return 0;
-               }
-               strbuf_rtrim(&branch);
+               else
+                       strbuf_rtrim(&branch);
        } else {
                struct object_id oid;
 
@@ -246,7 +243,7 @@ static int bisect_reset(const char *commit)
                strbuf_addstr(&branch, commit);
        }
 
-       if (!ref_exists("BISECT_HEAD")) {
+       if (branch.len && !ref_exists("BISECT_HEAD")) {
                struct child_process cmd = CHILD_PROCESS_INIT;
 
                cmd.git_cmd = 1;
@@ -921,7 +918,6 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
        const char *state;
        int i, verify_expected = 1;
        struct object_id oid, expected;
-       struct strbuf buf = STRBUF_INIT;
        struct oid_array revs = OID_ARRAY_INIT;
 
        if (!argc)
@@ -976,10 +972,8 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
                oid_array_append(&revs, &commit->object.oid);
        }
 
-       if (strbuf_read_file(&buf, git_path_bisect_expected_rev(), 0) < the_hash_algo->hexsz ||
-           get_oid_hex(buf.buf, &expected) < 0)
+       if (read_ref("BISECT_EXPECTED_REV", &expected))
                verify_expected = 0; /* Ignore invalid file contents */
-       strbuf_release(&buf);
 
        for (i = 0; i < revs.nr; i++) {
                if (bisect_write(state, oid_to_hex(&revs.oid[i]), terms, 0)) {
@@ -988,7 +982,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
                }
                if (verify_expected && !oideq(&revs.oid[i], &expected)) {
                        unlink_or_warn(git_path_bisect_ancestors_ok());
-                       unlink_or_warn(git_path_bisect_expected_rev());
+                       delete_ref(NULL, "BISECT_EXPECTED_REV", NULL, REF_NO_DEREF);
                        verify_expected = 0;
                }
        }
index 9c987d656756e8f436e3b1cb818306097e402e4c..db1f56de61a434c3028869a2f4105c319ac6fd33 100644 (file)
@@ -25,7 +25,6 @@
 #include "userdiff.h"
 #include "line-range.h"
 #include "line-log.h"
-#include "dir.h"
 #include "progress.h"
 #include "object-name.h"
 #include "object-store-ll.h"
@@ -748,6 +747,8 @@ static int git_blame_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "blame.coloring")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (!strcmp(value, "repeatedLines")) {
                        coloring_mode |= OUTPUT_COLOR_LINE;
                } else if (!strcmp(value, "highlightRecent")) {
index 08da650516037e2e18b2e99831562db533111254..8c2305ad2c85586c960c986582f1d9e874a26a24 100644 (file)
 #include "remote.h"
 #include "parse-options.h"
 #include "branch.h"
-#include "diff.h"
 #include "path.h"
-#include "revision.h"
 #include "string-list.h"
 #include "column.h"
 #include "utf8.h"
-#include "wt-status.h"
 #include "ref-filter.h"
 #include "worktree.h"
 #include "help.h"
+#include "advice.h"
 #include "commit-reach.h"
 
 static const char * const builtin_branch_usage[] = {
@@ -45,7 +43,6 @@ static const char *head;
 static struct object_id head_oid;
 static int recurse_submodules = 0;
 static int submodule_propagate_branches = 0;
-static int omit_empty = 0;
 
 static int branch_use_color = -1;
 static char branch_colors[][COLOR_MAXLEN] = {
@@ -161,6 +158,8 @@ static int branch_merged(int kind, const char *name,
 
        merged = reference_rev ? repo_in_merge_bases(the_repository, rev,
                                                     reference_rev) : 0;
+       if (merged < 0)
+               exit(128);
 
        /*
         * After the safety valve is fully redefined to "check with
@@ -169,15 +168,19 @@ static int branch_merged(int kind, const char *name,
         * any of the following code, but during the transition period,
         * a gentle reminder is in order.
         */
-       if ((head_rev != reference_rev) &&
-           (head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0) != merged) {
-               if (merged)
+       if (head_rev != reference_rev) {
+               int expect = head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0;
+               if (expect < 0)
+                       exit(128);
+               if (expect == merged)
+                       ; /* okay */
+               else if (merged)
                        warning(_("deleting branch '%s' that has been merged to\n"
-                               "         '%s', but not yet merged to HEAD."),
+                               "         '%s', but not yet merged to HEAD"),
                                name, reference_name);
                else
                        warning(_("not deleting branch '%s' that is not yet merged to\n"
-                               "         '%s', even though it is merged to HEAD."),
+                               "         '%s', even though it is merged to HEAD"),
                                name, reference_name);
        }
        free(reference_name_to_free);
@@ -190,13 +193,14 @@ static int check_branch_commit(const char *branchname, const char *refname,
 {
        struct commit *rev = lookup_commit_reference(the_repository, oid);
        if (!force && !rev) {
-               error(_("Couldn't look up commit object for '%s'"), refname);
+               error(_("couldn't look up commit object for '%s'"), refname);
                return -1;
        }
        if (!force && !branch_merged(kinds, branchname, rev, head_rev)) {
-               error(_("The branch '%s' is not fully merged.\n"
-                     "If you are sure you want to delete it, "
-                     "run 'git branch -D %s'."), branchname, branchname);
+               error(_("the branch '%s' is not fully merged"), branchname);
+               advise_if_enabled(ADVICE_FORCE_DELETE_BRANCH,
+                                 _("If you are sure you want to delete it, "
+                                 "run 'git branch -D %s'"), branchname);
                return -1;
        }
        return 0;
@@ -207,7 +211,7 @@ static void delete_branch_config(const char *branchname)
        struct strbuf buf = STRBUF_INIT;
        strbuf_addf(&buf, "branch.%s", branchname);
        if (git_config_rename_section(buf.buf, NULL) < 0)
-               warning(_("Update of config-file failed"));
+               warning(_("update of config-file failed"));
        strbuf_release(&buf);
 }
 
@@ -260,8 +264,8 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
                if (kinds == FILTER_REFS_BRANCHES) {
                        const char *path;
                        if ((path = branch_checked_out(name))) {
-                               error(_("Cannot delete branch '%s' "
-                                       "checked out at '%s'"),
+                               error(_("cannot delete branch '%s' "
+                                       "used by worktree at '%s'"),
                                      bname.buf, path);
                                ret = 1;
                                continue;
@@ -275,7 +279,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
                                        &oid, &flags);
                if (!target) {
                        if (remote_branch) {
-                               error(_("remote-tracking branch '%s' not found."), bname.buf);
+                               error(_("remote-tracking branch '%s' not found"), bname.buf);
                        } else {
                                char *virtual_name = mkpathdup(fmt_remotes, bname.buf);
                                char *virtual_target = resolve_refdup(virtual_name,
@@ -290,7 +294,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
                                                "Did you forget --remote?"),
                                                bname.buf);
                                else
-                                       error(_("branch '%s' not found."), bname.buf);
+                                       error(_("branch '%s' not found"), bname.buf);
                                FREE_AND_NULL(virtual_target);
                        }
                        ret = 1;
@@ -438,8 +442,6 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
 {
        int i;
        struct ref_array array;
-       struct strbuf out = STRBUF_INIT;
-       struct strbuf err = STRBUF_INIT;
        int maxwidth = 0;
        const char *remote_prefix = "";
        char *to_free = NULL;
@@ -469,24 +471,27 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
        filter_ahead_behind(the_repository, format, &array);
        ref_array_sort(sorting, &array);
 
-       for (i = 0; i < array.nr; i++) {
-               strbuf_reset(&err);
-               strbuf_reset(&out);
-               if (format_ref_array_item(array.items[i], format, &out, &err))
-                       die("%s", err.buf);
-               if (column_active(colopts)) {
-                       assert(!filter->verbose && "--column and --verbose are incompatible");
-                        /* format to a string_list to let print_columns() do its job */
+       if (column_active(colopts)) {
+               struct strbuf out = STRBUF_INIT, err = STRBUF_INIT;
+
+               assert(!filter->verbose && "--column and --verbose are incompatible");
+
+               for (i = 0; i < array.nr; i++) {
+                       strbuf_reset(&err);
+                       strbuf_reset(&out);
+                       if (format_ref_array_item(array.items[i], format, &out, &err))
+                               die("%s", err.buf);
+
+                       /* format to a string_list to let print_columns() do its job */
                        string_list_append(output, out.buf);
-               } else {
-                       fwrite(out.buf, 1, out.len, stdout);
-                       if (out.len || !omit_empty)
-                               putchar('\n');
                }
+
+               strbuf_release(&err);
+               strbuf_release(&out);
+       } else {
+               print_formatted_ref_array(&array, format);
        }
 
-       strbuf_release(&err);
-       strbuf_release(&out);
        ref_array_clear(&array);
        free(to_free);
 }
@@ -518,11 +523,11 @@ static void reject_rebase_or_bisect_branch(struct worktree **worktrees,
                        continue;
 
                if (is_worktree_being_rebased(wt, target))
-                       die(_("Branch %s is being rebased at %s"),
+                       die(_("branch %s is being rebased at %s"),
                            target, wt->path);
 
                if (is_worktree_being_bisected(wt, target))
-                       die(_("Branch %s is being bisected at %s"),
+                       die(_("branch %s is being bisected at %s"),
                            target, wt->path);
        }
 }
@@ -577,8 +582,12 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
                 */
                if (ref_exists(oldref.buf))
                        recovery = 1;
-               else
-                       die(_("Invalid branch name: '%s'"), oldname);
+               else {
+                       int code = die_message(_("invalid branch name: '%s'"), oldname);
+                       advise_if_enabled(ADVICE_REF_SYNTAX,
+                                         _("See `man git check-ref-format`"));
+                       exit(code);
+               }
        }
 
        for (int i = 0; worktrees[i]; i++) {
@@ -594,9 +603,9 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
 
        if ((copy || !(oldref_usage & IS_HEAD)) && !ref_exists(oldref.buf)) {
                if (oldref_usage & IS_HEAD)
-                       die(_("No commit on branch '%s' yet."), oldname);
+                       die(_("no commit on branch '%s' yet"), oldname);
                else
-                       die(_("No branch named '%s'."), oldname);
+                       die(_("no branch named '%s'"), oldname);
        }
 
        /*
@@ -624,32 +633,32 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
 
        if (!copy && !(oldref_usage & IS_ORPHAN) &&
            rename_ref(oldref.buf, newref.buf, logmsg.buf))
-               die(_("Branch rename failed"));
+               die(_("branch rename failed"));
        if (copy && copy_existing_ref(oldref.buf, newref.buf, logmsg.buf))
-               die(_("Branch copy failed"));
+               die(_("branch copy failed"));
 
        if (recovery) {
                if (copy)
-                       warning(_("Created a copy of a misnamed branch '%s'"),
+                       warning(_("created a copy of a misnamed branch '%s'"),
                                interpreted_oldname);
                else
-                       warning(_("Renamed a misnamed branch '%s' away"),
+                       warning(_("renamed a misnamed branch '%s' away"),
                                interpreted_oldname);
        }
 
        if (!copy && (oldref_usage & IS_HEAD) &&
            replace_each_worktree_head_symref(worktrees, oldref.buf, newref.buf,
                                              logmsg.buf))
-               die(_("Branch renamed to %s, but HEAD is not updated!"), newname);
+               die(_("branch renamed to %s, but HEAD is not updated"), newname);
 
        strbuf_release(&logmsg);
 
        strbuf_addf(&oldsection, "branch.%s", interpreted_oldname);
        strbuf_addf(&newsection, "branch.%s", interpreted_newname);
        if (!copy && git_config_rename_section(oldsection.buf, newsection.buf) < 0)
-               die(_("Branch is renamed, but update of config-file failed"));
+               die(_("branch is renamed, but update of config-file failed"));
        if (copy && strcmp(interpreted_oldname, interpreted_newname) && git_config_copy_section(oldsection.buf, newsection.buf) < 0)
-               die(_("Branch is copied, but update of config-file failed"));
+               die(_("branch is copied, but update of config-file failed"));
        strbuf_release(&oldref);
        strbuf_release(&newref);
        strbuf_release(&oldsection);
@@ -737,7 +746,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                OPT_BIT('D', NULL, &delete, N_("delete branch (even if not merged)"), 2),
                OPT_BIT('m', "move", &rename, N_("move/rename a branch and its reflog"), 1),
                OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2),
-               OPT_BOOL(0, "omit-empty",  &omit_empty,
+               OPT_BOOL(0, "omit-empty",  &format.array_opts.omit_empty,
                        N_("do not output a newline after empty formatted refs")),
                OPT_BIT('c', "copy", &copy, N_("copy a branch and its reflog"), 1),
                OPT_BIT('C', NULL, &copy, N_("copy a branch, even if target exists"), 2),
@@ -767,13 +776,19 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
        if (argc == 2 && !strcmp(argv[1], "-h"))
                usage_with_options(builtin_branch_usage, options);
 
+       /*
+        * Try to set sort keys from config. If config does not set any,
+        * fall back on default (refname) sorting.
+        */
        git_config(git_branch_config, &sorting_options);
+       if (!sorting_options.nr)
+               string_list_append(&sorting_options, "refname");
 
        track = git_branch_track;
 
        head = resolve_refdup("HEAD", 0, &head_oid, NULL);
        if (!head)
-               die(_("Failed to resolve HEAD as a valid ref."));
+               die(_("failed to resolve HEAD as a valid ref"));
        if (!strcmp(head, "HEAD"))
                filter.detached = 1;
        else if (!skip_prefix(head, "refs/heads/", &head))
@@ -866,7 +881,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 
                if (!argc) {
                        if (filter.detached)
-                               die(_("Cannot give description to detached HEAD"));
+                               die(_("cannot give description to detached HEAD"));
                        branch_name = head;
                } else if (argc == 1) {
                        strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
@@ -878,8 +893,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
                if (!ref_exists(branch_ref.buf))
                        error((!argc || branch_checked_out(branch_ref.buf))
-                             ? _("No commit on branch '%s' yet.")
-                             : _("No branch named '%s'."),
+                             ? _("no commit on branch '%s' yet")
+                             : _("no branch named '%s'"),
                              branch_name);
                else if (!edit_branch_description(branch_name))
                        ret = 0; /* happy */
@@ -892,8 +907,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                if (!argc)
                        die(_("branch name required"));
                else if ((argc == 1) && filter.detached)
-                       die(copy? _("cannot copy the current branch while not on any.")
-                               : _("cannot rename the current branch while not on any."));
+                       die(copy? _("cannot copy the current branch while not on any")
+                               : _("cannot rename the current branch while not on any"));
                else if (argc == 1)
                        copy_or_rename_branch(head, argv[0], copy, copy + rename > 1);
                else if (argc == 2)
@@ -916,14 +931,14 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                if (!branch) {
                        if (!argc || !strcmp(argv[0], "HEAD"))
                                die(_("could not set upstream of HEAD to %s when "
-                                     "it does not point to any branch."),
+                                     "it does not point to any branch"),
                                    new_upstream);
                        die(_("no such branch '%s'"), argv[0]);
                }
 
                if (!ref_exists(branch->refname)) {
                        if (!argc || branch_checked_out(branch->refname))
-                               die(_("No commit on branch '%s' yet."), branch->name);
+                               die(_("no commit on branch '%s' yet"), branch->name);
                        die(_("branch '%s' does not exist"), branch->name);
                }
 
@@ -946,12 +961,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                if (!branch) {
                        if (!argc || !strcmp(argv[0], "HEAD"))
                                die(_("could not unset upstream of HEAD when "
-                                     "it does not point to any branch."));
+                                     "it does not point to any branch"));
                        die(_("no such branch '%s'"), argv[0]);
                }
 
                if (!branch_has_merge_config(branch))
-                       die(_("Branch '%s' has no upstream information"), branch->name);
+                       die(_("branch '%s' has no upstream information"), branch->name);
 
                strbuf_reset(&buf);
                strbuf_addf(&buf, "branch.%s.remote", branch->name);
@@ -965,11 +980,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                const char *start_name = argc == 2 ? argv[1] : head;
 
                if (filter.kind != FILTER_REFS_BRANCHES)
-                       die(_("The -a, and -r, options to 'git branch' do not take a branch name.\n"
+                       die(_("the -a, and -r, options to 'git branch' do not take a branch name.\n"
                                  "Did you mean to use: -a|-r --list <pattern>?"));
 
                if (track == BRANCH_TRACK_OVERRIDE)
-                       die(_("the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead."));
+                       die(_("the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead"));
 
                if (recurse_submodules) {
                        create_branches_recursively(the_repository, branch_name,
index d2ae5c305db82cda78851196411f6437f4abbda9..25f860a0d973caca44593cb28919e47afb13089d 100644 (file)
@@ -64,7 +64,8 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit)
 }
 
 static const char * const bugreport_usage[] = {
-       N_("git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+       N_("git bugreport [(-o | --output-directory) <path>]\n"
+          "              [(-s | --suffix) <format> | --no-suffix]\n"
           "              [--diagnose[=<mode>]]"),
        NULL
 };
@@ -126,6 +127,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
        argc = parse_options(argc, argv, prefix, bugreport_options,
                             bugreport_usage, 0);
 
+       if (argc) {
+               error(_("unknown argument `%s'"), argv[0]);
+               usage(bugreport_usage[0]);
+       }
+
        /* Prepare the path to put the result */
        prefixed_filename = prefix_filename(prefix,
                                            option_output ? option_output : "");
@@ -133,8 +139,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
        strbuf_complete(&report_path, '/');
        output_path_len = report_path.len;
 
-       strbuf_addstr(&report_path, "git-bugreport-");
-       strbuf_addftime(&report_path, option_suffix, localtime_r(&now, &tm), 0, 0);
+       strbuf_addstr(&report_path, "git-bugreport");
+       if (option_suffix) {
+               strbuf_addch(&report_path, '-');
+               strbuf_addftime(&report_path, option_suffix, localtime_r(&now, &tm), 0, 0);
+       }
        strbuf_addstr(&report_path, ".txt");
 
        switch (safe_create_leading_directories(report_path.buf)) {
index e615d1f8e0da2605ab026a3fe2ffc3c8c1b4fbf5..3f5ce7d34c3c05b7a49b7ce08b8a9433ece57254 100644 (file)
@@ -15,7 +15,6 @@
 #include "parse-options.h"
 #include "userdiff.h"
 #include "streaming.h"
-#include "tree-walk.h"
 #include "oid-array.h"
 #include "packfile.h"
 #include "object-file.h"
@@ -225,6 +224,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                                                                     &type,
                                                                     &size);
                                const char *target;
+
+                               if (!buffer)
+                                       die(_("unable to read %s"), oid_to_hex(&oid));
+
                                if (!skip_prefix(buffer, "object ", &target) ||
                                    get_oid_hex_algop(target, &blob_oid,
                                                      &hash_algos[oid.algo]))
@@ -421,6 +424,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
 
                contents = repo_read_object_file(the_repository, oid, &type,
                                                 &size);
+               if (!contents)
+                       die("object %s disappeared", oid_to_hex(oid));
 
                if (use_mailmap) {
                        size_t s = size;
@@ -428,8 +433,6 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
                        size = cast_size_t_to_ulong(s);
                }
 
-               if (!contents)
-                       die("object %s disappeared", oid_to_hex(oid));
                if (type != data->type)
                        die("object %s changed type!?", oid_to_hex(oid));
                if (data->info.sizep && size != data->size && !use_mailmap)
@@ -486,6 +489,8 @@ static void batch_object_write(const char *obj_name,
 
                        buf = repo_read_object_file(the_repository, &data->oid, &data->type,
                                                    &data->size);
+                       if (!buf)
+                               die(_("unable to read %s"), oid_to_hex(&data->oid));
                        buf = replace_idents_using_mailmap(buf, &s);
                        data->size = cast_size_t_to_ulong(s);
 
@@ -928,11 +933,11 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
                N_("git cat-file <type> <object>"),
                N_("git cat-file (-e | -p) <object>"),
                N_("git cat-file (-t | -s) [--allow-unknown-type] <object>"),
+               N_("git cat-file (--textconv | --filters)\n"
+                  "             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"),
                N_("git cat-file (--batch | --batch-check | --batch-command) [--batch-all-objects]\n"
                   "             [--buffer] [--follow-symlinks] [--unordered]\n"
                   "             [--textconv | --filters] [-Z]"),
-               N_("git cat-file (--textconv | --filters)\n"
-                  "             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"),
                NULL
        };
        const struct option options[] = {
index b22ff748c3e20819887084f1175015a9a6078815..c1da1d184e9f6e24687f751bc67f88641f7083b0 100644 (file)
@@ -122,6 +122,9 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
        argc = parse_options(argc, argv, prefix, check_attr_options,
                             check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
 
+       prepare_repo_settings(the_repository);
+       the_repository->settings.command_requires_full_index = 0;
+
        if (repo_read_index(the_repository) < 0) {
                die("invalid cache");
        }
index f62f13f2b5324e15f982071f73b24281d2d9637a..2e086a204dc7b19271cdeb2733c62a64066ab304 100644 (file)
@@ -7,7 +7,6 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "config.h"
-#include "dir.h"
 #include "gettext.h"
 #include "lockfile.h"
 #include "quote.h"
@@ -24,7 +23,7 @@
 static int nul_term_line;
 static int checkout_stage; /* default to checkout stage0 */
 static int ignore_skip_worktree; /* default to 0 */
-static int to_tempfile;
+static int to_tempfile = -1;
 static char topath[4][TEMPORARY_FILENAME_LENGTH + 1];
 
 static struct checkout state = CHECKOUT_INIT;
@@ -193,15 +192,16 @@ static const char * const builtin_checkout_index_usage[] = {
 static int option_parse_stage(const struct option *opt,
                              const char *arg, int unset)
 {
+       int *stage = opt->value;
+
        BUG_ON_OPT_NEG(unset);
 
        if (!strcmp(arg, "all")) {
-               to_tempfile = 1;
-               checkout_stage = CHECKOUT_ALL;
+               *stage = CHECKOUT_ALL;
        } else {
                int ch = arg[0];
                if ('1' <= ch && ch <= '3')
-                       checkout_stage = arg[0] - '0';
+                       *stage = arg[0] - '0';
                else
                        die(_("stage should be between 1 and 3 or all"));
        }
@@ -239,7 +239,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
                        N_("write the content to temporary files")),
                OPT_STRING(0, "prefix", &state.base_dir, N_("string"),
                        N_("when creating files, prepend <string>")),
-               OPT_CALLBACK_F(0, "stage", NULL, "(1|2|3|all)",
+               OPT_CALLBACK_F(0, "stage", &checkout_stage, "(1|2|3|all)",
                        N_("copy out the files from named stage"),
                        PARSE_OPT_NONEG, option_parse_stage),
                OPT_END()
@@ -269,6 +269,12 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
                state.base_dir = "";
        state.base_dir_len = strlen(state.base_dir);
 
+       if (to_tempfile < 0)
+               to_tempfile = (checkout_stage == CHECKOUT_ALL);
+       if (!to_tempfile && checkout_stage == CHECKOUT_ALL)
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--stage=all", "--no-temp");
+
        /*
         * when --prefix is specified we do not want to update cache.
         */
index 03eff73fd031855db1dbd34bfcc1852bbe899f10..2e8b0d18f445b1307e264634f69c8ce0a3a5c68a 100644 (file)
@@ -1,7 +1,6 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "advice.h"
-#include "blob.h"
 #include "branch.h"
 #include "cache-tree.h"
 #include "checkout.h"
 #include "remote.h"
 #include "resolve-undo.h"
 #include "revision.h"
-#include "run-command.h"
 #include "setup.h"
 #include "submodule.h"
-#include "submodule-config.h"
 #include "symlinks.h"
 #include "trace2.h"
 #include "tree.h"
@@ -523,6 +520,15 @@ static int checkout_paths(const struct checkout_opts *opts,
                            "--merge", "--conflict", "--staged");
        }
 
+       /*
+        * recreating unmerged index entries and writing out data from
+        * unmerged index entries would make no sense when checking out
+        * of a tree-ish.
+        */
+       if ((opts->merge || opts->writeout_stage) && opts->source_tree)
+               die(_("'%s', '%s', or '%s' cannot be used when checking out of a tree"),
+                   "--merge", "--ours", "--theirs");
+
        if (opts->patch_mode) {
                enum add_p_mode patch_mode;
                const char *rev = new_branch_info->name;
@@ -560,6 +566,8 @@ static int checkout_paths(const struct checkout_opts *opts,
 
        if (opts->source_tree)
                read_tree_some(opts->source_tree, &opts->pathspec);
+       if (opts->merge)
+               unmerge_index(&the_index, &opts->pathspec, CE_MATCHED);
 
        ps_matched = xcalloc(opts->pathspec.nr, 1);
 
@@ -583,10 +591,6 @@ static int checkout_paths(const struct checkout_opts *opts,
        }
        free(ps_matched);
 
-       /* "checkout -m path" to recreate conflicted state */
-       if (opts->merge)
-               unmerge_marked_index(&the_index);
-
        /* Any unmerged paths? */
        for (pos = 0; pos < the_index.cache_nr; pos++) {
                const struct cache_entry *ce = the_index.cache[pos];
@@ -700,7 +704,8 @@ static int reset_tree(struct tree *tree, const struct checkout_opts *o,
        init_checkout_metadata(&opts.meta, info->refname,
                               info->commit ? &info->commit->object.oid : null_oid(),
                               NULL);
-       parse_tree(tree);
+       if (parse_tree(tree) < 0)
+               return 128;
        init_tree_desc(&tree_desc, &tree->object.oid, tree->buffer, tree->size);
        switch (unpack_trees(1, &tree_desc, &opts)) {
        case -2:
@@ -779,9 +784,15 @@ static int merge_working_tree(const struct checkout_opts *opts,
                if (new_branch_info->commit)
                        BUG("'switch --orphan' should never accept a commit as starting point");
                new_tree = parse_tree_indirect(the_hash_algo->empty_tree);
-       } else
+               if (!new_tree)
+                       BUG("unable to read empty tree");
+       } else {
                new_tree = repo_get_commit_tree(the_repository,
                                                new_branch_info->commit);
+               if (!new_tree)
+                       return error(_("unable to read tree (%s)"),
+                                    oid_to_hex(&new_branch_info->commit->object.oid));
+       }
        if (opts->discard_changes) {
                ret = reset_tree(new_tree, opts, 1, writeout_error, new_branch_info);
                if (ret)
@@ -817,7 +828,8 @@ static int merge_working_tree(const struct checkout_opts *opts,
 
                init_tree_desc(&trees[0], &tree->object.oid,
                               tree->buffer, tree->size);
-               parse_tree(new_tree);
+               if (parse_tree(new_tree) < 0)
+                       exit(128);
                tree = new_tree;
                init_tree_desc(&trees[1], &tree->object.oid,
                               tree->buffer, tree->size);
@@ -1197,6 +1209,8 @@ static int git_checkout_config(const char *var, const char *value,
        struct checkout_opts *opts = cb;
 
        if (!strcmp(var, "diff.ignoresubmodules")) {
+               if (!value)
+                       return config_error_nonbool(var);
                handle_ignore_submodules_arg(&opts->diff_options, value);
                return 0;
        }
@@ -1220,7 +1234,9 @@ static void setup_new_branch_info_and_source_tree(
        struct tree **source_tree = &opts->source_tree;
        struct object_id branch_rev;
 
-       new_branch_info->name = xstrdup(arg);
+       /* treat '@' as a shortcut for 'HEAD' */
+       new_branch_info->name = !strcmp(arg, "@") ? xstrdup("HEAD") :
+                                                   xstrdup(arg);
        setup_branch_path(new_branch_info);
 
        if (!check_refname_format(new_branch_info->path, 0) &&
@@ -1234,10 +1250,15 @@ static void setup_new_branch_info_and_source_tree(
        if (!new_branch_info->commit) {
                /* not a commit */
                *source_tree = parse_tree_indirect(rev);
+               if (!*source_tree)
+                       die(_("unable to read tree (%s)"), oid_to_hex(rev));
        } else {
                parse_commit_or_die(new_branch_info->commit);
                *source_tree = repo_get_commit_tree(the_repository,
                                                    new_branch_info->commit);
+               if (!*source_tree)
+                       die(_("unable to read tree (%s)"),
+                           oid_to_hex(&new_branch_info->commit->object.oid));
        }
 }
 
@@ -1511,6 +1532,26 @@ static void die_if_some_operation_in_progress(void)
        wt_status_state_free_buffers(&state);
 }
 
+/*
+ * die if attempting to checkout an existing branch that is in use
+ * in another worktree, unless ignore-other-wortrees option is given.
+ * The check is bypassed when the branch is already the current one,
+ * as it will not make things any worse.
+ */
+static void die_if_switching_to_a_branch_in_use(struct checkout_opts *opts,
+                                               const char *full_ref)
+{
+       int flags;
+       char *head_ref;
+
+       if (opts->ignore_other_worktrees)
+               return;
+       head_ref = resolve_refdup("HEAD", 0, NULL, &flags);
+       if (head_ref && (!(flags & REF_ISSYMREF) || strcmp(head_ref, full_ref)))
+               die_if_checked_out(full_ref, 1);
+       free(head_ref);
+}
+
 static int checkout_branch(struct checkout_opts *opts,
                           struct branch_info *new_branch_info)
 {
@@ -1571,14 +1612,15 @@ static int checkout_branch(struct checkout_opts *opts,
        if (!opts->can_switch_when_in_progress)
                die_if_some_operation_in_progress();
 
-       if (new_branch_info->path && !opts->force_detach && !opts->new_branch &&
-           !opts->ignore_other_worktrees) {
-               int flag;
-               char *head_ref = resolve_refdup("HEAD", 0, NULL, &flag);
-               if (head_ref &&
-                   (!(flag & REF_ISSYMREF) || strcmp(head_ref, new_branch_info->path)))
-                       die_if_checked_out(new_branch_info->path, 1);
-               free(head_ref);
+       /* "git checkout <branch>" */
+       if (new_branch_info->path && !opts->force_detach && !opts->new_branch)
+               die_if_switching_to_a_branch_in_use(opts, new_branch_info->path);
+
+       /* "git checkout -B <branch>" */
+       if (opts->new_branch_force) {
+               char *full_ref = xstrfmt("refs/heads/%s", opts->new_branch);
+               die_if_switching_to_a_branch_in_use(opts, full_ref);
+               free(full_ref);
        }
 
        if (!new_branch_info->commit && opts->new_branch) {
@@ -1622,7 +1664,7 @@ static struct option *add_common_switch_branch_options(
                        parse_opt_tracking_mode),
                OPT__FORCE(&opts->force, N_("force checkout (throw away local modifications)"),
                           PARSE_OPT_NOCOMPLETE),
-               OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unparented branch")),
+               OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unborn branch")),
                OPT_BOOL_F(0, "overwrite-ignore", &opts->overwrite_ignore,
                           N_("update ignored files (default)"),
                           PARSE_OPT_NOCOMPLETE),
@@ -1662,10 +1704,11 @@ static char cb_option = 'b';
 
 static int checkout_main(int argc, const char **argv, const char *prefix,
                         struct checkout_opts *opts, struct option *options,
-                        const char * const usagestr[],
-                        struct branch_info *new_branch_info)
+                        const char * const usagestr[])
 {
        int parseopt_flags = 0;
+       struct branch_info new_branch_info = { 0 };
+       int ret;
 
        opts->overwrite_ignore = 1;
        opts->prefix = prefix;
@@ -1781,7 +1824,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                        opts->track == BRANCH_TRACK_UNSPECIFIED &&
                        !opts->new_branch;
                int n = parse_branchname_arg(argc, argv, dwim_ok,
-                                            new_branch_info, opts, &rev);
+                                            &new_branch_info, opts, &rev);
                argv += n;
                argc -= n;
        } else if (!opts->accept_ref && opts->from_treeish) {
@@ -1790,7 +1833,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                if (repo_get_oid_mb(the_repository, opts->from_treeish, &rev))
                        die(_("could not resolve %s"), opts->from_treeish);
 
-               setup_new_branch_info_and_source_tree(new_branch_info,
+               setup_new_branch_info_and_source_tree(&new_branch_info,
                                                      opts, &rev,
                                                      opts->from_treeish);
 
@@ -1810,7 +1853,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                 * Try to give more helpful suggestion.
                 * new_branch && argc > 1 will be caught later.
                 */
-               if (opts->new_branch && argc == 1 && !new_branch_info->commit)
+               if (opts->new_branch && argc == 1 && !new_branch_info.commit)
                        die(_("'%s' is not a commit and a branch '%s' cannot be created from it"),
                                argv[0], opts->new_branch);
 
@@ -1860,9 +1903,16 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
        }
 
        if (opts->patch_mode || opts->pathspec.nr)
-               return checkout_paths(opts, new_branch_info);
+               ret = checkout_paths(opts, &new_branch_info);
        else
-               return checkout_branch(opts, new_branch_info);
+               ret = checkout_branch(opts, &new_branch_info);
+
+       branch_info_release(&new_branch_info);
+       clear_pathspec(&opts->pathspec);
+       free(opts->pathspec_from_file);
+       free(options);
+
+       return ret;
 }
 
 int cmd_checkout(int argc, const char **argv, const char *prefix)
@@ -1880,8 +1930,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "overlay", &opts.overlay_mode, N_("use overlay mode (default)")),
                OPT_END()
        };
-       int ret;
-       struct branch_info new_branch_info = { 0 };
 
        memset(&opts, 0, sizeof(opts));
        opts.dwim_new_local_branch = 1;
@@ -1911,13 +1959,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
        options = add_common_switch_branch_options(&opts, options);
        options = add_checkout_path_options(&opts, options);
 
-       ret = checkout_main(argc, argv, prefix, &opts,
-                           options, checkout_usage, &new_branch_info);
-       branch_info_release(&new_branch_info);
-       clear_pathspec(&opts.pathspec);
-       free(opts.pathspec_from_file);
-       FREE_AND_NULL(options);
-       return ret;
+       return checkout_main(argc, argv, prefix, &opts, options,
+                            checkout_usage);
 }
 
 int cmd_switch(int argc, const char **argv, const char *prefix)
@@ -1935,8 +1978,6 @@ int cmd_switch(int argc, const char **argv, const char *prefix)
                         N_("throw away local modifications")),
                OPT_END()
        };
-       int ret;
-       struct branch_info new_branch_info = { 0 };
 
        memset(&opts, 0, sizeof(opts));
        opts.dwim_new_local_branch = 1;
@@ -1955,11 +1996,8 @@ int cmd_switch(int argc, const char **argv, const char *prefix)
 
        cb_option = 'c';
 
-       ret = checkout_main(argc, argv, prefix, &opts,
-                           options, switch_branch_usage, &new_branch_info);
-       branch_info_release(&new_branch_info);
-       FREE_AND_NULL(options);
-       return ret;
+       return checkout_main(argc, argv, prefix, &opts, options,
+                            switch_branch_usage);
 }
 
 int cmd_restore(int argc, const char **argv, const char *prefix)
@@ -1978,8 +2016,6 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "overlay", &opts.overlay_mode, N_("use overlay mode")),
                OPT_END()
        };
-       int ret;
-       struct branch_info new_branch_info = { 0 };
 
        memset(&opts, 0, sizeof(opts));
        opts.accept_ref = 0;
@@ -1994,9 +2030,6 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
        options = add_common_options(&opts, options);
        options = add_checkout_path_options(&opts, options);
 
-       ret = checkout_main(argc, argv, prefix, &opts,
-                           options, restore_usage, &new_branch_info);
-       branch_info_release(&new_branch_info);
-       FREE_AND_NULL(options);
-       return ret;
+       return checkout_main(argc, argv, prefix, &opts, options,
+                            restore_usage);
 }
index 49c224e626d61819a633252572d3e7f3b32ffd62..29efe841537b341776bdca2fc70f3df4d333e066 100644 (file)
@@ -25,7 +25,7 @@
 #include "help.h"
 #include "prompt.h"
 
-static int force = -1; /* unset */
+static int require_force = -1; /* unset */
 static int interactive;
 static struct string_list del_list = STRING_LIST_INIT_DUP;
 static unsigned int colopts;
@@ -128,7 +128,7 @@ static int git_clean_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "clean.requireforce")) {
-               force = !git_config_bool(var, value);
+               require_force = git_config_bool(var, value);
                return 0;
        }
 
@@ -920,7 +920,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 {
        int i, res;
        int dry_run = 0, remove_directories = 0, quiet = 0, ignored = 0;
-       int ignored_only = 0, config_set = 0, errors = 0, gone = 1;
+       int ignored_only = 0, force = 0, errors = 0, gone = 1;
        int rm_flags = REMOVE_DIR_KEEP_NESTED_GIT;
        struct strbuf abs_path = STRBUF_INIT;
        struct dir_struct dir = DIR_INIT;
@@ -946,22 +946,12 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
        };
 
        git_config(git_clean_config, NULL);
-       if (force < 0)
-               force = 0;
-       else
-               config_set = 1;
 
        argc = parse_options(argc, argv, prefix, options, builtin_clean_usage,
                             0);
 
-       if (!interactive && !dry_run && !force) {
-               if (config_set)
-                       die(_("clean.requireForce set to true and neither -i, -n, nor -f given; "
-                                 "refusing to clean"));
-               else
-                       die(_("clean.requireForce defaults to true and neither -i, -n, nor -f given;"
-                                 " refusing to clean"));
-       }
+       if (require_force != 0 && !force && !interactive && !dry_run)
+               die(_("clean.requireForce is true and -f not given: refusing to clean"));
 
        if (force > 1)
                rm_flags = 0;
@@ -971,7 +961,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
        dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
 
        if (ignored && ignored_only)
-               die(_("-x and -X cannot be used together"));
+               die(_("options '%s' and '%s' cannot be used together"), "-x", "-X");
        if (!ignored)
                setup_standard_excludes(&dir);
        if (ignored_only)
index 79ceefb9399501be5ec6cb8bfcd2a7269de22921..74ec14542e811d10f0dc88c9bfe935fc41af1491 100644 (file)
@@ -19,7 +19,6 @@
 #include "hex.h"
 #include "lockfile.h"
 #include "parse-options.h"
-#include "fetch-pack.h"
 #include "refs.h"
 #include "refspec.h"
 #include "object-file.h"
@@ -72,6 +71,7 @@ static char *remote_name = NULL;
 static char *option_branch = NULL;
 static struct string_list option_not = STRING_LIST_INIT_NODUP;
 static const char *real_git_dir;
+static const char *ref_format;
 static char *option_upload_pack = "git-upload-pack";
 static int option_verbosity;
 static int option_progress = -1;
@@ -116,7 +116,7 @@ static struct option builtin_clone_options[] = {
        OPT_HIDDEN_BOOL(0, "naked", &option_bare,
                        N_("create a bare repository")),
        OPT_BOOL(0, "mirror", &option_mirror,
-                N_("create a mirror repository (implies bare)")),
+                N_("create a mirror repository (implies --bare)")),
        OPT_BOOL('l', "local", &option_local,
                N_("to clone from a local repository")),
        OPT_BOOL(0, "no-hardlinks", &option_no_hardlinks,
@@ -157,6 +157,8 @@ static struct option builtin_clone_options[] = {
                    N_("any cloned submodules will be shallow")),
        OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
                   N_("separate git dir from working tree")),
+       OPT_STRING(0, "ref-format", &ref_format, N_("format"),
+                  N_("specify the reference format to use")),
        OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
                        N_("set config inside the new repository")),
        OPT_STRING_LIST(0, "server-option", &server_options,
@@ -736,7 +738,8 @@ static int checkout(int submodule_progress, int filter_submodules)
        tree = parse_tree_indirect(&oid);
        if (!tree)
                die(_("unable to parse commit %s"), oid_to_hex(&oid));
-       parse_tree(tree);
+       if (parse_tree(tree) < 0)
+               exit(128);
        init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
        if (unpack_trees(1, &t, &opts) < 0)
                die(_("unable to checkout working tree"));
@@ -791,6 +794,8 @@ static int git_clone_config(const char *k, const char *v,
                            const struct config_context *ctx, void *cb)
 {
        if (!strcmp(k, "clone.defaultremotename")) {
+               if (!v)
+                       return config_error_nonbool(k);
                free(remote_name);
                remote_name = xstrdup(v);
        }
@@ -922,6 +927,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        struct ref *mapped_refs = NULL;
        const struct ref *ref;
        struct strbuf key = STRBUF_INIT;
+       struct strbuf buf = STRBUF_INIT;
        struct strbuf branch_top = STRBUF_INIT, reflog_msg = STRBUF_INIT;
        struct transport *transport = NULL;
        const char *src_ref_prefix = "refs/heads/";
@@ -930,6 +936,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        int submodule_progress;
        int filter_submodules = 0;
        int hash_algo;
+       unsigned int ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
        const int do_not_override_repo_unix_permissions = -1;
 
        struct transport_ls_refs_options transport_ls_refs_options =
@@ -955,6 +962,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        if (option_single_branch == -1)
                option_single_branch = deepen ? 1 : 0;
 
+       if (ref_format) {
+               ref_storage_format = ref_storage_format_by_name(ref_format);
+               if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+                       die(_("unknown ref storage format '%s'"), ref_format);
+       }
+
        if (option_mirror)
                option_bare = 1;
 
@@ -965,7 +978,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        }
 
        if (bundle_uri && deepen)
-               die(_("--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-exclude"));
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--bundle-uri",
+                   "--depth/--shallow-since/--shallow-exclude");
 
        repo_name = argv[0];
 
@@ -1097,14 +1112,65 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                }
        }
 
-       init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN, NULL,
-               do_not_override_repo_unix_permissions, INIT_DB_QUIET);
+       /*
+        * Initialize the repository, but skip initializing the reference
+        * database. We do not yet know about the object format of the
+        * repository, and reference backends may persist that information into
+        * their on-disk data structures.
+        */
+       init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN,
+               ref_storage_format, NULL,
+               do_not_override_repo_unix_permissions, INIT_DB_QUIET | INIT_DB_SKIP_REFDB);
 
        if (real_git_dir) {
                free((char *)git_dir);
                git_dir = real_git_dir;
        }
 
+       /*
+        * We have a chicken-and-egg situation between initializing the refdb
+        * and spawning transport helpers:
+        *
+        *   - Initializing the refdb requires us to know about the object
+        *     format. We thus have to spawn the transport helper to learn
+        *     about it.
+        *
+        *   - The transport helper may want to access the Git repository. But
+        *     because the refdb has not been initialized, we don't have "HEAD"
+        *     or "refs/". Thus, the helper cannot find the Git repository.
+        *
+        * Ideally, we would have structured the helper protocol such that it's
+        * mandatory for the helper to first announce its capabilities without
+        * yet assuming a fully initialized repository. Like that, we could
+        * have added a "lazy-refdb-init" capability that announces whether the
+        * helper is ready to handle not-yet-initialized refdbs. If any helper
+        * didn't support them, we would have fully initialized the refdb with
+        * the SHA1 object format, but later on bailed out if we found out that
+        * the remote repository used a different object format.
+        *
+        * But we didn't, and thus we use the following workaround to partially
+        * initialize the repository's refdb such that it can be discovered by
+        * Git commands. To do so, we:
+        *
+        *   - Create an invalid HEAD ref pointing at "refs/heads/.invalid".
+        *
+        *   - Create the "refs/" directory.
+        *
+        *   - Set up the ref storage format and repository version as
+        *     required.
+        *
+        * This is sufficient for Git commands to discover the Git directory.
+        */
+       initialize_repository_version(GIT_HASH_UNKNOWN,
+                                     the_repository->ref_storage_format, 1);
+
+       strbuf_addf(&buf, "%s/HEAD", git_dir);
+       write_file(buf.buf, "ref: refs/heads/.invalid");
+
+       strbuf_reset(&buf);
+       strbuf_addf(&buf, "%s/refs", git_dir);
+       safe_create_dir(buf.buf, 1);
+
        /*
         * additional config can be injected with -c, make sure it's included
         * after init_db, which clears the entire config environment.
@@ -1185,10 +1251,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        if (option_required_reference.nr || option_optional_reference.nr)
                setup_reference();
 
-       if (option_sparse_checkout && git_sparse_checkout_init(dir))
-               return 1;
-
-       remote = remote_get(remote_name);
+       remote = remote_get_early(remote_name);
 
        refspec_appendf(&remote->fetch, "+%s*:%s*", src_ref_prefix,
                        branch_top.buf);
@@ -1266,6 +1329,27 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        if (transport->smart_options && !deepen && !filter_options.choice)
                transport->smart_options->check_self_contained_and_connected = 1;
 
+       strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD");
+       refspec_ref_prefixes(&remote->fetch,
+                            &transport_ls_refs_options.ref_prefixes);
+       if (option_branch)
+               expand_ref_prefix(&transport_ls_refs_options.ref_prefixes,
+                                 option_branch);
+       if (!option_no_tags)
+               strvec_push(&transport_ls_refs_options.ref_prefixes,
+                           "refs/tags/");
+
+       refs = transport_get_remote_refs(transport, &transport_ls_refs_options);
+
+       /*
+        * Now that we know what algorithm the remote side is using, let's set
+        * ours to the same thing.
+        */
+       hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
+       initialize_repository_version(hash_algo, the_repository->ref_storage_format, 1);
+       repo_set_hash_algo(the_repository, hash_algo);
+       create_reference_database(the_repository->ref_storage_format, NULL, 1);
+
        /*
         * Before fetching from the remote, download and install bundle
         * data from the --bundle-uri option.
@@ -1281,24 +1365,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                                bundle_uri);
                else if (has_heuristic)
                        git_config_set_gently("fetch.bundleuri", bundle_uri);
-       }
-
-       strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD");
-       refspec_ref_prefixes(&remote->fetch,
-                            &transport_ls_refs_options.ref_prefixes);
-       if (option_branch)
-               expand_ref_prefix(&transport_ls_refs_options.ref_prefixes,
-                                 option_branch);
-       if (!option_no_tags)
-               strvec_push(&transport_ls_refs_options.ref_prefixes,
-                           "refs/tags/");
-
-       refs = transport_get_remote_refs(transport, &transport_ls_refs_options);
-
-       if (refs)
-               mapped_refs = wanted_peer_refs(refs, &remote->fetch);
-
-       if (!bundle_uri) {
+       } else {
                /*
                * Populate transport->got_remote_bundle_uri and
                * transport->bundle_uri. We might get nothing.
@@ -1319,13 +1386,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                }
        }
 
-               /*
-                * Now that we know what algorithm the remote side is using,
-                * let's set ours to the same thing.
-                */
-       hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
-       initialize_repository_version(hash_algo, 1);
-       repo_set_hash_algo(the_repository, hash_algo);
+       if (refs)
+               mapped_refs = wanted_peer_refs(refs, &remote->fetch);
 
        if (mapped_refs) {
                /*
@@ -1428,12 +1490,16 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                dissociate_from_references();
        }
 
+       if (option_sparse_checkout && git_sparse_checkout_init(dir))
+               return 1;
+
        junk_mode = JUNK_LEAVE_REPO;
        err = checkout(submodule_progress, filter_submodules);
 
        free(remote_name);
        strbuf_release(&reflog_msg);
        strbuf_release(&branch_top);
+       strbuf_release(&buf);
        strbuf_release(&key);
        free_refs(mapped_refs);
        free_refs(remote_head_points_at);
index a83be8bc991a8c9dfca5b64f886d33f952890236..10ff7e01668203ce1b9233a90056abb65bc75e73 100644 (file)
@@ -45,6 +45,8 @@ int cmd_column(int argc, const char **argv, const char *prefix)
        memset(&copts, 0, sizeof(copts));
        copts.padding = 1;
        argc = parse_options(argc, argv, prefix, options, builtin_column_usage, 0);
+       if (copts.padding < 0)
+               die(_("%s must be non-negative"), "--padding");
        if (argc)
                usage_with_options(builtin_column_usage, options);
        if (real_command || command) {
@@ -56,5 +58,7 @@ int cmd_column(int argc, const char **argv, const char *prefix)
                string_list_append(&list, sb.buf);
 
        print_columns(&list, colopts, &copts);
+       strbuf_release(&sb);
+       string_list_clear(&list, 0);
        return 0;
 }
index c88389df24ed5cb552ca22a4be0e29c625a9ac23..7102ee90a0094b12560108eebe38f2637f83e701 100644 (file)
@@ -1,17 +1,16 @@
 #include "builtin.h"
 #include "commit.h"
 #include "config.h"
-#include "dir.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
-#include "lockfile.h"
 #include "parse-options.h"
 #include "repository.h"
 #include "commit-graph.h"
 #include "object-store-ll.h"
 #include "progress.h"
 #include "replace-object.h"
+#include "strbuf.h"
 #include "tag.h"
 #include "trace2.h"
 
@@ -22,7 +21,7 @@
        N_("git commit-graph write [--object-dir <dir>] [--append]\n" \
           "                       [--split[=<strategy>]] [--reachable | --stdin-packs | --stdin-commits]\n" \
           "                       [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]\n" \
-          "                       <split options>")
+          "                       <split-options>")
 
 static const char * builtin_commit_graph_verify_usage[] = {
        BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
@@ -69,10 +68,12 @@ static int graph_verify(int argc, const char **argv, const char *prefix)
        struct commit_graph *graph = NULL;
        struct object_directory *odb = NULL;
        char *graph_name;
-       int open_ok;
+       char *chain_name;
+       enum { OPENED_NONE, OPENED_GRAPH, OPENED_CHAIN } opened = OPENED_NONE;
        int fd;
        struct stat st;
        int flags = 0;
+       int incomplete_chain = 0;
        int ret;
 
        static struct option builtin_commit_graph_verify_options[] = {
@@ -102,24 +103,39 @@ static int graph_verify(int argc, const char **argv, const char *prefix)
 
        odb = find_odb(the_repository, opts.obj_dir);
        graph_name = get_commit_graph_filename(odb);
-       open_ok = open_commit_graph(graph_name, &fd, &st);
-       if (!open_ok && errno != ENOENT)
+       chain_name = get_commit_graph_chain_filename(odb);
+       if (open_commit_graph(graph_name, &fd, &st))
+               opened = OPENED_GRAPH;
+       else if (errno != ENOENT)
                die_errno(_("Could not open commit-graph '%s'"), graph_name);
+       else if (open_commit_graph_chain(chain_name, &fd, &st))
+               opened = OPENED_CHAIN;
+       else if (errno != ENOENT)
+               die_errno(_("could not open commit-graph chain '%s'"), chain_name);
 
        FREE_AND_NULL(graph_name);
+       FREE_AND_NULL(chain_name);
        FREE_AND_NULL(options);
 
-       if (open_ok)
+       if (opened == OPENED_NONE)
+               return 0;
+       else if (opened == OPENED_GRAPH)
                graph = load_commit_graph_one_fd_st(the_repository, fd, &st, odb);
        else
-               graph = read_commit_graph_one(the_repository, odb);
+               graph = load_commit_graph_chain_fd_st(the_repository, fd, &st,
+                                                     &incomplete_chain);
 
-       /* Return failure if open_ok predicted success */
        if (!graph)
-               return !!open_ok;
+               return 1;
 
        ret = verify_commit_graph(the_repository, graph, flags);
        free_commit_graph(graph);
+
+       if (incomplete_chain) {
+               error("one or more commit-graph chain files could not be loaded");
+               ret |= 1;
+       }
+
        return ret;
 }
 
@@ -311,6 +327,7 @@ cleanup:
        FREE_AND_NULL(options);
        string_list_clear(&pack_indexes, 0);
        strbuf_release(&buf);
+       oidset_clear(&commits);
        return result;
 }
 
index 02625e71761dbf8d25f063b5ff4835e5eb4bf477..1bb78198392e9e13db117e87a4d421e17d10b26a 100644 (file)
@@ -11,9 +11,6 @@
 #include "object-store-ll.h"
 #include "repository.h"
 #include "commit.h"
-#include "tree.h"
-#include "utf8.h"
-#include "gpg-interface.h"
 #include "parse-options.h"
 
 static const char * const commit_tree_usage[] = {
index 537319932b65883a43298e25dc1381a72738a0d3..f5a5a0ec53aafe58d99b2792d3c421f68ce5139d 100644 (file)
 #include "editor.h"
 #include "environment.h"
 #include "diff.h"
-#include "diffcore.h"
 #include "commit.h"
 #include "gettext.h"
 #include "revision.h"
 #include "wt-status.h"
 #include "run-command.h"
-#include "hook.h"
-#include "refs.h"
-#include "log-tree.h"
 #include "strbuf.h"
-#include "utf8.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "path.h"
@@ -35,9 +30,6 @@
 #include "string-list.h"
 #include "rerere.h"
 #include "unpack-trees.h"
-#include "quote.h"
-#include "submodule.h"
-#include "gpg-interface.h"
 #include "column.h"
 #include "sequencer.h"
 #include "sparse-index.h"
@@ -339,7 +331,8 @@ static void create_base_index(const struct commit *current_head)
        tree = parse_tree_indirect(&current_head->object.oid);
        if (!tree)
                die(_("failed to unpack HEAD tree object"));
-       parse_tree(tree);
+       if (parse_tree(tree) < 0)
+               exit(128);
        init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
        if (unpack_trees(1, &t, &opts))
                exit(128); /* We've already reported the error, finish dying */
@@ -455,7 +448,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
                refresh_cache_or_die(refresh_flags);
                cache_tree_update(&the_index, WRITE_TREE_SILENT);
                if (write_locked_index(&the_index, &index_lock, 0))
-                       die(_("unable to write new_index file"));
+                       die(_("unable to write new index file"));
                commit_style = COMMIT_NORMAL;
                ret = get_lock_file_path(&index_lock);
                goto out;
@@ -479,7 +472,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
                        cache_tree_update(&the_index, WRITE_TREE_SILENT);
                if (write_locked_index(&the_index, &index_lock,
                                       COMMIT_LOCK | SKIP_IF_UNCHANGED))
-                       die(_("unable to write new_index file"));
+                       die(_("unable to write new index file"));
                commit_style = COMMIT_AS_IS;
                ret = get_index_file();
                goto out;
@@ -527,7 +520,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
        refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
        cache_tree_update(&the_index, WRITE_TREE_SILENT);
        if (write_locked_index(&the_index, &index_lock, 0))
-               die(_("unable to write new_index file"));
+               die(_("unable to write new index file"));
 
        hold_lock_file_for_update(&false_lock,
                                  git_path("next-index-%"PRIuMAX,
@@ -745,7 +738,6 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
        const char *hook_arg2 = NULL;
        int clean_message_contents = (cleanup_mode != COMMIT_MSG_CLEANUP_NONE);
        int old_display_comment_prefix;
-       int merge_contains_scissors = 0;
        int invoked_hook;
 
        /* This checks and barfs if author is badly specified */
@@ -849,7 +841,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                    wt_status_locate_end(sb.buf + merge_msg_start,
                                         sb.len - merge_msg_start) <
                                sb.len - merge_msg_start)
-                       merge_contains_scissors = 1;
+                       s->added_cut_line = 1;
        } else if (!stat(git_path_squash_msg(the_repository), &statbuf)) {
                if (strbuf_read_file(&sb, git_path_squash_msg(the_repository), 0) < 0)
                        die_errno(_("could not read SQUASH_MSG"));
@@ -900,7 +892,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                strbuf_stripspace(&sb, '\0');
 
        if (signoff)
-               append_signoff(&sb, ignore_non_trailer(sb.buf, sb.len), 0);
+               append_signoff(&sb, ignored_log_message_bytes(sb.buf, sb.len), 0);
 
        if (fwrite(sb.buf, 1, sb.len, s->fp) < sb.len)
                die_errno(_("could not write commit template"));
@@ -932,9 +924,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                          " yourself if you want to.\n"
                          "An empty message aborts the commit.\n");
                if (whence != FROM_COMMIT) {
-                       if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
-                               !merge_contains_scissors)
-                               wt_status_add_cut_line(s->fp);
+                       if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS)
+                               wt_status_add_cut_line(s);
                        status_printf_ln(
                                s, GIT_COLOR_NORMAL,
                                whence == FROM_MERGE ?
@@ -954,8 +945,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                if (cleanup_mode == COMMIT_MSG_CLEANUP_ALL)
                        status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_all, comment_line_char);
                else if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) {
-                       if (whence == FROM_COMMIT && !merge_contains_scissors)
-                               wt_status_add_cut_line(s->fp);
+                       if (whence == FROM_COMMIT)
+                               wt_status_add_cut_line(s);
                } else /* COMMIT_MSG_CLEANUP_SPACE, that is. */
                        status_printf(s, GIT_COLOR_NORMAL, hint_cleanup_space, comment_line_char);
 
@@ -1862,7 +1853,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
        if (commit_index_files())
                die(_("repository has been updated, but unable to write\n"
-                     "new_index file. Check that disk is not full and quota is\n"
+                     "new index file. Check that disk is not full and quota is\n"
                      "not exceeded, and then \"git restore --staged :/\" to recover."));
 
        git_test_write_commit_graph_or_die();
@@ -1885,7 +1876,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                                     &oid, flags);
        }
 
-       apply_autostash(git_path_merge_autostash(the_repository));
+       apply_autostash_ref(the_repository, "MERGE_AUTOSTASH");
 
 cleanup:
        strbuf_release(&author_ident);
index 11a4d4ef1411222f3750c760b68efd10180148c0..b55bfae7d66df0cea54313f677e1a924a4a579b3 100644 (file)
@@ -708,10 +708,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
        }
 
        if (use_global_config) {
-               char *user_config, *xdg_config;
-
-               git_global_config(&user_config, &xdg_config);
-               if (!user_config)
+               given_config_source.file = git_global_config();
+               if (!given_config_source.file)
                        /*
                         * It is unknown if HOME/.gitconfig exists, so
                         * we do not know if we should write to XDG
@@ -719,19 +717,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                         * is set and points at a sane location.
                         */
                        die(_("$HOME not set"));
-
                given_config_source.scope = CONFIG_SCOPE_GLOBAL;
-
-               if (access_or_warn(user_config, R_OK, 0) &&
-                   xdg_config && !access_or_warn(xdg_config, R_OK, 0)) {
-                       given_config_source.file = xdg_config;
-                       free(user_config);
-               } else {
-                       given_config_source.file = user_config;
-                       free(xdg_config);
-               }
-       }
-       else if (use_system_config) {
+       } else if (use_system_config) {
                given_config_source.file = git_system_config();
                given_config_source.scope = CONFIG_SCOPE_SYSTEM;
        } else if (use_local_config) {
@@ -760,7 +747,6 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                given_config_source.scope = CONFIG_SCOPE_COMMAND;
        }
 
-
        if (respect_includes_opt == -1)
                config_options.respect_includes = !given_config_source.file;
        else
index 43b9d0e5b16ba5da555a3b16ce53b88dff5dbb4c..bba96d4ffd6f198adb186aaba0c853e34a93dd11 100644 (file)
@@ -7,8 +7,6 @@
 
 #ifndef NO_UNIX_SOCKETS
 
-#include "credential.h"
-#include "string-list.h"
 #include "unix-socket.h"
 #include "run-command.h"
 
index b28a4a1f82d5290f4800b238224946923cf7811b..d6c77a714f46194faca18739d0118294bc233f81 100644 (file)
@@ -7,9 +7,7 @@
 #include "lockfile.h"
 #include "commit.h"
 #include "tag.h"
-#include "blob.h"
 #include "refs.h"
-#include "exec-cmd.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "read-cache-ll.h"
@@ -561,9 +559,11 @@ static void describe(const char *arg, int last_one)
 static int option_parse_exact_match(const struct option *opt, const char *arg,
                                    int unset)
 {
+       int *val = opt->value;
+
        BUG_ON_OPT_ARG(arg);
 
-       max_candidates = unset ? DEFAULT_CANDIDATES : 0;
+       *val = unset ? DEFAULT_CANDIDATES : 0;
        return 0;
 }
 
@@ -578,7 +578,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "long",       &longformat, N_("always use long format")),
                OPT_BOOL(0, "first-parent", &first_parent, N_("only follow first parent")),
                OPT__ABBREV(&abbrev),
-               OPT_CALLBACK_F(0, "exact-match", NULL, NULL,
+               OPT_CALLBACK_F(0, "exact-match", &max_candidates, NULL,
                               N_("only output exact matches"),
                               PARSE_OPT_NOARG, option_parse_exact_match),
                OPT_INTEGER(0, "candidates", &max_candidates,
@@ -668,7 +668,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                        struct lock_file index_lock = LOCK_INIT;
                        struct rev_info revs;
                        struct strvec args = STRVEC_INIT;
-                       int fd, result;
+                       int fd;
 
                        setup_work_tree();
                        prepare_repo_settings(the_repository);
@@ -685,9 +685,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                        strvec_pushv(&args, diff_index_args);
                        if (setup_revisions(args.nr, args.v, &revs, NULL) != 1)
                                BUG("malformed internal diff-index command line");
-                       result = run_diff_index(&revs, 0);
+                       run_diff_index(&revs, 0);
 
-                       if (!diff_result_code(&revs.diffopt, result))
+                       if (!diff_result_code(&revs.diffopt))
                                suffix = NULL;
                        else
                                suffix = dirty;
index 50330b8dd2fd289a188b6143d528da2658327057..018011f29ea26be24b567e9af380699dd7d893a3 100644 (file)
@@ -11,7 +11,6 @@
 #include "preload-index.h"
 #include "repository.h"
 #include "revision.h"
-#include "submodule.h"
 
 static const char diff_files_usage[] =
 "git diff-files [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]"
@@ -80,14 +79,10 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
            (rev.diffopt.output_format & DIFF_FORMAT_PATCH))
                diff_merges_set_dense_combined_if_unset(&rev);
 
-       if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) {
-               perror("repo_read_index_preload");
-               result = -1;
-               goto cleanup;
-       }
-       result = run_diff_files(&rev, options);
-       result = diff_result_code(&rev.diffopt, result);
-cleanup:
+       if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0)
+               die_errno("repo_read_index_preload");
+       run_diff_files(&rev, options);
+       result = diff_result_code(&rev.diffopt);
        release_revisions(&rev);
        return result;
 }
index 9db7139b839e46d10cf553fbb3d4a3a8e567735b..3e05260ac0e0401188163aeaf4c4d1aea0ba56d1 100644 (file)
@@ -7,8 +7,6 @@
 #include "repository.h"
 #include "revision.h"
 #include "setup.h"
-#include "sparse-index.h"
-#include "submodule.h"
 
 static const char diff_cache_usage[] =
 "git diff-index [-m] [--cached] [--merge-base] "
@@ -72,8 +70,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
                perror("repo_read_index");
                return -1;
        }
-       result = run_diff_index(&rev, option);
-       result = diff_result_code(&rev.diffopt, result);
+       run_diff_index(&rev, option);
+       result = diff_result_code(&rev.diffopt);
        release_revisions(&rev);
        return result;
 }
index c9ba35f143814f2b016fccfb57ab99f86bee4c85..a8e68ce8ef6275a99e2a4f62545d0e7d962dcf45 100644 (file)
@@ -6,7 +6,6 @@
 #include "gettext.h"
 #include "hex.h"
 #include "log-tree.h"
-#include "submodule.h"
 #include "read-cache-ll.h"
 #include "repository.h"
 #include "revision.h"
@@ -232,5 +231,5 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
                diff_free(&opt->diffopt);
        }
 
-       return diff_result_code(&opt->diffopt, 0);
+       return diff_result_code(&opt->diffopt);
 }
index b19530c996c7cd43be9baa3649c93247de888ebd..6e196e0c7d2d055df1557ffd256d87a737053324 100644 (file)
@@ -10,7 +10,6 @@
 #include "lockfile.h"
 #include "color.h"
 #include "commit.h"
-#include "blob.h"
 #include "gettext.h"
 #include "tag.h"
 #include "diff.h"
@@ -21,7 +20,6 @@
 #include "revision.h"
 #include "log-tree.h"
 #include "setup.h"
-#include "submodule.h"
 #include "oid-array.h"
 #include "tree.h"
 
@@ -77,9 +75,9 @@ static void stuff_change(struct diff_options *opt,
        diff_queue(&diff_queued_diff, one, two);
 }
 
-static int builtin_diff_b_f(struct rev_info *revs,
-                           int argc, const char **argv UNUSED,
-                           struct object_array_entry **blob)
+static void builtin_diff_b_f(struct rev_info *revs,
+                            int argc, const char **argv UNUSED,
+                            struct object_array_entry **blob)
 {
        /* Blob vs file in the working tree*/
        struct stat st;
@@ -109,12 +107,11 @@ static int builtin_diff_b_f(struct rev_info *revs,
                     path);
        diffcore_std(&revs->diffopt);
        diff_flush(&revs->diffopt);
-       return 0;
 }
 
-static int builtin_diff_blobs(struct rev_info *revs,
-                             int argc, const char **argv UNUSED,
-                             struct object_array_entry **blob)
+static void builtin_diff_blobs(struct rev_info *revs,
+                              int argc, const char **argv UNUSED,
+                              struct object_array_entry **blob)
 {
        const unsigned mode = canon_mode(S_IFREG | 0644);
 
@@ -134,11 +131,10 @@ static int builtin_diff_blobs(struct rev_info *revs,
                     blob_path(blob[0]), blob_path(blob[1]));
        diffcore_std(&revs->diffopt);
        diff_flush(&revs->diffopt);
-       return 0;
 }
 
-static int builtin_diff_index(struct rev_info *revs,
-                             int argc, const char **argv)
+static void builtin_diff_index(struct rev_info *revs,
+                              int argc, const char **argv)
 {
        unsigned int option = 0;
        while (1 < argc) {
@@ -163,20 +159,18 @@ static int builtin_diff_index(struct rev_info *revs,
                setup_work_tree();
                if (repo_read_index_preload(the_repository,
                                            &revs->diffopt.pathspec, 0) < 0) {
-                       perror("repo_read_index_preload");
-                       return -1;
+                       die_errno("repo_read_index_preload");
                }
        } else if (repo_read_index(the_repository) < 0) {
-               perror("repo_read_cache");
-               return -1;
+               die_errno("repo_read_cache");
        }
-       return run_diff_index(revs, option);
+       run_diff_index(revs, option);
 }
 
-static int builtin_diff_tree(struct rev_info *revs,
-                            int argc, const char **argv,
-                            struct object_array_entry *ent0,
-                            struct object_array_entry *ent1)
+static void builtin_diff_tree(struct rev_info *revs,
+                             int argc, const char **argv,
+                             struct object_array_entry *ent0,
+                             struct object_array_entry *ent1)
 {
        const struct object_id *(oid[2]);
        struct object_id mb_oid;
@@ -209,13 +203,12 @@ static int builtin_diff_tree(struct rev_info *revs,
        }
        diff_tree_oid(oid[0], oid[1], "", &revs->diffopt);
        log_tree_diff_flush(revs);
-       return 0;
 }
 
-static int builtin_diff_combined(struct rev_info *revs,
-                                int argc, const char **argv UNUSED,
-                                struct object_array_entry *ent,
-                                int ents, int first_non_parent)
+static void builtin_diff_combined(struct rev_info *revs,
+                                 int argc, const char **argv UNUSED,
+                                 struct object_array_entry *ent,
+                                 int ents, int first_non_parent)
 {
        struct oid_array parents = OID_ARRAY_INIT;
        int i;
@@ -236,7 +229,6 @@ static int builtin_diff_combined(struct rev_info *revs,
        }
        diff_tree_combined(&ent[first_non_parent].item->oid, &parents, revs);
        oid_array_clear(&parents);
-       return 0;
 }
 
 static void refresh_index_quietly(void)
@@ -254,7 +246,7 @@ static void refresh_index_quietly(void)
        repo_update_index_if_able(the_repository, &lock_file);
 }
 
-static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv)
+static void builtin_diff_files(struct rev_info *revs, int argc, const char **argv)
 {
        unsigned int options = 0;
 
@@ -269,8 +261,10 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
                        options |= DIFF_SILENT_ON_REMOVED;
                else if (!strcmp(argv[1], "-h"))
                        usage(builtin_diff_usage);
-               else
-                       return error(_("invalid option: %s"), argv[1]);
+               else {
+                       error(_("invalid option: %s"), argv[1]);
+                       usage(builtin_diff_usage);
+               }
                argv++; argc--;
        }
 
@@ -287,10 +281,9 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
        setup_work_tree();
        if (repo_read_index_preload(the_repository, &revs->diffopt.pathspec,
                                    0) < 0) {
-               perror("repo_read_index_preload");
-               return -1;
+               die_errno("repo_read_index_preload");
        }
-       return run_diff_files(revs, options);
+       run_diff_files(revs, options);
 }
 
 struct symdiff {
@@ -404,7 +397,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        int blobs = 0, paths = 0;
        struct object_array_entry *blob[2];
        int nongit = 0, no_index = 0;
-       int result = 0;
+       int result;
        struct symdiff sdiff;
 
        /*
@@ -479,8 +472,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        repo_init_revisions(the_repository, &rev, prefix);
 
        /* Set up defaults that will apply to both no-index and regular diffs. */
-       rev.diffopt.stat_width = -1;
-       rev.diffopt.stat_graph_width = -1;
+       init_diffstat_widths(&rev.diffopt);
        rev.diffopt.flags.allow_external = 1;
        rev.diffopt.flags.allow_textconv = 1;
 
@@ -583,17 +575,17 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        if (!ent.nr) {
                switch (blobs) {
                case 0:
-                       result = builtin_diff_files(&rev, argc, argv);
+                       builtin_diff_files(&rev, argc, argv);
                        break;
                case 1:
                        if (paths != 1)
                                usage(builtin_diff_usage);
-                       result = builtin_diff_b_f(&rev, argc, argv, blob);
+                       builtin_diff_b_f(&rev, argc, argv, blob);
                        break;
                case 2:
                        if (paths)
                                usage(builtin_diff_usage);
-                       result = builtin_diff_blobs(&rev, argc, argv, blob);
+                       builtin_diff_blobs(&rev, argc, argv, blob);
                        break;
                default:
                        usage(builtin_diff_usage);
@@ -602,18 +594,18 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        else if (blobs)
                usage(builtin_diff_usage);
        else if (ent.nr == 1)
-               result = builtin_diff_index(&rev, argc, argv);
+               builtin_diff_index(&rev, argc, argv);
        else if (ent.nr == 2) {
                if (sdiff.warn)
                        warning(_("%s...%s: multiple merge bases, using %s"),
                                sdiff.left, sdiff.right, sdiff.base);
-               result = builtin_diff_tree(&rev, argc, argv,
-                                          &ent.objects[0], &ent.objects[1]);
+               builtin_diff_tree(&rev, argc, argv,
+                                 &ent.objects[0], &ent.objects[1]);
        } else
-               result = builtin_diff_combined(&rev, argc, argv,
-                                              ent.objects, ent.nr,
-                                              first_non_parent);
-       result = diff_result_code(&rev.diffopt, result);
+               builtin_diff_combined(&rev, argc, argv,
+                                     ent.objects, ent.nr,
+                                     first_non_parent);
+       result = diff_result_code(&rev.diffopt);
        if (1 < rev.diffopt.skip_stat_unmatch)
                refresh_index_quietly();
        release_revisions(&rev);
index 0f5eae9cd41b3219b06964011089bb8d389975b4..a3c72b8258e7cb34e6e87e679e6a996d6086ecb0 100644 (file)
@@ -18,7 +18,6 @@
 #include "copy.h"
 #include "run-command.h"
 #include "environment.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "hex.h"
 #include "parse-options.h"
index 56dc69fac180126a43f8a9ca3ed116ca67283737..4693d18cc94f09ecf760c4662753583052ebc4c6 100644 (file)
@@ -25,7 +25,6 @@
 #include "quote.h"
 #include "remote.h"
 #include "blob.h"
-#include "commit-slab.h"
 
 static const char *fast_export_usage[] = {
        N_("git fast-export [<rev-list-opts>]"),
@@ -33,9 +32,9 @@ static const char *fast_export_usage[] = {
 };
 
 static int progress;
-static enum { SIGNED_TAG_ABORT, VERBATIM, WARN, WARN_STRIP, STRIP } signed_tag_mode = SIGNED_TAG_ABORT;
-static enum { TAG_FILTERING_ABORT, DROP, REWRITE } tag_of_filtered_mode = TAG_FILTERING_ABORT;
-static enum { REENCODE_ABORT, REENCODE_YES, REENCODE_NO } reencode_mode = REENCODE_ABORT;
+static enum signed_tag_mode { SIGNED_TAG_ABORT, VERBATIM, WARN, WARN_STRIP, STRIP } signed_tag_mode = SIGNED_TAG_ABORT;
+static enum tag_of_filtered_mode { TAG_FILTERING_ABORT, DROP, REWRITE } tag_of_filtered_mode = TAG_FILTERING_ABORT;
+static enum reencode_mode { REENCODE_ABORT, REENCODE_YES, REENCODE_NO } reencode_mode = REENCODE_ABORT;
 static int fake_missing_tagger;
 static int use_done_feature;
 static int no_data;
@@ -53,16 +52,18 @@ static struct revision_sources revision_sources;
 static int parse_opt_signed_tag_mode(const struct option *opt,
                                     const char *arg, int unset)
 {
+       enum signed_tag_mode *val = opt->value;
+
        if (unset || !strcmp(arg, "abort"))
-               signed_tag_mode = SIGNED_TAG_ABORT;
+               *val = SIGNED_TAG_ABORT;
        else if (!strcmp(arg, "verbatim") || !strcmp(arg, "ignore"))
-               signed_tag_mode = VERBATIM;
+               *val = VERBATIM;
        else if (!strcmp(arg, "warn"))
-               signed_tag_mode = WARN;
+               *val = WARN;
        else if (!strcmp(arg, "warn-strip"))
-               signed_tag_mode = WARN_STRIP;
+               *val = WARN_STRIP;
        else if (!strcmp(arg, "strip"))
-               signed_tag_mode = STRIP;
+               *val = STRIP;
        else
                return error("Unknown signed-tags mode: %s", arg);
        return 0;
@@ -71,12 +72,14 @@ static int parse_opt_signed_tag_mode(const struct option *opt,
 static int parse_opt_tag_of_filtered_mode(const struct option *opt,
                                          const char *arg, int unset)
 {
+       enum tag_of_filtered_mode *val = opt->value;
+
        if (unset || !strcmp(arg, "abort"))
-               tag_of_filtered_mode = TAG_FILTERING_ABORT;
+               *val = TAG_FILTERING_ABORT;
        else if (!strcmp(arg, "drop"))
-               tag_of_filtered_mode = DROP;
+               *val = DROP;
        else if (!strcmp(arg, "rewrite"))
-               tag_of_filtered_mode = REWRITE;
+               *val = REWRITE;
        else
                return error("Unknown tag-of-filtered mode: %s", arg);
        return 0;
@@ -85,21 +88,23 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt,
 static int parse_opt_reencode_mode(const struct option *opt,
                                   const char *arg, int unset)
 {
+       enum reencode_mode *val = opt->value;
+
        if (unset) {
-               reencode_mode = REENCODE_ABORT;
+               *val = REENCODE_ABORT;
                return 0;
        }
 
        switch (git_parse_maybe_bool(arg)) {
        case 0:
-               reencode_mode = REENCODE_NO;
+               *val = REENCODE_NO;
                break;
        case 1:
-               reencode_mode = REENCODE_YES;
+               *val = REENCODE_YES;
                break;
        default:
                if (!strcasecmp(arg, "abort"))
-                       reencode_mode = REENCODE_ABORT;
+                       *val = REENCODE_ABORT;
                else
                        return error("Unknown reencoding mode: %s", arg);
        }
@@ -131,8 +136,7 @@ static int anonymized_entry_cmp(const void *cmp_data UNUSED,
        a = container_of(eptr, const struct anonymized_entry, hash);
        if (keydata) {
                const struct anonymized_entry_key *key = keydata;
-               int equal = !strncmp(a->orig, key->orig, key->orig_len) &&
-                           !a->orig[key->orig_len];
+               int equal = !xstrncmpz(a->orig, key->orig, key->orig_len);
                return !equal;
        }
 
index 2c645fcfbe3f9b214681c7bdf69d131774e9b06f..782bda007c29e7f23393d1d5543dc47497ee2d14 100644 (file)
@@ -1102,6 +1102,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
                || (pack_size + PACK_SIZE_THRESHOLD + len) < pack_size)
                cycle_packfile();
 
+       the_hash_algo->init_fn(&checkpoint.ctx);
        hashfile_checkpoint(pack_file, &checkpoint);
        offset = checkpoint.offset;
 
@@ -1610,6 +1611,7 @@ static int update_branch(struct branch *b)
                oidclr(&old_oid);
        if (!force_update && !is_null_oid(&old_oid)) {
                struct commit *old_cmit, *new_cmit;
+               int ret;
 
                old_cmit = lookup_commit_reference_gently(the_repository,
                                                          &old_oid, 0);
@@ -1618,7 +1620,10 @@ static int update_branch(struct branch *b)
                if (!old_cmit || !new_cmit)
                        return error("Branch %s is missing commits.", b->name);
 
-               if (!repo_in_merge_bases(the_repository, old_cmit, new_cmit)) {
+               ret = repo_in_merge_bases(the_repository, old_cmit, new_cmit);
+               if (ret < 0)
+                       exit(128);
+               if (!ret) {
                        warning("Not updating %s"
                                " (new tip %s does not contain %s)",
                                b->name, oid_to_hex(&b->oid),
@@ -2794,8 +2799,7 @@ static void parse_new_tag(const char *arg)
        enum object_type type;
        const char *v;
 
-       t = mem_pool_alloc(&fi_mem_pool, sizeof(struct tag));
-       memset(t, 0, sizeof(struct tag));
+       t = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct tag));
        t->name = mem_pool_strdup(&fi_mem_pool, arg);
        if (last_tag)
                last_tag->next_tag = t;
index eed4a7cdb6c1d672ab7324ea129d83ea312b688e..46a793411a437969b53c4f14d941df27358d00ed 100644 (file)
@@ -26,7 +26,6 @@
 #include "connected.h"
 #include "strvec.h"
 #include "utf8.h"
-#include "packfile.h"
 #include "pager.h"
 #include "path.h"
 #include "pkt-line.h"
@@ -38,7 +37,6 @@
 #include "shallow.h"
 #include "trace.h"
 #include "trace2.h"
-#include "worktree.h"
 #include "bundle-uri.h"
 
 #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000)
@@ -102,6 +100,7 @@ static struct string_list negotiation_tip = STRING_LIST_INIT_NODUP;
 
 struct fetch_config {
        enum display_format display_format;
+       int all;
        int prune;
        int prune_tags;
        int show_forced_updates;
@@ -115,6 +114,11 @@ static int git_fetch_config(const char *k, const char *v,
 {
        struct fetch_config *fetch_config = cb;
 
+       if (!strcmp(k, "fetch.all")) {
+               fetch_config->all = git_config_bool(k, v);
+               return 0;
+       }
+
        if (!strcmp(k, "fetch.prune")) {
                fetch_config->prune = git_config_bool(k, v);
                return 0;
@@ -176,7 +180,7 @@ static int parse_refmap_arg(const struct option *opt, const char *arg, int unset
         * "git fetch --refmap='' origin foo"
         * can be used to tell the command not to store anywhere
         */
-       refspec_append(&refmap, arg);
+       refspec_append(opt->value, arg);
 
        return 0;
 }
@@ -308,7 +312,7 @@ static void clear_item(struct refname_hash_entry *item)
 
 
 static void add_already_queued_tags(const char *refname,
-                                   const struct object_id *old_oid,
+                                   const struct object_id *old_oid UNUSED,
                                    const struct object_id *new_oid,
                                    void *cb_data)
 {
@@ -444,9 +448,8 @@ static void filter_prefetch_refspec(struct refspec *rs)
                        continue;
                if (!rs->items[i].dst ||
                    (rs->items[i].src &&
-                    !strncmp(rs->items[i].src,
-                             ref_namespace[NAMESPACE_TAGS].ref,
-                             strlen(ref_namespace[NAMESPACE_TAGS].ref)))) {
+                    starts_with(rs->items[i].src,
+                                ref_namespace[NAMESPACE_TAGS].ref))) {
                        int j;
 
                        free(rs->items[i].src);
@@ -978,6 +981,8 @@ static int update_local_ref(struct ref *ref,
                uint64_t t_before = getnanotime();
                fast_forward = repo_in_merge_bases(the_repository, current,
                                                   updated);
+               if (fast_forward < 0)
+                       exit(128);
                forced_updates_ms += (getnanotime() - t_before) / 1000000;
        } else {
                fast_forward = 1;
@@ -1651,7 +1656,7 @@ static int do_fetch(struct transport *transport,
        if (atomic_fetch) {
                transaction = ref_transaction_begin(&err);
                if (!transaction) {
-                       retcode = error("%s", err.buf);
+                       retcode = -1;
                        goto cleanup;
                }
        }
@@ -1711,7 +1716,6 @@ static int do_fetch(struct transport *transport,
 
                retcode = ref_transaction_commit(transaction, &err);
                if (retcode) {
-                       error("%s", err.buf);
                        ref_transaction_free(transaction);
                        transaction = NULL;
                        goto cleanup;
@@ -1775,9 +1779,14 @@ static int do_fetch(struct transport *transport,
        }
 
 cleanup:
-       if (retcode && transaction) {
-               ref_transaction_abort(transaction, &err);
-               error("%s", err.buf);
+       if (retcode) {
+               if (err.len) {
+                       error("%s", err.buf);
+                       strbuf_reset(&err);
+               }
+               if (transaction && ref_transaction_abort(transaction, &err) &&
+                   err.len)
+                       error("%s", err.buf);
        }
 
        display_state_release(&display_state);
@@ -2128,7 +2137,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        const char *bundle_uri;
        struct string_list list = STRING_LIST_INIT_DUP;
        struct remote *remote = NULL;
-       int all = 0, multiple = 0;
+       int all = -1, multiple = 0;
        int result = 0;
        int prune_tags_ok = 1;
        int enable_auto_gc = 1;
@@ -2204,7 +2213,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
                           PARSE_OPT_HIDDEN, option_fetch_parse_recurse_submodules),
                OPT_BOOL(0, "update-shallow", &update_shallow,
                         N_("accept refs that update .git/shallow")),
-               OPT_CALLBACK_F(0, "refmap", NULL, N_("refmap"),
+               OPT_CALLBACK_F(0, "refmap", &refmap, N_("refmap"),
                               N_("specify fetch refmap"), PARSE_OPT_NONEG, parse_refmap_arg),
                OPT_STRING_LIST('o', "server-option", &server_options, N_("server-specific"), N_("option to transmit")),
                OPT_IPVERSION(&family),
@@ -2333,11 +2342,20 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
            fetch_bundle_uri(the_repository, bundle_uri, NULL))
                warning(_("failed to fetch bundles from '%s'"), bundle_uri);
 
+       if (all < 0) {
+               /*
+                * no --[no-]all given;
+                * only use config option if no remote was explicitly specified
+                */
+               all = (!argc) ? config.all : 0;
+       }
+
        if (all) {
                if (argc == 1)
                        die(_("fetch --all does not take a repository argument"));
                else if (argc > 1)
                        die(_("fetch --all does not make sense with refspecs"));
+
                (void) for_each_remote(get_one_remote_for_fetch, &list);
 
                /* do not do fetch_multiple() of one */
index 350bfa6e811b8c53d94ba33083a03bf9d93437dc..919282e12a335a5a7491b905f27dcfface0120a3 100644 (file)
@@ -1,13 +1,12 @@
 #include "builtin.h"
+#include "commit.h"
 #include "config.h"
 #include "gettext.h"
-#include "refs.h"
 #include "object.h"
 #include "parse-options.h"
 #include "ref-filter.h"
 #include "strbuf.h"
 #include "strvec.h"
-#include "commit-reach.h"
 
 static char const * const for_each_ref_usage[] = {
        N_("git for-each-ref [<options>] [<pattern>]"),
@@ -19,16 +18,12 @@ static char const * const for_each_ref_usage[] = {
 
 int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
 {
-       int i;
        struct ref_sorting *sorting;
        struct string_list sorting_options = STRING_LIST_INIT_DUP;
-       int maxcount = 0, icase = 0, omit_empty = 0;
-       struct ref_array array;
+       int icase = 0, include_root_refs = 0, from_stdin = 0;
        struct ref_filter filter = REF_FILTER_INIT;
        struct ref_format format = REF_FORMAT_INIT;
-       struct strbuf output = STRBUF_INIT;
-       struct strbuf err = STRBUF_INIT;
-       int from_stdin = 0;
+       unsigned int flags = FILTER_REFS_REGULAR;
        struct strvec vec = STRVEC_INIT;
 
        struct option opts[] = {
@@ -40,11 +35,11 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
                        N_("quote placeholders suitably for python"), QUOTE_PYTHON),
                OPT_BIT(0 , "tcl",  &format.quote_style,
                        N_("quote placeholders suitably for Tcl"), QUOTE_TCL),
-               OPT_BOOL(0, "omit-empty",  &omit_empty,
+               OPT_BOOL(0, "omit-empty",  &format.array_opts.omit_empty,
                        N_("do not output a newline after empty formatted refs")),
 
                OPT_GROUP(""),
-               OPT_INTEGER( 0 , "count", &maxcount, N_("show only <n> matched refs")),
+               OPT_INTEGER( 0 , "count", &format.array_opts.max_count, N_("show only <n> matched refs")),
                OPT_STRING(  0 , "format", &format.format, N_("format"), N_("format to use for the output")),
                OPT__COLOR(&format.use_color, N_("respect format colors")),
                OPT_REF_FILTER_EXCLUDE(&filter),
@@ -58,18 +53,20 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
                OPT_NO_CONTAINS(&filter.no_commit, N_("print only refs which don't contain the commit")),
                OPT_BOOL(0, "ignore-case", &icase, N_("sorting and filtering are case insensitive")),
                OPT_BOOL(0, "stdin", &from_stdin, N_("read reference patterns from stdin")),
+               OPT_BOOL(0, "include-root-refs", &include_root_refs, N_("also include HEAD ref and pseudorefs")),
                OPT_END(),
        };
 
-       memset(&array, 0, sizeof(array));
-
        format.format = "%(objectname) %(objecttype)\t%(refname)";
 
        git_config(git_default_config, NULL);
 
+       /* Set default (refname) sorting */
+       string_list_append(&sorting_options, "refname");
+
        parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0);
-       if (maxcount < 0) {
-               error("invalid --count argument: `%d'", maxcount);
+       if (format.array_opts.max_count < 0) {
+               error("invalid --count argument: `%d'", format.array_opts.max_count);
                usage_with_options(for_each_ref_usage, opts);
        }
        if (HAS_MULTI_BITS(format.quote_style)) {
@@ -100,27 +97,12 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
                filter.name_patterns = argv;
        }
 
+       if (include_root_refs)
+               flags |= FILTER_REFS_ROOT_REFS;
+
        filter.match_as_path = 1;
-       filter_refs(&array, &filter, FILTER_REFS_ALL);
-       filter_ahead_behind(the_repository, &format, &array);
-
-       ref_array_sort(sorting, &array);
-
-       if (!maxcount || array.nr < maxcount)
-               maxcount = array.nr;
-       for (i = 0; i < maxcount; i++) {
-               strbuf_reset(&err);
-               strbuf_reset(&output);
-               if (format_ref_array_item(array.items[i], &format, &output, &err))
-                       die("%s", err.buf);
-               fwrite(output.buf, 1, output.len, stdout);
-               if (output.len || !omit_empty)
-                       putchar('\n');
-       }
+       filter_and_format_refs(&filter, flags, sorting, &format);
 
-       strbuf_release(&err);
-       strbuf_release(&output);
-       ref_array_clear(&array);
        ref_filter_clear(&filter);
        ref_sorting_release(sorting);
        strvec_clear(&vec);
index 611925905e4fd1d972565806156059016d2eb1a6..f892487c9b975dd5079b86143e635c6539770981 100644 (file)
 #include "refs.h"
 #include "pack.h"
 #include "cache-tree.h"
-#include "tree-walk.h"
 #include "fsck.h"
 #include "parse-options.h"
-#include "dir.h"
 #include "progress.h"
 #include "streaming.h"
-#include "decorate.h"
 #include "packfile.h"
 #include "object-file.h"
 #include "object-name.h"
@@ -512,9 +509,7 @@ static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid
        return 0;
 }
 
-static int fsck_handle_reflog(const char *logname,
-                             const struct object_id *oid UNUSED,
-                             int flag UNUSED, void *cb_data)
+static int fsck_handle_reflog(const char *logname, void *cb_data)
 {
        struct strbuf refname = STRBUF_INIT;
 
index 7e99c4d61ba95942014d8ab2681568f53658fd0d..1593713f4cb29fe8e608f4c3c7502fa5a624d1f9 100644 (file)
@@ -1,19 +1,20 @@
 #include "builtin.h"
 #include "abspath.h"
 #include "config.h"
+#include "dir.h"
 #include "environment.h"
 #include "gettext.h"
 #include "parse-options.h"
 #include "fsmonitor-ll.h"
 #include "fsmonitor-ipc.h"
-#include "fsmonitor-path-utils.h"
 #include "fsmonitor-settings.h"
 #include "compat/fsmonitor/fsm-health.h"
 #include "compat/fsmonitor/fsm-listen.h"
 #include "fsmonitor--daemon.h"
+#include "repository.h"
 #include "simple-ipc.h"
 #include "khash.h"
-#include "pkt-line.h"
+#include "run-command.h"
 #include "trace.h"
 #include "trace2.h"
 
@@ -129,8 +130,9 @@ struct fsmonitor_cookie_item {
        enum fsmonitor_cookie_item_result result;
 };
 
-static int cookies_cmp(const void *data, const struct hashmap_entry *he1,
-                    const struct hashmap_entry *he2, const void *keydata)
+static int cookies_cmp(const void *data UNUSED,
+                      const struct hashmap_entry *he1,
+                      const struct hashmap_entry *he2, const void *keydata)
 {
        const struct fsmonitor_cookie_item *a =
                container_of(he1, const struct fsmonitor_cookie_item, entry);
@@ -1412,7 +1414,7 @@ done:
        return err;
 }
 
-static int try_to_run_foreground_daemon(int detach_console)
+static int try_to_run_foreground_daemon(int detach_console MAYBE_UNUSED)
 {
        /*
         * Technically, we don't need to probe for an existing daemon
@@ -1442,7 +1444,8 @@ static int try_to_run_foreground_daemon(int detach_console)
 
 static start_bg_wait_cb bg_wait_cb;
 
-static int bg_wait_cb(const struct child_process *cp, void *cb_data)
+static int bg_wait_cb(const struct child_process *cp UNUSED,
+                     void *cb_data UNUSED)
 {
        enum ipc_active_state s = fsmonitor_ipc__get_state();
 
index 5c4315f0d816c8e197bf22105f1d2ae56707ea2b..cb80ced6cb5c65d70859a3a6f57cff3d886084b3 100644 (file)
@@ -52,6 +52,7 @@ static const char * const builtin_gc_usage[] = {
 static int pack_refs = 1;
 static int prune_reflogs = 1;
 static int cruft_packs = 1;
+static unsigned long max_cruft_size;
 static int aggressive_depth = 50;
 static int aggressive_window = 250;
 static int gc_auto_threshold = 6700;
@@ -61,6 +62,8 @@ static timestamp_t gc_log_expire_time;
 static const char *gc_log_expire = "1.day.ago";
 static const char *prune_expire = "2.weeks.ago";
 static const char *prune_worktrees_expire = "3.months.ago";
+static char *repack_filter;
+static char *repack_filter_to;
 static unsigned long big_pack_threshold;
 static unsigned long max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
 
@@ -163,6 +166,7 @@ static void gc_config(void)
        git_config_get_int("gc.autopacklimit", &gc_auto_pack_limit);
        git_config_get_bool("gc.autodetach", &detach_auto);
        git_config_get_bool("gc.cruftpacks", &cruft_packs);
+       git_config_get_ulong("gc.maxcruftsize", &max_cruft_size);
        git_config_get_expiry("gc.pruneexpire", &prune_expire);
        git_config_get_expiry("gc.worktreepruneexpire", &prune_worktrees_expire);
        git_config_get_expiry("gc.logexpiry", &gc_log_expire);
@@ -170,6 +174,9 @@ static void gc_config(void)
        git_config_get_ulong("gc.bigpackthreshold", &big_pack_threshold);
        git_config_get_ulong("pack.deltacachesize", &max_delta_cache_size);
 
+       git_config_get_string("gc.repackfilter", &repack_filter);
+       git_config_get_string("gc.repackfilterto", &repack_filter_to);
+
        git_config(git_default_config, NULL);
 }
 
@@ -347,6 +354,9 @@ static void add_repack_all_option(struct string_list *keep_pack)
                strvec_push(&repack, "--cruft");
                if (prune_expire)
                        strvec_pushf(&repack, "--cruft-expiration=%s", prune_expire);
+               if (max_cruft_size)
+                       strvec_pushf(&repack, "--max-cruft-size=%lu",
+                                    max_cruft_size);
        } else {
                strvec_push(&repack, "-A");
                if (prune_expire)
@@ -355,6 +365,11 @@ static void add_repack_all_option(struct string_list *keep_pack)
 
        if (keep_pack)
                for_each_string_list(keep_pack, keep_one_pack, NULL);
+
+       if (repack_filter && *repack_filter)
+               strvec_pushf(&repack, "--filter=%s", repack_filter);
+       if (repack_filter_to && *repack_filter_to)
+               strvec_pushf(&repack, "--filter-to=%s", repack_filter_to);
 }
 
 static void add_repack_incremental_option(void)
@@ -575,6 +590,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                        N_("prune unreferenced objects"),
                        PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire },
                OPT_BOOL(0, "cruft", &cruft_packs, N_("pack unreferenced objects separately")),
+               OPT_MAGNITUDE(0, "max-cruft-size", &max_cruft_size,
+                             N_("with --cruft, limit the size of new cruft packs")),
                OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
                OPT_BOOL_F(0, "auto", &auto_gc, N_("enable auto-gc mode"),
                           PARSE_OPT_NOCOMPLETE),
@@ -1403,7 +1420,7 @@ static void initialize_task_config(int schedule)
        strbuf_release(&config_name);
 }
 
-static int task_option_parse(const struct option *opt,
+static int task_option_parse(const struct option *opt UNUSED,
                             const char *arg, int unset)
 {
        int i, num_selected = 0;
@@ -1526,19 +1543,18 @@ static int maintenance_register(int argc, const char **argv, const char *prefix)
 
        if (!found) {
                int rc;
-               char *user_config = NULL, *xdg_config = NULL;
+               char *global_config_file = NULL;
 
                if (!config_file) {
-                       git_global_config(&user_config, &xdg_config);
-                       config_file = user_config;
-                       if (!user_config)
-                               die(_("$HOME not set"));
+                       global_config_file = git_global_config();
+                       config_file = global_config_file;
                }
+               if (!config_file)
+                       die(_("$HOME not set"));
                rc = git_config_set_multivar_in_file_gently(
                        config_file, "maintenance.repo", maintpath,
                        CONFIG_REGEX_NONE, 0);
-               free(user_config);
-               free(xdg_config);
+               free(global_config_file);
 
                if (rc)
                        die(_("unable to add '%s' value of '%s'"),
@@ -1595,18 +1611,18 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
 
        if (found) {
                int rc;
-               char *user_config = NULL, *xdg_config = NULL;
+               char *global_config_file = NULL;
+
                if (!config_file) {
-                       git_global_config(&user_config, &xdg_config);
-                       config_file = user_config;
-                       if (!user_config)
-                               die(_("$HOME not set"));
+                       global_config_file = git_global_config();
+                       config_file = global_config_file;
                }
+               if (!config_file)
+                       die(_("$HOME not set"));
                rc = git_config_set_multivar_in_file_gently(
                        config_file, key, NULL, maintpath,
                        CONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);
-               free(user_config);
-               free(xdg_config);
+               free(global_config_file);
 
                if (rc &&
                    (!force || rc == CONFIG_NOTHING_SET))
@@ -1708,6 +1724,15 @@ static int get_schedule_cmd(const char **cmd, int *is_available)
        return 1;
 }
 
+static int get_random_minute(void)
+{
+       /* Use a static value when under tests. */
+       if (getenv("GIT_TEST_MAINT_SCHEDULER"))
+               return 13;
+
+       return git_rand() % 60;
+}
+
 static int is_launchctl_available(void)
 {
        const char *cmd = "launchctl";
@@ -1820,6 +1845,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
        struct strbuf plist = STRBUF_INIT, plist2 = STRBUF_INIT;
        struct stat st;
        const char *cmd = "launchctl";
+       int minute = get_random_minute();
 
        get_schedule_cmd(&cmd, NULL);
        preamble = "<?xml version=\"1.0\"?>\n"
@@ -1845,29 +1871,30 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
        case SCHEDULE_HOURLY:
                repeat = "<dict>\n"
                         "<key>Hour</key><integer>%d</integer>\n"
-                        "<key>Minute</key><integer>0</integer>\n"
+                        "<key>Minute</key><integer>%d</integer>\n"
                         "</dict>\n";
                for (i = 1; i <= 23; i++)
-                       strbuf_addf(&plist, repeat, i);
+                       strbuf_addf(&plist, repeat, i, minute);
                break;
 
        case SCHEDULE_DAILY:
                repeat = "<dict>\n"
                         "<key>Day</key><integer>%d</integer>\n"
                         "<key>Hour</key><integer>0</integer>\n"
-                        "<key>Minute</key><integer>0</integer>\n"
+                        "<key>Minute</key><integer>%d</integer>\n"
                         "</dict>\n";
                for (i = 1; i <= 6; i++)
-                       strbuf_addf(&plist, repeat, i);
+                       strbuf_addf(&plist, repeat, i, minute);
                break;
 
        case SCHEDULE_WEEKLY:
-               strbuf_addstr(&plist,
-                             "<dict>\n"
-                             "<key>Day</key><integer>0</integer>\n"
-                             "<key>Hour</key><integer>0</integer>\n"
-                             "<key>Minute</key><integer>0</integer>\n"
-                             "</dict>\n");
+               strbuf_addf(&plist,
+                           "<dict>\n"
+                           "<key>Day</key><integer>0</integer>\n"
+                           "<key>Hour</key><integer>0</integer>\n"
+                           "<key>Minute</key><integer>%d</integer>\n"
+                           "</dict>\n",
+                           minute);
                break;
 
        default:
@@ -1923,7 +1950,7 @@ static int launchctl_add_plists(void)
               launchctl_schedule_plist(exec_path, SCHEDULE_WEEKLY);
 }
 
-static int launchctl_update_schedule(int run_maintenance, int fd)
+static int launchctl_update_schedule(int run_maintenance, int fd UNUSED)
 {
        if (run_maintenance)
                return launchctl_add_plists();
@@ -1984,6 +2011,7 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
        const char *frequency = get_frequency(schedule);
        char *name = schtasks_task_name(frequency);
        struct strbuf tfilename = STRBUF_INIT;
+       int minute = get_random_minute();
 
        get_schedule_cmd(&cmd, NULL);
 
@@ -2004,7 +2032,7 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
        switch (schedule) {
        case SCHEDULE_HOURLY:
                fprintf(tfile->fp,
-                       "<StartBoundary>2020-01-01T01:00:00</StartBoundary>\n"
+                       "<StartBoundary>2020-01-01T01:%02d:00</StartBoundary>\n"
                        "<Enabled>true</Enabled>\n"
                        "<ScheduleByDay>\n"
                        "<DaysInterval>1</DaysInterval>\n"
@@ -2013,12 +2041,13 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
                        "<Interval>PT1H</Interval>\n"
                        "<Duration>PT23H</Duration>\n"
                        "<StopAtDurationEnd>false</StopAtDurationEnd>\n"
-                       "</Repetition>\n");
+                       "</Repetition>\n",
+                       minute);
                break;
 
        case SCHEDULE_DAILY:
                fprintf(tfile->fp,
-                       "<StartBoundary>2020-01-01T00:00:00</StartBoundary>\n"
+                       "<StartBoundary>2020-01-01T00:%02d:00</StartBoundary>\n"
                        "<Enabled>true</Enabled>\n"
                        "<ScheduleByWeek>\n"
                        "<DaysOfWeek>\n"
@@ -2030,19 +2059,21 @@ static int schtasks_schedule_task(const char *exec_path, enum schedule_priority
                        "<Saturday />\n"
                        "</DaysOfWeek>\n"
                        "<WeeksInterval>1</WeeksInterval>\n"
-                       "</ScheduleByWeek>\n");
+                       "</ScheduleByWeek>\n",
+                       minute);
                break;
 
        case SCHEDULE_WEEKLY:
                fprintf(tfile->fp,
-                       "<StartBoundary>2020-01-01T00:00:00</StartBoundary>\n"
+                       "<StartBoundary>2020-01-01T00:%02d:00</StartBoundary>\n"
                        "<Enabled>true</Enabled>\n"
                        "<ScheduleByWeek>\n"
                        "<DaysOfWeek>\n"
                        "<Sunday />\n"
                        "</DaysOfWeek>\n"
                        "<WeeksInterval>1</WeeksInterval>\n"
-                       "</ScheduleByWeek>\n");
+                       "</ScheduleByWeek>\n",
+                       minute);
                break;
 
        default:
@@ -2100,7 +2131,7 @@ static int schtasks_schedule_tasks(void)
               schtasks_schedule_task(exec_path, SCHEDULE_WEEKLY);
 }
 
-static int schtasks_update_schedule(int run_maintenance, int fd)
+static int schtasks_update_schedule(int run_maintenance, int fd UNUSED)
 {
        if (run_maintenance)
                return schtasks_schedule_tasks();
@@ -2159,6 +2190,7 @@ static int crontab_update_schedule(int run_maintenance, int fd)
        FILE *cron_list, *cron_in;
        struct strbuf line = STRBUF_INIT;
        struct tempfile *tmpedit = NULL;
+       int minute = get_random_minute();
 
        get_schedule_cmd(&cmd, NULL);
        strvec_split(&crontab_list.args, cmd);
@@ -2213,11 +2245,11 @@ static int crontab_update_schedule(int run_maintenance, int fd)
                        "# replaced in the future by a Git command.\n\n");
 
                strbuf_addf(&line_format,
-                           "%%s %%s * * %%s \"%s/git\" --exec-path=\"%s\" for-each-repo --config=maintenance.repo maintenance run --schedule=%%s\n",
+                           "%%d %%s * * %%s \"%s/git\" --exec-path=\"%s\" for-each-repo --config=maintenance.repo maintenance run --schedule=%%s\n",
                            exec_path, exec_path);
-               fprintf(cron_in, line_format.buf, "0", "1-23", "*", "hourly");
-               fprintf(cron_in, line_format.buf, "0", "0", "1-6", "daily");
-               fprintf(cron_in, line_format.buf, "0", "0", "0", "weekly");
+               fprintf(cron_in, line_format.buf, minute, "1-23", "*", "hourly");
+               fprintf(cron_in, line_format.buf, minute, "0", "1-6", "daily");
+               fprintf(cron_in, line_format.buf, minute, "0", "0", "weekly");
                strbuf_release(&line_format);
 
                fprintf(cron_in, "\n%s\n", END_LINE);
@@ -2276,77 +2308,54 @@ static char *xdg_config_home_systemd(const char *filename)
        return xdg_config_home_for("systemd/user", filename);
 }
 
-static int systemd_timer_enable_unit(int enable,
-                                    enum schedule_priority schedule)
-{
-       const char *cmd = "systemctl";
-       struct child_process child = CHILD_PROCESS_INIT;
-       const char *frequency = get_frequency(schedule);
+#define SYSTEMD_UNIT_FORMAT "git-maintenance@%s.%s"
 
-       /*
-        * Disabling the systemd unit while it is already disabled makes
-        * systemctl print an error.
-        * Let's ignore it since it means we already are in the expected state:
-        * the unit is disabled.
-        *
-        * On the other hand, enabling a systemd unit which is already enabled
-        * produces no error.
-        */
-       if (!enable)
-               child.no_stderr = 1;
-
-       get_schedule_cmd(&cmd, NULL);
-       strvec_split(&child.args, cmd);
-       strvec_pushl(&child.args, "--user", enable ? "enable" : "disable",
-                    "--now", NULL);
-       strvec_pushf(&child.args, "git-maintenance@%s.timer", frequency);
-
-       if (start_command(&child))
-               return error(_("failed to start systemctl"));
-       if (finish_command(&child))
-               /*
-                * Disabling an already disabled systemd unit makes
-                * systemctl fail.
-                * Let's ignore this failure.
-                *
-                * Enabling an enabled systemd unit doesn't fail.
-                */
-               if (enable)
-                       return error(_("failed to run systemctl"));
-       return 0;
-}
-
-static int systemd_timer_delete_unit_templates(void)
+static int systemd_timer_delete_timer_file(enum schedule_priority priority)
 {
        int ret = 0;
-       char *filename = xdg_config_home_systemd("git-maintenance@.timer");
-       if (unlink(filename) && !is_missing_file_error(errno))
-               ret = error_errno(_("failed to delete '%s'"), filename);
-       FREE_AND_NULL(filename);
+       const char *frequency = get_frequency(priority);
+       char *local_timer_name = xstrfmt(SYSTEMD_UNIT_FORMAT, frequency, "timer");
+       char *filename = xdg_config_home_systemd(local_timer_name);
 
-       filename = xdg_config_home_systemd("git-maintenance@.service");
        if (unlink(filename) && !is_missing_file_error(errno))
                ret = error_errno(_("failed to delete '%s'"), filename);
 
        free(filename);
+       free(local_timer_name);
        return ret;
 }
 
-static int systemd_timer_delete_units(void)
+static int systemd_timer_delete_service_template(void)
 {
-       return systemd_timer_enable_unit(0, SCHEDULE_HOURLY) ||
-              systemd_timer_enable_unit(0, SCHEDULE_DAILY) ||
-              systemd_timer_enable_unit(0, SCHEDULE_WEEKLY) ||
-              systemd_timer_delete_unit_templates();
+       int ret = 0;
+       char *local_service_name = xstrfmt(SYSTEMD_UNIT_FORMAT, "", "service");
+       char *filename = xdg_config_home_systemd(local_service_name);
+       if (unlink(filename) && !is_missing_file_error(errno))
+               ret = error_errno(_("failed to delete '%s'"), filename);
+
+       free(filename);
+       free(local_service_name);
+       return ret;
 }
 
-static int systemd_timer_write_unit_templates(const char *exec_path)
+/*
+ * Write the schedule information into a git-maintenance@<schedule>.timer
+ * file using a custom minute. This timer file cannot use the templating
+ * system, so we generate a specific file for each.
+ */
+static int systemd_timer_write_timer_file(enum schedule_priority schedule,
+                                         int minute)
 {
+       int res = -1;
        char *filename;
        FILE *file;
        const char *unit;
+       char *schedule_pattern = NULL;
+       const char *frequency = get_frequency(schedule);
+       char *local_timer_name = xstrfmt(SYSTEMD_UNIT_FORMAT, frequency, "timer");
+
+       filename = xdg_config_home_systemd(local_timer_name);
 
-       filename = xdg_config_home_systemd("git-maintenance@.timer");
        if (safe_create_leading_directories(filename)) {
                error(_("failed to create directories for '%s'"), filename);
                goto error;
@@ -2355,6 +2364,23 @@ static int systemd_timer_write_unit_templates(const char *exec_path)
        if (!file)
                goto error;
 
+       switch (schedule) {
+       case SCHEDULE_HOURLY:
+               schedule_pattern = xstrfmt("*-*-* 1..23:%02d:00", minute);
+               break;
+
+       case SCHEDULE_DAILY:
+               schedule_pattern = xstrfmt("Tue..Sun *-*-* 0:%02d:00", minute);
+               break;
+
+       case SCHEDULE_WEEKLY:
+               schedule_pattern = xstrfmt("Mon 0:%02d:00", minute);
+               break;
+
+       default:
+               BUG("Unhandled schedule_priority");
+       }
+
        unit = "# This file was created and is maintained by Git.\n"
               "# Any edits made in this file might be replaced in the future\n"
               "# by a Git command.\n"
@@ -2363,12 +2389,12 @@ static int systemd_timer_write_unit_templates(const char *exec_path)
               "Description=Optimize Git repositories data\n"
               "\n"
               "[Timer]\n"
-              "OnCalendar=%i\n"
+              "OnCalendar=%s\n"
               "Persistent=true\n"
               "\n"
               "[Install]\n"
               "WantedBy=timers.target\n";
-       if (fputs(unit, file) == EOF) {
+       if (fprintf(file, unit, schedule_pattern) < 0) {
                error(_("failed to write to '%s'"), filename);
                fclose(file);
                goto error;
@@ -2377,9 +2403,36 @@ static int systemd_timer_write_unit_templates(const char *exec_path)
                error_errno(_("failed to flush '%s'"), filename);
                goto error;
        }
+
+       res = 0;
+
+error:
+       free(schedule_pattern);
+       free(local_timer_name);
        free(filename);
+       return res;
+}
+
+/*
+ * No matter the schedule, we use the same service and can make use of the
+ * templating system. When installing git-maintenance@<schedule>.timer,
+ * systemd will notice that git-maintenance@.service exists as a template
+ * and will use this file and insert the <schedule> into the template at
+ * the position of "%i".
+ */
+static int systemd_timer_write_service_template(const char *exec_path)
+{
+       int res = -1;
+       char *filename;
+       FILE *file;
+       const char *unit;
+       char *local_service_name = xstrfmt(SYSTEMD_UNIT_FORMAT, "", "service");
 
-       filename = xdg_config_home_systemd("git-maintenance@.service");
+       filename = xdg_config_home_systemd(local_service_name);
+       if (safe_create_leading_directories(filename)) {
+               error(_("failed to create directories for '%s'"), filename);
+               goto error;
+       }
        file = fopen_or_warn(filename, "w");
        if (!file)
                goto error;
@@ -2397,7 +2450,7 @@ static int systemd_timer_write_unit_templates(const char *exec_path)
               "LockPersonality=yes\n"
               "MemoryDenyWriteExecute=yes\n"
               "NoNewPrivileges=yes\n"
-              "RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6\n"
+              "RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_VSOCK\n"
               "RestrictNamespaces=yes\n"
               "RestrictRealtime=yes\n"
               "RestrictSUIDSGID=yes\n"
@@ -2412,29 +2465,114 @@ static int systemd_timer_write_unit_templates(const char *exec_path)
                error_errno(_("failed to flush '%s'"), filename);
                goto error;
        }
+
+       res = 0;
+
+error:
+       free(local_service_name);
        free(filename);
+       return res;
+}
+
+static int systemd_timer_enable_unit(int enable,
+                                    enum schedule_priority schedule,
+                                    int minute)
+{
+       const char *cmd = "systemctl";
+       struct child_process child = CHILD_PROCESS_INIT;
+       const char *frequency = get_frequency(schedule);
+
+       /*
+        * Disabling the systemd unit while it is already disabled makes
+        * systemctl print an error.
+        * Let's ignore it since it means we already are in the expected state:
+        * the unit is disabled.
+        *
+        * On the other hand, enabling a systemd unit which is already enabled
+        * produces no error.
+        */
+       if (!enable)
+               child.no_stderr = 1;
+       else if (systemd_timer_write_timer_file(schedule, minute))
+               return -1;
+
+       get_schedule_cmd(&cmd, NULL);
+       strvec_split(&child.args, cmd);
+       strvec_pushl(&child.args, "--user", enable ? "enable" : "disable",
+                    "--now", NULL);
+       strvec_pushf(&child.args, SYSTEMD_UNIT_FORMAT, frequency, "timer");
+
+       if (start_command(&child))
+               return error(_("failed to start systemctl"));
+       if (finish_command(&child))
+               /*
+                * Disabling an already disabled systemd unit makes
+                * systemctl fail.
+                * Let's ignore this failure.
+                *
+                * Enabling an enabled systemd unit doesn't fail.
+                */
+               if (enable)
+                       return error(_("failed to run systemctl"));
        return 0;
+}
+
+/*
+ * A previous version of Git wrote the timer units as template files.
+ * Clean these up, if they exist.
+ */
+static void systemd_timer_delete_stale_timer_templates(void)
+{
+       char *timer_template_name = xstrfmt(SYSTEMD_UNIT_FORMAT, "", "timer");
+       char *filename = xdg_config_home_systemd(timer_template_name);
+
+       if (unlink(filename) && !is_missing_file_error(errno))
+               warning(_("failed to delete '%s'"), filename);
 
-error:
        free(filename);
-       systemd_timer_delete_unit_templates();
-       return -1;
+       free(timer_template_name);
+}
+
+static int systemd_timer_delete_unit_files(void)
+{
+       systemd_timer_delete_stale_timer_templates();
+
+       /* Purposefully not short-circuited to make sure all are called. */
+       return systemd_timer_delete_timer_file(SCHEDULE_HOURLY) |
+              systemd_timer_delete_timer_file(SCHEDULE_DAILY) |
+              systemd_timer_delete_timer_file(SCHEDULE_WEEKLY) |
+              systemd_timer_delete_service_template();
+}
+
+static int systemd_timer_delete_units(void)
+{
+       int minute = get_random_minute();
+       /* Purposefully not short-circuited to make sure all are called. */
+       return systemd_timer_enable_unit(0, SCHEDULE_HOURLY, minute) |
+              systemd_timer_enable_unit(0, SCHEDULE_DAILY, minute) |
+              systemd_timer_enable_unit(0, SCHEDULE_WEEKLY, minute) |
+              systemd_timer_delete_unit_files();
 }
 
 static int systemd_timer_setup_units(void)
 {
+       int minute = get_random_minute();
        const char *exec_path = git_exec_path();
 
-       int ret = systemd_timer_write_unit_templates(exec_path) ||
-                 systemd_timer_enable_unit(1, SCHEDULE_HOURLY) ||
-                 systemd_timer_enable_unit(1, SCHEDULE_DAILY) ||
-                 systemd_timer_enable_unit(1, SCHEDULE_WEEKLY);
+       int ret = systemd_timer_write_service_template(exec_path) ||
+                 systemd_timer_enable_unit(1, SCHEDULE_HOURLY, minute) ||
+                 systemd_timer_enable_unit(1, SCHEDULE_DAILY, minute) ||
+                 systemd_timer_enable_unit(1, SCHEDULE_WEEKLY, minute);
+
        if (ret)
                systemd_timer_delete_units();
+       else
+               systemd_timer_delete_stale_timer_templates();
+
        return ret;
 }
 
-static int systemd_timer_update_schedule(int run_maintenance, int fd)
+static int systemd_timer_update_schedule(int run_maintenance, int fd UNUSED)
 {
        if (run_maintenance)
                return systemd_timer_setup_units();
@@ -2606,9 +2744,12 @@ static int maintenance_start(int argc, const char **argv, const char *prefix)
        opts.scheduler = resolve_scheduler(opts.scheduler);
        validate_scheduler(opts.scheduler);
 
+       if (update_background_schedule(&opts, 1))
+               die(_("failed to set up maintenance schedule"));
+
        if (maintenance_register(ARRAY_SIZE(register_args)-1, register_args, NULL))
                warning(_("failed to add repo to global config"));
-       return update_background_schedule(&opts, 1);
+       return 0;
 }
 
 static const char *const builtin_maintenance_stop_usage[] = {
index 20d0dfe9cf1dfefe6ffacb23bd500701cca71a09..66a7389f9f4a21df975ef12a00d93fd7d8eee46f 100644 (file)
@@ -4,7 +4,6 @@
 #include "builtin.h"
 #include "commit.h"
 #include "tar.h"
-#include "quote.h"
 
 static const char builtin_get_tar_commit_id_usage[] =
 "git get-tar-commit-id";
index 0c2b8a376f8e350da5e089b61fc2cc02f4e8efc8..5777ba82a988e8a26dcae2e77ab8fb3423b70a6f 100644 (file)
@@ -4,19 +4,16 @@
  * Copyright (c) 2006 Junio C Hamano
  */
 #include "builtin.h"
+#include "abspath.h"
 #include "gettext.h"
 #include "hex.h"
 #include "repository.h"
 #include "config.h"
-#include "blob.h"
-#include "tree.h"
-#include "commit.h"
 #include "tag.h"
 #include "tree-walk.h"
 #include "parse-options.h"
 #include "string-list.h"
 #include "run-command.h"
-#include "userdiff.h"
 #include "grep.h"
 #include "quote.h"
 #include "dir.h"
@@ -574,6 +571,8 @@ static int grep_cache(struct grep_opt *opt,
 
                        data = repo_read_object_file(the_repository, &ce->oid,
                                                     &type, &size);
+                       if (!data)
+                               die(_("unable to read tree %s"), oid_to_hex(&ce->oid));
                        init_tree_desc(&tree, &ce->oid, data, size);
 
                        hit |= grep_tree(opt, pathspec, &tree, &name, 0, 0);
@@ -812,14 +811,20 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
 {
        struct grep_opt *grep_opt = opt->value;
        int from_stdin;
+       const char *filename = arg;
        FILE *patterns;
        int lno = 0;
        struct strbuf sb = STRBUF_INIT;
 
        BUG_ON_OPT_NEG(unset);
 
-       from_stdin = !strcmp(arg, "-");
-       patterns = from_stdin ? stdin : fopen(arg, "r");
+       if (!*filename)
+               ; /* leave it as-is */
+       else
+               filename = prefix_filename_except_for_dash(grep_prefix, filename);
+
+       from_stdin = !strcmp(filename, "-");
+       patterns = from_stdin ? stdin : fopen(filename, "r");
        if (!patterns)
                die_errno(_("cannot open '%s'"), arg);
        while (strbuf_getline(&sb, patterns) == 0) {
@@ -833,6 +838,8 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
        if (!from_stdin)
                fclose(patterns);
        strbuf_release(&sb);
+       if (filename != arg)
+               free((void *)filename);
        return 0;
 }
 
@@ -924,9 +931,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                         N_("process binary files with textconv filters")),
                OPT_SET_INT('r', "recursive", &opt.max_depth,
                            N_("search in subdirectories (default)"), -1),
-               { OPTION_INTEGER, 0, "max-depth", &opt.max_depth, N_("depth"),
-                       N_("descend at most <depth> levels"), PARSE_OPT_NONEG,
-                       NULL, 1 },
+               OPT_INTEGER_F(0, "max-depth", &opt.max_depth,
+                       N_("descend at most <n> levels"), PARSE_OPT_NONEG),
                OPT_GROUP(""),
                OPT_SET_INT('E', "extended-regexp", &opt.pattern_type_option,
                            N_("use extended POSIX regular expressions"),
@@ -990,7 +996,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                OPT_CALLBACK_F(0, "and", &opt, NULL,
                        N_("combine patterns specified with -e"),
                        PARSE_OPT_NOARG | PARSE_OPT_NONEG, and_callback),
-               OPT_BOOL(0, "or", &dummy, ""),
+               OPT_BOOL_F(0, "or", &dummy, "", PARSE_OPT_NONEG),
                OPT_CALLBACK_F(0, "not", &opt, NULL, "",
                        PARSE_OPT_NOARG | PARSE_OPT_NONEG, not_callback),
                OPT_CALLBACK_F('(', NULL, &opt, NULL, "",
index 5ffec99dceaf5c95d9b57c1f0c6c90358b80507d..82ca6d2bfdc7797a13646ff01271ceb803b0a973 100644 (file)
@@ -14,7 +14,6 @@
 #include "blob.h"
 #include "quote.h"
 #include "parse-options.h"
-#include "exec-cmd.h"
 #include "setup.h"
 #include "strbuf.h"
 #include "write-or-die.h"
index 09b51a6487c3928bc099567109193c32fe82fe30..5234693a94b40e2a6dd7aa4a8d724f0ac7b06a3b 100644 (file)
@@ -3,7 +3,6 @@
 #include "gettext.h"
 #include "hook.h"
 #include "parse-options.h"
-#include "strbuf.h"
 #include "strvec.h"
 
 #define BUILTIN_HOOK_RUN_USAGE \
index 006ffdc9c550d75a034960635f13d87b33dc57cc..856428fef9577eaa7f4407d598e073e488e4d089 100644 (file)
@@ -8,11 +8,9 @@
 #include "csum-file.h"
 #include "blob.h"
 #include "commit.h"
-#include "tag.h"
 #include "tree.h"
 #include "progress.h"
 #include "fsck.h"
-#include "exec-cmd.h"
 #include "strbuf.h"
 #include "streaming.h"
 #include "thread-utils.h"
@@ -26,7 +24,7 @@
 #include "setup.h"
 
 static const char index_pack_usage[] =
-"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
+"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict[=<msg-id>=<severity>...]] [--fsck-objects[=<msg-id>=<severity>...]] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
 
 struct object_entry {
        struct pack_idx_entry idx;
@@ -1166,6 +1164,7 @@ static void parse_pack_objects(unsigned char *hash)
        struct ofs_delta_entry *ofs_delta = ofs_deltas;
        struct object_id ref_delta_oid;
        struct stat st;
+       git_hash_ctx tmp_ctx;
 
        if (verbose)
                progress = start_progress(
@@ -1202,7 +1201,9 @@ static void parse_pack_objects(unsigned char *hash)
 
        /* Check pack integrity */
        flush();
-       the_hash_algo->final_fn(hash, &input_ctx);
+       the_hash_algo->init_fn(&tmp_ctx);
+       the_hash_algo->clone_fn(&tmp_ctx, &input_ctx);
+       the_hash_algo->final_fn(hash, &tmp_ctx);
        if (!hasheq(fill(the_hash_algo->rawsz), hash))
                die(_("pack is corrupted (SHA1 mismatch)"));
        use(the_hash_algo->rawsz);
@@ -1254,6 +1255,7 @@ static void resolve_deltas(void)
        base_cache_limit = delta_base_cache_limit * nr_threads;
        if (nr_threads > 1 || getenv("GIT_FORCE_THREADS")) {
                init_thread();
+               work_lock();
                for (i = 0; i < nr_threads; i++) {
                        int ret = pthread_create(&thread_data[i].thread, NULL,
                                                 threaded_second_pass, thread_data + i);
@@ -1261,6 +1263,7 @@ static void resolve_deltas(void)
                                die(_("unable to create thread: %s"),
                                    strerror(ret));
                }
+               work_unlock();
                for (i = 0; i < nr_threads; i++)
                        pthread_join(thread_data[i].thread, NULL);
                cleanup_thread();
@@ -1521,14 +1524,12 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
        struct strbuf pack_name = STRBUF_INIT;
        struct strbuf index_name = STRBUF_INIT;
        struct strbuf rev_index_name = STRBUF_INIT;
-       int err;
 
        if (!from_stdin) {
                close(input_fd);
        } else {
                fsync_component_or_die(FSYNC_COMPONENT_PACK, output_fd, curr_pack_name);
-               err = close(output_fd);
-               if (err)
+               if (close(output_fd))
                        die_errno(_("error while closing pack file"));
        }
 
@@ -1563,17 +1564,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
                write_or_die(1, buf.buf, buf.len);
                strbuf_release(&buf);
 
-               /*
-                * Let's just mimic git-unpack-objects here and write
-                * the last part of the input buffer to stdout.
-                */
-               while (input_len) {
-                       err = xwrite(1, input_buffer + input_offset, input_len);
-                       if (err <= 0)
-                               break;
-                       input_len -= err;
-                       input_offset += err;
-               }
+               /* Write the last part of the buffer to stdout */
+               write_in_full(1, input_buffer + input_offset, input_len);
        }
 
        strbuf_release(&rev_index_name);
@@ -1782,8 +1774,9 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
                        } else if (!strcmp(arg, "--check-self-contained-and-connected")) {
                                strict = 1;
                                check_self_contained_and_connected = 1;
-                       } else if (!strcmp(arg, "--fsck-objects")) {
+                       } else if (skip_to_optional_arg(arg, "--fsck-objects", &arg)) {
                                do_fsck_object = 1;
+                               fsck_set_msg_types(&fsck_options, arg);
                        } else if (!strcmp(arg, "--verify")) {
                                verify = 1;
                        } else if (!strcmp(arg, "--verify-stat")) {
index cb727c826f5653ab2827ccfbd575e6d305fad75a..0170469b849e5e5ad52cf8586f4540088b0edd61 100644 (file)
@@ -5,12 +5,13 @@
  */
 #include "builtin.h"
 #include "abspath.h"
-#include "config.h"
 #include "environment.h"
 #include "gettext.h"
 #include "object-file.h"
 #include "parse-options.h"
 #include "path.h"
+#include "refs.h"
+#include "repository.h"
 #include "setup.h"
 #include "strbuf.h"
 
@@ -57,6 +58,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
 static const char *const init_db_usage[] = {
        N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
           "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+          "         [--ref-format=<format>]\n"
           "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
           "         [--shared[=<permissions>]] [<directory>]"),
        NULL
@@ -76,8 +78,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
        const char *template_dir = NULL;
        unsigned int flags = 0;
        const char *object_format = NULL;
+       const char *ref_format = NULL;
        const char *initial_branch = NULL;
        int hash_algo = GIT_HASH_UNKNOWN;
+       unsigned int ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN;
        int init_shared_repository = -1;
        const struct option init_db_options[] = {
                OPT_STRING(0, "template", &template_dir, N_("template-directory"),
@@ -95,6 +99,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
                           N_("override the name of the initial branch")),
                OPT_STRING(0, "object-format", &object_format, N_("hash"),
                           N_("specify the hash algorithm to use")),
+               OPT_STRING(0, "ref-format", &ref_format, N_("format"),
+                          N_("specify the reference format to use")),
                OPT_END()
        };
 
@@ -158,6 +164,12 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
                        die(_("unknown hash algorithm '%s'"), object_format);
        }
 
+       if (ref_format) {
+               ref_storage_format = ref_storage_format_by_name(ref_format);
+               if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+                       die(_("unknown ref storage format '%s'"), ref_format);
+       }
+
        if (init_shared_repository != -1)
                set_shared_repository(init_shared_repository);
 
@@ -236,5 +248,6 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 
        flags |= INIT_DB_EXIST_OK;
        return init_db(git_dir, real_git_dir, template_dir, hash_algo,
-                      initial_branch, init_shared_repository, flags);
+                      ref_storage_format, initial_branch,
+                      init_shared_repository, flags);
 }
index c5e83452654de9242f01a4045fb90f3f058ea8f7..8768bfea3c43fe43d8a41c2dd148912b1546d5b7 100644 (file)
@@ -9,12 +9,13 @@
 #include "gettext.h"
 #include "parse-options.h"
 #include "string-list.h"
+#include "tempfile.h"
 #include "trailer.h"
 #include "config.h"
 
 static const char * const git_interpret_trailers_usage[] = {
        N_("git interpret-trailers [--in-place] [--trim-empty]\n"
-          "                       [(--trailer <token>[(=|:)<value>])...]\n"
+          "                       [(--trailer (<key>|<key-alias>)[(=|:)<value>])...]\n"
           "                       [--parse] [<file>...]"),
        NULL
 };
@@ -24,21 +25,24 @@ static enum trailer_if_exists if_exists;
 static enum trailer_if_missing if_missing;
 
 static int option_parse_where(const struct option *opt,
-                             const char *arg, int unset)
+                             const char *arg, int unset UNUSED)
 {
-       return trailer_set_where(&where, arg);
+       /* unset implies NULL arg, which is handled in our helper */
+       return trailer_set_where(opt->value, arg);
 }
 
 static int option_parse_if_exists(const struct option *opt,
-                                 const char *arg, int unset)
+                                 const char *arg, int unset UNUSED)
 {
-       return trailer_set_if_exists(&if_exists, arg);
+       /* unset implies NULL arg, which is handled in our helper */
+       return trailer_set_if_exists(opt->value, arg);
 }
 
 static int option_parse_if_missing(const struct option *opt,
-                                  const char *arg, int unset)
+                                  const char *arg, int unset UNUSED)
 {
-       return trailer_set_if_missing(&if_missing, arg);
+       /* unset implies NULL arg, which is handled in our helper */
+       return trailer_set_if_missing(opt->value, arg);
 }
 
 static void new_trailers_clear(struct list_head *trailers)
@@ -88,6 +92,102 @@ static int parse_opt_parse(const struct option *opt, const char *arg,
        return 0;
 }
 
+static struct tempfile *trailers_tempfile;
+
+static FILE *create_in_place_tempfile(const char *file)
+{
+       struct stat st;
+       struct strbuf filename_template = STRBUF_INIT;
+       const char *tail;
+       FILE *outfile;
+
+       if (stat(file, &st))
+               die_errno(_("could not stat %s"), file);
+       if (!S_ISREG(st.st_mode))
+               die(_("file %s is not a regular file"), file);
+       if (!(st.st_mode & S_IWUSR))
+               die(_("file %s is not writable by user"), file);
+
+       /* Create temporary file in the same directory as the original */
+       tail = strrchr(file, '/');
+       if (tail)
+               strbuf_add(&filename_template, file, tail - file + 1);
+       strbuf_addstr(&filename_template, "git-interpret-trailers-XXXXXX");
+
+       trailers_tempfile = xmks_tempfile_m(filename_template.buf, st.st_mode);
+       strbuf_release(&filename_template);
+       outfile = fdopen_tempfile(trailers_tempfile, "w");
+       if (!outfile)
+               die_errno(_("could not open temporary file"));
+
+       return outfile;
+}
+
+static void read_input_file(struct strbuf *sb, const char *file)
+{
+       if (file) {
+               if (strbuf_read_file(sb, file, 0) < 0)
+                       die_errno(_("could not read input file '%s'"), file);
+       } else {
+               if (strbuf_read(sb, fileno(stdin), 0) < 0)
+                       die_errno(_("could not read from stdin"));
+       }
+}
+
+static void interpret_trailers(const struct process_trailer_options *opts,
+                              struct list_head *new_trailer_head,
+                              const char *file)
+{
+       LIST_HEAD(head);
+       struct strbuf sb = STRBUF_INIT;
+       struct strbuf trailer_block = STRBUF_INIT;
+       struct trailer_info info;
+       FILE *outfile = stdout;
+
+       trailer_config_init();
+
+       read_input_file(&sb, file);
+
+       if (opts->in_place)
+               outfile = create_in_place_tempfile(file);
+
+       parse_trailers(opts, &info, sb.buf, &head);
+
+       /* Print the lines before the trailers */
+       if (!opts->only_trailers)
+               fwrite(sb.buf, 1, info.trailer_block_start, outfile);
+
+       if (!opts->only_trailers && !info.blank_line_before_trailer)
+               fprintf(outfile, "\n");
+
+
+       if (!opts->only_input) {
+               LIST_HEAD(config_head);
+               LIST_HEAD(arg_head);
+               parse_trailers_from_config(&config_head);
+               parse_trailers_from_command_line_args(&arg_head, new_trailer_head);
+               list_splice(&config_head, &arg_head);
+               process_trailers_lists(&head, &arg_head);
+       }
+
+       /* Print trailer block. */
+       format_trailers(opts, &head, &trailer_block);
+       free_trailers(&head);
+       fwrite(trailer_block.buf, 1, trailer_block.len, outfile);
+       strbuf_release(&trailer_block);
+
+       /* Print the lines after the trailers as is */
+       if (!opts->only_trailers)
+               fwrite(sb.buf + info.trailer_block_end, 1, sb.len - info.trailer_block_end, outfile);
+       trailer_info_release(&info);
+
+       if (opts->in_place)
+               if (rename_tempfile(&trailers_tempfile, file))
+                       die_errno(_("could not rename temporary file to %s"), file);
+
+       strbuf_release(&sb);
+}
+
 int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
 {
        struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT;
@@ -97,19 +197,19 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "in-place", &opts.in_place, N_("edit files in place")),
                OPT_BOOL(0, "trim-empty", &opts.trim_empty, N_("trim empty trailers")),
 
-               OPT_CALLBACK(0, "where", NULL, N_("action"),
+               OPT_CALLBACK(0, "where", &where, N_("placement"),
                             N_("where to place the new trailer"), option_parse_where),
-               OPT_CALLBACK(0, "if-exists", NULL, N_("action"),
+               OPT_CALLBACK(0, "if-exists", &if_exists, N_("action"),
                             N_("action if trailer already exists"), option_parse_if_exists),
-               OPT_CALLBACK(0, "if-missing", NULL, N_("action"),
+               OPT_CALLBACK(0, "if-missing", &if_missing, N_("action"),
                             N_("action if trailer is missing"), option_parse_if_missing),
 
                OPT_BOOL(0, "only-trailers", &opts.only_trailers, N_("output only the trailers")),
-               OPT_BOOL(0, "only-input", &opts.only_input, N_("do not apply config rules")),
-               OPT_BOOL(0, "unfold", &opts.unfold, N_("join whitespace-continued values")),
-               OPT_CALLBACK_F(0, "parse", &opts, NULL, N_("set parsing options"),
+               OPT_BOOL(0, "only-input", &opts.only_input, N_("do not apply trailer.* configuration variables")),
+               OPT_BOOL(0, "unfold", &opts.unfold, N_("reformat multiline trailer values as single-line values")),
+               OPT_CALLBACK_F(0, "parse", &opts, NULL, N_("alias for --only-trailers --only-input --unfold"),
                        PARSE_OPT_NOARG | PARSE_OPT_NONEG, parse_opt_parse),
-               OPT_BOOL(0, "no-divider", &opts.no_divider, N_("do not treat --- specially")),
+               OPT_BOOL(0, "no-divider", &opts.no_divider, N_("do not treat \"---\" as the end of input")),
                OPT_CALLBACK(0, "trailer", &trailers, N_("trailer"),
                                N_("trailer(s) to add"), option_parse_trailer),
                OPT_END()
@@ -129,11 +229,11 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
        if (argc) {
                int i;
                for (i = 0; i < argc; i++)
-                       process_trailers(argv[i], &opts, &trailers);
+                       interpret_trailers(&opts, &trailers, argv[i]);
        } else {
                if (opts.in_place)
                        die(_("no input file given for in-place editing"));
-               process_trailers(NULL, &opts, &trailers);
+               interpret_trailers(&opts, &trailers, NULL);
        }
 
        new_trailers_clear(&trailers);
index db3a88bfe96058679dff1059a6f4769599ee1801..e5da0d10434dddc146ee00d9b035e76c28e3b214 100644 (file)
@@ -26,7 +26,6 @@
 #include "tag.h"
 #include "reflog-walk.h"
 #include "patch-ids.h"
-#include "run-command.h"
 #include "shortlog.h"
 #include "remote.h"
 #include "string-list.h"
@@ -36,7 +35,6 @@
 #include "streaming.h"
 #include "version.h"
 #include "mailmap.h"
-#include "gpg-interface.h"
 #include "progress.h"
 #include "commit-slab.h"
 #include "repository.h"
@@ -118,16 +116,19 @@ static struct string_list decorate_refs_exclude = STRING_LIST_INIT_NODUP;
 static struct string_list decorate_refs_exclude_config = STRING_LIST_INIT_NODUP;
 static struct string_list decorate_refs_include = STRING_LIST_INIT_NODUP;
 
-static int clear_decorations_callback(const struct option *opt,
-                                           const char *arg, int unset)
+static int clear_decorations_callback(const struct option *opt UNUSED,
+                                     const char *arg, int unset)
 {
+       BUG_ON_OPT_NEG(unset);
+       BUG_ON_OPT_ARG(arg);
        string_list_clear(&decorate_refs_include, 0);
        string_list_clear(&decorate_refs_exclude, 0);
        use_default_decoration_filter = 0;
        return 0;
 }
 
-static int decorate_callback(const struct option *opt, const char *arg, int unset)
+static int decorate_callback(const struct option *opt UNUSED, const char *arg,
+                            int unset)
 {
        if (unset)
                decoration_style = 0;
@@ -173,16 +174,15 @@ static void cmd_log_init_defaults(struct rev_info *rev)
        if (default_follow)
                rev->diffopt.flags.default_follow_renames = 1;
        rev->verbose_header = 1;
+       init_diffstat_widths(&rev->diffopt);
        rev->diffopt.flags.recursive = 1;
-       rev->diffopt.stat_width = -1; /* use full terminal width */
-       rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
+       rev->diffopt.flags.allow_textconv = 1;
        rev->abbrev_commit = default_abbrev_commit;
        rev->show_root_diff = default_show_root;
        rev->subject_prefix = fmt_patch_subject_prefix;
        rev->patch_name_max = fmt_patch_name_max;
        rev->show_signature = default_show_signature;
        rev->encode_email_headers = default_encode_email_headers;
-       rev->diffopt.flags.allow_textconv = 1;
 
        if (default_date_mode)
                parse_date_format(default_date_mode, &rev->date_mode);
@@ -549,7 +549,7 @@ static int cmd_log_walk_no_free(struct rev_info *rev)
            rev->diffopt.flags.check_failed) {
                return 02;
        }
-       return diff_result_code(&rev->diffopt, 0);
+       return diff_result_code(&rev->diffopt);
 }
 
 static int cmd_log_walk(struct rev_info *rev)
@@ -592,8 +592,11 @@ static int git_log_config(const char *var, const char *value,
                        decoration_style = 0; /* maybe warn? */
                return 0;
        }
-       if (!strcmp(var, "log.diffmerges"))
+       if (!strcmp(var, "log.diffmerges")) {
+               if (!value)
+                       return config_error_nonbool(var);
                return diff_merges_config(value);
+       }
        if (!strcmp(var, "log.showroot")) {
                default_show_root = git_config_bool(var, value);
                return 0;
@@ -1253,7 +1256,15 @@ static void show_diffstat(struct rev_info *rev,
        fprintf(rev->diffopt.file, "\n");
 }
 
+static void read_desc_file(struct strbuf *buf, const char *desc_file)
+{
+       if (strbuf_read_file(buf, desc_file, 0) < 0)
+               die_errno(_("unable to read branch description file '%s'"),
+                         desc_file);
+}
+
 static void prepare_cover_text(struct pretty_print_context *pp,
+                              const char *description_file,
                               const char *branch_name,
                               struct strbuf *sb,
                               const char *encoding,
@@ -1267,7 +1278,9 @@ static void prepare_cover_text(struct pretty_print_context *pp,
        if (cover_from_description_mode == COVER_FROM_NONE)
                goto do_pp;
 
-       if (branch_name && *branch_name)
+       if (description_file && *description_file)
+               read_desc_file(&description_sb, description_file);
+       else if (branch_name && *branch_name)
                read_branch_desc(&description_sb, branch_name);
        if (!description_sb.len)
                goto do_pp;
@@ -1313,6 +1326,7 @@ static void get_notes_args(struct strvec *arg, struct rev_info *rev)
 static void make_cover_letter(struct rev_info *rev, int use_separate_file,
                              struct commit *origin,
                              int nr, struct commit **list,
+                             const char *description_file,
                              const char *branch_name,
                              int quiet)
 {
@@ -1351,8 +1365,10 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
        pp.date_mode.type = DATE_RFC2822;
        pp.rev = rev;
        pp.print_email_subject = 1;
+       pp.encode_email_headers = rev->encode_email_headers;
        pp_user_info(&pp, NULL, &sb, committer, encoding);
-       prepare_cover_text(&pp, branch_name, &sb, encoding, need_8bit_cte);
+       prepare_cover_text(&pp, description_file, branch_name, &sb,
+                          encoding, need_8bit_cte);
        fprintf(rev->diffopt.file, "%s\n", sb.buf);
 
        strbuf_release(&sb);
@@ -1468,19 +1484,16 @@ static int subject_prefix = 0;
 static int subject_prefix_callback(const struct option *opt, const char *arg,
                            int unset)
 {
+       struct strbuf *sprefix;
+
        BUG_ON_OPT_NEG(unset);
+       sprefix = opt->value;
        subject_prefix = 1;
-       ((struct rev_info *)opt->value)->subject_prefix = arg;
+       strbuf_reset(sprefix);
+       strbuf_addstr(sprefix, arg);
        return 0;
 }
 
-static int rfc_callback(const struct option *opt, const char *arg, int unset)
-{
-       BUG_ON_OPT_NEG(unset);
-       BUG_ON_OPT_ARG(arg);
-       return subject_prefix_callback(opt, "RFC PATCH", unset);
-}
-
 static int numbered_cmdline_opt = 0;
 
 static int numbered_callback(const struct option *opt, const char *arg,
@@ -1555,7 +1568,8 @@ static int inline_callback(const struct option *opt, const char *arg, int unset)
        return 0;
 }
 
-static int header_callback(const struct option *opt, const char *arg, int unset)
+static int header_callback(const struct option *opt UNUSED, const char *arg,
+                          int unset)
 {
        if (unset) {
                string_list_clear(&extra_hdr, 0);
@@ -1567,24 +1581,6 @@ static int header_callback(const struct option *opt, const char *arg, int unset)
        return 0;
 }
 
-static int to_callback(const struct option *opt, const char *arg, int unset)
-{
-       if (unset)
-               string_list_clear(&extra_to, 0);
-       else
-               string_list_append(&extra_to, arg);
-       return 0;
-}
-
-static int cc_callback(const struct option *opt, const char *arg, int unset)
-{
-       if (unset)
-               string_list_clear(&extra_cc, 0);
-       else
-               string_list_append(&extra_cc, arg);
-       return 0;
-}
-
 static int from_callback(const struct option *opt, const char *arg, int unset)
 {
        char **from = opt->value;
@@ -1629,7 +1625,7 @@ static struct commit *get_base_commit(const char *base_commit,
 {
        struct commit *base = NULL;
        struct commit **rev;
-       int i = 0, rev_nr = 0, auto_select, die_on_failure;
+       int i = 0, rev_nr = 0, auto_select, die_on_failure, ret;
 
        switch (auto_base) {
        case AUTO_BASE_NEVER:
@@ -1662,7 +1658,7 @@ static struct commit *get_base_commit(const char *base_commit,
                struct branch *curr_branch = branch_get(NULL);
                const char *upstream = branch_get_upstream(curr_branch, NULL);
                if (upstream) {
-                       struct commit_list *base_list;
+                       struct commit_list *base_list = NULL;
                        struct commit *commit;
                        struct object_id oid;
 
@@ -1673,11 +1669,12 @@ static struct commit *get_base_commit(const char *base_commit,
                                        return NULL;
                        }
                        commit = lookup_commit_or_die(&oid, "upstream base");
-                       base_list = repo_get_merge_bases_many(the_repository,
-                                                             commit, total,
-                                                             list);
-                       /* There should be one and only one merge base. */
-                       if (!base_list || base_list->next) {
+                       if (repo_get_merge_bases_many(the_repository,
+                                                     commit, total,
+                                                     list,
+                                                     &base_list) < 0 ||
+                           /* There should be one and only one merge base. */
+                           !base_list || base_list->next) {
                                if (die_on_failure) {
                                        die(_("could not find exact merge base"));
                                } else {
@@ -1708,11 +1705,11 @@ static struct commit *get_base_commit(const char *base_commit,
         */
        while (rev_nr > 1) {
                for (i = 0; i < rev_nr / 2; i++) {
-                       struct commit_list *merge_base;
-                       merge_base = repo_get_merge_bases(the_repository,
-                                                         rev[2 * i],
-                                                         rev[2 * i + 1]);
-                       if (!merge_base || merge_base->next) {
+                       struct commit_list *merge_base = NULL;
+                       if (repo_get_merge_bases(the_repository,
+                                                rev[2 * i],
+                                                rev[2 * i + 1], &merge_base) < 0 ||
+                           !merge_base || merge_base->next) {
                                if (die_on_failure) {
                                        die(_("failed to find exact merge base"));
                                } else {
@@ -1729,7 +1726,10 @@ static struct commit *get_base_commit(const char *base_commit,
                rev_nr = DIV_ROUND_UP(rev_nr, 2);
        }
 
-       if (!repo_in_merge_bases(the_repository, base, rev[0])) {
+       ret = repo_in_merge_bases(the_repository, base, rev[0]);
+       if (ret < 0)
+               exit(128);
+       if (!ret) {
                if (die_on_failure) {
                        die(_("base commit should be the ancestor of revision list"));
                } else {
@@ -1893,6 +1893,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        int quiet = 0;
        const char *reroll_count = NULL;
        char *cover_from_description_arg = NULL;
+       char *description_file = NULL;
        char *branch_name = NULL;
        char *base_commit = NULL;
        struct base_tree_info bases;
@@ -1907,6 +1908,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        struct strbuf rdiff_title = STRBUF_INIT;
        struct strbuf sprefix = STRBUF_INIT;
        int creation_factor = -1;
+       int rfc = 0;
 
        const struct option builtin_format_patch_options[] = {
                OPT_CALLBACK_F('n', "numbered", &numbered, NULL,
@@ -1930,13 +1932,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                            N_("mark the series as Nth re-roll")),
                OPT_INTEGER(0, "filename-max-length", &fmt_patch_name_max,
                            N_("max length of output filename")),
-               OPT_CALLBACK_F(0, "rfc", &rev, NULL,
-                           N_("use [RFC PATCH] instead of [PATCH]"),
-                           PARSE_OPT_NOARG | PARSE_OPT_NONEG, rfc_callback),
+               OPT_BOOL(0, "rfc", &rfc, N_("use [RFC PATCH] instead of [PATCH]")),
                OPT_STRING(0, "cover-from-description", &cover_from_description_arg,
                            N_("cover-from-description-mode"),
                            N_("generate parts of a cover letter based on a branch's description")),
-               OPT_CALLBACK_F(0, "subject-prefix", &rev, N_("prefix"),
+               OPT_FILENAME(0, "description-file", &description_file,
+                            N_("use branch description from file")),
+               OPT_CALLBACK_F(0, "subject-prefix", &sprefix, N_("prefix"),
                            N_("use [<prefix>] instead of [PATCH]"),
                            PARSE_OPT_NONEG, subject_prefix_callback),
                OPT_CALLBACK_F('o', "output-directory", &output_directory,
@@ -1957,8 +1959,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                OPT_GROUP(N_("Messaging")),
                OPT_CALLBACK(0, "add-header", NULL, N_("header"),
                            N_("add email header"), header_callback),
-               OPT_CALLBACK(0, "to", NULL, N_("email"), N_("add To: header"), to_callback),
-               OPT_CALLBACK(0, "cc", NULL, N_("email"), N_("add Cc: header"), cc_callback),
+               OPT_STRING_LIST(0, "to", &extra_to, N_("email"), N_("add To: header")),
+               OPT_STRING_LIST(0, "cc", &extra_cc, N_("email"), N_("add Cc: header")),
                OPT_CALLBACK_F(0, "from", &from, N_("ident"),
                            N_("set From address to <ident> (or committer ident if absent)"),
                            PARSE_OPT_OPTARG, from_callback),
@@ -2016,11 +2018,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        rev.max_parents = 1;
        rev.diffopt.flags.recursive = 1;
        rev.diffopt.no_free = 1;
-       rev.subject_prefix = fmt_patch_subject_prefix;
        memset(&s_r_opt, 0, sizeof(s_r_opt));
        s_r_opt.def = "HEAD";
        s_r_opt.revarg_opt = REVARG_COMMITTISH;
 
+       strbuf_addstr(&sprefix, fmt_patch_subject_prefix);
        if (format_no_prefix)
                diff_set_noprefix(&rev.diffopt);
 
@@ -2048,13 +2050,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        if (cover_from_description_arg)
                cover_from_description_mode = parse_cover_from_description(cover_from_description_arg);
 
+       if (rfc)
+               strbuf_insertstr(&sprefix, 0, "RFC ");
+
        if (reroll_count) {
-               strbuf_addf(&sprefix, "%s v%s",
-                           rev.subject_prefix, reroll_count);
+               strbuf_addf(&sprefix, " v%s", reroll_count);
                rev.reroll_count = reroll_count;
-               rev.subject_prefix = sprefix.buf;
        }
 
+       rev.subject_prefix = sprefix.buf;
+
        for (i = 0; i < extra_hdr.nr; i++) {
                strbuf_addstr(&buf, extra_hdr.items[i].string);
                strbuf_addch(&buf, '\n');
@@ -2321,7 +2326,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                if (thread)
                        gen_message_id(&rev, "cover");
                make_cover_letter(&rev, !!output_directory,
-                                 origin, nr, list, branch_name, quiet);
+                                 origin, nr, list, description_file, branch_name, quiet);
                print_bases(&bases, rev.diffopt.file);
                print_signature(rev.diffopt.file);
                total++;
index a0229c3277874accc9edf0a4a5ac4e8186217903..92f94e65bf065e900e59b9fcf2bc18f5af045975 100644 (file)
 #include "gettext.h"
 #include "object-name.h"
 #include "strbuf.h"
-#include "tree.h"
-#include "cache-tree.h"
 #include "parse-options.h"
 #include "resolve-undo.h"
 #include "string-list.h"
 #include "path.h"
 #include "pathspec.h"
 #include "read-cache.h"
-#include "run-command.h"
 #include "setup.h"
 #include "sparse-index.h"
 #include "submodule.h"
-#include "submodule-config.h"
 #include "object-store.h"
 #include "hex.h"
 
index fc765754305ed7a3f8a2efdcd604dd29c8b3b502..e8d65ebbdc0afc864826d722a7da7514a4f382ea 100644 (file)
@@ -5,7 +5,6 @@
 #include "pkt-line.h"
 #include "ref-filter.h"
 #include "remote.h"
-#include "refs.h"
 #include "parse-options.h"
 #include "wildmatch.h"
 
@@ -58,6 +57,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
        struct transport *transport;
        const struct ref *ref;
        struct ref_array ref_array;
+       struct ref_sorting *sorting;
        struct string_list sorting_options = STRING_LIST_INIT_DUP;
 
        struct option options[] = {
@@ -141,13 +141,8 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
                item->symref = xstrdup_or_null(ref->symref);
        }
 
-       if (sorting_options.nr) {
-               struct ref_sorting *sorting;
-
-               sorting = ref_sorting_options(&sorting_options);
-               ref_array_sort(sorting, &ref_array);
-               ref_sorting_release(sorting);
-       }
+       sorting = ref_sorting_options(&sorting_options);
+       ref_array_sort(sorting, &ref_array);
 
        for (i = 0; i < ref_array.nr; i++) {
                const struct ref_array_item *ref = ref_array.items[i];
@@ -157,6 +152,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
                status = 0; /* we found something */
        }
 
+       ref_sorting_release(sorting);
        ref_array_clear(&ref_array);
        if (transport_disconnect(transport))
                status = 1;
index 71281ab705b67048820fb93b8e1aa5a31cf6d7c5..61a2965c8a74c6f938eb01b507541056c408cad7 100644 (file)
@@ -9,9 +9,7 @@
 #include "hex.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "blob.h"
 #include "tree.h"
-#include "commit.h"
 #include "path.h"
 #include "quote.h"
 #include "parse-options.h"
@@ -241,7 +239,8 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,
        return recurse;
 }
 
-static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,
+static int show_tree_name_only(const struct object_id *oid UNUSED,
+                              struct strbuf *base,
                               const char *pathname, unsigned mode,
                               void *context)
 {
index 53b55dd71c0537b149860c4b9c0d505ea305fe57..53a22645da58b8c18bb825ca9012e2f072cbf3a3 100644 (file)
@@ -6,7 +6,6 @@
 #include "abspath.h"
 #include "environment.h"
 #include "gettext.h"
-#include "utf8.h"
 #include "strbuf.h"
 #include "mailinfo.h"
 #include "parse-options.h"
index e68b7fe45d77a9b032dd6031864b876eeeca5e5c..5a8e72950298c254d430664c6e931ca13c699590 100644 (file)
@@ -3,9 +3,6 @@
 #include "commit.h"
 #include "gettext.h"
 #include "hex.h"
-#include "refs.h"
-#include "diff.h"
-#include "revision.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "repository.h"
 
 static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
 {
-       struct commit_list *result, *r;
+       struct commit_list *result = NULL, *r;
 
-       result = repo_get_merge_bases_many_dirty(the_repository, rev[0],
-                                                rev_nr - 1, rev + 1);
+       if (repo_get_merge_bases_many_dirty(the_repository, rev[0],
+                                           rev_nr - 1, rev + 1, &result) < 0) {
+               free_commit_list(result);
+               return -1;
+       }
 
        if (!result)
                return 1;
@@ -77,13 +77,17 @@ static int handle_independent(int count, const char **args)
 static int handle_octopus(int count, const char **args, int show_all)
 {
        struct commit_list *revs = NULL;
-       struct commit_list *result, *rev;
+       struct commit_list *result = NULL, *rev;
        int i;
 
        for (i = count - 1; i >= 0; i--)
                commit_list_insert(get_commit_reference(args[i]), &revs);
 
-       result = get_octopus_merge_bases(revs);
+       if (get_octopus_merge_bases(revs, &result) < 0) {
+               free_commit_list(revs);
+               free_commit_list(result);
+               return 128;
+       }
        free_commit_list(revs);
        reduce_heads_replace(&result);
 
@@ -103,12 +107,16 @@ static int handle_octopus(int count, const char **args, int show_all)
 static int handle_is_ancestor(int argc, const char **argv)
 {
        struct commit *one, *two;
+       int ret;
 
        if (argc != 2)
                die("--is-ancestor takes exactly two commits");
        one = get_commit_reference(argv[0]);
        two = get_commit_reference(argv[1]);
-       if (repo_in_merge_bases(the_repository, one, two))
+       ret = repo_in_merge_bases(the_repository, one, two);
+       if (ret < 0)
+               exit(128);
+       if (ret)
                return 0;
        else
                return 1;
index d7eb4c654018e2bf8270ba90f1a3d945a261d025..1f987334a31b0e19904825297c1bb0d37a1fc2fe 100644 (file)
@@ -1,5 +1,9 @@
 #include "builtin.h"
 #include "abspath.h"
+#include "diff.h"
+#include "hex.h"
+#include "object-name.h"
+#include "object-store.h"
 #include "config.h"
 #include "gettext.h"
 #include "setup.h"
@@ -25,16 +29,41 @@ static int label_cb(const struct option *opt, const char *arg, int unset)
        return 0;
 }
 
+static int set_diff_algorithm(xpparam_t *xpp,
+                             const char *alg)
+{
+       long diff_algorithm = parse_algorithm_value(alg);
+       if (diff_algorithm < 0)
+               return -1;
+       xpp->flags = (xpp->flags & ~XDF_DIFF_ALGORITHM_MASK) | diff_algorithm;
+       return 0;
+}
+
+static int diff_algorithm_cb(const struct option *opt,
+                               const char *arg, int unset)
+{
+       xpparam_t *xpp = opt->value;
+
+       BUG_ON_OPT_NEG(unset);
+
+       if (set_diff_algorithm(xpp, arg))
+               return error(_("option diff-algorithm accepts \"myers\", "
+                              "\"minimal\", \"patience\" and \"histogram\""));
+
+       return 0;
+}
+
 int cmd_merge_file(int argc, const char **argv, const char *prefix)
 {
        const char *names[3] = { 0 };
        mmfile_t mmfs[3] = { 0 };
        mmbuffer_t result = { 0 };
        xmparam_t xmp = { 0 };
-       int ret = 0, i = 0, to_stdout = 0;
+       int ret = 0, i = 0, to_stdout = 0, object_id = 0;
        int quiet = 0;
        struct option options[] = {
                OPT_BOOL('p', "stdout", &to_stdout, N_("send results to standard output")),
+               OPT_BOOL(0,   "object-id", &object_id, N_("use object IDs instead of filenames")),
                OPT_SET_INT(0, "diff3", &xmp.style, N_("use a diff3 based merge"), XDL_MERGE_DIFF3),
                OPT_SET_INT(0, "zdiff3", &xmp.style, N_("use a zealous diff3 based merge"),
                                XDL_MERGE_ZEALOUS_DIFF3),
@@ -44,6 +73,9 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
                            XDL_MERGE_FAVOR_THEIRS),
                OPT_SET_INT(0, "union", &xmp.favor, N_("for conflicts, use a union version"),
                            XDL_MERGE_FAVOR_UNION),
+               OPT_CALLBACK_F(0, "diff-algorithm", &xmp.xpp, N_("<algorithm>"),
+                            N_("choose a diff algorithm"),
+                            PARSE_OPT_NONEG, diff_algorithm_cb),
                OPT_INTEGER(0, "marker-size", &xmp.marker_size,
                            N_("for conflicts, use this marker size")),
                OPT__QUIET(&quiet, N_("do not warn about conflicts")),
@@ -71,8 +103,12 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
                        return error_errno("failed to redirect stderr to /dev/null");
        }
 
+       if (object_id)
+               setup_git_directory();
+
        for (i = 0; i < 3; i++) {
                char *fname;
+               struct object_id oid;
                mmfile_t *mmf = mmfs + i;
 
                if (!names[i])
@@ -80,12 +116,22 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
 
                fname = prefix_filename(prefix, argv[i]);
 
-               if (read_mmfile(mmf, fname))
+               if (object_id) {
+                       if (repo_get_oid(the_repository, argv[i], &oid))
+                               ret = error(_("object '%s' does not exist"),
+                                             argv[i]);
+                       else if (!oideq(&oid, the_hash_algo->empty_blob))
+                               read_mmblob(mmf, &oid);
+                       else
+                               read_mmfile(mmf, "/dev/null");
+               } else if (read_mmfile(mmf, fname)) {
                        ret = -1;
-               else if (mmf->size > MAX_XDIFF_SIZE ||
-                        buffer_is_binary(mmf->ptr, mmf->size))
+               }
+               if (ret != -1 && (mmf->size > MAX_XDIFF_SIZE ||
+                   buffer_is_binary(mmf->ptr, mmf->size))) {
                        ret = error("Cannot merge binary files: %s",
                                    argv[i]);
+               }
 
                free(fname);
                if (ret)
@@ -99,20 +145,32 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
        ret = xdl_merge(mmfs + 1, mmfs + 0, mmfs + 2, &xmp, &result);
 
        if (ret >= 0) {
-               const char *filename = argv[0];
-               char *fpath = prefix_filename(prefix, argv[0]);
-               FILE *f = to_stdout ? stdout : fopen(fpath, "wb");
-
-               if (!f)
-                       ret = error_errno("Could not open %s for writing",
-                                         filename);
-               else if (result.size &&
-                        fwrite(result.ptr, result.size, 1, f) != 1)
-                       ret = error_errno("Could not write to %s", filename);
-               else if (fclose(f))
-                       ret = error_errno("Could not close %s", filename);
+               if (object_id && !to_stdout) {
+                       struct object_id oid;
+                       if (result.size) {
+                               if (write_object_file(result.ptr, result.size, OBJ_BLOB, &oid) < 0)
+                                       ret = error(_("Could not write object file"));
+                       } else {
+                               oidcpy(&oid, the_hash_algo->empty_blob);
+                       }
+                       if (ret >= 0)
+                               printf("%s\n", oid_to_hex(&oid));
+               } else {
+                       const char *filename = argv[0];
+                       char *fpath = prefix_filename(prefix, argv[0]);
+                       FILE *f = to_stdout ? stdout : fopen(fpath, "wb");
+
+                       if (!f)
+                               ret = error_errno("Could not open %s for writing",
+                                                 filename);
+                       else if (result.size &&
+                                fwrite(result.ptr, result.size, 1, f) != 1)
+                               ret = error_errno("Could not write to %s", filename);
+                       else if (fclose(f))
+                               ret = error_errno("Could not close %s", filename);
+                       free(fpath);
+               }
                free(result.ptr);
-               free(fpath);
        }
 
        if (ret > 127)
index 3366699657c9c390f850dfcba11be08327834f50..c2ce044a201366d7eea11ab3d2eeed2c15113af4 100644 (file)
@@ -1,13 +1,10 @@
 #include "builtin.h"
 #include "advice.h"
-#include "commit.h"
 #include "gettext.h"
 #include "hash.h"
-#include "tag.h"
 #include "merge-recursive.h"
 #include "object-name.h"
 #include "repository.h"
-#include "xdiff-interface.h"
 
 static const char builtin_merge_recursive_usage[] =
        "git %s <base>... -- <head> <remote> ...";
index 0de42aecf4babf5d1cae19aa81e7d46676c636d1..05d0cad55438a90b72c8e001dfe71b05ad8203d3 100644 (file)
 #include "parse-options.h"
 #include "repository.h"
 #include "blob.h"
-#include "exec-cmd.h"
 #include "merge-blobs.h"
 #include "quote.h"
 #include "tree.h"
 #include "config.h"
+#include "strvec.h"
 
 static int line_termination = '\n';
 
@@ -414,6 +414,7 @@ struct merge_tree_options {
        int show_messages;
        int name_only;
        int use_stdin;
+       struct merge_options merge_options;
 };
 
 static int real_merge(struct merge_tree_options *o,
@@ -423,47 +424,61 @@ static int real_merge(struct merge_tree_options *o,
 {
        struct commit *parent1, *parent2;
        struct commit_list *merge_bases = NULL;
-       struct merge_options opt;
        struct merge_result result = { 0 };
        int show_messages = o->show_messages;
+       struct merge_options opt;
 
-       parent1 = get_merge_parent(branch1);
-       if (!parent1)
-               help_unknown_ref(branch1, "merge-tree",
-                                _("not something we can merge"));
-
-       parent2 = get_merge_parent(branch2);
-       if (!parent2)
-               help_unknown_ref(branch2, "merge-tree",
-                                _("not something we can merge"));
-
-       init_merge_options(&opt, the_repository);
-
+       copy_merge_options(&opt, &o->merge_options);
        opt.show_rename_progress = 0;
 
        opt.branch1 = branch1;
        opt.branch2 = branch2;
 
        if (merge_base) {
-               struct commit *base_commit;
                struct tree *base_tree, *parent1_tree, *parent2_tree;
 
-               base_commit = lookup_commit_reference_by_name(merge_base);
-               if (!base_commit)
-                       die(_("could not lookup commit '%s'"), merge_base);
+               /*
+                * We actually only need the trees because we already
+                * have a merge base.
+                */
+               struct object_id base_oid, head_oid, merge_oid;
+
+               if (repo_get_oid_treeish(the_repository, merge_base, &base_oid))
+                       die(_("could not parse as tree '%s'"), merge_base);
+               base_tree = parse_tree_indirect(&base_oid);
+               if (!base_tree)
+                       die(_("unable to read tree (%s)"), oid_to_hex(&base_oid));
+               if (repo_get_oid_treeish(the_repository, branch1, &head_oid))
+                       die(_("could not parse as tree '%s'"), branch1);
+               parent1_tree = parse_tree_indirect(&head_oid);
+               if (!parent1_tree)
+                       die(_("unable to read tree (%s)"), oid_to_hex(&head_oid));
+               if (repo_get_oid_treeish(the_repository, branch2, &merge_oid))
+                       die(_("could not parse as tree '%s'"), branch2);
+               parent2_tree = parse_tree_indirect(&merge_oid);
+               if (!parent2_tree)
+                       die(_("unable to read tree (%s)"), oid_to_hex(&merge_oid));
 
                opt.ancestor = merge_base;
-               base_tree = repo_get_commit_tree(the_repository, base_commit);
-               parent1_tree = repo_get_commit_tree(the_repository, parent1);
-               parent2_tree = repo_get_commit_tree(the_repository, parent2);
                merge_incore_nonrecursive(&opt, base_tree, parent1_tree, parent2_tree, &result);
        } else {
+               parent1 = get_merge_parent(branch1);
+               if (!parent1)
+                       help_unknown_ref(branch1, "merge-tree",
+                                        _("not something we can merge"));
+
+               parent2 = get_merge_parent(branch2);
+               if (!parent2)
+                       help_unknown_ref(branch2, "merge-tree",
+                                        _("not something we can merge"));
+
                /*
                 * Get the merge bases, in reverse order; see comment above
                 * merge_incore_recursive in merge-ort.h
                 */
-               merge_bases = repo_get_merge_bases(the_repository, parent1,
-                                                  parent2);
+               if (repo_get_merge_bases(the_repository, parent1,
+                                        parent2, &merge_bases) < 0)
+                       exit(128);
                if (!merge_bases && !o->allow_unrelated_histories)
                        die(_("refusing to merge unrelated histories"));
                merge_bases = reverse_commit_list(merge_bases);
@@ -507,12 +522,14 @@ static int real_merge(struct merge_tree_options *o,
        if (o->use_stdin)
                putchar(line_termination);
        merge_finalize(&opt, &result);
+       clear_merge_options(&opt);
        return !result.clean; /* result.clean < 0 handled above */
 }
 
 int cmd_merge_tree(int argc, const char **argv, const char *prefix)
 {
        struct merge_tree_options o = { .show_messages = -1 };
+       struct strvec xopts = STRVEC_INIT;
        int expected_remaining_argc;
        int original_argc;
        const char *merge_base = NULL;
@@ -548,14 +565,25 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
                           &merge_base,
                           N_("commit"),
                           N_("specify a merge-base for the merge")),
+               OPT_STRVEC('X', "strategy-option", &xopts, N_("option=value"),
+                       N_("option for selected merge strategy")),
                OPT_END()
        };
 
+       /* Init merge options */
+       init_merge_options(&o.merge_options, the_repository);
+
        /* Parse arguments */
        original_argc = argc - 1; /* ignoring argv[0] */
        argc = parse_options(argc, argv, prefix, mt_options,
                             merge_tree_usage, PARSE_OPT_STOP_AT_NON_OPTION);
 
+       if (xopts.nr && o.mode == MODE_TRIVIAL)
+               die(_("--trivial-merge is incompatible with all other options"));
+       for (int x = 0; x < xopts.nr; x++)
+               if (parse_merge_opt(&o.merge_options, xopts.v[x]))
+                       die(_("unknown strategy option: -X%s"), xopts.v[x]);
+
        /* Handle --stdin */
        if (o.use_stdin) {
                struct strbuf buf = STRBUF_INIT;
@@ -563,7 +591,8 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
                if (o.mode == MODE_TRIVIAL)
                        die(_("--trivial-merge is incompatible with all other options"));
                if (merge_base)
-                       die(_("--merge-base is incompatible with --stdin"));
+                       die(_("options '%s' and '%s' cannot be used together"),
+                           "--merge-base", "--stdin");
                line_termination = '\0';
                while (strbuf_getline_lf(&buf, stdin) != EOF) {
                        struct strbuf **split;
index 718165d45917b684fea677f9146a2731e7082b69..1cbd6a899ccf2f3a3d92c7f14dcec3074634a3df 100644 (file)
@@ -31,8 +31,6 @@
 #include "unpack-trees.h"
 #include "cache-tree.h"
 #include "dir.h"
-#include "utf8.h"
-#include "log-tree.h"
 #include "color.h"
 #include "rerere.h"
 #include "help.h"
 #include "resolve-undo.h"
 #include "remote.h"
 #include "fmt-merge-msg.h"
-#include "gpg-interface.h"
 #include "sequencer.h"
 #include "string-list.h"
-#include "packfile.h"
 #include "tag.h"
 #include "alias.h"
 #include "branch.h"
@@ -79,8 +75,7 @@ static int overwrite_ignore = 1;
 static struct strbuf merge_msg = STRBUF_INIT;
 static struct strategy **use_strategies;
 static size_t use_strategies_nr, use_strategies_alloc;
-static const char **xopts;
-static size_t xopts_nr, xopts_alloc;
+static struct strvec xopts = STRVEC_INIT;
 static const char *branch;
 static char *branch_mergeoptions;
 static int verbosity;
@@ -197,8 +192,7 @@ static struct strategy *get_strategy(const char *name)
                        int j, found = 0;
                        struct cmdname *ent = main_cmds.names[i];
                        for (j = 0; !found && j < ARRAY_SIZE(all_strategy); j++)
-                               if (!strncmp(ent->name, all_strategy[j].name, ent->len)
-                                               && !all_strategy[j].name[ent->len])
+                               if (!xstrncmpz(all_strategy[j].name, ent->name, ent->len))
                                        found = 1;
                        if (!found)
                                add_cmdname(&not_strategies, ent->name, ent->len);
@@ -232,7 +226,7 @@ static void append_strategy(struct strategy *s)
        use_strategies[use_strategies_nr++] = s;
 }
 
-static int option_parse_strategy(const struct option *opt,
+static int option_parse_strategy(const struct option *opt UNUSED,
                                 const char *name, int unset)
 {
        if (unset)
@@ -242,29 +236,9 @@ static int option_parse_strategy(const struct option *opt,
        return 0;
 }
 
-static int option_parse_x(const struct option *opt,
-                         const char *arg, int unset)
-{
-       if (unset)
-               return 0;
-
-       ALLOC_GROW(xopts, xopts_nr + 1, xopts_alloc);
-       xopts[xopts_nr++] = xstrdup(arg);
-       return 0;
-}
-
-static int option_parse_n(const struct option *opt,
-                         const char *arg, int unset)
-{
-       BUG_ON_OPT_ARG(arg);
-       show_diffstat = unset;
-       return 0;
-}
-
 static struct option builtin_merge_options[] = {
-       OPT_CALLBACK_F('n', NULL, NULL, NULL,
-               N_("do not show a diffstat at the end of the merge"),
-               PARSE_OPT_NOARG, option_parse_n),
+       OPT_SET_INT('n', NULL, &show_diffstat,
+               N_("do not show a diffstat at the end of the merge"), 0),
        OPT_BOOL(0, "stat", &show_diffstat,
                N_("show a diffstat at the end of the merge")),
        OPT_BOOL(0, "summary", &show_diffstat, N_("(synonym to --stat)")),
@@ -285,10 +259,10 @@ static struct option builtin_merge_options[] = {
        OPT_RERERE_AUTOUPDATE(&allow_rerere_auto),
        OPT_BOOL(0, "verify-signatures", &verify_signatures,
                N_("verify that the named commit has a valid GPG signature")),
-       OPT_CALLBACK('s', "strategy", &use_strategies, N_("strategy"),
+       OPT_CALLBACK('s', "strategy", NULL, N_("strategy"),
                N_("merge strategy to use"), option_parse_strategy),
-       OPT_CALLBACK('X', "strategy-option", &xopts, N_("option=value"),
-               N_("option for selected merge strategy"), option_parse_x),
+       OPT_STRVEC('X', "strategy-option", &xopts, N_("option=value"),
+               N_("option for selected merge strategy")),
        OPT_CALLBACK('m', "message", &merge_msg, N_("message"),
                N_("merge commit message (for a non-fast-forward merge)"),
                option_parse_message),
@@ -487,8 +461,7 @@ static void finish(struct commit *head_commit,
        if (new_head && show_diffstat) {
                struct diff_options opts;
                repo_diff_setup(the_repository, &opts);
-               opts.stat_width = -1; /* use full terminal width */
-               opts.stat_graph_width = -1; /* respect statGraphWidth config */
+               init_diffstat_widths(&opts);
                opts.output_format |=
                        DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
                opts.detect_rename = DIFF_DETECT_RENAME;
@@ -502,7 +475,7 @@ static void finish(struct commit *head_commit,
        run_hooks_l("post-merge", squash ? "1" : "0", NULL);
 
        if (new_head)
-               apply_autostash(git_path_merge_autostash(the_repository));
+               apply_autostash_ref(the_repository, "MERGE_AUTOSTASH");
        strbuf_release(&reflog_message);
 }
 
@@ -750,9 +723,9 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
                o.show_rename_progress =
                        show_progress == -1 ? isatty(2) : show_progress;
 
-               for (x = 0; x < xopts_nr; x++)
-                       if (parse_merge_opt(&o, xopts[x]))
-                               die(_("unknown strategy option: -X%s"), xopts[x]);
+               for (x = 0; x < xopts.nr; x++)
+                       if (parse_merge_opt(&o, xopts.v[x]))
+                               die(_("unknown strategy option: -X%s"), xopts.v[x]);
 
                o.branch1 = head_arg;
                o.branch2 = merge_remote_util(remoteheads->item)->name;
@@ -778,7 +751,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
                return clean ? 0 : 1;
        } else {
                return try_merge_command(the_repository,
-                                        strategy, xopts_nr, xopts,
+                                        strategy, xopts.nr, xopts.v,
                                         common, head_arg, remoteheads);
        }
 }
@@ -892,7 +865,7 @@ static void prepare_to_commit(struct commit_list *remoteheads)
                                _(no_scissors_editor_comment), comment_line_char);
        }
        if (signoff)
-               append_signoff(&msg, ignore_non_trailer(msg.buf, msg.len), 0);
+               append_signoff(&msg, ignored_log_message_bytes(msg.buf, msg.len), 0);
        write_merge_heads(remoteheads);
        write_file_buf(git_path_merge_msg(the_repository), msg.buf, msg.len);
        if (run_commit_hook(0 < option_edit, get_index_file(), NULL,
@@ -1342,7 +1315,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
        if (abort_current_merge) {
                int nargc = 2;
                const char *nargv[] = {"reset", "--merge", NULL};
-               struct strbuf stash_oid = STRBUF_INIT;
+               char stash_oid_hex[GIT_MAX_HEXSZ + 1];
+               struct object_id stash_oid = {0};
 
                if (orig_argc != 2)
                        usage_msg_opt(_("--abort expects no arguments"),
@@ -1351,17 +1325,17 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                if (!file_exists(git_path_merge_head(the_repository)))
                        die(_("There is no merge to abort (MERGE_HEAD missing)."));
 
-               if (read_oneliner(&stash_oid, git_path_merge_autostash(the_repository),
-                   READ_ONELINER_SKIP_IF_EMPTY))
-                       unlink(git_path_merge_autostash(the_repository));
+               if (!read_ref("MERGE_AUTOSTASH", &stash_oid))
+                       delete_ref("", "MERGE_AUTOSTASH", &stash_oid, REF_NO_DEREF);
 
                /* Invoke 'git reset --merge' */
                ret = cmd_reset(nargc, nargv, prefix);
 
-               if (stash_oid.len)
-                       apply_autostash_oid(stash_oid.buf);
+               if (!is_null_oid(&stash_oid)) {
+                       oid_to_hex_r(stash_oid_hex, &stash_oid);
+                       apply_autostash_oid(stash_oid_hex);
+               }
 
-               strbuf_release(&stash_oid);
                goto done;
        }
 
@@ -1540,13 +1514,20 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
        if (!remoteheads)
                ; /* already up-to-date */
-       else if (!remoteheads->next)
-               common = repo_get_merge_bases(the_repository, head_commit,
-                                             remoteheads->item);
-       else {
+       else if (!remoteheads->next) {
+               if (repo_get_merge_bases(the_repository, head_commit,
+                                        remoteheads->item, &common) < 0) {
+                       ret = 2;
+                       goto done;
+               }
+       } else {
                struct commit_list *list = remoteheads;
                commit_list_insert(head_commit, &list);
-               common = get_octopus_merge_bases(list);
+               if (get_octopus_merge_bases(list, &common) < 0) {
+                       free(list);
+                       ret = 2;
+                       goto done;
+               }
                free(list);
        }
 
@@ -1590,13 +1571,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                }
 
                if (autostash)
-                       create_autostash(the_repository,
-                                        git_path_merge_autostash(the_repository));
+                       create_autostash_ref(the_repository, "MERGE_AUTOSTASH");
                if (checkout_fast_forward(the_repository,
                                          &head_commit->object.oid,
                                          &commit->object.oid,
                                          overwrite_ignore)) {
-                       apply_autostash(git_path_merge_autostash(the_repository));
+                       apply_autostash_ref(the_repository, "MERGE_AUTOSTASH");
                        ret = 1;
                        goto done;
                }
@@ -1654,17 +1634,21 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                struct commit_list *j;
 
                for (j = remoteheads; j; j = j->next) {
-                       struct commit_list *common_one;
+                       struct commit_list *common_one = NULL;
+                       struct commit *common_item;
 
                        /*
                         * Here we *have* to calculate the individual
                         * merge_bases again, otherwise "git merge HEAD^
                         * HEAD^^" would be missed.
                         */
-                       common_one = repo_get_merge_bases(the_repository,
-                                                         head_commit,
-                                                         j->item);
-                       if (!oideq(&common_one->item->object.oid, &j->item->object.oid)) {
+                       if (repo_get_merge_bases(the_repository, head_commit,
+                                                j->item, &common_one) < 0)
+                               exit(128);
+
+                       common_item = common_one->item;
+                       free_commit_list(common_one);
+                       if (!oideq(&common_item->object.oid, &j->item->object.oid)) {
                                up_to_date = 0;
                                break;
                        }
@@ -1679,8 +1663,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                die_ff_impossible();
 
        if (autostash)
-               create_autostash(the_repository,
-                                git_path_merge_autostash(the_repository));
+               create_autostash_ref(the_repository, "MERGE_AUTOSTASH");
 
        /* We are going to make a new commit. */
        git_committer_info(IDENT_STRICT);
@@ -1765,7 +1748,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                else
                        fprintf(stderr, _("Merge with strategy %s failed.\n"),
                                use_strategies[0]->name);
-               apply_autostash(git_path_merge_autostash(the_repository));
+               apply_autostash_ref(the_repository, "MERGE_AUTOSTASH");
                ret = 2;
                goto done;
        } else if (best_strategy == wt_strategy)
index d8e0b5afc079d2f71383eed6881b733fea251312..4767f1a97e6df25ca09eba0846feaf404e08fe46 100644 (file)
@@ -3,7 +3,6 @@
 #include "hex.h"
 #include "parse-options.h"
 #include "strbuf.h"
-#include "tag.h"
 #include "replace-object.h"
 #include "object-file.h"
 #include "object-store-ll.h"
index 05e7156034e04d637990cabf105f7fa967b0f2aa..22e64fc2900ec8e654aafa6cfaf8a10cdb5d58a7 100644 (file)
@@ -15,7 +15,6 @@
 #include "pathspec.h"
 #include "lockfile.h"
 #include "dir.h"
-#include "cache-tree.h"
 #include "string-list.h"
 #include "parse-options.h"
 #include "read-cache-ll.h"
@@ -305,7 +304,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                }
                if (S_ISDIR(st.st_mode)
                    && lstat(dst, &dest_st) == 0) {
-                       bad = _("cannot move directory over file");
+                       bad = _("destination already exists");
                        goto act_on_entry;
                }
 
index c706fa37201aeabc5bdc3eb752a5be859490a42d..ad9930c83112585f72a49883c4c8035529363fd5 100644 (file)
@@ -15,6 +15,7 @@
 #include "commit-slab.h"
 #include "commit-graph.h"
 #include "wildmatch.h"
+#include "mem-pool.h"
 
 /*
  * One day.  See the 'name a rev shortly after epoch' test in t6120 when
@@ -155,30 +156,25 @@ static struct rev_name *create_or_update_name(struct commit *commit,
        return name;
 }
 
-static char *get_parent_name(const struct rev_name *name, int parent_number)
+static char *get_parent_name(const struct rev_name *name, int parent_number,
+                            struct mem_pool *string_pool)
 {
-       struct strbuf sb = STRBUF_INIT;
        size_t len;
 
        strip_suffix(name->tip_name, "^0", &len);
        if (name->generation > 0) {
-               strbuf_grow(&sb, len +
-                           1 + decimal_width(name->generation) +
-                           1 + decimal_width(parent_number));
-               strbuf_addf(&sb, "%.*s~%d^%d", (int)len, name->tip_name,
-                           name->generation, parent_number);
+               return mem_pool_strfmt(string_pool, "%.*s~%d^%d",
+                                      (int)len, name->tip_name,
+                                      name->generation, parent_number);
        } else {
-               strbuf_grow(&sb, len +
-                           1 + decimal_width(parent_number));
-               strbuf_addf(&sb, "%.*s^%d", (int)len, name->tip_name,
-                           parent_number);
+               return mem_pool_strfmt(string_pool, "%.*s^%d",
+                                      (int)len, name->tip_name, parent_number);
        }
-       return strbuf_detach(&sb, NULL);
 }
 
 static void name_rev(struct commit *start_commit,
                const char *tip_name, timestamp_t taggerdate,
-               int from_tag, int deref)
+               int from_tag, int deref, struct mem_pool *string_pool)
 {
        struct prio_queue queue;
        struct commit *commit;
@@ -195,9 +191,10 @@ static void name_rev(struct commit *start_commit,
        if (!start_name)
                return;
        if (deref)
-               start_name->tip_name = xstrfmt("%s^0", tip_name);
+               start_name->tip_name = mem_pool_strfmt(string_pool, "%s^0",
+                                                      tip_name);
        else
-               start_name->tip_name = xstrdup(tip_name);
+               start_name->tip_name = mem_pool_strdup(string_pool, tip_name);
 
        memset(&queue, 0, sizeof(queue)); /* Use the prio_queue as LIFO */
        prio_queue_put(&queue, start_commit);
@@ -235,7 +232,8 @@ static void name_rev(struct commit *start_commit,
                                if (parent_number > 1)
                                        parent_name->tip_name =
                                                get_parent_name(name,
-                                                               parent_number);
+                                                               parent_number,
+                                                               string_pool);
                                else
                                        parent_name->tip_name = name->tip_name;
                                ALLOC_GROW(parents_to_queue,
@@ -415,7 +413,7 @@ static int name_ref(const char *path, const struct object_id *oid,
        return 0;
 }
 
-static void name_tips(void)
+static void name_tips(struct mem_pool *string_pool)
 {
        int i;
 
@@ -428,7 +426,7 @@ static void name_tips(void)
                struct tip_table_entry *e = &tip_table.table[i];
                if (e->commit) {
                        name_rev(e->commit, e->refname, e->taggerdate,
-                                e->from_tag, e->deref);
+                                e->from_tag, e->deref, string_pool);
                }
        }
 }
@@ -561,6 +559,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
 
 int cmd_name_rev(int argc, const char **argv, const char *prefix)
 {
+       struct mem_pool string_pool;
        struct object_array revs = OBJECT_ARRAY_INIT;
        int all = 0, annotate_stdin = 0, transform_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0;
        struct name_ref_data data = { 0, 0, STRING_LIST_INIT_NODUP, STRING_LIST_INIT_NODUP };
@@ -582,15 +581,12 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "undefined", &allow_undefined, N_("allow to print `undefined` names (default)")),
                OPT_BOOL(0, "always",     &always,
                           N_("show abbreviated commit object as fallback")),
-               {
-                       /* A Hidden OPT_BOOL */
-                       OPTION_SET_INT, 0, "peel-tag", &peel_tag, NULL,
-                       N_("dereference tags in the input (internal use)"),
-                       PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, NULL, 1,
-               },
+               OPT_HIDDEN_BOOL(0, "peel-tag", &peel_tag,
+                          N_("dereference tags in the input (internal use)")),
                OPT_END(),
        };
 
+       mem_pool_init(&string_pool, 0);
        init_commit_rev_name(&rev_names);
        git_config(git_default_config, NULL);
        argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
@@ -652,7 +648,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
        adjust_cutoff_timestamp_for_slop();
 
        for_each_ref(name_ref, &data);
-       name_tips();
+       name_tips(&string_pool);
 
        if (annotate_stdin) {
                struct strbuf sb = STRBUF_INIT;
@@ -680,6 +676,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
                                  always, allow_undefined, data.name_only);
        }
 
+       UNLEAK(string_pool);
        UNLEAK(revs);
        return 0;
 }
index 9f38863dd507ff680cf8a006b81a413d75550b1b..caf20fd5bdd4b7c1cb44191d58ecbb389643b748 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "builtin.h"
 #include "config.h"
-#include "alloc.h"
 #include "editor.h"
 #include "environment.h"
 #include "gettext.h"
@@ -19,7 +18,6 @@
 #include "object-store-ll.h"
 #include "path.h"
 #include "repository.h"
-#include "blob.h"
 #include "pretty.h"
 #include "refs.h"
 #include "exec-cmd.h"
@@ -718,9 +716,11 @@ static int append_edit(int argc, const char **argv, const char *prefix)
                struct strbuf buf = STRBUF_INIT;
                char *prev_buf = repo_read_object_file(the_repository, note, &type, &size);
 
-               if (prev_buf && size)
+               if (!prev_buf)
+                       die(_("unable to read %s"), oid_to_hex(note));
+               if (size)
                        strbuf_add(&buf, prev_buf, size);
-               if (d.buf.len && prev_buf && size)
+               if (d.buf.len && size)
                        append_separator(&buf);
                strbuf_insert(&d.buf, 0, buf.buf, buf.len);
 
index d34902002656ed844a94f2c744dbefd08c571b91..baf0090fc8dac79201a682f1d2c56257d8587283 100644 (file)
@@ -6,10 +6,8 @@
 #include "config.h"
 #include "attr.h"
 #include "object.h"
-#include "blob.h"
 #include "commit.h"
 #include "tag.h"
-#include "tree.h"
 #include "delta.h"
 #include "pack.h"
 #include "pack-revindex.h"
@@ -18,7 +16,6 @@
 #include "diff.h"
 #include "revision.h"
 #include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "pack-objects.h"
 #include "progress.h"
@@ -221,13 +218,19 @@ static int thin;
 static int num_preferred_base;
 static struct progress *progress_state;
 
-static struct packed_git *reuse_packfile;
+static struct bitmapped_pack *reuse_packfiles;
+static size_t reuse_packfiles_nr;
+static size_t reuse_packfiles_used_nr;
 static uint32_t reuse_packfile_objects;
 static struct bitmap *reuse_packfile_bitmap;
 
 static int use_bitmap_index_default = 1;
 static int use_bitmap_index = -1;
-static int allow_pack_reuse = 1;
+static enum {
+       NO_PACK_REUSE = 0,
+       SINGLE_PACK_REUSE,
+       MULTI_PACK_REUSE,
+} allow_pack_reuse = SINGLE_PACK_REUSE;
 static enum {
        WRITE_BITMAP_FALSE = 0,
        WRITE_BITMAP_QUIET,
@@ -1013,7 +1016,9 @@ static off_t find_reused_offset(off_t where)
        return reused_chunks[lo-1].difference;
 }
 
-static void write_reused_pack_one(size_t pos, struct hashfile *out,
+static void write_reused_pack_one(struct packed_git *reuse_packfile,
+                                 size_t pos, struct hashfile *out,
+                                 off_t pack_start,
                                  struct pack_window **w_curs)
 {
        off_t offset, next, cur;
@@ -1023,7 +1028,8 @@ static void write_reused_pack_one(size_t pos, struct hashfile *out,
        offset = pack_pos_to_offset(reuse_packfile, pos);
        next = pack_pos_to_offset(reuse_packfile, pos + 1);
 
-       record_reused_object(offset, offset - hashfile_total(out));
+       record_reused_object(offset,
+                            offset - (hashfile_total(out) - pack_start));
 
        cur = offset;
        type = unpack_object_header(reuse_packfile, w_curs, &cur, &size);
@@ -1091,41 +1097,93 @@ static void write_reused_pack_one(size_t pos, struct hashfile *out,
        copy_pack_data(out, reuse_packfile, w_curs, offset, next - offset);
 }
 
-static size_t write_reused_pack_verbatim(struct hashfile *out,
+static size_t write_reused_pack_verbatim(struct bitmapped_pack *reuse_packfile,
+                                        struct hashfile *out,
+                                        off_t pack_start,
                                         struct pack_window **w_curs)
 {
-       size_t pos = 0;
+       size_t pos = reuse_packfile->bitmap_pos;
+       size_t end;
+
+       if (pos % BITS_IN_EWORD) {
+               size_t word_pos = (pos / BITS_IN_EWORD);
+               size_t offset = pos % BITS_IN_EWORD;
+               size_t last;
+               eword_t word = reuse_packfile_bitmap->words[word_pos];
+
+               if (offset + reuse_packfile->bitmap_nr < BITS_IN_EWORD)
+                       last = offset + reuse_packfile->bitmap_nr;
+               else
+                       last = BITS_IN_EWORD;
+
+               for (; offset < last; offset++) {
+                       if (word >> offset == 0)
+                               return word_pos;
+                       if (!bitmap_get(reuse_packfile_bitmap,
+                                       word_pos * BITS_IN_EWORD + offset))
+                               return word_pos;
+               }
+
+               pos += BITS_IN_EWORD - (pos % BITS_IN_EWORD);
+       }
+
+       /*
+        * Now we're going to copy as many whole eword_t's as possible.
+        * "end" is the index of the last whole eword_t we copy, but
+        * there may be additional bits to process. Those are handled
+        * individually by write_reused_pack().
+        *
+        * Begin by advancing to the first word boundary in range of the
+        * bit positions occupied by objects in "reuse_packfile". Then
+        * pick the last word boundary in the same range. If we have at
+        * least one word's worth of bits to process, continue on.
+        */
+       end = reuse_packfile->bitmap_pos + reuse_packfile->bitmap_nr;
+       if (end % BITS_IN_EWORD)
+               end -= end % BITS_IN_EWORD;
+       if (pos >= end)
+               return reuse_packfile->bitmap_pos / BITS_IN_EWORD;
+
+       while (pos < end &&
+              reuse_packfile_bitmap->words[pos / BITS_IN_EWORD] == (eword_t)~0)
+               pos += BITS_IN_EWORD;
 
-       while (pos < reuse_packfile_bitmap->word_alloc &&
-                       reuse_packfile_bitmap->words[pos] == (eword_t)~0)
-               pos++;
+       if (pos > end)
+               pos = end;
 
-       if (pos) {
-               off_t to_write;
+       if (reuse_packfile->bitmap_pos < pos) {
+               off_t pack_start_off = pack_pos_to_offset(reuse_packfile->p, 0);
+               off_t pack_end_off = pack_pos_to_offset(reuse_packfile->p,
+                                                       pos - reuse_packfile->bitmap_pos);
 
-               written = (pos * BITS_IN_EWORD);
-               to_write = pack_pos_to_offset(reuse_packfile, written)
-                       - sizeof(struct pack_header);
+               written += pos - reuse_packfile->bitmap_pos;
 
                /* We're recording one chunk, not one object. */
-               record_reused_object(sizeof(struct pack_header), 0);
+               record_reused_object(pack_start_off,
+                                    pack_start_off - (hashfile_total(out) - pack_start));
                hashflush(out);
-               copy_pack_data(out, reuse_packfile, w_curs,
-                       sizeof(struct pack_header), to_write);
+               copy_pack_data(out, reuse_packfile->p, w_curs,
+                       pack_start_off, pack_end_off - pack_start_off);
 
                display_progress(progress_state, written);
        }
-       return pos;
+       if (pos % BITS_IN_EWORD)
+               BUG("attempted to jump past a word boundary to %"PRIuMAX,
+                   (uintmax_t)pos);
+       return pos / BITS_IN_EWORD;
 }
 
-static void write_reused_pack(struct hashfile *f)
+static void write_reused_pack(struct bitmapped_pack *reuse_packfile,
+                             struct hashfile *f)
 {
-       size_t i = 0;
+       size_t i = reuse_packfile->bitmap_pos / BITS_IN_EWORD;
        uint32_t offset;
+       off_t pack_start = hashfile_total(f) - sizeof(struct pack_header);
        struct pack_window *w_curs = NULL;
 
        if (allow_ofs_delta)
-               i = write_reused_pack_verbatim(f, &w_curs);
+               i = write_reused_pack_verbatim(reuse_packfile, f, pack_start,
+                                              &w_curs);
 
        for (; i < reuse_packfile_bitmap->word_alloc; ++i) {
                eword_t word = reuse_packfile_bitmap->words[i];
@@ -1136,16 +1194,23 @@ static void write_reused_pack(struct hashfile *f)
                                break;
 
                        offset += ewah_bit_ctz64(word >> offset);
+                       if (pos + offset < reuse_packfile->bitmap_pos)
+                               continue;
+                       if (pos + offset >= reuse_packfile->bitmap_pos + reuse_packfile->bitmap_nr)
+                               goto done;
                        /*
                         * Can use bit positions directly, even for MIDX
                         * bitmaps. See comment in try_partial_reuse()
                         * for why.
                         */
-                       write_reused_pack_one(pos + offset, f, &w_curs);
+                       write_reused_pack_one(reuse_packfile->p,
+                                             pos + offset - reuse_packfile->bitmap_pos,
+                                             f, pack_start, &w_curs);
                        display_progress(progress_state, ++written);
                }
        }
 
+done:
        unuse_pack(&w_curs);
 }
 
@@ -1197,9 +1262,14 @@ static void write_pack_file(void)
 
                offset = write_pack_header(f, nr_remaining);
 
-               if (reuse_packfile) {
+               if (reuse_packfiles_nr) {
                        assert(pack_to_stdout);
-                       write_reused_pack(f);
+                       for (j = 0; j < reuse_packfiles_nr; j++) {
+                               reused_chunks_nr = 0;
+                               write_reused_pack(&reuse_packfiles[j], f);
+                               if (reused_chunks_nr)
+                                       reuse_packfiles_used_nr++;
+                       }
                        offset = hashfile_total(f);
                }
 
@@ -3177,7 +3247,19 @@ static int git_pack_config(const char *k, const char *v,
                return 0;
        }
        if (!strcmp(k, "pack.allowpackreuse")) {
-               allow_pack_reuse = git_config_bool(k, v);
+               int res = git_parse_maybe_bool_text(v);
+               if (res < 0) {
+                       if (!strcasecmp(v, "single"))
+                               allow_pack_reuse = SINGLE_PACK_REUSE;
+                       else if (!strcasecmp(v, "multi"))
+                               allow_pack_reuse = MULTI_PACK_REUSE;
+                       else
+                               die(_("invalid pack.allowPackReuse value: '%s'"), v);
+               } else if (res) {
+                       allow_pack_reuse = SINGLE_PACK_REUSE;
+               } else {
+                       allow_pack_reuse = NO_PACK_REUSE;
+               }
                return 0;
        }
        if (!strcmp(k, "pack.threads")) {
@@ -3206,7 +3288,7 @@ static int git_pack_config(const char *k, const char *v,
                return 0;
        }
        if (!strcmp(k, "uploadpack.blobpackfileuri")) {
-               struct configured_exclusion *ex = xmalloc(sizeof(*ex));
+               struct configured_exclusion *ex;
                const char *oid_end, *pack_end;
                /*
                 * Stores the pack hash. This is not a true object ID, but is
@@ -3214,6 +3296,10 @@ static int git_pack_config(const char *k, const char *v,
                 */
                struct object_id pack_hash;
 
+               if (!v)
+                       return config_error_nonbool(k);
+
+               ex = xmalloc(sizeof(*ex));
                if (parse_oid_hex(v, &ex->e.oid, &oid_end) ||
                    *oid_end != ' ' ||
                    parse_oid_hex(oid_end + 1, &pack_hash, &pack_end) ||
@@ -3605,7 +3691,6 @@ static void read_cruft_objects(void)
                        string_list_append(&discard_packs, buf.buf + 1);
                else
                        string_list_append(&fresh_packs, buf.buf);
-               strbuf_reset(&buf);
        }
 
        string_list_sort(&discard_packs);
@@ -3741,7 +3826,7 @@ static void show_object__ma_allow_promisor(struct object *obj, const char *name,
        show_object(obj, name, data);
 }
 
-static int option_parse_missing_action(const struct option *opt,
+static int option_parse_missing_action(const struct option *opt UNUSED,
                                       const char *arg, int unset)
 {
        assert(arg);
@@ -3933,7 +4018,7 @@ static void loosen_unused_packed_objects(void)
  */
 static int pack_options_allow_reuse(void)
 {
-       return allow_pack_reuse &&
+       return allow_pack_reuse != NO_PACK_REUSE &&
               pack_to_stdout &&
               !ignore_packed_keep_on_disk &&
               !ignore_packed_keep_in_core &&
@@ -3946,13 +4031,18 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
        if (!(bitmap_git = prepare_bitmap_walk(revs, 0)))
                return -1;
 
-       if (pack_options_allow_reuse() &&
-           !reuse_partial_packfile_from_bitmap(
-                       bitmap_git,
-                       &reuse_packfile,
-                       &reuse_packfile_objects,
-                       &reuse_packfile_bitmap)) {
-               assert(reuse_packfile_objects);
+       if (pack_options_allow_reuse())
+               reuse_partial_packfile_from_bitmap(bitmap_git,
+                                                  &reuse_packfiles,
+                                                  &reuse_packfiles_nr,
+                                                  &reuse_packfile_bitmap,
+                                                  allow_pack_reuse == MULTI_PACK_REUSE);
+
+       if (reuse_packfiles) {
+               reuse_packfile_objects = bitmap_popcount(reuse_packfile_bitmap);
+               if (!reuse_packfile_objects)
+                       BUG("expected non-empty reuse bitmap");
+
                nr_result += reuse_packfile_objects;
                nr_seen += reuse_packfile_objects;
                display_progress(progress_state, nr_seen);
@@ -4122,34 +4212,37 @@ static void add_extra_kept_packs(const struct string_list *names)
 static int option_parse_quiet(const struct option *opt, const char *arg,
                              int unset)
 {
+       int *val = opt->value;
+
        BUG_ON_OPT_ARG(arg);
 
        if (!unset)
-               progress = 0;
-       else if (!progress)
-               progress = 1;
+               *val = 0;
+       else if (!*val)
+               *val = 1;
        return 0;
 }
 
 static int option_parse_index_version(const struct option *opt,
                                      const char *arg, int unset)
 {
+       struct pack_idx_option *popts = opt->value;
        char *c;
        const char *val = arg;
 
        BUG_ON_OPT_NEG(unset);
 
-       pack_idx_opts.version = strtoul(val, &c, 10);
-       if (pack_idx_opts.version > 2)
+       popts->version = strtoul(val, &c, 10);
+       if (popts->version > 2)
                die(_("unsupported index version %s"), val);
        if (*c == ',' && c[1])
-               pack_idx_opts.off32_limit = strtoul(c+1, &c, 0);
-       if (*c || pack_idx_opts.off32_limit & 0x80000000)
+               popts->off32_limit = strtoul(c+1, &c, 0);
+       if (*c || popts->off32_limit & 0x80000000)
                die(_("bad index version '%s'"), val);
        return 0;
 }
 
-static int option_parse_unpack_unreachable(const struct option *opt,
+static int option_parse_unpack_unreachable(const struct option *opt UNUSED,
                                           const char *arg, int unset)
 {
        if (unset) {
@@ -4164,7 +4257,7 @@ static int option_parse_unpack_unreachable(const struct option *opt,
        return 0;
 }
 
-static int option_parse_cruft_expiration(const struct option *opt,
+static int option_parse_cruft_expiration(const struct option *opt UNUSED,
                                         const char *arg, int unset)
 {
        if (unset) {
@@ -4192,7 +4285,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                LIST_OBJECTS_FILTER_INIT;
 
        struct option pack_objects_options[] = {
-               OPT_CALLBACK_F('q', "quiet", NULL, NULL,
+               OPT_CALLBACK_F('q', "quiet", &progress, NULL,
                               N_("do not show progress meter"),
                               PARSE_OPT_NOARG, option_parse_quiet),
                OPT_SET_INT(0, "progress", &progress,
@@ -4202,7 +4295,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "all-progress-implied",
                         &all_progress_implied,
                         N_("similar to --all-progress when progress meter is shown")),
-               OPT_CALLBACK_F(0, "index-version", NULL, N_("<version>[,<offset>]"),
+               OPT_CALLBACK_F(0, "index-version", &pack_idx_opts, N_("<version>[,<offset>]"),
                  N_("write the pack index file in the specified idx format version"),
                  PARSE_OPT_NONEG, option_parse_index_version),
                OPT_MAGNITUDE(0, "max-pack-size", &pack_size_limit,
@@ -4305,6 +4398,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                prepare_repo_settings(the_repository);
                if (sparse < 0)
                        sparse = the_repository->settings.pack_use_sparse;
+               if (the_repository->settings.pack_use_multi_pack_reuse)
+                       allow_pack_reuse = MULTI_PACK_REUSE;
        }
 
        reset_pack_idx_option(&pack_idx_opts);
@@ -4385,7 +4480,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 
        if (!HAVE_THREADS && delta_search_threads != 1)
                warning(_("no threads support, ignoring --threads"));
-       if (!pack_to_stdout && !pack_size_limit && !cruft)
+       if (!pack_to_stdout && !pack_size_limit)
                pack_size_limit = pack_size_limit_cfg;
        if (pack_to_stdout && pack_size_limit)
                die(_("--max-pack-size cannot be used to build a pack for transfer"));
@@ -4402,12 +4497,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
        if (!rev_list_all || !rev_list_reflog || !rev_list_index)
                unpack_unreachable_expiration = 0;
 
-       if (filter_options.choice) {
-               if (!pack_to_stdout)
-                       die(_("cannot use --filter without --stdout"));
-               if (stdin_packs)
-                       die(_("cannot use --filter with --stdin-packs"));
-       }
+       if (stdin_packs && filter_options.choice)
+               die(_("cannot use --filter with --stdin-packs"));
 
        if (stdin_packs && use_internal_rev_list)
                die(_("cannot use internal rev list with --stdin-packs"));
@@ -4417,8 +4508,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                        die(_("cannot use internal rev list with --cruft"));
                if (stdin_packs)
                        die(_("cannot use --stdin-packs with --cruft"));
-               if (pack_size_limit)
-                       die(_("cannot use --max-pack-size with --cruft"));
        }
 
        /*
@@ -4523,11 +4612,20 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                fprintf_ln(stderr,
                           _("Total %"PRIu32" (delta %"PRIu32"),"
                             " reused %"PRIu32" (delta %"PRIu32"),"
-                            " pack-reused %"PRIu32),
+                            " pack-reused %"PRIu32" (from %"PRIuMAX")"),
                           written, written_delta, reused, reused_delta,
-                          reuse_packfile_objects);
+                          reuse_packfile_objects,
+                          (uintmax_t)reuse_packfiles_used_nr);
+
+       trace2_data_intmax("pack-objects", the_repository, "written", written);
+       trace2_data_intmax("pack-objects", the_repository, "written/delta", written_delta);
+       trace2_data_intmax("pack-objects", the_repository, "reused", reused);
+       trace2_data_intmax("pack-objects", the_repository, "reused/delta", reused_delta);
+       trace2_data_intmax("pack-objects", the_repository, "pack-reused", reuse_packfile_objects);
+       trace2_data_intmax("pack-objects", the_repository, "packs-reused", reuse_packfiles_used_nr);
 
 cleanup:
+       clear_packing_data(&to_pack);
        list_objects_filter_release(&filter_options);
        strvec_clear(&rp);
 
index be2b2c9ebc97b2a1620b93e1766e0ccfa6c7843a..72cbb76d520718cfc2f23093dd5ef76ea2d682bf 100644 (file)
@@ -14,7 +14,6 @@
 #include "merge.h"
 #include "object-name.h"
 #include "parse-options.h"
-#include "exec-cmd.h"
 #include "run-command.h"
 #include "oid-array.h"
 #include "remote.h"
 #include "rebase.h"
 #include "refs.h"
 #include "refspec.h"
-#include "revision.h"
 #include "submodule.h"
 #include "submodule-config.h"
-#include "tempfile.h"
-#include "lockfile.h"
 #include "wt-status.h"
 #include "commit-reach.h"
 #include "sequencer.h"
-#include "packfile.h"
 
 /**
  * Parses the value of --rebase. If value is a false value, returns
@@ -820,7 +815,7 @@ static int get_octopus_merge_base(struct object_id *merge_base,
                const struct object_id *merge_head,
                const struct object_id *fork_point)
 {
-       struct commit_list *revs = NULL, *result;
+       struct commit_list *revs = NULL, *result = NULL;
 
        commit_list_insert(lookup_commit_reference(the_repository, curr_head),
                           &revs);
@@ -830,7 +825,8 @@ static int get_octopus_merge_base(struct object_id *merge_base,
                commit_list_insert(lookup_commit_reference(the_repository, fork_point),
                                   &revs);
 
-       result = get_octopus_merge_bases(revs);
+       if (get_octopus_merge_bases(revs, &result) < 0)
+               exit(128);
        free_commit_list(revs);
        reduce_heads_replace(&result);
 
@@ -931,6 +927,8 @@ static int get_can_ff(struct object_id *orig_head,
        merge_head = lookup_commit_reference(the_repository, orig_merge_head);
        ret = repo_is_descendant_of(the_repository, merge_head, list);
        free_commit_list(list);
+       if (ret < 0)
+               exit(128);
        return ret;
 }
 
@@ -955,6 +953,8 @@ static int already_up_to_date(struct object_id *orig_head,
                commit_list_insert(theirs, &list);
                ok = repo_is_descendant_of(the_repository, ours, list);
                free_commit_list(list);
+               if (ok < 0)
+                       exit(128);
                if (!ok)
                        return 0;
        }
index 2e708383c24ba86e07fc14b0139afb28d489c014..2fbb31c3ad8eb9b7a15ffac4e5d9aa65367d298f 100644 (file)
@@ -7,7 +7,6 @@
 #include "config.h"
 #include "environment.h"
 #include "gettext.h"
-#include "refs.h"
 #include "refspec.h"
 #include "run-command.h"
 #include "remote.h"
@@ -392,7 +391,7 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
        if (!is_empty_cas(&cas)) {
                if (!transport->smart_options)
                        die("underlying transport does not support --%s option",
-                           CAS_OPT_NAME);
+                           "force-with-lease");
                transport->smart_options->cas = &cas;
        }
 
@@ -526,26 +525,21 @@ static int git_push_config(const char *k, const char *v,
                        *flags |= TRANSPORT_PUSH_AUTO_UPSTREAM;
                return 0;
        } else if (!strcmp(k, "push.gpgsign")) {
-               const char *value;
-               if (!git_config_get_value("push.gpgsign", &value)) {
-                       switch (git_parse_maybe_bool(value)) {
-                       case 0:
-                               set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_NEVER);
-                               break;
-                       case 1:
-                               set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_ALWAYS);
-                               break;
-                       default:
-                               if (value && !strcasecmp(value, "if-asked"))
-                                       set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_IF_ASKED);
-                               else
-                                       return error(_("invalid value for '%s'"), k);
-                       }
+               switch (git_parse_maybe_bool(v)) {
+               case 0:
+                       set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_NEVER);
+                       break;
+               case 1:
+                       set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_ALWAYS);
+                       break;
+               default:
+                       if (!strcasecmp(v, "if-asked"))
+                               set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_IF_ASKED);
+                       else
+                               return error(_("invalid value for '%s'"), k);
                }
        } else if (!strcmp(k, "push.recursesubmodules")) {
-               const char *value;
-               if (!git_config_get_value("push.recursesubmodules", &value))
-                       recurse_submodules = parse_push_recurse_submodules_arg(k, value);
+               recurse_submodules = parse_push_recurse_submodules_arg(k, v);
        } else if (!strcmp(k, "submodule.recurse")) {
                int val = git_config_bool(k, v) ?
                        RECURSE_SUBMODULES_ON_DEMAND : RECURSE_SUBMODULES_OFF;
@@ -604,7 +598,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
                OPT_BIT( 0,  "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
                OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE),
-               OPT_CALLBACK_F(0, CAS_OPT_NAME, &cas, N_("<refname>:<expect>"),
+               OPT_CALLBACK_F(0, "force-with-lease", &cas, N_("<refname>:<expect>"),
                               N_("require old value of ref to be at this value"),
                               PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP, parseopt_push_cas_option),
                OPT_BIT(0, TRANS_OPT_FORCE_IF_INCLUDES, &flags,
@@ -639,8 +633,10 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                : &push_options_config);
        set_push_cert_flags(&flags, push_cert);
 
-       if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
-               die(_("options '%s' and '%s' cannot be used together"), "--delete", "--all/--branches/--mirror/--tags");
+       die_for_incompatible_opt4(deleterefs, "--delete",
+                                 tags, "--tags",
+                                 flags & TRANSPORT_PUSH_ALL, "--all/--branches",
+                                 flags & TRANSPORT_PUSH_MIRROR, "--mirror");
        if (deleterefs && argc < 2)
                die(_("--delete doesn't make sense without any refs"));
 
@@ -677,19 +673,13 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
 
        if (flags & TRANSPORT_PUSH_ALL) {
-               if (tags)
-                       die(_("options '%s' and '%s' cannot be used together"), "--all", "--tags");
                if (argc >= 2)
                        die(_("--all can't be combined with refspecs"));
        }
        if (flags & TRANSPORT_PUSH_MIRROR) {
-               if (tags)
-                       die(_("options '%s' and '%s' cannot be used together"), "--mirror", "--tags");
                if (argc >= 2)
                        die(_("--mirror can't be combined with refspecs"));
        }
-       if ((flags & TRANSPORT_PUSH_ALL) && (flags & TRANSPORT_PUSH_MIRROR))
-               die(_("options '%s' and '%s' cannot be used together"), "--all", "--mirror");
 
        if (!is_empty_cas(&cas) && (flags & TRANSPORT_PUSH_FORCE_IF_INCLUDES))
                cas.use_force_if_includes = 1;
index e455a4795cc8101576a806ee68df71a56c7661ce..f02cbac087db403cedae2e4b5269e5258059677f 100644 (file)
@@ -5,7 +5,6 @@
 #include "range-diff.h"
 #include "config.h"
 #include "repository.h"
-#include "revision.h"
 
 static const char * const builtin_range_diff_usage[] = {
 N_("git range-diff [<options>] <old-base>..<old-tip> <new-base>..<new-tip>"),
index 24d6d156d3a2ee54435d08ac7659ced69418cd6e..6f89cec0fbb6b181b8feae32d7d3da6ff45b7ef3 100644 (file)
 #include "tree-walk.h"
 #include "cache-tree.h"
 #include "unpack-trees.h"
-#include "dir.h"
 #include "parse-options.h"
 #include "repository.h"
 #include "resolve-undo.h"
 #include "setup.h"
 #include "sparse-index.h"
 #include "submodule.h"
-#include "submodule-config.h"
 
 static int nr_trees;
 static int read_empty;
@@ -49,7 +47,7 @@ static const char * const read_tree_usage[] = {
        NULL
 };
 
-static int index_output_cb(const struct option *opt, const char *arg,
+static int index_output_cb(const struct option *opt UNUSED, const char *arg,
                                 int unset)
 {
        BUG_ON_OPT_NEG(unset);
@@ -263,7 +261,8 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
        cache_tree_free(&the_index.cache_tree);
        for (i = 0; i < nr_trees; i++) {
                struct tree *tree = trees[i];
-               parse_tree(tree);
+               if (parse_tree(tree) < 0)
+                       return 128;
                init_tree_desc(t+i, &tree->object.oid, tree->buffer, tree->size);
        }
        if (unpack_trees(nr_trees, t, &opts))
index 50cb85751f798e81d30d631754a3aaad443c3c49..e444ab102dfe5c99dae8b004960b27a8a600a16b 100644 (file)
 #include "gettext.h"
 #include "hex.h"
 #include "run-command.h"
-#include "exec-cmd.h"
 #include "strvec.h"
 #include "dir.h"
-#include "packfile.h"
 #include "refs.h"
-#include "quote.h"
 #include "config.h"
-#include "cache-tree.h"
 #include "unpack-trees.h"
 #include "lockfile.h"
 #include "object-file.h"
@@ -149,7 +145,6 @@ struct rebase_options {
                .reapply_cherry_picks = -1,             \
                .allow_empty_message = 1,               \
                .autosquash = -1,                       \
-               .config_autosquash = -1,                \
                .rebase_merges = -1,                    \
                .config_rebase_merges = -1,             \
                .update_refs = -1,                      \
@@ -376,20 +371,6 @@ static int run_sequencer_rebase(struct rebase_options *opts)
        return ret;
 }
 
-static void imply_merge(struct rebase_options *opts, const char *option);
-static int parse_opt_keep_empty(const struct option *opt, const char *arg,
-                               int unset)
-{
-       struct rebase_options *opts = opt->value;
-
-       BUG_ON_OPT_ARG(arg);
-
-       imply_merge(opts, unset ? "--no-keep-empty" : "--keep-empty");
-       opts->keep_empty = !unset;
-       opts->type = REBASE_MERGE;
-       return 0;
-}
-
 static int is_merge(struct rebase_options *opts)
 {
        return opts->type == REBASE_MERGE;
@@ -534,7 +515,7 @@ static int finish_rebase(struct rebase_options *opts)
        int ret = 0;
 
        delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
-       unlink(git_path_auto_merge(the_repository));
+       delete_ref(NULL, "AUTO_MERGE", NULL, REF_NO_DEREF);
        apply_autostash(state_dir_path("autostash", opts));
        /*
         * We ignore errors in 'git maintenance run --auto', since the
@@ -586,18 +567,10 @@ static int move_to_original_branch(struct rebase_options *opts)
        return ret;
 }
 
-static const char *resolvemsg =
-N_("Resolve all conflicts manually, mark them as resolved with\n"
-"\"git add/rm <conflicted_files>\", then run \"git rebase --continue\".\n"
-"You can instead skip this commit: run \"git rebase --skip\".\n"
-"To abort and get back to the state before \"git rebase\", run "
-"\"git rebase --abort\".");
-
 static int run_am(struct rebase_options *opts)
 {
        struct child_process am = CHILD_PROCESS_INIT;
        struct child_process format_patch = CHILD_PROCESS_INIT;
-       struct strbuf revisions = STRBUF_INIT;
        int status;
        char *rebased_patches;
 
@@ -607,7 +580,7 @@ static int run_am(struct rebase_options *opts)
                     opts->reflog_action);
        if (opts->action == ACTION_CONTINUE) {
                strvec_push(&am.args, "--resolved");
-               strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
+               strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
                if (opts->gpg_sign_opt)
                        strvec_push(&am.args, opts->gpg_sign_opt);
                status = run_command(&am);
@@ -618,7 +591,7 @@ static int run_am(struct rebase_options *opts)
        }
        if (opts->action == ACTION_SKIP) {
                strvec_push(&am.args, "--skip");
-               strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
+               strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
                status = run_command(&am);
                if (status)
                        return status;
@@ -630,13 +603,6 @@ static int run_am(struct rebase_options *opts)
                return run_command(&am);
        }
 
-       strbuf_addf(&revisions, "%s...%s",
-                   oid_to_hex(opts->root ?
-                              /* this is now equivalent to !opts->upstream */
-                              &opts->onto->object.oid :
-                              &opts->upstream->object.oid),
-                   oid_to_hex(&opts->orig_head->object.oid));
-
        rebased_patches = xstrdup(git_path("rebased-patches"));
        format_patch.out = open(rebased_patches,
                                O_WRONLY | O_CREAT | O_TRUNC, 0666);
@@ -657,7 +623,12 @@ static int run_am(struct rebase_options *opts)
        if (opts->git_format_patch_opt.len)
                strvec_split(&format_patch.args,
                             opts->git_format_patch_opt.buf);
-       strvec_push(&format_patch.args, revisions.buf);
+       strvec_pushf(&format_patch.args, "%s...%s",
+                    oid_to_hex(opts->root ?
+                               /* this is now equivalent to !opts->upstream */
+                               &opts->onto->object.oid :
+                               &opts->upstream->object.oid),
+                    oid_to_hex(&opts->orig_head->object.oid));
        if (opts->restrict_revision)
                strvec_pushf(&format_patch.args, "^%s",
                             oid_to_hex(&opts->restrict_revision->object.oid));
@@ -680,10 +651,8 @@ static int run_am(struct rebase_options *opts)
                        "As a result, git cannot rebase them."),
                      opts->revisions);
 
-               strbuf_release(&revisions);
                return status;
        }
-       strbuf_release(&revisions);
 
        am.in = open(rebased_patches, O_RDONLY);
        if (am.in < 0) {
@@ -696,7 +665,7 @@ static int run_am(struct rebase_options *opts)
 
        strvec_pushv(&am.args, opts->git_am_opts.v);
        strvec_push(&am.args, "--rebasing");
-       strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
+       strvec_pushf(&am.args, "--resolvemsg=%s", rebase_resolvemsg);
        strvec_push(&am.args, "--patch-format=mboxrd");
        if (opts->allow_rerere_autoupdate == RERERE_AUTOUPDATE)
                strvec_push(&am.args, "--rerere-autoupdate");
@@ -724,11 +693,8 @@ static int run_specific_rebase(struct rebase_options *opts)
 
        if (opts->type == REBASE_MERGE) {
                /* Run sequencer-based rebase */
-               setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);
-               if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
+               if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT))
                        setenv("GIT_SEQUENCE_EDITOR", ":", 1);
-                       opts->autosquash = 0;
-               }
                if (opts->gpg_sign_opt) {
                        /* remove the leading "-S" */
                        char *tmp = xstrdup(opts->gpg_sign_opt + 2);
@@ -893,7 +859,8 @@ static int can_fast_forward(struct commit *onto, struct commit *upstream,
        if (!upstream)
                goto done;
 
-       merge_bases = repo_get_merge_bases(the_repository, upstream, head);
+       if (repo_get_merge_bases(the_repository, upstream, head, &merge_bases) < 0)
+               exit(128);
        if (!merge_bases || merge_bases->next)
                goto done;
 
@@ -912,8 +879,9 @@ static void fill_branch_base(struct rebase_options *options,
 {
        struct commit_list *merge_bases = NULL;
 
-       merge_bases = repo_get_merge_bases(the_repository, options->onto,
-                                          options->orig_head);
+       if (repo_get_merge_bases(the_repository, options->onto,
+                                options->orig_head, &merge_bases) < 0)
+               exit(128);
        if (!merge_bases || merge_bases->next)
                oidcpy(branch_base, null_oid());
        else
@@ -983,6 +951,18 @@ static enum empty_type parse_empty_value(const char *value)
        die(_("unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask\"."), value);
 }
 
+static int parse_opt_keep_empty(const struct option *opt, const char *arg,
+                               int unset)
+{
+       struct rebase_options *opts = opt->value;
+
+       BUG_ON_OPT_ARG(arg);
+
+       imply_merge(opts, unset ? "--no-keep-empty" : "--keep-empty");
+       opts->keep_empty = !unset;
+       return 0;
+}
+
 static int parse_opt_empty(const struct option *opt, const char *arg, int unset)
 {
        struct rebase_options *options = opt->value;
@@ -1147,7 +1127,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                                 "instead of ignoring them"),
                              1, PARSE_OPT_HIDDEN),
                OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate),
-               OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}",
+               OPT_CALLBACK_F(0, "empty", &options, "(drop|keep|ask)",
                               N_("how to handle commits that become empty"),
                               PARSE_OPT_NONEG, parse_opt_empty),
                OPT_CALLBACK_F('k', "keep-empty", &options, NULL,
@@ -1268,7 +1248,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                die(_("options '%s' and '%s' cannot be used together"), "--root", "--fork-point");
 
        if (options.action != ACTION_NONE && !in_progress)
-               die(_("No rebase in progress?"));
+               die(_("no rebase in progress"));
 
        if (options.action == ACTION_EDIT_TODO && !is_merge(&options))
                die(_("The --edit-todo action can only be used during "
@@ -1407,7 +1387,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
        if ((options.flags & REBASE_INTERACTIVE_EXPLICIT) ||
            (options.action != ACTION_NONE) ||
            (options.exec.nr > 0) ||
-           (options.autosquash == -1 && options.config_autosquash == 1) ||
            options.autosquash == 1) {
                allow_preemptive_ff = 0;
        }
@@ -1491,23 +1470,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 
        if (options.strategy) {
                options.strategy = xstrdup(options.strategy);
-               switch (options.type) {
-               case REBASE_APPLY:
-                       die(_("--strategy requires --merge or --interactive"));
-               case REBASE_MERGE:
-                       /* compatible */
-                       break;
-               case REBASE_UNSPECIFIED:
-                       options.type = REBASE_MERGE;
-                       break;
-               default:
-                       BUG("unhandled rebase type (%d)", options.type);
-               }
+               imply_merge(&options, "--strategy");
        }
 
-       if (options.type == REBASE_MERGE)
-               imply_merge(&options, "--merge");
-
        if (options.root && !options.onto_name)
                imply_merge(&options, "--root without --onto");
 
@@ -1524,8 +1489,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                        if (is_merge(&options))
                                die(_("apply options and merge options "
                                          "cannot be used together"));
-                       else if (options.autosquash == -1 && options.config_autosquash == 1)
-                               die(_("apply options are incompatible with rebase.autoSquash.  Consider adding --no-autosquash"));
                        else if (options.rebase_merges == -1 && options.config_rebase_merges == 1)
                                die(_("apply options are incompatible with rebase.rebaseMerges.  Consider adding --no-rebase-merges"));
                        else if (options.update_refs == -1 && options.config_update_refs == 1)
@@ -1545,14 +1508,17 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
        options.rebase_merges = (options.rebase_merges >= 0) ? options.rebase_merges :
                                ((options.config_rebase_merges >= 0) ? options.config_rebase_merges : 0);
 
-       if (options.autosquash == 1)
+       if (options.autosquash == 1) {
                imply_merge(&options, "--autosquash");
-       options.autosquash = (options.autosquash >= 0) ? options.autosquash :
-                            ((options.config_autosquash >= 0) ? options.config_autosquash : 0);
+       } else if (options.autosquash == -1) {
+               options.autosquash =
+                       options.config_autosquash &&
+                       (options.flags & REBASE_INTERACTIVE_EXPLICIT);
+       }
 
        if (options.type == REBASE_UNSPECIFIED) {
                if (!strcmp(options.default_backend, "merge"))
-                       imply_merge(&options, "--merge");
+                       options.type = REBASE_MERGE;
                else if (!strcmp(options.default_backend, "apply"))
                        options.type = REBASE_APPLY;
                else
@@ -1803,8 +1769,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 
                /* We want color (if set), but no pager */
                repo_diff_setup(the_repository, &opts);
-               opts.stat_width = -1; /* use full terminal width */
-               opts.stat_graph_width = -1; /* respect statGraphWidth config */
+               init_diffstat_widths(&opts);
                opts.output_format |=
                        DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
                opts.detect_rename = DIFF_DETECT_RENAME;
index fb8e1549d1be1e0b5e90cc2b7426eda7b7ce2f51..56d8a77ed75f65c1bcf47bd580e8e4e7cbbc32d9 100644 (file)
@@ -22,7 +22,6 @@
 #include "connected.h"
 #include "strvec.h"
 #include "version.h"
-#include "tag.h"
 #include "gpg-interface.h"
 #include "sigchain.h"
 #include "fsck.h"
@@ -142,6 +141,7 @@ static enum deny_action parse_deny_action(const char *var, const char *value)
 static int receive_pack_config(const char *var, const char *value,
                               const struct config_context *ctx, void *cb)
 {
+       const char *msg_id;
        int status = parse_hide_refs_config(var, value, "receive", &hidden_refs);
 
        if (status)
@@ -178,12 +178,14 @@ static int receive_pack_config(const char *var, const char *value,
                return 0;
        }
 
-       if (skip_prefix(var, "receive.fsck.", &var)) {
-               if (is_valid_msg_type(var, value))
+       if (skip_prefix(var, "receive.fsck.", &msg_id)) {
+               if (!value)
+                       return config_error_nonbool(var);
+               if (is_valid_msg_type(msg_id, value))
                        strbuf_addf(&fsck_msg_types, "%c%s=%s",
-                               fsck_msg_types.len ? ',' : '=', var, value);
+                               fsck_msg_types.len ? ',' : '=', msg_id, value);
                else
-                       warning("skipping unknown msg id '%s'", var);
+                       warning("skipping unknown msg id '%s'", msg_id);
                return 0;
        }
 
@@ -591,21 +593,6 @@ static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp)
        return strbuf_detach(&buf, NULL);
 }
 
-static char *find_header(const char *msg, size_t len, const char *key,
-                        const char **next_line)
-{
-       size_t out_len;
-       const char *val = find_header_mem(msg, len, key, &out_len);
-
-       if (!val)
-               return NULL;
-
-       if (next_line)
-               *next_line = val + out_len + 1;
-
-       return xmemdupz(val, out_len);
-}
-
 /*
  * Return zero if a and b are equal up to n bytes and nonzero if they are not.
  * This operation is guaranteed to run in constant time to avoid leaking data.
@@ -620,13 +607,14 @@ static int constant_memequal(const char *a, const char *b, size_t n)
        return res;
 }
 
-static const char *check_nonce(const char *buf, size_t len)
+static const char *check_nonce(const char *buf)
 {
-       char *nonce = find_header(buf, len, "nonce", NULL);
+       size_t noncelen;
+       const char *found = find_commit_header(buf, "nonce", &noncelen);
+       char *nonce = found ? xmemdupz(found, noncelen) : NULL;
        timestamp_t stamp, ostamp;
        char *bohmac, *expect = NULL;
        const char *retval = NONCE_BAD;
-       size_t noncelen;
 
        if (!nonce) {
                retval = NONCE_MISSING;
@@ -668,7 +656,6 @@ static const char *check_nonce(const char *buf, size_t len)
                goto leave;
        }
 
-       noncelen = strlen(nonce);
        expect = prepare_push_cert_nonce(service_dir, stamp);
        if (noncelen != strlen(expect)) {
                /* This is not even the right size. */
@@ -716,35 +703,28 @@ leave:
 static int check_cert_push_options(const struct string_list *push_options)
 {
        const char *buf = push_cert.buf;
-       int len = push_cert.len;
 
-       char *option;
-       const char *next_line;
+       const char *option;
+       size_t optionlen;
        int options_seen = 0;
 
        int retval = 1;
 
-       if (!len)
+       if (!*buf)
                return 1;
 
-       while ((option = find_header(buf, len, "push-option", &next_line))) {
-               len -= (next_line - buf);
-               buf = next_line;
+       while ((option = find_commit_header(buf, "push-option", &optionlen))) {
+               buf = option + optionlen + 1;
                options_seen++;
                if (options_seen > push_options->nr
-                   || strcmp(option,
-                             push_options->items[options_seen - 1].string)) {
-                       retval = 0;
-                       goto leave;
-               }
-               free(option);
+                   || xstrncmpz(push_options->items[options_seen - 1].string,
+                                option, optionlen))
+                       return 0;
        }
 
        if (options_seen != push_options->nr)
                retval = 0;
 
-leave:
-       free(option);
        return retval;
 }
 
@@ -771,7 +751,7 @@ static void prepare_push_cert_sha1(struct child_process *proc)
                check_signature(&sigcheck, push_cert.buf + bogs,
                                push_cert.len - bogs);
 
-               nonce_status = check_nonce(push_cert.buf, bogs);
+               nonce_status = check_nonce(sigcheck.payload);
        }
        if (!is_null_oid(&push_cert_oid)) {
                strvec_pushf(&proc->env, "GIT_PUSH_CERT=%s",
@@ -1546,6 +1526,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
            starts_with(name, "refs/heads/")) {
                struct object *old_object, *new_object;
                struct commit *old_commit, *new_commit;
+               int ret2;
 
                old_object = parse_object(the_repository, old_oid);
                new_object = parse_object(the_repository, new_oid);
@@ -1559,7 +1540,10 @@ static const char *update(struct command *cmd, struct shallow_info *si)
                }
                old_commit = (struct commit *)old_object;
                new_commit = (struct commit *)new_object;
-               if (!repo_in_merge_bases(the_repository, old_commit, new_commit)) {
+               ret2 = repo_in_merge_bases(the_repository, old_commit, new_commit);
+               if (ret2 < 0)
+                       exit(128);
+               if (!ret2) {
                        rp_error("denying non-fast-forward %s"
                                 " (you should pull first)", name);
                        ret = "non-fast-forward";
@@ -2527,10 +2511,10 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
        if (cert_nonce_seed)
                push_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL));
 
-       if (0 <= transfer_unpack_limit)
-               unpack_limit = transfer_unpack_limit;
-       else if (0 <= receive_unpack_limit)
+       if (0 <= receive_unpack_limit)
                unpack_limit = receive_unpack_limit;
+       else if (0 <= transfer_unpack_limit)
+               unpack_limit = transfer_unpack_limit;
 
        switch (determine_protocol_version_server()) {
        case protocol_v2:
index df63a5892e71057e342792147fe5d30e13603952..060eb3377e5d5b2e8af213aa1eec2b2decb33af4 100644 (file)
@@ -7,11 +7,15 @@
 #include "wildmatch.h"
 #include "worktree.h"
 #include "reflog.h"
+#include "refs.h"
 #include "parse-options.h"
 
 #define BUILTIN_REFLOG_SHOW_USAGE \
        N_("git reflog [show] [<log-options>] [<ref>]")
 
+#define BUILTIN_REFLOG_LIST_USAGE \
+       N_("git reflog list")
+
 #define BUILTIN_REFLOG_EXPIRE_USAGE \
        N_("git reflog expire [--expire=<time>] [--expire-unreachable=<time>]\n" \
           "                  [--rewrite] [--updateref] [--stale-fix]\n" \
@@ -29,6 +33,11 @@ static const char *const reflog_show_usage[] = {
        NULL,
 };
 
+static const char *const reflog_list_usage[] = {
+       BUILTIN_REFLOG_LIST_USAGE,
+       NULL,
+};
+
 static const char *const reflog_expire_usage[] = {
        BUILTIN_REFLOG_EXPIRE_USAGE,
        NULL
@@ -46,6 +55,7 @@ static const char *const reflog_exists_usage[] = {
 
 static const char *const reflog_usage[] = {
        BUILTIN_REFLOG_SHOW_USAGE,
+       BUILTIN_REFLOG_LIST_USAGE,
        BUILTIN_REFLOG_EXPIRE_USAGE,
        BUILTIN_REFLOG_DELETE_USAGE,
        BUILTIN_REFLOG_EXISTS_USAGE,
@@ -60,8 +70,7 @@ struct worktree_reflogs {
        struct string_list reflogs;
 };
 
-static int collect_reflog(const char *ref, const struct object_id *oid UNUSED,
-                         int flags UNUSED, void *cb_data)
+static int collect_reflog(const char *ref, void *cb_data)
 {
        struct worktree_reflogs *cb = cb_data;
        struct worktree *worktree = cb->worktree;
@@ -96,8 +105,7 @@ static struct reflog_expire_cfg *find_cfg_ent(const char *pattern, size_t len)
                reflog_expire_cfg_tail = &reflog_expire_cfg;
 
        for (ent = reflog_expire_cfg; ent; ent = ent->next)
-               if (!strncmp(ent->pattern, pattern, len) &&
-                   ent->pattern[len] == '\0')
+               if (!xstrncmpz(ent->pattern, pattern, len))
                        return ent;
 
        FLEX_ALLOC_MEM(ent, pattern, pattern, len);
@@ -239,16 +247,39 @@ static int cmd_reflog_show(int argc, const char **argv, const char *prefix)
        return cmd_log_reflog(argc, argv, prefix);
 }
 
+static int show_reflog(const char *refname, void *cb_data UNUSED)
+{
+       printf("%s\n", refname);
+       return 0;
+}
+
+static int cmd_reflog_list(int argc, const char **argv, const char *prefix)
+{
+       struct option options[] = {
+               OPT_END()
+       };
+       struct ref_store *ref_store;
+
+       argc = parse_options(argc, argv, prefix, options, reflog_list_usage, 0);
+       if (argc)
+               return error(_("%s does not accept arguments: '%s'"),
+                            "list", argv[0]);
+
+       ref_store = get_main_ref_store(the_repository);
+
+       return refs_for_each_reflog(ref_store, show_reflog, NULL);
+}
+
 static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 {
        struct cmd_reflog_expire_cb cmd = { 0 };
        timestamp_t now = time(NULL);
-       int i, status, do_all, all_worktrees = 1;
+       int i, status, do_all, single_worktree = 0;
        unsigned int flags = 0;
        int verbose = 0;
        reflog_expiry_should_prune_fn *should_prune_fn = should_expire_reflog_ent;
        const struct option options[] = {
-               OPT_BIT(0, "dry-run", &flags, N_("do not actually prune any entries"),
+               OPT_BIT('n', "dry-run", &flags, N_("do not actually prune any entries"),
                        EXPIRE_REFLOGS_DRY_RUN),
                OPT_BIT(0, "rewrite", &flags,
                        N_("rewrite the old SHA1 with the new SHA1 of the entry that now precedes it"),
@@ -268,7 +299,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "stale-fix", &cmd.stalefix,
                         N_("prune any reflog entries that point to broken commits")),
                OPT_BOOL(0, "all", &do_all, N_("process the reflogs of all references")),
-               OPT_BOOL(1, "single-worktree", &all_worktrees,
+               OPT_BOOL(0, "single-worktree", &single_worktree,
                         N_("limits processing to reflogs from the current worktree only")),
                OPT_END()
        };
@@ -298,7 +329,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                struct rev_info revs;
 
                repo_init_revisions(the_repository, &revs, prefix);
-               revs.do_not_die_on_missing_tree = 1;
+               revs.do_not_die_on_missing_objects = 1;
                revs.ignore_missing = 1;
                revs.ignore_missing_links = 1;
                if (verbose)
@@ -318,7 +349,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 
                worktrees = get_worktrees();
                for (p = worktrees; *p; p++) {
-                       if (!all_worktrees && !(*p)->is_current)
+                       if (single_worktree && !(*p)->is_current)
                                continue;
                        collected.worktree = *p;
                        refs_for_each_reflog(get_worktree_ref_store(*p),
@@ -368,7 +399,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
        int verbose = 0;
 
        const struct option options[] = {
-               OPT_BIT(0, "dry-run", &flags, N_("do not actually prune any entries"),
+               OPT_BIT('n', "dry-run", &flags, N_("do not actually prune any entries"),
                        EXPIRE_REFLOGS_DRY_RUN),
                OPT_BIT(0, "rewrite", &flags,
                        N_("rewrite the old SHA1 with the new SHA1 of the entry that now precedes it"),
@@ -418,6 +449,7 @@ int cmd_reflog(int argc, const char **argv, const char *prefix)
        parse_opt_subcommand_fn *fn = NULL;
        struct option options[] = {
                OPT_SUBCOMMAND("show", &fn, cmd_reflog_show),
+               OPT_SUBCOMMAND("list", &fn, cmd_reflog_list),
                OPT_SUBCOMMAND("expire", &fn, cmd_reflog_expire),
                OPT_SUBCOMMAND("delete", &fn, cmd_reflog_delete),
                OPT_SUBCOMMAND("exists", &fn, cmd_reflog_exists),
index d91bbe728d739e074e5f4fa54f70c186f371c1b7..8412d12fa55100132c69ae24914b2db536bf77c9 100644 (file)
@@ -150,7 +150,7 @@ static int parse_mirror_opt(const struct option *opt, const char *arg, int not)
        else if (!strcmp(arg, "push"))
                *mirror = MIRROR_PUSH;
        else
-               return error(_("unknown mirror argument: %s"), arg);
+               return error(_("unknown --mirror argument: %s"), arg);
        return 0;
 }
 
index 97051479e49bf12418dfd70ac42b9bc132b9d571..15e4cccc45687d4902979911e7162e7c82567e6e 100644 (file)
@@ -8,7 +8,6 @@
 #include "path.h"
 #include "run-command.h"
 #include "server-info.h"
-#include "sigchain.h"
 #include "strbuf.h"
 #include "string-list.h"
 #include "strvec.h"
 #include "pack.h"
 #include "pack-bitmap.h"
 #include "refs.h"
+#include "list-objects-filter-options.h"
 
 #define ALL_INTO_ONE 1
 #define LOOSEN_UNREACHABLE 2
 #define PACK_CRUFT 4
 
 #define DELETE_PACK 1
-#define CRUFT_PACK 2
+#define RETAIN_PACK 2
 
 static int pack_everything;
 static int delta_base_offset = 1;
@@ -52,11 +52,12 @@ struct pack_objects_args {
        const char *window_memory;
        const char *depth;
        const char *threads;
-       const char *max_pack_size;
+       unsigned long max_pack_size;
        int no_reuse_delta;
        int no_reuse_object;
        int quiet;
        int local;
+       struct list_objects_filter_options filter_options;
 };
 
 static int repack_config(const char *var, const char *value,
@@ -95,14 +96,143 @@ static int repack_config(const char *var, const char *value,
        return git_default_config(var, value, ctx, cb);
 }
 
+struct existing_packs {
+       struct string_list kept_packs;
+       struct string_list non_kept_packs;
+       struct string_list cruft_packs;
+};
+
+#define EXISTING_PACKS_INIT { \
+       .kept_packs = STRING_LIST_INIT_DUP, \
+       .non_kept_packs = STRING_LIST_INIT_DUP, \
+       .cruft_packs = STRING_LIST_INIT_DUP, \
+}
+
+static int has_existing_non_kept_packs(const struct existing_packs *existing)
+{
+       return existing->non_kept_packs.nr || existing->cruft_packs.nr;
+}
+
+static void pack_mark_for_deletion(struct string_list_item *item)
+{
+       item->util = (void*)((uintptr_t)item->util | DELETE_PACK);
+}
+
+static void pack_unmark_for_deletion(struct string_list_item *item)
+{
+       item->util = (void*)((uintptr_t)item->util & ~DELETE_PACK);
+}
+
+static int pack_is_marked_for_deletion(struct string_list_item *item)
+{
+       return (uintptr_t)item->util & DELETE_PACK;
+}
+
+static void pack_mark_retained(struct string_list_item *item)
+{
+       item->util = (void*)((uintptr_t)item->util | RETAIN_PACK);
+}
+
+static int pack_is_retained(struct string_list_item *item)
+{
+       return (uintptr_t)item->util & RETAIN_PACK;
+}
+
+static void mark_packs_for_deletion_1(struct string_list *names,
+                                     struct string_list *list)
+{
+       struct string_list_item *item;
+       const int hexsz = the_hash_algo->hexsz;
+
+       for_each_string_list_item(item, list) {
+               char *sha1;
+               size_t len = strlen(item->string);
+               if (len < hexsz)
+                       continue;
+               sha1 = item->string + len - hexsz;
+
+               if (pack_is_retained(item)) {
+                       pack_unmark_for_deletion(item);
+               } else if (!string_list_has_string(names, sha1)) {
+                       /*
+                        * Mark this pack for deletion, which ensures
+                        * that this pack won't be included in a MIDX
+                        * (if `--write-midx` was given) and that we
+                        * will actually delete this pack (if `-d` was
+                        * given).
+                        */
+                       pack_mark_for_deletion(item);
+               }
+       }
+}
+
+static void retain_cruft_pack(struct existing_packs *existing,
+                             struct packed_git *cruft)
+{
+       struct strbuf buf = STRBUF_INIT;
+       struct string_list_item *item;
+
+       strbuf_addstr(&buf, pack_basename(cruft));
+       strbuf_strip_suffix(&buf, ".pack");
+
+       item = string_list_lookup(&existing->cruft_packs, buf.buf);
+       if (!item)
+               BUG("could not find cruft pack '%s'", pack_basename(cruft));
+
+       pack_mark_retained(item);
+       strbuf_release(&buf);
+}
+
+static void mark_packs_for_deletion(struct existing_packs *existing,
+                                   struct string_list *names)
+
+{
+       mark_packs_for_deletion_1(names, &existing->non_kept_packs);
+       mark_packs_for_deletion_1(names, &existing->cruft_packs);
+}
+
+static void remove_redundant_pack(const char *dir_name, const char *base_name)
+{
+       struct strbuf buf = STRBUF_INIT;
+       struct multi_pack_index *m = get_local_multi_pack_index(the_repository);
+       strbuf_addf(&buf, "%s.pack", base_name);
+       if (m && midx_contains_pack(m, buf.buf))
+               clear_midx_file(the_repository);
+       strbuf_insertf(&buf, 0, "%s/", dir_name);
+       unlink_pack_path(buf.buf, 1);
+       strbuf_release(&buf);
+}
+
+static void remove_redundant_packs_1(struct string_list *packs)
+{
+       struct string_list_item *item;
+       for_each_string_list_item(item, packs) {
+               if (!pack_is_marked_for_deletion(item))
+                       continue;
+               remove_redundant_pack(packdir, item->string);
+       }
+}
+
+static void remove_redundant_existing_packs(struct existing_packs *existing)
+{
+       remove_redundant_packs_1(&existing->non_kept_packs);
+       remove_redundant_packs_1(&existing->cruft_packs);
+}
+
+static void existing_packs_release(struct existing_packs *existing)
+{
+       string_list_clear(&existing->kept_packs, 0);
+       string_list_clear(&existing->non_kept_packs, 0);
+       string_list_clear(&existing->cruft_packs, 0);
+}
+
 /*
- * Adds all packs hex strings (pack-$HASH) to either fname_nonkept_list
- * or fname_kept_list based on whether each pack has a corresponding
+ * Adds all packs hex strings (pack-$HASH) to either packs->non_kept
+ * or packs->kept based on whether each pack has a corresponding
  * .keep file or not.  Packs without a .keep file are not to be kept
  * if we are going to pack everything into one file.
  */
-static void collect_pack_filenames(struct string_list *fname_nonkept_list,
-                                  struct string_list *fname_kept_list,
+static void collect_pack_filenames(struct existing_packs *existing,
                                   const struct string_list *extra_keep)
 {
        struct packed_git *p;
@@ -126,28 +256,16 @@ static void collect_pack_filenames(struct string_list *fname_nonkept_list,
                strbuf_strip_suffix(&buf, ".pack");
 
                if ((extra_keep->nr > 0 && i < extra_keep->nr) || p->pack_keep)
-                       string_list_append(fname_kept_list, buf.buf);
-               else {
-                       struct string_list_item *item;
-                       item = string_list_append(fname_nonkept_list, buf.buf);
-                       if (p->is_cruft)
-                               item->util = (void*)(uintptr_t)CRUFT_PACK;
-               }
+                       string_list_append(&existing->kept_packs, buf.buf);
+               else if (p->is_cruft)
+                       string_list_append(&existing->cruft_packs, buf.buf);
+               else
+                       string_list_append(&existing->non_kept_packs, buf.buf);
        }
 
-       string_list_sort(fname_kept_list);
-       strbuf_release(&buf);
-}
-
-static void remove_redundant_pack(const char *dir_name, const char *base_name)
-{
-       struct strbuf buf = STRBUF_INIT;
-       struct multi_pack_index *m = get_local_multi_pack_index(the_repository);
-       strbuf_addf(&buf, "%s.pack", base_name);
-       if (m && midx_contains_pack(m, buf.buf))
-               clear_midx_file(the_repository);
-       strbuf_insertf(&buf, 0, "%s/", dir_name);
-       unlink_pack_path(buf.buf, 1);
+       string_list_sort(&existing->kept_packs);
+       string_list_sort(&existing->non_kept_packs);
+       string_list_sort(&existing->cruft_packs);
        strbuf_release(&buf);
 }
 
@@ -165,7 +283,7 @@ static void prepare_pack_objects(struct child_process *cmd,
        if (args->threads)
                strvec_pushf(&cmd->args, "--threads=%s", args->threads);
        if (args->max_pack_size)
-               strvec_pushf(&cmd->args, "--max-pack-size=%s", args->max_pack_size);
+               strvec_pushf(&cmd->args, "--max-pack-size=%lu", args->max_pack_size);
        if (args->no_reuse_delta)
                strvec_pushf(&cmd->args, "--no-reuse-delta");
        if (args->no_reuse_object)
@@ -196,8 +314,9 @@ static int write_oid(const struct object_id *oid,
                        die(_("could not start pack-objects to repack promisor objects"));
        }
 
-       xwrite(cmd->in, oid_to_hex(oid), the_hash_algo->hexsz);
-       xwrite(cmd->in, "\n", 1);
+       if (write_in_full(cmd->in, oid_to_hex(oid), the_hash_algo->hexsz) < 0 ||
+           write_in_full(cmd->in, "\n", 1) < 0)
+               die(_("failed to feed promisor objects to pack-objects"));
        return 0;
 }
 
@@ -238,6 +357,18 @@ static struct generated_pack_data *populate_pack_exts(const char *name)
        return data;
 }
 
+static int has_pack_ext(const struct generated_pack_data *data,
+                       const char *ext)
+{
+       int i;
+       for (i = 0; i < ARRAY_SIZE(exts); i++) {
+               if (strcmp(exts[i].name, ext))
+                       continue;
+               return !!data->tempfiles[i];
+       }
+       BUG("unknown pack extension: '%s'", ext);
+}
+
 static void repack_promisor_objects(const struct pack_objects_args *args,
                                    struct string_list *names)
 {
@@ -303,6 +434,8 @@ struct pack_geometry {
        struct packed_git **pack;
        uint32_t pack_nr, pack_alloc;
        uint32_t split;
+
+       int split_factor;
 };
 
 static uint32_t geometry_pack_weight(struct packed_git *p)
@@ -324,17 +457,13 @@ static int geometry_cmp(const void *va, const void *vb)
        return 0;
 }
 
-static void init_pack_geometry(struct pack_geometry **geometry_p,
-                              struct string_list *existing_kept_packs,
+static void init_pack_geometry(struct pack_geometry *geometry,
+                              struct existing_packs *existing,
                               const struct pack_objects_args *args)
 {
        struct packed_git *p;
-       struct pack_geometry *geometry;
        struct strbuf buf = STRBUF_INIT;
 
-       *geometry_p = xcalloc(1, sizeof(struct pack_geometry));
-       geometry = *geometry_p;
-
        for (p = get_all_packs(the_repository); p; p = p->next) {
                if (args->local && !p->pack_local)
                        /*
@@ -346,23 +475,24 @@ static void init_pack_geometry(struct pack_geometry **geometry_p,
 
                if (!pack_kept_objects) {
                        /*
-                        * Any pack that has its pack_keep bit set will appear
-                        * in existing_kept_packs below, but this saves us from
-                        * doing a more expensive check.
+                        * Any pack that has its pack_keep bit set will
+                        * appear in existing->kept_packs below, but
+                        * this saves us from doing a more expensive
+                        * check.
                         */
                        if (p->pack_keep)
                                continue;
 
                        /*
-                        * The pack may be kept via the --keep-pack option;
-                        * check 'existing_kept_packs' to determine whether to
-                        * ignore it.
+                        * The pack may be kept via the --keep-pack
+                        * option; check 'existing->kept_packs' to
+                        * determine whether to ignore it.
                         */
                        strbuf_reset(&buf);
                        strbuf_addstr(&buf, pack_basename(p));
                        strbuf_strip_suffix(&buf, ".pack");
 
-                       if (string_list_has_string(existing_kept_packs, buf.buf))
+                       if (string_list_has_string(&existing->kept_packs, buf.buf))
                                continue;
                }
                if (p->is_cruft)
@@ -380,7 +510,7 @@ static void init_pack_geometry(struct pack_geometry **geometry_p,
        strbuf_release(&buf);
 }
 
-static void split_pack_geometry(struct pack_geometry *geometry, int factor)
+static void split_pack_geometry(struct pack_geometry *geometry)
 {
        uint32_t i;
        uint32_t split;
@@ -399,12 +529,14 @@ static void split_pack_geometry(struct pack_geometry *geometry, int factor)
                struct packed_git *ours = geometry->pack[i];
                struct packed_git *prev = geometry->pack[i - 1];
 
-               if (unsigned_mult_overflows(factor, geometry_pack_weight(prev)))
+               if (unsigned_mult_overflows(geometry->split_factor,
+                                           geometry_pack_weight(prev)))
                        die(_("pack %s too large to consider in geometric "
                              "progression"),
                            prev->pack_name);
 
-               if (geometry_pack_weight(ours) < factor * geometry_pack_weight(prev))
+               if (geometry_pack_weight(ours) <
+                   geometry->split_factor * geometry_pack_weight(prev))
                        break;
        }
 
@@ -439,10 +571,12 @@ static void split_pack_geometry(struct pack_geometry *geometry, int factor)
        for (i = split; i < geometry->pack_nr; i++) {
                struct packed_git *ours = geometry->pack[i];
 
-               if (unsigned_mult_overflows(factor, total_size))
+               if (unsigned_mult_overflows(geometry->split_factor,
+                                           total_size))
                        die(_("pack %s too large to roll up"), ours->pack_name);
 
-               if (geometry_pack_weight(ours) < factor * total_size) {
+               if (geometry_pack_weight(ours) <
+                   geometry->split_factor * total_size) {
                        if (unsigned_add_overflows(total_size,
                                                   geometry_pack_weight(ours)))
                                die(_("pack %s too large to roll up"),
@@ -492,13 +626,38 @@ static struct packed_git *get_preferred_pack(struct pack_geometry *geometry)
        return NULL;
 }
 
+static void geometry_remove_redundant_packs(struct pack_geometry *geometry,
+                                           struct string_list *names,
+                                           struct existing_packs *existing)
+{
+       struct strbuf buf = STRBUF_INIT;
+       uint32_t i;
+
+       for (i = 0; i < geometry->split; i++) {
+               struct packed_git *p = geometry->pack[i];
+               if (string_list_has_string(names, hash_to_hex(p->hash)))
+                       continue;
+
+               strbuf_reset(&buf);
+               strbuf_addstr(&buf, pack_basename(p));
+               strbuf_strip_suffix(&buf, ".pack");
+
+               if ((p->pack_keep) ||
+                   (string_list_has_string(&existing->kept_packs, buf.buf)))
+                       continue;
+
+               remove_redundant_pack(packdir, buf.buf);
+       }
+
+       strbuf_release(&buf);
+}
+
 static void free_pack_geometry(struct pack_geometry *geometry)
 {
        if (!geometry)
                return;
 
        free(geometry->pack);
-       free(geometry);
 }
 
 struct midx_snapshot_ref_data {
@@ -564,18 +723,17 @@ static void midx_snapshot_refs(struct tempfile *f)
 }
 
 static void midx_included_packs(struct string_list *include,
-                               struct string_list *existing_nonkept_packs,
-                               struct string_list *existing_kept_packs,
+                               struct existing_packs *existing,
                                struct string_list *names,
                                struct pack_geometry *geometry)
 {
        struct string_list_item *item;
 
-       for_each_string_list_item(item, existing_kept_packs)
+       for_each_string_list_item(item, &existing->kept_packs)
                string_list_insert(include, xstrfmt("%s.idx", item->string));
        for_each_string_list_item(item, names)
                string_list_insert(include, xstrfmt("pack-%s.idx", item->string));
-       if (geometry) {
+       if (geometry->split_factor) {
                struct strbuf buf = STRBUF_INIT;
                uint32_t i;
                for (i = geometry->split; i < geometry->pack_nr; i++) {
@@ -598,28 +756,37 @@ static void midx_included_packs(struct string_list *include,
 
                        string_list_insert(include, strbuf_detach(&buf, NULL));
                }
-
-               for_each_string_list_item(item, existing_nonkept_packs) {
-                       if (!((uintptr_t)item->util & CRUFT_PACK)) {
-                               /*
-                                * no need to check DELETE_PACK, since we're not
-                                * doing an ALL_INTO_ONE repack
-                                */
-                               continue;
-                       }
-                       string_list_insert(include, xstrfmt("%s.idx", item->string));
-               }
        } else {
-               for_each_string_list_item(item, existing_nonkept_packs) {
-                       if ((uintptr_t)item->util & DELETE_PACK)
+               for_each_string_list_item(item, &existing->non_kept_packs) {
+                       if (pack_is_marked_for_deletion(item))
                                continue;
                        string_list_insert(include, xstrfmt("%s.idx", item->string));
                }
        }
+
+       for_each_string_list_item(item, &existing->cruft_packs) {
+               /*
+                * When doing a --geometric repack, there is no need to check
+                * for deleted packs, since we're by definition not doing an
+                * ALL_INTO_ONE repack (hence no packs will be deleted).
+                * Otherwise we must check for and exclude any packs which are
+                * enqueued for deletion.
+                *
+                * So we could omit the conditional below in the --geometric
+                * case, but doing so is unnecessary since no packs are marked
+                * as pending deletion (since we only call
+                * `mark_packs_for_deletion()` when doing an all-into-one
+                * repack).
+                */
+               if (pack_is_marked_for_deletion(item))
+                       continue;
+               string_list_insert(include, xstrfmt("%s.idx", item->string));
+       }
 }
 
 static int write_midx_included_packs(struct string_list *include,
                                     struct pack_geometry *geometry,
+                                    struct string_list *names,
                                     const char *refs_snapshot,
                                     int show_progress, int write_bitmaps)
 {
@@ -649,6 +816,38 @@ static int write_midx_included_packs(struct string_list *include,
        if (preferred)
                strvec_pushf(&cmd.args, "--preferred-pack=%s",
                             pack_basename(preferred));
+       else if (names->nr) {
+               /* The largest pack was repacked, meaning that either
+                * one or two packs exist depending on whether the
+                * repository has a cruft pack or not.
+                *
+                * Select the non-cruft one as preferred to encourage
+                * pack-reuse among packs containing reachable objects
+                * over unreachable ones.
+                *
+                * (Note we could write multiple packs here if
+                * `--max-pack-size` was given, but any one of them
+                * will suffice, so pick the first one.)
+                */
+               for_each_string_list_item(item, names) {
+                       struct generated_pack_data *data = item->util;
+                       if (has_pack_ext(data, ".mtimes"))
+                               continue;
+
+                       strvec_pushf(&cmd.args, "--preferred-pack=pack-%s.pack",
+                                    item->string);
+                       break;
+               }
+       } else {
+               /*
+                * No packs were kept, and no packs were written. The
+                * only thing remaining are .keep packs (unless
+                * --pack-kept-objects was given).
+                *
+                * Set the `--preferred-pack` arbitrarily here.
+                */
+               ;
+       }
 
        if (refs_snapshot)
                strvec_pushf(&cmd.args, "--refs-snapshot=%s", refs_snapshot);
@@ -694,18 +893,163 @@ static void remove_redundant_bitmaps(struct string_list *include,
        strbuf_release(&path);
 }
 
+static int finish_pack_objects_cmd(struct child_process *cmd,
+                                  struct string_list *names,
+                                  int local)
+{
+       FILE *out;
+       struct strbuf line = STRBUF_INIT;
+
+       out = xfdopen(cmd->out, "r");
+       while (strbuf_getline_lf(&line, out) != EOF) {
+               struct string_list_item *item;
+
+               if (line.len != the_hash_algo->hexsz)
+                       die(_("repack: Expecting full hex object ID lines only "
+                             "from pack-objects."));
+               /*
+                * Avoid putting packs written outside of the repository in the
+                * list of names.
+                */
+               if (local) {
+                       item = string_list_append(names, line.buf);
+                       item->util = populate_pack_exts(line.buf);
+               }
+       }
+       fclose(out);
+
+       strbuf_release(&line);
+
+       return finish_command(cmd);
+}
+
+static int write_filtered_pack(const struct pack_objects_args *args,
+                              const char *destination,
+                              const char *pack_prefix,
+                              struct existing_packs *existing,
+                              struct string_list *names)
+{
+       struct child_process cmd = CHILD_PROCESS_INIT;
+       struct string_list_item *item;
+       FILE *in;
+       int ret;
+       const char *caret;
+       const char *scratch;
+       int local = skip_prefix(destination, packdir, &scratch);
+
+       prepare_pack_objects(&cmd, args, destination);
+
+       strvec_push(&cmd.args, "--stdin-packs");
+
+       if (!pack_kept_objects)
+               strvec_push(&cmd.args, "--honor-pack-keep");
+       for_each_string_list_item(item, &existing->kept_packs)
+               strvec_pushf(&cmd.args, "--keep-pack=%s", item->string);
+
+       cmd.in = -1;
+
+       ret = start_command(&cmd);
+       if (ret)
+               return ret;
+
+       /*
+        * Here 'names' contains only the pack(s) that were just
+        * written, which is exactly the packs we want to keep. Also
+        * 'existing_kept_packs' already contains the packs in
+        * 'keep_pack_list'.
+        */
+       in = xfdopen(cmd.in, "w");
+       for_each_string_list_item(item, names)
+               fprintf(in, "^%s-%s.pack\n", pack_prefix, item->string);
+       for_each_string_list_item(item, &existing->non_kept_packs)
+               fprintf(in, "%s.pack\n", item->string);
+       for_each_string_list_item(item, &existing->cruft_packs)
+               fprintf(in, "%s.pack\n", item->string);
+       caret = pack_kept_objects ? "" : "^";
+       for_each_string_list_item(item, &existing->kept_packs)
+               fprintf(in, "%s%s.pack\n", caret, item->string);
+       fclose(in);
+
+       return finish_pack_objects_cmd(&cmd, names, local);
+}
+
+static int existing_cruft_pack_cmp(const void *va, const void *vb)
+{
+       struct packed_git *a = *(struct packed_git **)va;
+       struct packed_git *b = *(struct packed_git **)vb;
+
+       if (a->pack_size < b->pack_size)
+               return -1;
+       if (a->pack_size > b->pack_size)
+               return 1;
+       return 0;
+}
+
+static void collapse_small_cruft_packs(FILE *in, size_t max_size,
+                                      struct existing_packs *existing)
+{
+       struct packed_git **existing_cruft, *p;
+       struct strbuf buf = STRBUF_INIT;
+       size_t total_size = 0;
+       size_t existing_cruft_nr = 0;
+       size_t i;
+
+       ALLOC_ARRAY(existing_cruft, existing->cruft_packs.nr);
+
+       for (p = get_all_packs(the_repository); p; p = p->next) {
+               if (!(p->is_cruft && p->pack_local))
+                       continue;
+
+               strbuf_reset(&buf);
+               strbuf_addstr(&buf, pack_basename(p));
+               strbuf_strip_suffix(&buf, ".pack");
+
+               if (!string_list_has_string(&existing->cruft_packs, buf.buf))
+                       continue;
+
+               if (existing_cruft_nr >= existing->cruft_packs.nr)
+                       BUG("too many cruft packs (found %"PRIuMAX", but knew "
+                           "of %"PRIuMAX")",
+                           (uintmax_t)existing_cruft_nr + 1,
+                           (uintmax_t)existing->cruft_packs.nr);
+               existing_cruft[existing_cruft_nr++] = p;
+       }
+
+       QSORT(existing_cruft, existing_cruft_nr, existing_cruft_pack_cmp);
+
+       for (i = 0; i < existing_cruft_nr; i++) {
+               size_t proposed;
+
+               p = existing_cruft[i];
+               proposed = st_add(total_size, p->pack_size);
+
+               if (proposed <= max_size) {
+                       total_size = proposed;
+                       fprintf(in, "-%s\n", pack_basename(p));
+               } else {
+                       retain_cruft_pack(existing, p);
+                       fprintf(in, "%s\n", pack_basename(p));
+               }
+       }
+
+       for (i = 0; i < existing->non_kept_packs.nr; i++)
+               fprintf(in, "-%s.pack\n",
+                       existing->non_kept_packs.items[i].string);
+
+       strbuf_release(&buf);
+       free(existing_cruft);
+}
+
 static int write_cruft_pack(const struct pack_objects_args *args,
                            const char *destination,
                            const char *pack_prefix,
                            const char *cruft_expiration,
                            struct string_list *names,
-                           struct string_list *existing_packs,
-                           struct string_list *existing_kept_packs)
+                           struct existing_packs *existing)
 {
        struct child_process cmd = CHILD_PROCESS_INIT;
-       struct strbuf line = STRBUF_INIT;
        struct string_list_item *item;
-       FILE *in, *out;
+       FILE *in;
        int ret;
        const char *scratch;
        int local = skip_prefix(destination, packdir, &scratch);
@@ -719,7 +1063,6 @@ static int write_cruft_pack(const struct pack_objects_args *args,
 
        strvec_push(&cmd.args, "--honor-pack-keep");
        strvec_push(&cmd.args, "--non-empty");
-       strvec_push(&cmd.args, "--max-pack-size=0");
 
        cmd.in = -1;
 
@@ -743,33 +1086,30 @@ static int write_cruft_pack(const struct pack_objects_args *args,
        in = xfdopen(cmd.in, "w");
        for_each_string_list_item(item, names)
                fprintf(in, "%s-%s.pack\n", pack_prefix, item->string);
-       for_each_string_list_item(item, existing_packs)
-               fprintf(in, "-%s.pack\n", item->string);
-       for_each_string_list_item(item, existing_kept_packs)
+       if (args->max_pack_size && !cruft_expiration) {
+               collapse_small_cruft_packs(in, args->max_pack_size, existing);
+       } else {
+               for_each_string_list_item(item, &existing->non_kept_packs)
+                       fprintf(in, "-%s.pack\n", item->string);
+               for_each_string_list_item(item, &existing->cruft_packs)
+                       fprintf(in, "-%s.pack\n", item->string);
+       }
+       for_each_string_list_item(item, &existing->kept_packs)
                fprintf(in, "%s.pack\n", item->string);
        fclose(in);
 
-       out = xfdopen(cmd.out, "r");
-       while (strbuf_getline_lf(&line, out) != EOF) {
-               struct string_list_item *item;
-
-               if (line.len != the_hash_algo->hexsz)
-                       die(_("repack: Expecting full hex object ID lines only "
-                             "from pack-objects."));
-               /*
-                * avoid putting packs written outside of the repository in the
-                * list of names
-                */
-               if (local) {
-                       item = string_list_append(names, line.buf);
-                       item->util = populate_pack_exts(line.buf);
-               }
-       }
-       fclose(out);
-
-       strbuf_release(&line);
+       return finish_pack_objects_cmd(&cmd, names, local);
+}
 
-       return finish_command(&cmd);
+static const char *find_pack_prefix(const char *packdir, const char *packtmp)
+{
+       const char *pack_prefix;
+       if (!skip_prefix(packtmp, packdir, &pack_prefix))
+               die(_("pack prefix %s does not begin with objdir %s"),
+                   packtmp, packdir);
+       if (*pack_prefix == '/')
+               pack_prefix++;
+       return pack_prefix;
 }
 
 int cmd_repack(int argc, const char **argv, const char *prefix)
@@ -777,13 +1117,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        struct child_process cmd = CHILD_PROCESS_INIT;
        struct string_list_item *item;
        struct string_list names = STRING_LIST_INIT_DUP;
-       struct string_list existing_nonkept_packs = STRING_LIST_INIT_DUP;
-       struct string_list existing_kept_packs = STRING_LIST_INIT_DUP;
-       struct pack_geometry *geometry = NULL;
-       struct strbuf line = STRBUF_INIT;
+       struct existing_packs existing = EXISTING_PACKS_INIT;
+       struct pack_geometry geometry = { 0 };
        struct tempfile *refs_snapshot = NULL;
        int i, ext, ret;
-       FILE *out;
        int show_progress;
 
        /* variables to be filled by option parsing */
@@ -793,10 +1130,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        struct string_list keep_pack_list = STRING_LIST_INIT_NODUP;
        struct pack_objects_args po_args = {NULL};
        struct pack_objects_args cruft_po_args = {NULL};
-       int geometric_factor = 0;
        int write_midx = 0;
        const char *cruft_expiration = NULL;
        const char *expire_to = NULL;
+       const char *filter_to = NULL;
 
        struct option builtin_repack_options[] = {
                OPT_BIT('a', NULL, &pack_everything,
@@ -809,6 +1146,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                                   PACK_CRUFT),
                OPT_STRING(0, "cruft-expiration", &cruft_expiration, N_("approxidate"),
                                N_("with --cruft, expire objects older than this")),
+               OPT_MAGNITUDE(0, "max-cruft-size", &cruft_po_args.max_pack_size,
+                               N_("with --cruft, limit the size of new cruft packs")),
                OPT_BOOL('d', NULL, &delete_redundant,
                                N_("remove redundant packs, and run git-prune-packed")),
                OPT_BOOL('f', NULL, &po_args.no_reuse_delta,
@@ -836,21 +1175,26 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                                N_("limits the maximum delta depth")),
                OPT_STRING(0, "threads", &po_args.threads, N_("n"),
                                N_("limits the maximum number of threads")),
-               OPT_STRING(0, "max-pack-size", &po_args.max_pack_size, N_("bytes"),
+               OPT_MAGNITUDE(0, "max-pack-size", &po_args.max_pack_size,
                                N_("maximum size of each packfile")),
+               OPT_PARSE_LIST_OBJECTS_FILTER(&po_args.filter_options),
                OPT_BOOL(0, "pack-kept-objects", &pack_kept_objects,
                                N_("repack objects in packs marked with .keep")),
                OPT_STRING_LIST(0, "keep-pack", &keep_pack_list, N_("name"),
                                N_("do not repack this pack")),
-               OPT_INTEGER('g', "geometric", &geometric_factor,
+               OPT_INTEGER('g', "geometric", &geometry.split_factor,
                            N_("find a geometric progression with factor <N>")),
                OPT_BOOL('m', "write-midx", &write_midx,
                           N_("write a multi-pack index of the resulting packs")),
                OPT_STRING(0, "expire-to", &expire_to, N_("dir"),
                           N_("pack prefix to store a pack containing pruned objects")),
+               OPT_STRING(0, "filter-to", &filter_to, N_("dir"),
+                          N_("pack prefix to store a pack containing filtered out objects")),
                OPT_END()
        };
 
+       list_objects_filter_init(&po_args.filter_options);
+
        git_config(repack_config, &cruft_po_args);
 
        argc = parse_options(argc, argv, prefix, builtin_repack_options,
@@ -859,19 +1203,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        if (delete_redundant && repository_format_precious_objects)
                die(_("cannot delete packs in a precious-objects repo"));
 
-       if (keep_unreachable &&
-           (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE)))
-               die(_("options '%s' and '%s' cannot be used together"), "--keep-unreachable", "-A");
+       die_for_incompatible_opt3(unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE), "-A",
+                                 keep_unreachable, "-k/--keep-unreachable",
+                                 pack_everything & PACK_CRUFT, "--cruft");
 
-       if (pack_everything & PACK_CRUFT) {
+       if (pack_everything & PACK_CRUFT)
                pack_everything |= ALL_INTO_ONE;
 
-               if (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE))
-                       die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-A");
-               if (keep_unreachable)
-                       die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-k");
-       }
-
        if (write_bitmaps < 0) {
                if (!write_midx &&
                    (!(pack_everything & ALL_INTO_ONE) || !is_bare_repository()))
@@ -915,14 +1253,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        packtmp_name = xstrfmt(".tmp-%d-pack", (int)getpid());
        packtmp = mkpathdup("%s/%s", packdir, packtmp_name);
 
-       collect_pack_filenames(&existing_nonkept_packs, &existing_kept_packs,
-                              &keep_pack_list);
+       collect_pack_filenames(&existing, &keep_pack_list);
 
-       if (geometric_factor) {
+       if (geometry.split_factor) {
                if (pack_everything)
                        die(_("options '%s' and '%s' cannot be used together"), "--geometric", "-A/-a");
-               init_pack_geometry(&geometry, &existing_kept_packs, &po_args);
-               split_pack_geometry(geometry, geometric_factor);
+               init_pack_geometry(&geometry, &existing, &po_args);
+               split_pack_geometry(&geometry);
        }
 
        prepare_pack_objects(&cmd, &po_args, packtmp);
@@ -936,7 +1273,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                strvec_pushf(&cmd.args, "--keep-pack=%s",
                             keep_pack_list.items[i].string);
        strvec_push(&cmd.args, "--non-empty");
-       if (!geometry) {
+       if (!geometry.split_factor) {
                /*
                 * We need to grab all reachable objects, including those that
                 * are reachable from reflogs and the index.
@@ -965,7 +1302,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        if (pack_everything & ALL_INTO_ONE) {
                repack_promisor_objects(&po_args, &names);
 
-               if (existing_nonkept_packs.nr && delete_redundant &&
+               if (has_existing_non_kept_packs(&existing) &&
+                   delete_redundant &&
                    !(pack_everything & PACK_CRUFT)) {
                        for_each_string_list_item(item, &names) {
                                strvec_pushf(&cmd.args, "--keep-pack=%s-%s.pack",
@@ -983,7 +1321,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                                strvec_push(&cmd.args, "--pack-loose-unreachable");
                        }
                }
-       } else if (geometry) {
+       } else if (geometry.split_factor) {
                strvec_push(&cmd.args, "--stdin-packs");
                strvec_push(&cmd.args, "--unpacked");
        } else {
@@ -991,7 +1329,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                strvec_push(&cmd.args, "--incremental");
        }
 
-       if (geometry)
+       if (po_args.filter_options.choice)
+               strvec_pushf(&cmd.args, "--filter=%s",
+                            expand_list_objects_filter_spec(&po_args.filter_options));
+       else if (filter_to)
+               die(_("option '%s' can only be used along with '%s'"), "--filter-to", "--filter");
+
+       if (geometry.split_factor)
                cmd.in = -1;
        else
                cmd.no_stdin = 1;
@@ -1000,32 +1344,21 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        if (ret)
                goto cleanup;
 
-       if (geometry) {
+       if (geometry.split_factor) {
                FILE *in = xfdopen(cmd.in, "w");
                /*
                 * The resulting pack should contain all objects in packs that
                 * are going to be rolled up, but exclude objects in packs which
                 * are being left alone.
                 */
-               for (i = 0; i < geometry->split; i++)
-                       fprintf(in, "%s\n", pack_basename(geometry->pack[i]));
-               for (i = geometry->split; i < geometry->pack_nr; i++)
-                       fprintf(in, "^%s\n", pack_basename(geometry->pack[i]));
+               for (i = 0; i < geometry.split; i++)
+                       fprintf(in, "%s\n", pack_basename(geometry.pack[i]));
+               for (i = geometry.split; i < geometry.pack_nr; i++)
+                       fprintf(in, "^%s\n", pack_basename(geometry.pack[i]));
                fclose(in);
        }
 
-       out = xfdopen(cmd.out, "r");
-       while (strbuf_getline_lf(&line, out) != EOF) {
-               struct string_list_item *item;
-
-               if (line.len != the_hash_algo->hexsz)
-                       die(_("repack: Expecting full hex object ID lines only from pack-objects."));
-               item = string_list_append(&names, line.buf);
-               item->util = populate_pack_exts(item->string);
-       }
-       strbuf_release(&line);
-       fclose(out);
-       ret = finish_command(&cmd);
+       ret = finish_pack_objects_cmd(&cmd, &names, 1);
        if (ret)
                goto cleanup;
 
@@ -1033,12 +1366,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                printf_ln(_("Nothing new to pack."));
 
        if (pack_everything & PACK_CRUFT) {
-               const char *pack_prefix;
-               if (!skip_prefix(packtmp, packdir, &pack_prefix))
-                       die(_("pack prefix %s does not begin with objdir %s"),
-                           packtmp, packdir);
-               if (*pack_prefix == '/')
-                       pack_prefix++;
+               const char *pack_prefix = find_pack_prefix(packdir, packtmp);
 
                if (!cruft_po_args.window)
                        cruft_po_args.window = po_args.window;
@@ -1048,14 +1376,15 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                        cruft_po_args.depth = po_args.depth;
                if (!cruft_po_args.threads)
                        cruft_po_args.threads = po_args.threads;
+               if (!cruft_po_args.max_pack_size)
+                       cruft_po_args.max_pack_size = po_args.max_pack_size;
 
                cruft_po_args.local = po_args.local;
                cruft_po_args.quiet = po_args.quiet;
 
                ret = write_cruft_pack(&cruft_po_args, packtmp, pack_prefix,
                                       cruft_expiration, &names,
-                                      &existing_nonkept_packs,
-                                      &existing_kept_packs);
+                                      &existing);
                if (ret)
                        goto cleanup;
 
@@ -1086,13 +1415,25 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
                                               pack_prefix,
                                               NULL,
                                               &names,
-                                              &existing_nonkept_packs,
-                                              &existing_kept_packs);
+                                              &existing);
                        if (ret)
                                goto cleanup;
                }
        }
 
+       if (po_args.filter_options.choice) {
+               if (!filter_to)
+                       filter_to = packtmp;
+
+               ret = write_filtered_pack(&po_args,
+                                         filter_to,
+                                         find_pack_prefix(packdir, packtmp),
+                                         &existing,
+                                         &names);
+               if (ret)
+                       goto cleanup;
+       }
+
        string_list_sort(&names);
 
        close_object_store(the_repository->objects);
@@ -1131,31 +1472,14 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        }
        /* End of pack replacement. */
 
-       if (delete_redundant && pack_everything & ALL_INTO_ONE) {
-               const int hexsz = the_hash_algo->hexsz;
-               for_each_string_list_item(item, &existing_nonkept_packs) {
-                       char *sha1;
-                       size_t len = strlen(item->string);
-                       if (len < hexsz)
-                               continue;
-                       sha1 = item->string + len - hexsz;
-                       /*
-                        * Mark this pack for deletion, which ensures that this
-                        * pack won't be included in a MIDX (if `--write-midx`
-                        * was given) and that we will actually delete this pack
-                        * (if `-d` was given).
-                        */
-                       if (!string_list_has_string(&names, sha1))
-                               item->util = (void*)(uintptr_t)((size_t)item->util | DELETE_PACK);
-               }
-       }
+       if (delete_redundant && pack_everything & ALL_INTO_ONE)
+               mark_packs_for_deletion(&existing, &names);
 
        if (write_midx) {
                struct string_list include = STRING_LIST_INIT_NODUP;
-               midx_included_packs(&include, &existing_nonkept_packs,
-                                   &existing_kept_packs, &names, geometry);
+               midx_included_packs(&include, &existing, &names, &geometry);
 
-               ret = write_midx_included_packs(&include, geometry,
+               ret = write_midx_included_packs(&include, &geometry, &names,
                                                refs_snapshot ? get_tempfile_path(refs_snapshot) : NULL,
                                                show_progress, write_bitmaps > 0);
 
@@ -1172,35 +1496,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 
        if (delete_redundant) {
                int opts = 0;
-               for_each_string_list_item(item, &existing_nonkept_packs) {
-                       if (!((uintptr_t)item->util & DELETE_PACK))
-                               continue;
-                       remove_redundant_pack(packdir, item->string);
-               }
-
-               if (geometry) {
-                       struct strbuf buf = STRBUF_INIT;
-
-                       uint32_t i;
-                       for (i = 0; i < geometry->split; i++) {
-                               struct packed_git *p = geometry->pack[i];
-                               if (string_list_has_string(&names,
-                                                          hash_to_hex(p->hash)))
-                                       continue;
+               remove_redundant_existing_packs(&existing);
 
-                               strbuf_reset(&buf);
-                               strbuf_addstr(&buf, pack_basename(p));
-                               strbuf_strip_suffix(&buf, ".pack");
-
-                               if ((p->pack_keep) ||
-                                   (string_list_has_string(&existing_kept_packs,
-                                                           buf.buf)))
-                                       continue;
-
-                               remove_redundant_pack(packdir, buf.buf);
-                       }
-                       strbuf_release(&buf);
-               }
+               if (geometry.split_factor)
+                       geometry_remove_redundant_packs(&geometry, &names,
+                                                       &existing);
                if (show_progress)
                        opts |= PRUNE_PACKED_VERBOSE;
                prune_packed_objects(opts);
@@ -1224,9 +1524,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 
 cleanup:
        string_list_clear(&names, 1);
-       string_list_clear(&existing_nonkept_packs, 0);
-       string_list_clear(&existing_kept_packs, 0);
-       free_pack_geometry(geometry);
+       existing_packs_release(&existing);
+       free_pack_geometry(&geometry);
+       list_objects_filter_release(&po_args.filter_options);
 
        return ret;
 }
diff --git a/builtin/replay.c b/builtin/replay.c
new file mode 100644 (file)
index 0000000..6bc4b47
--- /dev/null
@@ -0,0 +1,446 @@
+/*
+ * "git replay" builtin command
+ */
+
+#define USE_THE_INDEX_VARIABLE
+#include "git-compat-util.h"
+
+#include "builtin.h"
+#include "environment.h"
+#include "hex.h"
+#include "lockfile.h"
+#include "merge-ort.h"
+#include "object-name.h"
+#include "parse-options.h"
+#include "refs.h"
+#include "revision.h"
+#include "strmap.h"
+#include <oidset.h>
+#include <tree.h>
+
+static const char *short_commit_name(struct commit *commit)
+{
+       return repo_find_unique_abbrev(the_repository, &commit->object.oid,
+                                      DEFAULT_ABBREV);
+}
+
+static struct commit *peel_committish(const char *name)
+{
+       struct object *obj;
+       struct object_id oid;
+
+       if (repo_get_oid(the_repository, name, &oid))
+               return NULL;
+       obj = parse_object(the_repository, &oid);
+       return (struct commit *)repo_peel_to_type(the_repository, name, 0, obj,
+                                                 OBJ_COMMIT);
+}
+
+static char *get_author(const char *message)
+{
+       size_t len;
+       const char *a;
+
+       a = find_commit_header(message, "author", &len);
+       if (a)
+               return xmemdupz(a, len);
+
+       return NULL;
+}
+
+static struct commit *create_commit(struct tree *tree,
+                                   struct commit *based_on,
+                                   struct commit *parent)
+{
+       struct object_id ret;
+       struct object *obj;
+       struct commit_list *parents = NULL;
+       char *author;
+       char *sign_commit = NULL; /* FIXME: cli users might want to sign again */
+       struct commit_extra_header *extra;
+       struct strbuf msg = STRBUF_INIT;
+       const char *out_enc = get_commit_output_encoding();
+       const char *message = repo_logmsg_reencode(the_repository, based_on,
+                                                  NULL, out_enc);
+       const char *orig_message = NULL;
+       const char *exclude_gpgsig[] = { "gpgsig", NULL };
+
+       commit_list_insert(parent, &parents);
+       extra = read_commit_extra_headers(based_on, exclude_gpgsig);
+       find_commit_subject(message, &orig_message);
+       strbuf_addstr(&msg, orig_message);
+       author = get_author(message);
+       reset_ident_date();
+       if (commit_tree_extended(msg.buf, msg.len, &tree->object.oid, parents,
+                                &ret, author, NULL, sign_commit, extra)) {
+               error(_("failed to write commit object"));
+               return NULL;
+       }
+       free(author);
+       strbuf_release(&msg);
+
+       obj = parse_object(the_repository, &ret);
+       return (struct commit *)obj;
+}
+
+struct ref_info {
+       struct commit *onto;
+       struct strset positive_refs;
+       struct strset negative_refs;
+       int positive_refexprs;
+       int negative_refexprs;
+};
+
+static void get_ref_information(struct rev_cmdline_info *cmd_info,
+                               struct ref_info *ref_info)
+{
+       int i;
+
+       ref_info->onto = NULL;
+       strset_init(&ref_info->positive_refs);
+       strset_init(&ref_info->negative_refs);
+       ref_info->positive_refexprs = 0;
+       ref_info->negative_refexprs = 0;
+
+       /*
+        * When the user specifies e.g.
+        *   git replay origin/main..mybranch
+        *   git replay ^origin/next mybranch1 mybranch2
+        * we want to be able to determine where to replay the commits.  In
+        * these examples, the branches are probably based on an old version
+        * of either origin/main or origin/next, so we want to replay on the
+        * newest version of that branch.  In contrast we would want to error
+        * out if they ran
+        *   git replay ^origin/master ^origin/next mybranch
+        *   git replay mybranch~2..mybranch
+        * the first of those because there's no unique base to choose, and
+        * the second because they'd likely just be replaying commits on top
+        * of the same commit and not making any difference.
+        */
+       for (i = 0; i < cmd_info->nr; i++) {
+               struct rev_cmdline_entry *e = cmd_info->rev + i;
+               struct object_id oid;
+               const char *refexpr = e->name;
+               char *fullname = NULL;
+               int can_uniquely_dwim = 1;
+
+               if (*refexpr == '^')
+                       refexpr++;
+               if (repo_dwim_ref(the_repository, refexpr, strlen(refexpr), &oid, &fullname, 0) != 1)
+                       can_uniquely_dwim = 0;
+
+               if (e->flags & BOTTOM) {
+                       if (can_uniquely_dwim)
+                               strset_add(&ref_info->negative_refs, fullname);
+                       if (!ref_info->negative_refexprs)
+                               ref_info->onto = lookup_commit_reference_gently(the_repository,
+                                                                               &e->item->oid, 1);
+                       ref_info->negative_refexprs++;
+               } else {
+                       if (can_uniquely_dwim)
+                               strset_add(&ref_info->positive_refs, fullname);
+                       ref_info->positive_refexprs++;
+               }
+
+               free(fullname);
+       }
+}
+
+static void determine_replay_mode(struct rev_cmdline_info *cmd_info,
+                                 const char *onto_name,
+                                 const char **advance_name,
+                                 struct commit **onto,
+                                 struct strset **update_refs)
+{
+       struct ref_info rinfo;
+
+       get_ref_information(cmd_info, &rinfo);
+       if (!rinfo.positive_refexprs)
+               die(_("need some commits to replay"));
+       if (onto_name && *advance_name)
+               die(_("--onto and --advance are incompatible"));
+       else if (onto_name) {
+               *onto = peel_committish(onto_name);
+               if (rinfo.positive_refexprs <
+                   strset_get_size(&rinfo.positive_refs))
+                       die(_("all positive revisions given must be references"));
+       } else if (*advance_name) {
+               struct object_id oid;
+               char *fullname = NULL;
+
+               *onto = peel_committish(*advance_name);
+               if (repo_dwim_ref(the_repository, *advance_name, strlen(*advance_name),
+                            &oid, &fullname, 0) == 1) {
+                       *advance_name = fullname;
+               } else {
+                       die(_("argument to --advance must be a reference"));
+               }
+               if (rinfo.positive_refexprs > 1)
+                       die(_("cannot advance target with multiple sources because ordering would be ill-defined"));
+       } else {
+               int positive_refs_complete = (
+                       rinfo.positive_refexprs ==
+                       strset_get_size(&rinfo.positive_refs));
+               int negative_refs_complete = (
+                       rinfo.negative_refexprs ==
+                       strset_get_size(&rinfo.negative_refs));
+               /*
+                * We need either positive_refs_complete or
+                * negative_refs_complete, but not both.
+                */
+               if (rinfo.negative_refexprs > 0 &&
+                   positive_refs_complete == negative_refs_complete)
+                       die(_("cannot implicitly determine whether this is an --advance or --onto operation"));
+               if (negative_refs_complete) {
+                       struct hashmap_iter iter;
+                       struct strmap_entry *entry;
+
+                       if (rinfo.negative_refexprs == 0)
+                               die(_("all positive revisions given must be references"));
+                       else if (rinfo.negative_refexprs > 1)
+                               die(_("cannot implicitly determine whether this is an --advance or --onto operation"));
+                       else if (rinfo.positive_refexprs > 1)
+                               die(_("cannot advance target with multiple source branches because ordering would be ill-defined"));
+
+                       /* Only one entry, but we have to loop to get it */
+                       strset_for_each_entry(&rinfo.negative_refs,
+                                             &iter, entry) {
+                               *advance_name = entry->key;
+                       }
+               } else { /* positive_refs_complete */
+                       if (rinfo.negative_refexprs > 1)
+                               die(_("cannot implicitly determine correct base for --onto"));
+                       if (rinfo.negative_refexprs == 1)
+                               *onto = rinfo.onto;
+               }
+       }
+       if (!*advance_name) {
+               *update_refs = xcalloc(1, sizeof(**update_refs));
+               **update_refs = rinfo.positive_refs;
+               memset(&rinfo.positive_refs, 0, sizeof(**update_refs));
+       }
+       strset_clear(&rinfo.negative_refs);
+       strset_clear(&rinfo.positive_refs);
+}
+
+static struct commit *mapped_commit(kh_oid_map_t *replayed_commits,
+                                   struct commit *commit,
+                                   struct commit *fallback)
+{
+       khint_t pos = kh_get_oid_map(replayed_commits, commit->object.oid);
+       if (pos == kh_end(replayed_commits))
+               return fallback;
+       return kh_value(replayed_commits, pos);
+}
+
+static struct commit *pick_regular_commit(struct commit *pickme,
+                                         kh_oid_map_t *replayed_commits,
+                                         struct commit *onto,
+                                         struct merge_options *merge_opt,
+                                         struct merge_result *result)
+{
+       struct commit *base, *replayed_base;
+       struct tree *pickme_tree, *base_tree;
+
+       base = pickme->parents->item;
+       replayed_base = mapped_commit(replayed_commits, base, onto);
+
+       result->tree = repo_get_commit_tree(the_repository, replayed_base);
+       pickme_tree = repo_get_commit_tree(the_repository, pickme);
+       base_tree = repo_get_commit_tree(the_repository, base);
+
+       merge_opt->branch1 = short_commit_name(replayed_base);
+       merge_opt->branch2 = short_commit_name(pickme);
+       merge_opt->ancestor = xstrfmt("parent of %s", merge_opt->branch2);
+
+       merge_incore_nonrecursive(merge_opt,
+                                 base_tree,
+                                 result->tree,
+                                 pickme_tree,
+                                 result);
+
+       free((char*)merge_opt->ancestor);
+       merge_opt->ancestor = NULL;
+       if (!result->clean)
+               return NULL;
+       return create_commit(result->tree, pickme, replayed_base);
+}
+
+int cmd_replay(int argc, const char **argv, const char *prefix)
+{
+       const char *advance_name = NULL;
+       struct commit *onto = NULL;
+       const char *onto_name = NULL;
+       int contained = 0;
+
+       struct rev_info revs;
+       struct commit *last_commit = NULL;
+       struct commit *commit;
+       struct merge_options merge_opt;
+       struct merge_result result;
+       struct strset *update_refs = NULL;
+       kh_oid_map_t *replayed_commits;
+       int ret = 0;
+
+       const char * const replay_usage[] = {
+               N_("(EXPERIMENTAL!) git replay "
+                  "([--contained] --onto <newbase> | --advance <branch>) "
+                  "<revision-range>..."),
+               NULL
+       };
+       struct option replay_options[] = {
+               OPT_STRING(0, "advance", &advance_name,
+                          N_("branch"),
+                          N_("make replay advance given branch")),
+               OPT_STRING(0, "onto", &onto_name,
+                          N_("revision"),
+                          N_("replay onto given commit")),
+               OPT_BOOL(0, "contained", &contained,
+                        N_("advance all branches contained in revision-range")),
+               OPT_END()
+       };
+
+       argc = parse_options(argc, argv, prefix, replay_options, replay_usage,
+                            PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT);
+
+       if (!onto_name && !advance_name) {
+               error(_("option --onto or --advance is mandatory"));
+               usage_with_options(replay_usage, replay_options);
+       }
+
+       if (advance_name && contained)
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--advance", "--contained");
+
+       repo_init_revisions(the_repository, &revs, prefix);
+
+       /*
+        * Set desired values for rev walking options here. If they
+        * are changed by some user specified option in setup_revisions()
+        * below, we will detect that below and then warn.
+        *
+        * TODO: In the future we might want to either die(), or allow
+        * some options changing these values if we think they could
+        * be useful.
+        */
+       revs.reverse = 1;
+       revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
+       revs.topo_order = 1;
+       revs.simplify_history = 0;
+
+       argc = setup_revisions(argc, argv, &revs, NULL);
+       if (argc > 1) {
+               ret = error(_("unrecognized argument: %s"), argv[1]);
+               goto cleanup;
+       }
+
+       /*
+        * Detect and warn if we override some user specified rev
+        * walking options.
+        */
+       if (revs.reverse != 1) {
+               warning(_("some rev walking options will be overridden as "
+                         "'%s' bit in 'struct rev_info' will be forced"),
+                       "reverse");
+               revs.reverse = 1;
+       }
+       if (revs.sort_order != REV_SORT_IN_GRAPH_ORDER) {
+               warning(_("some rev walking options will be overridden as "
+                         "'%s' bit in 'struct rev_info' will be forced"),
+                       "sort_order");
+               revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
+       }
+       if (revs.topo_order != 1) {
+               warning(_("some rev walking options will be overridden as "
+                         "'%s' bit in 'struct rev_info' will be forced"),
+                       "topo_order");
+               revs.topo_order = 1;
+       }
+       if (revs.simplify_history != 0) {
+               warning(_("some rev walking options will be overridden as "
+                         "'%s' bit in 'struct rev_info' will be forced"),
+                       "simplify_history");
+               revs.simplify_history = 0;
+       }
+
+       determine_replay_mode(&revs.cmdline, onto_name, &advance_name,
+                             &onto, &update_refs);
+
+       if (!onto) /* FIXME: Should handle replaying down to root commit */
+               die("Replaying down to root commit is not supported yet!");
+
+       if (prepare_revision_walk(&revs) < 0) {
+               ret = error(_("error preparing revisions"));
+               goto cleanup;
+       }
+
+       init_merge_options(&merge_opt, the_repository);
+       memset(&result, 0, sizeof(result));
+       merge_opt.show_rename_progress = 0;
+       last_commit = onto;
+       replayed_commits = kh_init_oid_map();
+       while ((commit = get_revision(&revs))) {
+               const struct name_decoration *decoration;
+               khint_t pos;
+               int hr;
+
+               if (!commit->parents)
+                       die(_("replaying down to root commit is not supported yet!"));
+               if (commit->parents->next)
+                       die(_("replaying merge commits is not supported yet!"));
+
+               last_commit = pick_regular_commit(commit, replayed_commits, onto,
+                                                 &merge_opt, &result);
+               if (!last_commit)
+                       break;
+
+               /* Record commit -> last_commit mapping */
+               pos = kh_put_oid_map(replayed_commits, commit->object.oid, &hr);
+               if (hr == 0)
+                       BUG("Duplicate rewritten commit: %s\n",
+                           oid_to_hex(&commit->object.oid));
+               kh_value(replayed_commits, pos) = last_commit;
+
+               /* Update any necessary branches */
+               if (advance_name)
+                       continue;
+               decoration = get_name_decoration(&commit->object);
+               if (!decoration)
+                       continue;
+               while (decoration) {
+                       if (decoration->type == DECORATION_REF_LOCAL &&
+                           (contained || strset_contains(update_refs,
+                                                         decoration->name))) {
+                               printf("update %s %s %s\n",
+                                      decoration->name,
+                                      oid_to_hex(&last_commit->object.oid),
+                                      oid_to_hex(&commit->object.oid));
+                       }
+                       decoration = decoration->next;
+               }
+       }
+
+       /* In --advance mode, advance the target ref */
+       if (result.clean == 1 && advance_name) {
+               printf("update %s %s %s\n",
+                      advance_name,
+                      oid_to_hex(&last_commit->object.oid),
+                      oid_to_hex(&onto->object.oid));
+       }
+
+       merge_finalize(&merge_opt, &result);
+       kh_destroy_oid_map(replayed_commits);
+       if (update_refs) {
+               strset_clear(update_refs);
+               free(update_refs);
+       }
+       ret = result.clean;
+
+cleanup:
+       release_revisions(&revs);
+
+       /* Return */
+       if (ret < 0)
+               exit(128);
+       return ret ? 0 : 1;
+}
index 07a9d37275cbbc52cc8cddbae4a6143df2e49a82..b2efc6f640e18a2f956cdc985ecc2c793120a267 100644 (file)
@@ -1,6 +1,5 @@
 #include "builtin.h"
 #include "config.h"
-#include "dir.h"
 #include "gettext.h"
 #include "parse-options.h"
 #include "repository.h"
index 4b018d20e3b2200e44a04f1f759837a571e4bc4f..1d62ff6332737c6449c76f66d2ebcbadb36bfb11 100644 (file)
 #include "hash.h"
 #include "hex.h"
 #include "lockfile.h"
-#include "tag.h"
 #include "object.h"
 #include "pretty.h"
-#include "run-command.h"
 #include "refs.h"
 #include "diff.h"
 #include "diffcore.h"
@@ -33,7 +31,6 @@
 #include "setup.h"
 #include "sparse-index.h"
 #include "submodule.h"
-#include "submodule-config.h"
 #include "trace.h"
 #include "trace2.h"
 #include "dir.h"
@@ -119,6 +116,10 @@ static int reset_index(const char *ref, const struct object_id *oid, int reset_t
 
        if (reset_type == MIXED || reset_type == HARD) {
                tree = parse_tree_indirect(oid);
+               if (!tree) {
+                       error(_("unable to read tree (%s)"), oid_to_hex(oid));
+                       goto out;
+               }
                prime_cache_tree(the_repository, the_repository->index, tree);
        }
 
@@ -284,7 +285,9 @@ static void parse_args(struct pathspec *pathspec,
                        verify_filename(prefix, argv[0], 1);
                }
        }
-       *rev_ret = rev;
+
+       /* treat '@' as a shortcut for 'HEAD' */
+       *rev_ret = !strcmp("@", rev) ? "HEAD" : rev;
 
        parse_pathspec(pathspec, 0,
                       PATHSPEC_PREFER_FULL |
index ff715d6918f004265cf8801879f13fc189f09709..ec455aa97277dd58d106c10623ad36aa923bcd10 100644 (file)
@@ -7,13 +7,11 @@
 #include "hex.h"
 #include "revision.h"
 #include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "object.h"
 #include "object-name.h"
 #include "object-file.h"
 #include "object-store-ll.h"
-#include "pack.h"
 #include "pack-bitmap.h"
 #include "log-tree.h"
 #include "graph.h"
@@ -100,7 +98,48 @@ static off_t get_object_disk_usage(struct object *obj)
        return size;
 }
 
-static void finish_commit(struct commit *commit);
+static inline void finish_object__ma(struct object *obj)
+{
+       /*
+        * Whether or not we try to dynamically fetch missing objects
+        * from the server, we currently DO NOT have the object.  We
+        * can either print, allow (ignore), or conditionally allow
+        * (ignore) them.
+        */
+       switch (arg_missing_action) {
+       case MA_ERROR:
+               die("missing %s object '%s'",
+                   type_name(obj->type), oid_to_hex(&obj->oid));
+               return;
+
+       case MA_ALLOW_ANY:
+               return;
+
+       case MA_PRINT:
+               oidset_insert(&missing_objects, &obj->oid);
+               return;
+
+       case MA_ALLOW_PROMISOR:
+               if (is_promisor_object(&obj->oid))
+                       return;
+               die("unexpected missing %s object '%s'",
+                   type_name(obj->type), oid_to_hex(&obj->oid));
+               return;
+
+       default:
+               BUG("unhandled missing_action");
+               return;
+       }
+}
+
+static void finish_commit(struct commit *commit)
+{
+       free_commit_list(commit->parents);
+       commit->parents = NULL;
+       free_commit_buffer(the_repository->parsed_objects,
+                          commit);
+}
+
 static void show_commit(struct commit *commit, void *data)
 {
        struct rev_list_info *info = data;
@@ -108,6 +147,12 @@ static void show_commit(struct commit *commit, void *data)
 
        display_progress(progress, ++progress_counter);
 
+       if (revs->do_not_die_on_missing_objects &&
+           oidset_contains(&revs->missing_commits, &commit->object.oid)) {
+               finish_object__ma(&commit->object);
+               return;
+       }
+
        if (show_disk_usage)
                total_disk_usage += get_object_disk_usage(&commit->object);
 
@@ -219,48 +264,6 @@ static void show_commit(struct commit *commit, void *data)
        finish_commit(commit);
 }
 
-static void finish_commit(struct commit *commit)
-{
-       free_commit_list(commit->parents);
-       commit->parents = NULL;
-       free_commit_buffer(the_repository->parsed_objects,
-                          commit);
-}
-
-static inline void finish_object__ma(struct object *obj)
-{
-       /*
-        * Whether or not we try to dynamically fetch missing objects
-        * from the server, we currently DO NOT have the object.  We
-        * can either print, allow (ignore), or conditionally allow
-        * (ignore) them.
-        */
-       switch (arg_missing_action) {
-       case MA_ERROR:
-               die("missing %s object '%s'",
-                   type_name(obj->type), oid_to_hex(&obj->oid));
-               return;
-
-       case MA_ALLOW_ANY:
-               return;
-
-       case MA_PRINT:
-               oidset_insert(&missing_objects, &obj->oid);
-               return;
-
-       case MA_ALLOW_PROMISOR:
-               if (is_promisor_object(&obj->oid))
-                       return;
-               die("unexpected missing %s object '%s'",
-                   type_name(obj->type), oid_to_hex(&obj->oid));
-               return;
-
-       default:
-               BUG("unhandled missing_action");
-               return;
-       }
-}
-
 static int finish_object(struct object *obj, const char *name UNUSED,
                         void *cb_data)
 {
@@ -542,6 +545,18 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
         *
         * Let "--missing" to conditionally set fetch_if_missing.
         */
+       /*
+        * NEEDSWORK: These loops that attempt to find presence of
+        * options without understanding that the options they are
+        * skipping are broken (e.g., it would not know "--grep
+        * --exclude-promisor-objects" is not triggering
+        * "--exclude-promisor-objects" option).  We really need
+        * setup_revisions() to have a mechanism to allow and disallow
+        * some sets of options for different commands (like rev-list,
+        * replay, etc). Such a mechanism should do an early parsing
+        * of options and be able to manage the `--missing=...` and
+        * `--exclude-promisor-objects` options below.
+        */
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
                if (!strcmp(arg, "--exclude-promisor-objects")) {
@@ -561,7 +576,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
        }
 
        if (arg_missing_action)
-               revs.do_not_die_on_missing_tree = 1;
+               revs.do_not_die_on_missing_objects = 1;
 
        argc = setup_revisions(argc, argv, &revs, &s_r_opt);
 
@@ -750,8 +765,12 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 
        if (arg_print_omitted)
                oidset_init(&omitted_objects, DEFAULT_OIDSET_SIZE);
-       if (arg_missing_action == MA_PRINT)
+       if (arg_missing_action == MA_PRINT) {
                oidset_init(&missing_objects, DEFAULT_OIDSET_SIZE);
+               /* Add missing tips */
+               oidset_insert_from_set(&missing_objects, &revs.missing_commits);
+               oidset_clear(&revs.missing_commits);
+       }
 
        traverse_commit_list_filtered(
                &revs, show_commit, show_object, &info,
index 0ef3e658cc5bbdba07a71d4dbea3a496708020c4..624182e507e5af9ac34a67f18d7a5dcf6fe2e58c 100644 (file)
@@ -298,7 +298,7 @@ static int try_difference(const char *arg)
                show_rev(NORMAL, &end_oid, end);
                show_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);
                if (symmetric) {
-                       struct commit_list *exclude;
+                       struct commit_list *exclude = NULL;
                        struct commit *a, *b;
                        a = lookup_commit_reference(the_repository, &start_oid);
                        b = lookup_commit_reference(the_repository, &end_oid);
@@ -306,7 +306,8 @@ static int try_difference(const char *arg)
                                *dotdot = '.';
                                return 0;
                        }
-                       exclude = repo_get_merge_bases(the_repository, a, b);
+                       if (repo_get_merge_bases(the_repository, a, b, &exclude) < 0)
+                               exit(128);
                        while (exclude) {
                                struct commit *commit = pop_commit(&exclude);
                                show_rev(REVERSED, &commit->object.oid, NULL);
@@ -913,13 +914,15 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                        }
                        if (opt_with_value(arg, "--branches", &arg)) {
                                if (ref_excludes.hidden_refs_configured)
-                                       return error(_("--exclude-hidden cannot be used together with --branches"));
+                                       return error(_("options '%s' and '%s' cannot be used together"),
+                                                    "--exclude-hidden", "--branches");
                                handle_ref_opt(arg, "refs/heads/");
                                continue;
                        }
                        if (opt_with_value(arg, "--tags", &arg)) {
                                if (ref_excludes.hidden_refs_configured)
-                                       return error(_("--exclude-hidden cannot be used together with --tags"));
+                                       return error(_("options '%s' and '%s' cannot be used together"),
+                                                    "--exclude-hidden", "--tags");
                                handle_ref_opt(arg, "refs/tags/");
                                continue;
                        }
@@ -929,7 +932,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                        }
                        if (opt_with_value(arg, "--remotes", &arg)) {
                                if (ref_excludes.hidden_refs_configured)
-                                       return error(_("--exclude-hidden cannot be used together with --remotes"));
+                                       return error(_("options '%s' and '%s' cannot be used together"),
+                                                    "--exclude-hidden", "--remotes");
                                handle_ref_opt(arg, "refs/remotes/");
                                continue;
                        }
@@ -1079,6 +1083,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                puts(the_hash_algo->name);
                                continue;
                        }
+                       if (!strcmp(arg, "--show-ref-format")) {
+                               puts(ref_storage_format_to_name(the_repository->ref_storage_format));
+                               continue;
+                       }
                        if (!strcmp(arg, "--end-of-options")) {
                                seen_end_of_options = 1;
                                if (filter & (DO_FLAGS | DO_REVS))
index e6f9a1ad26721c450258849cb8e415156052e442..89821bab95745a5fca294d00811804799ecd323d 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "config.h"
 #include "builtin.h"
 #include "parse-options.h"
 #include "diff.h"
@@ -7,7 +6,6 @@
 #include "repository.h"
 #include "revision.h"
 #include "rerere.h"
-#include "dir.h"
 #include "sequencer.h"
 #include "branch.h"
 
index dff819ae5098ff2ee0c72bae00b35da39bf4979d..fd130cea2d2592829e3abd991ca6caae4a119897 100644 (file)
@@ -9,7 +9,6 @@
 #include "config.h"
 #include "lockfile.h"
 #include "dir.h"
-#include "cache-tree.h"
 #include "gettext.h"
 #include "hash.h"
 #include "tree-walk.h"
index cd6d9e41129a21d7f9c21cebae0a322812ebcbcd..3df9eaad092babdbbfc47f1c5441fc43a4ccd182 100644 (file)
@@ -1,19 +1,14 @@
 #include "builtin.h"
 #include "config.h"
-#include "commit.h"
 #include "hex.h"
-#include "refs.h"
 #include "pkt-line.h"
-#include "sideband.h"
 #include "run-command.h"
 #include "remote.h"
 #include "connect.h"
 #include "send-pack.h"
 #include "quote.h"
 #include "transport.h"
-#include "version.h"
 #include "oid-array.h"
-#include "gpg-interface.h"
 #include "gettext.h"
 #include "protocol.h"
 #include "parse-options.h"
@@ -135,21 +130,18 @@ static int send_pack_config(const char *k, const char *v,
                            const struct config_context *ctx, void *cb)
 {
        if (!strcmp(k, "push.gpgsign")) {
-               const char *value;
-               if (!git_config_get_value("push.gpgsign", &value)) {
-                       switch (git_parse_maybe_bool(value)) {
-                       case 0:
-                               args.push_cert = SEND_PACK_PUSH_CERT_NEVER;
-                               break;
-                       case 1:
-                               args.push_cert = SEND_PACK_PUSH_CERT_ALWAYS;
-                               break;
-                       default:
-                               if (value && !strcasecmp(value, "if-asked"))
-                                       args.push_cert = SEND_PACK_PUSH_CERT_IF_ASKED;
-                               else
-                                       return error(_("invalid value for '%s'"), k);
-                       }
+               switch (git_parse_maybe_bool(v)) {
+               case 0:
+                       args.push_cert = SEND_PACK_PUSH_CERT_NEVER;
+                       break;
+               case 1:
+                       args.push_cert = SEND_PACK_PUSH_CERT_ALWAYS;
+                       break;
+               default:
+                       if (!strcasecmp(v, "if-asked"))
+                               args.push_cert = SEND_PACK_PUSH_CERT_IF_ASKED;
+                       else
+                               return error(_("invalid value for '%s'"), k);
                }
        }
        return git_default_config(k, v, ctx, cb);
@@ -208,7 +200,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "stateless-rpc", &stateless_rpc, N_("use stateless RPC protocol")),
                OPT_BOOL(0, "stdin", &from_stdin, N_("read refs from stdin")),
                OPT_BOOL(0, "helper-status", &helper_status, N_("print status from remote helper")),
-               OPT_CALLBACK_F(0, CAS_OPT_NAME, &cas, N_("<refname>:<expect>"),
+               OPT_CALLBACK_F(0, "force-with-lease", &cas, N_("<refname>:<expect>"),
                  N_("require old value of ref to be at this value"),
                  PARSE_OPT_OPTARG, parseopt_push_cas_option),
                OPT_BOOL(0, TRANS_OPT_FORCE_IF_INCLUDES, &force_if_includes,
@@ -341,6 +333,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
        }
 
        if (!ret && !transport_refs_pushed(remote_refs))
+               /* stable plumbing output; do not modify or localize */
                fprintf(stderr, "Everything up-to-date\n");
 
        return ret;
index 5110814f7960870aa4f1df60965f2234088f859f..1c15421e6008e80b1983c168592998f17667bf58 100644 (file)
@@ -2,28 +2,34 @@
 #include "config.h"
 #include "gettext.h"
 #include "hex.h"
-#include "refs.h"
+#include "refs/refs-internal.h"
 #include "object-name.h"
 #include "object-store-ll.h"
 #include "object.h"
-#include "tag.h"
 #include "string-list.h"
 #include "parse-options.h"
 
 static const char * const show_ref_usage[] = {
-       N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+       N_("git show-ref [--head] [-d | --dereference]\n"
           "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
           "             [--heads] [--] [<pattern>...]"),
+       N_("git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+          "             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+          "             [--] [<ref>...]"),
        N_("git show-ref --exclude-existing[=<pattern>]"),
+       N_("git show-ref --exists <ref>"),
        NULL
 };
 
-static int deref_tags, show_head, tags_only, heads_only, found_match, verify,
-          quiet, hash_only, abbrev, exclude_arg;
-static const char **pattern;
-static const char *exclude_existing_arg;
+struct show_one_options {
+       int quiet;
+       int hash_only;
+       int abbrev;
+       int deref_tags;
+};
 
-static void show_one(const char *refname, const struct object_id *oid)
+static void show_one(const struct show_one_options *opts,
+                    const char *refname, const struct object_id *oid)
 {
        const char *hex;
        struct object_id peeled;
@@ -32,33 +38,42 @@ static void show_one(const char *refname, const struct object_id *oid)
                die("git show-ref: bad ref %s (%s)", refname,
                    oid_to_hex(oid));
 
-       if (quiet)
+       if (opts->quiet)
                return;
 
-       hex = repo_find_unique_abbrev(the_repository, oid, abbrev);
-       if (hash_only)
+       hex = repo_find_unique_abbrev(the_repository, oid, opts->abbrev);
+       if (opts->hash_only)
                printf("%s\n", hex);
        else
                printf("%s %s\n", hex, refname);
 
-       if (!deref_tags)
+       if (!opts->deref_tags)
                return;
 
        if (!peel_iterated_oid(oid, &peeled)) {
-               hex = repo_find_unique_abbrev(the_repository, &peeled, abbrev);
+               hex = repo_find_unique_abbrev(the_repository, &peeled, opts->abbrev);
                printf("%s %s^{}\n", hex, refname);
        }
 }
 
+struct show_ref_data {
+       const struct show_one_options *show_one_opts;
+       const char **patterns;
+       int found_match;
+       int show_head;
+};
+
 static int show_ref(const char *refname, const struct object_id *oid,
-                   int flag UNUSED, void *cbdata UNUSED)
+                   int flag UNUSED, void *cbdata)
 {
-       if (show_head && !strcmp(refname, "HEAD"))
+       struct show_ref_data *data = cbdata;
+
+       if (data->show_head && !strcmp(refname, "HEAD"))
                goto match;
 
-       if (pattern) {
+       if (data->patterns) {
                int reflen = strlen(refname);
-               const char **p = pattern, *m;
+               const char **p = data->patterns, *m;
                while ((m = *p++) != NULL) {
                        int len = strlen(m);
                        if (len > reflen)
@@ -74,9 +89,9 @@ static int show_ref(const char *refname, const struct object_id *oid,
        }
 
 match:
-       found_match++;
+       data->found_match++;
 
-       show_one(refname, oid);
+       show_one(data->show_one_opts, refname, oid);
 
        return 0;
 }
@@ -90,6 +105,15 @@ static int add_existing(const char *refname,
        return 0;
 }
 
+struct exclude_existing_options {
+       /*
+        * We need an explicit `enabled` field because it is perfectly valid
+        * for `pattern` to be `NULL` even if `--exclude-existing` was given.
+        */
+       int enabled;
+       const char *pattern;
+};
+
 /*
  * read "^(?:<anything>\s)?<refname>(?:\^\{\})?$" from the standard input,
  * and
@@ -99,11 +123,11 @@ static int add_existing(const char *refname,
  * (4) ignore if refname is a ref that exists in the local repository;
  * (5) otherwise output the line.
  */
-static int exclude_existing(const char *match)
+static int cmd_show_ref__exclude_existing(const struct exclude_existing_options *opts)
 {
-       static struct string_list existing_refs = STRING_LIST_INIT_DUP;
+       struct string_list existing_refs = STRING_LIST_INIT_DUP;
        char buf[1024];
-       int matchlen = match ? strlen(match) : 0;
+       int patternlen = opts->pattern ? strlen(opts->pattern) : 0;
 
        for_each_ref(add_existing, &existing_refs);
        while (fgets(buf, sizeof(buf), stdin)) {
@@ -119,11 +143,11 @@ static int exclude_existing(const char *match)
                for (ref = buf + len; buf < ref; ref--)
                        if (isspace(ref[-1]))
                                break;
-               if (match) {
+               if (opts->pattern) {
                        int reflen = buf + len - ref;
-                       if (reflen < matchlen)
+                       if (reflen < patternlen)
                                continue;
-                       if (strncmp(ref, match, matchlen))
+                       if (strncmp(ref, opts->pattern, patternlen))
                                continue;
                }
                if (check_refname_format(ref, 0)) {
@@ -134,97 +158,172 @@ static int exclude_existing(const char *match)
                        printf("%s\n", buf);
                }
        }
+
+       string_list_clear(&existing_refs, 0);
+       return 0;
+}
+
+static int cmd_show_ref__verify(const struct show_one_options *show_one_opts,
+                               const char **refs)
+{
+       if (!refs || !*refs)
+               die("--verify requires a reference");
+
+       while (*refs) {
+               struct object_id oid;
+
+               if ((starts_with(*refs, "refs/") || refname_is_safe(*refs)) &&
+                   !read_ref(*refs, &oid)) {
+                       show_one(show_one_opts, *refs, &oid);
+               }
+               else if (!show_one_opts->quiet)
+                       die("'%s' - not a valid ref", *refs);
+               else
+                       return 1;
+               refs++;
+       }
+
        return 0;
 }
 
+struct patterns_options {
+       int show_head;
+       int heads_only;
+       int tags_only;
+};
+
+static int cmd_show_ref__patterns(const struct patterns_options *opts,
+                                 const struct show_one_options *show_one_opts,
+                                 const char **patterns)
+{
+       struct show_ref_data show_ref_data = {
+               .show_one_opts = show_one_opts,
+               .show_head = opts->show_head,
+       };
+
+       if (patterns && *patterns)
+               show_ref_data.patterns = patterns;
+
+       if (opts->show_head)
+               head_ref(show_ref, &show_ref_data);
+       if (opts->heads_only || opts->tags_only) {
+               if (opts->heads_only)
+                       for_each_fullref_in("refs/heads/", show_ref, &show_ref_data);
+               if (opts->tags_only)
+                       for_each_fullref_in("refs/tags/", show_ref, &show_ref_data);
+       } else {
+               for_each_ref(show_ref, &show_ref_data);
+       }
+       if (!show_ref_data.found_match)
+               return 1;
+
+       return 0;
+}
+
+static int cmd_show_ref__exists(const char **refs)
+{
+       struct strbuf unused_referent = STRBUF_INIT;
+       struct object_id unused_oid;
+       unsigned int unused_type;
+       int failure_errno = 0;
+       const char *ref;
+       int ret = 0;
+
+       if (!refs || !*refs)
+               die("--exists requires a reference");
+       ref = *refs++;
+       if (*refs)
+               die("--exists requires exactly one reference");
+
+       if (refs_read_raw_ref(get_main_ref_store(the_repository), ref,
+                             &unused_oid, &unused_referent, &unused_type,
+                             &failure_errno)) {
+               if (failure_errno == ENOENT || failure_errno == EISDIR) {
+                       error(_("reference does not exist"));
+                       ret = 2;
+               } else {
+                       errno = failure_errno;
+                       error_errno(_("failed to look up reference"));
+                       ret = 1;
+               }
+
+               goto out;
+       }
+
+out:
+       strbuf_release(&unused_referent);
+       return ret;
+}
+
 static int hash_callback(const struct option *opt, const char *arg, int unset)
 {
-       hash_only = 1;
+       struct show_one_options *opts = opt->value;
+       struct option abbrev_opt = *opt;
+
+       opts->hash_only = 1;
        /* Use full length SHA1 if no argument */
        if (!arg)
                return 0;
-       return parse_opt_abbrev_cb(opt, arg, unset);
+
+       abbrev_opt.value = &opts->abbrev;
+       return parse_opt_abbrev_cb(&abbrev_opt, arg, unset);
 }
 
 static int exclude_existing_callback(const struct option *opt, const char *arg,
                                     int unset)
 {
+       struct exclude_existing_options *opts = opt->value;
        BUG_ON_OPT_NEG(unset);
-       exclude_arg = 1;
-       *(const char **)opt->value = arg;
+       opts->enabled = 1;
+       opts->pattern = arg;
        return 0;
 }
 
-static const struct option show_ref_options[] = {
-       OPT_BOOL(0, "tags", &tags_only, N_("only show tags (can be combined with heads)")),
-       OPT_BOOL(0, "heads", &heads_only, N_("only show heads (can be combined with tags)")),
-       OPT_BOOL(0, "verify", &verify, N_("stricter reference checking, "
-                   "requires exact ref path")),
-       OPT_HIDDEN_BOOL('h', NULL, &show_head,
-                       N_("show the HEAD reference, even if it would be filtered out")),
-       OPT_BOOL(0, "head", &show_head,
-         N_("show the HEAD reference, even if it would be filtered out")),
-       OPT_BOOL('d', "dereference", &deref_tags,
-                   N_("dereference tags into object IDs")),
-       OPT_CALLBACK_F('s', "hash", &abbrev, N_("n"),
-                      N_("only show SHA1 hash using <n> digits"),
-                      PARSE_OPT_OPTARG, &hash_callback),
-       OPT__ABBREV(&abbrev),
-       OPT__QUIET(&quiet,
-                  N_("do not print results to stdout (useful with --verify)")),
-       OPT_CALLBACK_F(0, "exclude-existing", &exclude_existing_arg,
-                      N_("pattern"), N_("show refs from stdin that aren't in local repository"),
-                      PARSE_OPT_OPTARG | PARSE_OPT_NONEG, exclude_existing_callback),
-       OPT_END()
-};
-
 int cmd_show_ref(int argc, const char **argv, const char *prefix)
 {
+       struct exclude_existing_options exclude_existing_opts = {0};
+       struct patterns_options patterns_opts = {0};
+       struct show_one_options show_one_opts = {0};
+       int verify = 0, exists = 0;
+       const struct option show_ref_options[] = {
+               OPT_BOOL(0, "tags", &patterns_opts.tags_only, N_("only show tags (can be combined with heads)")),
+               OPT_BOOL(0, "heads", &patterns_opts.heads_only, N_("only show heads (can be combined with tags)")),
+               OPT_BOOL(0, "exists", &exists, N_("check for reference existence without resolving")),
+               OPT_BOOL(0, "verify", &verify, N_("stricter reference checking, "
+                           "requires exact ref path")),
+               OPT_HIDDEN_BOOL('h', NULL, &patterns_opts.show_head,
+                               N_("show the HEAD reference, even if it would be filtered out")),
+               OPT_BOOL(0, "head", &patterns_opts.show_head,
+                 N_("show the HEAD reference, even if it would be filtered out")),
+               OPT_BOOL('d', "dereference", &show_one_opts.deref_tags,
+                           N_("dereference tags into object IDs")),
+               OPT_CALLBACK_F('s', "hash", &show_one_opts, N_("n"),
+                              N_("only show SHA1 hash using <n> digits"),
+                              PARSE_OPT_OPTARG, &hash_callback),
+               OPT__ABBREV(&show_one_opts.abbrev),
+               OPT__QUIET(&show_one_opts.quiet,
+                          N_("do not print results to stdout (useful with --verify)")),
+               OPT_CALLBACK_F(0, "exclude-existing", &exclude_existing_opts,
+                              N_("pattern"), N_("show refs from stdin that aren't in local repository"),
+                              PARSE_OPT_OPTARG | PARSE_OPT_NONEG, exclude_existing_callback),
+               OPT_END()
+       };
+
        git_config(git_default_config, NULL);
 
        argc = parse_options(argc, argv, prefix, show_ref_options,
                             show_ref_usage, 0);
 
-       if (exclude_arg)
-               return exclude_existing(exclude_existing_arg);
-
-       pattern = argv;
-       if (!*pattern)
-               pattern = NULL;
-
-       if (verify) {
-               if (!pattern)
-                       die("--verify requires a reference");
-               while (*pattern) {
-                       struct object_id oid;
-
-                       if ((starts_with(*pattern, "refs/") || !strcmp(*pattern, "HEAD")) &&
-                           !read_ref(*pattern, &oid)) {
-                               show_one(*pattern, &oid);
-                       }
-                       else if (!quiet)
-                               die("'%s' - not a valid ref", *pattern);
-                       else
-                               return 1;
-                       pattern++;
-               }
-               return 0;
-       }
+       die_for_incompatible_opt3(exclude_existing_opts.enabled, "--exclude-existing",
+                                 verify, "--verify",
+                                 exists, "--exists");
 
-       if (show_head)
-               head_ref(show_ref, NULL);
-       if (heads_only || tags_only) {
-               if (heads_only)
-                       for_each_fullref_in("refs/heads/", show_ref, NULL);
-               if (tags_only)
-                       for_each_fullref_in("refs/tags/", show_ref, NULL);
-       } else {
-               for_each_ref(show_ref, NULL);
-       }
-       if (!found_match) {
-               if (verify && !quiet)
-                       die("No match");
-               return 1;
-       }
-       return 0;
+       if (exclude_existing_opts.enabled)
+               return cmd_show_ref__exclude_existing(&exclude_existing_opts);
+       else if (verify)
+               return cmd_show_ref__verify(&show_one_opts, argv);
+       else if (exists)
+               return cmd_show_ref__exists(argv);
+       else
+               return cmd_show_ref__patterns(&patterns_opts, &show_one_opts, argv);
 }
index 5c8ffb1f7598b056fadcdd8fb98182d34928e6f3..0f52e252493d0d56fd0bcf5a7b9f92a416e86348 100644 (file)
@@ -8,14 +8,10 @@
 #include "parse-options.h"
 #include "pathspec.h"
 #include "repository.h"
-#include "run-command.h"
 #include "strbuf.h"
 #include "string-list.h"
-#include "cache-tree.h"
 #include "lockfile.h"
-#include "resolve-undo.h"
 #include "unpack-trees.h"
-#include "wt-status.h"
 #include "quote.h"
 #include "setup.h"
 #include "sparse-index.h"
@@ -777,8 +773,7 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
 
        argc = parse_options(argc, argv, prefix,
                             builtin_sparse_checkout_add_options,
-                            builtin_sparse_checkout_add_usage,
-                            PARSE_OPT_KEEP_UNKNOWN_OPT);
+                            builtin_sparse_checkout_add_usage, 0);
 
        sanitize_paths(argc, argv, prefix, add_opts.skip_checks);
 
@@ -824,8 +819,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
 
        argc = parse_options(argc, argv, prefix,
                             builtin_sparse_checkout_set_options,
-                            builtin_sparse_checkout_set_usage,
-                            PARSE_OPT_KEEP_UNKNOWN_OPT);
+                            builtin_sparse_checkout_set_usage, 0);
 
        if (update_modes(&set_opts.cone_mode, &set_opts.sparse_index))
                return 1;
@@ -835,7 +829,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
         * non-cone mode, if nothing is specified, manually select just the
         * top-level directory (much as 'init' would do).
         */
-       if (!core_sparse_checkout_cone && argc == 0) {
+       if (!core_sparse_checkout_cone && !set_opts.use_stdin && argc == 0) {
                argv = default_patterns;
                argc = default_patterns_nr;
        } else {
@@ -996,8 +990,7 @@ static int sparse_checkout_check_rules(int argc, const char **argv, const char *
 
        argc = parse_options(argc, argv, prefix,
                             builtin_sparse_checkout_check_rules_options,
-                            builtin_sparse_checkout_check_rules_usage,
-                            PARSE_OPT_KEEP_UNKNOWN_OPT);
+                            builtin_sparse_checkout_check_rules_usage, 0);
 
        if (check_rules_opts.rules_file && check_rules_opts.cone_mode < 0)
                check_rules_opts.cone_mode = 1;
index 9ee52af4d28e361f4ebc5240dbdfc2ff1b0b74a0..062be1fbc07b0c2ecfcc6f41f5d995ae13c0aecb 100644 (file)
@@ -26,7 +26,6 @@
 #include "sparse-index.h"
 #include "log-tree.h"
 #include "diffcore.h"
-#include "exec-cmd.h"
 #include "reflog.h"
 #include "add-interactive.h"
 
@@ -362,7 +361,7 @@ static int is_path_a_directory(const char *path)
 }
 
 static void add_diff_to_buf(struct diff_queue_struct *q,
-                           struct diff_options *options,
+                           struct diff_options *options UNUSED,
                            void *data)
 {
        int i;
@@ -521,7 +520,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)
        repo_hold_locked_index(the_repository, &lock, LOCK_DIE_ON_ERROR);
        if (write_locked_index(&the_index, &lock,
                               COMMIT_LOCK | SKIP_IF_UNCHANGED))
-               die(_("Unable to write index."));
+               die(_("could not write index"));
 }
 
 static int do_apply_stash(const char *prefix, struct stash_info *info,
@@ -538,7 +537,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
        repo_read_index_preload(the_repository, NULL, 0);
        if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
                                         NULL, NULL, NULL))
-               return -1;
+               return error(_("could not write index"));
 
        if (write_index_as_tree(&c_tree, &the_index, get_index_file(), 0,
                                NULL))
@@ -974,7 +973,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)
        }
        log_tree_diff_flush(&rev);
 
-       ret = diff_result_code(&rev.diffopt, 0);
+       ret = diff_result_code(&rev.diffopt);
 cleanup:
        strvec_clear(&stash_args);
        free_stash_info(&info);
@@ -990,6 +989,12 @@ usage:
 static int do_store_stash(const struct object_id *w_commit, const char *stash_msg,
                          int quiet)
 {
+       struct stash_info info;
+       char revision[GIT_MAX_HEXSZ];
+
+       oid_to_hex_r(revision, w_commit);
+       assert_stash_like(&info, revision);
+
        if (!stash_msg)
                stash_msg = "Created via \"git stash store\".";
 
@@ -1090,7 +1095,6 @@ static int get_untracked_files(const struct pathspec *ps, int include_untracked,
  */
 static int check_changes_tracked_files(const struct pathspec *ps)
 {
-       int result;
        struct rev_info rev;
        struct object_id dummy;
        int ret = 0;
@@ -1112,14 +1116,14 @@ static int check_changes_tracked_files(const struct pathspec *ps)
        add_head_to_pending(&rev);
        diff_setup_done(&rev.diffopt);
 
-       result = run_diff_index(&rev, 1);
-       if (diff_result_code(&rev.diffopt, result)) {
+       run_diff_index(&rev, DIFF_INDEX_CACHED);
+       if (diff_result_code(&rev.diffopt)) {
                ret = 1;
                goto done;
        }
 
-       result = run_diff_files(&rev, 0);
-       if (diff_result_code(&rev.diffopt, result)) {
+       run_diff_files(&rev, 0);
+       if (diff_result_code(&rev.diffopt)) {
                ret = 1;
                goto done;
        }
@@ -1310,10 +1314,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
 
        add_pending_object(&rev, parse_object(the_repository, &info->b_commit),
                           "");
-       if (run_diff_index(&rev, 0)) {
-               ret = -1;
-               goto done;
-       }
+       run_diff_index(&rev, 0);
 
        cp_upd_index.git_cmd = 1;
        strvec_pushl(&cp_upd_index.args, "update-index",
@@ -1364,7 +1365,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
        repo_read_index_preload(the_repository, NULL, 0);
        if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
                                         NULL, NULL, NULL) < 0) {
-               ret = -1;
+               ret = error(_("could not write index"));
                goto done;
        }
 
@@ -1555,7 +1556,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
 
        if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
                                         NULL, NULL, NULL)) {
-               ret = -1;
+               ret = error(_("could not write index"));
                goto done;
        }
 
index f6871efd95dbca6da051f2d1b3b81b3c5c52b0b5..fda50f2af1e33277161f819f560b4d8164d284a0 100644 (file)
@@ -22,7 +22,6 @@
 #include "remote.h"
 #include "refs.h"
 #include "refspec.h"
-#include "connect.h"
 #include "revision.h"
 #include "diffcore.h"
 #include "diff.h"
@@ -629,7 +628,6 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
        char *displaypath;
        struct strvec diff_files_args = STRVEC_INIT;
        struct rev_info rev = REV_INFO_INIT;
-       int diff_files_result;
        struct strbuf buf = STRBUF_INIT;
        const char *git_dir;
        struct setup_revision_opt opt = {
@@ -669,9 +667,9 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
        repo_init_revisions(the_repository, &rev, NULL);
        rev.abbrev = 0;
        setup_revisions(diff_files_args.nr, diff_files_args.v, &rev, &opt);
-       diff_files_result = run_diff_files(&rev, 0);
+       run_diff_files(&rev, 0);
 
-       if (!diff_result_code(&rev.diffopt, diff_files_result)) {
+       if (!diff_result_code(&rev.diffopt)) {
                print_status(flags, ' ', path, ce_oid,
                             displaypath);
        } else if (!(flags & OPT_CACHED)) {
@@ -1141,7 +1139,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
        }
 
        if (diff_cmd == DIFF_INDEX)
-               run_diff_index(&rev, info->cached);
+               run_diff_index(&rev, info->cached ? DIFF_INDEX_CACHED : 0);
        else
                run_diff_files(&rev, 0);
        prepare_submodule_summary(info, &list);
@@ -2890,7 +2888,7 @@ cleanup:
 
 static int module_set_url(int argc, const char **argv, const char *prefix)
 {
-       int quiet = 0;
+       int quiet = 0, ret;
        const char *newurl;
        const char *path;
        char *config_name;
@@ -2902,20 +2900,29 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
                N_("git submodule set-url [--quiet] <path> <newurl>"),
                NULL
        };
+       const struct submodule *sub;
 
        argc = parse_options(argc, argv, prefix, options, usage, 0);
 
        if (argc != 2 || !(path = argv[0]) || !(newurl = argv[1]))
                usage_with_options(usage, options);
 
-       config_name = xstrfmt("submodule.%s.url", path);
+       sub = submodule_from_path(the_repository, null_oid(), path);
 
-       config_set_in_gitmodules_file_gently(config_name, newurl);
-       sync_submodule(path, prefix, NULL, quiet ? OPT_QUIET : 0);
+       if (!sub)
+               die(_("no submodule mapping found in .gitmodules for path '%s'"),
+                   path);
 
-       free(config_name);
+       config_name = xstrfmt("submodule.%s.url", sub->name);
+       ret = config_set_in_gitmodules_file_gently(config_name, newurl);
 
-       return 0;
+       if (!ret) {
+               repo_read_gitmodules(the_repository, 0);
+               sync_submodule(sub->path, prefix, NULL, quiet ? OPT_QUIET : 0);
+       }
+
+       free(config_name);
+       return !!ret;
 }
 
 static int module_set_branch(int argc, const char **argv, const char *prefix)
@@ -2942,6 +2949,7 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
                N_("git submodule set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
                NULL
        };
+       const struct submodule *sub;
 
        argc = parse_options(argc, argv, prefix, options, usage, 0);
 
@@ -2954,7 +2962,13 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
        if (argc != 1 || !(path = argv[0]))
                usage_with_options(usage, options);
 
-       config_name = xstrfmt("submodule.%s.branch", path);
+       sub = submodule_from_path(the_repository, null_oid(), path);
+
+       if (!sub)
+               die(_("no submodule mapping found in .gitmodules for path '%s'"),
+                   path);
+
+       config_name = xstrfmt("submodule.%s.branch", sub->name);
        ret = config_set_in_gitmodules_file_gently(config_name, opt_branch);
 
        free(config_name);
index 8c4bc28952c22d8587875171e6d3406b95e27b55..e2ff749832c282dc12ce6c5accf6389775d846d2 100644 (file)
@@ -18,7 +18,6 @@
 #include "object-store-ll.h"
 #include "path.h"
 #include "tag.h"
-#include "run-command.h"
 #include "parse-options.h"
 #include "diff.h"
 #include "revision.h"
@@ -45,18 +44,11 @@ static const char * const git_tag_usage[] = {
 static unsigned int colopts;
 static int force_sign_annotate;
 static int config_sign_tag = -1; /* unspecified */
-static int omit_empty = 0;
 
 static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
                     struct ref_format *format)
 {
-       struct ref_array array;
-       struct strbuf output = STRBUF_INIT;
-       struct strbuf err = STRBUF_INIT;
        char *to_free = NULL;
-       int i;
-
-       memset(&array, 0, sizeof(array));
 
        if (filter->lines == -1)
                filter->lines = 0;
@@ -74,23 +66,8 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
        if (verify_ref_format(format))
                die(_("unable to parse format string"));
        filter->with_commit_tag_algo = 1;
-       filter_refs(&array, filter, FILTER_REFS_TAGS);
-       filter_ahead_behind(the_repository, format, &array);
-       ref_array_sort(sorting, &array);
-
-       for (i = 0; i < array.nr; i++) {
-               strbuf_reset(&output);
-               strbuf_reset(&err);
-               if (format_ref_array_item(array.items[i], format, &output, &err))
-                       die("%s", err.buf);
-               fwrite(output.buf, 1, output.len, stdout);
-               if (output.len || !omit_empty)
-                       putchar('\n');
-       }
+       filter_and_format_refs(filter, FILTER_REFS_TAGS, sorting, format);
 
-       strbuf_release(&err);
-       strbuf_release(&output);
-       ref_array_clear(&array);
        free(to_free);
 
        return 0;
@@ -518,7 +495,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                OPT_WITHOUT(&filter.no_commit, N_("print only tags that don't contain the commit")),
                OPT_MERGED(&filter, N_("print only tags that are merged")),
                OPT_NO_MERGED(&filter, N_("print only tags that are not merged")),
-               OPT_BOOL(0, "omit-empty",  &omit_empty,
+               OPT_BOOL(0, "omit-empty",  &format.array_opts.omit_empty,
                        N_("do not output a newline after empty formatted refs")),
                OPT_REF_SORT(&sorting_options),
                {
@@ -538,7 +515,13 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
        setup_ref_filter_porcelain_msg();
 
+       /*
+        * Try to set sort keys from config. If config does not set any,
+        * fall back on default (refname) sorting.
+        */
        git_config(git_tag_config, &sorting_options);
+       if (!sorting_options.nr)
+               string_list_append(&sorting_options, "refname");
 
        memset(&opt, 0, sizeof(opt));
        filter.lines = -1;
@@ -584,7 +567,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                        struct column_options copts;
                        memset(&copts, 0, sizeof(copts));
                        copts.padding = 2;
-                       run_column_filter(colopts, &copts);
+                       if (run_column_filter(colopts, &copts))
+                               die(_("could not start 'git column'"));
                }
                filter.name_patterns = argv;
                ret = list_tags(&filter, sorting, &format);
index 32505255a0097b84080dd8af37454aeb01ee8001..f1c85a00ae9bb6586527a845c302cba47c4c8daf 100644 (file)
 #include "delta.h"
 #include "pack.h"
 #include "blob.h"
-#include "commit.h"
 #include "replace-object.h"
 #include "strbuf.h"
-#include "tag.h"
-#include "tree.h"
-#include "tree-walk.h"
 #include "progress.h"
 #include "decorate.h"
 #include "fsck.h"
@@ -609,6 +605,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
 {
        int i;
        struct object_id oid;
+       git_hash_ctx tmp_ctx;
 
        disable_replace_refs();
 
@@ -669,7 +666,9 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
        the_hash_algo->init_fn(&ctx);
        unpack_all();
        the_hash_algo->update_fn(&ctx, buffer, offset);
-       the_hash_algo->final_oid_fn(&oid, &ctx);
+       the_hash_algo->init_fn(&tmp_ctx);
+       the_hash_algo->clone_fn(&tmp_ctx, &ctx);
+       the_hash_algo->final_oid_fn(&oid, &tmp_ctx);
        if (strict) {
                write_rest();
                if (fsck_finish(&fsck_options))
@@ -680,13 +679,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
        use(the_hash_algo->rawsz);
 
        /* Write the last part of the buffer to stdout */
-       while (len) {
-               int ret = xwrite(1, buffer + offset, len);
-               if (ret <= 0)
-                       break;
-               len -= ret;
-               offset += ret;
-       }
+       write_in_full(1, buffer + offset, len);
 
        /* All done */
        return has_errors;
index aee3cb8cbd3a03cedaf0c3e317e8c860049dbb74..7bcaa1476c0fd5233475cac56a22db8c7714a570 100644 (file)
@@ -609,9 +609,6 @@ static const char * const update_index_usage[] = {
        NULL
 };
 
-static struct object_id head_oid;
-static struct object_id merge_head_oid;
-
 static struct cache_entry *read_one_ent(const char *which,
                                        struct object_id *ent, const char *path,
                                        int namelen, int stage)
@@ -642,84 +639,17 @@ static struct cache_entry *read_one_ent(const char *which,
 
 static int unresolve_one(const char *path)
 {
-       int namelen = strlen(path);
-       int pos;
-       int ret = 0;
-       struct cache_entry *ce_2 = NULL, *ce_3 = NULL;
-
-       /* See if there is such entry in the index. */
-       pos = index_name_pos(&the_index, path, namelen);
-       if (0 <= pos) {
-               /* already merged */
-               pos = unmerge_index_entry_at(&the_index, pos);
-               if (pos < the_index.cache_nr) {
-                       const struct cache_entry *ce = the_index.cache[pos];
-                       if (ce_stage(ce) &&
-                           ce_namelen(ce) == namelen &&
-                           !memcmp(ce->name, path, namelen))
-                               return 0;
-               }
-               /* no resolve-undo information; fall back */
-       } else {
-               /* If there isn't, either it is unmerged, or
-                * resolved as "removed" by mistake.  We do not
-                * want to do anything in the former case.
-                */
-               pos = -pos-1;
-               if (pos < the_index.cache_nr) {
-                       const struct cache_entry *ce = the_index.cache[pos];
-                       if (ce_namelen(ce) == namelen &&
-                           !memcmp(ce->name, path, namelen)) {
-                               fprintf(stderr,
-                                       "%s: skipping still unmerged path.\n",
-                                       path);
-                               goto free_return;
-                       }
-               }
-       }
-
-       /* Grab blobs from given path from HEAD and MERGE_HEAD,
-        * stuff HEAD version in stage #2,
-        * stuff MERGE_HEAD version in stage #3.
-        */
-       ce_2 = read_one_ent("our", &head_oid, path, namelen, 2);
-       ce_3 = read_one_ent("their", &merge_head_oid, path, namelen, 3);
-
-       if (!ce_2 || !ce_3) {
-               ret = -1;
-               goto free_return;
-       }
-       if (oideq(&ce_2->oid, &ce_3->oid) &&
-           ce_2->ce_mode == ce_3->ce_mode) {
-               fprintf(stderr, "%s: identical in both, skipping.\n",
-                       path);
-               goto free_return;
-       }
-
-       remove_file_from_index(&the_index, path);
-       if (add_index_entry(&the_index, ce_2, ADD_CACHE_OK_TO_ADD)) {
-               error("%s: cannot add our version to the index.", path);
-               ret = -1;
-               goto free_return;
-       }
-       if (!add_index_entry(&the_index, ce_3, ADD_CACHE_OK_TO_ADD))
-               return 0;
-       error("%s: cannot add their version to the index.", path);
-       ret = -1;
- free_return:
-       discard_cache_entry(ce_2);
-       discard_cache_entry(ce_3);
-       return ret;
-}
-
-static void read_head_pointers(void)
-{
-       if (read_ref("HEAD", &head_oid))
-               die("No HEAD -- no initial commit yet?");
-       if (read_ref("MERGE_HEAD", &merge_head_oid)) {
-               fprintf(stderr, "Not in the middle of a merge.\n");
-               exit(0);
-       }
+       struct string_list_item *item;
+       int res = 0;
+
+       if (!the_index.resolve_undo)
+               return res;
+       item = string_list_lookup(the_index.resolve_undo, path);
+       if (!item)
+               return res; /* no resolve-undo record for the path */
+       res = unmerge_index_entry(&the_index, path, item->util, 0);
+       FREE_AND_NULL(item->util);
+       return res;
 }
 
 static int do_unresolve(int ac, const char **av,
@@ -728,11 +658,6 @@ static int do_unresolve(int ac, const char **av,
        int i;
        int err = 0;
 
-       /* Read HEAD and MERGE_HEAD; if MERGE_HEAD does not exist, we
-        * are not doing a merge, so exit with success status.
-        */
-       read_head_pointers();
-
        for (i = 1; i < ac; i++) {
                const char *arg = av[i];
                char *p = prefix_path(prefix, prefix_length, arg);
@@ -751,6 +676,7 @@ static int do_reupdate(const char **paths,
        int pos;
        int has_head = 1;
        struct pathspec pathspec;
+       struct object_id head_oid;
 
        parse_pathspec(&pathspec, 0,
                       PATHSPEC_PREFER_CWD,
@@ -856,7 +782,7 @@ static int chmod_callback(const struct option *opt,
        return 0;
 }
 
-static int resolve_undo_clear_callback(const struct option *opt,
+static int resolve_undo_clear_callback(const struct option *opt UNUSED,
                                const char *arg, int unset)
 {
        BUG_ON_OPT_NEG(unset);
@@ -890,7 +816,7 @@ static int parse_new_style_cacheinfo(const char *arg,
 }
 
 static enum parse_opt_result cacheinfo_callback(
-       struct parse_opt_ctx_t *ctx, const struct option *opt,
+       struct parse_opt_ctx_t *ctx, const struct option *opt UNUSED,
        const char *arg, int unset)
 {
        struct object_id oid;
@@ -1090,6 +1016,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                        resolve_undo_clear_callback),
                OPT_INTEGER(0, "index-version", &preferred_index_format,
                        N_("write index in this format")),
+               OPT_SET_INT(0, "show-index-version", &preferred_index_format,
+                           N_("report on-disk index format version"), -1),
                OPT_BOOL(0, "split-index", &split_index,
                        N_("enable or disable split index")),
                OPT_BOOL(0, "untracked-cache", &untracked_cache,
@@ -1182,15 +1110,20 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 
        getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
        if (preferred_index_format) {
-               if (preferred_index_format < INDEX_FORMAT_LB ||
-                   INDEX_FORMAT_UB < preferred_index_format)
+               if (preferred_index_format < 0) {
+                       printf(_("%d\n"), the_index.version);
+               } else if (preferred_index_format < INDEX_FORMAT_LB ||
+                          INDEX_FORMAT_UB < preferred_index_format) {
                        die("index-version %d not in range: %d..%d",
                            preferred_index_format,
                            INDEX_FORMAT_LB, INDEX_FORMAT_UB);
-
-               if (the_index.version != preferred_index_format)
-                       the_index.cache_changed |= SOMETHING_CHANGED;
-               the_index.version = preferred_index_format;
+               } else {
+                       if (the_index.version != preferred_index_format)
+                               the_index.cache_changed |= SOMETHING_CHANGED;
+                       report(_("index-version: was %d, set to %d"),
+                              the_index.version, preferred_index_format);
+                       the_index.version = preferred_index_format;
+               }
        }
 
        if (read_from_stdin) {
index 242102273eea02a096e7d4c31b5110d592f5d6af..61338a01ecfc0ee4f029215149651bb9ac03da1e 100644 (file)
@@ -7,7 +7,6 @@
 #include "parse-options.h"
 #include "quote.h"
 #include "repository.h"
-#include "strvec.h"
 
 static const char * const git_update_ref_usage[] = {
        N_("git update-ref [<options>] -d <refname> [<old-val>]"),
@@ -311,8 +310,8 @@ static void report_ok(const char *command)
        fflush(stdout);
 }
 
-static void parse_cmd_option(struct ref_transaction *transaction,
-                            const char *next, const char *end)
+static void parse_cmd_option(struct ref_transaction *transaction UNUSED,
+                            const char *next, const char *end UNUSED)
 {
        const char *rest;
        if (skip_prefix(next, "no-deref", &rest) && *rest == line_termination)
@@ -321,8 +320,8 @@ static void parse_cmd_option(struct ref_transaction *transaction,
                die("option unknown: %s", next);
 }
 
-static void parse_cmd_start(struct ref_transaction *transaction,
-                           const char *next, const char *end)
+static void parse_cmd_start(struct ref_transaction *transaction UNUSED,
+                           const char *next, const char *end UNUSED)
 {
        if (*next != line_termination)
                die("start: extra input: %s", next);
@@ -330,7 +329,7 @@ static void parse_cmd_start(struct ref_transaction *transaction,
 }
 
 static void parse_cmd_prepare(struct ref_transaction *transaction,
-                             const char *next, const char *end)
+                             const char *next, const char *end UNUSED)
 {
        struct strbuf error = STRBUF_INIT;
        if (*next != line_termination)
@@ -341,7 +340,7 @@ static void parse_cmd_prepare(struct ref_transaction *transaction,
 }
 
 static void parse_cmd_abort(struct ref_transaction *transaction,
-                           const char *next, const char *end)
+                           const char *next, const char *end UNUSED)
 {
        struct strbuf error = STRBUF_INIT;
        if (*next != line_termination)
@@ -352,7 +351,7 @@ static void parse_cmd_abort(struct ref_transaction *transaction,
 }
 
 static void parse_cmd_commit(struct ref_transaction *transaction,
-                            const char *next, const char *end)
+                            const char *next, const char *end UNUSED)
 {
        struct strbuf error = STRBUF_INIT;
        if (*next != line_termination)
index 9b021ef026c28c97ece12b924833dff87c15a103..15afb97260165bc51cc85bae59b08afb37bfc6a6 100644 (file)
@@ -8,6 +8,7 @@
 #include "replace-object.h"
 #include "upload-pack.h"
 #include "serve.h"
+#include "commit.h"
 
 static const char * const upload_pack_usage[] = {
        N_("git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
@@ -37,6 +38,7 @@ int cmd_upload_pack(int argc, const char **argv, const char *prefix)
 
        packet_trace_identity("upload-pack");
        disable_replace_refs();
+       save_commit_buffer = 0;
 
        argc = parse_options(argc, argv, prefix, options, upload_pack_usage, 0);
 
index 74161bdf1c61b5248150bac284898e3c03c79111..cf5567208a277a62b872a1846919060fb6e276c3 100644 (file)
@@ -66,7 +66,7 @@ static char *git_attr_val_system(int ident_flag UNUSED)
 
 static char *git_attr_val_global(int ident_flag UNUSED)
 {
-       char *file = xstrdup(git_attr_global_file());
+       char *file = xstrdup_or_null(git_attr_global_file());
        if (file) {
                normalize_path_copy(file, file);
                return file;
@@ -90,7 +90,7 @@ static char *git_config_val_global(int ident_flag UNUSED)
        char *user, *xdg;
        size_t unused;
 
-       git_global_config(&user, &xdg);
+       git_global_config_paths(&user, &xdg);
        if (xdg && *xdg) {
                normalize_path_copy(xdg, xdg);
                strbuf_addf(&buf, "%s\n", xdg);
index 9680b5870130615b7b4432a5ce456279db750aa4..0d2b9aea2aedca39b18d15bc7a8719669d63f1d3 100644 (file)
@@ -9,10 +9,8 @@
 #include "config.h"
 #include "gettext.h"
 #include "object-name.h"
-#include "object-store-ll.h"
 #include "repository.h"
 #include "commit.h"
-#include "run-command.h"
 #include "parse-options.h"
 #include "gpg-interface.h"
 
index d8753270ebee4df6eed4b2dd5037f3fee97eb2c6..c731e2f87b4ee35e4910e3a8c11e18b8e68e58c1 100644 (file)
@@ -9,7 +9,6 @@
 #include "config.h"
 #include "gettext.h"
 #include "tag.h"
-#include "run-command.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "gpg-interface.h"
index 4cd01842de79fb43b842032eeffb1a181f788c6e..9c76b62b02da037db84ef633100cc6d9136eb0cf 100644 (file)
        _("No possible source branch, inferring '--orphan'")
 
 #define WORKTREE_ADD_ORPHAN_WITH_DASH_B_HINT_TEXT \
-       _("If you meant to create a worktree containing a new orphan branch\n" \
+       _("If you meant to create a worktree containing a new unborn branch\n" \
        "(branch with no commits) for this repository, you can do so\n" \
        "using the --orphan flag:\n" \
        "\n" \
        "    git worktree add --orphan -b %s %s\n")
 
 #define WORKTREE_ADD_ORPHAN_NO_DASH_B_HINT_TEXT \
-       _("If you meant to create a worktree containing a new orphan branch\n" \
+       _("If you meant to create a worktree containing a new unborn branch\n" \
        "(branch with no commits) for this repository, you can do so\n" \
        "using the --orphan flag:\n" \
        "\n" \
@@ -416,7 +416,6 @@ static int add_worktree(const char *path, const char *refname,
        struct strbuf sb_git = STRBUF_INIT, sb_repo = STRBUF_INIT;
        struct strbuf sb = STRBUF_INIT, realpath = STRBUF_INIT;
        const char *name;
-       struct child_process cp = CHILD_PROCESS_INIT;
        struct strvec child_env = STRVEC_INIT;
        unsigned int counter = 0;
        int len, ret;
@@ -424,7 +423,8 @@ static int add_worktree(const char *path, const char *refname,
        struct commit *commit = NULL;
        int is_branch = 0;
        struct strbuf sb_name = STRBUF_INIT;
-       struct worktree **worktrees;
+       struct worktree **worktrees, *wt = NULL;
+       struct ref_store *wt_refs;
 
        worktrees = get_worktrees();
        check_candidate_path(path, opts->force, worktrees, "add");
@@ -495,20 +495,32 @@ static int add_worktree(const char *path, const char *refname,
        strbuf_realpath(&realpath, get_git_common_dir(), 1);
        write_file(sb_git.buf, "gitdir: %s/worktrees/%s",
                   realpath.buf, name);
-       /*
-        * This is to keep resolve_ref() happy. We need a valid HEAD
-        * or is_git_directory() will reject the directory. Any value which
-        * looks like an object ID will do since it will be immediately
-        * replaced by the symbolic-ref or update-ref invocation in the new
-        * worktree.
-        */
-       strbuf_reset(&sb);
-       strbuf_addf(&sb, "%s/HEAD", sb_repo.buf);
-       write_file(sb.buf, "%s", oid_to_hex(null_oid()));
        strbuf_reset(&sb);
        strbuf_addf(&sb, "%s/commondir", sb_repo.buf);
        write_file(sb.buf, "../..");
 
+       /*
+        * Set up the ref store of the worktree and create the HEAD reference.
+        */
+       wt = get_linked_worktree(name, 1);
+       if (!wt) {
+               ret = error(_("could not find created worktree '%s'"), name);
+               goto done;
+       }
+       wt_refs = get_worktree_ref_store(wt);
+
+       ret = refs_init_db(wt_refs, REFS_INIT_DB_IS_WORKTREE, &sb);
+       if (ret)
+               goto done;
+
+       if (!is_branch && commit)
+               ret = refs_update_ref(wt_refs, NULL, "HEAD", &commit->object.oid,
+                                     NULL, 0, UPDATE_REFS_MSG_ON_ERR);
+       else
+               ret = refs_create_symref(wt_refs, "HEAD", symref.buf, NULL);
+       if (ret)
+               goto done;
+
        /*
         * If the current worktree has sparse-checkout enabled, then copy
         * the sparse-checkout patterns from the current worktree.
@@ -526,22 +538,6 @@ static int add_worktree(const char *path, const char *refname,
 
        strvec_pushf(&child_env, "%s=%s", GIT_DIR_ENVIRONMENT, sb_git.buf);
        strvec_pushf(&child_env, "%s=%s", GIT_WORK_TREE_ENVIRONMENT, path);
-       cp.git_cmd = 1;
-
-       if (!is_branch && commit) {
-               strvec_pushl(&cp.args, "update-ref", "HEAD",
-                            oid_to_hex(&commit->object.oid), NULL);
-       } else {
-               strvec_pushl(&cp.args, "symbolic-ref", "HEAD",
-                            symref.buf, NULL);
-               if (opts->quiet)
-                       strvec_push(&cp.args, "--quiet");
-       }
-
-       strvec_pushv(&cp.env, child_env.v);
-       ret = run_command(&cp);
-       if (ret)
-               goto done;
 
        if (opts->orphan &&
            (ret = make_worktree_orphan(refname, opts, &child_env)))
@@ -587,6 +583,7 @@ done:
        strbuf_release(&sb_git);
        strbuf_release(&sb_name);
        strbuf_release(&realpath);
+       free_worktree(wt);
        return ret;
 }
 
@@ -628,10 +625,10 @@ static void print_preparing_worktree_line(int detach,
  *
  * Returns 0 on failure and non-zero on success.
  */
-static int first_valid_ref(const char *refname,
-                          const struct object_id *oid,
-                          int flags,
-                          void *cb_data)
+static int first_valid_ref(const char *refname UNUSED,
+                          const struct object_id *oid UNUSED,
+                          int flags UNUSED,
+                          void *cb_data UNUSED)
 {
        return 1;
 }
@@ -696,7 +693,7 @@ static int can_use_remote_refs(const struct add_opts *opts)
                return 1;
        } else if (!opts->force && remote_get(NULL)) {
                die(_("No local or remote refs exist despite at least one remote\n"
-                     "present, stopping; use 'add -f' to overide or fetch a remote first"));
+                     "present, stopping; use 'add -f' to override or fetch a remote first"));
        }
        return 0;
 }
@@ -730,11 +727,11 @@ static int dwim_orphan(const struct add_opts *opts, int opt_track, int remote)
        }
 
        if (opt_track) {
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   "--track");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--track");
        } else if (!opts->checkout) {
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   "--no-checkout");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--no-checkout");
        }
        return 1;
 }
@@ -784,7 +781,7 @@ static int add(int ac, const char **av, const char *prefix)
                           N_("create a new branch")),
                OPT_STRING('B', NULL, &new_branch_force, N_("branch"),
                           N_("create or reset a branch")),
-               OPT_BOOL(0, "orphan", &opts.orphan, N_("create unborn/orphaned branch")),
+               OPT_BOOL(0, "orphan", &opts.orphan, N_("create unborn branch")),
                OPT_BOOL('d', "detach", &opts.detach, N_("detach HEAD at named commit")),
                OPT_BOOL(0, "checkout", &opts.checkout, N_("populate the new working tree")),
                OPT_BOOL(0, "lock", &keep_locked, N_("keep the new working tree locked")),
@@ -806,16 +803,17 @@ static int add(int ac, const char **av, const char *prefix)
        if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
                die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach");
        if (opts.detach && opts.orphan)
-               die(_("options '%s', and '%s' cannot be used together"),
+               die(_("options '%s' and '%s' cannot be used together"),
                    "--orphan", "--detach");
        if (opts.orphan && opt_track)
-               die(_("'%s' and '%s' cannot be used together"), "--orphan", "--track");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--track");
        if (opts.orphan && !opts.checkout)
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   "--no-checkout");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--no-checkout");
        if (opts.orphan && ac == 2)
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   _("<commit-ish>"));
+               die(_("option '%s' and commit-ish cannot be used together"),
+                   "--orphan");
        if (lock_reason && !keep_locked)
                die(_("the option '%s' requires '%s'"), "--reason", "--lock");
        if (lock_reason)
@@ -850,21 +848,21 @@ static int add(int ac, const char **av, const char *prefix)
                const char *s = worktree_basename(path, &n);
                new_branch = xstrndup(s, n);
        } else if (opts.orphan) {
-               // No-op
+               ; /* no-op */
        } else if (opts.detach) {
-               // Check HEAD
+               /* Check HEAD */
                if (!strcmp(branch, "HEAD"))
                        can_use_local_refs(&opts);
        } else if (ac < 2 && new_branch) {
-               // DWIM: Infer --orphan when repo has no refs.
+               /* DWIM: Infer --orphan when repo has no refs. */
                opts.orphan = dwim_orphan(&opts, !!opt_track, 0);
        } else if (ac < 2) {
-               // DWIM: Guess branch name from path.
+               /* DWIM: Guess branch name from path. */
                const char *s = dwim_branch(path, &new_branch);
                if (s)
                        branch = s;
 
-               // DWIM: Infer --orphan when repo has no refs.
+               /* DWIM: Infer --orphan when repo has no refs. */
                opts.orphan = (!s) && dwim_orphan(&opts, !!opt_track, 1);
        } else if (ac == 2) {
                struct object_id oid;
index 73bff3a23d27bb2d9b6825bceccc9912aa2c50ce..eb46b8863793e25b82ca6df27eb435476c4807a5 100644 (file)
@@ -11,7 +11,6 @@
 #include "csum-file.h"
 #include "pack.h"
 #include "strbuf.h"
-#include "string-list.h"
 #include "tmp-objdir.h"
 #include "packfile.h"
 #include "object-file.h"
@@ -155,10 +154,10 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id
  * status before calling us just in case we ask it to call us again
  * with a new pack.
  */
-static int stream_to_pack(struct bulk_checkin_packfile *state,
-                         git_hash_ctx *ctx, off_t *already_hashed_to,
-                         int fd, size_t size, enum object_type type,
-                         const char *path, unsigned flags)
+static int stream_blob_to_pack(struct bulk_checkin_packfile *state,
+                              git_hash_ctx *ctx, off_t *already_hashed_to,
+                              int fd, size_t size, const char *path,
+                              unsigned flags)
 {
        git_zstream s;
        unsigned char ibuf[16384];
@@ -170,7 +169,7 @@ static int stream_to_pack(struct bulk_checkin_packfile *state,
 
        git_deflate_init(&s, pack_compression_level);
 
-       hdrlen = encode_in_pack_object_header(obuf, sizeof(obuf), type, size);
+       hdrlen = encode_in_pack_object_header(obuf, sizeof(obuf), OBJ_BLOB, size);
        s.next_out = obuf + hdrlen;
        s.avail_out = sizeof(obuf) - hdrlen;
 
@@ -247,11 +246,10 @@ static void prepare_to_stream(struct bulk_checkin_packfile *state,
                die_errno("unable to write pack header");
 }
 
-static int deflate_to_pack(struct bulk_checkin_packfile *state,
-                          struct object_id *result_oid,
-                          int fd, size_t size,
-                          enum object_type type, const char *path,
-                          unsigned flags)
+static int deflate_blob_to_pack(struct bulk_checkin_packfile *state,
+                               struct object_id *result_oid,
+                               int fd, size_t size,
+                               const char *path, unsigned flags)
 {
        off_t seekback, already_hashed_to;
        git_hash_ctx ctx;
@@ -265,9 +263,10 @@ static int deflate_to_pack(struct bulk_checkin_packfile *state,
                return error("cannot find the current offset");
 
        header_len = format_object_header((char *)obuf, sizeof(obuf),
-                                         type, size);
+                                         OBJ_BLOB, size);
        the_hash_algo->init_fn(&ctx);
        the_hash_algo->update_fn(&ctx, obuf, header_len);
+       the_hash_algo->init_fn(&checkpoint.ctx);
 
        /* Note: idx is non-NULL when we are writing */
        if ((flags & HASH_WRITE_OBJECT) != 0)
@@ -282,8 +281,8 @@ static int deflate_to_pack(struct bulk_checkin_packfile *state,
                        idx->offset = state->offset;
                        crc32_begin(state->f);
                }
-               if (!stream_to_pack(state, &ctx, &already_hashed_to,
-                                   fd, size, type, path, flags))
+               if (!stream_blob_to_pack(state, &ctx, &already_hashed_to,
+                                        fd, size, path, flags))
                        break;
                /*
                 * Writing this object to the current pack will make
@@ -350,12 +349,12 @@ void fsync_loose_object_bulk_checkin(int fd, const char *filename)
        }
 }
 
-int index_bulk_checkin(struct object_id *oid,
-                      int fd, size_t size, enum object_type type,
-                      const char *path, unsigned flags)
+int index_blob_bulk_checkin(struct object_id *oid,
+                           int fd, size_t size,
+                           const char *path, unsigned flags)
 {
-       int status = deflate_to_pack(&bulk_checkin_packfile, oid, fd, size, type,
-                                    path, flags);
+       int status = deflate_blob_to_pack(&bulk_checkin_packfile, oid, fd, size,
+                                         path, flags);
        if (!odb_transaction_nesting)
                flush_bulk_checkin_packfile(&bulk_checkin_packfile);
        return status;
index 48fe9a6e9171e77aba4f2a3c7ab1edd79e9291b8..aa7286a7b3e127bbd4ee14cf99e3fd21f46df445 100644 (file)
@@ -9,9 +9,9 @@
 void prepare_loose_object_bulk_checkin(void);
 void fsync_loose_object_bulk_checkin(int fd, const char *filename);
 
-int index_bulk_checkin(struct object_id *oid,
-                      int fd, size_t size, enum object_type type,
-                      const char *path, unsigned flags);
+int index_blob_bulk_checkin(struct object_id *oid,
+                           int fd, size_t size,
+                           const char *path, unsigned flags);
 
 /*
  * Tell the object database to optimize for adding
index 4b5c49b93d28f080865e23688cc09a0d6dd7d70a..ca32050a78fd7570adea76db264c5600339caf82 100644 (file)
@@ -4,7 +4,6 @@
 #include "copy.h"
 #include "environment.h"
 #include "gettext.h"
-#include "object-store-ll.h"
 #include "refs.h"
 #include "run-command.h"
 #include "hashmap.h"
@@ -20,7 +19,7 @@ static struct {
        { BUNDLE_HEURISTIC_CREATIONTOKEN, "creationToken" },
 };
 
-static int compare_bundles(const void *hashmap_cmp_fn_data,
+static int compare_bundles(const void *hashmap_cmp_fn_data UNUSED,
                           const struct hashmap_entry *he1,
                           const struct hashmap_entry *he2,
                           const void *id)
@@ -45,7 +44,7 @@ void init_bundle_list(struct bundle_list *list)
 }
 
 static int clear_remote_bundle_info(struct remote_bundle_info *bundle,
-                                   void *data)
+                                   void *data UNUSED)
 {
        FREE_AND_NULL(bundle->id);
        FREE_AND_NULL(bundle->uri);
@@ -779,7 +778,7 @@ static int unbundle_all_bundles(struct repository *r,
        return 0;
 }
 
-static int unlink_bundle(struct remote_bundle_info *info, void *data)
+static int unlink_bundle(struct remote_bundle_info *info, void *data UNUSED)
 {
        if (info->file)
                unlink_or_warn(info->file);
index 334973a01ceee3ae4e99eb72120cc4f73153081c..387c0a3e5b7b8bfc895f380e8c3976fcf9b777d8 100644 (file)
@@ -11,7 +11,6 @@
 #include "read-cache-ll.h"
 #include "replace-object.h"
 #include "promisor-remote.h"
-#include "sparse-index.h"
 #include "trace.h"
 #include "trace2.h"
 
@@ -779,8 +778,8 @@ static void prime_cache_tree_rec(struct repository *r,
                        struct cache_tree_sub *sub;
                        struct tree *subtree = lookup_tree(r, &entry.oid);
 
-                       if (!subtree->object.parsed)
-                               parse_tree(subtree);
+                       if (parse_tree(subtree) < 0)
+                               exit(128);
                        sub = cache_tree_sub(it, entry.path);
                        sub->cache_tree = cache_tree();
 
index 140dfa0dcc4629fec59f723d025ec36019ff29eb..cdc7f39b7039b94a14a42ec74b0e27917c43fe4f 100644 (file)
@@ -102,7 +102,8 @@ int read_table_of_contents(struct chunkfile *cf,
                           const unsigned char *mfile,
                           size_t mfile_size,
                           uint64_t toc_offset,
-                          int toc_length)
+                          int toc_length,
+                          unsigned expected_alignment)
 {
        int i;
        uint32_t chunk_id;
@@ -120,6 +121,11 @@ int read_table_of_contents(struct chunkfile *cf,
                        error(_("terminating chunk id appears earlier than expected"));
                        return 1;
                }
+               if (chunk_offset % expected_alignment != 0) {
+                       error(_("chunk id %"PRIx32" not %d-byte aligned"),
+                             chunk_id, expected_alignment);
+                       return 1;
+               }
 
                table_of_contents += CHUNK_TOC_ENTRY_SIZE;
                next_chunk_offset = get_be64(table_of_contents + 4);
@@ -154,20 +160,28 @@ int read_table_of_contents(struct chunkfile *cf,
        return 0;
 }
 
+struct pair_chunk_data {
+       const unsigned char **p;
+       size_t *size;
+};
+
 static int pair_chunk_fn(const unsigned char *chunk_start,
                         size_t chunk_size,
                         void *data)
 {
-       const unsigned char **p = data;
-       *p = chunk_start;
+       struct pair_chunk_data *pcd = data;
+       *pcd->p = chunk_start;
+       *pcd->size = chunk_size;
        return 0;
 }
 
 int pair_chunk(struct chunkfile *cf,
               uint32_t chunk_id,
-              const unsigned char **p)
+              const unsigned char **p,
+              size_t *size)
 {
-       return read_chunk(cf, chunk_id, pair_chunk_fn, p);
+       struct pair_chunk_data pcd = { .p = p, .size = size };
+       return read_chunk(cf, chunk_id, pair_chunk_fn, &pcd);
 }
 
 int read_chunk(struct chunkfile *cf,
index c7794e84adda364bc0ad14a3d1d61467d73eaadd..14b76180ef768f6b5c38aa1cda128ab87d2327ae 100644 (file)
@@ -36,20 +36,23 @@ int read_table_of_contents(struct chunkfile *cf,
                           const unsigned char *mfile,
                           size_t mfile_size,
                           uint64_t toc_offset,
-                          int toc_length);
+                          int toc_length,
+                          unsigned expected_alignment);
 
 #define CHUNK_NOT_FOUND (-2)
 
 /*
  * Find 'chunk_id' in the given chunkfile and assign the
  * given pointer to the position in the mmap'd file where
- * that chunk begins.
+ * that chunk begins. Likewise the "size" parameter is filled
+ * with the size of the chunk.
  *
  * Returns CHUNK_NOT_FOUND if the chunk does not exist.
  */
 int pair_chunk(struct chunkfile *cf,
               uint32_t chunk_id,
-              const unsigned char **p);
+              const unsigned char **p,
+              size_t *size);
 
 typedef int (*chunk_read_fn)(const unsigned char *chunk_start,
                             size_t chunk_size, void *data);
diff --git a/ci/config/README b/ci/config/README
new file mode 100644 (file)
index 0000000..8de3a04
--- /dev/null
@@ -0,0 +1,14 @@
+You can configure some aspects of the GitHub Actions-based CI on a
+per-repository basis by setting "variables" and "secrets" from with the
+GitHub web interface. These can be found at:
+
+  https://github.com/<user>/git/settings/secrets/actions
+
+The following variables can be used:
+
+ - CI_BRANCHES
+
+   By default, CI is run when any branch is pushed. If this variable is
+   non-empty, then only the branches it lists will run CI. Branch names
+   should be separated by spaces, and should use their shortened form
+   (e.g., "main", not "refs/heads/main").
diff --git a/ci/config/allow-ref.sample b/ci/config/allow-ref.sample
deleted file mode 100755 (executable)
index af0e076..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-#
-# Sample script for enabling/disabling GitHub Actions CI runs on
-# particular refs. By default, CI is run for all branches pushed to
-# GitHub. You can override this by dropping the ".sample" from the script,
-# editing it, committing, and pushing the result to the "ci-config" branch of
-# your repository:
-#
-#   git checkout -b ci-config
-#   cp allow-ref.sample allow-ref
-#   $EDITOR allow-ref
-#   git add allow-ref
-#   git commit -am "implement my ci preferences"
-#   git push
-#
-# This script will then be run when any refs are pushed to that repository. It
-# gets the fully qualified refname as the first argument, and should exit with
-# success only for refs for which you want to run CI.
-
-case "$1" in
-# allow one-off tests by pushing to "for-ci" or "for-ci/mybranch"
-refs/heads/for-ci*) true ;;
-# always build your integration branch
-refs/heads/my-integration-branch) true ;;
-# don't build any other branches or tags
-*) false ;;
-esac
index 4f407530d3057552177883ad6b088f0a65b37b9a..b4e22de3cb9c351098cc57105c12e6242d1a4384 100755 (executable)
@@ -37,15 +37,13 @@ macos-*)
        test -z "$BREW_INSTALL_PACKAGES" ||
        brew install $BREW_INSTALL_PACKAGES
        brew link --force gettext
-       mkdir -p $HOME/bin
-       (
-               cd $HOME/bin
+
+       mkdir -p "$P4_PATH"
+       pushd "$P4_PATH"
                wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
                tar -xf helix-core-server.tgz &&
                sudo xattr -d com.apple.quarantine p4 p4d 2>/dev/null || true
-       )
-       PATH="$PATH:${HOME}/bin"
-       export PATH
+       popd
 
        if test -n "$CC_PACKAGE"
        then
index 78b7e326da6d8b6b3d1923007d3f22dea9814b8d..eb2c9e1eca73d3beb19ad0d20087f50af13fc62a 100755 (executable)
@@ -3,6 +3,10 @@
 # Install dependencies required to build and test Git inside container
 #
 
+. ${0%/*}/lib.sh
+
+begin_group "Install dependencies"
+
 case "$jobname" in
 linux32)
        linux32 --32bit i386 sh -c '
@@ -12,11 +16,31 @@ linux32)
        '
        ;;
 linux-musl)
-       apk add --update build-base curl-dev openssl-dev expat-dev gettext \
-               pcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null
+       apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
+               pcre2-dev python3 musl-libintl perl-utils ncurses \
+               apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
+               bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
+       ;;
+linux-*|StaticAnalysis)
+       # Required so that apt doesn't wait for user input on certain packages.
+       export DEBIAN_FRONTEND=noninteractive
+
+       apt update -q &&
+       apt install -q -y sudo git make language-pack-is libsvn-perl apache2 libssl-dev \
+               libcurl4-openssl-dev libexpat-dev tcl tk gettext zlib1g-dev \
+               perl-modules liberror-perl libauthen-sasl-perl libemail-valid-perl \
+               libdbd-sqlite3-perl libio-socket-ssl-perl libnet-smtp-ssl-perl ${CC_PACKAGE:-${CC:-gcc}} \
+               apache2 cvs cvsps gnupg libcgi-pm-perl subversion
+
+       if test "$jobname" = StaticAnalysis
+       then
+               apt install -q -y coccinelle
+       fi
        ;;
 pedantic)
        dnf -yq update >/dev/null &&
        dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
        ;;
 esac
+
+end_group "Install dependencies"
index 369d462f1306fbca89442df9be35925ccc272489..0a73fc7bd1c2036afc3b7b9df169746133a8b537 100755 (executable)
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -1,16 +1,7 @@
 # Library of functions shared by all CI scripts
 
-if test true != "$GITHUB_ACTIONS"
+if test true = "$GITHUB_ACTIONS"
 then
-       begin_group () { :; }
-       end_group () { :; }
-
-       group () {
-               shift
-               "$@"
-       }
-       set -x
-else
        begin_group () {
                need_to_end_group=t
                echo "::group::$1" >&2
@@ -23,27 +14,50 @@ else
                need_to_end_group=
                echo '::endgroup::' >&2
        }
-       trap end_group EXIT
+elif test true = "$GITLAB_CI"
+then
+       begin_group () {
+               need_to_end_group=t
+               printf "\e[0Ksection_start:$(date +%s):$(echo "$1" | tr ' ' _)\r\e[0K$1\n"
+               trap "end_group '$1'" EXIT
+               set -x
+       }
 
-       group () {
+       end_group () {
+               test -n "$need_to_end_group" || return 0
                set +x
-               begin_group "$1"
-               shift
-               # work around `dash` not supporting `set -o pipefail`
-               (
-                       "$@" 2>&1
-                       echo $? >exit.status
-               ) |
-               sed 's/^\(\([^ ]*\):\([0-9]*\):\([0-9]*:\) \)\(error\|warning\): /::\5 file=\2,line=\3::\1/'
-               res=$(cat exit.status)
-               rm exit.status
-               end_group
-               return $res
+               need_to_end_group=
+               printf "\e[0Ksection_end:$(date +%s):$(echo "$1" | tr ' ' _)\r\e[0K\n"
+               trap - EXIT
        }
+else
+       begin_group () { :; }
+       end_group () { :; }
 
-       begin_group "CI setup"
+       set -x
 fi
 
+group () {
+       group="$1"
+       shift
+       begin_group "$group"
+
+       # work around `dash` not supporting `set -o pipefail`
+       (
+               "$@" 2>&1
+               echo $? >exit.status
+       ) |
+       sed 's/^\(\([^ ]*\):\([0-9]*\):\([0-9]*:\) \)\(error\|warning\): /::\5 file=\2,line=\3::\1/'
+       res=$(cat exit.status)
+       rm exit.status
+
+       end_group "$group"
+       return $res
+}
+
+begin_group "CI setup"
+trap "end_group 'CI setup'" EXIT
+
 # Set 'exit on error' for all CI scripts to let the caller know that
 # something went wrong.
 #
@@ -71,10 +85,32 @@ skip_branch_tip_with_tag () {
        fi
 }
 
+# Check whether we can use the path passed via the first argument as Git
+# repository.
+is_usable_git_repository () {
+       # We require Git in our PATH, otherwise we cannot access repositories
+       # at all.
+       if ! command -v git >/dev/null
+       then
+               return 1
+       fi
+
+       # And the target directory needs to be a proper Git repository.
+       if ! git -C "$1" rev-parse 2>/dev/null
+       then
+               return 1
+       fi
+}
+
 # Save some info about the current commit's tree, so we can skip the build
 # job if we encounter the same tree again and can provide a useful info
 # message.
 save_good_tree () {
+       if ! is_usable_git_repository .
+       then
+               return
+       fi
+
        echo "$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID" >>"$good_trees_file"
        # limit the file size
        tail -1000 "$good_trees_file" >"$good_trees_file".tmp
@@ -90,6 +126,11 @@ skip_good_tree () {
                return
        fi
 
+       if ! is_usable_git_repository .
+       then
+               return
+       fi
+
        if ! good_tree_info="$(grep "^$(git rev-parse $CI_COMMIT^{tree}) " "$good_trees_file")"
        then
                # Haven't seen this tree yet, or no cached good trees file yet.
@@ -121,6 +162,11 @@ skip_good_tree () {
 }
 
 check_unignored_build_artifacts () {
+       if ! is_usable_git_repository .
+       then
+               return
+       fi
+
        ! git ls-files --other --exclude-standard --error-unmatch \
                -- ':/*' 2>/dev/null ||
        {
@@ -133,6 +179,26 @@ handle_failed_tests () {
        return 1
 }
 
+create_failed_test_artifacts () {
+       mkdir -p t/failed-test-artifacts
+
+       for test_exit in t/test-results/*.exit
+       do
+               test 0 != "$(cat "$test_exit")" || continue
+
+               test_name="${test_exit%.exit}"
+               test_name="${test_name##*/}"
+               printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
+               echo "The full logs are in the 'print test failures' step below."
+               echo "See also the 'failed-tests-*' artifacts attached to this run."
+               cat "t/test-results/$test_name.markup"
+
+               trash_dir="t/trash directory.$test_name"
+               cp "t/test-results/$test_name.out" t/failed-test-artifacts/
+               tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
+       done
+}
+
 # GitHub Action doesn't set TERM, which is required by tput
 export TERM=${TERM:-dumb}
 
@@ -156,11 +222,8 @@ then
        # among *all* phases)
        cache_dir="$HOME/test-cache/$SYSTEM_PHASENAME"
 
-       export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
-       export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
-       MAKEFLAGS="$MAKEFLAGS --jobs=10"
-       test windows_nt != "$CI_OS_NAME" ||
-       GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
+       GIT_TEST_OPTS="--write-junit-xml"
+       JOBS=10
 elif test true = "$GITHUB_ACTIONS"
 then
        CI_TYPE=github-actions
@@ -173,40 +236,70 @@ then
        CC="${CC_PACKAGE:-${CC:-gcc}}"
        DONT_SKIP_TAGS=t
        handle_failed_tests () {
-               mkdir -p t/failed-test-artifacts
                echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
+               create_failed_test_artifacts
+               return 1
+       }
+
+       cache_dir="$HOME/none"
 
-               for test_exit in t/test-results/*.exit
-               do
-                       test 0 != "$(cat "$test_exit")" || continue
-
-                       test_name="${test_exit%.exit}"
-                       test_name="${test_name##*/}"
-                       printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
-                       echo "The full logs are in the 'print test failures' step below."
-                       echo "See also the 'failed-tests-*' artifacts attached to this run."
-                       cat "t/test-results/$test_name.markup"
-
-                       trash_dir="t/trash directory.$test_name"
-                       cp "t/test-results/$test_name.out" t/failed-test-artifacts/
-                       tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
-               done
+       GIT_TEST_OPTS="--github-workflow-markup"
+       JOBS=10
+elif test true = "$GITLAB_CI"
+then
+       CI_TYPE=gitlab-ci
+       CI_BRANCH="$CI_COMMIT_REF_NAME"
+       CI_COMMIT="$CI_COMMIT_SHA"
+       case "$CI_JOB_IMAGE" in
+       macos-*)
+               # GitLab CI has Python installed via multiple package managers,
+               # most notably via asdf and Homebrew. Ensure that our builds
+               # pick up the Homebrew one by prepending it to our PATH as the
+               # asdf one breaks tests.
+               export PATH="$(brew --prefix)/bin:$PATH"
+
+               CI_OS_NAME=osx
+               ;;
+       alpine:*|fedora:*|ubuntu:*)
+               CI_OS_NAME=linux;;
+       *)
+               echo "Could not identify OS image" >&2
+               env >&2
+               exit 1
+               ;;
+       esac
+       CI_REPO_SLUG="$CI_PROJECT_PATH"
+       CI_JOB_ID="$CI_JOB_ID"
+       CC="${CC_PACKAGE:-${CC:-gcc}}"
+       DONT_SKIP_TAGS=t
+       handle_failed_tests () {
+               create_failed_test_artifacts
                return 1
        }
 
        cache_dir="$HOME/none"
 
-       export GIT_PROVE_OPTS="--timer --jobs 10"
-       export GIT_TEST_OPTS="--verbose-log -x --github-workflow-markup"
-       MAKEFLAGS="$MAKEFLAGS --jobs=10"
-       test windows != "$CI_OS_NAME" ||
-       GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
+       runs_on_pool=$(echo "$CI_JOB_IMAGE" | tr : -)
+       JOBS=$(nproc)
 else
        echo "Could not identify CI type" >&2
        env >&2
        exit 1
 fi
 
+MAKEFLAGS="$MAKEFLAGS --jobs=$JOBS"
+GIT_PROVE_OPTS="--timer --jobs $JOBS"
+
+GIT_TEST_OPTS="$GIT_TEST_OPTS --verbose-log -x"
+case "$CI_OS_NAME" in
+windows|windows_nt)
+       GIT_TEST_OPTS="$GIT_TEST_OPTS --no-chain-lint --no-bin-wrappers"
+       ;;
+esac
+
+export GIT_TEST_OPTS
+export GIT_PROVE_OPTS
+
 good_trees_file="$cache_dir/good-trees"
 
 mkdir -p "$cache_dir"
@@ -253,13 +346,14 @@ ubuntu-*)
        export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
        ;;
 macos-*)
-       if [ "$jobname" = osx-gcc ]
+       MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)"
+       if [ "$jobname" != osx-gcc ]
        then
-               MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)"
-       else
-               MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)"
                MAKEFLAGS="$MAKEFLAGS APPLE_COMMON_CRYPTO_SHA1=Yes"
        fi
+
+       P4_PATH="$HOME/custom/p4"
+       export PATH="$P4_PATH:$PATH"
        ;;
 esac
 
@@ -273,17 +367,19 @@ linux-musl)
        MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes"
        MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8"
        ;;
-linux-leaks)
+linux-leaks|linux-reftable-leaks)
        export SANITIZE=leak
        export GIT_TEST_PASSING_SANITIZE_LEAK=true
        export GIT_TEST_SANITIZE_LEAK_LOG=true
        ;;
 linux-asan-ubsan)
        export SANITIZE=address,undefined
+       export NO_SVN_TESTS=LetsSaveSomeTime
+       MAKEFLAGS="$MAKEFLAGS NO_PYTHON=YepBecauseP4FlakesTooOften"
        ;;
 esac
 
 MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
 
-end_group
+end_group "CI setup"
 set -x
index 57277eefcd0c8b6117fd71e9adb3a526baa05ef1..b1f80aeac345dd70746b02b6ca1b5282a0c2a4aa 100755 (executable)
@@ -8,7 +8,7 @@
 # Tracing executed commands would produce too much noise in the loop below.
 set +x
 
-cd t/
+cd "${TEST_OUTPUT_DIRECTORY:-t/}"
 
 if ! ls test-results/*.exit >/dev/null 2>/dev/null
 then
@@ -51,6 +51,12 @@ do
                        tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
                        continue
                        ;;
+               gitlab-ci)
+                       mkdir -p failed-test-artifacts
+                       cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
+                       tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
+                       continue
+                       ;;
                *)
                        echo "Unhandled CI type: $CI_TYPE" >&2
                        exit 1
diff --git a/ci/run-build-and-minimal-fuzzers.sh b/ci/run-build-and-minimal-fuzzers.sh
new file mode 100755 (executable)
index 0000000..8ba486f
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Build and test Git's fuzzers
+#
+
+. ${0%/*}/lib.sh
+
+group "Build fuzzers" make \
+       CC=clang \
+       CXX=clang++ \
+       CFLAGS="-fsanitize=fuzzer-no-link,address" \
+       LIB_FUZZING_ENGINE="-fsanitize=fuzzer,address" \
+       fuzz-all
+
+for fuzzer in commit-graph date pack-headers pack-idx ; do
+       begin_group "fuzz-$fuzzer"
+       ./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
+       end_group "fuzz-$fuzzer"
+done
index 2528f25e31d3c860d1f2dc435af320a4f1b4973c..c192bd613c03dd5faa69dba835014d54bfdf16ae 100755 (executable)
@@ -37,6 +37,9 @@ linux-clang)
 linux-sha256)
        export GIT_TEST_DEFAULT_HASH=sha256
        ;;
+linux-reftable|linux-reftable-leaks|osx-reftable)
+       export GIT_TEST_DEFAULT_REF_FORMAT=reftable
+       ;;
 pedantic)
        # Don't run the tests; we only care about whether Git can be
        # built.
@@ -50,6 +53,8 @@ if test -n "$run_tests"
 then
        group "Run tests" make test ||
        handle_failed_tests
+       group "Run unit tests" \
+               make DEFAULT_UNIT_TEST_TARGET=unit-tests-prove unit-tests
 fi
 check_unignored_build_artifacts
 
index a3c67956a8df8f803bc81eee1b86a8f5559db57b..ae8094382fe418dbd807dbc2156e16b814aa2adc 100755 (executable)
@@ -15,4 +15,9 @@ group "Run tests" make --quiet -C t T="$(cd t &&
        tr '\n' ' ')" ||
 handle_failed_tests
 
+# We only have one unit test at the moment, so run it in the first slice
+if [ "$1" == "0" ] ; then
+       group "Run unit tests" make --quiet -C t unit-tests-prove
+fi
+
 check_unignored_build_artifacts
diff --git a/color.c b/color.c
index b24b19566b99eb498859ed315b74cabcf6df37c1..f663c06ac4eddc7b8085739318ddfc99a3ee7583 100644 (file)
--- a/color.c
+++ b/color.c
@@ -3,7 +3,7 @@
 #include "color.h"
 #include "editor.h"
 #include "gettext.h"
-#include "hex.h"
+#include "hex-ll.h"
 #include "pager.h"
 #include "strbuf.h"
 
index ff2f0abf39930c85a515283625a98152d85bc492..50bbccc92ee86cf754a6b3250e52338a1870c990 100644 (file)
--- a/column.c
+++ b/column.c
@@ -182,6 +182,8 @@ void print_columns(const struct string_list *list, unsigned int colopts,
 {
        struct column_options nopts;
 
+       if (opts && (0 > opts->padding))
+               BUG("padding must be non-negative");
        if (!list->nr)
                return;
        assert((colopts & COL_ENABLE_MASK) != COL_AUTO);
@@ -361,6 +363,8 @@ int run_column_filter(int colopts, const struct column_options *opts)
 {
        struct strvec *argv;
 
+       if (opts && (0 > opts->padding))
+               BUG("padding must be non-negative");
        if (fd_out != -1)
                return -1;
 
index f90f442482932e618cc7399924c00ddde8c50eaf..d6d6fa168942053e756317d8b490435e4d1280b6 100644 (file)
@@ -2,7 +2,6 @@
 #include "object-store-ll.h"
 #include "commit.h"
 #include "convert.h"
-#include "blob.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "environment.h"
@@ -338,6 +337,8 @@ static char *grab_blob(struct repository *r,
                free_filespec(df);
        } else {
                blob = repo_read_object_file(r, oid, &type, size);
+               if (!blob)
+                       die(_("unable to read %s"), oid_to_hex(oid));
                if (type != OBJ_BLOB)
                        die("object '%s' is not a blob!", oid_to_hex(oid));
        }
index 54b2a50f5f1dfeb2121f73a43417a7855d6fe1f4..c4cd0f352b8833bc7362a5f685f220ec5dd888b0 100644 (file)
@@ -160,6 +160,7 @@ git-reflog                              ancillarymanipulators           complete
 git-remote                              ancillarymanipulators           complete
 git-repack                              ancillarymanipulators           complete
 git-replace                             ancillarymanipulators           complete
+git-replay                              plumbingmanipulators
 git-request-pull                        foreignscminterface             complete
 git-rerere                              ancillaryinterrogators
 git-reset                               mainporcelain           history
index 0aa1640d15aca59b90617677afd30ef7c8d247c1..45417d7412202e54d21de0ae49941536eb2c82b4 100644 (file)
@@ -1,14 +1,13 @@
 #include "git-compat-util.h"
 #include "config.h"
+#include "csum-file.h"
 #include "gettext.h"
 #include "hex.h"
 #include "lockfile.h"
-#include "pack.h"
 #include "packfile.h"
 #include "commit.h"
 #include "object.h"
 #include "refs.h"
-#include "revision.h"
 #include "hash-lookup.h"
 #include "commit-graph.h"
 #include "object-file.h"
@@ -128,6 +127,16 @@ timestamp_t commit_graph_generation(const struct commit *c)
        return GENERATION_NUMBER_INFINITY;
 }
 
+static timestamp_t commit_graph_generation_from_graph(const struct commit *c)
+{
+       struct commit_graph_data *data =
+               commit_graph_data_slab_peek(&commit_graph_data_slab, c);
+
+       if (!data || data->graph_pos == COMMIT_NOT_FROM_GRAPH)
+               return GENERATION_NUMBER_INFINITY;
+       return data->generation;
+}
+
 static struct commit_graph_data *commit_graph_data_at(const struct commit *c)
 {
        unsigned int i, nth_slab;
@@ -265,31 +274,25 @@ struct commit_graph *load_commit_graph_one_fd_st(struct repository *r,
        return ret;
 }
 
-static int verify_commit_graph_lite(struct commit_graph *g)
+static int graph_read_oid_fanout(const unsigned char *chunk_start,
+                                size_t chunk_size, void *data)
 {
-       /*
-        * Basic validation shared between parse_commit_graph()
-        * which'll be called every time the graph is used, and the
-        * much more expensive verify_commit_graph() used by
-        * "commit-graph verify".
-        *
-        * There should only be very basic checks here to ensure that
-        * we don't e.g. segfault in fill_commit_in_graph(), but
-        * because this is a very hot codepath nothing that e.g. loops
-        * over g->num_commits, or runs a checksum on the commit-graph
-        * itself.
-        */
-       if (!g->chunk_oid_fanout) {
-               error("commit-graph is missing the OID Fanout chunk");
-               return 1;
-       }
-       if (!g->chunk_oid_lookup) {
-               error("commit-graph is missing the OID Lookup chunk");
-               return 1;
-       }
-       if (!g->chunk_commit_data) {
-               error("commit-graph is missing the Commit Data chunk");
-               return 1;
+       struct commit_graph *g = data;
+       int i;
+
+       if (chunk_size != 256 * sizeof(uint32_t))
+               return error(_("commit-graph oid fanout chunk is wrong size"));
+       g->chunk_oid_fanout = (const uint32_t *)chunk_start;
+       g->num_commits = ntohl(g->chunk_oid_fanout[255]);
+
+       for (i = 0; i < 255; i++) {
+               uint32_t oid_fanout1 = ntohl(g->chunk_oid_fanout[i]);
+               uint32_t oid_fanout2 = ntohl(g->chunk_oid_fanout[i + 1]);
+
+               if (oid_fanout1 > oid_fanout2) {
+                       error(_("commit-graph fanout values out of order"));
+                       return 1;
+               }
        }
 
        return 0;
@@ -300,7 +303,40 @@ static int graph_read_oid_lookup(const unsigned char *chunk_start,
 {
        struct commit_graph *g = data;
        g->chunk_oid_lookup = chunk_start;
-       g->num_commits = chunk_size / g->hash_len;
+       if (chunk_size / g->hash_len != g->num_commits)
+               return error(_("commit-graph OID lookup chunk is the wrong size"));
+       return 0;
+}
+
+static int graph_read_commit_data(const unsigned char *chunk_start,
+                                 size_t chunk_size, void *data)
+{
+       struct commit_graph *g = data;
+       if (chunk_size / GRAPH_DATA_WIDTH != g->num_commits)
+               return error(_("commit-graph commit data chunk is wrong size"));
+       g->chunk_commit_data = chunk_start;
+       return 0;
+}
+
+static int graph_read_generation_data(const unsigned char *chunk_start,
+                                     size_t chunk_size, void *data)
+{
+       struct commit_graph *g = data;
+       if (chunk_size / sizeof(uint32_t) != g->num_commits)
+               return error(_("commit-graph generations chunk is wrong size"));
+       g->chunk_generation_data = chunk_start;
+       return 0;
+}
+
+static int graph_read_bloom_index(const unsigned char *chunk_start,
+                                 size_t chunk_size, void *data)
+{
+       struct commit_graph *g = data;
+       if (chunk_size / 4 != g->num_commits) {
+               warning(_("commit-graph changed-path index chunk is too small"));
+               return -1;
+       }
+       g->chunk_bloom_indexes = chunk_start;
        return 0;
 }
 
@@ -309,7 +345,17 @@ static int graph_read_bloom_data(const unsigned char *chunk_start,
 {
        struct commit_graph *g = data;
        uint32_t hash_version;
+
+       if (chunk_size < BLOOMDATA_CHUNK_HEADER_SIZE) {
+               warning(_("ignoring too-small changed-path chunk"
+                       " (%"PRIuMAX" < %"PRIuMAX") in commit-graph file"),
+                       (uintmax_t)chunk_size,
+                       (uintmax_t)BLOOMDATA_CHUNK_HEADER_SIZE);
+               return -1;
+       }
+
        g->chunk_bloom_data = chunk_start;
+       g->chunk_bloom_data_size = chunk_size;
        hash_version = get_be32(chunk_start);
 
        if (hash_version != 1)
@@ -381,29 +427,41 @@ struct commit_graph *parse_commit_graph(struct repo_settings *s,
        cf = init_chunkfile(NULL);
 
        if (read_table_of_contents(cf, graph->data, graph_size,
-                                  GRAPH_HEADER_SIZE, graph->num_chunks))
+                                  GRAPH_HEADER_SIZE, graph->num_chunks, 1))
+               goto free_and_return;
+
+       if (read_chunk(cf, GRAPH_CHUNKID_OIDFANOUT, graph_read_oid_fanout, graph)) {
+               error(_("commit-graph required OID fanout chunk missing or corrupted"));
+               goto free_and_return;
+       }
+       if (read_chunk(cf, GRAPH_CHUNKID_OIDLOOKUP, graph_read_oid_lookup, graph)) {
+               error(_("commit-graph required OID lookup chunk missing or corrupted"));
+               goto free_and_return;
+       }
+       if (read_chunk(cf, GRAPH_CHUNKID_DATA, graph_read_commit_data, graph)) {
+               error(_("commit-graph required commit data chunk missing or corrupted"));
                goto free_and_return;
+       }
 
-       pair_chunk(cf, GRAPH_CHUNKID_OIDFANOUT,
-                  (const unsigned char **)&graph->chunk_oid_fanout);
-       read_chunk(cf, GRAPH_CHUNKID_OIDLOOKUP, graph_read_oid_lookup, graph);
-       pair_chunk(cf, GRAPH_CHUNKID_DATA, &graph->chunk_commit_data);
-       pair_chunk(cf, GRAPH_CHUNKID_EXTRAEDGES, &graph->chunk_extra_edges);
-       pair_chunk(cf, GRAPH_CHUNKID_BASE, &graph->chunk_base_graphs);
+       pair_chunk(cf, GRAPH_CHUNKID_EXTRAEDGES, &graph->chunk_extra_edges,
+                  &graph->chunk_extra_edges_size);
+       pair_chunk(cf, GRAPH_CHUNKID_BASE, &graph->chunk_base_graphs,
+                  &graph->chunk_base_graphs_size);
 
        if (s->commit_graph_generation_version >= 2) {
-               pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA,
-                       &graph->chunk_generation_data);
+               read_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA,
+                          graph_read_generation_data, graph);
                pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW,
-                       &graph->chunk_generation_data_overflow);
+                          &graph->chunk_generation_data_overflow,
+                          &graph->chunk_generation_data_overflow_size);
 
                if (graph->chunk_generation_data)
                        graph->read_generation_data = 1;
        }
 
        if (s->commit_graph_read_changed_paths) {
-               pair_chunk(cf, GRAPH_CHUNKID_BLOOMINDEXES,
-                          &graph->chunk_bloom_indexes);
+               read_chunk(cf, GRAPH_CHUNKID_BLOOMINDEXES,
+                          graph_read_bloom_index, graph);
                read_chunk(cf, GRAPH_CHUNKID_BLOOMDATA,
                           graph_read_bloom_data, graph);
        }
@@ -419,9 +477,6 @@ struct commit_graph *parse_commit_graph(struct repo_settings *s,
 
        oidread(&graph->oid, graph->data + graph->data_len - graph->hash_len);
 
-       if (verify_commit_graph_lite(graph))
-               goto free_and_return;
-
        free_chunkfile(cf);
        return graph;
 
@@ -463,6 +518,31 @@ static struct commit_graph *load_commit_graph_v1(struct repository *r,
        return g;
 }
 
+/*
+ * returns 1 if and only if all graphs in the chain have
+ * corrected commit dates stored in the generation_data chunk.
+ */
+static int validate_mixed_generation_chain(struct commit_graph *g)
+{
+       int read_generation_data = 1;
+       struct commit_graph *p = g;
+
+       while (read_generation_data && p) {
+               read_generation_data = p->read_generation_data;
+               p = p->base_graph;
+       }
+
+       if (read_generation_data)
+               return 1;
+
+       while (g) {
+               g->read_generation_data = 0;
+               g = g->base_graph;
+       }
+
+       return 0;
+}
+
 static int add_graph_to_chain(struct commit_graph *g,
                              struct commit_graph *chain,
                              struct object_id *oids,
@@ -475,6 +555,11 @@ static int add_graph_to_chain(struct commit_graph *g,
                return 0;
        }
 
+       if (g->chunk_base_graphs_size / g->hash_len < n) {
+               warning(_("commit-graph base graphs chunk is too small"));
+               return 0;
+       }
+
        while (n) {
                n--;
 
@@ -488,8 +573,6 @@ static int add_graph_to_chain(struct commit_graph *g,
                cur_g = cur_g->base_graph;
        }
 
-       g->base_graph = chain;
-
        if (chain) {
                if (unsigned_add_overflows(chain->num_commits,
                                           chain->num_commits_in_base)) {
@@ -500,34 +583,46 @@ static int add_graph_to_chain(struct commit_graph *g,
                g->num_commits_in_base = chain->num_commits + chain->num_commits_in_base;
        }
 
+       g->base_graph = chain;
+
        return 1;
 }
 
-static struct commit_graph *load_commit_graph_chain(struct repository *r,
-                                                   struct object_directory *odb)
+int open_commit_graph_chain(const char *chain_file,
+                           int *fd, struct stat *st)
+{
+       *fd = git_open(chain_file);
+       if (*fd < 0)
+               return 0;
+       if (fstat(*fd, st)) {
+               close(*fd);
+               return 0;
+       }
+       if (st->st_size < the_hash_algo->hexsz) {
+               close(*fd);
+               if (!st->st_size) {
+                       /* treat empty files the same as missing */
+                       errno = ENOENT;
+               } else {
+                       warning(_("commit-graph chain file too small"));
+                       errno = EINVAL;
+               }
+               return 0;
+       }
+       return 1;
+}
+
+struct commit_graph *load_commit_graph_chain_fd_st(struct repository *r,
+                                                  int fd, struct stat *st,
+                                                  int *incomplete_chain)
 {
        struct commit_graph *graph_chain = NULL;
        struct strbuf line = STRBUF_INIT;
-       struct stat st;
        struct object_id *oids;
        int i = 0, valid = 1, count;
-       char *chain_name = get_commit_graph_chain_filename(odb);
-       FILE *fp;
-       int stat_res;
-
-       fp = fopen(chain_name, "r");
-       stat_res = stat(chain_name, &st);
-       free(chain_name);
-
-       if (!fp)
-               return NULL;
-       if (stat_res ||
-           st.st_size <= the_hash_algo->hexsz) {
-               fclose(fp);
-               return NULL;
-       }
+       FILE *fp = xfdopen(fd, "r");
 
-       count = st.st_size / (the_hash_algo->hexsz + 1);
+       count = st->st_size / (the_hash_algo->hexsz + 1);
        CALLOC_ARRAY(oids, count);
 
        prepare_alt_odb(r);
@@ -556,6 +651,8 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r,
                                if (add_graph_to_chain(g, graph_chain, oids, i)) {
                                        graph_chain = g;
                                        valid = 1;
+                               } else {
+                                       free_commit_graph(g);
                                }
 
                                break;
@@ -568,36 +665,32 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r,
                }
        }
 
+       validate_mixed_generation_chain(graph_chain);
+
        free(oids);
        fclose(fp);
        strbuf_release(&line);
 
+       *incomplete_chain = !valid;
        return graph_chain;
 }
 
-/*
- * returns 1 if and only if all graphs in the chain have
- * corrected commit dates stored in the generation_data chunk.
- */
-static int validate_mixed_generation_chain(struct commit_graph *g)
+static struct commit_graph *load_commit_graph_chain(struct repository *r,
+                                                   struct object_directory *odb)
 {
-       int read_generation_data = 1;
-       struct commit_graph *p = g;
-
-       while (read_generation_data && p) {
-               read_generation_data = p->read_generation_data;
-               p = p->base_graph;
-       }
-
-       if (read_generation_data)
-               return 1;
+       char *chain_file = get_commit_graph_chain_filename(odb);
+       struct stat st;
+       int fd;
+       struct commit_graph *g = NULL;
 
-       while (g) {
-               g->read_generation_data = 0;
-               g = g->base_graph;
+       if (open_commit_graph_chain(chain_file, &fd, &st)) {
+               int incomplete;
+               /* ownership of fd is taken over by load function */
+               g = load_commit_graph_chain_fd_st(r, fd, &st, &incomplete);
        }
 
-       return 0;
+       free(chain_file);
+       return g;
 }
 
 struct commit_graph *read_commit_graph_one(struct repository *r,
@@ -608,8 +701,6 @@ struct commit_graph *read_commit_graph_one(struct repository *r,
        if (!g)
                g = load_commit_graph_chain(r, odb);
 
-       validate_mixed_generation_chain(g);
-
        return g;
 }
 
@@ -713,19 +804,13 @@ struct bloom_filter_settings *get_bloom_filter_settings(struct repository *r)
        return NULL;
 }
 
-static void close_commit_graph_one(struct commit_graph *g)
+void close_commit_graph(struct raw_object_store *o)
 {
-       if (!g)
+       if (!o->commit_graph)
                return;
 
        clear_commit_graph_data_slab(&commit_graph_data_slab);
-       close_commit_graph_one(g->base_graph);
-       free_commit_graph(g);
-}
-
-void close_commit_graph(struct raw_object_store *o)
-{
-       close_commit_graph_one(o->commit_graph);
+       free_commit_graph(o->commit_graph);
        o->commit_graph = NULL;
 }
 
@@ -805,7 +890,10 @@ static void fill_commit_graph_info(struct commit *item, struct commit_graph *g,
                                die(_("commit-graph requires overflow generation data but has none"));
 
                        offset_pos = offset ^ CORRECTED_COMMIT_DATE_OFFSET_OVERFLOW;
-                       graph_data->generation = item->date + get_be64(g->chunk_generation_data_overflow + st_mult(8, offset_pos));
+                       if (g->chunk_generation_data_overflow_size / sizeof(uint64_t) <= offset_pos)
+                               die(_("commit-graph overflow generation data is too small"));
+                       graph_data->generation = item->date +
+                               get_be64(g->chunk_generation_data_overflow + sizeof(uint64_t) * offset_pos);
                } else
                        graph_data->generation = item->date + offset;
        } else
@@ -825,7 +913,7 @@ static int fill_commit_in_graph(struct repository *r,
                                struct commit_graph *g, uint32_t pos)
 {
        uint32_t edge_value;
-       uint32_t *parent_data_ptr;
+       uint32_t parent_data_pos;
        struct commit_list **pptr;
        const unsigned char *commit_data;
        uint32_t lex_index;
@@ -857,14 +945,21 @@ static int fill_commit_in_graph(struct repository *r,
                return 1;
        }
 
-       parent_data_ptr = (uint32_t*)(g->chunk_extra_edges +
-                         st_mult(4, edge_value & GRAPH_EDGE_LAST_MASK));
+       parent_data_pos = edge_value & GRAPH_EDGE_LAST_MASK;
        do {
-               edge_value = get_be32(parent_data_ptr);
+               if (g->chunk_extra_edges_size / sizeof(uint32_t) <= parent_data_pos) {
+                       error(_("commit-graph extra-edges pointer out of bounds"));
+                       free_commit_list(item->parents);
+                       item->parents = NULL;
+                       item->object.parsed = 0;
+                       return 0;
+               }
+               edge_value = get_be32(g->chunk_extra_edges +
+                                     sizeof(uint32_t) * parent_data_pos);
                pptr = insert_parent_or_die(r, g,
                                            edge_value & GRAPH_EDGE_LAST_MASK,
                                            pptr);
-               parent_data_ptr++;
+               parent_data_pos++;
        } while (!(edge_value & GRAPH_LAST_EDGE));
 
        return 1;
@@ -907,14 +1002,18 @@ int repo_find_commit_pos_in_graph(struct repository *r, struct commit *c,
 
 struct commit *lookup_commit_in_graph(struct repository *repo, const struct object_id *id)
 {
+       static int commit_graph_paranoia = -1;
        struct commit *commit;
        uint32_t pos;
 
+       if (commit_graph_paranoia == -1)
+               commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
+
        if (!prepare_commit_graph(repo))
                return NULL;
        if (!search_commit_pos_in_graph(id, repo->objects->commit_graph, &pos))
                return NULL;
-       if (!has_object(repo, id, 0))
+       if (commit_graph_paranoia && !has_object(repo, id, 0))
                return NULL;
 
        commit = lookup_commit(repo, id);
@@ -1568,12 +1667,14 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx)
        stop_progress(&ctx->progress);
 }
 
-static timestamp_t get_generation_from_graph_data(struct commit *c, void *data)
+static timestamp_t get_generation_from_graph_data(struct commit *c,
+                                                 void *data UNUSED)
 {
        return commit_graph_data_at(c)->generation;
 }
 
-static void set_generation_v2(struct commit *c, timestamp_t t, void *data)
+static void set_generation_v2(struct commit *c, timestamp_t t,
+                             void *data UNUSED)
 {
        struct commit_graph_data *g = commit_graph_data_at(c);
        g->generation = t;
@@ -1587,7 +1688,6 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
                .commits = &ctx->commits,
                .get_generation = get_generation_from_graph_data,
                .set_generation = set_generation_v2,
-               .data = ctx,
        };
 
        if (ctx->report_progress)
@@ -1616,7 +1716,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
 }
 
 static void set_generation_in_graph_data(struct commit *c, timestamp_t t,
-                                        void *data)
+                                        void *data UNUSED)
 {
        commit_graph_data_at(c)->generation = t;
 }
@@ -2061,9 +2161,11 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
                        free(graph_name);
                }
 
+               free(ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1]);
                ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1] = xstrdup(hash_to_hex(file_hash));
                final_graph_name = get_split_graph_filename(ctx->odb,
                                        ctx->commit_graph_hash_after[ctx->num_commit_graphs_after - 1]);
+               free(ctx->commit_graph_filenames_after[ctx->num_commit_graphs_after - 1]);
                ctx->commit_graph_filenames_after[ctx->num_commit_graphs_after - 1] = final_graph_name;
 
                result = rename(ctx->graph_name, final_graph_name);
@@ -2512,23 +2614,21 @@ int write_commit_graph(struct object_directory *odb,
 
 cleanup:
        free(ctx->graph_name);
+       free(ctx->base_graph_name);
        free(ctx->commits.list);
        oid_array_clear(&ctx->oids);
        clear_topo_level_slab(&topo_levels);
 
-       if (ctx->commit_graph_filenames_after) {
-               for (i = 0; i < ctx->num_commit_graphs_after; i++) {
-                       free(ctx->commit_graph_filenames_after[i]);
-                       free(ctx->commit_graph_hash_after[i]);
-               }
-
-               for (i = 0; i < ctx->num_commit_graphs_before; i++)
-                       free(ctx->commit_graph_filenames_before[i]);
+       for (i = 0; i < ctx->num_commit_graphs_before; i++)
+               free(ctx->commit_graph_filenames_before[i]);
+       free(ctx->commit_graph_filenames_before);
 
-               free(ctx->commit_graph_filenames_after);
-               free(ctx->commit_graph_filenames_before);
-               free(ctx->commit_graph_hash_after);
+       for (i = 0; i < ctx->num_commit_graphs_after; i++) {
+               free(ctx->commit_graph_filenames_after[i]);
+               free(ctx->commit_graph_hash_after[i]);
        }
+       free(ctx->commit_graph_filenames_after);
+       free(ctx->commit_graph_hash_after);
 
        free(ctx);
 
@@ -2550,9 +2650,6 @@ static void graph_report(const char *fmt, ...)
        va_end(ap);
 }
 
-#define GENERATION_ZERO_EXISTS 1
-#define GENERATION_NUMBER_EXISTS 2
-
 static int commit_graph_checksum_valid(struct commit_graph *g)
 {
        return hashfile_checksum_valid(g->data, g->data_len);
@@ -2565,11 +2662,8 @@ static int verify_one_commit_graph(struct repository *r,
 {
        uint32_t i, cur_fanout_pos = 0;
        struct object_id prev_oid, cur_oid;
-       int generation_zero = 0;
-
-       verify_commit_graph_error = verify_commit_graph_lite(g);
-       if (verify_commit_graph_error)
-               return verify_commit_graph_error;
+       struct commit *seen_gen_zero = NULL;
+       struct commit *seen_gen_non_zero = NULL;
 
        if (!commit_graph_checksum_valid(g)) {
                graph_report(_("the commit-graph file has incorrect checksum and is likely corrupt"));
@@ -2659,7 +2753,7 @@ static int verify_one_commit_graph(struct repository *r,
                                             oid_to_hex(&graph_parents->item->object.oid),
                                             oid_to_hex(&odb_parents->item->object.oid));
 
-                       generation = commit_graph_generation(graph_parents->item);
+                       generation = commit_graph_generation_from_graph(graph_parents->item);
                        if (generation > max_generation)
                                max_generation = generation;
 
@@ -2671,16 +2765,12 @@ static int verify_one_commit_graph(struct repository *r,
                        graph_report(_("commit-graph parent list for commit %s terminates early"),
                                     oid_to_hex(&cur_oid));
 
-               if (!commit_graph_generation(graph_commit)) {
-                       if (generation_zero == GENERATION_NUMBER_EXISTS)
-                               graph_report(_("commit-graph has generation number zero for commit %s, but non-zero elsewhere"),
-                                            oid_to_hex(&cur_oid));
-                       generation_zero = GENERATION_ZERO_EXISTS;
-               } else if (generation_zero == GENERATION_ZERO_EXISTS)
-                       graph_report(_("commit-graph has non-zero generation number for commit %s, but zero elsewhere"),
-                                    oid_to_hex(&cur_oid));
+               if (commit_graph_generation_from_graph(graph_commit))
+                       seen_gen_non_zero = graph_commit;
+               else
+                       seen_gen_zero = graph_commit;
 
-               if (generation_zero == GENERATION_ZERO_EXISTS)
+               if (seen_gen_zero)
                        continue;
 
                /*
@@ -2706,6 +2796,12 @@ static int verify_one_commit_graph(struct repository *r,
                                     odb_commit->date);
        }
 
+       if (seen_gen_zero && seen_gen_non_zero)
+               graph_report(_("commit-graph has both zero and non-zero "
+                              "generations (e.g., commits '%s' and '%s')"),
+                            oid_to_hex(&seen_gen_zero->object.oid),
+                            oid_to_hex(&seen_gen_non_zero->object.oid));
+
        return verify_commit_graph_error;
 }
 
@@ -2742,15 +2838,17 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
 
 void free_commit_graph(struct commit_graph *g)
 {
-       if (!g)
-               return;
-       if (g->data) {
-               munmap((void *)g->data, g->data_len);
-               g->data = NULL;
+       while (g) {
+               struct commit_graph *next = g->base_graph;
+
+               if (g->data)
+                       munmap((void *)g->data, g->data_len);
+               free(g->filename);
+               free(g->bloom_filter_settings);
+               free(g);
+
+               g = next;
        }
-       free(g->filename);
-       free(g->bloom_filter_settings);
-       free(g);
 }
 
 void disable_commit_graph(struct repository *r)
index 5e534f0fcc8d131a6e759ed1658b0e0984123a6e..e519cb81cb649dd016fdb5f26dbfd3623ead13e9 100644 (file)
@@ -8,6 +8,12 @@
 #define GIT_TEST_COMMIT_GRAPH_DIE_ON_PARSE "GIT_TEST_COMMIT_GRAPH_DIE_ON_PARSE"
 #define GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS "GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS"
 
+/*
+ * This environment variable controls whether commits looked up via the
+ * commit graph will be double checked to exist in the object database.
+ */
+#define GIT_COMMIT_GRAPH_PARANOIA "GIT_COMMIT_GRAPH_PARANOIA"
+
 /*
  * This method is only used to enhance coverage of the commit-graph
  * feature in the test suite with the GIT_TEST_COMMIT_GRAPH and
@@ -26,6 +32,7 @@ struct string_list;
 char *get_commit_graph_filename(struct object_directory *odb);
 char *get_commit_graph_chain_filename(struct object_directory *odb);
 int open_commit_graph(const char *graph_file, int *fd, struct stat *st);
+int open_commit_graph_chain(const char *chain_file, int *fd, struct stat *st);
 
 /*
  * Given a commit struct, try to fill the commit struct info, including:
@@ -93,10 +100,14 @@ struct commit_graph {
        const unsigned char *chunk_commit_data;
        const unsigned char *chunk_generation_data;
        const unsigned char *chunk_generation_data_overflow;
+       size_t chunk_generation_data_overflow_size;
        const unsigned char *chunk_extra_edges;
+       size_t chunk_extra_edges_size;
        const unsigned char *chunk_base_graphs;
+       size_t chunk_base_graphs_size;
        const unsigned char *chunk_bloom_indexes;
        const unsigned char *chunk_bloom_data;
+       size_t chunk_bloom_data_size;
 
        struct topo_level_slab *topo_levels;
        struct bloom_filter_settings *bloom_filter_settings;
@@ -105,6 +116,9 @@ struct commit_graph {
 struct commit_graph *load_commit_graph_one_fd_st(struct repository *r,
                                                 int fd, struct stat *st,
                                                 struct object_directory *odb);
+struct commit_graph *load_commit_graph_chain_fd_st(struct repository *r,
+                                                  int fd, struct stat *st,
+                                                  int *incomplete_chain);
 struct commit_graph *read_commit_graph_one(struct repository *r,
                                           struct object_directory *odb);
 
index 4b7c233fd468f9ad2a60abf5b9202f5c4fbad3c4..8f9b008f876787abf12ca89af5541f0b3bdf6ba7 100644 (file)
@@ -4,7 +4,6 @@
 #include "decorate.h"
 #include "hex.h"
 #include "prio-queue.h"
-#include "tree.h"
 #include "ref-filter.h"
 #include "revision.h"
 #include "tag.h"
@@ -50,13 +49,14 @@ static int queue_has_nonstale(struct prio_queue *queue)
 }
 
 /* all input commits in one and twos[] must have been parsed! */
-static struct commit_list *paint_down_to_common(struct repository *r,
-                                               struct commit *one, int n,
-                                               struct commit **twos,
-                                               timestamp_t min_generation)
+static int paint_down_to_common(struct repository *r,
+                               struct commit *one, int n,
+                               struct commit **twos,
+                               timestamp_t min_generation,
+                               int ignore_missing_commits,
+                               struct commit_list **result)
 {
        struct prio_queue queue = { compare_commits_by_gen_then_commit_date };
-       struct commit_list *result = NULL;
        int i;
        timestamp_t last_gen = GENERATION_NUMBER_INFINITY;
 
@@ -65,8 +65,8 @@ static struct commit_list *paint_down_to_common(struct repository *r,
 
        one->object.flags |= PARENT1;
        if (!n) {
-               commit_list_append(one, &result);
-               return result;
+               commit_list_append(one, result);
+               return 0;
        }
        prio_queue_put(&queue, one);
 
@@ -94,7 +94,7 @@ static struct commit_list *paint_down_to_common(struct repository *r,
                if (flags == (PARENT1 | PARENT2)) {
                        if (!(commit->object.flags & RESULT)) {
                                commit->object.flags |= RESULT;
-                               commit_list_insert_by_date(commit, &result);
+                               commit_list_insert_by_date(commit, result);
                        }
                        /* Mark parents of a found merge stale */
                        flags |= STALE;
@@ -105,67 +105,97 @@ static struct commit_list *paint_down_to_common(struct repository *r,
                        parents = parents->next;
                        if ((p->object.flags & flags) == flags)
                                continue;
-                       if (repo_parse_commit(r, p))
-                               return NULL;
+                       if (repo_parse_commit(r, p)) {
+                               clear_prio_queue(&queue);
+                               free_commit_list(*result);
+                               *result = NULL;
+                               /*
+                                * At this stage, we know that the commit is
+                                * missing: `repo_parse_commit()` uses
+                                * `OBJECT_INFO_DIE_IF_CORRUPT` and therefore
+                                * corrupt commits would already have been
+                                * dispatched with a `die()`.
+                                */
+                               if (ignore_missing_commits)
+                                       return 0;
+                               return error(_("could not parse commit %s"),
+                                            oid_to_hex(&p->object.oid));
+                       }
                        p->object.flags |= flags;
                        prio_queue_put(&queue, p);
                }
        }
 
        clear_prio_queue(&queue);
-       return result;
+       return 0;
 }
 
-static struct commit_list *merge_bases_many(struct repository *r,
-                                           struct commit *one, int n,
-                                           struct commit **twos)
+static int merge_bases_many(struct repository *r,
+                           struct commit *one, int n,
+                           struct commit **twos,
+                           struct commit_list **result)
 {
        struct commit_list *list = NULL;
-       struct commit_list *result = NULL;
        int i;
 
        for (i = 0; i < n; i++) {
-               if (one == twos[i])
+               if (one == twos[i]) {
                        /*
                         * We do not mark this even with RESULT so we do not
                         * have to clean it up.
                         */
-                       return commit_list_insert(one, &result);
+                       *result = commit_list_insert(one, result);
+                       return 0;
+               }
        }
 
+       if (!one)
+               return 0;
        if (repo_parse_commit(r, one))
-               return NULL;
+               return error(_("could not parse commit %s"),
+                            oid_to_hex(&one->object.oid));
        for (i = 0; i < n; i++) {
+               if (!twos[i])
+                       return 0;
                if (repo_parse_commit(r, twos[i]))
-                       return NULL;
+                       return error(_("could not parse commit %s"),
+                                    oid_to_hex(&twos[i]->object.oid));
        }
 
-       list = paint_down_to_common(r, one, n, twos, 0);
+       if (paint_down_to_common(r, one, n, twos, 0, 0, &list)) {
+               free_commit_list(list);
+               return -1;
+       }
 
        while (list) {
                struct commit *commit = pop_commit(&list);
                if (!(commit->object.flags & STALE))
-                       commit_list_insert_by_date(commit, &result);
+                       commit_list_insert_by_date(commit, result);
        }
-       return result;
+       return 0;
 }
 
-struct commit_list *get_octopus_merge_bases(struct commit_list *in)
+int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result)
 {
-       struct commit_list *i, *j, *k, *ret = NULL;
+       struct commit_list *i, *j, *k;
 
        if (!in)
-               return ret;
+               return 0;
 
-       commit_list_insert(in->item, &ret);
+       commit_list_insert(in->item, result);
 
        for (i = in->next; i; i = i->next) {
                struct commit_list *new_commits = NULL, *end = NULL;
 
-               for (j = ret; j; j = j->next) {
-                       struct commit_list *bases;
-                       bases = repo_get_merge_bases(the_repository, i->item,
-                                                    j->item);
+               for (j = *result; j; j = j->next) {
+                       struct commit_list *bases = NULL;
+                       if (repo_get_merge_bases(the_repository, i->item,
+                                                j->item, &bases) < 0) {
+                               free_commit_list(bases);
+                               free_commit_list(*result);
+                               *result = NULL;
+                               return -1;
+                       }
                        if (!new_commits)
                                new_commits = bases;
                        else
@@ -173,9 +203,10 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)
                        for (k = bases; k; k = k->next)
                                end = k;
                }
-               ret = new_commits;
+               free_commit_list(*result);
+               *result = new_commits;
        }
-       return ret;
+       return 0;
 }
 
 static int remove_redundant_no_gen(struct repository *r,
@@ -193,7 +224,7 @@ static int remove_redundant_no_gen(struct repository *r,
        for (i = 0; i < cnt; i++)
                repo_parse_commit(r, array[i]);
        for (i = 0; i < cnt; i++) {
-               struct commit_list *common;
+               struct commit_list *common = NULL;
                timestamp_t min_generation = commit_graph_generation(array[i]);
 
                if (redundant[i])
@@ -209,8 +240,16 @@ static int remove_redundant_no_gen(struct repository *r,
                        if (curr_generation < min_generation)
                                min_generation = curr_generation;
                }
-               common = paint_down_to_common(r, array[i], filled,
-                                             work, min_generation);
+               if (paint_down_to_common(r, array[i], filled,
+                                        work, min_generation, 0, &common)) {
+                       clear_commit_marks(array[i], all_flags);
+                       clear_commit_marks_many(filled, work, all_flags);
+                       free_commit_list(common);
+                       free(work);
+                       free(redundant);
+                       free(filled_index);
+                       return -1;
+               }
                if (array[i]->object.flags & PARENT2)
                        redundant[i] = 1;
                for (j = 0; j < filled; j++)
@@ -375,69 +414,77 @@ static int remove_redundant(struct repository *r, struct commit **array, int cnt
        return remove_redundant_no_gen(r, array, cnt);
 }
 
-static struct commit_list *get_merge_bases_many_0(struct repository *r,
-                                                 struct commit *one,
-                                                 int n,
-                                                 struct commit **twos,
-                                                 int cleanup)
+static int get_merge_bases_many_0(struct repository *r,
+                                 struct commit *one,
+                                 int n,
+                                 struct commit **twos,
+                                 int cleanup,
+                                 struct commit_list **result)
 {
        struct commit_list *list;
        struct commit **rslt;
-       struct commit_list *result;
        int cnt, i;
 
-       result = merge_bases_many(r, one, n, twos);
+       if (merge_bases_many(r, one, n, twos, result) < 0)
+               return -1;
        for (i = 0; i < n; i++) {
                if (one == twos[i])
-                       return result;
+                       return 0;
        }
-       if (!result || !result->next) {
+       if (!*result || !(*result)->next) {
                if (cleanup) {
                        clear_commit_marks(one, all_flags);
                        clear_commit_marks_many(n, twos, all_flags);
                }
-               return result;
+               return 0;
        }
 
        /* There are more than one */
-       cnt = commit_list_count(result);
+       cnt = commit_list_count(*result);
        CALLOC_ARRAY(rslt, cnt);
-       for (list = result, i = 0; list; list = list->next)
+       for (list = *result, i = 0; list; list = list->next)
                rslt[i++] = list->item;
-       free_commit_list(result);
+       free_commit_list(*result);
+       *result = NULL;
 
        clear_commit_marks(one, all_flags);
        clear_commit_marks_many(n, twos, all_flags);
 
        cnt = remove_redundant(r, rslt, cnt);
-       result = NULL;
+       if (cnt < 0) {
+               free(rslt);
+               return -1;
+       }
        for (i = 0; i < cnt; i++)
-               commit_list_insert_by_date(rslt[i], &result);
+               commit_list_insert_by_date(rslt[i], result);
        free(rslt);
-       return result;
+       return 0;
 }
 
-struct commit_list *repo_get_merge_bases_many(struct repository *r,
-                                             struct commit *one,
-                                             int n,
-                                             struct commit **twos)
+int repo_get_merge_bases_many(struct repository *r,
+                             struct commit *one,
+                             int n,
+                             struct commit **twos,
+                             struct commit_list **result)
 {
-       return get_merge_bases_many_0(r, one, n, twos, 1);
+       return get_merge_bases_many_0(r, one, n, twos, 1, result);
 }
 
-struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,
-                                                   struct commit *one,
-                                                   int n,
-                                                   struct commit **twos)
+int repo_get_merge_bases_many_dirty(struct repository *r,
+                                   struct commit *one,
+                                   int n,
+                                   struct commit **twos,
+                                   struct commit_list **result)
 {
-       return get_merge_bases_many_0(r, one, n, twos, 0);
+       return get_merge_bases_many_0(r, one, n, twos, 0, result);
 }
 
-struct commit_list *repo_get_merge_bases(struct repository *r,
-                                        struct commit *one,
-                                        struct commit *two)
+int repo_get_merge_bases(struct repository *r,
+                        struct commit *one,
+                        struct commit *two,
+                        struct commit_list **result)
 {
-       return get_merge_bases_many_0(r, one, 1, &two, 1);
+       return get_merge_bases_many_0(r, one, 1, &two, 1, result);
 }
 
 /*
@@ -460,11 +507,13 @@ int repo_is_descendant_of(struct repository *r,
        } else {
                while (with_commit) {
                        struct commit *other;
+                       int ret;
 
                        other = with_commit->item;
                        with_commit = with_commit->next;
-                       if (repo_in_merge_bases_many(r, other, 1, &commit))
-                               return 1;
+                       ret = repo_in_merge_bases_many(r, other, 1, &commit, 0);
+                       if (ret)
+                               return ret;
                }
                return 0;
        }
@@ -474,17 +523,18 @@ int repo_is_descendant_of(struct repository *r,
  * Is "commit" an ancestor of one of the "references"?
  */
 int repo_in_merge_bases_many(struct repository *r, struct commit *commit,
-                            int nr_reference, struct commit **reference)
+                            int nr_reference, struct commit **reference,
+                            int ignore_missing_commits)
 {
-       struct commit_list *bases;
+       struct commit_list *bases = NULL;
        int ret = 0, i;
        timestamp_t generation, max_generation = GENERATION_NUMBER_ZERO;
 
        if (repo_parse_commit(r, commit))
-               return ret;
+               return ignore_missing_commits ? 0 : -1;
        for (i = 0; i < nr_reference; i++) {
                if (repo_parse_commit(r, reference[i]))
-                       return ret;
+                       return ignore_missing_commits ? 0 : -1;
 
                generation = commit_graph_generation(reference[i]);
                if (generation > max_generation)
@@ -495,10 +545,11 @@ int repo_in_merge_bases_many(struct repository *r, struct commit *commit,
        if (generation > max_generation)
                return ret;
 
-       bases = paint_down_to_common(r, commit,
-                                    nr_reference, reference,
-                                    generation);
-       if (commit->object.flags & PARENT2)
+       if (paint_down_to_common(r, commit,
+                                nr_reference, reference,
+                                generation, ignore_missing_commits, &bases))
+               ret = -1;
+       else if (commit->object.flags & PARENT2)
                ret = 1;
        clear_commit_marks(commit, all_flags);
        clear_commit_marks_many(nr_reference, reference, all_flags);
@@ -551,6 +602,10 @@ struct commit_list *reduce_heads(struct commit_list *heads)
                }
        }
        num_head = remove_redundant(the_repository, array, num_head);
+       if (num_head < 0) {
+               free(array);
+               return NULL;
+       }
        for (i = 0; i < num_head; i++)
                tail = &commit_list_insert(array[i], tail)->next;
        free(array);
@@ -593,6 +648,8 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
        commit_list_insert(old_commit, &old_commit_list);
        ret = repo_is_descendant_of(the_repository,
                                    new_commit, old_commit_list);
+       if (ret < 0)
+               exit(128);
        free_commit_list(old_commit_list);
        return ret;
 }
index 35c4da4948122a6caea3a1757484b487db16b0fd..bf63cc468fd311a9ef658a23cec3db4fbbbac767 100644 (file)
@@ -9,18 +9,21 @@ struct ref_filter;
 struct object_id;
 struct object_array;
 
-struct commit_list *repo_get_merge_bases(struct repository *r,
-                                        struct commit *rev1,
-                                        struct commit *rev2);
-struct commit_list *repo_get_merge_bases_many(struct repository *r,
-                                             struct commit *one, int n,
-                                             struct commit **twos);
+int repo_get_merge_bases(struct repository *r,
+                        struct commit *rev1,
+                        struct commit *rev2,
+                        struct commit_list **result);
+int repo_get_merge_bases_many(struct repository *r,
+                             struct commit *one, int n,
+                             struct commit **twos,
+                             struct commit_list **result);
 /* To be used only when object flags after this call no longer matter */
-struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,
-                                                   struct commit *one, int n,
-                                                   struct commit **twos);
+int repo_get_merge_bases_many_dirty(struct repository *r,
+                                   struct commit *one, int n,
+                                   struct commit **twos,
+                                   struct commit_list **result);
 
-struct commit_list *get_octopus_merge_bases(struct commit_list *in);
+int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result);
 
 int repo_is_descendant_of(struct repository *r,
                          struct commit *commit,
@@ -30,7 +33,8 @@ int repo_in_merge_bases(struct repository *r,
                        struct commit *reference);
 int repo_in_merge_bases_many(struct repository *r,
                             struct commit *commit,
-                            int nr_reference, struct commit **reference);
+                            int nr_reference, struct commit **reference,
+                            int ignore_missing_commits);
 
 /*
  * Takes a list of commits and returns a new list where those
index 2b61a4d0aa11b02869d13ff906605264a112b281..1da10ec916c5e08a542da4bdc3b70518e91f113d 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -8,7 +8,6 @@
 #include "repository.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "pkt-line.h"
 #include "utf8.h"
 #include "diff.h"
 #include "revision.h"
 #include "advice.h"
 #include "refs.h"
 #include "commit-reach.h"
-#include "run-command.h"
 #include "setup.h"
 #include "shallow.h"
 #include "tree.h"
 #include "hook.h"
+#include "parse.h"
 #include "object-file-convert.h"
 
 static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
@@ -573,8 +572,21 @@ int repo_parse_commit_internal(struct repository *r,
                return -1;
        if (item->object.parsed)
                return 0;
-       if (use_commit_graph && parse_commit_in_graph(r, item))
+       if (use_commit_graph && parse_commit_in_graph(r, item)) {
+               static int commit_graph_paranoia = -1;
+
+               if (commit_graph_paranoia == -1)
+                       commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
+
+               if (commit_graph_paranoia && !has_object(r, &item->object.oid, 0)) {
+                       unparse_commit(r, &item->object.oid);
+                       return quiet_on_missing ? -1 :
+                               error(_("commit %s exists in commit-graph but not in the object database"),
+                                     oid_to_hex(&item->object.oid));
+               }
+
                return 0;
+       }
 
        if (oid_object_info_extended(r, &item->object.oid, &oi, flags) < 0)
                return quiet_on_missing ? -1 :
@@ -1041,7 +1053,7 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
 {
        struct object_id oid;
        struct rev_collect revs;
-       struct commit_list *bases;
+       struct commit_list *bases = NULL;
        int i;
        struct commit *ret = NULL;
        char *full_refname;
@@ -1066,8 +1078,9 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
        for (i = 0; i < revs.nr; i++)
                revs.commit[i]->object.flags &= ~TMP_MARK;
 
-       bases = repo_get_merge_bases_many(the_repository, commit, revs.nr,
-                                         revs.commit);
+       if (repo_get_merge_bases_many(the_repository, commit, revs.nr,
+                                     revs.commit, &bases) < 0)
+               exit(128);
 
        /*
         * There should be one and only one merge base, when we found
@@ -1900,7 +1913,7 @@ const char *find_commit_header(const char *msg, const char *key, size_t *out_len
  * Returns the number of bytes from the tail to ignore, to be fed as
  * the second parameter to append_signoff().
  */
-size_t ignore_non_trailer(const char *buf, size_t len)
+size_t ignored_log_message_bytes(const char *buf, size_t len)
 {
        size_t boc = 0;
        size_t bol = 0;
index 03edcec0129f8ed4b033c8d512a6103ca9c99a08..62fe0d77a70738048858e4087533b045fcc40613 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -294,8 +294,8 @@ const char *find_header_mem(const char *msg, size_t len,
 const char *find_commit_header(const char *msg, const char *key,
                               size_t *out_len);
 
-/* Find the end of the log message, the right place for a new trailer. */
-size_t ignore_non_trailer(const char *buf, size_t len);
+/* Find the number of bytes to ignore from the end of a log message. */
+size_t ignored_log_message_bytes(const char *buf, size_t len);
 
 typedef int (*each_mergetag_fn)(struct commit *commit, struct commit_extra_header *extra,
                                void *cb_data);
index 10dbb65937d17cab381bc1bfab1dff099157a625..e9ad9db84f22797e745d7a6c4e77021c3cf1814c 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef COMPILER_H
 #define COMPILER_H
 
-#include "git-compat-util.h"
 #include "strbuf.h"
 
 #ifdef __GLIBC__
index 6c979c27d89ec858b849f87e64505c2554cb121b..23bc1bef86c87a0853b87d75e0fc35ea1932f99d 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef COMPAT_DISK_H
 #define COMPAT_DISK_H
 
-#include "git-compat-util.h"
 #include "abspath.h"
 #include "gettext.h"
 
index 5b1709d63f729b173d89152e37567dcb3459117a..c2afcbe6c89d9ab2f279b5ac7cb4c9a3e6ae01ea 100644 (file)
@@ -4,21 +4,21 @@
 #include "fsm-health.h"
 #include "fsmonitor--daemon.h"
 
-int fsm_health__ctor(struct fsmonitor_daemon_state *state)
+int fsm_health__ctor(struct fsmonitor_daemon_state *state UNUSED)
 {
        return 0;
 }
 
-void fsm_health__dtor(struct fsmonitor_daemon_state *state)
+void fsm_health__dtor(struct fsmonitor_daemon_state *state UNUSED)
 {
        return;
 }
 
-void fsm_health__loop(struct fsmonitor_daemon_state *state)
+void fsm_health__loop(struct fsmonitor_daemon_state *state UNUSED)
 {
        return;
 }
 
-void fsm_health__stop_async(struct fsmonitor_daemon_state *state)
+void fsm_health__stop_async(struct fsmonitor_daemon_state *state UNUSED)
 {
 }
index 2d4e245beb18b8f3573ea33526274d3f8f45b675..2aa8c219acee4def1711e5f84d45571e34be4e16 100644 (file)
@@ -4,6 +4,7 @@
 #include "fsm-health.h"
 #include "fsmonitor--daemon.h"
 #include "gettext.h"
+#include "simple-ipc.h"
 
 /*
  * Every minute wake up and test our health.
index 8928fa93ce223968ab59279ddac50a3dd2b15239..41984ea48e26b8c5fc9cf8ed9bc6851957a230d9 100644 (file)
@@ -6,6 +6,6 @@
 const char *fsmonitor_ipc__get_path(struct repository *r) {
        static char *ret;
        if (!ret)
-               ret = git_pathdup("fsmonitor--daemon.ipc");
+               ret = repo_git_path(r, "fsmonitor--daemon.ipc");
        return ret;
 }
index 36c7e13281c675cba46d7a219f31f238f361c17c..2fc67442eb5e87e0b006f997fd6b597f9a919b99 100644 (file)
@@ -29,6 +29,7 @@
 #include "fsmonitor--daemon.h"
 #include "fsmonitor-path-utils.h"
 #include "gettext.h"
+#include "simple-ipc.h"
 #include "string-list.h"
 #include "trace.h"
 
@@ -191,12 +192,12 @@ static void my_add_path(struct fsmonitor_batch *batch, const char *path)
 }
 
 
-static void fsevent_callback(ConstFSEventStreamRef streamRef,
+static void fsevent_callback(ConstFSEventStreamRef streamRef UNUSED,
                             void *ctx,
                             size_t num_of_events,
                             void *event_paths,
                             const FSEventStreamEventFlags event_flags[],
-                            const FSEventStreamEventId event_ids[])
+                            const FSEventStreamEventId event_ids[] UNUSED)
 {
        struct fsmonitor_daemon_state *state = ctx;
        struct fsm_listen_data *data = state->listen_data;
index a361a7db20edbf406219922acebf2291f315b22c..5a21dade7b8659aa4d6e9e3c697a7e124ef31ccb 100644 (file)
@@ -4,6 +4,7 @@
 #include "fsm-listen.h"
 #include "fsmonitor--daemon.h"
 #include "gettext.h"
+#include "simple-ipc.h"
 #include "trace2.h"
 
 /*
@@ -289,8 +290,7 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
        SetEvent(state->listen_data->hListener[LISTENER_SHUTDOWN]);
 }
 
-static struct one_watch *create_watch(struct fsmonitor_daemon_state *state,
-                                     const char *path)
+static struct one_watch *create_watch(const char *path)
 {
        struct one_watch *watch = NULL;
        DWORD desired_access = FILE_LIST_DIRECTORY;
@@ -361,8 +361,7 @@ static void destroy_watch(struct one_watch *watch)
        free(watch);
 }
 
-static int start_rdcw_watch(struct fsm_listen_data *data,
-                           struct one_watch *watch)
+static int start_rdcw_watch(struct one_watch *watch)
 {
        DWORD dwNotifyFilter =
                FILE_NOTIFY_CHANGE_FILE_NAME |
@@ -735,11 +734,11 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
 
        state->listen_error_code = 0;
 
-       if (start_rdcw_watch(data, data->watch_worktree) == -1)
+       if (start_rdcw_watch(data->watch_worktree) == -1)
                goto force_error_stop;
 
        if (data->watch_gitdir &&
-           start_rdcw_watch(data, data->watch_gitdir) == -1)
+           start_rdcw_watch(data->watch_gitdir) == -1)
                goto force_error_stop;
 
        for (;;) {
@@ -755,7 +754,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
                        }
                        if (result == -2) {
                                /* retryable error */
-                               if (start_rdcw_watch(data, data->watch_worktree) == -1)
+                               if (start_rdcw_watch(data->watch_worktree) == -1)
                                        goto force_error_stop;
                                continue;
                        }
@@ -763,7 +762,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
                        /* have data */
                        if (process_worktree_events(state) == LISTENER_SHUTDOWN)
                                goto force_shutdown;
-                       if (start_rdcw_watch(data, data->watch_worktree) == -1)
+                       if (start_rdcw_watch(data->watch_worktree) == -1)
                                goto force_error_stop;
                        continue;
                }
@@ -776,7 +775,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
                        }
                        if (result == -2) {
                                /* retryable error */
-                               if (start_rdcw_watch(data, data->watch_gitdir) == -1)
+                               if (start_rdcw_watch(data->watch_gitdir) == -1)
                                        goto force_error_stop;
                                continue;
                        }
@@ -784,7 +783,7 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
                        /* have data */
                        if (process_gitdir_events(state) == LISTENER_SHUTDOWN)
                                goto force_shutdown;
-                       if (start_rdcw_watch(data, data->watch_gitdir) == -1)
+                       if (start_rdcw_watch(data->watch_gitdir) == -1)
                                goto force_error_stop;
                        continue;
                }
@@ -821,16 +820,14 @@ int fsm_listen__ctor(struct fsmonitor_daemon_state *state)
 
        data->hEventShutdown = CreateEvent(NULL, TRUE, FALSE, NULL);
 
-       data->watch_worktree = create_watch(state,
-                                           state->path_worktree_watch.buf);
+       data->watch_worktree = create_watch(state->path_worktree_watch.buf);
        if (!data->watch_worktree)
                goto failed;
 
        check_for_shortnames(data->watch_worktree);
 
        if (state->nr_paths_watching > 1) {
-               data->watch_gitdir = create_watch(state,
-                                                 state->path_gitdir_watch.buf);
+               data->watch_gitdir = create_watch(state->path_gitdir_watch.buf);
                if (!data->watch_gitdir)
                        goto failed;
        }
index c8a3e9dcdbb655eab0fbea2d42c1973ee67e16f7..f4f9cc1f336720614bcbb77d1ea908419801f9ab 100644 (file)
@@ -132,7 +132,8 @@ int fsmonitor__is_fs_remote(const char *path)
 /*
  * No-op for now.
  */
-int fsmonitor__get_alias(const char *path, struct alias_info *info)
+int fsmonitor__get_alias(const char *path UNUSED,
+                        struct alias_info *info UNUSED)
 {
        return 0;
 }
@@ -140,8 +141,8 @@ int fsmonitor__get_alias(const char *path, struct alias_info *info)
 /*
  * No-op for now.
  */
-char *fsmonitor__resolve_alias(const char *path,
-       const struct alias_info *info)
+char *fsmonitor__resolve_alias(const char *path UNUSED,
+                              const struct alias_info *info UNUSED)
 {
        return NULL;
 }
index b6f67444944b5ff60ed3823dc64fc10d36f2a778..0f2aa321f6e15f729aef67d4012fea6513cacfa4 100644 (file)
@@ -25,7 +25,7 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r)
        return FSMONITOR_REASON_OK;
 }
 
-enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
+enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc UNUSED)
 {
        enum fsmonitor_reason reason;
 
index ec5280da160135170e2d778cfcb19cea1752c211..320fb99a90e1db6006135e9798f7300f6fa29798 100644 (file)
@@ -255,6 +255,8 @@ int mingw_core_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "core.unsetenvvars")) {
+               if (!value)
+                       return config_error_nonbool(var);
                free(unset_environment_variables);
                unset_environment_variables = xstrdup(value);
                return 0;
@@ -705,13 +707,24 @@ ssize_t mingw_write(int fd, const void *buf, size_t len)
 {
        ssize_t result = write(fd, buf, len);
 
-       if (result < 0 && errno == EINVAL && buf) {
+       if (result < 0 && (errno == EINVAL || errno == ENOSPC) && buf) {
+               int orig = errno;
+
                /* check if fd is a pipe */
                HANDLE h = (HANDLE) _get_osfhandle(fd);
-               if (GetFileType(h) == FILE_TYPE_PIPE)
+               if (GetFileType(h) != FILE_TYPE_PIPE)
+                       errno = orig;
+               else if (orig == EINVAL)
                        errno = EPIPE;
-               else
-                       errno = EINVAL;
+               else {
+                       DWORD buf_size;
+
+                       if (!GetNamedPipeInfo(h, NULL, NULL, &buf_size, NULL))
+                               buf_size = 4096;
+                       if (len > buf_size)
+                               return write(fd, buf, buf_size);
+                       errno = orig;
+               }
        }
 
        return result;
@@ -2682,6 +2695,30 @@ static PSID get_current_user_sid(void)
        return result;
 }
 
+static BOOL user_sid_to_user_name(PSID sid, LPSTR *str)
+{
+       SID_NAME_USE pe_use;
+       DWORD len_user = 0, len_domain = 0;
+       BOOL translate_sid_to_user;
+
+       /*
+        * returns only FALSE, because the string pointers are NULL
+        */
+       LookupAccountSidA(NULL, sid, NULL, &len_user, NULL, &len_domain,
+                         &pe_use);
+       /*
+        * Alloc needed space of the strings
+        */
+       ALLOC_ARRAY((*str), (size_t)len_domain + (size_t)len_user);
+       translate_sid_to_user = LookupAccountSidA(NULL, sid,
+           (*str) + len_domain, &len_user, *str, &len_domain, &pe_use);
+       if (!translate_sid_to_user)
+               FREE_AND_NULL(*str);
+       else
+               (*str)[len_domain] = '/';
+       return translate_sid_to_user;
+}
+
 static int acls_supported(const char *path)
 {
        size_t offset = offset_1st_component(path);
@@ -2763,27 +2800,47 @@ int is_path_owned_by_current_sid(const char *path, struct strbuf *report)
                        strbuf_addf(report, "'%s' is on a file system that does "
                                    "not record ownership\n", path);
                } else if (report) {
-                       LPSTR str1, str2, to_free1 = NULL, to_free2 = NULL;
+                       LPSTR str1, str2, str3, str4, to_free1 = NULL,
+                           to_free3 = NULL, to_local_free2 = NULL,
+                           to_local_free4 = NULL;
 
-                       if (ConvertSidToStringSidA(sid, &str1))
+                       if (user_sid_to_user_name(sid, &str1))
                                to_free1 = str1;
                        else
                                str1 = "(inconvertible)";
-
-                       if (!current_user_sid)
-                               str2 = "(none)";
-                       else if (!IsValidSid(current_user_sid))
-                               str2 = "(invalid)";
-                       else if (ConvertSidToStringSidA(current_user_sid, &str2))
-                               to_free2 = str2;
+                       if (ConvertSidToStringSidA(sid, &str2))
+                               to_local_free2 = str2;
                        else
                                str2 = "(inconvertible)";
+
+                       if (!current_user_sid) {
+                               str3 = "(none)";
+                               str4 = "(none)";
+                       }
+                       else if (!IsValidSid(current_user_sid)) {
+                               str3 = "(invalid)";
+                               str4 = "(invalid)";
+                       } else {
+                               if (user_sid_to_user_name(current_user_sid,
+                                                         &str3))
+                                       to_free3 = str3;
+                               else
+                                       str3 = "(inconvertible)";
+                               if (ConvertSidToStringSidA(current_user_sid,
+                                                          &str4))
+                                       to_local_free4 = str4;
+                               else
+                                       str4 = "(inconvertible)";
+                       }
                        strbuf_addf(report,
                                    "'%s' is owned by:\n"
-                                   "\t'%s'\nbut the current user is:\n"
-                                   "\t'%s'\n", path, str1, str2);
-                       LocalFree(to_free1);
-                       LocalFree(to_free2);
+                                   "\t%s (%s)\nbut the current user is:\n"
+                                   "\t%s (%s)\n",
+                                   path, str1, str2, str3, str4);
+                       free(to_free1);
+                       LocalFree(to_local_free2);
+                       free(to_free3);
+                       LocalFree(to_local_free4);
                }
        }
 
index e5e1dda8ccdb60320a05b064479595eb4eb4997c..cb176d966f287d98e44495db1797061c8c1102af 100644 (file)
@@ -1,8 +1,5 @@
 #include "git-compat-util.h"
 #include "simple-ipc.h"
-#include "strbuf.h"
-#include "pkt-line.h"
-#include "thread-utils.h"
 
 #ifndef SUPPORTS_SIMPLE_IPC
 /*
index b2f4f22ce44f51f6f8f18e0d7ca6a2ed22de183b..9b3f2cdf8c9608a5aae4dc3ebfd8fa208c5617de 100644 (file)
@@ -2,7 +2,6 @@
 #include "gettext.h"
 #include "simple-ipc.h"
 #include "strbuf.h"
-#include "pkt-line.h"
 #include "thread-utils.h"
 #include "trace2.h"
 #include "unix-socket.h"
index 83d95e8656301d29b287801d74bc4dc42af52683..0afda730f278cc776e430ca6b5f44712d5b27f7b 100644 (file)
@@ -479,10 +479,13 @@ struct escape_sequence_entry {
 };
 
 static int sequence_entry_cmp(const void *hashmap_cmp_fn_data UNUSED,
-                             const struct escape_sequence_entry *e1,
-                             const struct escape_sequence_entry *e2,
+                             const struct hashmap_entry *he1,
+                             const struct hashmap_entry *he2,
                              const void *keydata)
 {
+       const struct escape_sequence_entry
+               *e1 = container_of(he1, const struct escape_sequence_entry, entry),
+               *e2 = container_of(he2, const struct escape_sequence_entry, entry);
        return strcmp(e1->sequence, keydata ? keydata : e2->sequence);
 }
 
@@ -496,8 +499,7 @@ static int is_known_escape_sequence(const char *sequence)
                struct strbuf buf = STRBUF_INIT;
                char *p, *eol;
 
-               hashmap_init(&sequences, (hashmap_cmp_fn)sequence_entry_cmp,
-                            NULL, 0);
+               hashmap_init(&sequences, sequence_entry_cmp, NULL, 0);
 
                strvec_pushl(&cp.args, "infocmp", "-L", "-1", NULL);
                if (pipe_command(&cp, NULL, 0, &buf, 0, NULL, 0))
index 3846a37be971c92153eb1ceeb65c6e612c8e173c..3cfeb3d8bd99f4ca15d0f3a06cd4b1fe932f7f47 100644 (file)
--- a/config.c
+++ b/config.c
@@ -11,6 +11,7 @@
 #include "date.h"
 #include "branch.h"
 #include "config.h"
+#include "parse.h"
 #include "convert.h"
 #include "environment.h"
 #include "gettext.h"
@@ -18,6 +19,7 @@
 #include "repository.h"
 #include "lockfile.h"
 #include "mailmap.h"
+#include "attr.h"
 #include "exec-cmd.h"
 #include "strbuf.h"
 #include "quote.h"
 #include "pager.h"
 #include "path.h"
 #include "utf8.h"
-#include "dir.h"
 #include "color.h"
-#include "replace-object.h"
 #include "refs.h"
 #include "setup.h"
 #include "strvec.h"
 #include "trace2.h"
 #include "wildmatch.h"
-#include "worktree.h"
 #include "ws.h"
 #include "write-or-die.h"
 
@@ -96,7 +95,6 @@ static long config_file_ftell(struct config_source *conf)
        return ftell(conf->u.file);
 }
 
-
 static int config_buf_fgetc(struct config_source *conf)
 {
        if (conf->u.buf.pos < conf->u.buf.len)
@@ -1165,129 +1163,6 @@ static int git_parse_source(struct config_source *cs, config_fn_t fn,
        return error_return;
 }
 
-static uintmax_t get_unit_factor(const char *end)
-{
-       if (!*end)
-               return 1;
-       else if (!strcasecmp(end, "k"))
-               return 1024;
-       else if (!strcasecmp(end, "m"))
-               return 1024 * 1024;
-       else if (!strcasecmp(end, "g"))
-               return 1024 * 1024 * 1024;
-       return 0;
-}
-
-static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
-{
-       if (value && *value) {
-               char *end;
-               intmax_t val;
-               intmax_t factor;
-
-               if (max < 0)
-                       BUG("max must be a positive integer");
-
-               errno = 0;
-               val = strtoimax(value, &end, 0);
-               if (errno == ERANGE)
-                       return 0;
-               if (end == value) {
-                       errno = EINVAL;
-                       return 0;
-               }
-               factor = get_unit_factor(end);
-               if (!factor) {
-                       errno = EINVAL;
-                       return 0;
-               }
-               if ((val < 0 && -max / factor > val) ||
-                   (val > 0 && max / factor < val)) {
-                       errno = ERANGE;
-                       return 0;
-               }
-               val *= factor;
-               *ret = val;
-               return 1;
-       }
-       errno = EINVAL;
-       return 0;
-}
-
-static int git_parse_unsigned(const char *value, uintmax_t *ret, uintmax_t max)
-{
-       if (value && *value) {
-               char *end;
-               uintmax_t val;
-               uintmax_t factor;
-
-               /* negative values would be accepted by strtoumax */
-               if (strchr(value, '-')) {
-                       errno = EINVAL;
-                       return 0;
-               }
-               errno = 0;
-               val = strtoumax(value, &end, 0);
-               if (errno == ERANGE)
-                       return 0;
-               if (end == value) {
-                       errno = EINVAL;
-                       return 0;
-               }
-               factor = get_unit_factor(end);
-               if (!factor) {
-                       errno = EINVAL;
-                       return 0;
-               }
-               if (unsigned_mult_overflows(factor, val) ||
-                   factor * val > max) {
-                       errno = ERANGE;
-                       return 0;
-               }
-               val *= factor;
-               *ret = val;
-               return 1;
-       }
-       errno = EINVAL;
-       return 0;
-}
-
-int git_parse_int(const char *value, int *ret)
-{
-       intmax_t tmp;
-       if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(int)))
-               return 0;
-       *ret = tmp;
-       return 1;
-}
-
-static int git_parse_int64(const char *value, int64_t *ret)
-{
-       intmax_t tmp;
-       if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(int64_t)))
-               return 0;
-       *ret = tmp;
-       return 1;
-}
-
-int git_parse_ulong(const char *value, unsigned long *ret)
-{
-       uintmax_t tmp;
-       if (!git_parse_unsigned(value, &tmp, maximum_unsigned_value_of_type(long)))
-               return 0;
-       *ret = tmp;
-       return 1;
-}
-
-int git_parse_ssize_t(const char *value, ssize_t *ret)
-{
-       intmax_t tmp;
-       if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(ssize_t)))
-               return 0;
-       *ret = tmp;
-       return 1;
-}
-
 NORETURN
 static void die_bad_number(const char *name, const char *value,
                           const struct key_value_info *kvi)
@@ -1363,23 +1238,6 @@ ssize_t git_config_ssize_t(const char *name, const char *value,
        return ret;
 }
 
-static int git_parse_maybe_bool_text(const char *value)
-{
-       if (!value)
-               return 1;
-       if (!*value)
-               return 0;
-       if (!strcasecmp(value, "true")
-           || !strcasecmp(value, "yes")
-           || !strcasecmp(value, "on"))
-               return 1;
-       if (!strcasecmp(value, "false")
-           || !strcasecmp(value, "no")
-           || !strcasecmp(value, "off"))
-               return 0;
-       return -1;
-}
-
 static const struct fsync_component_name {
        const char *name;
        enum fsync_component component_bits;
@@ -1454,16 +1312,6 @@ next_name:
        return (current & ~negative) | positive;
 }
 
-int git_parse_maybe_bool(const char *value)
-{
-       int v = git_parse_maybe_bool_text(value);
-       if (0 <= v)
-               return v;
-       if (git_parse_int(value, &v))
-               return !!v;
-       return -1;
-}
-
 int git_config_bool_or_int(const char *name, const char *value,
                           const struct key_value_info *kvi, int *is_bool)
 {
@@ -1534,10 +1382,15 @@ static int git_default_core_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "core.checkstat")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (!strcasecmp(value, "default"))
                        check_stat = 1;
                else if (!strcasecmp(value, "minimal"))
                        check_stat = 0;
+               else
+                       return error(_("invalid value for '%s': '%s'"),
+                                    var, value);
        }
 
        if (!strcmp(var, "core.quotepath")) {
@@ -1694,12 +1547,12 @@ static int git_default_core_config(const char *var, const char *value,
                return 0;
        }
 
-       if (!strcmp(var, "core.checkroundtripencoding")) {
-               check_roundtrip_encoding = xstrdup(value);
-               return 0;
-       }
+       if (!strcmp(var, "core.checkroundtripencoding"))
+               return git_config_string(&check_roundtrip_encoding, var, value);
 
        if (!strcmp(var, "core.notesref")) {
+               if (!value)
+                       return config_error_nonbool(var);
                notes_ref_name = xstrdup(value);
                return 0;
        }
@@ -1767,6 +1620,8 @@ static int git_default_core_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "core.createobject")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (!strcmp(value, "rename"))
                        object_creation_mode = OBJECT_CREATION_USES_RENAMES;
                else if (!strcmp(value, "link"))
@@ -1801,6 +1656,11 @@ static int git_default_core_config(const char *var, const char *value,
                return 0;
        }
 
+       if (!strcmp(var, "core.maxtreedepth")) {
+               max_allowed_tree_depth = git_config_int(var, value, ctx->kvi);
+               return 0;
+       }
+
        /* Add other config variables here and to Documentation/config.txt. */
        return platform_core_config(var, value, ctx, cb);
 }
@@ -1904,6 +1764,18 @@ static int git_default_mailmap_config(const char *var, const char *value)
        return 0;
 }
 
+static int git_default_attr_config(const char *var, const char *value)
+{
+       if (!strcmp(var, "attr.tree"))
+               return git_config_string(&git_attr_tree, var, value);
+
+       /*
+        * Add other attribute related config variables here and to
+        * Documentation/config/attr.txt.
+        */
+       return 0;
+}
+
 int git_default_config(const char *var, const char *value,
                       const struct config_context *ctx, void *cb)
 {
@@ -1927,6 +1799,9 @@ int git_default_config(const char *var, const char *value,
        if (starts_with(var, "mailmap."))
                return git_default_mailmap_config(var, value);
 
+       if (starts_with(var, "attr."))
+               return git_default_attr_config(var, value);
+
        if (starts_with(var, "advice.") || starts_with(var, "color.advice"))
                return git_default_advice_config(var, value);
 
@@ -2112,7 +1987,27 @@ char *git_system_config(void)
        return system_config;
 }
 
-void git_global_config(char **user_out, char **xdg_out)
+char *git_global_config(void)
+{
+       char *user_config, *xdg_config;
+
+       git_global_config_paths(&user_config, &xdg_config);
+       if (!user_config) {
+               free(xdg_config);
+               return NULL;
+       }
+
+       if (access_or_warn(user_config, R_OK, 0) && xdg_config &&
+           !access_or_warn(xdg_config, R_OK, 0)) {
+               free(user_config);
+               return xdg_config;
+       } else {
+               free(xdg_config);
+               return user_config;
+       }
+}
+
+void git_global_config_paths(char **user_out, char **xdg_out)
 {
        char *user_config = xstrdup_or_null(getenv("GIT_CONFIG_GLOBAL"));
        char *xdg_config = NULL;
@@ -2126,28 +2021,6 @@ void git_global_config(char **user_out, char **xdg_out)
        *xdg_out = xdg_config;
 }
 
-/*
- * Parse environment variable 'k' as a boolean (in various
- * possible spellings); if missing, use the default value 'def'.
- */
-int git_env_bool(const char *k, int def)
-{
-       const char *v = getenv(k);
-       return v ? git_config_bool(k, v) : def;
-}
-
-/*
- * Parse environment variable 'k' as ulong with possibly a unit
- * suffix; if missing, use the default value 'val'.
- */
-unsigned long git_env_ulong(const char *k, unsigned long val)
-{
-       const char *v = getenv(k);
-       if (v && !git_parse_ulong(v, &val))
-               die(_("failed to parse %s"), k);
-       return val;
-}
-
 int git_config_system(void)
 {
        return !git_env_bool("GIT_CONFIG_NOSYSTEM", 0);
@@ -2187,7 +2060,7 @@ static int do_git_config_sequence(const struct config_options *opts,
                                                         data, CONFIG_SCOPE_SYSTEM,
                                                         NULL);
 
-       git_global_config(&user_config, &xdg_config);
+       git_global_config_paths(&user_config, &xdg_config);
 
        if (xdg_config && !access_or_die(xdg_config, R_OK, ACCESS_EACCES_OK))
                ret += git_config_from_file_with_options(fn, xdg_config, data,
@@ -3564,7 +3437,6 @@ out_free:
 write_err_out:
        ret = write_error(get_lock_file_path(&lock));
        goto out_free;
-
 }
 
 void git_config_set_multivar_in_file(const char *config_filename,
index 6332d749047764aff33000d01fc78f75ddfe03b1..5dba984f770e4e96d322874351a70d0f7d0ee8ba 100644 (file)
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
 #include "hashmap.h"
 #include "string-list.h"
 #include "repository.h"
-
+#include "parse.h"
 
 /**
  * The config API gives callers a way to access Git configuration files
@@ -243,16 +243,6 @@ int config_with_options(config_fn_t fn, void *,
  * The following helper functions aid in parsing string values
  */
 
-int git_parse_ssize_t(const char *, ssize_t *);
-int git_parse_ulong(const char *, unsigned long *);
-int git_parse_int(const char *value, int *ret);
-
-/**
- * Same as `git_config_bool`, except that it returns -1 on error rather
- * than dying.
- */
-int git_parse_maybe_bool(const char *);
-
 /**
  * Parse the string to an integer, including unit factors. Dies on error;
  * otherwise, returns the parsed result.
@@ -385,8 +375,6 @@ int git_config_rename_section(const char *, const char *);
 int git_config_rename_section_in_file(const char *, const char *, const char *);
 int git_config_copy_section(const char *, const char *);
 int git_config_copy_section_in_file(const char *, const char *, const char *);
-int git_env_bool(const char *, int);
-unsigned long git_env_ulong(const char *, unsigned long);
 int git_config_system(void);
 int config_error_nonbool(const char *);
 #if defined(__GNUC__)
@@ -394,7 +382,8 @@ int config_error_nonbool(const char *);
 #endif
 
 char *git_system_config(void);
-void git_global_config(char **user, char **xdg);
+char *git_global_config(void);
+void git_global_config_paths(char **user, char **xdg);
 
 int git_config_parse_parameter(const char *, config_fn_t fn, void *data);
 
index 3bb03f423a08102f837c52dcbe7a3b581104e0cb..d0dcca2ec554cddf61447215357a7e15877b0aca 100644 (file)
@@ -158,6 +158,19 @@ ifeq ($(uname_S),Darwin)
                ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
                        MSGFMT = /usr/local/opt/gettext/bin/msgfmt
                endif
+       # On newer ARM-based machines the default installation path has changed to
+       # /opt/homebrew. Include it in our search paths so that the user does not
+       # have to configure this manually.
+       #
+       # Note that we do not employ the same workaround as above where we manually
+       # add gettext. The issue was fixed more than three years ago by now, and at
+       # that point there haven't been any ARM-based Macs yet.
+       else ifeq ($(shell test -d /opt/homebrew/ && echo y),y)
+               BASIC_CFLAGS += -I/opt/homebrew/include
+               BASIC_LDFLAGS += -L/opt/homebrew/lib
+               ifeq ($(shell test -x /opt/homebrew/bin/msgfmt && echo y),y)
+                       MSGFMT = /opt/homebrew/bin/msgfmt
+               endif
        endif
 
        # The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
@@ -625,6 +638,18 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
        SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
        SHELL_PATH = /usr/coreutils/bin/bash
 endif
+ifeq ($(uname_S),OS/390)
+       NO_SYS_POLL_H = YesPlease
+       NO_STRCASESTR = YesPlease
+       NO_REGEX = YesPlease
+       NO_MMAP = YesPlease
+       NO_NSEC = YesPlease
+       NO_STRLCPY = YesPlease
+       NO_MEMMEM = YesPlease
+       NO_GECOS_IN_PWENT = YesPlease
+       HAVE_STRINGS_H = YesPlease
+       NEEDS_MODE_TRANSLATION = YesPlease
+endif
 ifeq ($(uname_S),MINGW)
        ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
                $(error "Building with MSys is no longer supported")
index 276593cd9dd935a283620f3b9d25b09987c04bf2..d1a96da14eb56766e1538da80ab97ed8a99b24f6 100644 (file)
@@ -94,7 +94,7 @@ AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR],
 [AC_ARG_WITH([$1],
  [AS_HELP_STRING([--with-$1=VALUE], $3)],
  if test -n "$withval"; then
-  if test "$withval" = "yes" -o "$withval" = "no"; then
+  if test "$withval" = "yes" || test "$withval" = "no"; then
     AC_MSG_WARN([You likely do not want either 'yes' or 'no' as]
                     [a value for $1 ($2).  Maybe you do...?])
   fi
index 05f291c1f1d3d1018f390618816f94d0cd58951b..21d3d0e7dee46de8ee07ae69d9735b76643693db 100644 (file)
@@ -23,7 +23,7 @@ This is the same way as how I have been treating gitk, and to a
 lesser degree various foreign SCM interfaces, so you know the
 drill.
 
-I expect that things that start their life in the contrib/ area
+I expect things that start their life in the contrib/ area
 to graduate out of contrib/ once they mature, either by becoming
 projects on their own, or moving to the toplevel directory.  On
 the other hand, I expect I'll be proposing removal of disused
@@ -31,7 +31,7 @@ and inactive ones from time to time.
 
 If you have new things to add to this area, please first propose
 it on the git mailing list, and after a list discussion proves
-there are some general interests (it does not have to be a
+there is general interest (it does not have to be a
 list-wide consensus for a tool targeted to a relatively narrow
 audience -- for example I do not work with projects whose
 upstream is svn, so I have no use for git-svn myself, but it is
index 6b819e2fbdf357f8401a29b5f8daa29e43284cfe..804629c525b1b1978512c9d15b710bfebeef185e 100644 (file)
@@ -974,6 +974,35 @@ target_link_libraries(test-fake-ssh common-main)
 parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
 list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 
+#unit-tests
+add_library(unit-test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
+
+parse_makefile_for_scripts(unit_test_PROGRAMS "UNIT_TEST_PROGRAMS" "")
+foreach(unit_test ${unit_test_PROGRAMS})
+       add_executable("${unit_test}" "${CMAKE_SOURCE_DIR}/t/unit-tests/${unit_test}.c")
+       target_link_libraries("${unit_test}" unit-test-lib common-main)
+       set_target_properties("${unit_test}"
+               PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
+       if(MSVC)
+               set_target_properties("${unit_test}"
+                       PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
+               set_target_properties("${unit_test}"
+                       PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
+       endif()
+       list(APPEND PROGRAMS_BUILT "${unit_test}")
+
+       # t-basic intentionally fails tests, to validate the unit-test infrastructure.
+       # Therefore, it should only be run as part of t0080, which verifies that it
+       # fails only in the expected ways.
+       #
+       # All other unit tests should be run.
+       if(NOT ${unit_test} STREQUAL "t-basic")
+               add_test(NAME "t.unit-tests.${unit_test}"
+                       COMMAND "./${unit_test}"
+                       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t/unit-tests/bin)
+       endif()
+endforeach()
+
 #test-tool
 parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
 
@@ -1093,17 +1122,18 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH})
        file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-completion.bash DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/)
 endif()
 
-file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh")
+file(GLOB test_scripts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh")
 
 #test
-foreach(tsh ${test_scipts})
-       add_test(NAME ${tsh}
+foreach(tsh ${test_scripts})
+       string(REGEX REPLACE ".*/(.*)\\.sh" "\\1" test_name ${tsh})
+       add_test(NAME "t.suite.${test_name}"
                COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx
                WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
 endforeach()
 
 # This test script takes an extremely long time and is known to time out even
 # on fast machines because it requires in excess of one hour to run
-set_tests_properties("${CMAKE_SOURCE_DIR}/t/t7112-reset-submodule.sh" PROPERTIES TIMEOUT 4000)
+set_tests_properties("t.suite.t7112-reset-submodule" PROPERTIES TIMEOUT 4000)
 
 endif()#BUILD_TESTING
diff --git a/contrib/coccinelle/xstrncmpz.cocci b/contrib/coccinelle/xstrncmpz.cocci
new file mode 100644 (file)
index 0000000..ccb39e2
--- /dev/null
@@ -0,0 +1,28 @@
+@@
+expression S, T, L;
+@@
+(
+- strncmp(S, T, L) || S[L]
++ !!xstrncmpz(S, T, L)
+|
+- strncmp(S, T, L) || S[L] != '\0'
++ !!xstrncmpz(S, T, L)
+|
+- strncmp(S, T, L) || T[L]
++ !!xstrncmpz(T, S, L)
+|
+- strncmp(S, T, L) || T[L] != '\0'
++ !!xstrncmpz(T, S, L)
+|
+- !strncmp(S, T, L) && !S[L]
++ !xstrncmpz(S, T, L)
+|
+- !strncmp(S, T, L) && S[L] == '\0'
++ !xstrncmpz(S, T, L)
+|
+- !strncmp(S, T, L) && !T[L]
++ !xstrncmpz(T, S, L)
+|
+- !strncmp(S, T, L) && T[L] == '\0'
++ !xstrncmpz(T, S, L)
+)
index 133ec92bfae72186721b4a51c50922f6d542be80..75193ded4bdeda01fc440db26b08e40ae2d3a73f 100644 (file)
@@ -28,6 +28,8 @@
 # completion style.  For example '!f() { : git commit ; ... }; f' will
 # tell the completion to use commit completion.  This also works with aliases
 # of form "!sh -c '...'".  For example, "!sh -c ': git commit ; ... '".
+# Note that "git" is optional --- '!f() { : commit; ...}; f' would complete
+# just like the 'git commit' command.
 #
 # If you have a command that is not part of git, but you would still
 # like completion, you can use __git_complete:
@@ -120,6 +122,40 @@ __git ()
                ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
 }
 
+# Helper function to read the first line of a file into a variable.
+# __git_eread requires 2 arguments, the file path and the name of the
+# variable, in that order.
+#
+# This is taken from git-prompt.sh.
+__git_eread ()
+{
+       test -r "$1" && IFS=$'\r\n' read -r "$2" <"$1"
+}
+
+# Runs git in $__git_repo_path to determine whether a pseudoref exists.
+# 1: The pseudo-ref to search
+__git_pseudoref_exists ()
+{
+       local ref=$1
+       local head
+
+       __git_find_repo_path
+
+       # If the reftable is in use, we have to shell out to 'git rev-parse'
+       # to determine whether the ref exists instead of looking directly in
+       # the filesystem to determine whether the ref exists. Otherwise, use
+       # Bash builtins since executing Git commands are expensive on some
+       # platforms.
+       if __git_eread "$__git_repo_path/HEAD" head; then
+               if [ "$head" == "ref: refs/heads/.invalid" ]; then
+                       __git show-ref --exists "$ref"
+                       return $?
+               fi
+       fi
+
+       [ -f "$__git_repo_path/$ref" ]
+}
+
 # Removes backslash escaping, single quotes and double quotes from a word,
 # stores the result in the variable $dequoted_word.
 # 1: The word to dequote.
@@ -418,16 +454,18 @@ fi
 
 # This function is equivalent to
 #
-#    __gitcomp "$(git xxx --git-completion-helper) ..."
+#    ___git_resolved_builtins=$(git xxx --git-completion-helper)
 #
-# except that the output is cached. Accept 1-3 arguments:
+# except that the result of the execution is cached.
+#
+# Accept 1-3 arguments:
 # 1: the git command to execute, this is also the cache key
+#    (use "_" when the command contains spaces, e.g. "remote add"
+#    becomes "remote_add")
 # 2: extra options to be added on top (e.g. negative forms)
 # 3: options to be excluded
-__gitcomp_builtin ()
+__git_resolve_builtins ()
 {
-       # spaces must be replaced with underscore for multi-word
-       # commands, e.g. "git remote add" becomes remote_add.
        local cmd="$1"
        local incl="${2-}"
        local excl="${3-}"
@@ -453,7 +491,24 @@ __gitcomp_builtin ()
                eval "$var=\"$options\""
        fi
 
-       __gitcomp "$options"
+       ___git_resolved_builtins="$options"
+}
+
+# This function is equivalent to
+#
+#    __gitcomp "$(git xxx --git-completion-helper) ..."
+#
+# except that the output is cached. Accept 1-3 arguments:
+# 1: the git command to execute, this is also the cache key
+#    (use "_" when the command contains spaces, e.g. "remote add"
+#    becomes "remote_add")
+# 2: extra options to be added on top (e.g. negative forms)
+# 3: options to be excluded
+__gitcomp_builtin ()
+{
+       __git_resolve_builtins "$1" "$2" "$3"
+
+       __gitcomp "$___git_resolved_builtins"
 }
 
 # Variation of __gitcomp_nl () that appends to the existing list of
@@ -520,6 +575,26 @@ __gitcomp_file ()
        true
 }
 
+# Find the current subcommand for commands that follow the syntax:
+#
+#    git <command> <subcommand>
+#
+# 1: List of possible subcommands.
+# 2: Optional subcommand to return when none is found.
+__git_find_subcommand ()
+{
+       local subcommand subcommands="$1" default_subcommand="$2"
+
+       for subcommand in $subcommands; do
+               if [ "$subcommand" = "${words[__git_cmd_idx+1]}" ]; then
+                       echo $subcommand
+                       return
+               fi
+       done
+
+       echo $default_subcommand
+}
+
 # Execute 'git ls-files', unless the --committable option is specified, in
 # which case it runs 'git diff-index' to find out the files that can be
 # committed.  It return paths relative to the directory specified in the first
@@ -1182,7 +1257,7 @@ __git_aliased_command ()
                        :)      : skip null command ;;
                        \'*)    : skip opening quote after sh -c ;;
                        *)
-                               cur="$word"
+                               cur="${word%;}"
                                break
                        esac
                done
@@ -1447,12 +1522,32 @@ _git_bisect ()
 {
        __git_has_doubledash && return
 
-       local subcommands="start bad good skip reset visualize replay log run"
-       local subcommand="$(__git_find_on_cmdline "$subcommands")"
+       __git_find_repo_path
+
+       # If a bisection is in progress get the terms being used.
+       local term_bad term_good
+       if [ -f "$__git_repo_path"/BISECT_TERMS ]; then
+               term_bad=$(__git bisect terms --term-bad)
+               term_good=$(__git bisect terms --term-good)
+       fi
+
+       # We will complete any custom terms, but still always complete the
+       # more usual bad/new/good/old because git bisect gives a good error
+       # message if these are given when not in use, and that's better than
+       # silent refusal to complete if the user is confused.
+       #
+       # We want to recognize 'view' but not complete it, because it overlaps
+       # with 'visualize' too much and is just an alias for it.
+       #
+       local completable_subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help"
+       local all_subcommands="$completable_subcommands view"
+
+       local subcommand="$(__git_find_on_cmdline "$all_subcommands")"
+
        if [ -z "$subcommand" ]; then
                __git_find_repo_path
                if [ -f "$__git_repo_path"/BISECT_START ]; then
-                       __gitcomp "$subcommands"
+                       __gitcomp "$completable_subcommands"
                else
                        __gitcomp "replay start"
                fi
@@ -1460,7 +1555,26 @@ _git_bisect ()
        fi
 
        case "$subcommand" in
-       bad|good|reset|skip|start)
+       start)
+               case "$cur" in
+               --*)
+                       __gitcomp "--first-parent --no-checkout --term-new --term-bad --term-old --term-good"
+                       return
+                       ;;
+               *)
+                       __git_complete_refs
+                       ;;
+               esac
+               ;;
+       terms)
+               __gitcomp "--term-good --term-old --term-bad --term-new"
+               return
+               ;;
+       visualize|view)
+               __git_complete_log_opts
+               return
+               ;;
+       bad|new|"$term_bad"|good|old|"$term_good"|reset|skip)
                __git_complete_refs
                ;;
        *)
@@ -1607,7 +1721,7 @@ _git_checkout ()
 
                if [ -n "$(__git_find_on_cmdline "-b -B -d --detach --orphan")" ]; then
                        __git_complete_refs --mode="refs"
-               elif [ -n "$(__git_find_on_cmdline "--track")" ]; then
+               elif [ -n "$(__git_find_on_cmdline "-t --track")" ]; then
                        __git_complete_refs --mode="remote-heads"
                else
                        __git_complete_refs $dwim_opt --mode="refs"
@@ -1622,8 +1736,7 @@ __git_cherry_pick_inprogress_options=$__git_sequencer_inprogress_options
 
 _git_cherry_pick ()
 {
-       __git_find_repo_path
-       if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then
+       if __git_pseudoref_exists CHERRY_PICK_HEAD; then
                __gitcomp "$__git_cherry_pick_inprogress_options"
                return
        fi
@@ -1677,6 +1790,11 @@ _git_clone ()
 
 __git_untracked_file_modes="all no normal"
 
+__git_trailer_tokens ()
+{
+       __git config --name-only --get-regexp '^trailer\..*\.key$' | cut -d. -f 2- | rev | cut -d. -f2- | rev
+}
+
 _git_commit ()
 {
        case "$prev" in
@@ -1701,6 +1819,10 @@ _git_commit ()
                __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
                return
                ;;
+       --trailer=*)
+               __gitcomp_nl "$(__git_trailer_tokens)" "" "${cur##--trailer=}" ":"
+               return
+               ;;
        --*)
                __gitcomp_builtin commit
                return
@@ -1764,7 +1886,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
                        --output= --output-indicator-context=
                        --output-indicator-new= --output-indicator-old=
                        --ws-error-highlight=
-                       --pickaxe-all --pickaxe-regex
+                       --pickaxe-all --pickaxe-regex --patch-with-raw
 "
 
 # Options for diff/difftool
@@ -2028,6 +2150,16 @@ __git_log_common_options="
        --min-age= --until= --before=
        --min-parents= --max-parents=
        --no-min-parents --no-max-parents
+       --alternate-refs --ancestry-path
+       --author-date-order --basic-regexp
+       --bisect --boundary --exclude-first-parent-only
+       --exclude-hidden --extended-regexp
+       --fixed-strings --grep-reflog
+       --ignore-missing --left-only --perl-regexp
+       --reflog --regexp-ignore-case --remove-empty
+       --right-only --show-linear-break
+       --show-notes-by-default --show-pulls
+       --since-as-filter --single-worktree
 "
 # Options that go well for log and gitk (not shortlog)
 __git_log_gitk_options="
@@ -2042,7 +2174,8 @@ __git_log_shortlog_options="
 "
 # Options accepted by log and show
 __git_log_show_options="
-       --diff-merges --diff-merges= --no-diff-merges --remerge-diff
+       --diff-merges --diff-merges= --no-diff-merges --dd --remerge-diff
+       --encoding=
 "
 
 __git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r"
@@ -2050,13 +2183,15 @@ __git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-c
 __git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
 __git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
 
-_git_log ()
+# Complete porcelain (i.e. not git-rev-list) options and at least some
+# option arguments accepted by git-log.  Note that this same set of options
+# are also accepted by some other git commands besides git-log.
+__git_complete_log_opts ()
 {
-       __git_has_doubledash && return
-       __git_find_repo_path
+       COMPREPLY=()
 
        local merge=""
-       if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
+       if __git_pseudoref_exists MERGE_HEAD; then
                merge="--merge"
        fi
        case "$prev,$cur" in
@@ -2126,6 +2261,8 @@ _git_log ()
                        --no-walk --no-walk= --do-walk
                        --parents --children
                        --expand-tabs --expand-tabs= --no-expand-tabs
+                       --clear-decorations --decorate-refs=
+                       --decorate-refs-exclude=
                        $merge
                        $__git_diff_common_options
                        "
@@ -2147,6 +2284,16 @@ _git_log ()
                return
                ;;
        esac
+}
+
+_git_log ()
+{
+       __git_has_doubledash && return
+       __git_find_repo_path
+
+       __git_complete_log_opts
+        [ ${#COMPREPLY[@]} -eq 0 ] || return
+
        __git_complete_revlist
 }
 
@@ -2363,13 +2510,30 @@ _git_rebase ()
 
 _git_reflog ()
 {
-       local subcommands="show delete expire"
-       local subcommand="$(__git_find_on_cmdline "$subcommands")"
+       local subcommands subcommand
 
-       if [ -z "$subcommand" ]; then
-               __gitcomp "$subcommands"
-       else
-               __git_complete_refs
+       __git_resolve_builtins "reflog"
+
+       subcommands="$___git_resolved_builtins"
+       subcommand="$(__git_find_subcommand "$subcommands" "show")"
+
+       case "$subcommand,$cur" in
+       show,--*)
+               __gitcomp "
+                       $__git_log_common_options
+                       "
+               return
+               ;;
+       $subcommand,--*)
+               __gitcomp_builtin "reflog_$subcommand"
+               return
+               ;;
+       esac
+
+       __git_complete_refs
+
+       if [ $((cword - __git_cmd_idx)) -eq 1 ]; then
+               __gitcompappend "$subcommands" "" "$cur" " "
        fi
 }
 
@@ -2514,7 +2678,7 @@ _git_switch ()
 
                if [ -n "$(__git_find_on_cmdline "-c -C -d --detach")" ]; then
                        __git_complete_refs --mode="refs"
-               elif [ -n "$(__git_find_on_cmdline "--track")" ]; then
+               elif [ -n "$(__git_find_on_cmdline "-t --track")" ]; then
                        __git_complete_refs --mode="remote-heads"
                else
                        __git_complete_refs $dwim_opt --mode="heads"
@@ -2552,6 +2716,33 @@ __git_compute_config_vars ()
        __git_config_vars="$(git help --config-for-completion)"
 }
 
+__git_config_vars_all=
+__git_compute_config_vars_all ()
+{
+       test -n "$__git_config_vars_all" ||
+       __git_config_vars_all="$(git --no-pager help --config)"
+}
+
+__git_compute_first_level_config_vars_for_section ()
+{
+       local section="$1"
+       __git_compute_config_vars
+       local this_section="__git_first_level_config_vars_for_section_${section}"
+       test -n "${!this_section}" ||
+       printf -v "__git_first_level_config_vars_for_section_${section}" %s \
+               "$(echo "$__git_config_vars" | awk -F. "/^${section}\.[a-z]/ { print \$2 }")"
+}
+
+__git_compute_second_level_config_vars_for_section ()
+{
+       local section="$1"
+       __git_compute_config_vars_all
+       local this_section="__git_second_level_config_vars_for_section_${section}"
+       test -n "${!this_section}" ||
+       printf -v "__git_second_level_config_vars_for_section_${section}" %s \
+               "$(echo "$__git_config_vars_all" | awk -F. "/^${section}\.</ { print \$3 }")"
+}
+
 __git_config_sections=
 __git_compute_config_sections ()
 {
@@ -2696,73 +2887,50 @@ __git_complete_config_variable_name ()
        done
 
        case "$cur_" in
-       branch.*.*)
+       branch.*.*|guitool.*.*|difftool.*.*|man.*.*|mergetool.*.*|remote.*.*|submodule.*.*|url.*.*)
                local pfx="${cur_%.*}."
                cur_="${cur_##*.}"
-               __gitcomp "remote pushRemote merge mergeOptions rebase" "$pfx" "$cur_" "$sfx"
+               local section="${pfx%.*.}"
+               __git_compute_second_level_config_vars_for_section "${section}"
+               local this_section="__git_second_level_config_vars_for_section_${section}"
+               __gitcomp "${!this_section}" "$pfx" "$cur_" "$sfx"
                return
                ;;
        branch.*)
                local pfx="${cur_%.*}."
                cur_="${cur_#*.}"
+               local section="${pfx%.}"
                __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
-               __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "${sfx- }"
-               return
-               ;;
-       guitool.*.*)
-               local pfx="${cur_%.*}."
-               cur_="${cur_##*.}"
-               __gitcomp "
-                       argPrompt cmd confirm needsFile noConsole noRescan
-                       prompt revPrompt revUnmerged title
-                       " "$pfx" "$cur_" "$sfx"
-               return
-               ;;
-       difftool.*.*)
-               local pfx="${cur_%.*}."
-               cur_="${cur_##*.}"
-               __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"
-               return
-               ;;
-       man.*.*)
-               local pfx="${cur_%.*}."
-               cur_="${cur_##*.}"
-               __gitcomp "cmd path" "$pfx" "$cur_" "$sfx"
-               return
-               ;;
-       mergetool.*.*)
-               local pfx="${cur_%.*}."
-               cur_="${cur_##*.}"
-               __gitcomp "cmd path trustExitCode" "$pfx" "$cur_" "$sfx"
+               __git_compute_first_level_config_vars_for_section "${section}"
+               local this_section="__git_first_level_config_vars_for_section_${section}"
+               __gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
                return
                ;;
        pager.*)
                local pfx="${cur_%.*}."
                cur_="${cur_#*.}"
                __git_compute_all_commands
-               __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "${sfx- }"
-               return
-               ;;
-       remote.*.*)
-               local pfx="${cur_%.*}."
-               cur_="${cur_##*.}"
-               __gitcomp "
-                       url proxy fetch push mirror skipDefaultUpdate
-                       receivepack uploadpack tagOpt pushurl
-                       " "$pfx" "$cur_" "$sfx"
+               __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "${sfx:- }"
                return
                ;;
        remote.*)
                local pfx="${cur_%.*}."
                cur_="${cur_#*.}"
+               local section="${pfx%.}"
                __gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
-               __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "${sfx- }"
+               __git_compute_first_level_config_vars_for_section "${section}"
+               local this_section="__git_first_level_config_vars_for_section_${section}"
+               __gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
                return
                ;;
-       url.*.*)
+       submodule.*)
                local pfx="${cur_%.*}."
-               cur_="${cur_##*.}"
-               __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_" "$sfx"
+               cur_="${cur_#*.}"
+               local section="${pfx%.}"
+               __gitcomp_nl "$(__git config -f "$(__git rev-parse --show-toplevel)/.gitmodules" --get-regexp 'submodule.*.path' | awk -F. '{print $2}')" "$pfx" "$cur_" "."
+               __git_compute_first_level_config_vars_for_section "${section}"
+               local this_section="__git_first_level_config_vars_for_section_${section}"
+               __gitcomp_nl_append "${!this_section}" "$pfx" "$cur_" "${sfx:- }"
                return
                ;;
        *.*)
@@ -2941,7 +3109,7 @@ _git_restore ()
                __gitcomp_builtin restore
                ;;
        *)
-               if __git rev-parse --verify --quiet HEAD >/dev/null; then
+               if __git_pseudoref_exists HEAD; then
                        __git_complete_index_file "--modified"
                fi
        esac
@@ -2951,8 +3119,7 @@ __git_revert_inprogress_options=$__git_sequencer_inprogress_options
 
 _git_revert ()
 {
-       __git_find_repo_path
-       if [ -f "$__git_repo_path"/REVERT_HEAD ]; then
+       if __git_pseudoref_exists REVERT_HEAD; then
                __gitcomp "$__git_revert_inprogress_options"
                return
        fi
@@ -3073,12 +3240,119 @@ __gitcomp_directories ()
                        COMPREPLY+=("$c/")
                        _found=1
                fi
-       done < <(git ls-tree -z -d --name-only HEAD $_tmp_dir)
+       done < <(__git ls-tree -z -d --name-only HEAD $_tmp_dir)
 
        if [[ $_found == 0 ]] && [[ "$cur" =~ /$ ]]; then
                # No possible further completions any deeper, so assume we're at
                # a leaf directory and just consider it complete
                __gitcomp_direct_append "$cur "
+       elif [[ $_found == 0 ]]; then
+               # No possible completions found.  Avoid falling back to
+               # bash's default file and directory completion, because all
+               # valid completions have already been searched and the
+               # fallbacks can do nothing but mislead.  In fact, they can
+               # mislead in three different ways:
+               #    1) Fallback file completion makes no sense when asking
+               #       for directory completions, as this function does.
+               #    2) Fallback directory completion is bad because
+               #       e.g. "/pro" is invalid and should NOT complete to
+               #       "/proc".
+               #    3) Fallback file/directory completion only completes
+               #       on paths that exist in the current working tree,
+               #       i.e. which are *already* part of their
+               #       sparse-checkout.  Thus, normal file and directory
+               #       completion is always useless for "git
+               #       sparse-checkout add" and is also probelmatic for
+               #       "git sparse-checkout set" unless using it to
+               #       strictly narrow the checkout.
+               COMPREPLY=( "" )
+       fi
+}
+
+# In non-cone mode, the arguments to {set,add} are supposed to be
+# patterns, relative to the toplevel directory.  These can be any kind
+# of general pattern, like 'subdir/*.c' and we can't complete on all
+# of those.  However, if the user presses Tab to get tab completion, we
+# presume that they are trying to provide a pattern that names a specific
+# path.
+__gitcomp_slash_leading_paths ()
+{
+       local dequoted_word pfx="" cur_ toplevel
+
+       # Since we are dealing with a sparse-checkout, subdirectories may not
+       # exist in the local working copy.  Therefore, we want to run all
+       # ls-files commands relative to the repository toplevel.
+       toplevel="$(git rev-parse --show-toplevel)/"
+
+       __git_dequote "$cur"
+
+       # If the paths provided by the user already start with '/', then
+       # they are considered relative to the toplevel of the repository
+       # already.  If they do not start with /, then we need to adjust
+       # them to start with the appropriate prefix.
+       case "$cur" in
+       /*)
+               cur="${cur:1}"
+               ;;
+       *)
+               pfx="$(__git rev-parse --show-prefix)"
+       esac
+
+       # Since sparse-index is limited to cone-mode, in non-cone-mode the
+       # list of valid paths is precisely the cached files in the index.
+       #
+       # NEEDSWORK:
+       #   1) We probably need to take care of cases where ls-files
+       #      responds with special quoting.
+       #   2) We probably need to take care of cases where ${cur} has
+       #      some kind of special quoting.
+       #   3) On top of any quoting from 1 & 2, we have to provide an extra
+       #      level of quoting for any paths that contain a '*', '?', '\',
+       #      '[', ']', or leading '#' or '!' since those will be
+       #      interpreted by sparse-checkout as something other than a
+       #      literal path character.
+       # Since there are two types of quoting here, this might get really
+       # complex.  For now, just punt on all of this...
+       completions="$(__git -C "${toplevel}" -c core.quotePath=false \
+                        ls-files --cached -- "${pfx}${cur}*" \
+                        | sed -e s%^%/% -e 's%$% %')"
+       # Note, above, though that we needed all of the completions to be
+       # prefixed with a '/', and we want to add a space so that bash
+       # completion will actually complete an entry and let us move on to
+       # the next one.
+
+       # Return what we've found.
+       if test -n "$completions"; then
+               # We found some completions; return them
+               local IFS=$'\n'
+               COMPREPLY=($completions)
+       else
+               # Do NOT fall back to bash-style all-local-files-and-dirs
+               # when we find no match.  Such options are worse than
+               # useless:
+               #     1. "git sparse-checkout add" needs paths that are NOT
+               #        currently in the working copy.  "git
+               #        sparse-checkout set" does as well, except in the
+               #        special cases when users are only trying to narrow
+               #        their sparse checkout to a subset of what they
+               #        already have.
+               #
+               #     2. A path like '.config' is ambiguous as to whether
+               #        the user wants all '.config' files throughout the
+               #        tree, or just the one under the current directory.
+               #        It would result in a warning from the
+               #        sparse-checkout command due to this.  As such, all
+               #        completions of paths should be prefixed with a
+               #        '/'.
+               #
+               #     3. We don't want paths prefixed with a '/' to
+               #        complete files in the system root directory, we
+               #        want it to complete on files relative to the
+               #        repository root.
+               #
+               # As such, make sure that NO completions are offered rather
+               # than falling back to bash's default completions.
+               COMPREPLY=( "" )
        fi
 }
 
@@ -3086,6 +3360,7 @@ _git_sparse_checkout ()
 {
        local subcommands="list init set disable add reapply"
        local subcommand="$(__git_find_on_cmdline "$subcommands")"
+       local using_cone=true
        if [ -z "$subcommand" ]; then
                __gitcomp "$subcommands"
                return
@@ -3096,9 +3371,18 @@ _git_sparse_checkout ()
                __gitcomp_builtin sparse-checkout_$subcommand "" "--"
                ;;
        set,*|add,*)
-               if [ "$(__git config core.sparseCheckoutCone)" == "true" ] ||
-               [ -n "$(__git_find_on_cmdline --cone)" ]; then
+               if [[ "$(__git config core.sparseCheckout)" == "true" &&
+                     "$(__git config core.sparseCheckoutCone)" == "false" &&
+                     -z "$(__git_find_on_cmdline --cone)" ]]; then
+                       using_cone=false
+               fi
+               if [[ -n "$(__git_find_on_cmdline --no-cone)" ]]; then
+                       using_cone=false
+               fi
+               if [[ "$using_cone" == "true" ]]; then
                        __gitcomp_directories
+               else
+                        __gitcomp_slash_leading_paths
                fi
        esac
 }
@@ -3345,7 +3629,7 @@ __git_complete_worktree_paths ()
        # Generate completion reply from worktree list skipping the first
        # entry: it's the path of the main worktree, which can't be moved,
        # removed, locked, etc.
-       __gitcomp_nl "$(git worktree list --porcelain |
+       __gitcomp_nl "$(__git worktree list --porcelain |
                sed -n -e '2,$ s/^worktree //p')"
 }
 
@@ -3581,7 +3865,7 @@ __gitk_main ()
        __git_find_repo_path
 
        local merge=""
-       if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
+       if __git_pseudoref_exists MERGE_HEAD; then
                merge="--merge"
        fi
        case "$cur" in
index 2c030050aea1c67472570a9d86d69d55e31e7714..71f179cba3fbda3bc93de461649cf75bb08c6653 100644 (file)
@@ -408,7 +408,7 @@ __git_ps1 ()
 
        local repo_info rev_parse_exit_code
        repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
-               --is-bare-repository --is-inside-work-tree \
+               --is-bare-repository --is-inside-work-tree --show-ref-format \
                --short HEAD 2>/dev/null)"
        rev_parse_exit_code="$?"
 
@@ -421,6 +421,8 @@ __git_ps1 ()
                short_sha="${repo_info##*$'\n'}"
                repo_info="${repo_info%$'\n'*}"
        fi
+       local ref_format="${repo_info##*$'\n'}"
+       repo_info="${repo_info%$'\n'*}"
        local inside_worktree="${repo_info##*$'\n'}"
        repo_info="${repo_info%$'\n'*}"
        local bare_repo="${repo_info##*$'\n'}"
@@ -479,12 +481,25 @@ __git_ps1 ()
                        b="$(git symbolic-ref HEAD 2>/dev/null)"
                else
                        local head=""
-                       if ! __git_eread "$g/HEAD" head; then
-                               return $exit
-                       fi
-                       # is it a symbolic ref?
-                       b="${head#ref: }"
-                       if [ "$head" = "$b" ]; then
+
+                       case "$ref_format" in
+                       files)
+                               if ! __git_eread "$g/HEAD" head; then
+                                       return $exit
+                               fi
+
+                               if [[ $head == "ref: "* ]]; then
+                                       head="${head#ref: }"
+                               else
+                                       head=""
+                               fi
+                               ;;
+                       *)
+                               head="$(git symbolic-ref HEAD 2>/dev/null)"
+                               ;;
+                       esac
+
+                       if test -z "$head"; then
                                detached=yes
                                b="$(
                                case "${GIT_PS1_DESCRIBE_STYLE-}" in
@@ -502,6 +517,8 @@ __git_ps1 ()
 
                                b="$short_sha..."
                                b="($b)"
+                       else
+                               b="$head"
                        fi
                fi
        fi
index 4ec419f90048babf0b18a0f8ca0fce82fc2b3f30..6ce9603568ef7d4b41d7eed9247e8512a2f45a74 100755 (executable)
@@ -74,8 +74,7 @@ do
        sort >uncovered_lines.txt
 
        comm -12 uncovered_lines.txt new_lines.txt |
-       sed -e 's/$/\)/' |
-       sed -e 's/^/ /' >uncovered_new_lines.txt
+       sed -e 's/$/\)/' -e 's/^/ /' >uncovered_new_lines.txt
 
        grep -q '[^[:space:]]' <uncovered_new_lines.txt &&
        echo $file >>coverage-data.txt &&
@@ -91,11 +90,7 @@ cat coverage-data.txt
 
 echo "Commits introducing uncovered code:"
 
-commit_list=$(cat coverage-data.txt |
-       grep -E '^[0-9a-f]{7,} ' |
-       awk '{print $1;}' |
-       sort |
-       uniq)
+commit_list=$(awk '/^[0-9a-f]{7,}/ { print $1 }' coverage-data.txt | sort -u)
 
 (
        for commit in $commit_list
index ef681f29d5ba12dd5c6f7f11baa42cb1e6aab7d5..90034d0cf1eb3d04c04872f38f2c8ba3a25fd904 100644 (file)
@@ -39,6 +39,8 @@ struct credential {
        char *path;
        char *username;
        char *password;
+       char *password_expiry_utc;
+       char *oauth_refresh_token;
 };
 
 #define CREDENTIAL_INIT { 0 }
@@ -52,8 +54,29 @@ struct credential_operation {
 
 #define CREDENTIAL_OP_END { NULL, NULL }
 
+static void credential_clear(struct credential *c);
+
 /* ----------------- Secret Service functions ----------------- */
 
+static const SecretSchema schema = {
+       "org.git.Password",
+       /* Ignore schema name during search for backwards compatibility */
+       SECRET_SCHEMA_DONT_MATCH_NAME,
+       {
+               /*
+                * libsecret assumes attribute values are non-confidential and
+                * unchanging, so we can't include oauth_refresh_token or
+                * password_expiry_utc.
+                */
+               {  "user", SECRET_SCHEMA_ATTRIBUTE_STRING },
+               {  "object", SECRET_SCHEMA_ATTRIBUTE_STRING },
+               {  "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING },
+               {  "port", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
+               {  "server", SECRET_SCHEMA_ATTRIBUTE_STRING },
+               {  NULL, 0 },
+       }
+};
+
 static char *make_label(struct credential *c)
 {
        if (c->port)
@@ -101,7 +124,7 @@ static int keyring_get(struct credential *c)
 
        attributes = make_attr_list(c);
        items = secret_service_search_sync(service,
-                                          SECRET_SCHEMA_COMPAT_NETWORK,
+                                          &schema,
                                           attributes,
                                           SECRET_SEARCH_LOAD_SECRETS | SECRET_SEARCH_UNLOCK,
                                           NULL,
@@ -117,6 +140,7 @@ static int keyring_get(struct credential *c)
                SecretItem *item;
                SecretValue *secret;
                const char *s;
+               gchar **parts;
 
                item = items->data;
                secret = secret_item_get_secret(item);
@@ -130,8 +154,30 @@ static int keyring_get(struct credential *c)
 
                s = secret_value_get_text(secret);
                if (s) {
-                       g_free(c->password);
-                       c->password = g_strdup(s);
+                       /*
+                        * Passwords and other attributes encoded in following format:
+                        *   hunter2
+                        *   password_expiry_utc=1684189401
+                        *   oauth_refresh_token=xyzzy
+                        */
+                       parts = g_strsplit(s, "\n", 0);
+                       if (g_strv_length(parts) >= 1) {
+                               g_free(c->password);
+                               c->password = g_strdup(parts[0]);
+                       } else {
+                               g_free(c->password);
+                               c->password = g_strdup("");
+                       }
+                       for (int i = 1; i < g_strv_length(parts); i++) {
+                               if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {
+                                       g_free(c->password_expiry_utc);
+                                       c->password_expiry_utc = g_strdup(&parts[i][20]);
+                               } else if (g_str_has_prefix(parts[i], "oauth_refresh_token=")) {
+                                       g_free(c->oauth_refresh_token);
+                                       c->oauth_refresh_token = g_strdup(&parts[i][20]);
+                               }
+                       }
+                       g_strfreev(parts);
                }
 
                g_hash_table_unref(attributes);
@@ -148,6 +194,7 @@ static int keyring_store(struct credential *c)
        char *label = NULL;
        GHashTable *attributes = NULL;
        GError *error = NULL;
+       GString *secret = NULL;
 
        /*
         * Sanity check that what we are storing is actually sensible.
@@ -162,13 +209,23 @@ static int keyring_store(struct credential *c)
 
        label = make_label(c);
        attributes = make_attr_list(c);
-       secret_password_storev_sync(SECRET_SCHEMA_COMPAT_NETWORK,
+       secret = g_string_new(c->password);
+       if (c->password_expiry_utc) {
+               g_string_append_printf(secret, "\npassword_expiry_utc=%s",
+                       c->password_expiry_utc);
+       }
+       if (c->oauth_refresh_token) {
+               g_string_append_printf(secret, "\noauth_refresh_token=%s",
+                       c->oauth_refresh_token);
+       }
+       secret_password_storev_sync(&schema,
                                    attributes,
                                    NULL,
                                    label,
-                                   c->password,
+                                   secret->str,
                                    NULL,
                                    &error);
+       g_string_free(secret, TRUE);
        g_free(label);
        g_hash_table_unref(attributes);
 
@@ -185,6 +242,7 @@ static int keyring_erase(struct credential *c)
 {
        GHashTable *attributes = NULL;
        GError *error = NULL;
+       struct credential existing = CREDENTIAL_INIT;
 
        /*
         * Sanity check that we actually have something to match
@@ -197,8 +255,22 @@ static int keyring_erase(struct credential *c)
        if (!c->protocol && !c->host && !c->path && !c->username)
                return EXIT_FAILURE;
 
+       if (c->password) {
+               existing.host = g_strdup(c->host);
+               existing.path = g_strdup(c->path);
+               existing.port = c->port;
+               existing.protocol = g_strdup(c->protocol);
+               existing.username = g_strdup(c->username);
+               keyring_get(&existing);
+               if (existing.password && strcmp(c->password, existing.password)) {
+                       credential_clear(&existing);
+                       return EXIT_SUCCESS;
+               }
+               credential_clear(&existing);
+       }
+
        attributes = make_attr_list(c);
-       secret_password_clearv_sync(SECRET_SCHEMA_COMPAT_NETWORK,
+       secret_password_clearv_sync(&schema,
                                    attributes,
                                    NULL,
                                    &error);
@@ -238,6 +310,8 @@ static void credential_clear(struct credential *c)
        g_free(c->path);
        g_free(c->username);
        g_free(c->password);
+       g_free(c->password_expiry_utc);
+       g_free(c->oauth_refresh_token);
 
        credential_init(c);
 }
@@ -284,11 +358,19 @@ static int credential_read(struct credential *c)
                } else if (!strcmp(key, "username")) {
                        g_free(c->username);
                        c->username = g_strdup(value);
+               } else if (!strcmp(key, "password_expiry_utc")) {
+                       g_free(c->password_expiry_utc);
+                       c->password_expiry_utc = g_strdup(value);
                } else if (!strcmp(key, "password")) {
                        g_free(c->password);
                        c->password = g_strdup(value);
                        while (*value)
                                *value++ = '\0';
+               } else if (!strcmp(key, "oauth_refresh_token")) {
+                       g_free(c->oauth_refresh_token);
+                       c->oauth_refresh_token = g_strdup(value);
+                       while (*value)
+                               *value++ = '\0';
                }
                /*
                 * Ignore other lines; we don't know what they mean, but
@@ -314,6 +396,10 @@ static void credential_write(const struct credential *c)
        /* only write username/password, if set */
        credential_write_item(stdout, "username", c->username);
        credential_write_item(stdout, "password", c->password);
+       credential_write_item(stdout, "password_expiry_utc",
+               c->password_expiry_utc);
+       credential_write_item(stdout, "oauth_refresh_token",
+               c->oauth_refresh_token);
 }
 
 static void usage(const char *name)
index 96f10613aee29b7c360b25308927564df1551388..4be0d58cd89ad7bfbbf8c8fc0b2268cee9052f9e 100644 (file)
@@ -35,7 +35,7 @@ static void *xmalloc(size_t size)
 }
 
 static WCHAR *wusername, *password, *protocol, *host, *path, target[1024],
-       *password_expiry_utc;
+       *password_expiry_utc, *oauth_refresh_token;
 
 static void write_item(const char *what, LPCWSTR wbuf, int wlen)
 {
@@ -109,7 +109,18 @@ static int match_part_last(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim)
        return match_part_with_last(ptarget, want, delim, 1);
 }
 
-static int match_cred(const CREDENTIALW *cred)
+static int match_cred_password(const CREDENTIALW *cred) {
+       int ret;
+       WCHAR *cred_password = xmalloc(cred->CredentialBlobSize);
+       wcsncpy_s(cred_password, cred->CredentialBlobSize,
+               (LPCWSTR)cred->CredentialBlob,
+               cred->CredentialBlobSize / sizeof(WCHAR));
+       ret = !wcscmp(cred_password, password);
+       free(cred_password);
+       return ret;
+}
+
+static int match_cred(const CREDENTIALW *cred, int match_password)
 {
        LPCWSTR target = cred->TargetName;
        if (wusername && wcscmp(wusername, cred->UserName ? cred->UserName : L""))
@@ -119,7 +130,8 @@ static int match_cred(const CREDENTIALW *cred)
                match_part(&target, protocol, L"://") &&
                match_part_last(&target, wusername, L"@") &&
                match_part(&target, host, L"/") &&
-               match_part(&target, path, L"");
+               match_part(&target, path, L"") &&
+               (!match_password || match_cred_password(cred));
 }
 
 static void get_credential(void)
@@ -128,18 +140,38 @@ static void get_credential(void)
        DWORD num_creds;
        int i;
        CREDENTIAL_ATTRIBUTEW *attr;
+       WCHAR *secret;
+       WCHAR *line;
+       WCHAR *remaining_lines;
+       WCHAR *part;
+       WCHAR *remaining_parts;
 
        if (!CredEnumerateW(L"git:*", 0, &num_creds, &creds))
                return;
 
        /* search for the first credential that matches username */
        for (i = 0; i < num_creds; ++i)
-               if (match_cred(creds[i])) {
+               if (match_cred(creds[i], 0)) {
                        write_item("username", creds[i]->UserName,
                                creds[i]->UserName ? wcslen(creds[i]->UserName) : 0);
-                       write_item("password",
-                               (LPCWSTR)creds[i]->CredentialBlob,
-                               creds[i]->CredentialBlobSize / sizeof(WCHAR));
+                       if (creds[i]->CredentialBlobSize > 0) {
+                               secret = xmalloc(creds[i]->CredentialBlobSize);
+                               wcsncpy_s(secret, creds[i]->CredentialBlobSize, (LPCWSTR)creds[i]->CredentialBlob, creds[i]->CredentialBlobSize / sizeof(WCHAR));
+                               line = wcstok_s(secret, L"\r\n", &remaining_lines);
+                               write_item("password", line, line ? wcslen(line) : 0);
+                               while(line != NULL) {
+                                       part = wcstok_s(line, L"=", &remaining_parts);
+                                       if (!wcscmp(part, L"oauth_refresh_token")) {
+                                               write_item("oauth_refresh_token", remaining_parts, remaining_parts ? wcslen(remaining_parts) : 0);
+                                       }
+                                       line = wcstok_s(NULL, L"\r\n", &remaining_lines);
+                               }
+                               free(secret);
+                       } else {
+                               write_item("password",
+                                               (LPCWSTR)creds[i]->CredentialBlob,
+                                               creds[i]->CredentialBlobSize / sizeof(WCHAR));
+                       }
                        for (int j = 0; j < creds[i]->AttributeCount; j++) {
                                attr = creds[i]->Attributes + j;
                                if (!wcscmp(attr->Keyword, L"git_password_expiry_utc")) {
@@ -158,16 +190,26 @@ static void store_credential(void)
 {
        CREDENTIALW cred;
        CREDENTIAL_ATTRIBUTEW expiry_attr;
+       WCHAR *secret;
+       int wlen;
 
        if (!wusername || !password)
                return;
 
+       if (oauth_refresh_token) {
+               wlen = _scwprintf(L"%s\r\noauth_refresh_token=%s", password, oauth_refresh_token);
+               secret = xmalloc(sizeof(WCHAR) * wlen);
+               _snwprintf_s(secret, sizeof(WCHAR) * wlen, wlen, L"%s\r\noauth_refresh_token=%s", password, oauth_refresh_token);
+       } else {
+               secret = _wcsdup(password);
+       }
+
        cred.Flags = 0;
        cred.Type = CRED_TYPE_GENERIC;
        cred.TargetName = target;
        cred.Comment = L"saved by git-credential-wincred";
-       cred.CredentialBlobSize = (wcslen(password)) * sizeof(WCHAR);
-       cred.CredentialBlob = (LPVOID)password;
+       cred.CredentialBlobSize = wcslen(secret) * sizeof(WCHAR);
+       cred.CredentialBlob = (LPVOID)_wcsdup(secret);
        cred.Persist = CRED_PERSIST_LOCAL_MACHINE;
        cred.AttributeCount = 0;
        cred.Attributes = NULL;
@@ -182,6 +224,8 @@ static void store_credential(void)
        cred.TargetAlias = NULL;
        cred.UserName = wusername;
 
+       free(secret);
+
        if (!CredWriteW(&cred, 0))
                die("CredWrite failed");
 }
@@ -196,7 +240,7 @@ static void erase_credential(void)
                return;
 
        for (i = 0; i < num_creds; ++i) {
-               if (match_cred(creds[i]))
+               if (match_cred(creds[i], password != NULL))
                        CredDeleteW(creds[i]->TargetName, creds[i]->Type, 0);
        }
 
@@ -253,6 +297,8 @@ static void read_credential(void)
                        password = utf8_to_utf16_dup(v);
                else if (!strcmp(buf, "password_expiry_utc"))
                        password_expiry_utc = utf8_to_utf16_dup(v);
+               else if (!strcmp(buf, "oauth_refresh_token"))
+                       oauth_refresh_token = utf8_to_utf16_dup(v);
                /*
                 * Ignore other lines; we don't know what they mean, but
                 * this future-proofs us when later versions of git do
index 376f577737591e26a118718a87945500ea621c95..636add6968067537a34e46b92957fbc35acd18e9 100644 (file)
@@ -1,6 +1,6 @@
 package DiffHighlight;
 
-use 5.008;
+use 5.008001;
 use warnings FATAL => 'all';
 use strict;
 
index 40c4b0d111071676c278651f49669036e90f079a..47e0c557e63f1b236a3ad763e03ac086f1842d23 100755 (executable)
@@ -9,7 +9,7 @@ The <mode> parameter is one of:
 
 diff: elements are diff hunks. Arguments are given to diff.
 
-merge: elements are merge conflicts. Arguments are ignored.
+merge: elements are merge conflicts. Arguments are given to ls-files -u.
 
 grep: elements are grep hits. Arguments are given to git grep or, if
       configured, to the command in `jump.grepCmd`.
index 917d9e2d3222c12f2d0dc043a1434acae2b398ae..ff7811225ee67166d8e997ce99def0344971f904 100644 (file)
@@ -1,6 +1,6 @@
 package Git::Mediawiki;
 
-use 5.008;
+use 5.008001;
 use strict;
 use POSIX;
 use Git;
index 6187ec67faaa23c59d358bc3150b72fc82bd7087..7139995a405cee9881f690ff892464c875984e27 100755 (executable)
@@ -161,7 +161,7 @@ test_expect_success 'git push properly warns about insufficient permissions' '
                git add foo.forbidden &&
                git commit -m "add a file" &&
                git push 2>actual &&
-               test_i18ngrep "foo.forbidden is not a permitted file" actual
+               test_grep "foo.forbidden is not a permitted file" actual
        )
 '
 
index 7db4c45676d304869bba126bd57e7f553aec2008..5dab3f506c6e0877740f7d3990388b3975e877c5 100755 (executable)
@@ -33,19 +33,19 @@ git subtree split --prefix=<prefix> [<commit>]
 git subtree pull  --prefix=<prefix> <repository> <ref>
 git subtree push  --prefix=<prefix> <repository> <refspec>
 --
-h,help        show the help
-q,quiet       quiet
-d,debug       show debug messages
+h,help!       show the help
+q,quiet!      quiet
+d,debug!      show debug messages
 P,prefix=     the name of the subdir to split out
  options for 'split' (also: 'push')
 annotate=     add a prefix to commit message of new commits
-b,branch    create a new branch from the split subtree
+b,branch!=    create a new branch from the split subtree
 ignore-joins  ignore prior --rejoin commits
 onto=         try connecting new tree to an existing one
 rejoin        merge the new branch back into HEAD
  options for 'add' and 'merge' (also: 'pull', 'split --rejoin', and 'push --rejoin')
 squash        merge subtree changes as a single commit
-m,message   use the given message as the commit message for the merge commit
+m,message!=   use the given message as the commit message for the merge commit
 "
 
 indent=0
@@ -373,7 +373,8 @@ try_remove_previous () {
 
 # Usage: process_subtree_split_trailer SPLIT_HASH MAIN_HASH [REPOSITORY]
 process_subtree_split_trailer () {
-       assert test $# = 2 -o $# = 3
+       assert test $# -ge 2
+       assert test $# -le 3
        b="$1"
        sq="$2"
        repository=""
@@ -402,7 +403,8 @@ process_subtree_split_trailer () {
 
 # Usage: find_latest_squash DIR [REPOSITORY]
 find_latest_squash () {
-       assert test $# = 1 -o $# = 2
+       assert test $# -ge 1
+       assert test $# -le 2
        dir="$1"
        repository=""
        if test "$#" = 2
@@ -455,7 +457,8 @@ find_latest_squash () {
 
 # Usage: find_existing_splits DIR REV [REPOSITORY]
 find_existing_splits () {
-       assert test $# = 2 -o $# = 3
+       assert test $# -ge 2
+       assert test $# -le 3
        debug "Looking for prior splits..."
        local indent=$(($indent + 1))
 
@@ -489,13 +492,13 @@ find_existing_splits () {
                        ;;
                END)
                        debug "Main is: '$main'"
-                       if test -z "$main" -a -n "$sub"
+                       if test -z "$main" && test -n "$sub"
                        then
                                # squash commits refer to a subtree
                                debug "  Squash: $sq from $sub"
                                cache_set "$sq" "$sub"
                        fi
-                       if test -n "$main" -a -n "$sub"
+                       if test -n "$main" && test -n "$sub"
                        then
                                debug "  Prior: $main -> $sub"
                                cache_set $main $sub
@@ -638,10 +641,16 @@ subtree_for_commit () {
        while read mode type tree name
        do
                assert test "$name" = "$dir"
-               assert test "$type" = "tree" -o "$type" = "commit"
-               test "$type" = "commit" && continue  # ignore submodules
-               echo $tree
-               break
+
+               case "$type" in
+               commit)
+                       continue;; # ignore submodules
+               tree)
+                       echo $tree
+                       break;;
+               *)
+                       die "fatal: tree entry is of type ${type}, expected tree or commit";;
+               esac
        done || exit $?
 }
 
@@ -778,6 +787,22 @@ ensure_valid_ref_format () {
                die "fatal: '$1' does not look like a ref"
 }
 
+# Usage: check if a commit from another subtree should be
+# ignored from processing for splits
+should_ignore_subtree_split_commit () {
+       assert test $# = 1
+       local rev="$1"
+       if test -n "$(git log -1 --grep="git-subtree-dir:" $rev)"
+       then
+               if test -z "$(git log -1 --grep="git-subtree-mainline:" $rev)" &&
+                       test -z "$(git log -1 --grep="git-subtree-dir: $arg_prefix$" $rev)"
+               then
+                       return 0
+               fi
+       fi
+       return 1
+}
+
 # Usage: process_split_commit REV PARENTS
 process_split_commit () {
        assert test $# = 2
@@ -916,7 +941,7 @@ cmd_split () {
        if test $# -eq 0
        then
                rev=$(git rev-parse HEAD)
-       elif test $# -eq 1 -o $# -eq 2
+       elif test $# -eq 1 || test $# -eq 2
        then
                rev=$(git rev-parse -q --verify "$1^{commit}") ||
                        die "fatal: '$1' does not refer to a commit"
@@ -963,7 +988,19 @@ cmd_split () {
        eval "$grl" |
        while read rev parents
        do
-               process_split_commit "$rev" "$parents"
+               if should_ignore_subtree_split_commit "$rev"
+               then
+                       continue
+               fi
+               parsedparents=''
+               for parent in $parents
+               do
+                       if ! should_ignore_subtree_split_commit "$parent"
+                       then
+                               parsedparents="$parsedparents$parent "
+                       fi
+               done
+               process_split_commit "$rev" "$parsedparents"
        done || exit $?
 
        latest_new=$(cache_get latest_new) || exit $?
@@ -1006,8 +1043,11 @@ cmd_split () {
 
 # Usage: cmd_merge REV [REPOSITORY]
 cmd_merge () {
-       test $# -eq 1 -o $# -eq 2 ||
+       if test $# -lt 1 || test $# -gt 2
+       then
                die "fatal: you must provide exactly one revision, and optionally a repository. Got: '$*'"
+       fi
+
        rev=$(git rev-parse -q --verify "$1^{commit}") ||
                die "fatal: '$1' does not refer to a commit"
        repository=""
index 341c169eca7e6c0f02ac43f0e1844605abddf24d..c3bd2a58b941f0bda8673a707fb0da71e4cbca88 100755 (executable)
@@ -63,7 +63,7 @@ test_create_pre2_32_repo () {
        git -C "$1" log -1 --format=%B HEAD^2 >msg &&
        test_commit -C "$1-sub" --annotate sub2 &&
        git clone --no-local "$1" "$1-clone" &&
-       new_commit=$(cat msg | sed -e "s/$commit/$tag/" | git -C "$1-clone" commit-tree HEAD^2^{tree}) &&
+       new_commit=$(sed -e "s/$commit/$tag/" msg | git -C "$1-clone" commit-tree HEAD^2^{tree}) &&
        git -C "$1-clone" replace HEAD^2 $new_commit
 }
 
@@ -71,7 +71,7 @@ test_expect_success 'shows short help text for -h' '
        test_expect_code 129 git subtree -h >out 2>err &&
        test_must_be_empty err &&
        grep -e "^ *or: git subtree pull" out &&
-       grep -e --annotate out
+       grep -F -e "--[no-]annotate" out
 '
 
 #
@@ -385,6 +385,46 @@ test_expect_success 'split sub dir/ with --rejoin' '
        )
 '
 
+# Tests that commits from other subtrees are not processed as
+# part of a split.
+#
+# This test performs the following:
+# - Creates Repo with subtrees 'subA' and 'subB'
+# - Creates commits in the repo including changes to subtrees
+# - Runs the following 'split' and commit' commands in order:
+#      - Perform 'split' on subtree A
+#      - Perform 'split' on subtree B
+#      - Create new commits with changes to subtree A and B
+#      - Perform split on subtree A
+#      - Check that the commits in subtree B are not processed
+#                      as part of the subtree A split
+test_expect_success 'split with multiple subtrees' '
+       subtree_test_create_repo "$test_count" &&
+       subtree_test_create_repo "$test_count/subA" &&
+       subtree_test_create_repo "$test_count/subB" &&
+       test_create_commit "$test_count" main1 &&
+       test_create_commit "$test_count/subA" subA1 &&
+       test_create_commit "$test_count/subA" subA2 &&
+       test_create_commit "$test_count/subA" subA3 &&
+       test_create_commit "$test_count/subB" subB1 &&
+       git -C "$test_count" fetch ./subA HEAD &&
+       git -C "$test_count" subtree add --prefix=subADir FETCH_HEAD &&
+       git -C "$test_count" fetch ./subB HEAD &&
+       git -C "$test_count" subtree add --prefix=subBDir FETCH_HEAD &&
+       test_create_commit "$test_count" subADir/main-subA1 &&
+       test_create_commit "$test_count" subBDir/main-subB1 &&
+       git -C "$test_count" subtree split --prefix=subADir \
+               --squash --rejoin -m "Sub A Split 1" &&
+       git -C "$test_count" subtree split --prefix=subBDir \
+               --squash --rejoin -m "Sub B Split 1" &&
+       test_create_commit "$test_count" subADir/main-subA2 &&
+       test_create_commit "$test_count" subBDir/main-subB2 &&
+       git -C "$test_count" subtree split --prefix=subADir \
+               --squash --rejoin -m "Sub A Split 2" &&
+       test "$(git -C "$test_count" subtree split --prefix=subBDir \
+               --squash --rejoin -d -m "Sub B Split 1" 2>&1 | grep -w "\[1\]")" = ""
+'
+
 test_expect_success 'split sub dir/ with --rejoin from scratch' '
        subtree_test_create_repo "$test_count" &&
        test_create_commit "$test_count" main1 &&
index 888c34a5215258ad7d5715771f92ab58f3efd363..989197aace0bc03ecae6d5f94af86e6e91968562 100755 (executable)
@@ -79,7 +79,7 @@ trap cleanup $siglist
 # create the links to the original repo.  explicitly exclude index, HEAD and
 # logs/HEAD from the list since they are purely related to the current working
 # directory, and should not be shared.
-for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache svn
+for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache svn reftable
 do
        # create a containing directory if needed
        case $x in
index a8870baff36a4a3042baf31c730793b45f6b6442..35b25eb3cb9212f92dd918d0f247e49ecd620c41 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -1028,7 +1028,7 @@ static int read_convert_config(const char *var, const char *value,
        if (parse_config_key(var, "filter", &name, &namelen, &key) < 0 || !name)
                return 0;
        for (drv = user_convert; drv; drv = drv->next)
-               if (!strncmp(drv->name, name, namelen) && !drv->name[namelen])
+               if (!xstrncmpz(drv->name, name, namelen))
                        break;
        if (!drv) {
                CALLOC_ARRAY(drv, 1);
index d925589444b90a11058abe87286df3d5add592f8..ab8b4fa68d67ba3da1fc7900b616dc70a9967eba 100644 (file)
--- a/convert.h
+++ b/convert.h
@@ -92,7 +92,7 @@ void convert_attrs(struct index_state *istate,
                   struct conv_attrs *ca, const char *path);
 
 extern enum eol core_eol;
-extern char *check_roundtrip_encoding;
+extern const char *check_roundtrip_encoding;
 const char *get_cached_convert_stats_ascii(struct index_state *istate,
                                           const char *path);
 const char *get_wt_convert_stats_ascii(const char *path);
index d6647541634f3850ea147cebc681a5944d8e5ee9..18098bd35ebab9683ae0046c1712b111eaeb3fe1 100644 (file)
@@ -88,8 +88,8 @@ static int proto_is_http(const char *s)
 static void credential_describe(struct credential *c, struct strbuf *out);
 static void credential_format(struct credential *c, struct strbuf *out);
 
-static int select_all(const struct urlmatch_item *a,
-                     const struct urlmatch_item *b)
+static int select_all(const struct urlmatch_item *a UNUSED,
+                     const struct urlmatch_item *b UNUSED)
 {
        return 0;
 }
index cd017132448d1ec340f137d6b882ee9bc420509a..870748e01695f865e1e4d587cdb38f769367a5c6 100644 (file)
@@ -207,7 +207,7 @@ int hashfile_truncate(struct hashfile *f, struct hashfile_checkpoint *checkpoint
            lseek(f->fd, offset, SEEK_SET) != offset)
                return -1;
        f->total = offset;
-       f->ctx = checkpoint->ctx;
+       the_hash_algo->clone_fn(&f->ctx, &checkpoint->ctx);
        f->offset = 0; /* hashflush() was called in checkpoint */
        return 0;
 }
index f5e597114b671fc79cd0acf63c63e5ac427af8bf..17d331b2f38465e295c019e534eff371ef3e6e49 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -1243,19 +1243,20 @@ static int serve(struct string_list *listen_addr, int listen_port,
 int cmd_main(int argc, const char **argv)
 {
        int listen_port = 0;
-       struct string_list listen_addr = STRING_LIST_INIT_NODUP;
+       struct string_list listen_addr = STRING_LIST_INIT_DUP;
        int serve_mode = 0, inetd_mode = 0;
        const char *pid_file = NULL, *user_name = NULL, *group_name = NULL;
        int detach = 0;
        struct credentials *cred = NULL;
        int i;
+       int ret;
 
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
                const char *v;
 
                if (skip_prefix(arg, "--listen=", &v)) {
-                       string_list_append(&listen_addr, xstrdup_tolower(v));
+                       string_list_append_nodup(&listen_addr, xstrdup_tolower(v));
                        continue;
                }
                if (skip_prefix(arg, "--port=", &v)) {
@@ -1437,22 +1438,26 @@ int cmd_main(int argc, const char **argv)
                        die_errno("failed to redirect stderr to /dev/null");
        }
 
-       if (inetd_mode || serve_mode)
-               return execute();
+       if (inetd_mode || serve_mode) {
+               ret = execute();
+       } else {
+               if (detach) {
+                       if (daemonize())
+                               die("--detach not supported on this platform");
+               }
 
-       if (detach) {
-               if (daemonize())
-                       die("--detach not supported on this platform");
-       }
+               if (pid_file)
+                       write_file(pid_file, "%"PRIuMAX, (uintmax_t) getpid());
 
-       if (pid_file)
-               write_file(pid_file, "%"PRIuMAX, (uintmax_t) getpid());
+               /* prepare argv for serving-processes */
+               strvec_push(&cld_argv, argv[0]); /* git-daemon */
+               strvec_push(&cld_argv, "--serve");
+               for (i = 1; i < argc; ++i)
+                       strvec_push(&cld_argv, argv[i]);
 
-       /* prepare argv for serving-processes */
-       strvec_push(&cld_argv, argv[0]); /* git-daemon */
-       strvec_push(&cld_argv, "--serve");
-       for (i = 1; i < argc; ++i)
-               strvec_push(&cld_argv, argv[i]);
+               ret = serve(&listen_addr, listen_port, cred);
+       }
 
-       return serve(&listen_addr, listen_port, cred);
+       string_list_clear(&listen_addr, 0);
+       return ret;
 }
diff --git a/date.c b/date.c
index 619ada5b20442046ef50a38d4e88136b14419a42..44cf2221d81f61760fa26605765eaea5eee9ee4d 100644 (file)
--- a/date.c
+++ b/date.c
@@ -342,14 +342,18 @@ const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
                                tm->tm_hour, tm->tm_min, tm->tm_sec,
                                tz);
        else if (mode->type == DATE_ISO8601_STRICT) {
-               char sign = (tz >= 0) ? '+' : '-';
-               tz = abs(tz);
-               strbuf_addf(&timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
+               strbuf_addf(&timebuf, "%04d-%02d-%02dT%02d:%02d:%02d",
                                tm->tm_year + 1900,
                                tm->tm_mon + 1,
                                tm->tm_mday,
-                               tm->tm_hour, tm->tm_min, tm->tm_sec,
-                               sign, tz / 100, tz % 100);
+                               tm->tm_hour, tm->tm_min, tm->tm_sec);
+               if (tz == 0) {
+                       strbuf_addch(&timebuf, 'Z');
+               } else {
+                       strbuf_addch(&timebuf, tz >= 0 ? '+' : '-');
+                       tz = abs(tz);
+                       strbuf_addf(&timebuf, "%02d:%02d", tz / 100, tz % 100);
+               }
        } else if (mode->type == DATE_RFC2822)
                strbuf_addf(&timebuf, "%.3s, %d %.3s %d %02d:%02d:%02d %+05d",
                        weekday_names[tm->tm_wday], tm->tm_mday,
index a5c43c0c1461761bb808b4d6b833222b181843a6..69aeb142b45e9fee08d61dace73f6dc2bce1c2d0 100644 (file)
@@ -81,3 +81,18 @@ void *lookup_decoration(struct decoration *n, const struct object *obj)
                        j = 0;
        }
 }
+
+void clear_decoration(struct decoration *n, void (*free_cb)(void *))
+{
+       if (free_cb) {
+               unsigned int i;
+               for (i = 0; i < n->size; i++) {
+                       void *d = n->entries[i].decoration;
+                       if (d)
+                               free_cb(d);
+               }
+       }
+
+       FREE_AND_NULL(n->entries);
+       n->size = n->nr = 0;
+}
index ee43dee1f008882094ca9c85f6b28b86ec88fdf6..cdeb17c9df2eb680d85e73e8ed2f48b52f44569f 100644 (file)
@@ -58,4 +58,14 @@ void *add_decoration(struct decoration *n, const struct object *obj, void *decor
  */
 void *lookup_decoration(struct decoration *n, const struct object *obj);
 
+/*
+ * Clear all decoration entries, releasing any memory used by the structure.
+ * If free_cb is not NULL, it is called for every decoration value currently
+ * stored.
+ *
+ * After clearing, the decoration struct can be used again. The "name" field is
+ * retained.
+ */
+void clear_decoration(struct decoration *n, void (*free_cb)(void *));
+
 #endif
index 1ff3506b10f25a044733f40b1a8252cc12623705..f7e079425fe45d70ead6ea191d2ecc37ee7a339b 100644 (file)
@@ -1,18 +1,13 @@
 #include "git-compat-util.h"
-#include "attr.h"
 #include "object.h"
-#include "blob.h"
 #include "commit.h"
 #include "gettext.h"
 #include "hex.h"
 #include "tag.h"
 #include "tree.h"
-#include "delta.h"
 #include "pack.h"
 #include "tree-walk.h"
 #include "diff.h"
-#include "revision.h"
-#include "list-objects.h"
 #include "progress.h"
 #include "refs.h"
 #include "khash.h"
index 8430064000bcba96506e4b9c99c9efe60ba072f4..4d096c857f1e669a44bc2e43375889ce2952083c 100644 (file)
@@ -71,42 +71,6 @@ static int dir_file_stats(struct object_directory *object_dir, void *data)
        return 0;
 }
 
-/*
- * Get the d_type of a dirent. If the d_type is unknown, derive it from
- * stat.st_mode.
- *
- * Note that 'path' is assumed to have a trailing slash. It is also modified
- * in-place during the execution of the function, but is then reverted to its
- * original value before returning.
- */
-static unsigned char get_dtype(struct dirent *e, struct strbuf *path)
-{
-       struct stat st;
-       unsigned char dtype = DTYPE(e);
-       size_t base_path_len;
-
-       if (dtype != DT_UNKNOWN)
-               return dtype;
-
-       /* d_type unknown in dirent, try to fall back on lstat results */
-       base_path_len = path->len;
-       strbuf_addstr(path, e->d_name);
-       if (lstat(path->buf, &st))
-               goto cleanup;
-
-       /* determine d_type from st_mode */
-       if (S_ISREG(st.st_mode))
-               dtype = DT_REG;
-       else if (S_ISDIR(st.st_mode))
-               dtype = DT_DIR;
-       else if (S_ISLNK(st.st_mode))
-               dtype = DT_LNK;
-
-cleanup:
-       strbuf_setlen(path, base_path_len);
-       return dtype;
-}
-
 static int count_files(struct strbuf *path)
 {
        DIR *dir = opendir(path->buf);
@@ -117,7 +81,7 @@ static int count_files(struct strbuf *path)
                return 0;
 
        while ((e = readdir_skip_dot_and_dotdot(dir)) != NULL)
-               if (get_dtype(e, path) == DT_REG)
+               if (get_dtype(e, path, 0) == DT_REG)
                        count++;
 
        closedir(dir);
@@ -146,7 +110,7 @@ static void loose_objs_stats(struct strbuf *buf, const char *path)
        base_path_len = count_path.len;
 
        while ((e = readdir_skip_dot_and_dotdot(dir)) != NULL)
-               if (get_dtype(e, &count_path) == DT_DIR &&
+               if (get_dtype(e, &count_path, 0) == DT_DIR &&
                    strlen(e->d_name) == 2 &&
                    !hex_to_bytes(&c, e->d_name, 1)) {
                        strbuf_setlen(&count_path, base_path_len);
@@ -191,7 +155,7 @@ static int add_directory_to_archiver(struct strvec *archiver_args,
 
                strbuf_add_absolute_path(&abspath, at_root ? "." : path);
                strbuf_addch(&abspath, '/');
-               dtype = get_dtype(e, &abspath);
+               dtype = get_dtype(e, &abspath, 0);
 
                strbuf_setlen(&buf, len);
                strbuf_addstr(&buf, e->d_name);
index add323f5628dbd4a8a7ef6701f1c5220237a57ea..1cd790a4d2bef6a3df8a6eb080622ccaa6749fa3 100644 (file)
@@ -2,7 +2,6 @@
  * Copyright (C) 2005 Junio C Hamano
  */
 #include "git-compat-util.h"
-#include "quote.h"
 #include "commit.h"
 #include "diff.h"
 #include "diffcore.h"
  * exists for ce that is a submodule -- it is a submodule that is not
  * checked out).  Return negative for an error.
  */
-static int check_removed(const struct index_state *istate, const struct cache_entry *ce, struct stat *st)
+static int check_removed(const struct cache_entry *ce, struct stat *st)
 {
-       assert(is_fsmonitor_refreshed(istate));
-       if (!(ce->ce_flags & CE_FSMONITOR_VALID) && lstat(ce->name, st) < 0) {
+       int stat_err;
+
+       if (!(ce->ce_flags & CE_FSMONITOR_VALID))
+               stat_err = lstat(ce->name, st);
+       else
+               stat_err = fake_lstat(ce, st);
+       if (stat_err < 0) {
                if (!is_missing_file_error(errno))
                        return -1;
                return 1;
        }
+
        if (has_symlink_leading_path(ce->name, ce_namelen(ce)))
                return 1;
        if (S_ISDIR(st->st_mode)) {
@@ -96,7 +101,7 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
        return changed;
 }
 
-int run_diff_files(struct rev_info *revs, unsigned int option)
+void run_diff_files(struct rev_info *revs, unsigned int option)
 {
        int entries, i;
        int diff_unmerged_stage = revs->max_count;
@@ -149,7 +154,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                        memset(&(dpath->parent[0]), 0,
                               sizeof(struct combine_diff_parent)*5);
 
-                       changed = check_removed(istate, ce, &st);
+                       changed = check_removed(ce, &st);
                        if (!changed)
                                wt_mode = ce_mode_from_stat(ce, st.st_mode);
                        else {
@@ -229,7 +234,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                } else {
                        struct stat st;
 
-                       changed = check_removed(istate, ce, &st);
+                       changed = check_removed(ce, &st);
                        if (changed) {
                                if (changed < 0) {
                                        perror(ce->name);
@@ -272,7 +277,6 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
        diffcore_std(&revs->diffopt);
        diff_flush(&revs->diffopt);
        trace_performance_since(start, "diff-files");
-       return 0;
 }
 
 /*
@@ -304,7 +308,7 @@ static int get_stat_data(const struct index_state *istate,
        if (!cached && !ce_uptodate(ce)) {
                int changed;
                struct stat st;
-               changed = check_removed(istate, ce, &st);
+               changed = check_removed(ce, &st);
                if (changed < 0)
                        return -1;
                else if (changed) {
@@ -566,14 +570,12 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)
 {
        int i;
        struct commit *mb_child[2] = {0};
-       struct commit_list *merge_bases;
+       struct commit_list *merge_bases = NULL;
 
        for (i = 0; i < revs->pending.nr; i++) {
                struct object *obj = revs->pending.objects[i].item;
                if (obj->flags)
                        die(_("--merge-base does not work with ranges"));
-               if (obj->type != OBJ_COMMIT)
-                       die(_("--merge-base only works with commits"));
        }
 
        /*
@@ -595,7 +597,8 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)
                mb_child[1] = lookup_commit_reference(the_repository, &oid);
        }
 
-       merge_bases = repo_get_merge_bases(the_repository, mb_child[0], mb_child[1]);
+       if (repo_get_merge_bases(the_repository, mb_child[0], mb_child[1], &merge_bases) < 0)
+               exit(128);
        if (!merge_bases)
                die(_("no merge base found"));
        if (merge_bases->next)
@@ -606,7 +609,7 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)
        free_commit_list(merge_bases);
 }
 
-int run_diff_index(struct rev_info *revs, unsigned int option)
+void run_diff_index(struct rev_info *revs, unsigned int option)
 {
        struct object_array_entry *ent;
        int cached = !!(option & DIFF_INDEX_CACHED);
@@ -640,7 +643,6 @@ int run_diff_index(struct rev_info *revs, unsigned int option)
        diffcore_std(&revs->diffopt);
        diff_flush(&revs->diffopt);
        trace_performance_leave("diff-index");
-       return 0;
 }
 
 int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
@@ -682,7 +684,7 @@ int index_differs_from(struct repository *r,
                        rev.diffopt.flags.ignore_submodules = flags->ignore_submodules;
        }
        rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
-       run_diff_index(&rev, 1);
+       run_diff_index(&rev, DIFF_INDEX_CACHED);
        has_changes = rev.diffopt.flags.has_changes;
        release_revisions(&rev);
        return (has_changes != 0);
index ec97616db1dfaa0673945bb08a9f364b2d570db1..45507588a2797b8d3618e3a19a2854d12051157b 100644 (file)
@@ -131,6 +131,9 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
        } else if (!strcmp(arg, "--cc")) {
                set_dense_combined(revs);
                revs->merges_imply_patch = 1;
+       } else if (!strcmp(arg, "--dd")) {
+               set_first_parent(revs);
+               revs->merges_imply_patch = 1;
        } else if (!strcmp(arg, "--remerge-diff")) {
                set_remerge_diff(revs);
                revs->merges_imply_patch = 1;
index 4771cf02aa8588b9e7cb162c38e109e42332cf46..3a8965672c5e90093c08a9fde12981b922ae8a76 100644 (file)
@@ -8,13 +8,10 @@
 #include "abspath.h"
 #include "color.h"
 #include "commit.h"
-#include "blob.h"
-#include "tag.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "gettext.h"
 #include "revision.h"
-#include "log-tree.h"
 #include "parse-options.h"
 #include "string-list.h"
 #include "dir.h"
@@ -232,6 +229,7 @@ static int queue_diff(struct diff_options *o,
                if (o->flags.reverse_diff) {
                        SWAP(mode1, mode2);
                        SWAP(name1, name2);
+                       SWAP(special1, special2);
                }
 
                d1 = noindex_filespec(name1, mode1, special1);
@@ -364,7 +362,7 @@ int diff_no_index(struct rev_info *revs,
         * The return code for --no-index imitates diff(1):
         * 0 = no changes, 1 = changes, else error
         */
-       ret = diff_result_code(&revs->diffopt, 0);
+       ret = diff_result_code(&revs->diffopt);
 
 out:
        for (i = 0; i < ARRAY_SIZE(to_free); i++)
diff --git a/diff.c b/diff.c
index ee3eb629e3dc5e3010342ed988678d9f0cedd0bd..e50def45383eba4af74300802a161bdeeb6c4e8f 100644 (file)
--- a/diff.c
+++ b/diff.c
 #include "hex.h"
 #include "xdiff-interface.h"
 #include "color.h"
-#include "attr.h"
 #include "run-command.h"
 #include "utf8.h"
 #include "object-store-ll.h"
 #include "userdiff.h"
-#include "submodule-config.h"
 #include "submodule.h"
 #include "hashmap.h"
 #include "mem-pool.h"
@@ -65,6 +63,7 @@ int diff_auto_refresh_index = 1;
 static int diff_mnemonic_prefix;
 static int diff_no_prefix;
 static int diff_relative;
+static int diff_stat_name_width;
 static int diff_stat_graph_width;
 static int diff_dirstat_permille_default = 30;
 static struct diff_options default_diff_options;
@@ -371,7 +370,10 @@ int git_diff_ui_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "diff.colormovedws")) {
-               unsigned cm = parse_color_moved_ws(value);
+               unsigned cm;
+               if (!value)
+                       return config_error_nonbool(var);
+               cm = parse_color_moved_ws(value);
                if (cm & COLOR_MOVED_WS_ERROR)
                        return -1;
                diff_color_moved_ws_default = cm;
@@ -410,6 +412,10 @@ int git_diff_ui_config(const char *var, const char *value,
                diff_relative = git_config_bool(var, value);
                return 0;
        }
+       if (!strcmp(var, "diff.statnamewidth")) {
+               diff_stat_name_width = git_config_int(var, value, ctx->kvi);
+               return 0;
+       }
        if (!strcmp(var, "diff.statgraphwidth")) {
                diff_stat_graph_width = git_config_int(var, value, ctx->kvi);
                return 0;
@@ -421,10 +427,15 @@ int git_diff_ui_config(const char *var, const char *value,
        if (!strcmp(var, "diff.orderfile"))
                return git_config_pathname(&diff_order_file_cfg, var, value);
 
-       if (!strcmp(var, "diff.ignoresubmodules"))
+       if (!strcmp(var, "diff.ignoresubmodules")) {
+               if (!value)
+                       return config_error_nonbool(var);
                handle_ignore_submodules_arg(&default_diff_options, value);
+       }
 
        if (!strcmp(var, "diff.submodule")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (parse_submodule_params(&default_diff_options, value))
                        warning(_("Unknown value for 'diff.submodule' config variable: '%s'"),
                                value);
@@ -432,9 +443,12 @@ int git_diff_ui_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "diff.algorithm")) {
+               if (!value)
+                       return config_error_nonbool(var);
                diff_algorithm = parse_algorithm_value(value);
                if (diff_algorithm < 0)
-                       return -1;
+                       return error(_("unknown value for config '%s': %s"),
+                                    var, value);
                return 0;
        }
 
@@ -468,9 +482,13 @@ int git_diff_basic_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "diff.wserrorhighlight")) {
-               int val = parse_ws_error_highlight(value);
+               int val;
+               if (!value)
+                       return config_error_nonbool(var);
+               val = parse_ws_error_highlight(value);
                if (val < 0)
-                       return -1;
+                       return error(_("unknown value for config '%s': %s"),
+                                    var, value);
                ws_error_highlight_default = val;
                return 0;
        }
@@ -485,6 +503,8 @@ int git_diff_basic_config(const char *var, const char *value,
 
        if (!strcmp(var, "diff.dirstat")) {
                struct strbuf errmsg = STRBUF_INIT;
+               if (!value)
+                       return config_error_nonbool(var);
                default_diff_options.dirstat_permille = diff_dirstat_permille_default;
                if (parse_dirstat_params(&default_diff_options, value, &errmsg))
                        warning(_("Found errors in 'diff.dirstat' config variable:\n%s"),
@@ -2704,12 +2724,14 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
        number_width = decimal_width(max_change) > number_width ?
                decimal_width(max_change) : number_width;
 
+       if (options->stat_name_width == -1)
+               options->stat_name_width = diff_stat_name_width;
        if (options->stat_graph_width == -1)
                options->stat_graph_width = diff_stat_graph_width;
 
        /*
-        * Guarantee 3/8*16==6 for the graph part
-        * and 5/8*16==10 for the filename part
+        * Guarantee 3/8*16 == 6 for the graph part
+        * and 5/8*16 == 10 for the filename part
         */
        if (width < 16 + 6 + number_width)
                width = 16 + 6 + number_width;
@@ -3563,18 +3585,21 @@ static void builtin_diff(const char *name_a,
                strbuf_addf(&header, "%s%snew file mode %06o%s\n", line_prefix, meta, two->mode, reset);
                if (xfrm_msg)
                        strbuf_addstr(&header, xfrm_msg);
+               o->found_changes = 1;
                must_show_header = 1;
        }
        else if (lbl[1][0] == '/') {
                strbuf_addf(&header, "%s%sdeleted file mode %06o%s\n", line_prefix, meta, one->mode, reset);
                if (xfrm_msg)
                        strbuf_addstr(&header, xfrm_msg);
+               o->found_changes = 1;
                must_show_header = 1;
        }
        else {
                if (one->mode != two->mode) {
                        strbuf_addf(&header, "%s%sold mode %06o%s\n", line_prefix, meta, one->mode, reset);
                        strbuf_addf(&header, "%s%snew mode %06o%s\n", line_prefix, meta, two->mode, reset);
+                       o->found_changes = 1;
                        must_show_header = 1;
                }
                if (xfrm_msg)
@@ -4359,7 +4384,8 @@ static void run_external_diff(const char *pgm,
                add_external_diff_name(o->repo, &cmd.args, two);
                if (other) {
                        strvec_push(&cmd.args, other);
-                       strvec_push(&cmd.args, xfrm_msg);
+                       if (xfrm_msg)
+                               strvec_push(&cmd.args, xfrm_msg);
                }
        }
 
@@ -4832,6 +4858,10 @@ void diff_setup_done(struct diff_options *options)
        else
                options->prefix_length = 0;
 
+       /*
+        * --name-only, --name-status, --checkdiff, and -s
+        * turn other output format off.
+        */
        if (options->output_format & (DIFF_FORMAT_NAME |
                                      DIFF_FORMAT_NAME_STATUS |
                                      DIFF_FORMAT_CHECKDIFF |
@@ -5560,7 +5590,7 @@ struct option *add_diff_options(const struct option *opts,
                OPT_BITOP(0, "shortstat", &options->output_format,
                          N_("output only the last line of --stat"),
                          DIFF_FORMAT_SHORTSTAT, DIFF_FORMAT_NO_OUTPUT),
-               OPT_CALLBACK_F('X', "dirstat", options, N_("<param1,param2>..."),
+               OPT_CALLBACK_F('X', "dirstat", options, N_("<param1>,<param2>..."),
                               N_("output the distribution of relative amount of changes for each sub-directory"),
                               PARSE_OPT_NONEG | PARSE_OPT_OPTARG,
                               diff_opt_dirstat),
@@ -5568,8 +5598,8 @@ struct option *add_diff_options(const struct option *opts,
                               N_("synonym for --dirstat=cumulative"),
                               PARSE_OPT_NONEG | PARSE_OPT_NOARG,
                               diff_opt_dirstat),
-               OPT_CALLBACK_F(0, "dirstat-by-file", options, N_("<param1,param2>..."),
-                              N_("synonym for --dirstat=files,param1,param2..."),
+               OPT_CALLBACK_F(0, "dirstat-by-file", options, N_("<param1>,<param2>..."),
+                              N_("synonym for --dirstat=files,<param1>,<param2>..."),
                               PARSE_OPT_NONEG | PARSE_OPT_OPTARG,
                               diff_opt_dirstat),
                OPT_BIT_F(0, "check", &options->output_format,
@@ -6206,6 +6236,8 @@ static void flush_one_pair(struct diff_filepair *p, struct diff_options *opt)
                fprintf(opt->file, "%s", diff_line_prefix(opt));
                write_name_quoted(name_a, opt->file, opt->line_termination);
        }
+
+       opt->found_changes = 1;
 }
 
 static void show_file_mode_name(struct diff_options *opt, const char *newdelete, struct diff_filespec *fs)
@@ -6684,6 +6716,21 @@ void diff_flush(struct diff_options *options)
                separator++;
        }
 
+       if (output_format & DIFF_FORMAT_PATCH) {
+               if (separator) {
+                       emit_diff_symbol(options, DIFF_SYMBOL_SEPARATOR, NULL, 0, 0);
+                       if (options->stat_sep)
+                               /* attach patch instead of inline */
+                               emit_diff_symbol(options, DIFF_SYMBOL_STAT_SEP,
+                                                NULL, 0, 0);
+               }
+
+               diff_flush_patch_all_file_pairs(options);
+       }
+
+       if (output_format & DIFF_FORMAT_CALLBACK)
+               options->format_callback(q, options, options->format_callback_data);
+
        if (output_format & DIFF_FORMAT_NO_OUTPUT &&
            options->flags.exit_with_status &&
            options->flags.diff_from_contents) {
@@ -6705,21 +6752,6 @@ void diff_flush(struct diff_options *options)
                }
        }
 
-       if (output_format & DIFF_FORMAT_PATCH) {
-               if (separator) {
-                       emit_diff_symbol(options, DIFF_SYMBOL_SEPARATOR, NULL, 0, 0);
-                       if (options->stat_sep)
-                               /* attach patch instead of inline */
-                               emit_diff_symbol(options, DIFF_SYMBOL_STAT_SEP,
-                                                NULL, 0, 0);
-               }
-
-               diff_flush_patch_all_file_pairs(options);
-       }
-
-       if (output_format & DIFF_FORMAT_CALLBACK)
-               options->format_callback(q, options, options->format_callback_data);
-
 free_queue:
        diff_free_queue(q);
        DIFF_QUEUE_CLEAR(q);
@@ -6920,6 +6952,13 @@ void diff_queued_diff_prefetch(void *repository)
        oid_array_clear(&to_fetch);
 }
 
+void init_diffstat_widths(struct diff_options *options)
+{
+       options->stat_width = -1;        /* use full terminal width */
+       options->stat_name_width = -1;   /* respect diff.statNameWidth config */
+       options->stat_graph_width = -1;  /* respect diff.statGraphWidth config */
+}
+
 void diffcore_std(struct diff_options *options)
 {
        int output_formats_to_prefetch = DIFF_FORMAT_DIFFSTAT |
@@ -6973,16 +7012,14 @@ void diffcore_std(struct diff_options *options)
        options->found_follow = 0;
 }
 
-int diff_result_code(struct diff_options *opt, int status)
+int diff_result_code(struct diff_options *opt)
 {
        int result = 0;
 
        diff_warn_rename_limit("diff.renameLimit",
                               opt->needed_rename_limit,
                               opt->degraded_cc_to_c);
-       if (!opt->flags.exit_with_status &&
-           !(opt->output_format & DIFF_FORMAT_CHECKDIFF))
-               return status;
+
        if (opt->flags.exit_with_status &&
            opt->flags.has_changes)
                result |= 01;
@@ -7029,6 +7066,7 @@ void compute_diffstat(struct diff_options *options,
                if (check_pair_status(p))
                        diff_flush_stat(p, options, diffstat);
        }
+       options->found_changes = !!diffstat->nr;
 }
 
 void diff_addremove(struct diff_options *options,
diff --git a/diff.h b/diff.h
index 260c454155a21af2c133fb78254fdafc20534f7f..66bd8aeb2936fbe9d6610f7dc1202e31e1450ebb 100644 (file)
--- a/diff.h
+++ b/diff.h
@@ -573,6 +573,7 @@ int git_config_rename(const char *var, const char *value);
 
 #define DIFF_PICKAXE_IGNORE_CASE       32
 
+void init_diffstat_widths(struct diff_options *);
 void diffcore_std(struct diff_options *);
 void diffcore_fix_diff_index(void);
 
@@ -637,17 +638,17 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb);
 #define DIFF_SILENT_ON_REMOVED 01
 /* report racily-clean paths as modified */
 #define DIFF_RACY_IS_MODIFIED 02
-int run_diff_files(struct rev_info *revs, unsigned int option);
+void run_diff_files(struct rev_info *revs, unsigned int option);
 
 #define DIFF_INDEX_CACHED 01
 #define DIFF_INDEX_MERGE_BASE 02
-int run_diff_index(struct rev_info *revs, unsigned int option);
+void run_diff_index(struct rev_info *revs, unsigned int option);
 
 int do_diff_cache(const struct object_id *, struct diff_options *);
 int diff_flush_patch_id(struct diff_options *, struct object_id *, int);
 void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx);
 
-int diff_result_code(struct diff_options *, int);
+int diff_result_code(struct diff_options *);
 
 int diff_no_index(struct rev_info *,
                  int implicit_no_index, int, const char **);
index f57ece2757d46ea6dee3af34a476c5fdd9908b0d..49ba38aa7c0a58433380e560f6d84e0cc084a67f 100644 (file)
@@ -2,7 +2,6 @@
  * Copyright (C) 2005 Junio C Hamano
  */
 #include "git-compat-util.h"
-#include "diff.h"
 #include "diffcore.h"
 #include "hash.h"
 #include "object.h"
index c30b56e983bda39e18eda24bb81608ae7a33942c..ba6cbee76ba0180db352d4baf0653af201304046 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "diff.h"
 #include "diffcore.h"
 
 /*
@@ -159,6 +158,10 @@ static struct spanhash_top *hash_chars(struct repository *r,
                n = 0;
                accum1 = accum2 = 0;
        }
+       if (n > 0) {
+               hashval = (accum1 + accum2 * 0x61) % HASHBASE;
+               hash = add_spanhash(hash, hashval, n);
+       }
        QSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp);
        return hash;
 }
index 278b04243a3f40e63df433eea9549f90aed1c34d..de619846f29ad9c51d42b538d12c1b62e3958b5d 100644 (file)
@@ -2,10 +2,19 @@
 #include "dir.h"
 #include "iterator.h"
 #include "dir-iterator.h"
+#include "string-list.h"
 
 struct dir_iterator_level {
        DIR *dir;
 
+       /*
+        * The directory entries of the current level. This list will only be
+        * populated when the iterator is ordered. In that case, `dir` will be
+        * set to `NULL`.
+        */
+       struct string_list entries;
+       size_t entries_idx;
+
        /*
         * The length of the directory part of path at this level
         * (including a trailing '/'):
@@ -43,6 +52,31 @@ struct dir_iterator_int {
        unsigned int flags;
 };
 
+static int next_directory_entry(DIR *dir, const char *path,
+                               struct dirent **out)
+{
+       struct dirent *de;
+
+repeat:
+       errno = 0;
+       de = readdir(dir);
+       if (!de) {
+               if (errno) {
+                       warning_errno("error reading directory '%s'",
+                                     path);
+                       return -1;
+               }
+
+               return 1;
+       }
+
+       if (is_dot_or_dotdot(de->d_name))
+               goto repeat;
+
+       *out = de;
+       return 0;
+}
+
 /*
  * Push a level in the iter stack and initialize it with information from
  * the directory pointed by iter->base->path. It is assumed that this
@@ -72,6 +106,35 @@ static int push_level(struct dir_iterator_int *iter)
                return -1;
        }
 
+       string_list_init_dup(&level->entries);
+       level->entries_idx = 0;
+
+       /*
+        * When the iterator is sorted we read and sort all directory entries
+        * directly.
+        */
+       if (iter->flags & DIR_ITERATOR_SORTED) {
+               struct dirent *de;
+
+               while (1) {
+                       int ret = next_directory_entry(level->dir, iter->base.path.buf, &de);
+                       if (ret < 0) {
+                               if (errno != ENOENT &&
+                                   iter->flags & DIR_ITERATOR_PEDANTIC)
+                                       return -1;
+                               continue;
+                       } else if (ret > 0) {
+                               break;
+                       }
+
+                       string_list_append(&level->entries, de->d_name);
+               }
+               string_list_sort(&level->entries);
+
+               closedir(level->dir);
+               level->dir = NULL;
+       }
+
        return 0;
 }
 
@@ -88,21 +151,22 @@ static int pop_level(struct dir_iterator_int *iter)
                warning_errno("error closing directory '%s'",
                              iter->base.path.buf);
        level->dir = NULL;
+       string_list_clear(&level->entries, 0);
 
        return --iter->levels_nr;
 }
 
 /*
  * Populate iter->base with the necessary information on the next iteration
- * entry, represented by the given dirent de. Return 0 on success and -1
+ * entry, represented by the given name. Return 0 on success and -1
  * otherwise, setting errno accordingly.
  */
 static int prepare_next_entry_data(struct dir_iterator_int *iter,
-                                  struct dirent *de)
+                                  const char *name)
 {
        int err, saved_errno;
 
-       strbuf_addstr(&iter->base.path, de->d_name);
+       strbuf_addstr(&iter->base.path, name);
        /*
         * We have to reset these because the path strbuf might have
         * been realloc()ed at the previous strbuf_addstr().
@@ -139,27 +203,34 @@ int dir_iterator_advance(struct dir_iterator *dir_iterator)
                struct dirent *de;
                struct dir_iterator_level *level =
                        &iter->levels[iter->levels_nr - 1];
+               const char *name;
 
                strbuf_setlen(&iter->base.path, level->prefix_len);
-               errno = 0;
-               de = readdir(level->dir);
 
-               if (!de) {
-                       if (errno) {
-                               warning_errno("error reading directory '%s'",
-                                             iter->base.path.buf);
+               if (level->dir) {
+                       int ret = next_directory_entry(level->dir, iter->base.path.buf, &de);
+                       if (ret < 0) {
                                if (iter->flags & DIR_ITERATOR_PEDANTIC)
                                        goto error_out;
-                       } else if (pop_level(iter) == 0) {
-                               return dir_iterator_abort(dir_iterator);
+                               continue;
+                       } else if (ret > 0) {
+                               if (pop_level(iter) == 0)
+                                       return dir_iterator_abort(dir_iterator);
+                               continue;
                        }
-                       continue;
-               }
 
-               if (is_dot_or_dotdot(de->d_name))
-                       continue;
+                       name = de->d_name;
+               } else {
+                       if (level->entries_idx >= level->entries.nr) {
+                               if (pop_level(iter) == 0)
+                                       return dir_iterator_abort(dir_iterator);
+                               continue;
+                       }
 
-               if (prepare_next_entry_data(iter, de)) {
+                       name = level->entries.items[level->entries_idx++].string;
+               }
+
+               if (prepare_next_entry_data(iter, name)) {
                        if (errno != ENOENT && iter->flags & DIR_ITERATOR_PEDANTIC)
                                goto error_out;
                        continue;
@@ -188,6 +259,8 @@ int dir_iterator_abort(struct dir_iterator *dir_iterator)
                        warning_errno("error closing directory '%s'",
                                      iter->base.path.buf);
                }
+
+               string_list_clear(&level->entries, 0);
        }
 
        free(iter->levels);
index 479e1ec784dfa4081430ea5a104302e79d10eae3..6d438809b6ed51b5735080f878c08aa2302b7552 100644 (file)
  *   and ITER_ERROR is returned immediately. In both cases, a meaningful
  *   warning is emitted. Note: ENOENT errors are always ignored so that
  *   the API users may remove files during iteration.
+ *
+ * - DIR_ITERATOR_SORTED: sort directory entries alphabetically.
  */
 #define DIR_ITERATOR_PEDANTIC (1 << 0)
+#define DIR_ITERATOR_SORTED   (1 << 1)
 
 struct dir_iterator {
        /* The current path: */
diff --git a/dir.c b/dir.c
index 8486e4d56ff50cafd14aa3ef00ee89c069d87269..20ebe4cba2687e027765876ddc57b086fa85dd71 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -16,7 +16,6 @@
 #include "object-file.h"
 #include "object-store-ll.h"
 #include "path.h"
-#include "attr.h"
 #include "refs.h"
 #include "wildmatch.h"
 #include "pathspec.h"
@@ -2179,7 +2178,8 @@ static int exclude_matches_pathspec(const char *path, int pathlen,
                       PATHSPEC_LITERAL |
                       PATHSPEC_GLOB |
                       PATHSPEC_ICASE |
-                      PATHSPEC_EXCLUDE);
+                      PATHSPEC_EXCLUDE |
+                      PATHSPEC_ATTR);
 
        for (i = 0; i < pathspec->nr; i++) {
                const struct pathspec_item *item = &pathspec->items[i];
@@ -2235,6 +2235,39 @@ static int get_index_dtype(struct index_state *istate,
        return DT_UNKNOWN;
 }
 
+unsigned char get_dtype(struct dirent *e, struct strbuf *path,
+                       int follow_symlink)
+{
+       struct stat st;
+       unsigned char dtype = DTYPE(e);
+       size_t base_path_len;
+
+       if (dtype != DT_UNKNOWN && !(follow_symlink && dtype == DT_LNK))
+               return dtype;
+
+       /*
+        * d_type unknown or unfollowed symlink, try to fall back on [l]stat
+        * results. If [l]stat fails, explicitly set DT_UNKNOWN.
+        */
+       base_path_len = path->len;
+       strbuf_addstr(path, e->d_name);
+       if ((follow_symlink && stat(path->buf, &st)) ||
+           (!follow_symlink && lstat(path->buf, &st)))
+               goto cleanup;
+
+       /* determine d_type from st_mode */
+       if (S_ISREG(st.st_mode))
+               dtype = DT_REG;
+       else if (S_ISDIR(st.st_mode))
+               dtype = DT_DIR;
+       else if (S_ISLNK(st.st_mode))
+               dtype = DT_LNK;
+
+cleanup:
+       strbuf_setlen(path, base_path_len);
+       return dtype;
+}
+
 static int resolve_dtype(int dtype, struct index_state *istate,
                         const char *path, int len)
 {
@@ -3885,6 +3918,26 @@ void untracked_cache_invalidate_path(struct index_state *istate,
                                 path, strlen(path));
 }
 
+void untracked_cache_invalidate_trimmed_path(struct index_state *istate,
+                                            const char *path,
+                                            int safe_path)
+{
+       size_t len = strlen(path);
+
+       if (!len)
+               BUG("untracked_cache_invalidate_trimmed_path given zero length path");
+
+       if (path[len - 1] != '/') {
+               untracked_cache_invalidate_path(istate, path, safe_path);
+       } else {
+               struct strbuf tmp = STRBUF_INIT;
+
+               strbuf_add(&tmp, path, len - 1);
+               untracked_cache_invalidate_path(istate, tmp.buf, safe_path);
+               strbuf_release(&tmp);
+       }
+}
+
 void untracked_cache_remove_from_index(struct index_state *istate,
                                       const char *path)
 {
diff --git a/dir.h b/dir.h
index ad06682fd54b3e7ae47d6f8a8d80048da0324f01..45a7b9ec5f2d52214e8000dbd68913056a1a2d77 100644 (file)
--- a/dir.h
+++ b/dir.h
@@ -363,6 +363,22 @@ struct dir_struct {
 
 struct dirent *readdir_skip_dot_and_dotdot(DIR *dirp);
 
+/*
+ * Get the d_type of a dirent. If the d_type is unknown, derive it from
+ * stat.st_mode using the path to the dirent's containing directory (path) and
+ * the name of the dirent itself.
+ *
+ * If 'follow_symlink' is 1, this function will attempt to follow DT_LNK types
+ * using 'stat'. Links are *not* followed recursively, so a symlink pointing
+ * to another symlink will still resolve to 'DT_LNK'.
+ *
+ * Note that 'path' is assumed to have a trailing slash. It is also modified
+ * in-place during the execution of the function, but is then reverted to its
+ * original value before returning.
+ */
+unsigned char get_dtype(struct dirent *e, struct strbuf *path,
+                       int follow_symlink);
+
 /*Count the number of slashes for string s*/
 int count_slashes(const char *s);
 
@@ -560,6 +576,13 @@ int cmp_dir_entry(const void *p1, const void *p2);
 int check_dir_entry_contains(const struct dir_entry *out, const struct dir_entry *in);
 
 void untracked_cache_invalidate_path(struct index_state *, const char *, int safe_path);
+/*
+ * Invalidate the untracked-cache for this path, but first strip
+ * off a trailing slash, if present.
+ */
+void untracked_cache_invalidate_trimmed_path(struct index_state *,
+                                            const char *path,
+                                            int safe_path);
 void untracked_cache_remove_from_index(struct index_state *, const char *);
 void untracked_cache_add_to_index(struct index_state *, const char *);
 
diff --git a/entry.c b/entry.c
index 43767f9043c0cbb97ec3257fd78b0a985e5a8f77..f918a3a78e8154fb62de1fb2378d100f9c47e9ca 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "blob.h"
 #include "object-store-ll.h"
 #include "dir.h"
 #include "environment.h"
@@ -581,3 +580,8 @@ void unlink_entry(const struct cache_entry *ce, const char *super_prefix)
                return;
        schedule_dir_for_removal(ce->name, ce_namelen(ce));
 }
+
+int remove_or_warn(unsigned int mode, const char *file)
+{
+       return S_ISGITLINK(mode) ? rmdir_or_warn(file) : unlink_or_warn(file);
+}
diff --git a/entry.h b/entry.h
index 7329f918a97ee3f80aeeaff07e4236143fcf3cbf..ca3ed35bc08654ee47bc6c9331c1fad2804bfd32 100644 (file)
--- a/entry.h
+++ b/entry.h
@@ -62,4 +62,10 @@ int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st)
 void update_ce_after_write(const struct checkout *state, struct cache_entry *ce,
                           struct stat *st);
 
+/*
+ * Calls the correct function out of {unlink,rmdir}_or_warn based on
+ * the supplied file mode.
+ */
+int remove_or_warn(unsigned int mode, const char *path);
+
 #endif /* ENTRY_H */
index f98d76f08047f14f49e9d3c3d1a4232c500efbf1..60706ea3987f2c4d11e5e2e2d21aa5cd5e9196e1 100644 (file)
@@ -64,7 +64,7 @@ const char *excludes_file;
 enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
 enum eol core_eol = EOL_UNSET;
 int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
-char *check_roundtrip_encoding = "SHIFT-JIS";
+const char *check_roundtrip_encoding = "SHIFT-JIS";
 enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
 enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
 enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
@@ -81,6 +81,20 @@ int merge_log_config = -1;
 int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
 unsigned long pack_size_limit_cfg;
 enum log_refs_config log_all_ref_updates = LOG_REFS_UNSET;
+int max_allowed_tree_depth =
+#ifdef _MSC_VER
+       /*
+        * When traversing into too-deep trees, Visual C-compiled Git seems to
+        * run into some internal stack overflow detection in the
+        * `RtlpAllocateHeap()` function that is called from within
+        * `git_inflate_init()`'s call tree. The following value seems to be
+        * low enough to avoid that by letting Git exit with an error before
+        * the stack overflow can occur.
+        */
+       512;
+#else
+       2048;
+#endif
 
 #ifndef PROTECT_HFS_DEFAULT
 #define PROTECT_HFS_DEFAULT 0
@@ -193,6 +207,9 @@ void setup_git_env(const char *git_dir)
        shallow_file = getenv(GIT_SHALLOW_FILE_ENVIRONMENT);
        if (shallow_file)
                set_alternate_shallow_file(the_repository, shallow_file, 0);
+
+       if (git_env_bool(NO_LAZY_FETCH_ENVIRONMENT, 0))
+               fetch_if_missing = 0;
 }
 
 int is_bare_repository(void)
index c5377473c683390992315f69a63c557b25c655bb..5cec19cecc1a5a2c057f807f3b96dd2b29f0b355 100644 (file)
@@ -36,6 +36,7 @@ const char *getenv_safe(struct strvec *argv, const char *name);
 #define CEILING_DIRECTORIES_ENVIRONMENT "GIT_CEILING_DIRECTORIES"
 #define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS"
 #define GIT_REPLACE_REF_BASE_ENVIRONMENT "GIT_REPLACE_REF_BASE"
+#define NO_LAZY_FETCH_ENVIRONMENT "GIT_NO_LAZY_FETCH"
 #define GITATTRIBUTES_FILE ".gitattributes"
 #define INFOATTRIBUTES_FILE "info/attributes"
 #define ATTRIBUTE_MACRO_PREFIX "[attr]"
@@ -132,6 +133,7 @@ extern size_t packed_git_limit;
 extern size_t delta_base_cache_limit;
 extern unsigned long big_file_threshold;
 extern unsigned long pack_size_limit_cfg;
+extern int max_allowed_tree_depth;
 
 /*
  * Accessors for the core.sharedrepository config which lazy-load the value
index 7b525b1ecd896e02dfa71cdf3aab75496d998fac..ac7e0af622a8fc74b678b57f464698d1bc9a45e7 100644 (file)
@@ -169,6 +169,15 @@ size_t bitmap_popcount(struct bitmap *self)
        return count;
 }
 
+int bitmap_is_empty(struct bitmap *self)
+{
+       size_t i;
+       for (i = 0; i < self->word_alloc; i++)
+               if (self->words[i])
+                       return 0;
+       return 1;
+}
+
 int bitmap_equals(struct bitmap *self, struct bitmap *other)
 {
        struct bitmap *big, *small;
index 7eb8b9b63013daa70c91687108307d38a9eb1e09..c11d76c6f336930e0ea540a5b40c594bdb9f5be2 100644 (file)
@@ -189,5 +189,6 @@ void bitmap_or_ewah(struct bitmap *self, struct ewah_bitmap *other);
 void bitmap_or(struct bitmap *self, const struct bitmap *other);
 
 size_t bitmap_popcount(struct bitmap *self);
+int bitmap_is_empty(struct bitmap *self);
 
 #endif
index 1d597e84ea7f4c3c8296cbf527bf0c5514037e99..909777f61f4fa3d9d8c51c25db96e8d1f30544ae 100644 (file)
@@ -4,7 +4,6 @@
 #include "exec-cmd.h"
 #include "gettext.h"
 #include "path.h"
-#include "quote.h"
 #include "run-command.h"
 #include "strvec.h"
 #include "trace.h"
index 65c1ff4bb4fbcdf21b4b13cd427f7a764f60d237..091f9a80a9ee72593c5079b48f15ea22dbd59d4c 100644 (file)
@@ -10,7 +10,6 @@
 #include "pkt-line.h"
 #include "commit.h"
 #include "tag.h"
-#include "exec-cmd.h"
 #include "pack.h"
 #include "sideband.h"
 #include "fetch-pack.h"
@@ -18,7 +17,6 @@
 #include "run-command.h"
 #include "connect.h"
 #include "trace2.h"
-#include "transport.h"
 #include "version.h"
 #include "oid-array.h"
 #include "oidset.h"
@@ -1862,6 +1860,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
 static int fetch_pack_config_cb(const char *var, const char *value,
                                const struct config_context *ctx, void *cb)
 {
+       const char *msg_id;
+
        if (strcmp(var, "fetch.fsck.skiplist") == 0) {
                const char *path;
 
@@ -1873,12 +1873,14 @@ static int fetch_pack_config_cb(const char *var, const char *value,
                return 0;
        }
 
-       if (skip_prefix(var, "fetch.fsck.", &var)) {
-               if (is_valid_msg_type(var, value))
+       if (skip_prefix(var, "fetch.fsck.", &msg_id)) {
+               if (!value)
+                       return config_error_nonbool(var);
+               if (is_valid_msg_type(msg_id, value))
                        strbuf_addf(&fsck_msg_types, "%c%s=%s",
-                               fsck_msg_types.len ? ',' : '=', var, value);
+                               fsck_msg_types.len ? ',' : '=', msg_id, value);
                else
-                       warning("Skipping unknown msg id '%s'", var);
+                       warning("Skipping unknown msg id '%s'", msg_id);
                return 0;
        }
 
@@ -1911,10 +1913,10 @@ static void fetch_pack_setup(void)
        if (did_setup)
                return;
        fetch_pack_config();
-       if (0 <= transfer_unpack_limit)
-               unpack_limit = transfer_unpack_limit;
-       else if (0 <= fetch_unpack_limit)
+       if (0 <= fetch_unpack_limit)
                unpack_limit = fetch_unpack_limit;
+       else if (0 <= transfer_unpack_limit)
+               unpack_limit = transfer_unpack_limit;
        did_setup = 1;
 }
 
@@ -2214,7 +2216,7 @@ void negotiate_using_fetch(const struct oid_array *negotiation_tips,
                                           the_repository, "%d",
                                           negotiation_round);
        }
-       trace2_region_enter("fetch-pack", "negotiate_using_fetch", the_repository);
+       trace2_region_leave("fetch-pack", "negotiate_using_fetch", the_repository);
        trace2_data_intmax("negotiate_using_fetch", the_repository,
                           "total_rounds", negotiation_round);
        clear_common_flag(acked_commits);
index 8c7752fc8212c7f911f9f462a2b306c48022bc2f..6775d265175748d2fccd2b9571c864a6ec091f20 100644 (file)
@@ -2,7 +2,6 @@
 #define FETCH_PACK_H
 
 #include "string-list.h"
-#include "run-command.h"
 #include "protocol.h"
 #include "list-objects-filter-options.h"
 #include "oidset.h"
diff --git a/fsck.c b/fsck.c
index 6b492a48da828cdb67163b89ff55c82fd2206b46..78af29d26459e1d392d8a64ff72dd5fed575daff 100644 (file)
--- a/fsck.c
+++ b/fsck.c
 #include "refs.h"
 #include "url.h"
 #include "utf8.h"
-#include "decorate.h"
 #include "oidset.h"
 #include "packfile.h"
 #include "submodule-config.h"
 #include "config.h"
-#include "credential.h"
 #include "help.h"
 
+static ssize_t max_tree_entry_len = 4096;
+
 #define STR(x) #x
 #define MSG_ID(id, msg_type) { STR(id), NULL, NULL, FSCK_##msg_type },
 static struct {
@@ -154,15 +154,29 @@ void fsck_set_msg_type(struct fsck_options *options,
                       const char *msg_id_str, const char *msg_type_str)
 {
        int msg_id = parse_msg_id(msg_id_str);
-       enum fsck_msg_type msg_type = parse_msg_type(msg_type_str);
+       char *to_free = NULL;
+       enum fsck_msg_type msg_type;
 
        if (msg_id < 0)
                die("Unhandled message id: %s", msg_id_str);
 
+       if (msg_id == FSCK_MSG_LARGE_PATHNAME) {
+               const char *colon = strchr(msg_type_str, ':');
+               if (colon) {
+                       msg_type_str = to_free =
+                               xmemdupz(msg_type_str, colon - msg_type_str);
+                       colon++;
+                       if (!git_parse_ssize_t(colon, &max_tree_entry_len))
+                               die("unable to parse max tree entry len: %s", colon);
+               }
+       }
+       msg_type = parse_msg_type(msg_type_str);
+
        if (msg_type != FSCK_ERROR && msg_id_info[msg_id].msg_type == FSCK_FATAL)
                die("Cannot demote %s to %s", msg_id_str, msg_type_str);
 
        fsck_set_msg_type_from_ids(options, msg_id, msg_type);
+       free(to_free);
 }
 
 void fsck_set_msg_types(struct fsck_options *options, const char *values)
@@ -579,6 +593,7 @@ static int fsck_tree(const struct object_id *tree_oid,
        int has_bad_modes = 0;
        int has_dup_entries = 0;
        int not_properly_sorted = 0;
+       int has_large_name = 0;
        struct tree_desc desc;
        unsigned o_mode;
        const char *o_name;
@@ -609,6 +624,7 @@ static int fsck_tree(const struct object_id *tree_oid,
                has_dotdot |= !strcmp(name, "..");
                has_dotgit |= is_hfs_dotgit(name) || is_ntfs_dotgit(name);
                has_zero_pad |= *(char *)desc.buffer == '0';
+               has_large_name |= tree_entry_len(&desc.entry) > max_tree_entry_len;
 
                if (is_hfs_dotgitmodules(name) || is_ntfs_dotgitmodules(name)) {
                        if (!S_ISLNK(mode))
@@ -751,6 +767,10 @@ static int fsck_tree(const struct object_id *tree_oid,
                retval += report(options, tree_oid, OBJ_TREE,
                                 FSCK_MSG_TREE_NOT_SORTED,
                                 "not properly sorted");
+       if (has_large_name)
+               retval += report(options, tree_oid, OBJ_TREE,
+                                FSCK_MSG_LARGE_PATHNAME,
+                                "contains excessively large pathname");
        return retval;
 }
 
@@ -1028,138 +1048,6 @@ done:
        return ret;
 }
 
-static int starts_with_dot_slash(const char *const path)
-{
-       return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_SLASH |
-                               PATH_MATCH_XPLATFORM);
-}
-
-static int starts_with_dot_dot_slash(const char *const path)
-{
-       return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_DOT_SLASH |
-                               PATH_MATCH_XPLATFORM);
-}
-
-static int submodule_url_is_relative(const char *url)
-{
-       return starts_with_dot_slash(url) || starts_with_dot_dot_slash(url);
-}
-
-/*
- * Count directory components that a relative submodule URL should chop
- * from the remote_url it is to be resolved against.
- *
- * In other words, this counts "../" components at the start of a
- * submodule URL.
- *
- * Returns the number of directory components to chop and writes a
- * pointer to the next character of url after all leading "./" and
- * "../" components to out.
- */
-static int count_leading_dotdots(const char *url, const char **out)
-{
-       int result = 0;
-       while (1) {
-               if (starts_with_dot_dot_slash(url)) {
-                       result++;
-                       url += strlen("../");
-                       continue;
-               }
-               if (starts_with_dot_slash(url)) {
-                       url += strlen("./");
-                       continue;
-               }
-               *out = url;
-               return result;
-       }
-}
-/*
- * Check whether a transport is implemented by git-remote-curl.
- *
- * If it is, returns 1 and writes the URL that would be passed to
- * git-remote-curl to the "out" parameter.
- *
- * Otherwise, returns 0 and leaves "out" untouched.
- *
- * Examples:
- *   http::https://example.com/repo.git -> 1, https://example.com/repo.git
- *   https://example.com/repo.git -> 1, https://example.com/repo.git
- *   git://example.com/repo.git -> 0
- *
- * This is for use in checking for previously exploitable bugs that
- * required a submodule URL to be passed to git-remote-curl.
- */
-static int url_to_curl_url(const char *url, const char **out)
-{
-       /*
-        * We don't need to check for case-aliases, "http.exe", and so
-        * on because in the default configuration, is_transport_allowed
-        * prevents URLs with those schemes from being cloned
-        * automatically.
-        */
-       if (skip_prefix(url, "http::", out) ||
-           skip_prefix(url, "https::", out) ||
-           skip_prefix(url, "ftp::", out) ||
-           skip_prefix(url, "ftps::", out))
-               return 1;
-       if (starts_with(url, "http://") ||
-           starts_with(url, "https://") ||
-           starts_with(url, "ftp://") ||
-           starts_with(url, "ftps://")) {
-               *out = url;
-               return 1;
-       }
-       return 0;
-}
-
-static int check_submodule_url(const char *url)
-{
-       const char *curl_url;
-
-       if (looks_like_command_line_option(url))
-               return -1;
-
-       if (submodule_url_is_relative(url) || starts_with(url, "git://")) {
-               char *decoded;
-               const char *next;
-               int has_nl;
-
-               /*
-                * This could be appended to an http URL and url-decoded;
-                * check for malicious characters.
-                */
-               decoded = url_decode(url);
-               has_nl = !!strchr(decoded, '\n');
-
-               free(decoded);
-               if (has_nl)
-                       return -1;
-
-               /*
-                * URLs which escape their root via "../" can overwrite
-                * the host field and previous components, resolving to
-                * URLs like https::example.com/submodule.git and
-                * https:///example.com/submodule.git that were
-                * susceptible to CVE-2020-11008.
-                */
-               if (count_leading_dotdots(url, &next) > 0 &&
-                   (*next == ':' || *next == '/'))
-                       return -1;
-       }
-
-       else if (url_to_curl_url(url, &curl_url)) {
-               struct credential c = CREDENTIAL_INIT;
-               int ret = 0;
-               if (credential_from_url_gently(&c, curl_url, 1) ||
-                   !*c.host)
-                       ret = -1;
-               credential_clear(&c);
-               return ret;
-       }
-
-       return 0;
-}
-
 struct fsck_gitmodules_data {
        const struct object_id *oid;
        struct fsck_options *options;
@@ -1383,6 +1271,8 @@ int git_fsck_config(const char *var, const char *value,
                    const struct config_context *ctx, void *cb)
 {
        struct fsck_options *options = cb;
+       const char *msg_id;
+
        if (strcmp(var, "fsck.skiplist") == 0) {
                const char *path;
                struct strbuf sb = STRBUF_INIT;
@@ -1396,8 +1286,10 @@ int git_fsck_config(const char *var, const char *value,
                return 0;
        }
 
-       if (skip_prefix(var, "fsck.", &var)) {
-               fsck_set_msg_type(options, var, value);
+       if (skip_prefix(var, "fsck.", &msg_id)) {
+               if (!value)
+                       return config_error_nonbool(var);
+               fsck_set_msg_type(options, msg_id, value);
                return 0;
        }
 
diff --git a/fsck.h b/fsck.h
index 6359ba359bd24a5ece2fa4752d55f703af32388e..e3adf9d91159878ae09b35a9fe12370fdbf85f98 100644 (file)
--- a/fsck.h
+++ b/fsck.h
@@ -73,6 +73,7 @@ enum fsck_msg_type {
        FUNC(NULL_SHA1, WARN) \
        FUNC(ZERO_PADDED_FILEMODE, WARN) \
        FUNC(NUL_IN_COMMIT, WARN) \
+       FUNC(LARGE_PATHNAME, WARN) \
        /* infos (reported as warnings, but ignored by default) */ \
        FUNC(BAD_FILEMODE, INFO) \
        FUNC(GITMODULES_PARSE, INFO) \
index 70d776c54f6d142c2efd931cec140afaa91479f4..5cbbec8d940ba75a541dc0398a930f8f393562b6 100644 (file)
@@ -3,9 +3,7 @@
 
 #ifdef HAVE_FSMONITOR_DAEMON_BACKEND
 
-#include "dir.h"
-#include "run-command.h"
-#include "simple-ipc.h"
+#include "hashmap.h"
 #include "thread-utils.h"
 #include "fsmonitor-path-utils.h"
 
@@ -99,7 +97,7 @@ struct fsmonitor_daemon_state {
  * to only mean an external GITDIR referenced by a ".git" file.
  *
  * The platform FS event backends will receive watch-specific
- * relative paths (except for those OS's that always emit absolute
+ * relative paths (except for those OSes that always emit absolute
  * paths).  We use the following enum and routines to classify each
  * path so that we know how to handle it.  There is a slight asymmetry
  * here because ".git/" is inside the working directory and the
index 88575aa54cad07312b2aa3dab3a87cfe0ebb3693..45471b5b741a19515b5d0caea2dd01dd3e9fce25 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "fsmonitor-ll.h"
 #include "gettext.h"
 #include "simple-ipc.h"
 #include "fsmonitor-ipc.h"
@@ -20,7 +19,7 @@ int fsmonitor_ipc__is_supported(void)
        return 0;
 }
 
-const char *fsmonitor_ipc__get_path(struct repository *r)
+const char *fsmonitor_ipc__get_path(struct repository *r UNUSED)
 {
        return NULL;
 }
@@ -30,14 +29,14 @@ enum ipc_active_state fsmonitor_ipc__get_state(void)
        return IPC_STATE__OTHER_ERROR;
 }
 
-int fsmonitor_ipc__send_query(const char *since_token,
-                             struct strbuf *answer)
+int fsmonitor_ipc__send_query(const char *since_token UNUSED,
+                             struct strbuf *answer UNUSED)
 {
        return -1;
 }
 
-int fsmonitor_ipc__send_command(const char *command,
-                               struct strbuf *answer)
+int fsmonitor_ipc__send_command(const char *command UNUSED,
+                               struct strbuf *answer UNUSED)
 {
        return -1;
 }
index b62acf44aee2b9c029fac4389f6af7e4c4df6dab..a6a9e6bc199ec2ea0b608212da2f5b4a6edd94ed 100644 (file)
@@ -62,7 +62,8 @@ static enum fsmonitor_reason check_remote(struct repository *r)
 }
 #endif
 
-static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc)
+static enum fsmonitor_reason check_for_incompatible(struct repository *r,
+                                                   int ipc MAYBE_UNUSED)
 {
        if (!r->worktree) {
                /*
index f670c50937898342f693708c706a0db270be3a6d..2b17d60bbbecb0e0e53a934b4376e2207649e826 100644 (file)
@@ -5,6 +5,7 @@
 #include "ewah/ewok.h"
 #include "fsmonitor.h"
 #include "fsmonitor-ipc.h"
+#include "name-hash.h"
 #include "run-command.h"
 #include "strbuf.h"
 #include "trace2.h"
@@ -183,79 +184,282 @@ static int query_fsmonitor_hook(struct repository *r,
        return result;
 }
 
-static void fsmonitor_refresh_callback(struct index_state *istate, char *name)
+/*
+ * Invalidate the FSM bit on this CE.  This is like mark_fsmonitor_invalid()
+ * but we've already handled the untracked-cache, so let's not repeat that
+ * work.  This also lets us have a different trace message so that we can
+ * see everything that was done as part of the refresh-callback.
+ */
+static void invalidate_ce_fsm(struct cache_entry *ce)
 {
-       int i, len = strlen(name);
-       int pos = index_name_pos(istate, name, len);
+       if (ce->ce_flags & CE_FSMONITOR_VALID) {
+               trace_printf_key(&trace_fsmonitor,
+                                "fsmonitor_refresh_callback INV: '%s'",
+                                ce->name);
+               ce->ce_flags &= ~CE_FSMONITOR_VALID;
+       }
+}
+
+static size_t handle_path_with_trailing_slash(
+       struct index_state *istate, const char *name, int pos);
+
+/*
+ * Use the name-hash to do a case-insensitive cache-entry lookup with
+ * the pathname and invalidate the cache-entry.
+ *
+ * Returns the number of cache-entries that we invalidated.
+ */
+static size_t handle_using_name_hash_icase(
+       struct index_state *istate, const char *name)
+{
+       struct cache_entry *ce = NULL;
+
+       ce = index_file_exists(istate, name, strlen(name), 1);
+       if (!ce)
+               return 0;
 
+       /*
+        * A case-insensitive search in the name-hash using the
+        * observed pathname found a cache-entry, so the observed path
+        * is case-incorrect.  Invalidate the cache-entry and use the
+        * correct spelling from the cache-entry to invalidate the
+        * untracked-cache.  Since we now have sparse-directories in
+        * the index, the observed pathname may represent a regular
+        * file or a sparse-index directory.
+        *
+        * Note that we should not have seen FSEvents for a
+        * sparse-index directory, but we handle it just in case.
+        *
+        * Either way, we know that there are not any cache-entries for
+        * children inside the cone of the directory, so we don't need to
+        * do the usual scan.
+        */
        trace_printf_key(&trace_fsmonitor,
-                        "fsmonitor_refresh_callback '%s' (pos %d)",
-                        name, pos);
+                        "fsmonitor_refresh_callback MAP: '%s' '%s'",
+                        name, ce->name);
 
-       if (name[len - 1] == '/') {
-               /*
-                * The daemon can decorate directory events, such as
-                * moves or renames, with a trailing slash if the OS
-                * FS Event contains sufficient information, such as
-                * MacOS.
-                *
-                * Use this to invalidate the entire cone under that
-                * directory.
-                *
-                * We do not expect an exact match because the index
-                * does not normally contain directory entries, so we
-                * start at the insertion point and scan.
-                */
-               if (pos < 0)
-                       pos = -pos - 1;
+       /*
+        * NEEDSWORK: We used the name-hash to find the correct
+        * case-spelling of the pathname in the cache-entry[], so
+        * technically this is a tracked file or a sparse-directory.
+        * It should not have any entries in the untracked-cache, so
+        * we should not need to use the case-corrected spelling to
+        * invalidate the the untracked-cache.  So we may not need to
+        * do this.  For now, I'm going to be conservative and always
+        * do it; we can revisit this later.
+        */
+       untracked_cache_invalidate_trimmed_path(istate, ce->name, 0);
 
-               /* Mark all entries for the folder invalid */
-               for (i = pos; i < istate->cache_nr; i++) {
-                       if (!starts_with(istate->cache[i]->name, name))
-                               break;
-                       istate->cache[i]->ce_flags &= ~CE_FSMONITOR_VALID;
-               }
+       invalidate_ce_fsm(ce);
+       return 1;
+}
+
+/*
+ * Use the dir-name-hash to find the correct-case spelling of the
+ * directory.  Use the canonical spelling to invalidate all of the
+ * cache-entries within the matching cone.
+ *
+ * Returns the number of cache-entries that we invalidated.
+ */
+static size_t handle_using_dir_name_hash_icase(
+       struct index_state *istate, const char *name)
+{
+       struct strbuf canonical_path = STRBUF_INIT;
+       int pos;
+       size_t len = strlen(name);
+       size_t nr_in_cone;
+
+       if (name[len - 1] == '/')
+               len--;
+
+       if (!index_dir_find(istate, name, len, &canonical_path))
+               return 0; /* name is untracked */
 
+       if (!memcmp(name, canonical_path.buf, canonical_path.len)) {
+               strbuf_release(&canonical_path);
                /*
-                * We need to remove the traling "/" from the path
-                * for the untracked cache.
+                * NEEDSWORK: Our caller already tried an exact match
+                * and failed to find one.  They called us to do an
+                * ICASE match, so we should never get an exact match,
+                * so we could promote this to a BUG() here if we
+                * wanted to.  It doesn't hurt anything to just return
+                * 0 and go on because we should never get here.  Or we
+                * could just get rid of the memcmp() and this "if"
+                * clause completely.
                 */
-               name[len - 1] = '\0';
-       } else if (pos >= 0) {
+               BUG("handle_using_dir_name_hash_icase(%s) did not exact match",
+                   name);
+       }
+
+       trace_printf_key(&trace_fsmonitor,
+                        "fsmonitor_refresh_callback MAP: '%s' '%s'",
+                        name, canonical_path.buf);
+
+       /*
+        * The dir-name-hash only tells us the corrected spelling of
+        * the prefix.  We have to use this canonical path to do a
+        * lookup in the cache-entry array so that we repeat the
+        * original search using the case-corrected spelling.
+        */
+       strbuf_addch(&canonical_path, '/');
+       pos = index_name_pos(istate, canonical_path.buf,
+                            canonical_path.len);
+       nr_in_cone = handle_path_with_trailing_slash(
+               istate, canonical_path.buf, pos);
+       strbuf_release(&canonical_path);
+       return nr_in_cone;
+}
+
+/*
+ * The daemon sent an observed pathname without a trailing slash.
+ * (This is the normal case.)  We do not know if it is a tracked or
+ * untracked file, a sparse-directory, or a populated directory (on a
+ * platform such as Windows where FSEvents are not qualified).
+ *
+ * The pathname contains the observed case reported by the FS. We
+ * do not know it is case-correct or -incorrect.
+ *
+ * Assume it is case-correct and try an exact match.
+ *
+ * Return the number of cache-entries that we invalidated.
+ */
+static size_t handle_path_without_trailing_slash(
+       struct index_state *istate, const char *name, int pos)
+{
+       /*
+        * Mark the untracked cache dirty for this path (regardless of
+        * whether or not we find an exact match for it in the index).
+        * Since the path is unqualified (no trailing slash hint in the
+        * FSEvent), it may refer to a file or directory. So we should
+        * not assume one or the other and should always let the untracked
+        * cache decide what needs to invalidated.
+        */
+       untracked_cache_invalidate_trimmed_path(istate, name, 0);
+
+       if (pos >= 0) {
                /*
-                * We have an exact match for this path and can just
-                * invalidate it.
+                * An exact match on a tracked file. We assume that we
+                * do not need to scan forward for a sparse-directory
+                * cache-entry with the same pathname, nor for a cone
+                * at that directory. (That is, assume no D/F conflicts.)
                 */
-               istate->cache[pos]->ce_flags &= ~CE_FSMONITOR_VALID;
+               invalidate_ce_fsm(istate->cache[pos]);
+               return 1;
        } else {
+               size_t nr_in_cone;
+               struct strbuf work_path = STRBUF_INIT;
+
                /*
-                * The path is not a tracked file -or- it is a
-                * directory event on a platform that cannot
-                * distinguish between file and directory events in
-                * the event handler, such as Windows.
-                *
-                * Scan as if it is a directory and invalidate the
-                * cone under it.  (But remember to ignore items
-                * between "name" and "name/", such as "name-" and
-                * "name.".
+                * The negative "pos" gives us the suggested insertion
+                * point for the pathname (without the trailing slash).
+                * We need to see if there is a directory with that
+                * prefix, but there can be lots of pathnames between
+                * "foo" and "foo/" like "foo-" or "foo-bar", so we
+                * don't want to do our own scan.
                 */
+               strbuf_add(&work_path, name, strlen(name));
+               strbuf_addch(&work_path, '/');
+               pos = index_name_pos(istate, work_path.buf, work_path.len);
+               nr_in_cone = handle_path_with_trailing_slash(
+                       istate, work_path.buf, pos);
+               strbuf_release(&work_path);
+               return nr_in_cone;
+       }
+}
+
+/*
+ * The daemon can decorate directory events, such as a move or rename,
+ * by adding a trailing slash to the observed name.  Use this to
+ * explicitly invalidate the entire cone under that directory.
+ *
+ * The daemon can only reliably do that if the OS FSEvent contains
+ * sufficient information in the event.
+ *
+ * macOS FSEvents have enough information.
+ *
+ * Other platforms may or may not be able to do it (and it might
+ * depend on the type of event (for example, a daemon could lstat() an
+ * observed pathname after a rename, but not after a delete)).
+ *
+ * If we find an exact match in the index for a path with a trailing
+ * slash, it means that we matched a sparse-index directory in a
+ * cone-mode sparse-checkout (since that's the only time we have
+ * directories in the index).  We should never see this in practice
+ * (because sparse directories should not be present and therefore
+ * not generating FS events).  Either way, we can treat them in the
+ * same way and just invalidate the cache-entry and the untracked
+ * cache (and in this case, the forward cache-entry scan won't find
+ * anything and it doesn't hurt to let it run).
+ *
+ * Return the number of cache-entries that we invalidated.  We will
+ * use this later to determine if we need to attempt a second
+ * case-insensitive search on case-insensitive file systems.  That is,
+ * if the search using the observed-case in the FSEvent yields any
+ * results, we assume the prefix is case-correct.  If there are no
+ * matches, we still don't know if the observed path is simply
+ * untracked or case-incorrect.
+ */
+static size_t handle_path_with_trailing_slash(
+       struct index_state *istate, const char *name, int pos)
+{
+       int i;
+       size_t nr_in_cone = 0;
+
+       /*
+        * Mark the untracked cache dirty for this directory path
+        * (regardless of whether or not we find an exact match for it
+        * in the index or find it to be proper prefix of one or more
+        * files in the index), since the FSEvent is hinting that
+        * there may be changes on or within the directory.
+        */
+       untracked_cache_invalidate_trimmed_path(istate, name, 0);
+
+       if (pos < 0)
                pos = -pos - 1;
 
-               for (i = pos; i < istate->cache_nr; i++) {
-                       if (!starts_with(istate->cache[i]->name, name))
-                               break;
-                       if ((unsigned char)istate->cache[i]->name[len] > '/')
-                               break;
-                       if (istate->cache[i]->name[len] == '/')
-                               istate->cache[i]->ce_flags &= ~CE_FSMONITOR_VALID;
-               }
+       /* Mark all entries for the folder invalid */
+       for (i = pos; i < istate->cache_nr; i++) {
+               if (!starts_with(istate->cache[i]->name, name))
+                       break;
+               invalidate_ce_fsm(istate->cache[i]);
+               nr_in_cone++;
        }
 
+       return nr_in_cone;
+}
+
+static void fsmonitor_refresh_callback(struct index_state *istate, char *name)
+{
+       int len = strlen(name);
+       int pos = index_name_pos(istate, name, len);
+       size_t nr_in_cone;
+
+       trace_printf_key(&trace_fsmonitor,
+                        "fsmonitor_refresh_callback '%s' (pos %d)",
+                        name, pos);
+
+       if (name[len - 1] == '/')
+               nr_in_cone = handle_path_with_trailing_slash(istate, name, pos);
+       else
+               nr_in_cone = handle_path_without_trailing_slash(istate, name, pos);
+
        /*
-        * Mark the untracked cache dirty even if it wasn't found in the index
-        * as it could be a new untracked file.
+        * If we did not find an exact match for this pathname or any
+        * cache-entries with this directory prefix and we're on a
+        * case-insensitive file system, try again using the name-hash
+        * and dir-name-hash.
         */
-       untracked_cache_invalidate_path(istate, name, 0);
+       if (!nr_in_cone && ignore_case) {
+               nr_in_cone = handle_using_name_hash_icase(istate, name);
+               if (!nr_in_cone)
+                       nr_in_cone = handle_using_dir_name_hash_icase(
+                               istate, name);
+       }
+
+       if (nr_in_cone)
+               trace_printf_key(&trace_fsmonitor,
+                                "fsmonitor_refresh_callback CNT: %d",
+                                (int)nr_in_cone);
 }
 
 /*
index f27e94407b4c2848eecfbd827ee85525ff8c04ed..57facbc21ec2545e5bdeb1e738445ad403f419b4 100644 (file)
--- a/gettext.c
+++ b/gettext.c
@@ -7,9 +7,7 @@
 #include "environment.h"
 #include "exec-cmd.h"
 #include "gettext.h"
-#include "strbuf.h"
 #include "utf8.h"
-#include "config.h"
 
 #ifndef NO_GETTEXT
 #      include <libintl.h>
index b7c173c345544d61a887cfbebb58703478a29d2d..f5a317b89961ce3bd6ec64afa96ae0e550b7e4d0 100755 (executable)
@@ -54,7 +54,7 @@ and can contain multiple, unrelated branches.
 
 =cut
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Std;
index d32aa754ae14f518d286a8b2205fd0e1d23b5804..7c2a6538e5afea607f3d9a1c09cc6aea5539d8de 100644 (file)
@@ -225,6 +225,7 @@ struct strbuf;
 #include <stddef.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <stdbool.h>
 #include <string.h>
 #ifdef HAVE_STRINGS_H
 #include <strings.h> /* for strcasecmp() */
@@ -422,6 +423,10 @@ char *gitdirname(char *);
 #define PATH_MAX 4096
 #endif
 
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+
 typedef uintmax_t timestamp_t;
 #define PRItime PRIuMAX
 #define parse_timestamp strtoumax
@@ -680,11 +685,11 @@ report_fn get_warn_routine(void);
 void set_die_is_recursing_routine(int (*routine)(void));
 
 /*
- * If the string "str" begins with the string found in "prefix", return 1.
+ * If the string "str" begins with the string found in "prefix", return true.
  * The "out" parameter is set to "str + strlen(prefix)" (i.e., to the point in
  * the string right after the prefix).
  *
- * Otherwise, return 0 and leave "out" untouched.
+ * Otherwise, return false and leave "out" untouched.
  *
  * Examples:
  *
@@ -695,57 +700,58 @@ void set_die_is_recursing_routine(int (*routine)(void));
  *   [skip prefix if present, otherwise use whole string]
  *   skip_prefix(name, "refs/heads/", &name);
  */
-static inline int skip_prefix(const char *str, const char *prefix,
-                             const char **out)
+static inline bool skip_prefix(const char *str, const char *prefix,
+                              const char **out)
 {
        do {
                if (!*prefix) {
                        *out = str;
-                       return 1;
+                       return true;
                }
        } while (*str++ == *prefix++);
-       return 0;
+       return false;
 }
 
 /*
  * Like skip_prefix, but promises never to read past "len" bytes of the input
  * buffer, and returns the remaining number of bytes in "out" via "outlen".
  */
-static inline int skip_prefix_mem(const char *buf, size_t len,
-                                 const char *prefix,
-                                 const char **out, size_t *outlen)
+static inline bool skip_prefix_mem(const char *buf, size_t len,
+                                  const char *prefix,
+                                  const char **out, size_t *outlen)
 {
        size_t prefix_len = strlen(prefix);
        if (prefix_len <= len && !memcmp(buf, prefix, prefix_len)) {
                *out = buf + prefix_len;
                *outlen = len - prefix_len;
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 /*
- * If buf ends with suffix, return 1 and subtract the length of the suffix
- * from *len. Otherwise, return 0 and leave *len untouched.
+ * If buf ends with suffix, return true and subtract the length of the suffix
+ * from *len. Otherwise, return false and leave *len untouched.
  */
-static inline int strip_suffix_mem(const char *buf, size_t *len,
-                                  const char *suffix)
+static inline bool strip_suffix_mem(const char *buf, size_t *len,
+                                   const char *suffix)
 {
        size_t suflen = strlen(suffix);
        if (*len < suflen || memcmp(buf + (*len - suflen), suffix, suflen))
-               return 0;
+               return false;
        *len -= suflen;
-       return 1;
+       return true;
 }
 
 /*
- * If str ends with suffix, return 1 and set *len to the size of the string
- * without the suffix. Otherwise, return 0 and set *len to the size of the
+ * If str ends with suffix, return true and set *len to the size of the string
+ * without the suffix. Otherwise, return false and set *len to the size of the
  * string.
  *
  * Note that we do _not_ NUL-terminate str to the new length.
  */
-static inline int strip_suffix(const char *str, const char *suffix, size_t *len)
+static inline bool strip_suffix(const char *str, const char *suffix,
+                               size_t *len)
 {
        *len = strlen(str);
        return strip_suffix_mem(str, len, suffix);
@@ -1009,6 +1015,15 @@ static inline unsigned long cast_size_t_to_ulong(size_t a)
        return (unsigned long)a;
 }
 
+static inline uint32_t cast_size_t_to_uint32_t(size_t a)
+{
+       if (a != (uint32_t)a)
+               die("object too large to read on this platform: %"
+                   PRIuMAX" is cut off to %u",
+                   (uintmax_t)a, (uint32_t)a);
+       return (uint32_t)a;
+}
+
 static inline int cast_size_t_to_int(size_t a)
 {
        if (a > INT_MAX)
index 289d4bc684dc26256f497636ca5c080fc6589226..1e03ba94d1b27196c74636fc643781e2b25577a9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Std;
index 7bf3c12d6789741fc33a9a9032c697bb89dc2fc0..211ec8459a0b84e95e84b0b67ff3c9a7742ad4be 100755 (executable)
@@ -13,7 +13,7 @@
 # The head revision is on branch "origin" by default.
 # You can change that with the '-o' option.
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Long;
@@ -329,7 +329,7 @@ sub conn {
                        # Use a HTTP Proxy. Only works for HTTP proxies that
                        # don't require user authentication
                        #
-                       # See: http://www.ietf.org/rfc/rfc2817.txt
+                       # See: https://www.ietf.org/rfc/rfc2817.txt
 
                        $s = IO::Socket::INET->new(PeerHost => $proxyhost, PeerPort => $proxyport);
                        die "Socket to $proxyhost: $!\n" unless defined $s;
index 7b757360e28c012eb26632889f831c7fef465e16..124f598bdc07058b139f8dcbf8245128c52d9176 100755 (executable)
@@ -15,7 +15,7 @@
 ####
 ####
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use bytes;
index e4e820e68095928765940be51fba0cdb8e5d609c..dd0c9a5b7f2b078205000f3051df0bade8b0cfab 100755 (executable)
@@ -91,6 +91,19 @@ then
        # ignore the error from the above --- run_merge_tool
        # will diagnose unusable tool by itself
        run_merge_tool "$merge_tool" false
+
+       status=$?
+       if test $status -ge 126
+       then
+               # Command not found (127), not executable (126) or
+               # exited via a signal (>= 128).
+               exit $status
+       fi
+
+       if test "$GIT_DIFFTOOL_TRUST_EXIT_CODE" = true
+       then
+               exit $status
+       fi
 else
        # Launch the merge tool on each path provided by 'git diff'
        while test $# -gt 6
index a0d5a4b28e171542a0bfca2a3e833607aa47d409..3f80435436c11d2f36ee626450ae72697570ca8e 100644 (file)
@@ -138,25 +138,10 @@ GITGUI_SCRIPT   := $$0
 GITGUI_RELATIVE :=
 GITGUI_MACOSXAPP :=
 
-ifeq ($(uname_O),Cygwin)
-       GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
-
-       # Is this a Cygwin Tcl/Tk binary?  If so it knows how to do
-       # POSIX path translation just like cygpath does and we must
-       # keep libdir in POSIX format so Cygwin packages of git-gui
-       # work no matter where the user installs them.
-       #
-       ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /))
-               gg_libdir_sed_in := $(gg_libdir)
-       else
-               gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
-       endif
-else
-       ifeq ($(exedir),$(gg_libdir))
-               GITGUI_RELATIVE := 1
-       endif
-       gg_libdir_sed_in := $(gg_libdir)
+ifeq ($(exedir),$(gg_libdir))
+       GITGUI_RELATIVE := 1
 endif
+gg_libdir_sed_in := $(gg_libdir)
 ifeq ($(uname_S),Darwin)
        ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
                GITGUI_MACOSXAPP := YesPlease
index 5ce2122fbc618384f66f4e1f08f98bca047db1c0..b460b649a8ccfec587dab03fb3c516007ab1a060 100644 (file)
@@ -88,7 +88,7 @@ that you first use `git-format-patch` to generate the emails, audit them, and
 then send them via `git-send-email`.
 
 A pretty good guide to configuring and using `git-send-email` can be found
-[here](https://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/)
+[here](https://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/).
 
 ### Using your email client
 
index 201524c34edac053f908c927a00270a7b1fdc09a..507fb2b6826cf6ca264290f3a6eb907b8d525c11 100755 (executable)
@@ -24,7 +24,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, see <http://www.gnu.org/licenses/>.}]
+along with this program; if not, see <https://www.gnu.org/licenses/>.}]
 
 ######################################################################
 ##
@@ -44,6 +44,132 @@ if {[catch {package require Tcl 8.5} err]
 
 catch {rename send {}} ; # What an evil concept...
 
+######################################################################
+##
+## Enabling platform-specific code paths
+
+proc is_MacOSX {} {
+       if {[tk windowingsystem] eq {aqua}} {
+               return 1
+       }
+       return 0
+}
+
+proc is_Windows {} {
+       if {$::tcl_platform(platform) eq {windows}} {
+               return 1
+       }
+       return 0
+}
+
+set _iscygwin {}
+proc is_Cygwin {} {
+       global _iscygwin
+       if {$_iscygwin eq {}} {
+               if {[string match "CYGWIN_*" $::tcl_platform(os)]} {
+                       set _iscygwin 1
+               } else {
+                       set _iscygwin 0
+               }
+       }
+       return $_iscygwin
+}
+
+######################################################################
+##
+## PATH lookup
+
+set _search_path {}
+proc _which {what args} {
+       global env _search_exe _search_path
+
+       if {$_search_path eq {}} {
+               if {[is_Windows]} {
+                       set gitguidir [file dirname [info script]]
+                       regsub -all ";" $gitguidir "\\;" gitguidir
+                       set env(PATH) "$gitguidir;$env(PATH)"
+                       set _search_path [split $env(PATH) {;}]
+                       # Skip empty `PATH` elements
+                       set _search_path [lsearch -all -inline -not -exact \
+                               $_search_path ""]
+                       set _search_exe .exe
+               } else {
+                       set _search_path [split $env(PATH) :]
+                       set _search_exe {}
+               }
+       }
+
+       if {[is_Windows] && [lsearch -exact $args -script] >= 0} {
+               set suffix {}
+       } else {
+               set suffix $_search_exe
+       }
+
+       foreach p $_search_path {
+               set p [file join $p $what$suffix]
+               if {[file exists $p]} {
+                       return [file normalize $p]
+               }
+       }
+       return {}
+}
+
+proc sanitize_command_line {command_line from_index} {
+       set i $from_index
+       while {$i < [llength $command_line]} {
+               set cmd [lindex $command_line $i]
+               if {[llength [file split $cmd]] < 2} {
+                       set fullpath [_which $cmd]
+                       if {$fullpath eq ""} {
+                               throw {NOT-FOUND} "$cmd not found in PATH"
+                       }
+                       lset command_line $i $fullpath
+               }
+
+               # handle piped commands, e.g. `exec A | B`
+               for {incr i} {$i < [llength $command_line]} {incr i} {
+                       if {[lindex $command_line $i] eq "|"} {
+                               incr i
+                               break
+                       }
+               }
+       }
+       return $command_line
+}
+
+# Override `exec` to avoid unsafe PATH lookup
+
+rename exec real_exec
+
+proc exec {args} {
+       # skip options
+       for {set i 0} {$i < [llength $args]} {incr i} {
+               set arg [lindex $args $i]
+               if {$arg eq "--"} {
+                       incr i
+                       break
+               }
+               if {[string range $arg 0 0] ne "-"} {
+                       break
+               }
+       }
+       set args [sanitize_command_line $args $i]
+       uplevel 1 real_exec $args
+}
+
+# Override `open` to avoid unsafe PATH lookup
+
+rename open real_open
+
+proc open {args} {
+       set arg0 [lindex $args 0]
+       if {[string range $arg0 0 0] eq "|"} {
+               set command_line [string trim [string range $arg0 1 end]]
+               lset args 0 "| [sanitize_command_line $command_line 0]"
+       }
+       uplevel 1 real_open $args
+}
+
 ######################################################################
 ##
 ## locate our library
@@ -163,8 +289,6 @@ set _isbare {}
 set _gitexec {}
 set _githtmldir {}
 set _reponame {}
-set _iscygwin {}
-set _search_path {}
 set _shellpath {@@SHELL_PATH@@}
 
 set _trace [lsearch -exact $argv --trace]
@@ -211,14 +335,7 @@ proc gitexec {args} {
                if {[catch {set _gitexec [git --exec-path]} err]} {
                        error "Git not installed?\n\n$err"
                }
-               if {[is_Cygwin]} {
-                       set _gitexec [exec cygpath \
-                               --windows \
-                               --absolute \
-                               $_gitexec]
-               } else {
-                       set _gitexec [file normalize $_gitexec]
-               }
+               set _gitexec [file normalize $_gitexec]
        }
        if {$args eq {}} {
                return $_gitexec
@@ -233,14 +350,7 @@ proc githtmldir {args} {
                        # Git not installed or option not yet supported
                        return {}
                }
-               if {[is_Cygwin]} {
-                       set _githtmldir [exec cygpath \
-                               --windows \
-                               --absolute \
-                               $_githtmldir]
-               } else {
-                       set _githtmldir [file normalize $_githtmldir]
-               }
+               set _githtmldir [file normalize $_githtmldir]
        }
        if {$args eq {}} {
                return $_githtmldir
@@ -252,40 +362,6 @@ proc reponame {} {
        return $::_reponame
 }
 
-proc is_MacOSX {} {
-       if {[tk windowingsystem] eq {aqua}} {
-               return 1
-       }
-       return 0
-}
-
-proc is_Windows {} {
-       if {$::tcl_platform(platform) eq {windows}} {
-               return 1
-       }
-       return 0
-}
-
-proc is_Cygwin {} {
-       global _iscygwin
-       if {$_iscygwin eq {}} {
-               if {$::tcl_platform(platform) eq {windows}} {
-                       if {[catch {set p [exec cygpath --windir]} err]} {
-                               set _iscygwin 0
-                       } else {
-                               set _iscygwin 1
-                               # Handle MSys2 which is only cygwin when MSYSTEM is MSYS.
-                               if {[info exists ::env(MSYSTEM)] && $::env(MSYSTEM) ne "MSYS"} {
-                                       set _iscygwin 0
-                               }
-                       }
-               } else {
-                       set _iscygwin 0
-               }
-       }
-       return $_iscygwin
-}
-
 proc is_enabled {option} {
        global enabled_options
        if {[catch {set on $enabled_options($option)}]} {return 0}
@@ -448,44 +524,6 @@ proc _git_cmd {name} {
        return $v
 }
 
-proc _which {what args} {
-       global env _search_exe _search_path
-
-       if {$_search_path eq {}} {
-               if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} {
-                       set _search_path [split [exec cygpath \
-                               --windows \
-                               --path \
-                               --absolute \
-                               $env(PATH)] {;}]
-                       set _search_exe .exe
-               } elseif {[is_Windows]} {
-                       set gitguidir [file dirname [info script]]
-                       regsub -all ";" $gitguidir "\\;" gitguidir
-                       set env(PATH) "$gitguidir;$env(PATH)"
-                       set _search_path [split $env(PATH) {;}]
-                       set _search_exe .exe
-               } else {
-                       set _search_path [split $env(PATH) :]
-                       set _search_exe {}
-               }
-       }
-
-       if {[is_Windows] && [lsearch -exact $args -script] >= 0} {
-               set suffix {}
-       } else {
-               set suffix $_search_exe
-       }
-
-       foreach p $_search_path {
-               set p [file join $p $what$suffix]
-               if {[file exists $p]} {
-                       return [file normalize $p]
-               }
-       }
-       return {}
-}
-
 # Test a file for a hashbang to identify executable scripts on Windows.
 proc is_shellscript {filename} {
        if {![file exists $filename]} {return 0}
@@ -623,31 +661,8 @@ proc git_write {args} {
 }
 
 proc githook_read {hook_name args} {
-       set pchook [gitdir hooks $hook_name]
-       lappend args 2>@1
-
-       # On Windows [file executable] might lie so we need to ask
-       # the shell if the hook is executable.  Yes that's annoying.
-       #
-       if {[is_Windows]} {
-               upvar #0 _sh interp
-               if {![info exists interp]} {
-                       set interp [_which sh]
-               }
-               if {$interp eq {}} {
-                       error "hook execution requires sh (not in PATH)"
-               }
-
-               set scr {if test -x "$1";then exec "$@";fi}
-               set sh_c [list $interp -c $scr $interp $pchook]
-               return [_open_stdout_stderr [concat $sh_c $args]]
-       }
-
-       if {[file executable $pchook]} {
-               return [_open_stdout_stderr [concat [list $pchook] $args]]
-       }
-
-       return {}
+       set cmd [concat git hook run --ignore-missing $hook_name -- $args 2>@1]
+       return [_open_stdout_stderr $cmd]
 }
 
 proc kill_file_process {fd} {
@@ -1259,9 +1274,6 @@ if {$_gitdir eq "."} {
        set _gitdir [pwd]
 }
 
-if {![file isdirectory $_gitdir] && [is_Cygwin]} {
-       catch {set _gitdir [exec cygpath --windows $_gitdir]}
-}
 if {![file isdirectory $_gitdir]} {
        catch {wm withdraw .}
        error_popup [strcat [mc "Git directory not found:"] "\n\n$_gitdir"]
@@ -1273,11 +1285,7 @@ apply_config
 
 # v1.7.0 introduced --show-toplevel to return the canonical work-tree
 if {[package vcompare $_git_version 1.7.0] >= 0} {
-       if { [is_Cygwin] } {
-               catch {set _gitworktree [exec cygpath --windows [git rev-parse --show-toplevel]]}
-       } else {
-               set _gitworktree [git rev-parse --show-toplevel]
-       }
+       set _gitworktree [git rev-parse --show-toplevel]
 } else {
        # try to set work tree from environment, core.worktree or use
        # cdup to obtain a relative path to the top of the worktree. If
@@ -1502,24 +1510,8 @@ proc rescan {after {honor_trustmtime 1}} {
        }
 }
 
-if {[is_Cygwin]} {
-       set is_git_info_exclude {}
-       proc have_info_exclude {} {
-               global is_git_info_exclude
-
-               if {$is_git_info_exclude eq {}} {
-                       if {[catch {exec test -f [gitdir info exclude]}]} {
-                               set is_git_info_exclude 0
-                       } else {
-                               set is_git_info_exclude 1
-                       }
-               }
-               return $is_git_info_exclude
-       }
-} else {
-       proc have_info_exclude {} {
-               return [file readable [gitdir info exclude]]
-       }
+proc have_info_exclude {} {
+       return [file readable [gitdir info exclude]]
 }
 
 proc rescan_stage2 {fd after} {
@@ -2259,7 +2251,9 @@ proc do_git_gui {} {
 
 # Get the system-specific explorer app/command.
 proc get_explorer {} {
-       if {[is_Cygwin] || [is_Windows]} {
+       if {[is_Cygwin]} {
+               set explorer "/bin/cygstart.exe --explore"
+       } elseif {[is_Windows]} {
                set explorer "explorer.exe"
        } elseif {[is_MacOSX]} {
                set explorer "open"
@@ -2373,7 +2367,7 @@ proc do_quit {{rc {1}}} {
        set ret_code $rc
 
        # Briefly enable send again, working around Tk bug
-       # http://sourceforge.net/tracker/?func=detail&atid=112997&aid=1821174&group_id=12997
+       # https://sourceforge.net/p/tktoolkit/bugs/2343/
        tk appname [appname]
 
        destroy .
@@ -3053,16 +3047,12 @@ if {[is_MacOSX]} {
 set doc_path [githtmldir]
 if {$doc_path ne {}} {
        set doc_path [file join $doc_path index.html]
-
-       if {[is_Cygwin]} {
-               set doc_path [exec cygpath --mixed $doc_path]
-       }
 }
 
 if {[file isfile $doc_path]} {
        set doc_url "file:$doc_path"
 } else {
-       set doc_url {http://www.kernel.org/pub/software/scm/git/docs/}
+       set doc_url {https://www.kernel.org/pub/software/scm/git/docs/}
 }
 
 proc start_browser {url} {
@@ -4028,60 +4018,6 @@ set file_lists($ui_workdir) [list]
 wm title . "[appname] ([reponame]) [file normalize $_gitworktree]"
 focus -force $ui_comm
 
-# -- Warn the user about environmental problems.  Cygwin's Tcl
-#    does *not* pass its env array onto any processes it spawns.
-#    This means that git processes get none of our environment.
-#
-if {[is_Cygwin]} {
-       set ignored_env 0
-       set suggest_user {}
-       set msg [mc "Possible environment issues exist.
-
-The following environment variables are probably
-going to be ignored by any Git subprocess run
-by %s:
-
-" [appname]]
-       foreach name [array names env] {
-               switch -regexp -- $name {
-               {^GIT_INDEX_FILE$} -
-               {^GIT_OBJECT_DIRECTORY$} -
-               {^GIT_ALTERNATE_OBJECT_DIRECTORIES$} -
-               {^GIT_DIFF_OPTS$} -
-               {^GIT_EXTERNAL_DIFF$} -
-               {^GIT_PAGER$} -
-               {^GIT_TRACE$} -
-               {^GIT_CONFIG$} -
-               {^GIT_(AUTHOR|COMMITTER)_DATE$} {
-                       append msg " - $name\n"
-                       incr ignored_env
-               }
-               {^GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL)$} {
-                       append msg " - $name\n"
-                       incr ignored_env
-                       set suggest_user $name
-               }
-               }
-       }
-       if {$ignored_env > 0} {
-               append msg [mc "
-This is due to a known issue with the
-Tcl binary distributed by Cygwin."]
-
-               if {$suggest_user ne {}} {
-                       append msg [mc "
-
-A good replacement for %s
-is placing values for the user.name and
-user.email settings into your personal
-~/.gitconfig file.
-" $suggest_user]
-               }
-               warn_popup $msg
-       }
-       unset ignored_env msg suggest_user name
-}
-
 # -- Only initialize complex UI if we are going to stay running.
 #
 if {[is_enabled transport]} {
index af1fee7c751dc635bcc9c621161dc3558f297cb8..d23abedcb36fd93ab3f12694d607bf354d6cf208 100644 (file)
@@ -174,9 +174,6 @@ constructor pick {} {
                        -foreground blue \
                        -underline 1
                set home $::env(HOME)
-               if {[is_Cygwin]} {
-                       set home [exec cygpath --windows --absolute $home]
-               }
                set home "[file normalize $home]/"
                set hlen [string length $home]
                foreach p $sorted_recent {
@@ -374,18 +371,6 @@ proc _objdir {path} {
                return $objdir
        }
 
-       if {[is_Cygwin]} {
-               set objdir [file join $path .git objects.lnk]
-               if {[file isfile $objdir]} {
-                       return [win32_read_lnk $objdir]
-               }
-
-               set objdir [file join $path objects.lnk]
-               if {[file isfile $objdir]} {
-                       return [win32_read_lnk $objdir]
-               }
-       }
-
        return {}
 }
 
@@ -623,12 +608,6 @@ method _do_clone2 {} {
        }
 
        set giturl $origin_url
-       if {[is_Cygwin] && [file isdirectory $giturl]} {
-               set giturl [exec cygpath --unix --absolute $giturl]
-               if {$clone_type eq {shared}} {
-                       set objdir [exec cygpath --unix --absolute $objdir]
-               }
-       }
 
        if {[file exists $local_path]} {
                error_popup [mc "Location %s already exists." $local_path]
@@ -668,11 +647,7 @@ method _do_clone2 {} {
                                fconfigure $f_cp -translation binary -encoding binary
                                cd $objdir
                                while {[gets $f_in line] >= 0} {
-                                       if {[is_Cygwin]} {
-                                               puts $f_cp [exec cygpath --unix --absolute $line]
-                                       } else {
-                                               puts $f_cp [file normalize $line]
-                                       }
+                                       puts $f_cp [file normalize $line]
                                }
                                close $f_in
                                close $f_cp
index 32668fc9c6debee6de9882719c305392c1e4791a..d2e0fa60c3ba3f770f525a8d01c66f17826aea75 100644 (file)
@@ -3,7 +3,7 @@
 # (Copied from gitk, commit fd8ccbec4f0161)
 
 # This list of encoding names and aliases is distilled from
-# http://www.iana.org/assignments/character-sets.
+# https://www.iana.org/assignments/character-sets.
 # Not all of them are supported by Tcl.
 set encoding_aliases {
     { ANSI_X3.4-1968 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII
index 97d1d7aa02686606912dd5ff7b512343083a17c0..674a41f5e0c868b70d84202381fec8b5919f962f 100644 (file)
@@ -27,13 +27,10 @@ proc do_windows_shortcut {} {
 }
 
 proc do_cygwin_shortcut {} {
-       global argv0 _gitworktree
+       global argv0 _gitworktree oguilib
 
        if {[catch {
                set desktop [exec cygpath \
-                       --windows \
-                       --absolute \
-                       --long-name \
                        --desktop]
                }]} {
                        set desktop .
@@ -48,19 +45,19 @@ proc do_cygwin_shortcut {} {
                        set fn ${fn}.lnk
                }
                if {[catch {
-                               set sh [exec cygpath \
-                                       --windows \
-                                       --absolute \
-                                       /bin/sh.exe]
-                               set me [exec cygpath \
-                                       --unix \
-                                       --absolute \
-                                       $argv0]
-                               win32_create_lnk $fn [list \
-                                       $sh -c \
-                                       "CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
-                                       ] \
-                                       [file normalize $_gitworktree]
+                               set repodir [file normalize $_gitworktree]
+                               set shargs {-c \
+                                       "CHERE_INVOKING=1 \
+                                       source /etc/profile; \
+                                       git gui"}
+                               exec /bin/mkshortcut.exe \
+                                       --arguments $shargs \
+                                       --desc "git-gui on $repodir" \
+                                       --icon $oguilib/git-gui.ico \
+                                       --name $fn \
+                                       --show min \
+                                       --workingdir $repodir \
+                                       /bin/sh.exe
                        } err]} {
                        error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
                }
index 2514bc22abf4aedfaa8d641976c96fbf222bb8a7..116233100d781a61303c1f63be153e50c52f90a1 100644 (file)
@@ -39,7 +39,7 @@ in your language?
 If you do not know what your language should be named, you need to find
 it.  This currently follows ISO 639-1 two letter codes:
 
-       http://www.loc.gov/standards/iso639-2/php/code_list.php
+       https://www.loc.gov/standards/iso639-2/php/code_list.php
 
 For example, if you are preparing a translation for Afrikaans, the
 language code is "af".  If there already is a translation for your
index c68f49454cd83f48ce3452df178766606effbad9..994431c887277410e50b8a592febf3a1e855469a 100755 (executable)
@@ -432,7 +432,7 @@ mongoose_conf() {
 # Mongoose web server configuration file.
 # Lines starting with '#' and empty lines are ignored.
 # For detailed description of every option, visit
-# http://code.google.com/p/mongoose/wiki/MongooseManual
+# https://code.google.com/p/mongoose/wiki/MongooseManual
 
 root           $root
 ports          $port
@@ -458,7 +458,7 @@ plackup_conf () {
 #!$PERL
 
 # gitweb - simple web interface to track changes in git repositories
-#          PSGI wrapper and server starter (see http://plackperl.org)
+#          PSGI wrapper and server starter (see https://plackperl.org)
 
 use strict;
 
index d26a980e5acb66eda31d32e075d90736bcac4e3a..28ab12c72b6561bf6f583391acf8daa300a6211b 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -689,8 +689,8 @@ def setP4ExecBit(file, mode):
 
     if not isModeExec(mode):
         p4Type = getP4OpenedType(file)
-        p4Type = re.sub('^([cku]?)x(.*)', '\\1\\2', p4Type)
-        p4Type = re.sub('(.*?\+.*?)x(.*?)', '\\1\\2', p4Type)
+        p4Type = re.sub(r'^([cku]?)x(.*)', r'\1\2', p4Type)
+        p4Type = re.sub(r'(.*?\+.*?)x(.*?)', r'\1\2', p4Type)
         if p4Type[-1] == "+":
             p4Type = p4Type[0:-1]
 
@@ -701,7 +701,7 @@ def getP4OpenedType(file):
     """Returns the perforce file type for the given file."""
 
     result = p4_read_pipe(["opened", wildcard_encode(file)])
-    match = re.match(".*\((.+)\)( \*exclusive\*)?\r?$", result)
+    match = re.match(r".*\((.+)\)( \*exclusive\*)?\r?$", result)
     if match:
         return match.group(1)
     else:
@@ -757,7 +757,7 @@ def parseDiffTreeEntry(entry):
 
     global _diff_tree_pattern
     if not _diff_tree_pattern:
-        _diff_tree_pattern = re.compile(':(\d+) (\d+) (\w+) (\w+) ([A-Z])(\d+)?\t(.*?)((\t(.*))|$)')
+        _diff_tree_pattern = re.compile(r':(\d+) (\d+) (\w+) (\w+) ([A-Z])(\d+)?\t(.*?)((\t(.*))|$)')
 
     match = _diff_tree_pattern.match(entry)
     if match:
@@ -918,9 +918,9 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
             if len(result) > 0:
                 data = result[0].get('data')
                 if data:
-                    m = re.search('Too many rows scanned \(over (\d+)\)', data)
+                    m = re.search(r'Too many rows scanned \(over (\d+)\)', data)
                     if not m:
-                        m = re.search('Request too large \(over (\d+)\)', data)
+                        m = re.search(r'Request too large \(over (\d+)\)', data)
 
                     if m:
                         limit = int(m.group(1))
@@ -1452,7 +1452,7 @@ def wildcard_encode(path):
 
 
 def wildcard_present(path):
-    m = re.search("[*#@%]", path)
+    m = re.search(r"[*#@%]", path)
     return m is not None
 
 
@@ -1522,6 +1522,10 @@ class LargeFileSystem(object):
            file is stored in the large file system and handles all necessary
            steps.
            """
+        # symlinks aren't processed by smudge/clean filters
+        if git_mode == "120000":
+            return (git_mode, contents)
+
         if self.exceedsLargeFileThreshold(relPath, contents) or self.hasLargeFileExtension(relPath):
             contentTempFile = self.generateTempFile(contents)
             pointer_git_mode, contents, localLargeFile = self.generatePointer(contentTempFile)
@@ -3044,7 +3048,7 @@ class P4Sync(Command, P4UserMap):
             # Preserve everything in relative path name except leading
             # //depot/; just look at first prefix as they all should
             # be in the same depot.
-            depot = re.sub("^(//[^/]+/).*", r'\1', prefixes[0])
+            depot = re.sub(r"^(//[^/]+/).*", r'\1', prefixes[0])
             if p4PathStartsWith(path, depot):
                 path = path[len(depot):]
 
@@ -3599,7 +3603,7 @@ class P4Sync(Command, P4UserMap):
                     commitFound = True
                 else:
                     gitCommit = read_pipe(["git", "rev-list", "--max-count=1",
-                        "--reverse", ":/\[git-p4:.*change = %d\]" % changelist], ignore_error=True)
+                        "--reverse", r":/\[git-p4:.*change = %d\]" % changelist], ignore_error=True)
                     if len(gitCommit) == 0:
                         print("importing label %s: could not find git commit for changelist %d" % (name, changelist))
                     else:
@@ -4178,7 +4182,7 @@ class P4Sync(Command, P4UserMap):
                 if len(self.changesFile) == 0:
                     revision = "#head"
 
-            p = re.sub("\.\.\.$", "", p)
+            p = re.sub(r"\.\.\.$", "", p)
             if not p.endswith("/"):
                 p += "/"
 
@@ -4247,7 +4251,8 @@ class P4Sync(Command, P4UserMap):
         if self.tempBranches != []:
             for branch in self.tempBranches:
                 read_pipe(["git", "update-ref", "-d", branch])
-            os.rmdir(os.path.join(os.environ.get("GIT_DIR", ".git"), self.tempBranchLocation))
+            if len(read_pipe(["git", "for-each-ref", self.tempBranchLocation])) > 0:
+                   die("There are unexpected temporary branches")
 
         # Create a symbolic ref p4/HEAD pointing to p4/<branch> to allow
         # a convenient shortcut refname "p4".
@@ -4287,7 +4292,7 @@ class P4Rebase(Command):
             die("Cannot find upstream branchpoint for rebase")
 
         # the branchpoint may be p4/foo~3, so strip off the parent
-        upstream = re.sub("~[0-9]+$", "", upstream)
+        upstream = re.sub(r"~[0-9]+$", "", upstream)
 
         print("Rebasing the current branch onto %s" % upstream)
         oldHead = read_pipe(["git", "rev-parse", "HEAD"]).strip()
@@ -4316,8 +4321,8 @@ class P4Clone(P4Sync):
     def defaultDestination(self, args):
         # TODO: use common prefix of args?
         depotPath = args[0]
-        depotDir = re.sub("(@[^@]*)$", "", depotPath)
-        depotDir = re.sub("(#[^#]*)$", "", depotDir)
+        depotDir = re.sub(r"(@[^@]*)$", "", depotPath)
+        depotDir = re.sub(r"(#[^#]*)$", "", depotDir)
         depotDir = re.sub(r"\.\.\.$", "", depotDir)
         depotDir = re.sub(r"/$", "", depotDir)
         return os.path.split(depotDir)[1]
index e3d390974331e83261ba32e757724723b9bea724..eb34cda4092aaf0a396893cd424ca358d93b36aa 100755 (executable)
@@ -148,7 +148,7 @@ do
        if [ -z "$dry_run" ] ; then
                git apply --index -C1 ${level:+"$level"} "$tmp_patch" &&
                tree=$(git write-tree) &&
-               commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit-tree $tree -p $commit) &&
+               commit=$( { echo "$SUBJECT"; echo; cat "$tmp_msg"; } | git commit-tree $tree -p $commit) &&
                git update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
        fi
 done 3<"$QUILT_SERIES"
index 897cea6564fb504ecfc4efdd59f991cfbab113e9..821b2b3a135ab6f4ab0085ac6acbea1d4eb1c320 100755 (executable)
@@ -16,7 +16,7 @@
 #    and second line is the subject of the message.
 #
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Getopt::Long;
@@ -28,8 +28,8 @@ Getopt::Long::Configure qw/ pass_through /;
 
 sub usage {
        print <<EOT;
-git send-email' [<options>] <file|directory>
-git send-email' [<options>] <format-patch options>
+git send-email [<options>] <file|directory>
+git send-email [<options>] <format-patch options>
 git send-email --dump-aliases
 
   Composing:
@@ -119,13 +119,16 @@ sub completion_helper {
 
        foreach my $key (keys %$original_opts) {
                unless (exists $not_for_completion{$key}) {
-                       $key =~ s/!$//;
+                       my $negatable = ($key =~ s/!$//);
 
                        if ($key =~ /[:=][si]$/) {
                                $key =~ s/[:=][si]$//;
                                push (@send_email_opts, "--$_=") foreach (split (/\|/, $key));
                        } else {
                                push (@send_email_opts, "--$_") foreach (split (/\|/, $key));
+                               if ($negatable) {
+                                       push (@send_email_opts, "--no-$_") foreach (split (/\|/, $key));
+                               }
                        }
                }
        }
@@ -228,7 +231,7 @@ sub system_or_msg {
        my @sprintf_args = ($cmd_name ? $cmd_name : $args->[0], $exit_code);
        if (defined $msg) {
                # Quiet the 'redundant' warning category, except we
-               # need to support down to Perl 5.8, so we can't do a
+               # need to support down to Perl 5.8.1, so we can't do a
                # "no warnings 'redundant'", since that category was
                # introduced in perl 5.22, and asking for it will die
                # on older perls.
@@ -491,7 +494,6 @@ my %options = (
                    "bcc=s" => \@getopt_bcc,
                    "no-bcc" => \$no_bcc,
                    "chain-reply-to!" => \$chain_reply_to,
-                   "no-chain-reply-to" => sub {$chain_reply_to = 0},
                    "sendmail-cmd=s" => \$sendmail_cmd,
                    "smtp-server=s" => \$smtp_server,
                    "smtp-server-option=s" => \@smtp_server_options,
@@ -506,36 +508,27 @@ my %options = (
                    "smtp-auth=s" => \$smtp_auth,
                    "no-smtp-auth" => sub {$smtp_auth = 'none'},
                    "annotate!" => \$annotate,
-                   "no-annotate" => sub {$annotate = 0},
                    "compose" => \$compose,
                    "quiet" => \$quiet,
                    "cc-cmd=s" => \$cc_cmd,
                    "header-cmd=s" => \$header_cmd,
                    "no-header-cmd" => \$no_header_cmd,
                    "suppress-from!" => \$suppress_from,
-                   "no-suppress-from" => sub {$suppress_from = 0},
                    "suppress-cc=s" => \@suppress_cc,
                    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
-                   "no-signed-off-cc|no-signed-off-by-cc" => sub {$signed_off_by_cc = 0},
-                   "cc-cover|cc-cover!" => \$cover_cc,
-                   "no-cc-cover" => sub {$cover_cc = 0},
-                   "to-cover|to-cover!" => \$cover_to,
-                   "no-to-cover" => sub {$cover_to = 0},
+                   "cc-cover!" => \$cover_cc,
+                   "to-cover!" => \$cover_to,
                    "confirm=s" => \$confirm,
                    "dry-run" => \$dry_run,
                    "envelope-sender=s" => \$envelope_sender,
                    "thread!" => \$thread,
-                   "no-thread" => sub {$thread = 0},
                    "validate!" => \$validate,
-                   "no-validate" => sub {$validate = 0},
                    "transfer-encoding=s" => \$target_xfer_encoding,
                    "format-patch!" => \$format_patch,
-                   "no-format-patch" => sub {$format_patch = 0},
                    "8bit-encoding=s" => \$auto_8bit_encoding,
                    "compose-encoding=s" => \$compose_encoding,
                    "force" => \$force,
                    "xmailer!" => \$use_xmailer,
-                   "no-xmailer" => sub {$use_xmailer = 0},
                    "batch-size=i" => \$batch_size,
                    "relogin-delay=i" => \$relogin_delay,
                    "git-completion-helper" => \$git_completion_helper,
@@ -799,30 +792,6 @@ $sender = sanitize_address($sender);
 
 $time = time - scalar $#files;
 
-if ($validate) {
-       # FIFOs can only be read once, exclude them from validation.
-       my @real_files = ();
-       foreach my $f (@files) {
-               unless (-p $f) {
-                       push(@real_files, $f);
-               }
-       }
-
-       # Run the loop once again to avoid gaps in the counter due to FIFO
-       # arguments provided by the user.
-       my $num = 1;
-       my $num_files = scalar @real_files;
-       $ENV{GIT_SENDEMAIL_FILE_TOTAL} = "$num_files";
-       foreach my $r (@real_files) {
-               $ENV{GIT_SENDEMAIL_FILE_COUNTER} = "$num";
-               pre_process_file($r, 1);
-               validate_patch($r, $target_xfer_encoding);
-               $num += 1;
-       }
-       delete $ENV{GIT_SENDEMAIL_FILE_COUNTER};
-       delete $ENV{GIT_SENDEMAIL_FILE_TOTAL};
-}
-
 @files = handle_backup_files(@files);
 
 if (@files) {
@@ -861,6 +830,9 @@ if ($compose) {
        my $tpl_subject = $initial_subject || '';
        my $tpl_in_reply_to = $initial_in_reply_to || '';
        my $tpl_reply_to = $reply_to || '';
+       my $tpl_to = join(',', @initial_to);
+       my $tpl_cc = join(',', @initial_cc);
+       my $tpl_bcc = join(', ', @initial_bcc);
 
        print $c <<EOT1, Git::prefix_lines("GIT: ", __(<<EOT2)), <<EOT3;
 From $tpl_sender # This line is ignored.
@@ -872,6 +844,9 @@ for the patch you are writing.
 Clear the body content if you don't wish to send a summary.
 EOT2
 From: $tpl_sender
+To: $tpl_to
+Cc: $tpl_cc
+Bcc: $tpl_bcc
 Reply-To: $tpl_reply_to
 Subject: $tpl_subject
 In-Reply-To: $tpl_in_reply_to
@@ -888,73 +863,65 @@ EOT3
                do_edit($compose_filename);
        }
 
+       open my $c2, ">", $compose_filename . ".final"
+               or die sprintf(__("Failed to open %s.final: %s"), $compose_filename, $!);
+
        open $c, "<", $compose_filename
                or die sprintf(__("Failed to open %s: %s"), $compose_filename, $!);
 
+       my $need_8bit_cte = file_has_nonascii($compose_filename);
+       my $in_body = 0;
+       my $summary_empty = 1;
        if (!defined $compose_encoding) {
                $compose_encoding = "UTF-8";
        }
-
-       my %parsed_email;
-       while (my $line = <$c>) {
-               next if $line =~ m/^GIT:/;
-               parse_header_line($line, \%parsed_email);
-               if ($line =~ /^$/) {
-                       $parsed_email{'body'} = filter_body($c);
+       while(<$c>) {
+               next if m/^GIT:/;
+               if ($in_body) {
+                       $summary_empty = 0 unless (/^\n$/);
+               } elsif (/^\n$/) {
+                       $in_body = 1;
+                       if ($need_8bit_cte) {
+                               print $c2 "MIME-Version: 1.0\n",
+                                        "Content-Type: text/plain; ",
+                                          "charset=$compose_encoding\n",
+                                        "Content-Transfer-Encoding: 8bit\n";
+                       }
+               } elsif (/^MIME-Version:/i) {
+                       $need_8bit_cte = 0;
+               } elsif (/^Subject:\s*(.+)\s*$/i) {
+                       $initial_subject = $1;
+                       my $subject = $initial_subject;
+                       $_ = "Subject: " .
+                               quote_subject($subject, $compose_encoding) .
+                               "\n";
+               } elsif (/^In-Reply-To:\s*(.+)\s*$/i) {
+                       $initial_in_reply_to = $1;
+                       next;
+               } elsif (/^Reply-To:\s*(.+)\s*$/i) {
+                       $reply_to = $1;
+               } elsif (/^From:\s*(.+)\s*$/i) {
+                       $sender = $1;
+                       next;
+               } elsif (/^To:\s*(.+)\s*$/i) {
+                       @initial_to = parse_address_line($1);
+                       next;
+               } elsif (/^Cc:\s*(.+)\s*$/i) {
+                       @initial_cc = parse_address_line($1);
+                       next;
+               } elsif (/^Bcc:/i) {
+                       @initial_bcc = parse_address_line($1);
+                       next;
                }
+               print $c2 $_;
        }
        close $c;
+       close $c2;
 
-       open my $c2, ">", $compose_filename . ".final"
-       or die sprintf(__("Failed to open %s.final: %s"), $compose_filename, $!);
-
-
-       if ($parsed_email{'From'}) {
-               $sender = delete($parsed_email{'From'});
-       }
-       if ($parsed_email{'In-Reply-To'}) {
-               $initial_in_reply_to = delete($parsed_email{'In-Reply-To'});
-       }
-       if ($parsed_email{'Reply-To'}) {
-               $reply_to = delete($parsed_email{'Reply-To'});
-       }
-       if ($parsed_email{'Subject'}) {
-               $initial_subject = delete($parsed_email{'Subject'});
-               print $c2 "Subject: " .
-                       quote_subject($initial_subject, $compose_encoding) .
-                       "\n";
-       }
-
-       if ($parsed_email{'MIME-Version'}) {
-               print $c2 "MIME-Version: $parsed_email{'MIME-Version'}\n",
-                               "Content-Type: $parsed_email{'Content-Type'};\n",
-                               "Content-Transfer-Encoding: $parsed_email{'Content-Transfer-Encoding'}\n";
-               delete($parsed_email{'MIME-Version'});
-               delete($parsed_email{'Content-Type'});
-               delete($parsed_email{'Content-Transfer-Encoding'});
-       } elsif (file_has_nonascii($compose_filename)) {
-               my $content_type = (delete($parsed_email{'Content-Type'}) or
-                       "text/plain; charset=$compose_encoding");
-               print $c2 "MIME-Version: 1.0\n",
-                       "Content-Type: $content_type\n",
-                       "Content-Transfer-Encoding: 8bit\n";
-       }
-       # Preserve unknown headers
-       foreach my $key (keys %parsed_email) {
-               next if $key eq 'body';
-               print $c2 "$key: $parsed_email{$key}";
-       }
-
-       if ($parsed_email{'body'}) {
-               print $c2 "\n$parsed_email{'body'}\n";
-               delete($parsed_email{'body'});
-       } else {
+       if ($summary_empty) {
                print __("Summary email is empty, skipping it\n");
                $compose = -1;
        }
-
-       close $c2;
-
 } elsif ($annotate) {
        do_edit(@files);
 }
@@ -1009,32 +976,6 @@ sub ask {
        return;
 }
 
-sub parse_header_line {
-       my $lines = shift;
-       my $parsed_line = shift;
-       my $addr_pat = join "|", qw(To Cc Bcc);
-
-       foreach (split(/\n/, $lines)) {
-               if (/^($addr_pat):\s*(.+)$/i) {
-                       $parsed_line->{$1} = [ parse_address_line($2) ];
-               } elsif (/^([^:]*):\s*(.+)\s*$/i) {
-                       $parsed_line->{$1} = $2;
-               }
-       }
-}
-
-sub filter_body {
-       my $c = shift;
-       my $body = "";
-       while (my $body_line = <$c>) {
-               if ($body_line !~ m/^GIT:/) {
-                       $body .= $body_line;
-               }
-       }
-       return $body;
-}
-
-
 my %broken_encoding;
 
 sub file_declares_8bit_cte {
@@ -1166,10 +1107,10 @@ sub extract_valid_address {
 
 sub extract_valid_address_or_die {
        my $address = shift;
-       $address = extract_valid_address($address);
+       my $valid_address = extract_valid_address($address);
        die sprintf(__("error: unable to extract a valid address from: %s\n"), $address)
-               if !$address;
-       return $address;
+               if !$valid_address;
+       return $valid_address;
 }
 
 sub validate_address {
@@ -1754,10 +1695,6 @@ EOF
        return 1;
 }
 
-$in_reply_to = $initial_in_reply_to;
-$references = $initial_in_reply_to || '';
-$message_num = 0;
-
 sub pre_process_file {
        my ($t, $quiet) = @_;
 
@@ -2023,6 +1960,38 @@ sub process_file {
        return 1;
 }
 
+sub initialize_modified_loop_vars {
+       $in_reply_to = $initial_in_reply_to;
+       $references = $initial_in_reply_to || '';
+       $message_num = 0;
+}
+
+if ($validate) {
+       # FIFOs can only be read once, exclude them from validation.
+       my @real_files = ();
+       foreach my $f (@files) {
+               unless (-p $f) {
+                       push(@real_files, $f);
+               }
+       }
+
+       # Run the loop once again to avoid gaps in the counter due to FIFO
+       # arguments provided by the user.
+       my $num = 1;
+       my $num_files = scalar @real_files;
+       $ENV{GIT_SENDEMAIL_FILE_TOTAL} = "$num_files";
+       initialize_modified_loop_vars();
+       foreach my $r (@real_files) {
+               $ENV{GIT_SENDEMAIL_FILE_COUNTER} = "$num";
+               pre_process_file($r, 1);
+               validate_patch($r, $target_xfer_encoding);
+               $num += 1;
+       }
+       delete $ENV{GIT_SENDEMAIL_FILE_COUNTER};
+       delete $ENV{GIT_SENDEMAIL_FILE_TOTAL};
+}
+
+initialize_modified_loop_vars();
 foreach my $t (@files) {
        while (!process_file($t)) {
                # user edited the file
index be987e316f92acda1ff83c880ead3c6848db487c..b0d0a50984bcea740f9486deda974aa3e53cbe1c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
 # License: GPL v2 or later
-use 5.008;
+use 5.008001;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use strict;
 use vars qw/   $AUTHOR $VERSION
@@ -297,28 +297,12 @@ my %cmd = (
                {} ],
 );
 
-package FakeTerm;
-sub new {
-       my ($class, $reason) = @_;
-       return bless \$reason, shift;
-}
-sub readline {
-       my $self = shift;
-       die "Cannot use readline on FakeTerm: $$self";
-}
-package main;
-
 my $term;
 sub term_init {
-       $term = eval {
-               require Term::ReadLine;
-               $ENV{"GIT_SVN_NOTTY"}
+       require Term::ReadLine;
+       $term = $ENV{"GIT_SVN_NOTTY"}
                        ? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
                        : new Term::ReadLine 'git-svn';
-       };
-       if ($@) {
-               $term = new FakeTerm "$@: going non-interactive";
-       }
 }
 
 my $cmd;
diff --git a/git.c b/git.c
index c67e44dd82d2e4fc01fb841c8f863282607f6ac7..654d615a18845185e2ece17a7ca6229cea431a07 100644 (file)
--- a/git.c
+++ b/git.c
@@ -4,6 +4,7 @@
 #include "exec-cmd.h"
 #include "gettext.h"
 #include "help.h"
+#include "object-file.h"
 #include "pager.h"
 #include "read-cache-ll.h"
 #include "run-command.h"
@@ -186,6 +187,11 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                        use_pager = 0;
                        if (envchanged)
                                *envchanged = 1;
+               } else if (!strcmp(cmd, "--no-lazy-fetch")) {
+                       fetch_if_missing = 0;
+                       setenv(NO_LAZY_FETCH_ENVIRONMENT, "1", 1);
+                       if (envchanged)
+                               *envchanged = 1;
                } else if (!strcmp(cmd, "--no-replace-objects")) {
                        disable_replace_refs();
                        setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);
@@ -373,8 +379,6 @@ static int handle_alias(int *argcp, const char ***argv)
                        strvec_pushv(&child.args, (*argv) + 1);
 
                        trace2_cmd_alias(alias_command, child.args.v);
-                       trace2_cmd_list_config();
-                       trace2_cmd_list_env_vars();
                        trace2_cmd_name("_run_shell_alias_");
 
                        ret = run_command(&child);
@@ -411,8 +415,6 @@ static int handle_alias(int *argcp, const char ***argv)
                COPY_ARRAY(new_argv + count, *argv + 1, *argcp);
 
                trace2_cmd_alias(alias_command, new_argv);
-               trace2_cmd_list_config();
-               trace2_cmd_list_env_vars();
 
                *argv = new_argv;
                *argcp += count - 1;
@@ -462,8 +464,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 
        trace_argv_printf(argv, "trace: built-in: git");
        trace2_cmd_name(p->cmd);
-       trace2_cmd_list_config();
-       trace2_cmd_list_env_vars();
 
        validate_cache_entries(the_repository->index);
        status = p->fn(argc, argv, prefix);
@@ -594,6 +594,7 @@ static struct cmd_struct commands[] = {
        { "remote-fd", cmd_remote_fd, NO_PARSEOPT },
        { "repack", cmd_repack, RUN_SETUP },
        { "replace", cmd_replace, RUN_SETUP },
+       { "replay", cmd_replay, RUN_SETUP },
        { "rerere", cmd_rerere, RUN_SETUP },
        { "reset", cmd_reset, RUN_SETUP },
        { "restore", cmd_restore, RUN_SETUP | NEED_WORK_TREE },
index df3ba2ea99b310c3cdcd5c7a8938eef498b3e92e..7a087f123d7563d27a88751f70ead6172441af20 100755 (executable)
@@ -11956,7 +11956,7 @@ proc formatdate {d} {
 }
 
 # This list of encoding names and aliases is distilled from
-# http://www.iana.org/assignments/character-sets.
+# https://www.iana.org/assignments/character-sets.
 # Not all of them are supported by Tcl.
 set encoding_aliases {
     { ANSI_X3.4-1968 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII
@@ -12472,7 +12472,7 @@ if {[tk windowingsystem] eq "aqua"} {
 
 catch {
     # follow the XDG base directory specification by default. See
-    # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+    # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
     if {[info exists env(XDG_CONFIG_HOME)] && $env(XDG_CONFIG_HOME) ne ""} {
         # XDG_CONFIG_HOME environment variable is set
         set config_file [file join $env(XDG_CONFIG_HOME) git gitk]
index a58e6b3c44b0ef6175df1417a3ed6f7775bd9953..5bfa4968c4a43193c009045dbd6a6f187a319c76 100644 (file)
@@ -29,7 +29,7 @@ Requirements
 ------------
 
  - Core git tools
- - Perl 5.8
+ - Perl 5.8.1
  - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.
  - web server
 
@@ -203,7 +203,7 @@ You can specify the following configuration variables when building GIT:
    created.  [Default: /etc/gitweb.conf]
  * HIGHLIGHT_BIN
    Path to the highlight executable to use (must be the one from
-   http://www.andre-simon.de due to assumptions about parameters and output).
+   http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
    Useful if highlight is not installed on your webserver's PATH.
    [Default: highlight]
 
index e66eb3d9bad7cf627d5ed35e13e32dafb556d5cd..ccd14e0e30c14ef1da31d09cf6949e70b75cf5e0 100755 (executable)
@@ -7,7 +7,7 @@
 #
 # This program is licensed under the GPLv2
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 # handle ACL in file access tests
@@ -122,9 +122,9 @@ our $favicon = "++GITWEB_FAVICON++";
 our $javascript = "++GITWEB_JS++";
 
 # URI and label (title) of GIT logo link
-#our $logo_url = "http://www.kernel.org/pub/software/scm/git/docs/";
+#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
 #our $logo_label = "git documentation";
-our $logo_url = "http://git-scm.com/";
+our $logo_url = "https://git-scm.com/";
 our $logo_label = "git homepage";
 
 # source of projects list
@@ -197,7 +197,7 @@ our @diff_opts = ('-M'); # taken from git_commit
 our $prevent_xss = 0;
 
 # Path to the highlight executable to use (must be the one from
-# http://www.andre-simon.de due to assumptions about parameters and output).
+# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
 # Useful if highlight is not installed on your webserver's PATH.
 # [Default: highlight]
 our $highlight_bin = "++HIGHLIGHT_BIN++";
@@ -269,7 +269,7 @@ our %avatar_size = (
 # Leave it undefined (or set to 'undef') to turn off load checking.
 our $maxload = 300;
 
-# configuration for 'highlight' (http://www.andre-simon.de/)
+# configuration for 'highlight' (http://andre-simon.de/doku/highlight/en/highlight.php)
 # match by basename
 our %highlight_basename = (
        #'Program' => 'py',
@@ -728,9 +728,11 @@ our $per_request_config = 1;
 sub read_config_file {
        my $filename = shift;
        return unless defined $filename;
-       # die if there are errors parsing config file
        if (-e $filename) {
                do $filename;
+               # die if there is a problem accessing the file
+               die $! if $!;
+               # die if there are errors parsing config file
                die $@ if $@;
                return 1;
        }
@@ -8193,7 +8195,7 @@ sub git_feed {
        my $have_blame = gitweb_check_feature('blame');
 
        # Atom: http://www.atomenabled.org/developers/syndication/
-       # RSS:  http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
+       # RSS:  https://web.archive.org/web/20030729001534/http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
        if ($format ne 'rss' && $format ne 'atom') {
                die_error(400, "Unknown web feed format");
        }
index 3212601032622fef063f06066bd7131061de36d9..48d2e5101542ad96dcac78aace13d3bbee40d303 100644 (file)
@@ -667,7 +667,7 @@ div.remote {
 }
 
 
-/* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */
+/* Style definition generated by highlight 2.4.5, http://andre-simon.de/doku/highlight/en/highlight.php */
 
 /* Highlighting theme definition: */
 
index 018bbb7d4cb72eeb786c3309ba318e7789a02b37..99e3eb8c3d97ae8705ff8e656512479d9f84a90e 100644 (file)
@@ -123,8 +123,8 @@ function addCssRule(selector, style) {
  * NOTE that there are limits and differences compared to native
  * getElementsByClassName as defined by e.g.:
  *   https://developer.mozilla.org/en/DOM/document.getElementsByClassName
- *   http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-getelementsbyclassname
- *   http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-getelementsbyclassname
+ *   https://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-getelementsbyclassname
+ *   https://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-getelementsbyclassname
  *
  * Namely, this implementation supports only single class name as
  * argument and not set of space-separated tokens representing classes,
@@ -133,11 +133,11 @@ function addCssRule(selector, style) {
  * (via getElementsByTagName).
  *
  * Based on
- *   http://code.google.com/p/getelementsbyclassname/
+ *   https://code.google.com/p/getelementsbyclassname/
  *   http://www.dustindiaz.com/getelementsbyclass/
- *   http://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
+ *   https://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
  *
- * See also http://ejohn.org/blog/getelementsbyclassname-speed-comparison/
+ * See also https://johnresig.com/blog/getelementsbyclassname-speed-comparison/
  *
  * @param {String} class: name of _single_ class to find
  * @param {String} [taghint] limit search to given tags
index 48f43c5a21d34569bdc966eefd652da38003d157..95e764acb14b3e069a255a8261a7d724c5f8d1ad 100644 (file)
@@ -12,7 +12,6 @@
 #include "sigchain.h"
 #include "tempfile.h"
 #include "alias.h"
-#include "environment.h"
 
 static int git_gpg_config(const char *, const char *,
                          const struct config_context *, void *);
@@ -762,23 +761,14 @@ static int git_gpg_config(const char *var, const char *value,
                return 0;
        }
 
-       if (!strcmp(var, "gpg.ssh.defaultkeycommand")) {
-               if (!value)
-                       return config_error_nonbool(var);
+       if (!strcmp(var, "gpg.ssh.defaultkeycommand"))
                return git_config_string(&ssh_default_key_command, var, value);
-       }
 
-       if (!strcmp(var, "gpg.ssh.allowedsignersfile")) {
-               if (!value)
-                       return config_error_nonbool(var);
+       if (!strcmp(var, "gpg.ssh.allowedsignersfile"))
                return git_config_pathname(&ssh_allowed_signers, var, value);
-       }
 
-       if (!strcmp(var, "gpg.ssh.revocationfile")) {
-               if (!value)
-                       return config_error_nonbool(var);
+       if (!strcmp(var, "gpg.ssh.revocationfile"))
                return git_config_pathname(&ssh_revocation_file, var, value);
-       }
 
        if (!strcmp(var, "gpg.program") || !strcmp(var, "gpg.openpgp.program"))
                fmtname = "openpgp";
@@ -1088,7 +1078,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
                if (strstr(signer_stderr.buf, "usage:"))
                        error(_("ssh-keygen -Y sign is needed for ssh signing (available in openssh version 8.2p1+)"));
 
-               error("%s", signer_stderr.buf);
+               ret = error("%s", signer_stderr.buf);
                goto out;
        }
 
index 143cdc1c02d4b31fa08f92fbcae1691c80d2c2d6..7cd98161f7f21b5946daa6834617d4876745119f 100644 (file)
@@ -66,7 +66,7 @@ size_t parse_signed_buffer(const char *buf, size_t size);
  * Create a detached signature for the contents of "buffer" and append
  * it after "signature"; "buffer" and "signature" can be the same
  * strbuf instance, which would cause the detached signature appended
- * at the end.
+ * at the end.  Returns 0 on success, non-zero on failure.
  */
 int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
                const char *signing_key);
diff --git a/graph.c b/graph.c
index 2a9dc430fae105c8d6fb5a8763320ae40fb1e5c8..1ca34770ee8139f25e0a2476c5aa3cd8b06fb89c 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -339,7 +339,6 @@ void graph_setup_line_prefix(struct diff_options *diffopt)
                diffopt->output_prefix = diff_output_prefix_callback;
 }
 
-
 struct git_graph *graph_init(struct rev_info *opt)
 {
        struct git_graph *graph = xmalloc(sizeof(struct git_graph));
diff --git a/graph.h b/graph.h
index e88632a0140f70ef25535e23120c898c007b8349..3fd1dcb2e94d4399fc40406f9ec71b319cda0d5f 100644 (file)
--- a/graph.h
+++ b/graph.h
@@ -130,7 +130,7 @@ void graph_setup_line_prefix(struct diff_options *diffopt);
  * This functions must be called BEFORE graph_init() is called.
  *
  * NOTE: This function isn't used in Git outside graph.c but it is used
- * by CGit (http://git.zx2c4.com/cgit/) to use HTML for colors.
+ * by CGit (https://git.zx2c4.com/cgit/) to use HTML for colors.
  */
 void graph_set_column_colors(const char **colors, unsigned short colors_max);
 
@@ -196,7 +196,7 @@ int graph_is_commit_finished(struct git_graph const *graph);
  * graph_update() is called.
  *
  * NOTE: This function isn't used in Git outside graph.c but it is used
- * by CGit (http://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
+ * by CGit (https://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
  */
 int graph_next_line(struct git_graph *graph, struct strbuf *sb);
 
diff --git a/grep.c b/grep.c
index 0904d55b244fb6f0e1b859cdd87be330c606d9e7..5f23d1a50cabb35732f9515355fe0a85a33d2ff8 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -9,7 +9,6 @@
 #include "xdiff-interface.h"
 #include "diff.h"
 #include "diffcore.h"
-#include "commit.h"
 #include "quote.h"
 #include "help.h"
 
@@ -17,7 +16,7 @@ static int grep_source_load(struct grep_source *gs);
 static int grep_source_is_binary(struct grep_source *gs,
                                 struct index_state *istate);
 
-static void std_output(struct grep_opt *opt, const void *buf, size_t size)
+static void std_output(struct grep_opt *opt UNUSED, const void *buf, size_t size)
 {
        fwrite(buf, size, 1, stdout);
 }
@@ -452,18 +451,20 @@ static void free_pcre2_pattern(struct grep_pat *p)
        pcre2_general_context_free(p->pcre2_general_context);
 }
 #else /* !USE_LIBPCRE2 */
-static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt)
+static void compile_pcre2_pattern(struct grep_pat *p UNUSED,
+                                 const struct grep_opt *opt UNUSED)
 {
        die("cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE");
 }
 
-static int pcre2match(struct grep_pat *p, const char *line, const char *eol,
-               regmatch_t *match, int eflags)
+static int pcre2match(struct grep_pat *p UNUSED, const char *line UNUSED,
+                     const char *eol UNUSED, regmatch_t *match UNUSED,
+                     int eflags UNUSED)
 {
        return 1;
 }
 
-static void free_pcre2_pattern(struct grep_pat *p)
+static void free_pcre2_pattern(struct grep_pat *p UNUSED)
 {
 }
 
diff --git a/help.c b/help.c
index 6d2ebfbd2a45f134bc45c039cb4cf26b402b8f6c..2dbe57b413b2a8f2e8262fb2c022711aa2d60a2a 100644 (file)
--- a/help.c
+++ b/help.c
@@ -464,8 +464,11 @@ static int get_alias(const char *var, const char *value,
 {
        struct string_list *list = data;
 
-       if (skip_prefix(var, "alias.", &var))
+       if (skip_prefix(var, "alias.", &var)) {
+               if (!value)
+                       return config_error_nonbool(var);
                string_list_append(list, var)->util = xstrdup(value);
+       }
 
        return 0;
 }
diff --git a/hex-ll.c b/hex-ll.c
new file mode 100644 (file)
index 0000000..4d7ece1
--- /dev/null
+++ b/hex-ll.c
@@ -0,0 +1,49 @@
+#include "git-compat-util.h"
+#include "hex-ll.h"
+
+const signed char hexval_table[256] = {
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 00-07 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 08-0f */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 10-17 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 18-1f */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 20-27 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 28-2f */
+         0,  1,  2,  3,  4,  5,  6,  7,                /* 30-37 */
+         8,  9, -1, -1, -1, -1, -1, -1,                /* 38-3f */
+        -1, 10, 11, 12, 13, 14, 15, -1,                /* 40-47 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 48-4f */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 50-57 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 58-5f */
+        -1, 10, 11, 12, 13, 14, 15, -1,                /* 60-67 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 68-67 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 70-77 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 78-7f */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 80-87 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 88-8f */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 90-97 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* 98-9f */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* a0-a7 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* a8-af */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* b0-b7 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* b8-bf */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* c0-c7 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* c8-cf */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* d0-d7 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* d8-df */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* e0-e7 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* e8-ef */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* f0-f7 */
+        -1, -1, -1, -1, -1, -1, -1, -1,                /* f8-ff */
+};
+
+int hex_to_bytes(unsigned char *binary, const char *hex, size_t len)
+{
+       for (; len; len--, hex += 2) {
+               unsigned int val = (hexval(hex[0]) << 4) | hexval(hex[1]);
+
+               if (val & ~0xff)
+                       return -1;
+               *binary++ = val;
+       }
+       return 0;
+}
diff --git a/hex-ll.h b/hex-ll.h
new file mode 100644 (file)
index 0000000..a381fa8
--- /dev/null
+++ b/hex-ll.h
@@ -0,0 +1,27 @@
+#ifndef HEX_LL_H
+#define HEX_LL_H
+
+extern const signed char hexval_table[256];
+static inline unsigned int hexval(unsigned char c)
+{
+       return hexval_table[c];
+}
+
+/*
+ * Convert two consecutive hexadecimal digits into a char.  Return a
+ * negative value on error.  Don't run over the end of short strings.
+ */
+static inline int hex2chr(const char *s)
+{
+       unsigned int val = hexval(s[0]);
+       return (val & ~0xf) ? val : (val << 4) | hexval(s[1]);
+}
+
+/*
+ * Read `len` pairs of hexadecimal digits from `hex` and write the
+ * values to `binary` as `len` bytes. Return 0 on success, or -1 if
+ * the input does not consist of hex digits).
+ */
+int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
+
+#endif
diff --git a/hex.c b/hex.c
index 01f17fe5c906e6f8dd225b7c07bfb725a54a48a8..d42262bdca71a8703ce191393f0217f0c589a75e 100644 (file)
--- a/hex.c
+++ b/hex.c
@@ -2,53 +2,6 @@
 #include "hash.h"
 #include "hex.h"
 
-const signed char hexval_table[256] = {
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 00-07 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 08-0f */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 10-17 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 18-1f */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 20-27 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 28-2f */
-         0,  1,  2,  3,  4,  5,  6,  7,                /* 30-37 */
-         8,  9, -1, -1, -1, -1, -1, -1,                /* 38-3f */
-        -1, 10, 11, 12, 13, 14, 15, -1,                /* 40-47 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 48-4f */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 50-57 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 58-5f */
-        -1, 10, 11, 12, 13, 14, 15, -1,                /* 60-67 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 68-67 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 70-77 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 78-7f */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 80-87 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 88-8f */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 90-97 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* 98-9f */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* a0-a7 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* a8-af */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* b0-b7 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* b8-bf */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* c0-c7 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* c8-cf */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* d0-d7 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* d8-df */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* e0-e7 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* e8-ef */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* f0-f7 */
-        -1, -1, -1, -1, -1, -1, -1, -1,                /* f8-ff */
-};
-
-int hex_to_bytes(unsigned char *binary, const char *hex, size_t len)
-{
-       for (; len; len--, hex += 2) {
-               unsigned int val = (hexval(hex[0]) << 4) | hexval(hex[1]);
-
-               if (val & ~0xff)
-                       return -1;
-               *binary++ = val;
-       }
-       return 0;
-}
-
 static int get_hash_hex_algop(const char *hex, unsigned char *hash,
                              const struct git_hash_algo *algop)
 {
diff --git a/hex.h b/hex.h
index 87abf6660214151a50f45197572b6749c10944cc..e0b83f776f1a8cc62ab1694be4faf579051396b4 100644 (file)
--- a/hex.h
+++ b/hex.h
@@ -2,22 +2,7 @@
 #define HEX_H
 
 #include "hash-ll.h"
-
-extern const signed char hexval_table[256];
-static inline unsigned int hexval(unsigned char c)
-{
-       return hexval_table[c];
-}
-
-/*
- * Convert two consecutive hexadecimal digits into a char.  Return a
- * negative value on error.  Don't run over the end of short strings.
- */
-static inline int hex2chr(const char *s)
-{
-       unsigned int val = hexval(s[0]);
-       return (val & ~0xf) ? val : (val << 4) | hexval(s[1]);
-}
+#include "hex-ll.h"
 
 /*
  * Try to read a hash (specified by the_hash_algo) in hexadecimal
@@ -34,13 +19,6 @@ int get_oid_hex(const char *hex, struct object_id *oid);
 /* Like get_oid_hex, but for an arbitrary hash algorithm. */
 int get_oid_hex_algop(const char *hex, struct object_id *oid, const struct git_hash_algo *algop);
 
-/*
- * Read `len` pairs of hexadecimal digits from `hex` and write the
- * values to `binary` as `len` bytes. Return 0 on success, or -1 if
- * the input does not consist of hex digits).
- */
-int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
-
 /*
  * Convert a binary hash in "unsigned char []" or an object name in
  * "struct object_id *" to its hex equivalent. The `_r` variant is reentrant,
index ff07b87e6461446610c35708a39f22a5e5b36aff..1ed1e29d0706bfe51e2074cabe393e0ed6eba7c7 100644 (file)
@@ -38,6 +38,7 @@ struct rpc_service {
 static struct rpc_service rpc_service[] = {
        { "upload-pack", "uploadpack", 1, 1 },
        { "receive-pack", "receivepack", 0, -1 },
+       { "upload-archive", "uploadarchive", 0, -1 },
 };
 
 static struct string_list *get_parameters(void)
@@ -639,10 +640,15 @@ static void check_content_type(struct strbuf *hdr, const char *accepted_type)
 
 static void service_rpc(struct strbuf *hdr, char *service_name)
 {
-       const char *argv[] = {NULL, "--stateless-rpc", ".", NULL};
+       struct strvec argv = STRVEC_INIT;
        struct rpc_service *svc = select_service(hdr, service_name);
        struct strbuf buf = STRBUF_INIT;
 
+       strvec_push(&argv, svc->name);
+       if (strcmp(service_name, "git-upload-archive"))
+               strvec_push(&argv, "--stateless-rpc");
+       strvec_push(&argv, ".");
+
        strbuf_reset(&buf);
        strbuf_addf(&buf, "application/x-git-%s-request", svc->name);
        check_content_type(hdr, buf.buf);
@@ -655,9 +661,9 @@ static void service_rpc(struct strbuf *hdr, char *service_name)
 
        end_headers(hdr);
 
-       argv[0] = svc->name;
-       run_service(argv, svc->buffer_input);
+       run_service(argv.v, svc->buffer_input);
        strbuf_release(&buf);
+       strvec_clear(&argv);
 }
 
 static int dead;
@@ -723,6 +729,7 @@ static struct service_cmd {
        {"GET", "/objects/pack/pack-[0-9a-f]{64}\\.idx$", get_idx_file},
 
        {"POST", "/git-upload-pack$", service_rpc},
+       {"POST", "/git-upload-archive$", service_rpc},
        {"POST", "/git-receive-pack$", service_rpc}
 };
 
index fffda592670e667e81eb92af218f9a4d95d7614d..bec94988bbe563a5048c6dd5905f1a9827193489 100644 (file)
@@ -1,12 +1,12 @@
 #include "git-compat-util.h"
 #include "config.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "hex.h"
 #include "http.h"
 #include "walker.h"
 #include "setup.h"
 #include "strvec.h"
+#include "url.h"
 #include "urlmatch.h"
 #include "trace2.h"
 
index 81c35b5e96f7e97980575e0fcab7129318ddc04a..1fe51226fd28a84fefe621cd2cf0a593afa1105f 100644 (file)
@@ -6,10 +6,8 @@
 #include "tag.h"
 #include "blob.h"
 #include "http.h"
-#include "refs.h"
 #include "diff.h"
 #include "revision.h"
-#include "exec-cmd.h"
 #include "remote.h"
 #include "list-objects.h"
 #include "setup.h"
@@ -17,6 +15,7 @@
 #include "strvec.h"
 #include "tree.h"
 #include "tree-walk.h"
+#include "url.h"
 #include "packfile.h"
 #include "object-store-ll.h"
 #include "commit-reach.h"
@@ -1576,8 +1575,11 @@ static int verify_merge_base(struct object_id *head_oid, struct ref *remote)
        struct commit *head = lookup_commit_or_die(head_oid, "HEAD");
        struct commit *branch = lookup_commit_or_die(&remote->old_oid,
                                                     remote->name);
+       int ret = repo_in_merge_bases(the_repository, branch, head);
 
-       return repo_in_merge_bases(the_repository, branch, head);
+       if (ret < 0)
+               exit(128);
+       return ret;
 }
 
 static int delete_remote_branch(const char *pattern, int force)
@@ -1852,6 +1854,7 @@ int cmd_main(int argc, const char **argv)
 
                if (oideq(&ref->old_oid, &ref->peer_ref->new_oid)) {
                        if (push_verbosely)
+                               /* stable plumbing output; do not modify or localize */
                                fprintf(stderr, "'%s': up-to-date\n", ref->name);
                        if (helper_status)
                                printf("ok %s up to date\n", ref->name);
@@ -1872,6 +1875,7 @@ int cmd_main(int argc, const char **argv)
                                 * commits at the remote end and likely
                                 * we were not up to date to begin with.
                                 */
+                               /* stable plumbing output; do not modify or localize */
                                error("remote '%s' is not an ancestor of\n"
                                      "local '%s'.\n"
                                      "Maybe you are not up-to-date and "
index 78d99f7c4b002cb95196800a62a1de8fbcce6cea..b395ef13279eaa3f672e36512a7816fee209abf9 100644 (file)
@@ -1,6 +1,5 @@
 #include "git-compat-util.h"
 #include "repository.h"
-#include "commit.h"
 #include "hex.h"
 #include "walker.h"
 #include "http.h"
diff --git a/http.c b/http.c
index e138b4b96fb9e201623339eada35f9499b5ba371..e73b136e5897bd8fce2f874b20f316141ba59c31 100644 (file)
--- a/http.c
+++ b/http.c
@@ -4,7 +4,6 @@
 #include "http.h"
 #include "config.h"
 #include "pack.h"
-#include "sideband.h"
 #include "run-command.h"
 #include "url.h"
 #include "urlmatch.h"
@@ -15,7 +14,6 @@
 #include "trace.h"
 #include "transport.h"
 #include "packfile.h"
-#include "protocol.h"
 #include "string-list.h"
 #include "object-file.h"
 #include "object-store-ll.h"
@@ -738,18 +736,43 @@ static int redact_sensitive_header(struct strbuf *header, size_t offset)
        return ret;
 }
 
+static int match_curl_h2_trace(const char *line, const char **out)
+{
+       const char *p;
+
+       /*
+        * curl prior to 8.1.0 gives us:
+        *
+        *     h2h3 [<header-name>: <header-val>]
+        *
+        * Starting in 8.1.0, the first token became just "h2".
+        */
+       if (skip_iprefix(line, "h2h3 [", out) ||
+           skip_iprefix(line, "h2 [", out))
+               return 1;
+
+       /*
+        * curl 8.3.0 uses:
+        *   [HTTP/2] [<stream-id>] [<header-name>: <header-val>]
+        * where <stream-id> is numeric.
+        */
+       if (skip_iprefix(line, "[HTTP/2] [", &p)) {
+               while (isdigit(*p))
+                       p++;
+               if (skip_prefix(p, "] [", out))
+                       return 1;
+       }
+
+       return 0;
+}
+
 /* Redact headers in info */
 static void redact_sensitive_info_header(struct strbuf *header)
 {
        const char *sensitive_header;
 
-       /*
-        * curl's h2h3 prints headers in info, e.g.:
-        *   h2h3 [<header-name>: <header-val>]
-        */
        if (trace_curl_redact &&
-           (skip_iprefix(header->buf, "h2h3 [", &sensitive_header) ||
-            skip_iprefix(header->buf, "h2 [", &sensitive_header))) {
+           match_curl_h2_trace(header->buf, &sensitive_header)) {
                if (redact_sensitive_header(header, sensitive_header - header->buf)) {
                        /* redaction ate our closing bracket */
                        strbuf_addch(header, ']');
@@ -1877,7 +1900,7 @@ static void write_accept_language(struct strbuf *buf)
         * MAX_DECIMAL_PLACES must not be larger than 3. If it is larger than
         * that, q-value will be smaller than 0.001, the minimum q-value the
         * HTTP specification allows. See
-        * http://tools.ietf.org/html/rfc7231#section-5.3.1 for q-value.
+        * https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.1 for q-value.
         */
        const int MAX_DECIMAL_PLACES = 3;
        const int MAX_LANGUAGE_TAGS = 1000;
diff --git a/http.h b/http.h
index 3a409bccd4e6197874a97629c36b050ca923b944..3af19a8bf53e0550fa7c877bb661c34463283adf 100644 (file)
--- a/http.h
+++ b/http.h
@@ -10,7 +10,6 @@ struct packed_git;
 
 #include "strbuf.h"
 #include "remote.h"
-#include "url.h"
 
 #define DEFAULT_MAX_REQUESTS 5
 
index 06386e0b3bd878b163624f49e953686d4d49f8d1..f2e1947e63815c80e45f648f0ce37cd6341f825b 100644 (file)
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *  along with this program; if not, see <https://www.gnu.org/licenses/>.
  */
 
 #include "git-compat-util.h"
 #include "config.h"
 #include "credential.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "run-command.h"
 #include "parse-options.h"
@@ -206,10 +205,14 @@ static void socket_perror(const char *func, struct imap_socket *sock, int ret)
                else
                        fprintf(stderr, "%s: unexpected EOF\n", func);
        }
+       /* mark as used to appease -Wunused-parameter with NO_OPENSSL */
+       (void)sock;
 }
 
 #ifdef NO_OPENSSL
-static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int verify)
+static int ssl_socket_connect(struct imap_socket *sock UNUSED,
+                             int use_tls_only UNUSED,
+                             int verify UNUSED)
 {
        fprintf(stderr, "SSL requested but SSL support not compiled in\n");
        return -1;
@@ -856,7 +859,7 @@ static void imap_close_store(struct imap_store *ctx)
 
 /*
  * hexchar() and cram() functions are based on the code from the isync
- * project (http://isync.sf.net/).
+ * project (https://isync.sourceforge.io/).
  */
 static char hexchar(unsigned int b)
 {
@@ -904,7 +907,9 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)
 
 #else
 
-static char *cram(const char *challenge_64, const char *user, const char *pass)
+static char *cram(const char *challenge_64 UNUSED,
+                 const char *user UNUSED,
+                 const char *pass UNUSED)
 {
        die("If you want to use CRAM-MD5 authenticate method, "
            "you have to build git-imap-send with OpenSSL library.");
@@ -1340,7 +1345,7 @@ static int git_imap_config(const char *var, const char *val,
                server.port = git_config_int(var, val, ctx->kvi);
        else if (!strcmp("imap.host", var)) {
                if (!val) {
-                       git_die_config("imap.host", "Missing value for 'imap.host'");
+                       return config_error_nonbool(var);
                } else {
                        if (starts_with(val, "imap:"))
                                val += 5;
index 209355e0f12ce296c120b5e5b9f1651a2daf311f..04413bd1afda5d6693d5dfec2e96645557e1bb45 100644 (file)
@@ -3,8 +3,8 @@
 
 /*
  * JSON data structures are defined at:
- * [1] http://www.ietf.org/rfc/rfc7159.txt
- * [2] http://json.org/
+ * [1] https://www.ietf.org/rfc/rfc7159.txt
+ * [2] https://www.json.org/
  *
  * The JSON-writer API allows one to build JSON data structures using a
  * simple wrapper around a "struct strbuf" buffer.  It is intended as a
diff --git a/kwset.c b/kwset.c
index bbfcf815a567b053bd0206ddb7bb38d138731bd1..695e47b7ccfaf1aaa0e866933dffa8b7fcc51868 100644 (file)
--- a/kwset.c
+++ b/kwset.c
@@ -18,7 +18,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>. */
+   along with this program; if not, see <https://www.gnu.org/licenses/>. */
 
 /* Written August 1989 by Mike Haertel.
    The author may be reached (Email) at the address mike@ai.mit.edu,
diff --git a/kwset.h b/kwset.h
index d42a793a301cb6d7ba758a5d592516cdf9d8444f..c722664e5a7eeef9900a86738a5553b3eace49fc 100644 (file)
--- a/kwset.h
+++ b/kwset.h
@@ -20,7 +20,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>. */
+   along with this program; if not, see <https://www.gnu.org/licenses/>. */
 
 /* Written August 1989 by Mike Haertel.
    The author may be reached (Email) at the address mike@ai.mit.edu,
index 790ab732127d04df57b330f06b43785532fd68b9..8ff6ccb77241fd249f58827ecc1add65356648a4 100644 (file)
@@ -1,8 +1,8 @@
 #include "git-compat-util.h"
+#include "diffcore.h"
 #include "line-range.h"
 #include "hex.h"
 #include "tag.h"
-#include "blob.h"
 #include "tree.h"
 #include "diff.h"
 #include "commit.h"
@@ -12,8 +12,6 @@
 #include "xdiff-interface.h"
 #include "strbuf.h"
 #include "log-tree.h"
-#include "graph.h"
-#include "userdiff.h"
 #include "line-log.h"
 #include "setup.h"
 #include "strvec.h"
@@ -1327,3 +1325,13 @@ int line_log_filter(struct rev_info *rev)
 
        return 0;
 }
+
+static void free_void_line_log_data(void *data)
+{
+       free_line_log_data(data);
+}
+
+void line_log_free(struct rev_info *rev)
+{
+       clear_decoration(&rev->line_log_data, free_void_line_log_data);
+}
index adff361b1bc93905641341df88a7cfcbfb6c118d..e9dadbc1a58e2c657511b03f289994143b62bbfb 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef LINE_LOG_H
 #define LINE_LOG_H
 
-#include "diffcore.h"
-
 struct rev_info;
 struct commit;
 struct string_list;
@@ -60,4 +58,6 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev,
 
 int line_log_print(struct rev_info *rev, struct commit *commit);
 
+void line_log_free(struct rev_info *rev);
+
 #endif /* LINE_LOG_H */
index 47bf0d6f1a253a01baf6e3d0f68dfa5d5df6a0f0..60f0e5ada81967d3743ef866438aaf9b8efdc497 100644 (file)
@@ -1,7 +1,6 @@
 #include "git-compat-util.h"
 #include "line-range.h"
 #include "xdiff-interface.h"
-#include "strbuf.h"
 #include "userdiff.h"
 
 /*
index 8a08b7af49c1ff7750296508102bf67807027bea..c5f363ca6f729ace28756467470e56363fad7a1e 100644 (file)
@@ -1,11 +1,6 @@
 #include "git-compat-util.h"
-#include "commit.h"
 #include "config.h"
 #include "gettext.h"
-#include "revision.h"
-#include "strvec.h"
-#include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "promisor-remote.h"
 #include "trace.h"
index 9327ccd5057cb6fffc9fcd9a92f2939a50b50253..4346f8da4560fd518d73db7969faa9127e302090 100644 (file)
@@ -2,14 +2,9 @@
 #include "dir.h"
 #include "gettext.h"
 #include "hex.h"
-#include "tag.h"
 #include "commit.h"
-#include "tree.h"
-#include "blob.h"
 #include "diff.h"
-#include "tree-walk.h"
 #include "revision.h"
-#include "list-objects.h"
 #include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "oidmap.h"
@@ -716,15 +711,6 @@ static void filter_combine__free(void *filter_data)
        free(d);
 }
 
-static void add_all(struct oidset *dest, struct oidset *src) {
-       struct oidset_iter iter;
-       struct object_id *src_oid;
-
-       oidset_iter_init(src, &iter);
-       while ((src_oid = oidset_iter_next(&iter)) != NULL)
-               oidset_insert(dest, src_oid);
-}
-
 static void filter_combine__finalize_omits(
        struct oidset *omits,
        void *filter_data)
@@ -733,7 +719,7 @@ static void filter_combine__finalize_omits(
        size_t sub;
 
        for (sub = 0; sub < d->nr; sub++) {
-               add_all(omits, &d->sub[sub].omits);
+               oidset_insert_from_set(omits, &d->sub[sub].omits);
                oidset_clear(&d->sub[sub].omits);
        }
 }
index 312335c8a7f240247059f9286c48ff79fb9e0f89..11ad8be411eeb29b3f1bb0fd798ab71e71791014 100644 (file)
@@ -14,6 +14,7 @@
 #include "packfile.h"
 #include "object-store-ll.h"
 #include "trace.h"
+#include "environment.h"
 
 struct traversal_context {
        struct rev_info *revs;
@@ -21,6 +22,7 @@ struct traversal_context {
        show_commit_fn show_commit;
        void *show_data;
        struct filter *filter;
+       int depth;
 };
 
 static void show_commit(struct traversal_context *ctx,
@@ -37,6 +39,9 @@ static void show_object(struct traversal_context *ctx,
 {
        if (!ctx->show_object)
                return;
+       if (ctx->revs->unpacked && has_object_pack(&object->oid))
+               return;
+
        ctx->show_object(object, name, ctx->show_data);
 }
 
@@ -118,7 +123,9 @@ static void process_tree_contents(struct traversal_context *ctx,
                                    entry.path, oid_to_hex(&tree->object.oid));
                        }
                        t->object.flags |= NOT_USER_GIVEN;
+                       ctx->depth++;
                        process_tree(ctx, t, base, entry.path);
+                       ctx->depth--;
                }
                else if (S_ISGITLINK(entry.mode))
                        ; /* ignore gitlink */
@@ -156,6 +163,9 @@ static void process_tree(struct traversal_context *ctx,
            !revs->include_check_obj(&tree->object, revs->include_check_data))
                return;
 
+       if (ctx->depth > max_allowed_tree_depth)
+               die("exceeded maximum allowed tree depth");
+
        failed_parse = parse_tree_gently(tree, 1);
        if (failed_parse) {
                if (revs->ignore_missing_links)
@@ -170,7 +180,7 @@ static void process_tree(struct traversal_context *ctx,
                    is_promisor_object(&obj->oid))
                        return;
 
-               if (!revs->do_not_die_on_missing_tree)
+               if (!revs->do_not_die_on_missing_objects)
                        die("bad tree object %s", oid_to_hex(&obj->oid));
        }
 
@@ -349,6 +359,7 @@ static void traverse_non_commits(struct traversal_context *ctx,
                if (!path)
                        path = "";
                if (obj->type == OBJ_TREE) {
+                       ctx->depth = 0;
                        process_tree(ctx, (struct tree *)obj, base, path);
                        continue;
                }
@@ -381,6 +392,9 @@ static void do_traverse(struct traversal_context *ctx)
                 */
                if (!ctx->revs->tree_objects)
                        ; /* do not bother loading tree */
+               else if (ctx->revs->do_not_die_on_missing_objects &&
+                        oidset_contains(&ctx->revs->missing_commits, &commit->object.oid))
+                       ;
                else if (repo_get_commit_tree(the_repository, commit)) {
                        struct tree *tree = repo_get_commit_tree(the_repository,
                                                                 commit);
diff --git a/list.h b/list.h
index 362a4cd7f5f10f17f174086911dc30e60e07e6ec..98428010f4d131580f8d3fa640efc6a10651a35b 100644 (file)
--- a/list.h
+++ b/list.h
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see
- * <http://www.gnu.org/licenses/>.
+ * <https://www.gnu.org/licenses/>.
  */
 
 #ifndef LIST_H
index 90af4e66b28c8f338cb62cf228a2b8d80000e8a8..1bb99264976d27095f348caf0fc35efe5598348b 100644 (file)
@@ -321,11 +321,11 @@ static inline int commit_lock_file_to(struct lock_file *lk, const char *path)
  * Roll back `lk`: close the file descriptor and/or file pointer and
  * remove the lockfile. It is a NOOP to call `rollback_lock_file()`
  * for a `lock_file` object that has already been committed or rolled
- * back.
+ * back. No error will be returned in this case.
  */
-static inline void rollback_lock_file(struct lock_file *lk)
+static inline int rollback_lock_file(struct lock_file *lk)
 {
-       delete_tempfile(&lk->tempfile);
+       return delete_tempfile(&lk->tempfile);
 }
 
 #endif /* LOCKFILE_H */
index 208c69cbb79021ad471467292572c5587b103a6d..e5438b029d90f352f0c434ebc8088c01fce11f3a 100644 (file)
@@ -2,6 +2,7 @@
 #include "commit-reach.h"
 #include "config.h"
 #include "diff.h"
+#include "diffcore.h"
 #include "environment.h"
 #include "hex.h"
 #include "object-name.h"
@@ -303,26 +304,43 @@ static void show_name(struct strbuf *sb, const struct name_decoration *decoratio
 
 /*
  * The caller makes sure there is no funny color before calling.
- * format_decorations_extended makes sure the same after return.
+ * format_decorations ensures the same after return.
  */
-void format_decorations_extended(struct strbuf *sb,
+void format_decorations(struct strbuf *sb,
                        const struct commit *commit,
                        int use_color,
-                       const char *prefix,
-                       const char *separator,
-                       const char *suffix)
+                       const struct decoration_options *opts)
 {
        const struct name_decoration *decoration;
        const struct name_decoration *current_and_HEAD;
-       const char *color_commit =
-               diff_get_color(use_color, DIFF_COMMIT);
-       const char *color_reset =
-               decorate_get_color(use_color, DECORATION_NONE);
+       const char *color_commit, *color_reset;
+
+       const char *prefix = " (";
+       const char *suffix = ")";
+       const char *separator = ", ";
+       const char *pointer = " -> ";
+       const char *tag = "tag: ";
 
        decoration = get_name_decoration(&commit->object);
        if (!decoration)
                return;
 
+       if (opts) {
+               if (opts->prefix)
+                       prefix = opts->prefix;
+               if (opts->suffix)
+                       suffix = opts->suffix;
+               if (opts->separator)
+                       separator = opts->separator;
+               if (opts->pointer)
+                       pointer = opts->pointer;
+               if (opts->tag)
+                       tag = opts->tag;
+       }
+
+       color_commit = diff_get_color(use_color, DIFF_COMMIT);
+       color_reset = decorate_get_color(use_color, DECORATION_NONE);
+
        current_and_HEAD = current_pointed_by_HEAD(decoration);
        while (decoration) {
                /*
@@ -331,31 +349,44 @@ void format_decorations_extended(struct strbuf *sb,
                 * appeared, skipping the entry for current.
                 */
                if (decoration != current_and_HEAD) {
-                       strbuf_addstr(sb, color_commit);
-                       strbuf_addstr(sb, prefix);
-                       strbuf_addstr(sb, color_reset);
-                       strbuf_addstr(sb, decorate_get_color(use_color, decoration->type));
-                       if (decoration->type == DECORATION_REF_TAG)
-                               strbuf_addstr(sb, "tag: ");
+                       const char *color =
+                               decorate_get_color(use_color, decoration->type);
+
+                       if (*prefix) {
+                               strbuf_addstr(sb, color_commit);
+                               strbuf_addstr(sb, prefix);
+                               strbuf_addstr(sb, color_reset);
+                       }
 
+                       if (*tag && decoration->type == DECORATION_REF_TAG) {
+                               strbuf_addstr(sb, color);
+                               strbuf_addstr(sb, tag);
+                               strbuf_addstr(sb, color_reset);
+                       }
+
+                       strbuf_addstr(sb, color);
                        show_name(sb, decoration);
+                       strbuf_addstr(sb, color_reset);
 
                        if (current_and_HEAD &&
                            decoration->type == DECORATION_REF_HEAD) {
-                               strbuf_addstr(sb, " -> ");
+                               strbuf_addstr(sb, color_commit);
+                               strbuf_addstr(sb, pointer);
                                strbuf_addstr(sb, color_reset);
                                strbuf_addstr(sb, decorate_get_color(use_color, current_and_HEAD->type));
                                show_name(sb, current_and_HEAD);
+                               strbuf_addstr(sb, color_reset);
                        }
-                       strbuf_addstr(sb, color_reset);
 
                        prefix = separator;
                }
                decoration = decoration->next;
        }
-       strbuf_addstr(sb, color_commit);
-       strbuf_addstr(sb, suffix);
-       strbuf_addstr(sb, color_reset);
+       if (*suffix) {
+               strbuf_addstr(sb, color_commit);
+               strbuf_addstr(sb, suffix);
+               strbuf_addstr(sb, color_reset);
+       }
 }
 
 void show_decorations(struct rev_info *opt, struct commit *commit)
@@ -370,7 +401,7 @@ void show_decorations(struct rev_info *opt, struct commit *commit)
        }
        if (!opt->show_decorations)
                return;
-       format_decorations(&sb, commit, opt->diffopt.use_color);
+       format_decorations(&sb, commit, opt->diffopt.use_color, NULL);
        fputs(sb.buf, opt->diffopt.file);
        strbuf_release(&sb);
 }
@@ -980,7 +1011,7 @@ static int do_remerge_diff(struct rev_info *opt,
                           struct object_id *oid)
 {
        struct merge_options o;
-       struct commit_list *bases;
+       struct commit_list *bases = NULL;
        struct merge_result res = {0};
        struct pretty_print_context ctx = {0};
        struct commit *parent1 = parents->item;
@@ -1005,7 +1036,8 @@ static int do_remerge_diff(struct rev_info *opt,
        /* Parse the relevant commits and get the merge bases */
        parse_commit_or_die(parent1);
        parse_commit_or_die(parent2);
-       bases = repo_get_merge_bases(the_repository, parent1, parent2);
+       if (repo_get_merge_bases(the_repository, parent1, parent2, &bases) < 0)
+               exit(128);
 
        /* Re-merge the parents */
        merge_incore_recursive(&o, bases, parent1, parent2, &res);
index bdb64328154e519ceaa4138045ee4124c0fb3381..41c776fea52e6867800caf2eb919379fc6e54218 100644 (file)
@@ -13,17 +13,20 @@ struct decoration_filter {
        struct string_list *exclude_ref_config_pattern;
 };
 
+struct decoration_options {
+       char *prefix;
+       char *suffix;
+       char *separator;
+       char *pointer;
+       char *tag;
+};
+
 int parse_decorate_color_config(const char *var, const char *slot_name, const char *value);
 int log_tree_diff_flush(struct rev_info *);
 int log_tree_commit(struct rev_info *, struct commit *);
 void show_log(struct rev_info *opt);
-void format_decorations_extended(struct strbuf *sb, const struct commit *commit,
-                            int use_color,
-                            const char *prefix,
-                            const char *separator,
-                            const char *suffix);
-#define format_decorations(strbuf, commit, color) \
-                            format_decorations_extended((strbuf), (commit), (color), " (", ", ", ")")
+void format_decorations(struct strbuf *sb, const struct commit *commit,
+                       int use_color, const struct decoration_options *opts);
 void show_decorations(struct rev_info *opt, struct commit *commit);
 void log_write_email_headers(struct rev_info *opt, struct commit *commit,
                             const char **extra_headers_p,
index 0e49b932c308b24a5654910d5e0197cf1388162e..819cbefee3de07c7cb7f8f92e1fd715b1b2f7af6 100644 (file)
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -5,7 +5,6 @@
 #include "hex.h"
 #include "repository.h"
 #include "refs.h"
-#include "remote.h"
 #include "strvec.h"
 #include "ls-refs.h"
 #include "pkt-line.h"
index 931505363cde08b0475f200e9c60fd3c034413b7..94b9b0abf228b891bc1df5a71bcd96807ed982a8 100644 (file)
@@ -1,7 +1,7 @@
 #include "git-compat-util.h"
 #include "config.h"
 #include "gettext.h"
-#include "hex.h"
+#include "hex-ll.h"
 #include "utf8.h"
 #include "strbuf.h"
 #include "mailinfo.h"
@@ -58,12 +58,13 @@ static void parse_bogus_from(struct mailinfo *mi, const struct strbuf *line)
 
 static const char *unquote_comment(struct strbuf *outbuf, const char *in)
 {
-       int c;
        int take_next_literally = 0;
+       int depth = 1;
 
        strbuf_addch(outbuf, '(');
 
-       while ((c = *in++) != 0) {
+       while (*in) {
+               int c = *in++;
                if (take_next_literally == 1) {
                        take_next_literally = 0;
                } else {
@@ -72,11 +73,14 @@ static const char *unquote_comment(struct strbuf *outbuf, const char *in)
                                take_next_literally = 1;
                                continue;
                        case '(':
-                               in = unquote_comment(outbuf, in);
+                               strbuf_addch(outbuf, '(');
+                               depth++;
                                continue;
                        case ')':
                                strbuf_addch(outbuf, ')');
-                               return in;
+                               if (!--depth)
+                                       return in;
+                               continue;
                        }
                }
 
@@ -88,10 +92,10 @@ static const char *unquote_comment(struct strbuf *outbuf, const char *in)
 
 static const char *unquote_quoted_string(struct strbuf *outbuf, const char *in)
 {
-       int c;
        int take_next_literally = 0;
 
-       while ((c = *in++) != 0) {
+       while (*in) {
+               int c = *in++;
                if (take_next_literally == 1) {
                        take_next_literally = 0;
                } else {
@@ -1253,6 +1257,8 @@ static int git_mailinfo_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "mailinfo.quotedcr")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (mailinfo_parse_quoted_cr_action(value, &mi->quoted_cr) != 0)
                        return error(_("bad action '%s' for '%s'"), value, var);
                return 0;
index c34846d176c886ecb9f028ec48bb847402d242f9..2078c22b097a61c97faddb6689a75e6c10ccb9ee 100644 (file)
@@ -89,9 +89,7 @@ void *mem_pool_alloc(struct mem_pool *pool, size_t len)
        struct mp_block *p = NULL;
        void *r;
 
-       /* round up to a 'GIT_MAX_ALIGNMENT' alignment */
-       if (len & (GIT_MAX_ALIGNMENT - 1))
-               len += GIT_MAX_ALIGNMENT - (len & (GIT_MAX_ALIGNMENT - 1));
+       len = DIV_ROUND_UP(len, GIT_MAX_ALIGNMENT) * GIT_MAX_ALIGNMENT;
 
        if (pool->mp_block &&
            pool->mp_block->end - pool->mp_block->next_free >= len)
@@ -99,9 +97,9 @@ void *mem_pool_alloc(struct mem_pool *pool, size_t len)
 
        if (!p) {
                if (len >= (pool->block_alloc / 2))
-                       return mem_pool_alloc_block(pool, len, pool->mp_block);
-
-               p = mem_pool_alloc_block(pool, pool->block_alloc, NULL);
+                       p = mem_pool_alloc_block(pool, len, pool->mp_block);
+               else
+                       p = mem_pool_alloc_block(pool, pool->block_alloc, NULL);
        }
 
        r = p->next_free;
@@ -109,6 +107,45 @@ void *mem_pool_alloc(struct mem_pool *pool, size_t len)
        return r;
 }
 
+static char *mem_pool_strvfmt(struct mem_pool *pool, const char *fmt,
+                             va_list ap)
+{
+       struct mp_block *block = pool->mp_block;
+       char *next_free = block ? block->next_free : NULL;
+       size_t available = block ? block->end - block->next_free : 0;
+       va_list cp;
+       int len, len2;
+       char *ret;
+
+       va_copy(cp, ap);
+       len = vsnprintf(next_free, available, fmt, cp);
+       va_end(cp);
+       if (len < 0)
+               BUG("your vsnprintf is broken (returned %d)", len);
+
+       ret = mem_pool_alloc(pool, len + 1);  /* 1 for NUL */
+
+       /* Shortcut; relies on mem_pool_alloc() not touching buffer contents. */
+       if (ret == next_free)
+               return ret;
+
+       len2 = vsnprintf(ret, len + 1, fmt, ap);
+       if (len2 != len)
+               BUG("your vsnprintf is broken (returns inconsistent lengths)");
+       return ret;
+}
+
+char *mem_pool_strfmt(struct mem_pool *pool, const char *fmt, ...)
+{
+       va_list ap;
+       char *ret;
+
+       va_start(ap, fmt);
+       ret = mem_pool_strvfmt(pool, fmt, ap);
+       va_end(ap);
+       return ret;
+}
+
 void *mem_pool_calloc(struct mem_pool *pool, size_t count, size_t size)
 {
        size_t len = st_mult(count, size);
index fe7507f022bba40d74aab341e99269ead7171695..d1c66413ec322104f6199cc2248466c734cee868 100644 (file)
@@ -47,6 +47,11 @@ void *mem_pool_calloc(struct mem_pool *pool, size_t count, size_t size);
 char *mem_pool_strdup(struct mem_pool *pool, const char *str);
 char *mem_pool_strndup(struct mem_pool *pool, const char *str, size_t len);
 
+/*
+ * Allocate memory from the memory pool and format a string into it.
+ */
+char *mem_pool_strfmt(struct mem_pool *pool, const char *fmt, ...);
+
 /*
  * Move the memory associated with the 'src' pool to the 'dst' pool. The 'src'
  * pool will be empty and not contain any memory. It still needs to be free'd
index 9293cbf75c8ab737a2cf7267d3e31ffd93a48dc8..2f659fd01432d4249d1d2be1876f0edfd8c9cd09 100644 (file)
@@ -1,6 +1,4 @@
 #include "git-compat-util.h"
-#include "run-command.h"
-#include "xdiff-interface.h"
 #include "merge-ll.h"
 #include "blob.h"
 #include "merge-blobs.h"
index 8fcf2d3710ed1a87bd851abe04dd22a32fafdf84..61e0ae53981dbc786061a1b8ed7689ca5fee3912 100644 (file)
@@ -185,9 +185,9 @@ static void create_temp(mmfile_t *src, char *path, size_t len)
 static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
                        mmbuffer_t *result,
                        const char *path,
-                       mmfile_t *orig, const char *orig_name UNUSED,
-                       mmfile_t *src1, const char *name1 UNUSED,
-                       mmfile_t *src2, const char *name2 UNUSED,
+                       mmfile_t *orig, const char *orig_name,
+                       mmfile_t *src1, const char *name1,
+                       mmfile_t *src2, const char *name2,
                        const struct ll_merge_options *opts,
                        int marker_size)
 {
@@ -222,6 +222,12 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
                        strbuf_addf(&cmd, "%d", marker_size);
                else if (skip_prefix(format, "P", &format))
                        sq_quote_buf(&cmd, path);
+               else if (skip_prefix(format, "S", &format))
+                       sq_quote_buf(&cmd, orig_name ? orig_name : "");
+               else if (skip_prefix(format, "X", &format))
+                       sq_quote_buf(&cmd, name1 ? name1 : "");
+               else if (skip_prefix(format, "Y", &format))
+                       sq_quote_buf(&cmd, name2 ? name2 : "");
                else
                        strbuf_addch(&cmd, '%');
        }
@@ -286,7 +292,7 @@ static int read_merge_config(const char *var, const char *value,
         * after seeing merge.<name>.var1.
         */
        for (fn = ll_user_merge; fn; fn = fn->next)
-               if (!strncmp(fn->name, name, namelen) && !fn->name[namelen])
+               if (!xstrncmpz(fn->name, name, namelen))
                        break;
        if (!fn) {
                CALLOC_ARRAY(fn, 1);
@@ -301,7 +307,7 @@ static int read_merge_config(const char *var, const char *value,
 
        if (!strcmp("driver", key)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                /*
                 * merge.<name>.driver specifies the command line:
                 *
@@ -315,7 +321,12 @@ static int read_merge_config(const char *var, const char *value,
                 *    %B - temporary file name for the other branches' version.
                 *    %L - conflict marker length
                 *    %P - the original path (safely quoted for the shell)
+                *    %S - the revision for the merge base
+                *    %X - the revision for our version
+                *    %Y - the revision for their version
                 *
+                * If the file is not named indentically in all versions, then each
+                * revision is joined with the corresponding path, separated by a colon.
                 * The external merge driver should write the results in the
                 * file named by %A, and signal that it has done with zero exit
                 * status.
index 3a5729c91e486e37452a4629fd2e46c485b59791..ac225cc33c27d30629fad541ba4375d5707ec11c 100644 (file)
@@ -18,8 +18,8 @@
 #include "merge-ort.h"
 
 #include "alloc.h"
+#include "advice.h"
 #include "attr.h"
-#include "blob.h"
 #include "cache-tree.h"
 #include "commit.h"
 #include "commit-reach.h"
 #include "path.h"
 #include "promisor-remote.h"
 #include "read-cache-ll.h"
+#include "refs.h"
 #include "revision.h"
 #include "sparse-index.h"
 #include "strmap.h"
-#include "submodule-config.h"
-#include "submodule.h"
 #include "trace2.h"
 #include "tree.h"
 #include "unpack-trees.h"
@@ -544,6 +543,7 @@ enum conflict_and_info_types {
        CONFLICT_SUBMODULE_HISTORY_NOT_AVAILABLE,
        CONFLICT_SUBMODULE_MAY_HAVE_REWINDS,
        CONFLICT_SUBMODULE_NULL_MERGE_BASE,
+       CONFLICT_SUBMODULE_CORRUPT,
 
        /* Keep this entry _last_ in the list */
        NB_CONFLICT_TYPES,
@@ -596,7 +596,9 @@ static const char *type_short_descriptions[] = {
        [CONFLICT_SUBMODULE_MAY_HAVE_REWINDS] =
                "CONFLICT (submodule may have rewinds)",
        [CONFLICT_SUBMODULE_NULL_MERGE_BASE] =
-               "CONFLICT (submodule lacks merge base)"
+               "CONFLICT (submodule lacks merge base)",
+       [CONFLICT_SUBMODULE_CORRUPT] =
+               "CONFLICT (submodule corrupt)"
 };
 
 struct logical_conflict_info {
@@ -721,23 +723,6 @@ static void clear_or_reinit_internal_opts(struct merge_options_internal *opti,
        renames->callback_data_nr = renames->callback_data_alloc = 0;
 }
 
-__attribute__((format (printf, 2, 3)))
-static int err(struct merge_options *opt, const char *err, ...)
-{
-       va_list params;
-       struct strbuf sb = STRBUF_INIT;
-
-       strbuf_addstr(&sb, "error: ");
-       va_start(params, err);
-       strbuf_vaddf(&sb, err, params);
-       va_end(params);
-
-       error("%s", sb.buf);
-       strbuf_release(&sb);
-
-       return -1;
-}
-
 static void format_commit(struct strbuf *sb,
                          int indent,
                          struct repository *repo,
@@ -1676,9 +1661,10 @@ static int collect_merge_info(struct merge_options *opt,
        info.data = opt;
        info.show_all_errors = 1;
 
-       parse_tree(merge_base);
-       parse_tree(side1);
-       parse_tree(side2);
+       if (parse_tree(merge_base) < 0 ||
+           parse_tree(side1) < 0 ||
+           parse_tree(side2) < 0)
+               return -1;
        init_tree_desc(t + 0, &merge_base->object.oid,
                       merge_base->buffer, merge_base->size);
        init_tree_desc(t + 1, &side1->object.oid, side1->buffer, side1->size);
@@ -1728,7 +1714,14 @@ static int find_first_merges(struct repository *repo,
                die("revision walk setup failed");
        while ((commit = get_revision(&revs)) != NULL) {
                struct object *o = &(commit->object);
-               if (repo_in_merge_bases(repo, b, commit))
+               int ret = repo_in_merge_bases(repo, b, commit);
+
+               if (ret < 0) {
+                       object_array_clear(&merges);
+                       release_revisions(&revs);
+                       return ret;
+               }
+               if (ret > 0)
                        add_object_array(o, NULL, &merges);
        }
        reset_revision_walk();
@@ -1743,9 +1736,17 @@ static int find_first_merges(struct repository *repo,
                contains_another = 0;
                for (j = 0; j < merges.nr; j++) {
                        struct commit *m2 = (struct commit *) merges.objects[j].item;
-                       if (i != j && repo_in_merge_bases(repo, m2, m1)) {
-                               contains_another = 1;
-                               break;
+                       if (i != j) {
+                               int ret = repo_in_merge_bases(repo, m2, m1);
+                               if (ret < 0) {
+                                       object_array_clear(&merges);
+                                       release_revisions(&revs);
+                                       return ret;
+                               }
+                               if (ret > 0) {
+                                       contains_another = 1;
+                                       break;
+                               }
                        }
                }
 
@@ -1767,7 +1768,7 @@ static int merge_submodule(struct merge_options *opt,
 {
        struct repository subrepo;
        struct strbuf sb = STRBUF_INIT;
-       int ret = 0;
+       int ret = 0, ret2;
        struct commit *commit_o, *commit_a, *commit_b;
        int parent_count;
        struct object_array merges;
@@ -1814,8 +1815,28 @@ static int merge_submodule(struct merge_options *opt,
        }
 
        /* check whether both changes are forward */
-       if (!repo_in_merge_bases(&subrepo, commit_o, commit_a) ||
-           !repo_in_merge_bases(&subrepo, commit_o, commit_b)) {
+       ret2 = repo_in_merge_bases(&subrepo, commit_o, commit_a);
+       if (ret2 < 0) {
+               path_msg(opt, CONFLICT_SUBMODULE_CORRUPT, 0,
+                        path, NULL, NULL, NULL,
+                        _("Failed to merge submodule %s "
+                          "(repository corrupt)"),
+                        path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (ret2 > 0)
+               ret2 = repo_in_merge_bases(&subrepo, commit_o, commit_b);
+       if (ret2 < 0) {
+               path_msg(opt, CONFLICT_SUBMODULE_CORRUPT, 0,
+                        path, NULL, NULL, NULL,
+                        _("Failed to merge submodule %s "
+                          "(repository corrupt)"),
+                        path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (!ret2) {
                path_msg(opt, CONFLICT_SUBMODULE_MAY_HAVE_REWINDS, 0,
                         path, NULL, NULL, NULL,
                         _("Failed to merge submodule %s "
@@ -1825,7 +1846,17 @@ static int merge_submodule(struct merge_options *opt,
        }
 
        /* Case #1: a is contained in b or vice versa */
-       if (repo_in_merge_bases(&subrepo, commit_a, commit_b)) {
+       ret2 = repo_in_merge_bases(&subrepo, commit_a, commit_b);
+       if (ret2 < 0) {
+               path_msg(opt, CONFLICT_SUBMODULE_CORRUPT, 0,
+                        path, NULL, NULL, NULL,
+                        _("Failed to merge submodule %s "
+                          "(repository corrupt)"),
+                        path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (ret2 > 0) {
                oidcpy(result, b);
                path_msg(opt, INFO_SUBMODULE_FAST_FORWARDING, 1,
                         path, NULL, NULL, NULL,
@@ -1834,7 +1865,17 @@ static int merge_submodule(struct merge_options *opt,
                ret = 1;
                goto cleanup;
        }
-       if (repo_in_merge_bases(&subrepo, commit_b, commit_a)) {
+       ret2 = repo_in_merge_bases(&subrepo, commit_b, commit_a);
+       if (ret2 < 0) {
+               path_msg(opt, CONFLICT_SUBMODULE_CORRUPT, 0,
+                        path, NULL, NULL, NULL,
+                        _("Failed to merge submodule %s "
+                          "(repository corrupt)"),
+                        path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (ret2 > 0) {
                oidcpy(result, a);
                path_msg(opt, INFO_SUBMODULE_FAST_FORWARDING, 1,
                         path, NULL, NULL, NULL,
@@ -1859,6 +1900,14 @@ static int merge_submodule(struct merge_options *opt,
        parent_count = find_first_merges(&subrepo, path, commit_a, commit_b,
                                         &merges);
        switch (parent_count) {
+       case -1:
+               path_msg(opt, CONFLICT_SUBMODULE_CORRUPT, 0,
+                        path, NULL, NULL, NULL,
+                        _("Failed to merge submodule %s "
+                          "(repository corrupt)"),
+                        path);
+               ret = -1;
+               break;
        case 0:
                path_msg(opt, CONFLICT_SUBMODULE_FAILED_TO_MERGE, 0,
                         path, NULL, NULL, NULL,
@@ -1920,6 +1969,7 @@ static void initialize_attr_index(struct merge_options *opt)
        struct index_state *attr_index = &opt->priv->attr_index;
        struct cache_entry *ce;
 
+       attr_index->repo = opt->repo;
        attr_index->initialized = 1;
 
        if (!opt->renormalize)
@@ -2054,7 +2104,7 @@ static int handle_content_merge(struct merge_options *opt,
         * the three blobs to merge on various sides of history.
         *
         * extra_marker_size is the amount to extend conflict markers in
-        * ll_merge; this is neeed if we have content merges of content
+        * ll_merge; this is needed if we have content merges of content
         * merges, which happens for example with rename/rename(2to1) and
         * rename/add conflicts.
         */
@@ -2123,13 +2173,12 @@ static int handle_content_merge(struct merge_options *opt,
                                          &result_buf);
 
                if ((merge_status < 0) || !result_buf.ptr)
-                       ret = err(opt, _("Failed to execute internal merge"));
+                       ret = error(_("failed to execute internal merge"));
 
                if (!ret &&
                    write_object_file(result_buf.ptr, result_buf.size,
                                      OBJ_BLOB, &result->oid))
-                       ret = err(opt, _("Unable to add %s to database"),
-                                 path);
+                       ret = error(_("unable to add %s to database"), path);
 
                free(result_buf.ptr);
                if (ret)
@@ -2662,7 +2711,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
                        oidcpy(&ci->stages[i].oid, null_oid());
                }
 
-               // Now we want to focus on new_ci, so reassign ci to it
+               /* Now we want to focus on new_ci, so reassign ci to it. */
                ci = new_ci;
        }
 
@@ -3343,10 +3392,7 @@ static int collect_renames(struct merge_options *opt,
        return clean;
 }
 
-static int detect_and_process_renames(struct merge_options *opt,
-                                     struct tree *merge_base,
-                                     struct tree *side1,
-                                     struct tree *side2)
+static int detect_and_process_renames(struct merge_options *opt)
 {
        struct diff_queue_struct combined = { 0 };
        struct rename_info *renames = &opt->priv->renames;
@@ -3510,8 +3556,7 @@ static int sort_dirs_next_to_their_children(const char *one, const char *two)
                return c1 - c2;
 }
 
-static int read_oid_strbuf(struct merge_options *opt,
-                          const struct object_id *oid,
+static int read_oid_strbuf(const struct object_id *oid,
                           struct strbuf *dst)
 {
        void *buf;
@@ -3519,10 +3564,10 @@ static int read_oid_strbuf(struct merge_options *opt,
        unsigned long size;
        buf = repo_read_object_file(the_repository, oid, &type, &size);
        if (!buf)
-               return err(opt, _("cannot read object %s"), oid_to_hex(oid));
+               return error(_("cannot read object %s"), oid_to_hex(oid));
        if (type != OBJ_BLOB) {
                free(buf);
-               return err(opt, _("object %s is not a blob"), oid_to_hex(oid));
+               return error(_("object %s is not a blob"), oid_to_hex(oid));
        }
        strbuf_attach(dst, buf, size, size + 1);
        return 0;
@@ -3546,8 +3591,8 @@ static int blob_unchanged(struct merge_options *opt,
        if (oideq(&base->oid, &side->oid))
                return 1;
 
-       if (read_oid_strbuf(opt, &base->oid, &basebuf) ||
-           read_oid_strbuf(opt, &side->oid, &sidebuf))
+       if (read_oid_strbuf(&base->oid, &basebuf) ||
+           read_oid_strbuf(&side->oid, &sidebuf))
                goto error_return;
        /*
         * Note: binary | is used so that both renormalizations are
@@ -4400,9 +4445,11 @@ static int checkout(struct merge_options *opt,
        unpack_opts.verbose_update = (opt->verbosity > 2);
        unpack_opts.fn = twoway_merge;
        unpack_opts.preserve_ignored = 0; /* FIXME: !opts->overwrite_ignore */
-       parse_tree(prev);
+       if (parse_tree(prev) < 0)
+               return -1;
        init_tree_desc(&trees[0], &prev->object.oid, prev->buffer, prev->size);
-       parse_tree(next);
+       if (parse_tree(next) < 0)
+               return -1;
        init_tree_desc(&trees[1], &next->object.oid, next->buffer, next->size);
 
        ret = unpack_trees(2, trees, &unpack_opts);
@@ -4580,7 +4627,7 @@ static void print_submodule_conflict_suggestion(struct string_list *csub) {
                      " - commit the resulting index in the superproject\n"),
                    tmp.buf, subs.buf);
 
-       printf("%s", msg.buf);
+       advise_if_enabled(ADVICE_SUBMODULE_MERGE_CONFLICT, "%s", msg.buf);
 
        strbuf_release(&subs);
        strbuf_release(&tmp);
@@ -4684,9 +4731,6 @@ void merge_switch_to_result(struct merge_options *opt,
 {
        assert(opt->priv == NULL);
        if (result->clean >= 0 && update_worktree_and_index) {
-               const char *filename;
-               FILE *fp;
-
                trace2_region_enter("merge", "checkout", opt->repo);
                if (checkout(opt, head, result->tree)) {
                        /* failure to function */
@@ -4712,10 +4756,17 @@ void merge_switch_to_result(struct merge_options *opt,
                trace2_region_leave("merge", "record_conflicted", opt->repo);
 
                trace2_region_enter("merge", "write_auto_merge", opt->repo);
-               filename = git_path_auto_merge(opt->repo);
-               fp = xfopen(filename, "w");
-               fprintf(fp, "%s\n", oid_to_hex(&result->tree->object.oid));
-               fclose(fp);
+               if (refs_update_ref(get_main_ref_store(opt->repo), "", "AUTO_MERGE",
+                                   &result->tree->object.oid, NULL, REF_NO_DEREF,
+                                   UPDATE_REFS_MSG_ON_ERR)) {
+                       /* failure to function */
+                       opt->priv = NULL;
+                       result->clean = -1;
+                       merge_finalize(opt, result);
+                       trace2_region_leave("merge", "write_auto_merge",
+                                           opt->repo);
+                       return;
+               }
                trace2_region_leave("merge", "write_auto_merge", opt->repo);
        }
        if (display_update_msgs)
@@ -4903,8 +4954,7 @@ static void merge_start(struct merge_options *opt, struct merge_result *result)
        trace2_region_leave("merge", "allocate/init", opt->repo);
 }
 
-static void merge_check_renames_reusable(struct merge_options *opt,
-                                        struct merge_result *result,
+static void merge_check_renames_reusable(struct merge_result *result,
                                         struct tree *merge_base,
                                         struct tree *side1,
                                         struct tree *side2)
@@ -4974,7 +5024,7 @@ redo:
                 * TRANSLATORS: The %s arguments are: 1) tree hash of a merge
                 * base, and 2-3) the trees for the two trees we're merging.
                 */
-               err(opt, _("collecting merge info failed for trees %s, %s, %s"),
+               error(_("collecting merge info failed for trees %s, %s, %s"),
                    oid_to_hex(&merge_base->object.oid),
                    oid_to_hex(&side1->object.oid),
                    oid_to_hex(&side2->object.oid));
@@ -4984,8 +5034,7 @@ redo:
        trace2_region_leave("merge", "collect_merge_info", opt->repo);
 
        trace2_region_enter("merge", "renames", opt->repo);
-       result->clean = detect_and_process_renames(opt, merge_base,
-                                                  side1, side2);
+       result->clean = detect_and_process_renames(opt);
        trace2_region_leave("merge", "renames", opt->repo);
        if (opt->priv->renames.redo_after_renames == 2) {
                trace2_region_enter("merge", "reset_maps", opt->repo);
@@ -5004,6 +5053,9 @@ redo:
 
        if (result->clean >= 0) {
                result->tree = parse_tree_indirect(&working_tree_oid);
+               if (!result->tree)
+                       die(_("unable to read tree (%s)"),
+                           oid_to_hex(&working_tree_oid));
                /* existence of conflicted entries implies unclean */
                result->clean &= strmap_empty(&opt->priv->conflicted);
        }
@@ -5029,7 +5081,11 @@ static void merge_ort_internal(struct merge_options *opt,
        struct strbuf merge_base_abbrev = STRBUF_INIT;
 
        if (!merge_bases) {
-               merge_bases = repo_get_merge_bases(the_repository, h1, h2);
+               if (repo_get_merge_bases(the_repository, h1, h2,
+                                        &merge_bases) < 0) {
+                       result->clean = -1;
+                       return;
+               }
                /* See merge-ort.h:merge_incore_recursive() declaration NOTE */
                merge_bases = reverse_commit_list(merge_bases);
        }
@@ -5107,7 +5163,7 @@ void merge_incore_nonrecursive(struct merge_options *opt,
 
        trace2_region_enter("merge", "merge_start", opt->repo);
        assert(opt->ancestor != NULL);
-       merge_check_renames_reusable(opt, result, merge_base, side1, side2);
+       merge_check_renames_reusable(result, merge_base, side1, side2);
        merge_start(opt, result);
        /*
         * Record the trees used in this merge, so if there's a next merge in
index 93df9eecdd9570b6b8b398e666ab92dce6d98233..69d67bef5a96da9e9b843267a74a84f29eef70c7 100644 (file)
@@ -6,10 +6,7 @@
 #include "git-compat-util.h"
 #include "merge-recursive.h"
 
-#include "advice.h"
 #include "alloc.h"
-#include "attr.h"
-#include "blob.h"
 #include "cache-tree.h"
 #include "commit.h"
 #include "commit-reach.h"
@@ -32,8 +29,6 @@
 #include "revision.h"
 #include "sparse-index.h"
 #include "string-list.h"
-#include "submodule-config.h"
-#include "submodule.h"
 #include "symlinks.h"
 #include "tag.h"
 #include "tree-walk.h"
@@ -410,7 +405,8 @@ static inline int merge_detect_rename(struct merge_options *opt)
 
 static void init_tree_desc_from_tree(struct tree_desc *desc, struct tree *tree)
 {
-       parse_tree(tree);
+       if (parse_tree(tree) < 0)
+               exit(128);
        init_tree_desc(desc, &tree->object.oid, tree->buffer, tree->size);
 }
 
@@ -1144,7 +1140,13 @@ static int find_first_merges(struct repository *repo,
                die("revision walk setup failed");
        while ((commit = get_revision(&revs)) != NULL) {
                struct object *o = &(commit->object);
-               if (repo_in_merge_bases(repo, b, commit))
+               int ret = repo_in_merge_bases(repo, b, commit);
+               if (ret < 0) {
+                       object_array_clear(&merges);
+                       release_revisions(&revs);
+                       return ret;
+               }
+               if (ret)
                        add_object_array(o, NULL, &merges);
        }
        reset_revision_walk();
@@ -1159,9 +1161,17 @@ static int find_first_merges(struct repository *repo,
                contains_another = 0;
                for (j = 0; j < merges.nr; j++) {
                        struct commit *m2 = (struct commit *) merges.objects[j].item;
-                       if (i != j && repo_in_merge_bases(repo, m2, m1)) {
-                               contains_another = 1;
-                               break;
+                       if (i != j) {
+                               int ret = repo_in_merge_bases(repo, m2, m1);
+                               if (ret < 0) {
+                                       object_array_clear(&merges);
+                                       release_revisions(&revs);
+                                       return ret;
+                               }
+                               if (ret > 0) {
+                                       contains_another = 1;
+                                       break;
+                               }
                        }
                }
 
@@ -1197,7 +1207,7 @@ static int merge_submodule(struct merge_options *opt,
                           const struct object_id *b)
 {
        struct repository subrepo;
-       int ret = 0;
+       int ret = 0, ret2;
        struct commit *commit_base, *commit_a, *commit_b;
        int parent_count;
        struct object_array merges;
@@ -1234,14 +1244,32 @@ static int merge_submodule(struct merge_options *opt,
        }
 
        /* check whether both changes are forward */
-       if (!repo_in_merge_bases(&subrepo, commit_base, commit_a) ||
-           !repo_in_merge_bases(&subrepo, commit_base, commit_b)) {
+       ret2 = repo_in_merge_bases(&subrepo, commit_base, commit_a);
+       if (ret2 < 0) {
+               output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (ret2 > 0)
+               ret2 = repo_in_merge_bases(&subrepo, commit_base, commit_b);
+       if (ret2 < 0) {
+               output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (!ret2) {
                output(opt, 1, _("Failed to merge submodule %s (commits don't follow merge-base)"), path);
                goto cleanup;
        }
 
        /* Case #1: a is contained in b or vice versa */
-       if (repo_in_merge_bases(&subrepo, commit_a, commit_b)) {
+       ret2 = repo_in_merge_bases(&subrepo, commit_a, commit_b);
+       if (ret2 < 0) {
+               output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (ret2) {
                oidcpy(result, b);
                if (show(opt, 3)) {
                        output(opt, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
@@ -1254,7 +1282,13 @@ static int merge_submodule(struct merge_options *opt,
                ret = 1;
                goto cleanup;
        }
-       if (repo_in_merge_bases(&subrepo, commit_b, commit_a)) {
+       ret2 = repo_in_merge_bases(&subrepo, commit_b, commit_a);
+       if (ret2 < 0) {
+               output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path);
+               ret = -1;
+               goto cleanup;
+       }
+       if (ret2) {
                oidcpy(result, a);
                if (show(opt, 3)) {
                        output(opt, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
@@ -1283,6 +1317,10 @@ static int merge_submodule(struct merge_options *opt,
        parent_count = find_first_merges(&subrepo, &merges, path,
                                         commit_a, commit_b);
        switch (parent_count) {
+       case -1:
+               output(opt, 1,_("Failed to merge submodule %s (repository corrupt)"), path);
+               ret = -1;
+               break;
        case 0:
                output(opt, 1, _("Failed to merge submodule %s (merge following commits not found)"), path);
                break;
@@ -1383,12 +1421,12 @@ static int merge_mode_and_contents(struct merge_options *opt,
                                                  extra_marker_size);
 
                        if ((merge_status < 0) || !result_buf.ptr)
-                               ret = err(opt, _("Failed to execute internal merge"));
+                               ret = err(opt, _("failed to execute internal merge"));
 
                        if (!ret &&
                            write_object_file(result_buf.ptr, result_buf.size,
                                              OBJ_BLOB, &result->blob.oid))
-                               ret = err(opt, _("Unable to add %s to database"),
+                               ret = err(opt, _("unable to add %s to database"),
                                          a->path);
 
                        free(result_buf.ptr);
@@ -1397,11 +1435,14 @@ static int merge_mode_and_contents(struct merge_options *opt,
                        /* FIXME: bug, what if modes didn't match? */
                        result->clean = (merge_status == 0);
                } else if (S_ISGITLINK(a->mode)) {
-                       result->clean = merge_submodule(opt, &result->blob.oid,
-                                                       o->path,
-                                                       &o->oid,
-                                                       &a->oid,
-                                                       &b->oid);
+                       int clean = merge_submodule(opt, &result->blob.oid,
+                                                   o->path,
+                                                   &o->oid,
+                                                   &a->oid,
+                                                   &b->oid);
+                       if (clean < 0)
+                               return -1;
+                       result->clean = clean;
                } else if (S_ISLNK(a->mode)) {
                        switch (opt->recursive_variant) {
                        case MERGE_VARIANT_NORMAL:
@@ -3602,7 +3643,9 @@ static int merge_recursive_internal(struct merge_options *opt,
        }
 
        if (!merge_bases) {
-               merge_bases = repo_get_merge_bases(the_repository, h1, h2);
+               if (repo_get_merge_bases(the_repository, h1, h2,
+                                        &merge_bases) < 0)
+                       return -1;
                merge_bases = reverse_commit_list(merge_bases);
        }
 
@@ -3912,6 +3955,22 @@ void init_merge_options(struct merge_options *opt,
                opt->buffer_output = 0;
 }
 
+/*
+ * For now, members of merge_options do not need deep copying, but
+ * it may change in the future, in which case we would need to update
+ * this, and also make a matching change to clear_merge_options() to
+ * release the resources held by a copied instance.
+ */
+void copy_merge_options(struct merge_options *dst, struct merge_options *src)
+{
+       *dst = *src;
+}
+
+void clear_merge_options(struct merge_options *opt UNUSED)
+{
+       ; /* no-op as our copy is shallow right now */
+}
+
 int parse_merge_opt(struct merge_options *opt, const char *s)
 {
        const char *arg;
index b88000e3c25277d07d20b7ba29755b9670cd28ff..3d3b3e3c295deb0dc8470958d01f8ed1e6ef0611 100644 (file)
@@ -55,6 +55,9 @@ struct merge_options {
 
 void init_merge_options(struct merge_options *opt, struct repository *repo);
 
+void copy_merge_options(struct merge_options *dst, struct merge_options *src);
+void clear_merge_options(struct merge_options *opt);
+
 /* parse the option in s and update the relevant field of opt */
 int parse_merge_opt(struct merge_options *opt, const char *s);
 
diff --git a/merge.c b/merge.c
index 86179c34102de01b126aeb11fce50054aa2ac74f..752a937fa93dd3bf8703400c6311afe7a5265e02 100644 (file)
--- a/merge.c
+++ b/merge.c
@@ -1,6 +1,4 @@
 #include "git-compat-util.h"
-#include "diff.h"
-#include "diffcore.h"
 #include "gettext.h"
 #include "hash.h"
 #include "hex.h"
@@ -13,7 +11,6 @@
 #include "tree.h"
 #include "tree-walk.h"
 #include "unpack-trees.h"
-#include "dir.h"
 
 static const char *merge_argument(struct commit *commit)
 {
@@ -80,7 +77,10 @@ int checkout_fast_forward(struct repository *r,
                return -1;
        }
        for (i = 0; i < nr_trees; i++) {
-               parse_tree(trees[i]);
+               if (parse_tree(trees[i]) < 0) {
+                       rollback_lock_file(&lock_file);
+                       return -1;
+               }
                init_tree_desc(t+i, &trees[i]->object.oid,
                               trees[i]->buffer, trees[i]->size);
        }
index 06937acbf5497115c9ba4d9a2377634b1885db7e..97e376329bf510fce8c70c89a6de7a5465190d2b 100644 (file)
@@ -371,9 +371,17 @@ diff_cmd_help () {
 
 
 merge_cmd () {
-       layout=$(git config mergetool.vimdiff.layout)
+       TOOL=$1
 
-       case "$1" in
+       layout=$(git config "mergetool.$TOOL.layout")
+
+       # backward compatibility:
+       if test -z "$layout"
+       then
+               layout=$(git config mergetool.vimdiff.layout)
+       fi
+
+       case "$TOOL" in
        *vimdiff)
                if test -z "$layout"
                then
diff --git a/midx.c b/midx.c
index 931f55735037fcc4de53005ef0970e9ed3781885..85e1c2cd1287b34e91d9dcccc74d330c93ff809c 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -21,6 +21,7 @@
 #include "refs.h"
 #include "revision.h"
 #include "list-objects.h"
+#include "pack-revindex.h"
 
 #define MIDX_SIGNATURE 0x4d494458 /* "MIDX" */
 #define MIDX_VERSION 1
@@ -33,6 +34,7 @@
 
 #define MIDX_CHUNK_ALIGNMENT 4
 #define MIDX_CHUNKID_PACKNAMES 0x504e414d /* "PNAM" */
+#define MIDX_CHUNKID_BITMAPPEDPACKS 0x42544d50 /* "BTMP" */
 #define MIDX_CHUNKID_OIDFANOUT 0x4f494446 /* "OIDF" */
 #define MIDX_CHUNKID_OIDLOOKUP 0x4f49444c /* "OIDL" */
 #define MIDX_CHUNKID_OBJECTOFFSETS 0x4f4f4646 /* "OOFF" */
@@ -41,6 +43,7 @@
 #define MIDX_CHUNK_FANOUT_SIZE (sizeof(uint32_t) * 256)
 #define MIDX_CHUNK_OFFSET_WIDTH (2 * sizeof(uint32_t))
 #define MIDX_CHUNK_LARGE_OFFSET_WIDTH (sizeof(uint64_t))
+#define MIDX_CHUNK_BITMAPPED_PACKS_WIDTH (2 * sizeof(uint32_t))
 #define MIDX_LARGE_OFFSET_NEEDED 0x80000000
 
 #define PACK_EXPIRED UINT_MAX
@@ -64,6 +67,7 @@ void get_midx_rev_filename(struct strbuf *out, struct multi_pack_index *m)
 static int midx_read_oid_fanout(const unsigned char *chunk_start,
                                size_t chunk_size, void *data)
 {
+       int i;
        struct multi_pack_index *m = data;
        m->chunk_oid_fanout = (uint32_t *)chunk_start;
 
@@ -71,6 +75,43 @@ static int midx_read_oid_fanout(const unsigned char *chunk_start,
                error(_("multi-pack-index OID fanout is of the wrong size"));
                return 1;
        }
+       for (i = 0; i < 255; i++) {
+               uint32_t oid_fanout1 = ntohl(m->chunk_oid_fanout[i]);
+               uint32_t oid_fanout2 = ntohl(m->chunk_oid_fanout[i+1]);
+
+               if (oid_fanout1 > oid_fanout2) {
+                       error(_("oid fanout out of order: fanout[%d] = %"PRIx32" > %"PRIx32" = fanout[%d]"),
+                             i, oid_fanout1, oid_fanout2, i + 1);
+                       return 1;
+               }
+       }
+       m->num_objects = ntohl(m->chunk_oid_fanout[255]);
+       return 0;
+}
+
+static int midx_read_oid_lookup(const unsigned char *chunk_start,
+                               size_t chunk_size, void *data)
+{
+       struct multi_pack_index *m = data;
+       m->chunk_oid_lookup = chunk_start;
+
+       if (chunk_size != st_mult(m->hash_len, m->num_objects)) {
+               error(_("multi-pack-index OID lookup chunk is the wrong size"));
+               return 1;
+       }
+       return 0;
+}
+
+static int midx_read_object_offsets(const unsigned char *chunk_start,
+                                   size_t chunk_size, void *data)
+{
+       struct multi_pack_index *m = data;
+       m->chunk_object_offsets = chunk_start;
+
+       if (chunk_size != st_mult(m->num_objects, MIDX_CHUNK_OFFSET_WIDTH)) {
+               error(_("multi-pack-index object offset chunk is the wrong size"));
+               return 1;
+       }
        return 0;
 }
 
@@ -137,36 +178,49 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local
 
        m->num_packs = get_be32(m->data + MIDX_BYTE_NUM_PACKS);
 
+       m->preferred_pack_idx = -1;
+
        cf = init_chunkfile(NULL);
 
        if (read_table_of_contents(cf, m->data, midx_size,
-                                  MIDX_HEADER_SIZE, m->num_chunks))
+                                  MIDX_HEADER_SIZE, m->num_chunks,
+                                  MIDX_CHUNK_ALIGNMENT))
                goto cleanup_fail;
 
-       if (pair_chunk(cf, MIDX_CHUNKID_PACKNAMES, &m->chunk_pack_names) == CHUNK_NOT_FOUND)
-               die(_("multi-pack-index missing required pack-name chunk"));
-       if (read_chunk(cf, MIDX_CHUNKID_OIDFANOUT, midx_read_oid_fanout, m) == CHUNK_NOT_FOUND)
-               die(_("multi-pack-index missing required OID fanout chunk"));
-       if (pair_chunk(cf, MIDX_CHUNKID_OIDLOOKUP, &m->chunk_oid_lookup) == CHUNK_NOT_FOUND)
-               die(_("multi-pack-index missing required OID lookup chunk"));
-       if (pair_chunk(cf, MIDX_CHUNKID_OBJECTOFFSETS, &m->chunk_object_offsets) == CHUNK_NOT_FOUND)
-               die(_("multi-pack-index missing required object offsets chunk"));
-
-       pair_chunk(cf, MIDX_CHUNKID_LARGEOFFSETS, &m->chunk_large_offsets);
+       if (pair_chunk(cf, MIDX_CHUNKID_PACKNAMES, &m->chunk_pack_names, &m->chunk_pack_names_len))
+               die(_("multi-pack-index required pack-name chunk missing or corrupted"));
+       if (read_chunk(cf, MIDX_CHUNKID_OIDFANOUT, midx_read_oid_fanout, m))
+               die(_("multi-pack-index required OID fanout chunk missing or corrupted"));
+       if (read_chunk(cf, MIDX_CHUNKID_OIDLOOKUP, midx_read_oid_lookup, m))
+               die(_("multi-pack-index required OID lookup chunk missing or corrupted"));
+       if (read_chunk(cf, MIDX_CHUNKID_OBJECTOFFSETS, midx_read_object_offsets, m))
+               die(_("multi-pack-index required object offsets chunk missing or corrupted"));
+
+       pair_chunk(cf, MIDX_CHUNKID_LARGEOFFSETS, &m->chunk_large_offsets,
+                  &m->chunk_large_offsets_len);
+       pair_chunk(cf, MIDX_CHUNKID_BITMAPPEDPACKS,
+                  (const unsigned char **)&m->chunk_bitmapped_packs,
+                  &m->chunk_bitmapped_packs_len);
 
        if (git_env_bool("GIT_TEST_MIDX_READ_RIDX", 1))
-               pair_chunk(cf, MIDX_CHUNKID_REVINDEX, &m->chunk_revindex);
-
-       m->num_objects = ntohl(m->chunk_oid_fanout[255]);
+               pair_chunk(cf, MIDX_CHUNKID_REVINDEX, &m->chunk_revindex,
+                          &m->chunk_revindex_len);
 
        CALLOC_ARRAY(m->pack_names, m->num_packs);
        CALLOC_ARRAY(m->packs, m->num_packs);
 
        cur_pack_name = (const char *)m->chunk_pack_names;
        for (i = 0; i < m->num_packs; i++) {
+               const char *end;
+               size_t avail = m->chunk_pack_names_len -
+                               (cur_pack_name - (const char *)m->chunk_pack_names);
+
                m->pack_names[i] = cur_pack_name;
 
-               cur_pack_name += strlen(cur_pack_name) + 1;
+               end = memchr(cur_pack_name, '\0', avail);
+               if (!end)
+                       die(_("multi-pack-index pack-name chunk is too short"));
+               cur_pack_name = end + 1;
 
                if (i && strcmp(m->pack_names[i], m->pack_names[i - 1]) <= 0)
                        die(_("multi-pack-index pack names out of order: '%s' before '%s'"),
@@ -240,6 +294,26 @@ int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t
        return 0;
 }
 
+int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m,
+                      struct bitmapped_pack *bp, uint32_t pack_int_id)
+{
+       if (!m->chunk_bitmapped_packs)
+               return error(_("MIDX does not contain the BTMP chunk"));
+
+       if (prepare_midx_pack(r, m, pack_int_id))
+               return error(_("could not load bitmapped pack %"PRIu32), pack_int_id);
+
+       bp->p = m->packs[pack_int_id];
+       bp->bitmap_pos = get_be32((char *)m->chunk_bitmapped_packs +
+                                 MIDX_CHUNK_BITMAPPED_PACKS_WIDTH * pack_int_id);
+       bp->bitmap_nr = get_be32((char *)m->chunk_bitmapped_packs +
+                                MIDX_CHUNK_BITMAPPED_PACKS_WIDTH * pack_int_id +
+                                sizeof(uint32_t));
+       bp->pack_int_id = pack_int_id;
+
+       return 0;
+}
+
 int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result)
 {
        return bsearch_hash(oid->hash, m->chunk_oid_fanout, m->chunk_oid_lookup,
@@ -270,8 +344,9 @@ off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos)
                        die(_("multi-pack-index stores a 64-bit offset, but off_t is too small"));
 
                offset32 ^= MIDX_LARGE_OFFSET_NEEDED;
-               return get_be64(m->chunk_large_offsets +
-                               st_mult(sizeof(uint64_t), offset32));
+               if (offset32 >= m->chunk_large_offsets_len / sizeof(uint64_t))
+                       die(_("multi-pack-index large offset out of bounds"));
+               return get_be64(m->chunk_large_offsets + sizeof(uint64_t) * offset32);
        }
 
        return offset32;
@@ -356,7 +431,8 @@ static int cmp_idx_or_pack_name(const char *idx_or_pack_name,
        return strcmp(idx_or_pack_name, idx_name);
 }
 
-int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name)
+int midx_locate_pack(struct multi_pack_index *m, const char *idx_or_pack_name,
+                    uint32_t *pos)
 {
        uint32_t first = 0, last = m->num_packs;
 
@@ -367,8 +443,11 @@ int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name)
 
                current = m->pack_names[mid];
                cmp = cmp_idx_or_pack_name(idx_or_pack_name, current);
-               if (!cmp)
+               if (!cmp) {
+                       if (pos)
+                               *pos = mid;
                        return 1;
+               }
                if (cmp > 0) {
                        first = mid + 1;
                        continue;
@@ -379,6 +458,28 @@ int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name)
        return 0;
 }
 
+int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name)
+{
+       return midx_locate_pack(m, idx_or_pack_name, NULL);
+}
+
+int midx_preferred_pack(struct multi_pack_index *m, uint32_t *pack_int_id)
+{
+       if (m->preferred_pack_idx == -1) {
+               if (load_midx_revindex(m) < 0) {
+                       m->preferred_pack_idx = -2;
+                       return -1;
+               }
+
+               m->preferred_pack_idx =
+                       nth_midxed_pack_int_id(m, pack_pos_to_midx(m, 0));
+       } else if (m->preferred_pack_idx == -2)
+               return -1; /* no revindex */
+
+       *pack_int_id = m->preferred_pack_idx;
+       return 0;
+}
+
 int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local)
 {
        struct multi_pack_index *m;
@@ -421,13 +522,31 @@ static size_t write_midx_header(struct hashfile *f,
        return MIDX_HEADER_SIZE;
 }
 
+#define BITMAP_POS_UNKNOWN (~((uint32_t)0))
+
 struct pack_info {
        uint32_t orig_pack_int_id;
        char *pack_name;
        struct packed_git *p;
+
+       uint32_t bitmap_pos;
+       uint32_t bitmap_nr;
+
        unsigned expired : 1;
 };
 
+static void fill_pack_info(struct pack_info *info,
+                          struct packed_git *p, const char *pack_name,
+                          uint32_t orig_pack_int_id)
+{
+       memset(info, 0, sizeof(struct pack_info));
+
+       info->orig_pack_int_id = orig_pack_int_id;
+       info->pack_name = xstrdup(pack_name);
+       info->p = p;
+       info->bitmap_pos = BITMAP_POS_UNKNOWN;
+}
+
 static int pack_info_compare(const void *_a, const void *_b)
 {
        struct pack_info *a = (struct pack_info *)_a;
@@ -468,6 +587,7 @@ static void add_pack_to_midx(const char *full_path, size_t full_path_len,
                             const char *file_name, void *data)
 {
        struct write_midx_context *ctx = data;
+       struct packed_git *p;
 
        if (ends_with(file_name, ".idx")) {
                display_progress(ctx->progress, ++ctx->pack_paths_checked);
@@ -494,27 +614,22 @@ static void add_pack_to_midx(const char *full_path, size_t full_path_len,
 
                ALLOC_GROW(ctx->info, ctx->nr + 1, ctx->alloc);
 
-               ctx->info[ctx->nr].p = add_packed_git(full_path,
-                                                     full_path_len,
-                                                     0);
-
-               if (!ctx->info[ctx->nr].p) {
+               p = add_packed_git(full_path, full_path_len, 0);
+               if (!p) {
                        warning(_("failed to add packfile '%s'"),
                                full_path);
                        return;
                }
 
-               if (open_pack_index(ctx->info[ctx->nr].p)) {
+               if (open_pack_index(p)) {
                        warning(_("failed to open pack-index '%s'"),
                                full_path);
-                       close_pack(ctx->info[ctx->nr].p);
-                       FREE_AND_NULL(ctx->info[ctx->nr].p);
+                       close_pack(p);
+                       free(p);
                        return;
                }
 
-               ctx->info[ctx->nr].pack_name = xstrdup(file_name);
-               ctx->info[ctx->nr].orig_pack_int_id = ctx->nr;
-               ctx->info[ctx->nr].expired = 0;
+               fill_pack_info(&ctx->info[ctx->nr], p, file_name, ctx->nr);
                ctx->nr++;
        }
 }
@@ -770,6 +885,26 @@ static int write_midx_pack_names(struct hashfile *f, void *data)
        return 0;
 }
 
+static int write_midx_bitmapped_packs(struct hashfile *f, void *data)
+{
+       struct write_midx_context *ctx = data;
+       size_t i;
+
+       for (i = 0; i < ctx->nr; i++) {
+               struct pack_info *pack = &ctx->info[i];
+               if (pack->expired)
+                       continue;
+
+               if (pack->bitmap_pos == BITMAP_POS_UNKNOWN && pack->bitmap_nr)
+                       BUG("pack '%s' has no bitmap position, but has %d bitmapped object(s)",
+                           pack->pack_name, pack->bitmap_nr);
+
+               hashwrite_be32(f, pack->bitmap_pos);
+               hashwrite_be32(f, pack->bitmap_nr);
+       }
+       return 0;
+}
+
 static int write_midx_oid_fanout(struct hashfile *f,
                                 void *data)
 {
@@ -937,8 +1072,19 @@ static uint32_t *midx_pack_order(struct write_midx_context *ctx)
        QSORT(data, ctx->entries_nr, midx_pack_order_cmp);
 
        ALLOC_ARRAY(pack_order, ctx->entries_nr);
-       for (i = 0; i < ctx->entries_nr; i++)
+       for (i = 0; i < ctx->entries_nr; i++) {
+               struct pack_midx_entry *e = &ctx->entries[data[i].nr];
+               struct pack_info *pack = &ctx->info[ctx->pack_perm[e->pack_int_id]];
+               if (pack->bitmap_pos == BITMAP_POS_UNKNOWN)
+                       pack->bitmap_pos = i;
+               pack->bitmap_nr++;
                pack_order[i] = data[i].nr;
+       }
+       for (i = 0; i < ctx->nr; i++) {
+               struct pack_info *pack = &ctx->info[ctx->pack_perm[i]];
+               if (pack->bitmap_pos == BITMAP_POS_UNKNOWN)
+                       pack->bitmap_pos = 0;
+       }
        free(data);
 
        trace2_region_leave("midx", "midx_pack_order", the_repository);
@@ -1239,6 +1385,7 @@ static int write_midx_internal(const char *object_dir,
        struct hashfile *f = NULL;
        struct lock_file lk;
        struct write_midx_context ctx = { 0 };
+       int bitmapped_packs_concat_len = 0;
        int pack_name_concat_len = 0;
        int dropped_packs = 0;
        int result = 0;
@@ -1274,11 +1421,6 @@ static int write_midx_internal(const char *object_dir,
                for (i = 0; i < ctx.m->num_packs; i++) {
                        ALLOC_GROW(ctx.info, ctx.nr + 1, ctx.alloc);
 
-                       ctx.info[ctx.nr].orig_pack_int_id = i;
-                       ctx.info[ctx.nr].pack_name = xstrdup(ctx.m->pack_names[i]);
-                       ctx.info[ctx.nr].p = ctx.m->packs[i];
-                       ctx.info[ctx.nr].expired = 0;
-
                        if (flags & MIDX_WRITE_REV_INDEX) {
                                /*
                                 * If generating a reverse index, need to have
@@ -1294,10 +1436,10 @@ static int write_midx_internal(const char *object_dir,
                                if (open_pack_index(ctx.m->packs[i]))
                                        die(_("could not open index for %s"),
                                            ctx.m->packs[i]->pack_name);
-                               ctx.info[ctx.nr].p = ctx.m->packs[i];
                        }
 
-                       ctx.nr++;
+                       fill_pack_info(&ctx.info[ctx.nr++], ctx.m->packs[i],
+                                      ctx.m->pack_names[i], i);
                }
        }
 
@@ -1456,8 +1598,10 @@ static int write_midx_internal(const char *object_dir,
        }
 
        for (i = 0; i < ctx.nr; i++) {
-               if (!ctx.info[i].expired)
-                       pack_name_concat_len += strlen(ctx.info[i].pack_name) + 1;
+               if (ctx.info[i].expired)
+                       continue;
+               pack_name_concat_len += strlen(ctx.info[i].pack_name) + 1;
+               bitmapped_packs_concat_len += 2 * sizeof(uint32_t);
        }
 
        /* Check that the preferred pack wasn't expired (if given). */
@@ -1517,6 +1661,9 @@ static int write_midx_internal(const char *object_dir,
                add_chunk(cf, MIDX_CHUNKID_REVINDEX,
                          st_mult(ctx.entries_nr, sizeof(uint32_t)),
                          write_midx_revindex);
+               add_chunk(cf, MIDX_CHUNKID_BITMAPPEDPACKS,
+                         bitmapped_packs_concat_len,
+                         write_midx_bitmapped_packs);
        }
 
        write_midx_header(f, get_num_chunks(cf), ctx.nr - dropped_packs);
@@ -1556,8 +1703,13 @@ static int write_midx_internal(const char *object_dir,
                                      flags) < 0) {
                        error(_("could not write multi-pack bitmap"));
                        result = 1;
+                       clear_packing_data(&pdata);
+                       free(commits);
                        goto cleanup;
                }
+
+               clear_packing_data(&pdata);
+               free(commits);
        }
        /*
         * NOTE: Do not use ctx.entries beyond this point, since it might
@@ -1746,15 +1898,6 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
        }
        stop_progress(&progress);
 
-       for (i = 0; i < 255; i++) {
-               uint32_t oid_fanout1 = ntohl(m->chunk_oid_fanout[i]);
-               uint32_t oid_fanout2 = ntohl(m->chunk_oid_fanout[i + 1]);
-
-               if (oid_fanout1 > oid_fanout2)
-                       midx_report(_("oid fanout out of order: fanout[%d] = %"PRIx32" > %"PRIx32" = fanout[%d]"),
-                                   i, oid_fanout1, oid_fanout2, i + 1);
-       }
-
        if (m->num_objects == 0) {
                midx_report(_("the midx contains no oid"));
                /*
diff --git a/midx.h b/midx.h
index 5578cd7b835e2b396e502e8abaf4560ab765c850..b374a7afafb867a9ef9f0fd9913ec2552914859c 100644 (file)
--- a/midx.h
+++ b/midx.h
@@ -1,12 +1,12 @@
 #ifndef MIDX_H
 #define MIDX_H
 
-#include "repository.h"
 #include "string-list.h"
 
 struct object_id;
 struct pack_entry;
 struct repository;
+struct bitmapped_pack;
 
 #define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
 #define GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP \
@@ -28,15 +28,21 @@ struct multi_pack_index {
        unsigned char num_chunks;
        uint32_t num_packs;
        uint32_t num_objects;
+       int preferred_pack_idx;
 
        int local;
 
        const unsigned char *chunk_pack_names;
+       size_t chunk_pack_names_len;
+       const uint32_t *chunk_bitmapped_packs;
+       size_t chunk_bitmapped_packs_len;
        const uint32_t *chunk_oid_fanout;
        const unsigned char *chunk_oid_lookup;
        const unsigned char *chunk_object_offsets;
        const unsigned char *chunk_large_offsets;
+       size_t chunk_large_offsets_len;
        const unsigned char *chunk_revindex;
+       size_t chunk_revindex_len;
 
        const char **pack_names;
        struct packed_git **packs;
@@ -55,6 +61,8 @@ void get_midx_rev_filename(struct strbuf *out, struct multi_pack_index *m);
 
 struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
 int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t pack_int_id);
+int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m,
+                      struct bitmapped_pack *bp, uint32_t pack_int_id);
 int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
 off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos);
 uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos);
@@ -62,7 +70,11 @@ struct object_id *nth_midxed_object_oid(struct object_id *oid,
                                        struct multi_pack_index *m,
                                        uint32_t n);
 int fill_midx_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
-int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name);
+int midx_contains_pack(struct multi_pack_index *m,
+                      const char *idx_or_pack_name);
+int midx_locate_pack(struct multi_pack_index *m, const char *idx_or_pack_name,
+                    uint32_t *pos);
+int midx_preferred_pack(struct multi_pack_index *m, uint32_t *pack_int_id);
 int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
 
 /*
index 251f036eef6983a66ac13013e5bee3ef770e8f9f..3a58ce03d9c4a6721941f0ff8b262b6ddb73acd2 100644 (file)
@@ -685,13 +685,20 @@ static int same_name(const struct cache_entry *ce, const char *name, int namelen
        return slow_same_name(name, namelen, ce->name, len);
 }
 
-int index_dir_exists(struct index_state *istate, const char *name, int namelen)
+int index_dir_find(struct index_state *istate, const char *name, int namelen,
+                  struct strbuf *canonical_path)
 {
        struct dir_entry *dir;
 
        lazy_init_name_hash(istate);
        expand_to_path(istate, name, namelen, 0);
        dir = find_dir_entry(istate, name, namelen);
+
+       if (canonical_path && dir && dir->nr) {
+               strbuf_reset(canonical_path);
+               strbuf_add(canonical_path, dir->name, dir->namelen);
+       }
+
        return dir && dir->nr;
 }
 
index b1b4b0fb337f12eb5878dbedcaa66ae394cba425..0cbfc4286316b244a0902c7fffd1168ba320d52f 100644 (file)
@@ -4,7 +4,12 @@
 struct cache_entry;
 struct index_state;
 
-int index_dir_exists(struct index_state *istate, const char *name, int namelen);
+
+int index_dir_find(struct index_state *istate, const char *name, int namelen,
+                  struct strbuf *canonical_path);
+
+#define index_dir_exists(i, n, l) index_dir_find((i), (n), (l), NULL)
+
 void adjust_dirname_case(struct index_state *istate, char *name);
 struct cache_entry *index_file_exists(struct index_state *istate, const char *name, int namelen, int igncase);
 
index 7b729376867afee47c76aaf74901aa19f3615804..65e3c200084aa4a198145e2433ad6055425ae2fa 100644 (file)
@@ -1,24 +1,25 @@
 #include "git-compat-util.h"
 #include "noop.h"
-#include "../commit.h"
 #include "../fetch-negotiator.h"
 
-static void known_common(struct fetch_negotiator *n, struct commit *c)
+static void known_common(struct fetch_negotiator *n UNUSED,
+                        struct commit *c UNUSED)
 {
        /* do nothing */
 }
 
-static void add_tip(struct fetch_negotiator *n, struct commit *c)
+static void add_tip(struct fetch_negotiator *n UNUSED,
+                   struct commit *c UNUSED)
 {
        /* do nothing */
 }
 
-static const struct object_id *next(struct fetch_negotiator *n)
+static const struct object_id *next(struct fetch_negotiator *n UNUSED)
 {
        return NULL;
 }
 
-static int ack(struct fetch_negotiator *n, struct commit *c)
+static int ack(struct fetch_negotiator *n UNUSED, struct commit *c UNUSED)
 {
        /*
         * This negotiator does not emit any commits, so there is no commit to
@@ -28,7 +29,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c)
        return 0;
 }
 
-static void release(struct fetch_negotiator *n)
+static void release(struct fetch_negotiator *n UNUSED)
 {
        /* nothing to release */
 }
index 8799b522a55f31869dcc8cbfd7229cc8db65af4c..51282934ae62b8e7daefcf8202b98e006c416c07 100644 (file)
@@ -607,7 +607,8 @@ int notes_merge(struct notes_merge_options *o,
        assert(local && remote);
 
        /* Find merge bases */
-       bases = repo_get_merge_bases(the_repository, local, remote);
+       if (repo_get_merge_bases(the_repository, local, remote, &bases) < 0)
+               exit(128);
        if (!bases) {
                base_oid = null_oid();
                base_tree_oid = the_hash_algo->empty_tree;
index 97c031c26ec7c7c2fdade8478fa039d470820bad..6197a5a4556400603ed7e669d5cccb0db4089e21 100644 (file)
@@ -5,7 +5,6 @@
 #include "gettext.h"
 #include "refs.h"
 #include "notes-utils.h"
-#include "repository.h"
 #include "strbuf.h"
 
 void create_notes_commit(struct repository *r,
@@ -112,6 +111,8 @@ static int notes_rewrite_config(const char *k, const char *v,
                }
                return 0;
        } else if (!c->refs_from_env && !strcmp(k, "notes.rewriteref")) {
+               if (!v)
+                       return config_error_nonbool(k);
                /* note that a refs/ prefix is implied in the
                 * underlying for_each_glob_ref */
                if (starts_with(v, "refs/notes/"))
diff --git a/notes.c b/notes.c
index 1ef2a331ce9302e58cb2078e58b7b40a94972b3e..fed1eda80cd7e41a2e21af26aed81e1dd472b27c 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -5,8 +5,6 @@
 #include "notes.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "blob.h"
-#include "tree.h"
 #include "utf8.h"
 #include "strbuf.h"
 #include "tree-walk.h"
index 5fa4b14baee0ac7969c9ddde4f923c2b39a806f0..610b1f465c4248e8c0520687049a707a8497195e 100644 (file)
 #include "hex.h"
 #include "string-list.h"
 #include "lockfile.h"
-#include "delta.h"
 #include "pack.h"
-#include "blob.h"
 #include "commit.h"
 #include "run-command.h"
-#include "tag.h"
-#include "tree.h"
-#include "tree-walk.h"
 #include "refs.h"
-#include "pack-revindex.h"
-#include "hash-lookup.h"
 #include "bulk-checkin.h"
 #include "repository.h"
 #include "replace-object.h"
 #include "streaming.h"
 #include "dir.h"
 #include "list.h"
-#include "mergesort.h"
 #include "quote.h"
 #include "packfile.h"
 #include "object-file.h"
@@ -2618,11 +2610,11 @@ static int index_core(struct index_state *istate,
  * binary blobs, they generally do not want to get any conversion, and
  * callers should avoid this code path when filters are requested.
  */
-static int index_stream(struct object_id *oid, int fd, size_t size,
-                       enum object_type type, const char *path,
-                       unsigned flags)
+static int index_blob_stream(struct object_id *oid, int fd, size_t size,
+                            const char *path,
+                            unsigned flags)
 {
-       return index_bulk_checkin(oid, fd, size, type, path, flags);
+       return index_blob_bulk_checkin(oid, fd, size, path, flags);
 }
 
 int index_fd(struct index_state *istate, struct object_id *oid,
@@ -2644,8 +2636,8 @@ int index_fd(struct index_state *istate, struct object_id *oid,
                ret = index_core(istate, oid, fd, xsize_t(st->st_size),
                                 type, path, flags);
        else
-               ret = index_stream(oid, fd, xsize_t(st->st_size), type, path,
-                                  flags);
+               ret = index_blob_stream(oid, fd, xsize_t(st->st_size), path,
+                                       flags);
        close(fd);
        return ret;
 }
index 7dd6e5e47566ccd1b2e10350b40b0e8a1a0b93ae..523af6f64f33512d1d7587bf0ce96cbe23b63b94 100644 (file)
@@ -8,7 +8,6 @@
 #include "tag.h"
 #include "commit.h"
 #include "tree.h"
-#include "blob.h"
 #include "tree-walk.h"
 #include "refs.h"
 #include "remote.h"
@@ -21,7 +20,6 @@
 #include "read-cache-ll.h"
 #include "repository.h"
 #include "setup.h"
-#include "submodule.h"
 #include "midx.h"
 #include "commit-reach.h"
 #include "date.h"
@@ -1060,6 +1058,15 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
                                                len, str,
                                                show_date(co_time, co_tz, DATE_MODE(RFC2822)));
                                }
+                       } else if (nth == co_cnt && !is_null_oid(oid)) {
+                               /*
+                                * We were asked for the Nth reflog (counting
+                                * from 0), but there were only N entries.
+                                * read_ref_at() will have returned "1" to tell
+                                * us it did not find an entry, but it did
+                                * still fill in the oid with the "old" value,
+                                * which we can use.
+                                */
                        } else {
                                if (flags & GET_OID_QUIETLY) {
                                        exit(128);
@@ -1505,7 +1512,7 @@ int repo_get_oid_mb(struct repository *r,
                    struct object_id *oid)
 {
        struct commit *one, *two;
-       struct commit_list *mbs;
+       struct commit_list *mbs = NULL;
        struct object_id oid_tmp;
        const char *dots;
        int st;
@@ -1533,7 +1540,10 @@ int repo_get_oid_mb(struct repository *r,
        two = lookup_commit_reference_gently(r, &oid_tmp, 0);
        if (!two)
                return -1;
-       mbs = repo_get_merge_bases(r, one, two);
+       if (repo_get_merge_bases(r, one, two, &mbs) < 0) {
+               free_commit_list(mbs);
+               return -1;
+       }
        if (!mbs || mbs->next)
                st = -1;
        else {
index 186a0a47c0fbd28836552baab3440e2468879514..51e384828e96efa9b3a9cbf96f5cf8b1b719856e 100644 (file)
--- a/object.c
+++ b/object.c
@@ -48,8 +48,7 @@ int type_from_string_gently(const char *str, ssize_t len, int gentle)
                len = strlen(str);
 
        for (i = 1; i < ARRAY_SIZE(object_type_strings); i++)
-               if (!strncmp(str, object_type_strings[i], len) &&
-                   object_type_strings[i][len] == '\0')
+               if (!xstrncmpz(object_type_strings[i], str, len))
                        return i;
 
        if (gentle)
@@ -273,6 +272,7 @@ struct object *parse_object_with_flags(struct repository *r,
                                       enum parse_object_flags flags)
 {
        int skip_hash = !!(flags & PARSE_OBJECT_SKIP_HASH_CHECK);
+       int discard_tree = !!(flags & PARSE_OBJECT_DISCARD_TREE);
        unsigned long size;
        enum object_type type;
        int eaten;
@@ -300,6 +300,17 @@ struct object *parse_object_with_flags(struct repository *r,
                return lookup_object(r, oid);
        }
 
+       /*
+        * If the caller does not care about the tree buffer and does not
+        * care about checking the hash, we can simply verify that we
+        * have the on-disk object with the correct type.
+        */
+       if (skip_hash && discard_tree &&
+           (!obj || obj->type == OBJ_TREE) &&
+           oid_object_info(r, oid, NULL) == OBJ_TREE) {
+               return &lookup_tree(r, oid)->object;
+       }
+
        buffer = repo_read_object_file(r, oid, &type, &size);
        if (buffer) {
                if (!skip_hash &&
@@ -313,6 +324,8 @@ struct object *parse_object_with_flags(struct repository *r,
                                          buffer, &eaten);
                if (!eaten)
                        free(buffer);
+               if (discard_tree && type == OBJ_TREE)
+                       free_tree_buffer((struct tree *)obj);
                return obj;
        }
        return NULL;
index 70c8d4ae63dc531fa2bb7a548da53708b76ad17b..9293e703cccc6acf6205be9c5fae440fff441d5a 100644 (file)
--- a/object.h
+++ b/object.h
@@ -215,6 +215,7 @@ static inline const char *parse_mode(const char *str, uint16_t *modep)
  */
 enum parse_object_flags {
        PARSE_OBJECT_SKIP_HASH_CHECK = 1 << 0,
+       PARSE_OBJECT_DISCARD_TREE = 1 << 1,
 };
 struct object *parse_object(struct repository *r, const struct object_id *oid);
 struct object *parse_object_with_flags(struct repository *r,
index d1e5376316ecd5f9dcf549e1067697283bdc712c..91d13859106a1bc56632aeedd4030a007608a359 100644 (file)
--- a/oidset.c
+++ b/oidset.c
@@ -23,6 +23,16 @@ int oidset_insert(struct oidset *set, const struct object_id *oid)
        return !added;
 }
 
+void oidset_insert_from_set(struct oidset *dest, struct oidset *src)
+{
+       struct oidset_iter iter;
+       struct object_id *src_oid;
+
+       oidset_iter_init(src, &iter);
+       while ((src_oid = oidset_iter_next(&iter)))
+               oidset_insert(dest, src_oid);
+}
+
 int oidset_remove(struct oidset *set, const struct object_id *oid)
 {
        khiter_t pos = kh_get_oid_set(&set->set, *oid);
index ba4a5a2cd3a7a233bc9ca2cb7cf4a58a1e5a122c..262f4256d6ac5ad39e1cef4a39e36716e817d651 100644 (file)
--- a/oidset.h
+++ b/oidset.h
@@ -47,6 +47,12 @@ int oidset_contains(const struct oidset *set, const struct object_id *oid);
  */
 int oidset_insert(struct oidset *set, const struct object_id *oid);
 
+/**
+ * Insert all the oids that are in set 'src' into set 'dest'; a copy
+ * is made of each oid inserted into set 'dest'.
+ */
+void oidset_insert_from_set(struct oidset *dest, struct oidset *src);
+
 /**
  * Remove the oid from the set.
  *
index 9acb74412ef0fc28589262b392c9d56c7d381137..5b954088254b21a6cbc90b41d0dac415a552d6b7 100644 (file)
@@ -1,3 +1,4 @@
 fuzz-commit-graph
+fuzz-date
 fuzz-pack-headers
 fuzz-pack-idx
diff --git a/oss-fuzz/dummy-cmd-main.c b/oss-fuzz/dummy-cmd-main.c
new file mode 100644 (file)
index 0000000..071cb23
--- /dev/null
@@ -0,0 +1,14 @@
+#include "git-compat-util.h"
+
+/*
+ * When linking the fuzzers, we link against common-main.o to pick up some
+ * symbols. However, even though we ignore common-main:main(), we still need to
+ * provide all the symbols it references. In the fuzzers' case, we need to
+ * provide a dummy cmd_main() for the linker to be happy. It will never be
+ * executed.
+ */
+
+int cmd_main(int argc, const char **argv) {
+       BUG("We should not execute cmd_main() from a fuzz target");
+       return 1;
+}
diff --git a/oss-fuzz/fuzz-date.c b/oss-fuzz/fuzz-date.c
new file mode 100644 (file)
index 0000000..036378b
--- /dev/null
@@ -0,0 +1,49 @@
+#include "git-compat-util.h"
+#include "date.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+       int local;
+       int num;
+       char *str;
+       int16_t tz;
+       timestamp_t ts;
+       enum date_mode_type dmtype;
+       struct date_mode *dm;
+
+       if (size <= 4)
+               /*
+                * we use the first byte to fuzz dmtype and the
+                * second byte to fuzz local, then the next two
+                * bytes to fuzz tz offset. The remainder
+                * (at least one byte) is fed as input to
+                * approxidate_careful().
+                */
+               return 0;
+
+       local = !!(*data++ & 0x10);
+       num = *data++ % DATE_UNIX;
+       if (num >= DATE_STRFTIME)
+               num++;
+       dmtype = (enum date_mode_type)num;
+       size -= 2;
+
+       tz = *data++;
+       tz = (tz << 8) | *data++;
+       size -= 2;
+
+       str = xmemdupz(data, size);
+
+       ts = approxidate_careful(str, &num);
+       free(str);
+
+       dm = date_mode_from_type(dmtype);
+       dm->local = local;
+       show_date(ts, (int)tz, dm);
+
+       date_mode_release(dm);
+
+       return 0;
+}
index 9211e08f01273adab0ff65c19ea93e993c2e9754..c6c8f94cc514476a5a6f543cbb86a260020e9753 100644 (file)
@@ -4,12 +4,9 @@
 #include "hex.h"
 #include "object-store-ll.h"
 #include "commit.h"
-#include "tag.h"
 #include "diff.h"
 #include "revision.h"
-#include "list-objects.h"
 #include "progress.h"
-#include "pack-revindex.h"
 #include "pack.h"
 #include "pack-bitmap.h"
 #include "hash-lookup.h"
@@ -198,6 +195,13 @@ struct bb_commit {
        unsigned idx; /* within selected array */
 };
 
+static void clear_bb_commit(struct bb_commit *commit)
+{
+       free_commit_list(commit->reverse_edges);
+       bitmap_free(commit->commit_mask);
+       bitmap_free(commit->bitmap);
+}
+
 define_commit_slab(bb_data, struct bb_commit);
 
 struct bitmap_builder {
@@ -339,7 +343,7 @@ next:
 
 static void bitmap_builder_clear(struct bitmap_builder *bb)
 {
-       clear_bb_data(&bb->data);
+       deep_clear_bb_data(&bb->data, clear_bb_commit);
        free(bb->commits);
        bb->commits_nr = bb->commits_alloc = 0;
 }
@@ -413,15 +417,19 @@ static int fill_bitmap_commit(struct bb_commit *ent,
 
                if (old_bitmap && mapping) {
                        struct ewah_bitmap *old = bitmap_for_commit(old_bitmap, c);
+                       struct bitmap *remapped = bitmap_new();
                        /*
                         * If this commit has an old bitmap, then translate that
                         * bitmap and add its bits to this one. No need to walk
                         * parents or the tree for this commit.
                         */
-                       if (old && !rebuild_bitmap(mapping, old, ent->bitmap)) {
+                       if (old && !rebuild_bitmap(mapping, old, remapped)) {
+                               bitmap_or(ent->bitmap, remapped);
+                               bitmap_free(remapped);
                                reused_bitmaps_nr++;
                                continue;
                        }
+                       bitmap_free(remapped);
                }
 
                /*
index 6afc03d1e4c39e53c1c48deb51c16d65667979e8..2baeabacee13d4ec5311261499fe10d8f0a882e5 100644 (file)
@@ -51,13 +51,6 @@ struct bitmap_index {
        struct packed_git *pack;
        struct multi_pack_index *midx;
 
-       /*
-        * Mark the first `reuse_objects` in the packfile as reused:
-        * they will be sent as-is without using them for repacking
-        * calculations
-        */
-       uint32_t reuse_objects;
-
        /* mmapped buffer of the whole bitmap index */
        unsigned char *map;
        size_t map_size; /* size of the mmaped buffer */
@@ -338,7 +331,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
        struct stat st;
        char *bitmap_name = midx_bitmap_filename(midx);
        int fd = git_open(bitmap_name);
-       uint32_t i;
+       uint32_t i, preferred_pack;
        struct packed_git *preferred;
 
        if (fd < 0) {
@@ -393,7 +386,12 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
                }
        }
 
-       preferred = bitmap_git->midx->packs[midx_preferred_pack(bitmap_git)];
+       if (midx_preferred_pack(bitmap_git->midx, &preferred_pack) < 0) {
+               warning(_("could not determine MIDX preferred pack"));
+               goto cleanup;
+       }
+
+       preferred = bitmap_git->midx->packs[preferred_pack];
        if (!is_pack_valid(preferred)) {
                warning(_("preferred pack (%s) is invalid"),
                        preferred->pack_name);
@@ -1101,8 +1099,9 @@ static void show_boundary_commit(struct commit *commit, void *_data)
        }
 }
 
-static void show_boundary_object(struct object *object,
-                                const char *name, void *data)
+static void show_boundary_object(struct object *object UNUSED,
+                                const char *name UNUSED,
+                                void *data UNUSED)
 {
        BUG("should not be called");
 }
@@ -1279,6 +1278,8 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
                base = fill_in_bitmap(bitmap_git, revs, base, seen);
        }
 
+       object_list_free(&not_mapped);
+
        return base;
 }
 
@@ -1665,6 +1666,30 @@ static int can_filter_bitmap(struct list_objects_filter_options *filter)
        return !filter_bitmap(NULL, NULL, NULL, filter);
 }
 
+
+static void filter_packed_objects_from_bitmap(struct bitmap_index *bitmap_git,
+                                             struct bitmap *result)
+{
+       struct eindex *eindex = &bitmap_git->ext_index;
+       uint32_t objects_nr;
+       size_t i, pos;
+
+       objects_nr = bitmap_num_objects(bitmap_git);
+       pos = objects_nr / BITS_IN_EWORD;
+
+       if (pos > result->word_alloc)
+               pos = result->word_alloc;
+
+       memset(result->words, 0x00, sizeof(eword_t) * pos);
+       for (i = pos * BITS_IN_EWORD; i < objects_nr; i++)
+               bitmap_unset(result, i);
+
+       for (i = 0; i < eindex->count; ++i) {
+               if (has_object_pack(&eindex->objects[i]->oid))
+                       bitmap_unset(result, objects_nr + i);
+       }
+}
+
 struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
                                         int filter_provided_objects)
 {
@@ -1787,6 +1812,9 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
                      wants_bitmap,
                      &revs->filter);
 
+       if (revs->unpacked)
+               filter_packed_objects_from_bitmap(bitmap_git, wants_bitmap);
+
        bitmap_git->result = wants_bitmap;
        bitmap_git->haves = haves_bitmap;
 
@@ -1806,8 +1834,10 @@ cleanup:
  * -1 means "stop trying further objects"; 0 means we may or may not have
  * reused, but you can keep feeding bits.
  */
-static int try_partial_reuse(struct packed_git *pack,
-                            size_t pos,
+static int try_partial_reuse(struct bitmap_index *bitmap_git,
+                            struct bitmapped_pack *pack,
+                            size_t bitmap_pos,
+                            uint32_t pack_pos,
                             struct bitmap *reuse,
                             struct pack_window **w_curs)
 {
@@ -1815,40 +1845,18 @@ static int try_partial_reuse(struct packed_git *pack,
        enum object_type type;
        unsigned long size;
 
-       /*
-        * try_partial_reuse() is called either on (a) objects in the
-        * bitmapped pack (in the case of a single-pack bitmap) or (b)
-        * objects in the preferred pack of a multi-pack bitmap.
-        * Importantly, the latter can pretend as if only a single pack
-        * exists because:
-        *
-        *   - The first pack->num_objects bits of a MIDX bitmap are
-        *     reserved for the preferred pack, and
-        *
-        *   - Ties due to duplicate objects are always resolved in
-        *     favor of the preferred pack.
-        *
-        * Therefore we do not need to ever ask the MIDX for its copy of
-        * an object by OID, since it will always select it from the
-        * preferred pack. Likewise, the selected copy of the base
-        * object for any deltas will reside in the same pack.
-        *
-        * This means that we can reuse pos when looking up the bit in
-        * the reuse bitmap, too, since bits corresponding to the
-        * preferred pack precede all bits from other packs.
-        */
+       if (pack_pos >= pack->p->num_objects)
+               return -1; /* not actually in the pack */
 
-       if (pos >= pack->num_objects)
-               return -1; /* not actually in the pack or MIDX preferred pack */
-
-       offset = delta_obj_offset = pack_pos_to_offset(pack, pos);
-       type = unpack_object_header(pack, w_curs, &offset, &size);
+       offset = delta_obj_offset = pack_pos_to_offset(pack->p, pack_pos);
+       type = unpack_object_header(pack->p, w_curs, &offset, &size);
        if (type < 0)
                return -1; /* broken packfile, punt */
 
        if (type == OBJ_REF_DELTA || type == OBJ_OFS_DELTA) {
                off_t base_offset;
                uint32_t base_pos;
+               uint32_t base_bitmap_pos;
 
                /*
                 * Find the position of the base object so we can look it up
@@ -1858,24 +1866,48 @@ static int try_partial_reuse(struct packed_git *pack,
                 * and the normal slow path will complain about it in
                 * more detail.
                 */
-               base_offset = get_delta_base(pack, w_curs, &offset, type,
+               base_offset = get_delta_base(pack->p, w_curs, &offset, type,
                                             delta_obj_offset);
                if (!base_offset)
                        return 0;
-               if (offset_to_pack_pos(pack, base_offset, &base_pos) < 0)
-                       return 0;
 
-               /*
-                * We assume delta dependencies always point backwards. This
-                * lets us do a single pass, and is basically always true
-                * due to the way OFS_DELTAs work. You would not typically
-                * find REF_DELTA in a bitmapped pack, since we only bitmap
-                * packs we write fresh, and OFS_DELTA is the default). But
-                * let's double check to make sure the pack wasn't written with
-                * odd parameters.
-                */
-               if (base_pos >= pos)
-                       return 0;
+               offset_to_pack_pos(pack->p, base_offset, &base_pos);
+
+               if (bitmap_is_midx(bitmap_git)) {
+                       /*
+                        * Cross-pack deltas are rejected for now, but could
+                        * theoretically be supported in the future.
+                        *
+                        * We would need to ensure that we're sending both
+                        * halves of the delta/base pair, regardless of whether
+                        * or not the two cross a pack boundary. If they do,
+                        * then we must convert the delta to an REF_DELTA to
+                        * refer back to the base in the other pack.
+                        * */
+                       if (midx_pair_to_pack_pos(bitmap_git->midx,
+                                                 pack->pack_int_id,
+                                                 base_offset,
+                                                 &base_bitmap_pos) < 0) {
+                               return 0;
+                       }
+               } else {
+                       if (offset_to_pack_pos(pack->p, base_offset,
+                                              &base_pos) < 0)
+                               return 0;
+                       /*
+                        * We assume delta dependencies always point backwards.
+                        * This lets us do a single pass, and is basically
+                        * always true due to the way OFS_DELTAs work. You would
+                        * not typically find REF_DELTA in a bitmapped pack,
+                        * since we only bitmap packs we write fresh, and
+                        * OFS_DELTA is the default). But let's double check to
+                        * make sure the pack wasn't written with odd
+                        * parameters.
+                        */
+                       if (base_pos >= pack_pos)
+                               return 0;
+                       base_bitmap_pos = pack->bitmap_pos + base_pos;
+               }
 
                /*
                 * And finally, if we're not sending the base as part of our
@@ -1885,77 +1917,89 @@ static int try_partial_reuse(struct packed_git *pack,
                 * to REF_DELTA on the fly. Better to just let the normal
                 * object_entry code path handle it.
                 */
-               if (!bitmap_get(reuse, base_pos))
+               if (!bitmap_get(reuse, base_bitmap_pos))
                        return 0;
        }
 
        /*
         * If we got here, then the object is OK to reuse. Mark it.
         */
-       bitmap_set(reuse, pos);
+       bitmap_set(reuse, bitmap_pos);
        return 0;
 }
 
-uint32_t midx_preferred_pack(struct bitmap_index *bitmap_git)
+static void reuse_partial_packfile_from_bitmap_1(struct bitmap_index *bitmap_git,
+                                                struct bitmapped_pack *pack,
+                                                struct bitmap *reuse)
 {
-       struct multi_pack_index *m = bitmap_git->midx;
-       if (!m)
-               BUG("midx_preferred_pack: requires non-empty MIDX");
-       return nth_midxed_pack_int_id(m, pack_pos_to_midx(bitmap_git->midx, 0));
-}
-
-int reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
-                                      struct packed_git **packfile_out,
-                                      uint32_t *entries,
-                                      struct bitmap **reuse_out)
-{
-       struct repository *r = the_repository;
-       struct packed_git *pack;
        struct bitmap *result = bitmap_git->result;
-       struct bitmap *reuse;
        struct pack_window *w_curs = NULL;
-       size_t i = 0;
-       uint32_t offset;
-       uint32_t objects_nr;
+       size_t pos = pack->bitmap_pos / BITS_IN_EWORD;
 
-       assert(result);
+       if (!pack->bitmap_pos) {
+               /*
+                * If we're processing the first (in the case of a MIDX, the
+                * preferred pack) or the only (in the case of single-pack
+                * bitmaps) pack, then we can reuse whole words at a time.
+                *
+                * This is because we know that any deltas in this range *must*
+                * have their bases chosen from the same pack, since:
+                *
+                * - In the single pack case, there is no other pack to choose
+                *   them from.
+                *
+                * - In the MIDX case, the first pack is the preferred pack, so
+                *   all ties are broken in favor of that pack (i.e. the one
+                *   we're currently processing). So any duplicate bases will be
+                *   resolved in favor of the pack we're processing.
+                */
+               while (pos < result->word_alloc &&
+                      pos < pack->bitmap_nr / BITS_IN_EWORD &&
+                      result->words[pos] == (eword_t)~0)
+                       pos++;
+               memset(reuse->words, 0xFF, pos * sizeof(eword_t));
+       }
 
-       load_reverse_index(r, bitmap_git);
+       for (; pos < result->word_alloc; pos++) {
+               eword_t word = result->words[pos];
+               size_t offset;
 
-       if (bitmap_is_midx(bitmap_git))
-               pack = bitmap_git->midx->packs[midx_preferred_pack(bitmap_git)];
-       else
-               pack = bitmap_git->pack;
-       objects_nr = pack->num_objects;
+               for (offset = 0; offset < BITS_IN_EWORD; offset++) {
+                       size_t bit_pos;
+                       uint32_t pack_pos;
 
-       while (i < result->word_alloc && result->words[i] == (eword_t)~0)
-               i++;
+                       if (word >> offset == 0)
+                               break;
 
-       /*
-        * Don't mark objects not in the packfile or preferred pack. This bitmap
-        * marks objects eligible for reuse, but the pack-reuse code only
-        * understands how to reuse a single pack. Since the preferred pack is
-        * guaranteed to have all bases for its deltas (in a multi-pack bitmap),
-        * we use it instead of another pack. In single-pack bitmaps, the choice
-        * is made for us.
-        */
-       if (i > objects_nr / BITS_IN_EWORD)
-               i = objects_nr / BITS_IN_EWORD;
+                       offset += ewah_bit_ctz64(word >> offset);
 
-       reuse = bitmap_word_alloc(i);
-       memset(reuse->words, 0xFF, i * sizeof(eword_t));
+                       bit_pos = pos * BITS_IN_EWORD + offset;
+                       if (bit_pos < pack->bitmap_pos)
+                               continue;
+                       if (bit_pos >= pack->bitmap_pos + pack->bitmap_nr)
+                               goto done;
 
-       for (; i < result->word_alloc; ++i) {
-               eword_t word = result->words[i];
-               size_t pos = (i * BITS_IN_EWORD);
+                       if (bitmap_is_midx(bitmap_git)) {
+                               uint32_t midx_pos;
+                               off_t ofs;
 
-               for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
-                       if ((word >> offset) == 0)
-                               break;
+                               midx_pos = pack_pos_to_midx(bitmap_git->midx, bit_pos);
+                               ofs = nth_midxed_offset(bitmap_git->midx, midx_pos);
 
-                       offset += ewah_bit_ctz64(word >> offset);
-                       if (try_partial_reuse(pack, pos + offset,
-                                             reuse, &w_curs) < 0) {
+                               if (offset_to_pack_pos(pack->p, ofs, &pack_pos) < 0)
+                                       BUG("could not find object in pack %s "
+                                           "at offset %"PRIuMAX" in MIDX",
+                                           pack_basename(pack->p), (uintmax_t)ofs);
+                       } else {
+                               pack_pos = cast_size_t_to_uint32_t(st_sub(bit_pos, pack->bitmap_pos));
+                               if (pack_pos >= pack->p->num_objects)
+                                       BUG("advanced beyond the end of pack %s (%"PRIuMAX" > %"PRIu32")",
+                                           pack_basename(pack->p), (uintmax_t)pack_pos,
+                                           pack->p->num_objects);
+                       }
+
+                       if (try_partial_reuse(bitmap_git, pack, bit_pos,
+                                             pack_pos, reuse, &w_curs) < 0) {
                                /*
                                 * try_partial_reuse indicated we couldn't reuse
                                 * any bits, so there is no point in trying more
@@ -1972,11 +2016,97 @@ int reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
 
 done:
        unuse_pack(&w_curs);
+}
 
-       *entries = bitmap_popcount(reuse);
-       if (!*entries) {
-               bitmap_free(reuse);
+static int bitmapped_pack_cmp(const void *va, const void *vb)
+{
+       const struct bitmapped_pack *a = va;
+       const struct bitmapped_pack *b = vb;
+
+       if (a->bitmap_pos < b->bitmap_pos)
                return -1;
+       if (a->bitmap_pos > b->bitmap_pos)
+               return 1;
+       return 0;
+}
+
+void reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
+                                       struct bitmapped_pack **packs_out,
+                                       size_t *packs_nr_out,
+                                       struct bitmap **reuse_out,
+                                       int multi_pack_reuse)
+{
+       struct repository *r = the_repository;
+       struct bitmapped_pack *packs = NULL;
+       struct bitmap *result = bitmap_git->result;
+       struct bitmap *reuse;
+       size_t i;
+       size_t packs_nr = 0, packs_alloc = 0;
+       size_t word_alloc;
+       uint32_t objects_nr = 0;
+
+       assert(result);
+
+       load_reverse_index(r, bitmap_git);
+
+       if (bitmap_is_midx(bitmap_git)) {
+               for (i = 0; i < bitmap_git->midx->num_packs; i++) {
+                       struct bitmapped_pack pack;
+                       if (nth_bitmapped_pack(r, bitmap_git->midx, &pack, i) < 0) {
+                               warning(_("unable to load pack: '%s', disabling pack-reuse"),
+                                       bitmap_git->midx->pack_names[i]);
+                               free(packs);
+                               return;
+                       }
+
+                       if (!pack.bitmap_nr)
+                               continue;
+
+                       if (!multi_pack_reuse && pack.bitmap_pos) {
+                               /*
+                                * If we're only reusing a single pack, skip
+                                * over any packs which are not positioned at
+                                * the beginning of the MIDX bitmap.
+                                *
+                                * This is consistent with the existing
+                                * single-pack reuse behavior, which only reuses
+                                * parts of the MIDX's preferred pack.
+                                */
+                               continue;
+                       }
+
+                       ALLOC_GROW(packs, packs_nr + 1, packs_alloc);
+                       memcpy(&packs[packs_nr++], &pack, sizeof(pack));
+
+                       objects_nr += pack.p->num_objects;
+
+                       if (!multi_pack_reuse)
+                               break;
+               }
+
+               QSORT(packs, packs_nr, bitmapped_pack_cmp);
+       } else {
+               ALLOC_GROW(packs, packs_nr + 1, packs_alloc);
+
+               packs[packs_nr].p = bitmap_git->pack;
+               packs[packs_nr].bitmap_nr = bitmap_git->pack->num_objects;
+               packs[packs_nr].bitmap_pos = 0;
+
+               objects_nr = packs[packs_nr++].bitmap_nr;
+       }
+
+       word_alloc = objects_nr / BITS_IN_EWORD;
+       if (objects_nr % BITS_IN_EWORD)
+               word_alloc++;
+       reuse = bitmap_word_alloc(word_alloc);
+
+       for (i = 0; i < packs_nr; i++)
+               reuse_partial_packfile_from_bitmap_1(bitmap_git, &packs[i], reuse);
+
+       if (bitmap_is_empty(reuse)) {
+               free(packs);
+               bitmap_free(reuse);
+               return;
        }
 
        /*
@@ -1984,9 +2114,9 @@ done:
         * need to be handled separately.
         */
        bitmap_and_not(result, reuse);
-       *packfile_out = pack;
+       *packs_out = packs;
+       *packs_nr_out = packs_nr;
        *reuse_out = reuse;
-       return 0;
 }
 
 int bitmap_walk_contains(struct bitmap_index *bitmap_git,
index 5273a6a019708c8295be8e4fa5ca11db342f3a40..c7dea13217a00ef544d16a45d0f78de8f0e8ebc0 100644 (file)
@@ -52,6 +52,15 @@ typedef int (*show_reachable_fn)(
 
 struct bitmap_index;
 
+struct bitmapped_pack {
+       struct packed_git *p;
+
+       uint32_t bitmap_pos;
+       uint32_t bitmap_nr;
+
+       uint32_t pack_int_id; /* MIDX only */
+};
+
 struct bitmap_index *prepare_bitmap_git(struct repository *r);
 struct bitmap_index *prepare_midx_bitmap_git(struct multi_pack_index *midx);
 void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,
@@ -68,11 +77,11 @@ int test_bitmap_hashes(struct repository *r);
 
 struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
                                         int filter_provided_objects);
-uint32_t midx_preferred_pack(struct bitmap_index *bitmap_git);
-int reuse_partial_packfile_from_bitmap(struct bitmap_index *,
-                                      struct packed_git **packfile,
-                                      uint32_t *entries,
-                                      struct bitmap **reuse_out);
+void reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
+                                       struct bitmapped_pack **packs_out,
+                                       size_t *packs_nr_out,
+                                       struct bitmap **reuse_out,
+                                       int multi_pack_reuse);
 int rebuild_existing_bitmaps(struct bitmap_index *, struct packing_data *mapping,
                             kh_oid_map_t *reused_bitmaps, int show_progress);
 void free_bitmap_index(struct bitmap_index *);
index 977f619618e0a9b97044f0b07e5617d3b3e1839b..25104d5b14c1e8f9a9988f106a1ad1a6823ca31c 100644 (file)
@@ -3,7 +3,6 @@
 #include "hex.h"
 #include "repository.h"
 #include "pack.h"
-#include "pack-revindex.h"
 #include "progress.h"
 #include "packfile.h"
 #include "object-file.h"
index 1b8052bececc1f9b0a2ef53f04d70334c1b57314..a9d9855063aea85f4b1b8f70f301c644c5d5e225 100644 (file)
@@ -3,7 +3,7 @@
 #include "pack.h"
 #include "pack-objects.h"
 #include "packfile.h"
-#include "config.h"
+#include "parse.h"
 
 static uint32_t locate_object_entry_hash(struct packing_data *pdata,
                                         const struct object_id *oid,
@@ -151,6 +151,21 @@ void prepare_packing_data(struct repository *r, struct packing_data *pdata)
        init_recursive_mutex(&pdata->odb_lock);
 }
 
+void clear_packing_data(struct packing_data *pdata)
+{
+       if (!pdata)
+               return;
+
+       free(pdata->cruft_mtime);
+       free(pdata->in_pack);
+       free(pdata->in_pack_by_idx);
+       free(pdata->in_pack_pos);
+       free(pdata->index);
+       free(pdata->layer);
+       free(pdata->objects);
+       free(pdata->tree_depth);
+}
+
 struct object_entry *packlist_alloc(struct packing_data *pdata,
                                    const struct object_id *oid)
 {
index 0d78db40cb2f11fcbc4b3c2bbb2d23624ef3f22e..b9898a4e64b8b4d53b21ea776c16f79d9794efef 100644 (file)
@@ -169,6 +169,7 @@ struct packing_data {
 };
 
 void prepare_packing_data(struct repository *r, struct packing_data *pdata);
+void clear_packing_data(struct packing_data *pdata);
 
 /* Protect access to object database */
 static inline void packing_data_lock(struct packing_data *pdata)
index 7fffcad9125610cb05a5823b03b86d3e28eeabdb..a7624d8be8e58e0807cf0b2dc5e3bae52ac53af9 100644 (file)
@@ -6,7 +6,7 @@
 #include "packfile.h"
 #include "strbuf.h"
 #include "trace2.h"
-#include "config.h"
+#include "parse.h"
 #include "midx.h"
 #include "csum-file.h"
 
@@ -343,6 +343,17 @@ int verify_pack_revindex(struct packed_git *p)
        return res;
 }
 
+static int can_use_midx_ridx_chunk(struct multi_pack_index *m)
+{
+       if (!m->chunk_revindex)
+               return 0;
+       if (m->chunk_revindex_len != st_mult(sizeof(uint32_t), m->num_objects)) {
+               error(_("multi-pack-index reverse-index chunk is the wrong size"));
+               return 0;
+       }
+       return 1;
+}
+
 int load_midx_revindex(struct multi_pack_index *m)
 {
        struct strbuf revindex_name = STRBUF_INIT;
@@ -351,7 +362,7 @@ int load_midx_revindex(struct multi_pack_index *m)
        if (m->revindex_data)
                return 0;
 
-       if (m->chunk_revindex) {
+       if (can_use_midx_ridx_chunk(m)) {
                /*
                 * If the MIDX `m` has a `RIDX` chunk, then use its contents for
                 * the reverse index instead of trying to load a separate `.rev`
@@ -509,19 +520,12 @@ static int midx_pack_order_cmp(const void *va, const void *vb)
        return 0;
 }
 
-int midx_to_pack_pos(struct multi_pack_index *m, uint32_t at, uint32_t *pos)
+static int midx_key_to_pack_pos(struct multi_pack_index *m,
+                               struct midx_pack_key *key,
+                               uint32_t *pos)
 {
-       struct midx_pack_key key;
        uint32_t *found;
 
-       if (!m->revindex_data)
-               BUG("midx_to_pack_pos: reverse index not yet loaded");
-       if (m->num_objects <= at)
-               BUG("midx_to_pack_pos: out-of-bounds object at %"PRIu32, at);
-
-       key.pack = nth_midxed_pack_int_id(m, at);
-       key.offset = nth_midxed_offset(m, at);
-       key.midx = m;
        /*
         * The preferred pack sorts first, so determine its identifier by
         * looking at the first object in pseudo-pack order.
@@ -531,14 +535,43 @@ int midx_to_pack_pos(struct multi_pack_index *m, uint32_t at, uint32_t *pos)
         * implicitly is preferred (and includes all its objects, since ties are
         * broken first by pack identifier).
         */
-       key.preferred_pack = nth_midxed_pack_int_id(m, pack_pos_to_midx(m, 0));
+       if (midx_preferred_pack(key->midx, &key->preferred_pack) < 0)
+               return error(_("could not determine preferred pack"));
 
-       found = bsearch(&key, m->revindex_data, m->num_objects,
-                       sizeof(*m->revindex_data), midx_pack_order_cmp);
+       found = bsearch(key, m->revindex_data, m->num_objects,
+                       sizeof(*m->revindex_data),
+                       midx_pack_order_cmp);
 
        if (!found)
-               return error("bad offset for revindex");
+               return -1;
 
        *pos = found - m->revindex_data;
        return 0;
 }
+
+int midx_to_pack_pos(struct multi_pack_index *m, uint32_t at, uint32_t *pos)
+{
+       struct midx_pack_key key;
+
+       if (!m->revindex_data)
+               BUG("midx_to_pack_pos: reverse index not yet loaded");
+       if (m->num_objects <= at)
+               BUG("midx_to_pack_pos: out-of-bounds object at %"PRIu32, at);
+
+       key.pack = nth_midxed_pack_int_id(m, at);
+       key.offset = nth_midxed_offset(m, at);
+       key.midx = m;
+
+       return midx_key_to_pack_pos(m, &key, pos);
+}
+
+int midx_pair_to_pack_pos(struct multi_pack_index *m, uint32_t pack_int_id,
+                         off_t ofs, uint32_t *pos)
+{
+       struct midx_pack_key key = {
+               .pack = pack_int_id,
+               .offset = ofs,
+               .midx = m,
+       };
+       return midx_key_to_pack_pos(m, &key, pos);
+}
index 6dd47efea10ec69a3438f0a804a71bf13cd91c37..422c2487ae32d8a4500f4a151ca673364fed96a0 100644 (file)
@@ -142,4 +142,7 @@ uint32_t pack_pos_to_midx(struct multi_pack_index *m, uint32_t pos);
  */
 int midx_to_pack_pos(struct multi_pack_index *midx, uint32_t at, uint32_t *pos);
 
+int midx_pair_to_pack_pos(struct multi_pack_index *midx, uint32_t pack_id,
+                         off_t ofs, uint32_t *pos);
+
 #endif
index b19ddf15b284868acd7ad9123aed8fba10d08d30..80ecfa544c5d9f7980adfad829e32cabd281ecc4 100644 (file)
@@ -7,7 +7,6 @@
 #include "remote.h"
 #include "chunk-format.h"
 #include "pack-mtimes.h"
-#include "oidmap.h"
 #include "pack-objects.h"
 #include "pack-revindex.h"
 #include "path.h"
index 1fae0fcdd9e73ee2e2d2cd8c57b9959f9644c4f5..d4df7fdeea56ffe63fd1738d227b509bca2d553a 100644 (file)
@@ -9,7 +9,6 @@
 #include "mergesort.h"
 #include "packfile.h"
 #include "delta.h"
-#include "streaming.h"
 #include "hash-lookup.h"
 #include "commit.h"
 #include "object.h"
index c3692308b8dc866b2b99b2ed9b983db4d6d1352b..28c8fd3e39a23ae997a66a11dfd0d5d281dbc28f 100644 (file)
@@ -54,7 +54,7 @@ const char *pack_basename(struct packed_git *p);
 struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);
 
 typedef void each_file_in_pack_dir_fn(const char *full_path, size_t full_path_len,
-                                     const char *file_pach, void *data);
+                                     const char *file_name, void *data);
 void for_each_file_in_pack_dir(const char *objdir,
                               each_file_in_pack_dir_fn fn,
                               void *data);
index a24521dee0fca3de6284a9c59cd3bd8cefdb4942..bdc7fae49719dfef060739854ae7491045afb6f2 100644 (file)
@@ -227,7 +227,9 @@ int parse_opt_strvec(const struct option *opt, const char *arg, int unset)
        return 0;
 }
 
-int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset)
+int parse_opt_noop_cb(const struct option *opt UNUSED,
+                     const char *arg UNUSED,
+                     int unset UNUSED)
 {
        return 0;
 }
index 60224cf8d03fb1764ad26da422f7158898b631ea..30b9e68f8ac85df1c6700d7a512eef618988b06c 100644 (file)
@@ -1,11 +1,10 @@
 #include "git-compat-util.h"
 #include "parse-options.h"
 #include "abspath.h"
-#include "config.h"
-#include "commit.h"
-#include "color.h"
+#include "parse.h"
 #include "gettext.h"
 #include "strbuf.h"
+#include "string-list.h"
 #include "utf8.h"
 
 static int disallow_abbreviated_options;
@@ -69,42 +68,10 @@ static void fix_filename(const char *prefix, char **file)
                *file = prefix_filename_except_for_dash(prefix, *file);
 }
 
-static enum parse_opt_result opt_command_mode_error(
-       const struct option *opt,
-       const struct option *all_opts,
-       enum opt_parsed flags)
-{
-       const struct option *that;
-       struct strbuf that_name = STRBUF_INIT;
-
-       /*
-        * Find the other option that was used to set the variable
-        * already, and report that this is not compatible with it.
-        */
-       for (that = all_opts; that->type != OPTION_END; that++) {
-               if (that == opt ||
-                   !(that->flags & PARSE_OPT_CMDMODE) ||
-                   that->value != opt->value ||
-                   that->defval != *(int *)opt->value)
-                       continue;
-
-               if (that->long_name)
-                       strbuf_addf(&that_name, "--%s", that->long_name);
-               else
-                       strbuf_addf(&that_name, "-%c", that->short_name);
-               error(_("%s is incompatible with %s"),
-                     optname(opt, flags), that_name.buf);
-               strbuf_release(&that_name);
-               return PARSE_OPT_ERROR;
-       }
-       return error(_("%s : incompatible with something else"),
-                    optname(opt, flags));
-}
-
-static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
-                                      const struct option *opt,
-                                      const struct option *all_opts,
-                                      enum opt_parsed flags)
+static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p,
+                                         const struct option *opt,
+                                         enum opt_parsed flags,
+                                         const char **argp)
 {
        const char *s, *arg;
        const int unset = flags & OPT_UNSET;
@@ -117,14 +84,6 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
        if (!(flags & OPT_SHORT) && p->opt && (opt->flags & PARSE_OPT_NOARG))
                return error(_("%s takes no value"), optname(opt, flags));
 
-       /*
-        * Giving the same mode option twice, although unnecessary,
-        * is not a grave error, so let it pass.
-        */
-       if ((opt->flags & PARSE_OPT_CMDMODE) &&
-           *(int *)opt->value && *(int *)opt->value != opt->defval)
-               return opt_command_mode_error(opt, all_opts, flags);
-
        switch (opt->type) {
        case OPTION_LOWLEVEL_CALLBACK:
                return opt->ll_callback(p, opt, NULL, unset);
@@ -199,6 +158,8 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
                        p_unset = 0;
                        p_arg = arg;
                }
+               if (opt->flags & PARSE_OPT_CMDMODE)
+                       *argp = p_arg;
                if (opt->callback)
                        return (*opt->callback)(opt, p_arg, p_unset) ? (-1) : 0;
                else
@@ -246,16 +207,92 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
        }
 }
 
+struct parse_opt_cmdmode_list {
+       int value, *value_ptr;
+       const struct option *opt;
+       const char *arg;
+       enum opt_parsed flags;
+       struct parse_opt_cmdmode_list *next;
+};
+
+static void build_cmdmode_list(struct parse_opt_ctx_t *ctx,
+                              const struct option *opts)
+{
+       ctx->cmdmode_list = NULL;
+
+       for (; opts->type != OPTION_END; opts++) {
+               struct parse_opt_cmdmode_list *elem = ctx->cmdmode_list;
+               int *value_ptr = opts->value;
+
+               if (!(opts->flags & PARSE_OPT_CMDMODE) || !value_ptr)
+                       continue;
+
+               while (elem && elem->value_ptr != value_ptr)
+                       elem = elem->next;
+               if (elem)
+                       continue;
+
+               CALLOC_ARRAY(elem, 1);
+               elem->value_ptr = value_ptr;
+               elem->value = *value_ptr;
+               elem->next = ctx->cmdmode_list;
+               ctx->cmdmode_list = elem;
+       }
+}
+
+static char *optnamearg(const struct option *opt, const char *arg,
+                       enum opt_parsed flags)
+{
+       if (flags & OPT_SHORT)
+               return xstrfmt("-%c%s", opt->short_name, arg ? arg : "");
+       return xstrfmt("--%s%s%s%s", flags & OPT_UNSET ? "no-" : "",
+                      opt->long_name, arg ? "=" : "", arg ? arg : "");
+}
+
+static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
+                                      const struct option *opt,
+                                      enum opt_parsed flags)
+{
+       const char *arg = NULL;
+       enum parse_opt_result result = do_get_value(p, opt, flags, &arg);
+       struct parse_opt_cmdmode_list *elem = p->cmdmode_list;
+       char *opt_name, *other_opt_name;
+
+       for (; elem; elem = elem->next) {
+               if (*elem->value_ptr == elem->value)
+                       continue;
+
+               if (elem->opt &&
+                   (elem->opt->flags | opt->flags) & PARSE_OPT_CMDMODE)
+                       break;
+
+               elem->opt = opt;
+               elem->arg = arg;
+               elem->flags = flags;
+               elem->value = *elem->value_ptr;
+       }
+
+       if (result || !elem)
+               return result;
+
+       opt_name = optnamearg(opt, arg, flags);
+       other_opt_name = optnamearg(elem->opt, elem->arg, elem->flags);
+       error(_("options '%s' and '%s' cannot be used together"),
+             opt_name, other_opt_name);
+       free(opt_name);
+       free(other_opt_name);
+       return -1;
+}
+
 static enum parse_opt_result parse_short_opt(struct parse_opt_ctx_t *p,
                                             const struct option *options)
 {
-       const struct option *all_opts = options;
        const struct option *numopt = NULL;
 
        for (; options->type != OPTION_END; options++) {
                if (options->short_name == *p->opt) {
                        p->opt = p->opt[1] ? p->opt + 1 : NULL;
-                       return get_value(p, options, all_opts, OPT_SHORT);
+                       return get_value(p, options, OPT_SHORT);
                }
 
                /*
@@ -313,98 +350,107 @@ static int is_alias(struct parse_opt_ctx_t *ctx,
        return 0;
 }
 
+struct parsed_option {
+       const struct option *option;
+       enum opt_parsed flags;
+};
+
+static void register_abbrev(struct parse_opt_ctx_t *p,
+                           const struct option *option, enum opt_parsed flags,
+                           struct parsed_option *abbrev,
+                           struct parsed_option *ambiguous)
+{
+       if (p->flags & PARSE_OPT_KEEP_UNKNOWN_OPT)
+               return;
+       if (abbrev->option &&
+           !(abbrev->flags == flags && is_alias(p, abbrev->option, option))) {
+               /*
+                * If this is abbreviated, it is
+                * ambiguous. So when there is no
+                * exact match later, we need to
+                * error out.
+                */
+               ambiguous->option = abbrev->option;
+               ambiguous->flags = abbrev->flags;
+       }
+       abbrev->option = option;
+       abbrev->flags = flags;
+}
+
 static enum parse_opt_result parse_long_opt(
        struct parse_opt_ctx_t *p, const char *arg,
        const struct option *options)
 {
-       const struct option *all_opts = options;
        const char *arg_end = strchrnul(arg, '=');
-       const struct option *abbrev_option = NULL, *ambiguous_option = NULL;
-       enum opt_parsed abbrev_flags = OPT_LONG, ambiguous_flags = OPT_LONG;
+       const char *arg_start = arg;
+       enum opt_parsed flags = OPT_LONG;
+       int arg_starts_with_no_no = 0;
+       struct parsed_option abbrev = { .option = NULL, .flags = OPT_LONG };
+       struct parsed_option ambiguous = { .option = NULL, .flags = OPT_LONG };
+
+       if (skip_prefix(arg_start, "no-", &arg_start)) {
+               if (skip_prefix(arg_start, "no-", &arg_start))
+                       arg_starts_with_no_no = 1;
+               else
+                       flags |= OPT_UNSET;
+       }
 
        for (; options->type != OPTION_END; options++) {
                const char *rest, *long_name = options->long_name;
-               enum opt_parsed flags = OPT_LONG, opt_flags = OPT_LONG;
+               enum opt_parsed opt_flags = OPT_LONG;
+               int allow_unset = !(options->flags & PARSE_OPT_NONEG);
 
                if (options->type == OPTION_SUBCOMMAND)
                        continue;
                if (!long_name)
                        continue;
 
-again:
-               if (!skip_prefix(arg, long_name, &rest))
-                       rest = NULL;
-               if (!rest) {
-                       /* abbreviated? */
-                       if (!(p->flags & PARSE_OPT_KEEP_UNKNOWN_OPT) &&
-                           !strncmp(long_name, arg, arg_end - arg)) {
-is_abbreviated:
-                               if (abbrev_option &&
-                                   !is_alias(p, abbrev_option, options)) {
-                                       /*
-                                        * If this is abbreviated, it is
-                                        * ambiguous. So when there is no
-                                        * exact match later, we need to
-                                        * error out.
-                                        */
-                                       ambiguous_option = abbrev_option;
-                                       ambiguous_flags = abbrev_flags;
-                               }
-                               if (!(flags & OPT_UNSET) && *arg_end)
-                                       p->opt = arg_end + 1;
-                               abbrev_option = options;
-                               abbrev_flags = flags ^ opt_flags;
-                               continue;
-                       }
-                       /* negation allowed? */
-                       if (options->flags & PARSE_OPT_NONEG)
-                               continue;
-                       /* negated and abbreviated very much? */
-                       if (starts_with("no-", arg)) {
-                               flags |= OPT_UNSET;
-                               goto is_abbreviated;
-                       }
-                       /* negated? */
-                       if (!starts_with(arg, "no-")) {
-                               if (skip_prefix(long_name, "no-", &long_name)) {
-                                       opt_flags |= OPT_UNSET;
-                                       goto again;
-                               }
-                               continue;
-                       }
-                       flags |= OPT_UNSET;
-                       if (!skip_prefix(arg + 3, long_name, &rest)) {
-                               /* abbreviated and negated? */
-                               if (starts_with(long_name, arg + 3))
-                                       goto is_abbreviated;
-                               else
-                                       continue;
-                       }
-               }
-               if (*rest) {
-                       if (*rest != '=')
+               if (skip_prefix(long_name, "no-", &long_name))
+                       opt_flags |= OPT_UNSET;
+               else if (arg_starts_with_no_no)
+                       continue;
+
+               if (((flags ^ opt_flags) & OPT_UNSET) && !allow_unset)
+                       continue;
+
+               if (skip_prefix(arg_start, long_name, &rest)) {
+                       if (*rest == '=')
+                               p->opt = rest + 1;
+                       else if (*rest)
                                continue;
-                       p->opt = rest + 1;
+                       return get_value(p, options, flags ^ opt_flags);
                }
-               return get_value(p, options, all_opts, flags ^ opt_flags);
+
+               /* abbreviated? */
+               if (!strncmp(long_name, arg_start, arg_end - arg_start))
+                       register_abbrev(p, options, flags ^ opt_flags,
+                                       &abbrev, &ambiguous);
+
+               /* negated and abbreviated very much? */
+               if (allow_unset && starts_with("no-", arg))
+                       register_abbrev(p, options, OPT_UNSET ^ opt_flags,
+                                       &abbrev, &ambiguous);
        }
 
-       if (disallow_abbreviated_options && (ambiguous_option || abbrev_option))
+       if (disallow_abbreviated_options && (ambiguous.option || abbrev.option))
                die("disallowed abbreviated or ambiguous option '%.*s'",
                    (int)(arg_end - arg), arg);
 
-       if (ambiguous_option) {
+       if (ambiguous.option) {
                error(_("ambiguous option: %s "
                        "(could be --%s%s or --%s%s)"),
                        arg,
-                       (ambiguous_flags & OPT_UNSET) ?  "no-" : "",
-                       ambiguous_option->long_name,
-                       (abbrev_flags & OPT_UNSET) ?  "no-" : "",
-                       abbrev_option->long_name);
+                       (ambiguous.flags & OPT_UNSET) ?  "no-" : "",
+                       ambiguous.option->long_name,
+                       (abbrev.flags & OPT_UNSET) ?  "no-" : "",
+                       abbrev.option->long_name);
                return PARSE_OPT_HELP;
        }
-       if (abbrev_option)
-               return get_value(p, abbrev_option, all_opts, abbrev_flags);
+       if (abbrev.option) {
+               if (*arg_end)
+                       p->opt = arg_end + 1;
+               return get_value(p, abbrev.option, abbrev.flags);
+       }
        return PARSE_OPT_UNKNOWN;
 }
 
@@ -412,13 +458,11 @@ static enum parse_opt_result parse_nodash_opt(struct parse_opt_ctx_t *p,
                                              const char *arg,
                                              const struct option *options)
 {
-       const struct option *all_opts = options;
-
        for (; options->type != OPTION_END; options++) {
                if (!(options->flags & PARSE_OPT_NODASH))
                        continue;
                if (options->short_name == arg[0] && arg[1] == '\0')
-                       return get_value(p, options, all_opts, OPT_SHORT);
+                       return get_value(p, options, OPT_SHORT);
        }
        return PARSE_OPT_ERROR;
 }
@@ -573,6 +617,7 @@ static void parse_options_start_1(struct parse_opt_ctx_t *ctx,
            (flags & PARSE_OPT_KEEP_ARGV0))
                BUG("Can't keep argv0 if you don't have it");
        parse_options_check(options);
+       build_cmdmode_list(ctx, options);
 }
 
 void parse_options_start(struct parse_opt_ctx_t *ctx,
@@ -893,13 +938,18 @@ enum parse_opt_result parse_options_step(struct parse_opt_ctx_t *ctx,
                        continue;
                }
 
-               if (!arg[2] /* "--" */ ||
-                   !strcmp(arg + 2, "end-of-options")) {
+               if (!arg[2] /* "--" */) {
                        if (!(ctx->flags & PARSE_OPT_KEEP_DASHDASH)) {
                                ctx->argc--;
                                ctx->argv++;
                        }
                        break;
+               } else if (!strcmp(arg + 2, "end-of-options")) {
+                       if (!(ctx->flags & PARSE_OPT_KEEP_UNKNOWN_OPT)) {
+                               ctx->argc--;
+                               ctx->argv++;
+                       }
+                       break;
                }
 
                if (internal_help && !strcmp(arg + 2, "help-all"))
@@ -1005,6 +1055,11 @@ int parse_options(int argc, const char **argv,
        precompose_argv_prefix(argc, argv, NULL);
        free_preprocessed_options(real_options);
        free(ctx.alias_groups);
+       for (struct parse_opt_cmdmode_list *elem = ctx.cmdmode_list; elem;) {
+               struct parse_opt_cmdmode_list *next = elem->next;
+               free(elem);
+               elem = next;
+       }
        return parse_options_end(&ctx);
 }
 
@@ -1023,14 +1078,37 @@ static int usage_argh(const struct option *opts, FILE *outfile)
        return utf8_fprintf(outfile, s, opts->argh ? _(opts->argh) : _("..."));
 }
 
-#define USAGE_OPTS_WIDTH 24
-#define USAGE_GAP         2
+static int usage_indent(FILE *outfile)
+{
+       return fprintf(outfile, "    ");
+}
+
+#define USAGE_OPTS_WIDTH 26
+
+static void usage_padding(FILE *outfile, size_t pos)
+{
+       if (pos < USAGE_OPTS_WIDTH)
+               fprintf(outfile, "%*s", USAGE_OPTS_WIDTH - (int)pos, "");
+       else
+               fprintf(outfile, "\n%*s", USAGE_OPTS_WIDTH, "");
+}
+
+static const struct option *find_option_by_long_name(const struct option *opts,
+                                                    const char *long_name)
+{
+       for (; opts->type != OPTION_END; opts++) {
+               if (opts->long_name && !strcmp(opts->long_name, long_name))
+                       return opts;
+       }
+       return NULL;
+}
 
 static enum parse_opt_result usage_with_options_internal(struct parse_opt_ctx_t *ctx,
                                                         const char * const *usagestr,
                                                         const struct option *opts,
                                                         int full, int err)
 {
+       const struct option *all_opts = opts;
        FILE *outfile = err ? stderr : stdout;
        int need_newline;
 
@@ -1111,8 +1189,8 @@ static enum parse_opt_result usage_with_options_internal(struct parse_opt_ctx_t
 
        for (; opts->type != OPTION_END; opts++) {
                size_t pos;
-               int pad;
                const char *cp, *np;
+               const char *positive_name = NULL;
 
                if (opts->type == OPTION_SUBCOMMAND)
                        continue;
@@ -1131,7 +1209,7 @@ static enum parse_opt_result usage_with_options_internal(struct parse_opt_ctx_t
                        need_newline = 0;
                }
 
-               pos = fprintf(outfile, "    ");
+               pos = usage_indent(outfile);
                if (opts->short_name) {
                        if (opts->flags & PARSE_OPT_NODASH)
                                pos += fprintf(outfile, "%c", opts->short_name);
@@ -1140,8 +1218,15 @@ static enum parse_opt_result usage_with_options_internal(struct parse_opt_ctx_t
                }
                if (opts->long_name && opts->short_name)
                        pos += fprintf(outfile, ", ");
-               if (opts->long_name)
-                       pos += fprintf(outfile, "--%s", opts->long_name);
+               if (opts->long_name) {
+                       const char *long_name = opts->long_name;
+                       if ((opts->flags & PARSE_OPT_NONEG) ||
+                           skip_prefix(long_name, "no-", &positive_name))
+                               pos += fprintf(outfile, "--%s", long_name);
+                       else
+                               pos += fprintf(outfile, "--[no-]%s", long_name);
+               }
+
                if (opts->type == OPTION_NUMBER)
                        pos += utf8_fprintf(outfile, _("-NUM"));
 
@@ -1149,29 +1234,31 @@ static enum parse_opt_result usage_with_options_internal(struct parse_opt_ctx_t
                    !(opts->flags & PARSE_OPT_NOARG))
                        pos += usage_argh(opts, outfile);
 
-               if (pos == USAGE_OPTS_WIDTH + 1)
-                       pad = -1;
-               else if (pos <= USAGE_OPTS_WIDTH)
-                       pad = USAGE_OPTS_WIDTH - pos;
-               else {
-                       fputc('\n', outfile);
-                       pad = USAGE_OPTS_WIDTH;
-               }
                if (opts->type == OPTION_ALIAS) {
-                       fprintf(outfile, "%*s", pad + USAGE_GAP, "");
+                       usage_padding(outfile, pos);
                        fprintf_ln(outfile, _("alias of --%s"),
                                   (const char *)opts->value);
                        continue;
                }
 
-               for (cp = _(opts->help); *cp; cp = np) {
+               for (cp = opts->help ? _(opts->help) : ""; *cp; cp = np) {
                        np = strchrnul(cp, '\n');
-                       fprintf(outfile,
-                               "%*s%.*s\n", pad + USAGE_GAP, "",
-                               (int)(np - cp), cp);
                        if (*np)
                                np++;
-                       pad = USAGE_OPTS_WIDTH;
+                       usage_padding(outfile, pos);
+                       fwrite(cp, 1, np - cp, outfile);
+                       pos = 0;
+               }
+               fputc('\n', outfile);
+
+               if (positive_name) {
+                       if (find_option_by_long_name(all_opts, positive_name))
+                               continue;
+                       pos = usage_indent(outfile);
+                       pos += fprintf(outfile, "--%s", positive_name);
+                       usage_padding(outfile, pos);
+                       fprintf_ln(outfile, _("opposite of --no-%s"),
+                                  positive_name);
                }
        }
        fputc('\n', outfile);
index 57a7fe9d91a1690e59e05838897a8d474aca5de1..bd62e20268d01d0e9d7afbcb300c440bb3adaa9f 100644 (file)
@@ -445,6 +445,8 @@ static inline void die_for_incompatible_opt3(int opt1, const char *opt1_name,
 
 /*----- incremental advanced APIs -----*/
 
+struct parse_opt_cmdmode_list;
+
 /*
  * It's okay for the caller to consume argv/argc in the usual way.
  * Other fields of that structure are private to parse-options and should not
@@ -459,7 +461,7 @@ struct parse_opt_ctx_t {
        unsigned has_subcommands;
        const char *prefix;
        const char **alias_groups; /* must be in groups of 3 elements! */
-       struct option *updated_options;
+       struct parse_opt_cmdmode_list *cmdmode_list;
 };
 
 void parse_options_start(struct parse_opt_ctx_t *ctx,
diff --git a/parse.c b/parse.c
new file mode 100644 (file)
index 0000000..42d691a
--- /dev/null
+++ b/parse.c
@@ -0,0 +1,182 @@
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "parse.h"
+
+static uintmax_t get_unit_factor(const char *end)
+{
+       if (!*end)
+               return 1;
+       else if (!strcasecmp(end, "k"))
+               return 1024;
+       else if (!strcasecmp(end, "m"))
+               return 1024 * 1024;
+       else if (!strcasecmp(end, "g"))
+               return 1024 * 1024 * 1024;
+       return 0;
+}
+
+int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
+{
+       if (value && *value) {
+               char *end;
+               intmax_t val;
+               intmax_t factor;
+
+               if (max < 0)
+                       BUG("max must be a positive integer");
+
+               errno = 0;
+               val = strtoimax(value, &end, 0);
+               if (errno == ERANGE)
+                       return 0;
+               if (end == value) {
+                       errno = EINVAL;
+                       return 0;
+               }
+               factor = get_unit_factor(end);
+               if (!factor) {
+                       errno = EINVAL;
+                       return 0;
+               }
+               if ((val < 0 && -max / factor > val) ||
+                   (val > 0 && max / factor < val)) {
+                       errno = ERANGE;
+                       return 0;
+               }
+               val *= factor;
+               *ret = val;
+               return 1;
+       }
+       errno = EINVAL;
+       return 0;
+}
+
+static int git_parse_unsigned(const char *value, uintmax_t *ret, uintmax_t max)
+{
+       if (value && *value) {
+               char *end;
+               uintmax_t val;
+               uintmax_t factor;
+
+               /* negative values would be accepted by strtoumax */
+               if (strchr(value, '-')) {
+                       errno = EINVAL;
+                       return 0;
+               }
+               errno = 0;
+               val = strtoumax(value, &end, 0);
+               if (errno == ERANGE)
+                       return 0;
+               if (end == value) {
+                       errno = EINVAL;
+                       return 0;
+               }
+               factor = get_unit_factor(end);
+               if (!factor) {
+                       errno = EINVAL;
+                       return 0;
+               }
+               if (unsigned_mult_overflows(factor, val) ||
+                   factor * val > max) {
+                       errno = ERANGE;
+                       return 0;
+               }
+               val *= factor;
+               *ret = val;
+               return 1;
+       }
+       errno = EINVAL;
+       return 0;
+}
+
+int git_parse_int(const char *value, int *ret)
+{
+       intmax_t tmp;
+       if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(int)))
+               return 0;
+       *ret = tmp;
+       return 1;
+}
+
+int git_parse_int64(const char *value, int64_t *ret)
+{
+       intmax_t tmp;
+       if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(int64_t)))
+               return 0;
+       *ret = tmp;
+       return 1;
+}
+
+int git_parse_ulong(const char *value, unsigned long *ret)
+{
+       uintmax_t tmp;
+       if (!git_parse_unsigned(value, &tmp, maximum_unsigned_value_of_type(long)))
+               return 0;
+       *ret = tmp;
+       return 1;
+}
+
+int git_parse_ssize_t(const char *value, ssize_t *ret)
+{
+       intmax_t tmp;
+       if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(ssize_t)))
+               return 0;
+       *ret = tmp;
+       return 1;
+}
+
+int git_parse_maybe_bool_text(const char *value)
+{
+       if (!value)
+               return 1;
+       if (!*value)
+               return 0;
+       if (!strcasecmp(value, "true")
+           || !strcasecmp(value, "yes")
+           || !strcasecmp(value, "on"))
+               return 1;
+       if (!strcasecmp(value, "false")
+           || !strcasecmp(value, "no")
+           || !strcasecmp(value, "off"))
+               return 0;
+       return -1;
+}
+
+int git_parse_maybe_bool(const char *value)
+{
+       int v = git_parse_maybe_bool_text(value);
+       if (0 <= v)
+               return v;
+       if (git_parse_int(value, &v))
+               return !!v;
+       return -1;
+}
+
+/*
+ * Parse environment variable 'k' as a boolean (in various
+ * possible spellings); if missing, use the default value 'def'.
+ */
+int git_env_bool(const char *k, int def)
+{
+       const char *v = getenv(k);
+       int val;
+       if (!v)
+               return def;
+       val = git_parse_maybe_bool(v);
+       if (val < 0)
+               die(_("bad boolean environment value '%s' for '%s'"),
+                   v, k);
+       return val;
+}
+
+/*
+ * Parse environment variable 'k' as ulong with possibly a unit
+ * suffix; if missing, use the default value 'val'.
+ */
+unsigned long git_env_ulong(const char *k, unsigned long val)
+{
+       const char *v = getenv(k);
+       if (v && !git_parse_ulong(v, &val))
+               die(_("failed to parse %s"), k);
+       return val;
+}
diff --git a/parse.h b/parse.h
new file mode 100644 (file)
index 0000000..07d2193
--- /dev/null
+++ b/parse.h
@@ -0,0 +1,20 @@
+#ifndef PARSE_H
+#define PARSE_H
+
+int git_parse_signed(const char *value, intmax_t *ret, intmax_t max);
+int git_parse_ssize_t(const char *, ssize_t *);
+int git_parse_ulong(const char *, unsigned long *);
+int git_parse_int(const char *value, int *ret);
+int git_parse_int64(const char *value, int64_t *ret);
+
+/**
+ * Same as `git_config_bool`, except that it returns -1 on error rather
+ * than dying.
+ */
+int git_parse_maybe_bool(const char *);
+int git_parse_maybe_bool_text(const char *value);
+
+int git_env_bool(const char *, int);
+unsigned long git_env_ulong(const char *, unsigned long);
+
+#endif /* PARSE_H */
index c3e1a0dd216c80c92c47f0e2a98d74a57c422742..a5683b462c6e7692ceff3218213b9747a9b6cc02 100644 (file)
@@ -2,7 +2,6 @@
 #include "diff.h"
 #include "commit.h"
 #include "hash.h"
-#include "hash-lookup.h"
 #include "hex.h"
 #include "patch-ids.h"
 
diff --git a/path.c b/path.c
index 67e2690efef897b406d46eab6202b52fc65a55d0..8bb223c92c91c2d963ab4fefa9efb0ac7c3b026c 100644 (file)
--- a/path.c
+++ b/path.c
@@ -871,7 +871,7 @@ const char *enter_repo(const char *path, int strict)
        return NULL;
 }
 
-static int calc_shared_perm(int mode)
+int calc_shared_perm(int mode)
 {
        int tweak;
 
@@ -1588,7 +1588,5 @@ REPO_GIT_PATH_FUNC(merge_msg, "MERGE_MSG")
 REPO_GIT_PATH_FUNC(merge_rr, "MERGE_RR")
 REPO_GIT_PATH_FUNC(merge_mode, "MERGE_MODE")
 REPO_GIT_PATH_FUNC(merge_head, "MERGE_HEAD")
-REPO_GIT_PATH_FUNC(merge_autostash, "MERGE_AUTOSTASH")
-REPO_GIT_PATH_FUNC(auto_merge, "AUTO_MERGE")
 REPO_GIT_PATH_FUNC(fetch_head, "FETCH_HEAD")
 REPO_GIT_PATH_FUNC(shallow, "shallow")
diff --git a/path.h b/path.h
index 639372edd9ee36127e3b89084f89ee59d12ff60f..e053effef20cbad3115095d54989cb9d4d91cfff 100644 (file)
--- a/path.h
+++ b/path.h
@@ -175,14 +175,13 @@ const char *git_path_merge_msg(struct repository *r);
 const char *git_path_merge_rr(struct repository *r);
 const char *git_path_merge_mode(struct repository *r);
 const char *git_path_merge_head(struct repository *r);
-const char *git_path_merge_autostash(struct repository *r);
-const char *git_path_auto_merge(struct repository *r);
 const char *git_path_fetch_head(struct repository *r);
 const char *git_path_shallow(struct repository *r);
 
 int ends_with_path_components(const char *path, const char *components);
 int validate_headref(const char *ref);
 
+int calc_shared_perm(int mode);
 int adjust_shared_perm(const char *path);
 
 char *interpolate_path(const char *path, int real_home);
index 3a3a5724c44bcb7b53d10ddce6f0f9f9f397512b..2133b9fe60a87c201186dc3f1840276104903f7f 100644 (file)
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "abspath.h"
-#include "config.h"
+#include "parse.h"
 #include "dir.h"
 #include "environment.h"
 #include "gettext.h"
@@ -109,16 +109,37 @@ static struct pathspec_magic {
        { PATHSPEC_ATTR,    '\0', "attr" },
 };
 
-static void prefix_magic(struct strbuf *sb, int prefixlen, unsigned magic)
+static void prefix_magic(struct strbuf *sb, int prefixlen,
+                        unsigned magic, const char *element)
 {
-       int i;
-       strbuf_addstr(sb, ":(");
-       for (i = 0; i < ARRAY_SIZE(pathspec_magic); i++)
-               if (magic & pathspec_magic[i].bit) {
-                       if (sb->buf[sb->len - 1] != '(')
-                               strbuf_addch(sb, ',');
-                       strbuf_addstr(sb, pathspec_magic[i].name);
+       /* No magic was found in element, just add prefix magic */
+       if (!magic) {
+               strbuf_addf(sb, ":(prefix:%d)", prefixlen);
+               return;
+       }
+
+       /*
+        * At this point, we know that parse_element_magic() was able
+        * to extract some pathspec magic from element. So we know
+        * element is correctly formatted in either shorthand or
+        * longhand form
+        */
+       if (element[1] != '(') {
+               /* Process an element in shorthand form (e.g. ":!/<match>") */
+               strbuf_addstr(sb, ":(");
+               for (int i = 0; i < ARRAY_SIZE(pathspec_magic); i++) {
+                       if ((magic & pathspec_magic[i].bit) &&
+                           pathspec_magic[i].mnemonic) {
+                               if (sb->buf[sb->len - 1] != '(')
+                                       strbuf_addch(sb, ',');
+                               strbuf_addstr(sb, pathspec_magic[i].name);
+                       }
                }
+       } else {
+               /* For the longhand form, we copy everything up to the final ')' */
+               size_t len = strchr(element, ')') - element;
+               strbuf_add(sb, element, len);
+       }
        strbuf_addf(sb, ",prefix:%d)", prefixlen);
 }
 
@@ -467,7 +488,12 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
                match = prefix_path_gently(prefix, prefixlen,
                                           &prefixlen, copyfrom);
                if (!match) {
-                       const char *hint_path = get_git_work_tree();
+                       const char *hint_path;
+
+                       if (!have_git_dir())
+                               die(_("'%s' is outside the directory tree"),
+                                   copyfrom);
+                       hint_path = get_git_work_tree();
                        if (!hint_path)
                                hint_path = get_git_dir();
                        die(_("%s: '%s' is outside repository at '%s'"), elt,
@@ -488,7 +514,7 @@ static void init_pathspec_item(struct pathspec_item *item, unsigned flags,
                struct strbuf sb = STRBUF_INIT;
 
                /* Preserve the actual prefix length of each pattern */
-               prefix_magic(&sb, prefixlen, element_magic);
+               prefix_magic(&sb, prefixlen, element_magic, elt);
 
                strbuf_addstr(&sb, match);
                item->original = strbuf_detach(&sb, NULL);
index d82b71325c6bd492cd7eb0f703b00fa6634c627d..5b97e0315d6f16c9a215b387fb587dba1074bd23 100644 (file)
@@ -1025,7 +1025,7 @@ C<:warndie> handlers added by Paul Evans <leonerd@leonerd.org.uk>
 
 =head1 MAINTAINER
 
-Shlomi Fish, L<http://www.shlomifish.org/> .
+Shlomi Fish, L<https://www.shlomifish.org/> .
 
 =head1 PAST MAINTAINERS
 
index 117765dc73c4a8c30bfbcf9b3b37bad6b26a9ede..03bf570bf4c852932973f3a6815c2d3dd4802622 100644 (file)
@@ -7,7 +7,7 @@ Git - Perl interface to the Git version control system
 
 package Git;
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 
index 895e759c57a9d9c76d677299ff4658796e2930af..5454c3a6d2c433c1456c0d6151c50746e8f2fad4 100644 (file)
@@ -1,5 +1,5 @@
 package Git::I18N;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 BEGIN {
index 0c360bc799860798ade6b2afce6e05b0a567d21f..8c7fa805f97390a47366b0d0058966ee391b9df1 100644 (file)
@@ -1,5 +1,5 @@
 package Git::LoadCPAN;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 
index 5d84c202884b7cb7cea576ea1a6f146b2e653ae2..5cecb0fcd6930a1806aafdaacee9312aa7e8212e 100644 (file)
@@ -1,5 +1,5 @@
 package Git::LoadCPAN::Error;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Git::LoadCPAN (
index 340e88a7a56be37af8b1f437c92ecb52b1b29089..9f808090a66a16c02eba9c5ed84669ec03f1b944 100644 (file)
@@ -1,5 +1,5 @@
 package Git::LoadCPAN::Mail::Address;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Git::LoadCPAN (
index d144f5168f37adaf54a2f9b768f04ad2a1c20196..d896e6952399b0fa92b249144d61fcd58d2aab67 100644 (file)
@@ -1,5 +1,5 @@
 package Git::Packet;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 BEGIN {
index 6ce2e283c8d18b3de72cbec12957ebd532d25333..7721708ce5d7f6560ba9f84706e9ad840664020a 100644 (file)
@@ -1752,7 +1752,7 @@ sub tie_for_persistent_memoization {
 END {
        # Force cache writeout explicitly instead of waiting for
        # global destruction to avoid segfault in Storable:
-       # http://rt.cpan.org/Public/Bug/Display.html?id=36087
+       # https://rt.cpan.org/Public/Bug/Display.html?id=36087
        unmemoize_svn_mergeinfo_functions();
 }
 
index af83a19f4df5537da9f1c7a87ea29cb2f5903ea2..24479eae4dbe2a44b15a10f86b15bfc6f865bb34 100644 (file)
@@ -4,6 +4,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "run-command.h"
+#include "sideband.h"
 #include "trace.h"
 #include "write-or-die.h"
 
@@ -462,8 +463,32 @@ enum packet_read_status packet_read_with_status(int fd, char **src_buffer,
        }
 
        if ((options & PACKET_READ_CHOMP_NEWLINE) &&
-           len && buffer[len-1] == '\n')
-               len--;
+           len && buffer[len-1] == '\n') {
+               if (options & PACKET_READ_USE_SIDEBAND) {
+                       int band = *buffer & 0xff;
+                       switch (band) {
+                       case 1:
+                               /* Chomp newline for payload */
+                               len--;
+                               break;
+                       case 2:
+                       case 3:
+                               /*
+                                * Do not chomp newline for progress and error
+                                * message.
+                                */
+                               break;
+                       default:
+                               /*
+                                * Bad sideband, let's leave it to
+                                * demultiplex_sideband() to catch this error.
+                                */
+                               break;
+                       }
+               } else {
+                       len--;
+               }
+       }
 
        buffer[len] = 0;
        if (options & PACKET_READ_REDACT_URI_PATH &&
@@ -592,17 +617,19 @@ void packet_reader_init(struct packet_reader *reader, int fd,
        reader->options = options;
        reader->me = "git";
        reader->hash_algo = &hash_algos[GIT_HASH_SHA1];
+       strbuf_init(&reader->scratch, 0);
 }
 
 enum packet_read_status packet_reader_read(struct packet_reader *reader)
 {
-       struct strbuf scratch = STRBUF_INIT;
-
        if (reader->line_peeked) {
                reader->line_peeked = 0;
                return reader->status;
        }
 
+       if (reader->use_sideband)
+               reader->options |= PACKET_READ_USE_SIDEBAND;
+
        /*
         * Consume all progress packets until a primary payload packet is
         * received
@@ -620,7 +647,7 @@ enum packet_read_status packet_reader_read(struct packet_reader *reader)
                        break;
                if (demultiplex_sideband(reader->me, reader->status,
                                         reader->buffer, reader->pktlen, 1,
-                                        &scratch, &sideband_type))
+                                        &reader->scratch, &sideband_type))
                        break;
        }
 
index 954eec87197d3e0c50812879d47e0afbb008baa3..3b33cc64f34dcc3447f6a6f42f12451dbc1a77a9 100644 (file)
@@ -2,7 +2,6 @@
 #define PKTLINE_H
 
 #include "strbuf.h"
-#include "sideband.h"
 
 /*
  * Write a packetized stream, where each line is preceded by
@@ -85,6 +84,7 @@ void packet_fflush(FILE *f);
 #define PACKET_READ_DIE_ON_ERR_PACKET    (1u<<2)
 #define PACKET_READ_GENTLE_ON_READ_ERROR (1u<<3)
 #define PACKET_READ_REDACT_URI_PATH      (1u<<4)
+#define PACKET_READ_USE_SIDEBAND         (1u<<5)
 int packet_read(int fd, char *buffer, unsigned size, int options);
 
 /*
@@ -194,6 +194,9 @@ struct packet_reader {
 
        /* hash algorithm in use */
        const struct git_hash_algo *hash_algo;
+
+       /* hold temporary sideband message */
+       struct strbuf scratch;
 };
 
 /*
index 3e4f897d935918092f3dfd1a05637b7176bd9fe1..ec08aa24add4e3da7c02b990ba1851665825c2b0 100644 (file)
@@ -412,7 +412,7 @@ There are some conventions that l10n contributors must follow:
 - Do not use non-ASCII characters in the subject of a commit.
 
 - The length of commit subject (first line of the commit log) should
-  be less than 50 characters, and the length of other lines of the
+  be no more than 50 characters, and the length of other lines of the
   commit log should be no more than 72 characters.
 
 - Add "Signed-off-by" trailer to your commit log, like other commits
index 61214c4b1c5eb2a658503a0be9dfaaf23568597c..6b95addef41e21943dbe0f72eb03ccb5683e68a1 100644 (file)
--- a/po/bg.po
+++ b/po/bg.po
@@ -1,7 +1,7 @@
 # Bulgarian translation of git po-file.
-# Copyright (C) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Alexander Shopov <ash@kambanaria.org>.
+# Copyright (C) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Alexander Shopov <ash@kambanaria.org>.
 # This file is distributed under the same license as the git package.
-# Alexander Shopov <ash@kambanaria.org>, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023.
+# Alexander Shopov <ash@kambanaria.org>, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024.
 # ========================
 # DICTIONARY TO MERGE IN GIT GUI
 # ------------------------
 # island marks граници на групите
 # reflog журнал на указателите
 # hash контролна сума, изчисляване на контролна сума
-# fanout откъс (разперване???)
+# fanout откъс за разпределяне
 # idx - index of pack file, 1 index per 1 packfile
 # midx, multi-pack index - файл с индекса за множество пакети
 # overlay mode - припокриващ режим (при изтеглянe)
 # incremental file нарастващ файл
+# commit-graph граф с подавания
+# commit-graph chain верига на гра̀фа с подавания
 # split (commit-graphr) раздробен (граф с подавания)
 # clobber (a tag) презаписвам (етикет)
 # blame извеждане на авторство
 # timestamp времево клеймо
 # bare repository голо хранилище
 # resolve-undo отмяна на разрешените подавания
+# resolve conflict коригирам конфликт
+# resolve reference установяване на обекта, сочен от указателя, проследяване на указателя
+# cannot resolve reference  не може да сее открие към какво сочи указателят
 # maintenance задачи по поддръжка
 # GLE последна грешка в нишката - от GetLatError: https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror
 # lookup table таблица със съответствия
 # superproject свръхпроект
 # rev-index обратен индекс (reverse index)
 # dererging branches раздалечили се клони
+# master/main branch основен клон
+# unborn/orphan branch неродѐн клон (а не несъздаден) - клон без никакви подавания, включително и началното
+# parse анализ, анализирам
+# reinitialize repository зануляване на хранилището и инициализиране
+# replay изпълняване/прилагане наново
+# BTMP chunk откъс за побитова маска
+# OID fanout chunk откъс за разпределянето
+# OID lookup chunk  откъс за търсенето
+# autostash автоматично скатано
+# symref файл с указател (regular file that stores a string that begins with ref: refs/)
+#
+#
+#
 # ------------------------
 # „$var“ - може да не сработва за shell има gettext и eval_gettext - проверка - намират се лесно по „$
 # ------------------------
+# табулация в началото на реда се заменя с четири интервала
+# по подобен начин отстъпът на примерна команда е четири интервала
+# ------------------------
+#
 # FIXME
-# HEAD as a reference vs head of a branch
-# git update-index -h извежда само един ред, а не цялата помощ за опциите
 # git fetch --al работи подобно на --all
+#
+# ----
+#
+# TODO
+# Причастно-страдателни форми (бъде отворен) -> Възвратно-страдателни форми (се отвори)
+# <ТЕРМИН> -> ТЕРМИН
+#
 # ------------------------
 # export PO_FILE=bg.po
 # msgattrib --only-fuzzy  $PO_FILE > todo1.po
 # for i in `sort -u FILES`; do cnt=`grep $i FILES | wc -l`; echo $cnt $i ;done | sort -n
 msgid ""
 msgstr ""
-"Project-Id-Version: git 2.41\n"
+"Project-Id-Version: git 2.44\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-05-19 19:48+0200\n"
-"PO-Revision-Date: 2023-05-19 20:57+0300\n"
+"POT-Creation-Date: 2024-02-16 09:33+0100\n"
+"PO-Revision-Date: 2024-02-16 09:38+0100\n"
 "Last-Translator: Alexander Shopov <ash@kambanaria.org>\n"
 "Language-Team: Bulgarian <dict@fsa-bg.org>\n"
 "Language: bg\n"
@@ -234,7 +261,7 @@ msgid "Huh (%s)?"
 msgstr "Неуспешен анализ — „%s“."
 
 msgid "could not read index"
-msgstr "индексът не може да бъде прочетен"
+msgstr "индексът не може да се прочете"
 
 msgid "binary"
 msgstr "двоично"
@@ -253,7 +280,7 @@ msgid "could not stage '%s'"
 msgstr "неуспешно добавяне в индекса на „%s“"
 
 msgid "could not write index"
-msgstr "индексът не може да бъде записан"
+msgstr "индексът не може да се запише"
 
 #, c-format
 msgid "updated %d path\n"
@@ -273,7 +300,7 @@ msgid "Revert"
 msgstr "Отмяна"
 
 msgid "Could not parse HEAD^{tree}"
-msgstr "Указателят „HEAD^{tree}“ не може да бъде анализиран"
+msgstr "Указателят „HEAD^{tree}“ не може да се анализира"
 
 #, c-format
 msgid "reverted %d path\n"
@@ -376,7 +403,7 @@ msgid "path"
 msgstr "път"
 
 msgid "could not refresh index"
-msgstr "индексът не може да бъде обновен"
+msgstr "индексът не може да се обнови"
 
 #, c-format
 msgid "Bye.\n"
@@ -402,8 +429,8 @@ msgid ""
 "If the patch applies cleanly, the edited hunk will immediately be marked for "
 "staging."
 msgstr ""
-"Ако кръпката може да се приложи чисто, редактираното парче ще бъде незабавно "
-"добавено към индекса."
+"Ако кръпката може да се приложи чисто, редактираното парче незабавно ще се "
+"добави към индекса."
 
 msgid ""
 "y - stage this hunk\n"
@@ -438,8 +465,8 @@ msgid ""
 "If the patch applies cleanly, the edited hunk will immediately be marked for "
 "stashing."
 msgstr ""
-"Ако кръпката може да се приложи чисто, редактираното парче ще бъде незабавно "
-"скътано."
+"Ако кръпката може да се приложи чисто, редактираното парче незабавно ще се "
+"скатае."
 
 msgid ""
 "y - stash this hunk\n"
@@ -474,8 +501,8 @@ msgid ""
 "If the patch applies cleanly, the edited hunk will immediately be marked for "
 "unstaging."
 msgstr ""
-"Ако кръпката може да се приложи чисто, редактираното парче ще бъде незабавно "
-"извадено от индекса."
+"Ако кръпката може да се приложи чисто, редактираното парче незабавно ще се "
+"извади от индекса."
 
 msgid ""
 "y - unstage this hunk\n"
@@ -511,8 +538,8 @@ msgid ""
 "If the patch applies cleanly, the edited hunk will immediately be marked for "
 "applying."
 msgstr ""
-"Ако кръпката може да се приложи чисто, редактираното парче ще бъде незабавно "
-"набелязано за прилагане."
+"Ако кръпката може да се приложи чисто, редактираното парче незабавно ще се "
+"набележи за прилагане."
 
 msgid ""
 "y - apply this hunk to index\n"
@@ -549,8 +576,8 @@ msgid ""
 "If the patch applies cleanly, the edited hunk will immediately be marked for "
 "discarding."
 msgstr ""
-"Ако кръпката може да се приложи чисто, редактираното парче ще бъде незабавно "
-"набелязано за зануляване."
+"Ако кръпката може да се приложи чисто, редактираното парче незабавно ще се "
+"набележи за зануляване."
 
 msgid ""
 "y - discard this hunk from worktree\n"
@@ -728,7 +755,7 @@ msgstr ""
 "За да пропуснете редовете, започващи с „%c“: заменете знака с „ “ (стават "
 "контекст)\n"
 "За да пропуснете редовете, започващи с „%c“: изтрийте ги.\n"
-"Редовете, които започват с „%c“ ще бъдат пропуснати.\n"
+"Редовете, които започват с „%c“ ще се пропуснат.\n"
 
 msgid ""
 "If it does not apply cleanly, you will be given an opportunity to\n"
@@ -736,7 +763,7 @@ msgid ""
 "aborted and the hunk is left unchanged.\n"
 msgstr ""
 "Ако е невъзможно чисто прилагане на кода, ще може пак да редактирате.  Ако\n"
-"изтриете всички редове от парчето код, то ще бъде оставено непроменено, а\n"
+"изтриете всички редове от парчето код, то ще се остави непроменено, а\n"
 "редактирането — отказано.\n"
 
 msgid "could not parse hunk header"
@@ -827,14 +854,14 @@ msgid "No hunk matches the given pattern"
 msgstr "Никое парче не напасва на регулярния израз"
 
 msgid "Sorry, cannot split this hunk"
-msgstr "Това парче не може да бъде разделено"
+msgstr "Това парче не може да се раздели"
 
 #, c-format
 msgid "Split into %d hunks."
 msgstr "Разделяне на %d парчета."
 
 msgid "Sorry, cannot edit this hunk"
-msgstr "Това парче не може да бъде редактирано"
+msgstr "Това парче не може да се редактира"
 
 msgid "'git apply' failed"
 msgstr "неуспешно изпълнение на „git apply“"
@@ -868,9 +895,8 @@ msgstr "Издърпването е блокирано от неслети фа
 msgid "Reverting is not possible because you have unmerged files."
 msgstr "Отмяната е блокирана от неслети файлове."
 
-#, c-format
-msgid "It is not possible to %s because you have unmerged files."
-msgstr "Действието „%s“ е блокирано от неслети файлове."
+msgid "Rebasing is not possible because you have unmerged files."
+msgstr "Пребазирането е блокирано от неслети файлове."
 
 msgid ""
 "Fix them up in the work tree, and then use 'git add/rm <file>'\n"
@@ -902,11 +928,11 @@ msgid ""
 msgstr ""
 "Раздалечили се клони не може да се превъртят.  Ползвайте:\n"
 "\n"
-"  git merge --no-ff\n"
+"    git merge --no-ff\n"
 "\n"
 "или:\n"
 "\n"
-"  git rebase\n"
+"    git rebase\n"
 
 msgid "Not possible to fast-forward, aborting."
 msgstr "Не може да се извърши превъртане, преустановяване на действието."
@@ -953,9 +979,8 @@ msgstr ""
 "Бележка: преминаване към „%s“.\n"
 "\n"
 "Указателят „HEAD“ не е свързан.  Може да разглеждате, да правите произволни\n"
-"промѐни и да ги подавате.  Ако изтеглите нещо друго, всички промѐни ще "
-"бъдат\n"
-"забравени и никой клон няма да се промѐни.\n"
+"промѐни и да ги подавате.  Ако изтеглите нещо друго, всички промѐни ще се\n"
+"забравят и никой клон няма да се промѐни.\n"
 "\n"
 "Ако искате да създадете нов клон, за да запазите подаванията си, може да\n"
 "направите това като зададете име на клон към опцията „-c“ на командата\n"
@@ -1019,9 +1044,15 @@ msgstr "опциите „%s“ и „%s“ са несъвместими"
 msgid "'%s' outside a repository"
 msgstr "„%s“ извън хранилище"
 
+msgid "failed to read patch"
+msgstr "кръпката не може да се прочете"
+
+msgid "patch too large"
+msgstr "твърде голяма кръпка"
+
 #, c-format
 msgid "Cannot prepare timestamp regexp %s"
-msgstr "РегÑ\83лÑ\8fÑ\80ниÑ\8fÑ\82 Ð¸Ð·Ñ\80аз Ð·Ð° Ð²Ñ\80емевоÑ\82о ÐºÐ»ÐµÐ¹Ð¼Ð¾ â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð·Ð° Ð±Ñ\8aде ÐºÐ¾Ð¼Ð¿Ð¸Ð»Ð¸Ñ\80ан"
+msgstr "РегÑ\83лÑ\8fÑ\80ниÑ\8fÑ\82 Ð¸Ð·Ñ\80аз Ð·Ð° Ð²Ñ\80емевоÑ\82о ÐºÐ»ÐµÐ¹Ð¼Ð¾ â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ñ\81е ÐºÐ¾Ð¼Ð¿Ð¸Ð»Ð¸Ñ\80а "
 
 #, c-format
 msgid "regexec returned %d for input: %s"
@@ -1126,11 +1157,11 @@ msgstr "кръпката е с изцяло повредени данни на 
 
 #, c-format
 msgid "unable to read symlink %s"
-msgstr "символната връзка „%s“ не може да бъде прочетена"
+msgstr "символната връзка „%s“ не може да се прочете"
 
 #, c-format
 msgid "unable to open or read %s"
-msgstr "файлът „%s“ не може да бъде отворен или прочетен"
+msgstr "файлът „%s“ не може да се отвори или прочете"
 
 #, c-format
 msgid "invalid start of line: '%c'"
@@ -1183,12 +1214,11 @@ msgstr "кръпката съответства на „%s“, който тря
 #, c-format
 msgid "the necessary postimage %s for '%s' cannot be read"
 msgstr ""
-"необходимият резултат след операцията  — „%s“ за „%s“ не може да бъде "
-"прочетен"
+"необходимият резултат след операцията  — „%s“ за „%s“ не може да се прочете"
 
 #, c-format
 msgid "binary patch does not apply to '%s'"
-msgstr "двоичната кръпка не може да бъде приложена върху „%s“"
+msgstr "двоичната кръпка не може да се приложи върху „%s“"
 
 #, c-format
 msgid "binary patch to '%s' creates incorrect result (expecting %s, got %s)"
@@ -1206,7 +1236,7 @@ msgstr "„%s“ не може да се изтегли"
 
 #, c-format
 msgid "failed to read %s"
-msgstr "файлът „%s“ не може да бъде прочетен"
+msgstr "файлът „%s“ не може да се прочете"
 
 #, c-format
 msgid "reading from '%s' beyond a symbolic link"
@@ -1233,7 +1263,7 @@ msgstr "Тройно сливане…\n"
 
 #, c-format
 msgid "cannot read the current contents of '%s'"
-msgstr "текущото съдържание на „%s“ не може да бъде прочетено"
+msgstr "текущото съдържание на „%s“ не може да се прочете"
 
 #, c-format
 msgid "Failed to perform three-way merge...\n"
@@ -1289,7 +1319,7 @@ msgstr "засегнатият файл „%s“ е след символна в
 
 #, c-format
 msgid "%s: patch does not apply"
-msgstr "Кръпката „%s“ не може да бъде приложена"
+msgstr "Кръпката „%s“ не може да се приложи"
 
 #, c-format
 msgid "Checking patch %s..."
@@ -1369,7 +1399,7 @@ msgstr "съкращаване на името на файла с отхвърл
 
 #, c-format
 msgid "cannot open %s"
-msgstr "„%s“ не може да бъде отворен"
+msgstr "„%s“ не може да се отвори"
 
 #, c-format
 msgid "cannot unlink '%s'"
@@ -1392,11 +1422,11 @@ msgstr ""
 "На входа няма непразни кръпки (те се приемат при опция „--allow-empty“)"
 
 msgid "unable to read index file"
-msgstr "индексът не може да бъде записан"
+msgstr "индексът не може да се запише"
 
 #, c-format
 msgid "can't open patch '%s': %s"
-msgstr "кръпката „%s“ не може да бъде отворена: %s"
+msgstr "кръпката „%s“ не може да се отвори: %s"
 
 #, c-format
 msgid "squelched %d whitespace error"
@@ -1419,7 +1449,7 @@ msgstr[1] ""
 "Добавени са %d реда след корекцията на грешките в знаците за интервали."
 
 msgid "Unable to write new index file"
-msgstr "Новият индекс не може да бъде записан"
+msgstr "Новият индекс не може да се запише"
 
 msgid "don't apply changes matching the given path"
 msgstr "без прилагане на промѐните напасващи на дадения път"
@@ -1449,7 +1479,7 @@ msgid "instead of applying the patch, see if the patch is applicable"
 msgstr "проверка дали кръпката може да се приложи, без действително прилагане"
 
 msgid "make sure the patch is applicable to the current index"
-msgstr "проверка дали кръпката може да бъде приложена към текущия индекс"
+msgstr "проверка дали кръпката може да се приложи към текущия индекс"
 
 msgid "mark new files with `git add --intent-to-add`"
 msgstr "отбелязване на новите файлове с „git add --intent-to-add“"
@@ -1462,8 +1492,7 @@ msgstr "прилагане на кръпка, която променя и фа
 
 msgid "also apply the patch (use with --stat/--summary/--check)"
 msgstr ""
-"кръпката да бъде приложена.  Опцията се комбинира с „--check“/„--stat“/„--"
-"summary“"
+"кръпката се приложи.  Опцията се комбинира с „--check“/„--stat“/„--summary“"
 
 msgid "attempt three-way merge, fall back on normal patch if that fails"
 msgstr ""
@@ -1519,7 +1548,7 @@ msgstr "да не се връща грешка при празни кръпки"
 
 #, c-format
 msgid "cannot stream blob %s"
-msgstr "обектът-BLOB „%s“ не може да бъде обработен"
+msgstr "обектът-BLOB „%s“ не може да се обработи"
 
 #, c-format
 msgid "unsupported file mode: 0%o (SHA1: %s)"
@@ -1531,10 +1560,10 @@ msgstr "грешка при декомпресиране с „deflate“ (%d)"
 
 #, c-format
 msgid "unable to start '%s' filter"
-msgstr "филтърът „%s“ не може да бъде стартиран"
+msgstr "филтърът „%s“ не може да се стартира"
 
 msgid "unable to redirect descriptor"
-msgstr "дескрипторът не може да бъде пренасочен"
+msgstr "дескрипторът не може да се пренасочи"
 
 #, c-format
 msgid "'%s' filter reported error"
@@ -1566,7 +1595,7 @@ msgstr "git archive --remote ХРАНИЛИЩЕ [--exec КОМАНДА] --list"
 
 #, c-format
 msgid "cannot read '%s'"
-msgstr "файлът „%s“ не може да бъде прочетен"
+msgstr "файлът „%s“ не може да се прочете"
 
 #, c-format
 msgid "pathspec '%s' matches files outside the current directory"
@@ -1672,6 +1701,10 @@ msgstr "опцията „%s“ изисква „%s“"
 msgid "Unexpected option --output"
 msgstr "Неочаквана опция „--output“"
 
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "излишна опция или стойност на командния ред: „%s“"
+
 #, c-format
 msgid "Unknown archive format '%s'"
 msgstr "Непознат формат на архив: „%s“"
@@ -1719,6 +1752,14 @@ msgstr ""
 "неправилна стойност за опцията „--attr-source“ или променливата "
 "„GIT_ATTR_SOURCE“"
 
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "„stat“ не може да се изпълни върху „%s“"
+
+#, c-format
+msgid "unable to read %s"
+msgstr "обектът „%s“ не може да бъде прочетен"
+
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
 msgstr "Неправилно цитирано съдържание във файла „%s“: %s"
@@ -1771,7 +1812,7 @@ msgid ""
 "So we cannot be sure the first %s commit is between %s and %s.\n"
 "We continue anyway."
 msgstr ""
-"базата за сливане между „%s“ и [%s] трябва да бъде прескочена.\n"
+"базата за сливане между „%s“ и [%s] трябва да се прескочи.\n"
 "Не може да сме сигурни, че първото %s подаване е между „%s“ и „%s“.\n"
 "Двоичното търсене продължава."
 
@@ -1785,11 +1826,11 @@ msgstr "необходима е версия „%s“"
 
 #, c-format
 msgid "could not create file '%s'"
-msgstr "файлът „%s“ не може да бъде създаден"
+msgstr "файлът „%s“ не може да се създаде"
 
 #, c-format
 msgid "could not read file '%s'"
-msgstr "файлът „%s“ не може да бъде прочетен"
+msgstr "файлът „%s“ не може да се прочете"
 
 msgid "reading bisect refs failed"
 msgstr "неуспешно прочитане на указателите за двоично търсене"
@@ -1844,7 +1885,7 @@ msgstr "няма път на име „%s“ в „%s“"
 
 #, c-format
 msgid "cannot read blob %s for path %s"
-msgstr "обектът-BLOB „%s“ в пътя %s не може да бъде прочетен"
+msgstr "обектът-BLOB „%s“ в пътя %s не може да се прочете"
 
 msgid ""
 "cannot inherit upstream tracking configuration of multiple refs when "
@@ -1871,7 +1912,7 @@ msgid "branch '%s' set up to track:"
 msgstr "клонът „%s“ ще следи:"
 
 msgid "unable to write upstream branch configuration"
-msgstr "настройките за следения клон не може да бъдат записани"
+msgstr "настройките за следения клон не може да се запишат"
 
 msgid ""
 "\n"
@@ -1944,11 +1985,11 @@ msgstr "„%s“ не е позволено име за клон"
 msgid "a branch named '%s' already exists"
 msgstr "вече съществува клон с име „%s“."
 
-# FIXME
 #, c-format
-msgid "cannot force update the branch '%s' checked out at '%s'"
+msgid "cannot force update the branch '%s' used by worktree at '%s'"
 msgstr ""
-"не може принудително да обновите клона „%s“, който е изтеглен в пътя „%s“"
+"не може принудително да обновите клона „%s“, който се ползва от работното "
+"дърво в „%s“"
 
 #, c-format
 msgid "cannot set up tracking information; starting point '%s' is not a branch"
@@ -2007,8 +2048,8 @@ msgid "submodule '%s': cannot create branch '%s'"
 msgstr "подмодул „%s“: клонът „%s“ не може да се създаде"
 
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "„%s“ вече е изтеглен в „%s“"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "„%s“ вече се ползва от работното дърво в „%s“"
 
 msgid "git add [<options>] [--] <pathspec>..."
 msgstr "git add [ОПЦИЯ…] [--] ПЪТ…"
@@ -2017,17 +2058,6 @@ msgstr "git add [ОПЦИЯ…] [--] ПЪТ…"
 msgid "cannot chmod %cx '%s'"
 msgstr "права̀та на „%2$s“ не може да се зададат да са %1$cx"
 
-#, c-format
-msgid "unexpected diff status %c"
-msgstr "неочакван изходен код при генериране на разлика: %c"
-
-msgid "updating files failed"
-msgstr "неуспешно обновяване на файловете"
-
-#, c-format
-msgid "remove '%s'\n"
-msgstr "изтриване на „%s“\n"
-
 msgid "Unstaged changes after refreshing the index:"
 msgstr "Промѐни, които и след обновяването на индекса не са добавени към него:"
 
@@ -2038,29 +2068,26 @@ msgstr ""
 "Настройката „add.interactive.useBuiltin“ е премахната!\n"
 "За подробности я потърсете в изхода от „git help config“."
 
-msgid "Could not read the index"
-msgstr "Индексът не може да бъде прочетен"
-
-msgid "Could not write patch"
-msgstr "Кръпката не може да бъде записана"
+msgid "could not read the index"
+msgstr "индексът не може да се прочете"
 
 msgid "editing patch failed"
 msgstr "неуспешно редактиране на кръпка"
 
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "Ð\9dе Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ñ\81е Ð¿Ð¾Ð»Ñ\83Ñ\87и Ð¸Ð½Ñ\84оÑ\80маÑ\86иÑ\8f Ñ\87Ñ\80ез â\80\9estatâ\80\9c Ð·Ð° Ñ\84айла „%s“"
+msgid "could not stat '%s'"
+msgstr "неÑ\83Ñ\81пеÑ\88но Ð¸Ð·Ð¿Ñ\8aлнение Ð½Ð° â\80\9estatâ\80\9c Ð²Ñ\8aÑ\80Ñ\85Ñ\83 „%s“"
 
-msgid "Empty patch. Aborted."
-msgstr "Ð\9fÑ\80азна ÐºÑ\80Ñ\8aпка, Ð¿Ñ\80еÑ\83Ñ\81Ñ\82ановÑ\8fване Ð½Ð° Ð´ÐµÐ¹Ñ\81Ñ\82виеÑ\82о."
+msgid "empty patch. aborted"
+msgstr "пÑ\80азна ÐºÑ\80Ñ\8aпка, Ð¿Ñ\80еÑ\83Ñ\81Ñ\82ановÑ\8fване Ð½Ð° Ð´ÐµÐ¹Ñ\81Ñ\82виеÑ\82о"
 
 #, c-format
-msgid "Could not apply '%s'"
-msgstr "Ð\9aÑ\80Ñ\8aпкаÑ\82а â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¿Ñ\80иложена"
+msgid "could not apply '%s'"
+msgstr "кÑ\80Ñ\8aпкаÑ\82а â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ñ\81е Ð¿Ñ\80иложи"
 
 msgid "The following paths are ignored by one of your .gitignore files:\n"
 msgstr ""
-"Следните пътища ще бъдат игнорирани според някой от файловете „.gitignore“:\n"
+"Следните пътища ще се игнорират според някой от файловете „.gitignore“:\n"
 
 msgid "dry run"
 msgstr "пробно изпълнение"
@@ -2087,7 +2114,7 @@ msgid "renormalize EOL of tracked files (implies -u)"
 msgstr "уеднаквяване на знаците за край на файл (включва опцията „-u“)"
 
 msgid "record only the fact that the path will be added later"
-msgstr "отбелязване само на факта, че пътят ще бъде добавен по-късно"
+msgstr "отбелязване само на факта, че пътят ще се добави по-късно"
 
 msgid "add changes from all tracked and untracked files"
 msgstr "добавяне на всички промѐни в следените и неследените файлове"
@@ -2101,7 +2128,7 @@ msgid "don't add, only refresh the index"
 msgstr "без добавяне на нови файлове, само обновяване на индекса"
 
 msgid "just skip files which cannot be added because of errors"
-msgstr "прескачане на файловете, които не може да бъдат добавени поради грешки"
+msgstr "прескачане на файловете, които не може да се добавят поради грешки"
 
 msgid "check if - even missing - files are ignored in dry run"
 msgstr ""
@@ -2190,6 +2217,9 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "файлът с индекса е повреден"
 
+msgid "unable to write new index file"
+msgstr "неуспешно записване на новия индекс"
+
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "неправилно действие „%s“ за „%s“"
@@ -2200,7 +2230,7 @@ msgstr "неправилна стойност за „%s“: „%s“"
 
 #, c-format
 msgid "could not read '%s'"
-msgstr "файлът „%s“ не може да бъде прочетен"
+msgstr "файлът „%s“ не може да се прочете"
 
 msgid "could not parse author script"
 msgstr "скриптът за автор не може да се анализира"
@@ -2226,11 +2256,11 @@ msgstr "неуспешно изпълнение на „fseek“"
 
 #, c-format
 msgid "could not open '%s' for reading"
-msgstr "файлът не може да бъде прочетен: „%s“"
+msgstr "файлът не може да се прочете: „%s“"
 
 #, c-format
 msgid "could not open '%s' for writing"
-msgstr "„%s“ не може да бъде отворен за запис"
+msgstr "„%s“ не може да се отвори за запис"
 
 #, c-format
 msgid "could not parse patch '%s'"
@@ -2238,7 +2268,7 @@ msgstr "кръпката „%s“ не може да се анализира"
 
 msgid "Only one StGIT patch series can be applied at once"
 msgstr ""
-"Само една поредица от кръпки от „StGIT“ може да бъде прилагана в даден момент"
+"Само една поредица от кръпки от „StGIT“ може да се приложи в даден момент"
 
 msgid "invalid timestamp"
 msgstr "неправилна стойност за времево клеймо"
@@ -2250,14 +2280,14 @@ msgid "invalid timezone offset"
 msgstr "неправилно отместване на часовия пояс"
 
 msgid "Patch format detection failed."
-msgstr "Форматът на кръпката не може да бъде определен."
+msgstr "Форматът на кръпката не може да се определи."
 
 #, c-format
 msgid "failed to create directory '%s'"
-msgstr "директорията „%s“ не може да бъде създадена"
+msgstr "директорията „%s“ не може да се създаде"
 
 msgid "Failed to split patches."
-msgstr "Кръпките не може да бъдат разделени."
+msgstr "Кръпките не може да се разделят."
 
 #, c-format
 msgid "When you have resolved this problem, run \"%s --continue\"."
@@ -2302,7 +2332,7 @@ msgstr "грешен ред с идентичност: %.*s"
 
 #, c-format
 msgid "unable to parse commit %s"
-msgstr "подаването не може да бъде анализирано: %s"
+msgstr "подаването не може да се анализира: %s"
 
 msgid "Repository lacks necessary blobs to fall back on 3-way merge."
 msgstr ""
@@ -2332,7 +2362,7 @@ msgid "applying to an empty history"
 msgstr "прилагане върху празна история"
 
 msgid "failed to write commit object"
-msgstr "обектът за подаването не може да бъде записан"
+msgstr "обектът за подаването не може да се запише"
 
 #, c-format
 msgid "cannot resume: %s does not exist."
@@ -2352,12 +2382,11 @@ msgstr ""
 "на всичко:"
 
 msgid "unable to write index file"
-msgstr "индексът не може да бъде записан"
+msgstr "индексът не може да се запише"
 
 #, c-format
 msgid "Dirty index: cannot apply patches (dirty: %s)"
-msgstr ""
-"Индексът не е чист: кръпките не може да бъдат приложени (замърсени са: %s)"
+msgstr "Индексът не е чист: кръпките не може да се приложат (замърсени са: %s)"
 
 #, c-format
 msgid "Skipping: %.*s"
@@ -2409,15 +2438,12 @@ msgstr ""
 "След корекция на конфликтите изпълнете „git add“ върху поправените файлове.\n"
 "За да приемете „изтрити от тях“, изпълнете „git rm“ върху изтритите файлове."
 
-msgid "unable to write new index file"
-msgstr "неуспешно записване на новия индекс"
-
 #, c-format
 msgid "Could not parse object '%s'."
 msgstr "„%s“ не е разпознат като обект."
 
 msgid "failed to clean index"
-msgstr "индексът не може да бъде изчистен"
+msgstr "индексът не може да се изчисти"
 
 msgid ""
 "You seem to have moved HEAD since the last 'am' failure.\n"
@@ -2431,17 +2457,13 @@ msgstr ""
 
 #, c-format
 msgid "failed to read '%s'"
-msgstr "„%s“ не може да бъде прочетен"
-
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "опциите „%s=%s“ и „%s=%s“ са несъвместими"
+msgstr "„%s“ не може да се прочете"
 
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
-msgstr "git am [ОПЦИЯ…] [(ФАЙЛ_С_ПОЩА | ДИРЕКТОРИЯ_С_ПОЩА)…]"
+msgstr "git am [ОПЦИЯ…] [(ФАЙЛ_С_ПОЩА|ДИРЕКТОРИЯ_С_ПОЩА)…]"
 
 msgid "git am [<options>] (--continue | --skip | --abort)"
-msgstr "git am [ОПЦИЯ…] (--continue | --skip | --abort)"
+msgstr "git am [ОПЦИЯ…] (--continue|--skip|--abort)"
 
 msgid "run interactively"
 msgstr "интерактивна работа"
@@ -2479,11 +2501,6 @@ msgid "pass --keep-cr flag to git-mailsplit for mbox format"
 msgstr ""
 "подаване на опцията „--keep-cr“ на командата „git-mailsplit“ за формат „mbox“"
 
-msgid "do not pass --keep-cr flag to git-mailsplit independent of am.keepcr"
-msgstr ""
-"без подаване на опцията „--keep-cr“ на командата „git-mailsplit“ независимо "
-"от „am.keepcr“"
-
 msgid "strip everything before a scissors line"
 msgstr "пропускане на всичко преди реда за отрязване"
 
@@ -2581,7 +2598,7 @@ msgid "git apply [<options>] [<patch>...]"
 msgstr "git apply [ОПЦИЯ…] [КРЪПКА…]"
 
 msgid "could not redirect output"
-msgstr "изходът не може да бъде пренасочен"
+msgstr "изходът не може да се пренасочи"
 
 msgid "git archive: Remote with no URL"
 msgstr "git archive: Липсва адрес за отдалеченото хранилище"
@@ -2601,12 +2618,12 @@ msgid "git archive: expected a flush"
 msgstr "git archive: очакваше се изчистване на буферите чрез „flush“"
 
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=УПРАВЛЯВАЩА_ДУМА --term-{old,good}"
-"=УПРАВЛЯВАЩА_ДУМА] [--no-checkout] [--first-parent] [ЛОШО [ДОБРО…]] [--] "
-"[ПЪТ…]"
+"git bisect start [--term-(new,bad)=УПРАВЛЯВАЩА_ДУМА --term-(old,"
+"good)=УПРАВЛЯВАЩА_ДУМА] [--no-checkout] [--first-parent] [ЛОШО [ДОБРО…]] "
+"[--] [ПЪТ…]"
 
 msgid "git bisect (good|bad) [<rev>...]"
 msgstr "git bisect (good|bad) [ВЕРСИЯ…]"
@@ -2620,8 +2637,8 @@ msgstr "git bisect reset [ПОДАВАНЕ]"
 msgid "git bisect replay <logfile>"
 msgstr "git bisect replay ИМЕ_НА_ФАЙЛ"
 
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run КОМАНДА…"
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run КОМАНДА… [АРГУМЕНТ…]"
 
 #, c-format
 msgid "cannot open file '%s' in mode '%s'"
@@ -2633,7 +2650,7 @@ msgstr "във файла „%s“ не може да се пише"
 
 #, c-format
 msgid "cannot open file '%s' for reading"
-msgstr "файлът „%s“ не може да бъде отворен за четене"
+msgstr "файлът „%s“ не може да се отвори за четене"
 
 #, c-format
 msgid "'%s' is not a valid term"
@@ -2662,8 +2679,8 @@ msgstr "„%s“ не е подаване"
 msgid ""
 "could not check out original HEAD '%s'. Try 'git bisect reset <commit>'."
 msgstr ""
-"първоначално указаното „%s“ в указателя „HEAD“ не може да бъде\n"
-"изÑ\82еглено.  Пробвайте да изпълните командата „git bisect reset ПОДАВАНЕ“."
+"първоначално указаното „%s“ в указателя „HEAD“ не може да се\n"
+"изÑ\82егли.  Пробвайте да изпълните командата „git bisect reset ПОДАВАНЕ“."
 
 #, c-format
 msgid "Bad bisect_write argument: %s"
@@ -3034,7 +3051,7 @@ msgid "Blaming lines"
 msgstr "Редове с авторство"
 
 msgid "git branch [<options>] [-r | -a] [--merged] [--no-merged]"
-msgstr "git branch [ОПЦИЯ…] [-r | -a] [--merged] [--no-merged]"
+msgstr "git branch [ОПЦИЯ…] [-r|-a] [--merged] [--no-merged]"
 
 msgid ""
 "git branch [<options>] [-f] [--recurse-submodules] <branch-name> [<start-"
@@ -3045,61 +3062,65 @@ msgid "git branch [<options>] [-l] [<pattern>...]"
 msgstr "git branch [ОПЦИЯ…] [-l] [ШАБЛОН…]"
 
 msgid "git branch [<options>] [-r] (-d | -D) <branch-name>..."
-msgstr "git branch [ОПЦИЯ…] [-r] (-d | -D) ИМЕ_НА_КЛОН…"
+msgstr "git branch [ОПЦИЯ…] [-r] (-d|-D) ИМЕ_НА_КЛОН…"
 
 msgid "git branch [<options>] (-m | -M) [<old-branch>] <new-branch>"
-msgstr "git branch [ОПЦИЯ…] (-m | -M) [СТАР_КЛОН] НОВ_КЛОН"
+msgstr "git branch [ОПЦИЯ…] (-m|-M) [СТАР_КЛОН] НОВ_КЛОН"
 
 msgid "git branch [<options>] (-c | -C) [<old-branch>] <new-branch>"
-msgstr "git branch [ОПЦИЯ…] (-c | -C) [СТАР_КЛОН] НОВ_КЛОН"
+msgstr "git branch [ОПЦИЯ…] (-c|-C) [СТАР_КЛОН] НОВ_КЛОН"
 
 msgid "git branch [<options>] [-r | -a] [--points-at]"
-msgstr "git branch [ОПЦИЯ…] [-r | -a] [--points-at]"
+msgstr "git branch [ОПЦИЯ…] [-r|-a] [--points-at]"
 
 msgid "git branch [<options>] [-r | -a] [--format]"
-msgstr "git branch [ОПЦИЯ…] [-r | -a] [--format]"
+msgstr "git branch [ОПЦИЯ…] [-r|-a] [--format]"
 
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
 "изтриване на клона „%s“, който е слят към „%s“,\n"
-"    но още не е слят към върха „HEAD“."
+"    но още не е слят към върха „HEAD“"
 
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
 "отказване на изтриване на клона „%s“, който не е слят към\n"
-"    „%s“, но е слят към върха „HEAD“."
+"    „%s“, но е слят към върха „HEAD“"
 
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
-msgstr "Ð\9eбекÑ\82Ñ\8aÑ\82-подаване Ð·Ð° â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¾Ñ\82кÑ\80иÑ\82"
+msgid "couldn't look up commit object for '%s'"
+msgstr "обекÑ\82Ñ\8aÑ\82-подаване Ð·Ð° â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ñ\81е Ð¾Ñ\82кÑ\80ие"
 
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
+msgid "the branch '%s' is not fully merged"
+msgstr "клонът „%s“ не е слят напълно"
+
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
 msgstr ""
-"Клонът „%s“ не е слят напълно.  Ако сте сигурни, че искате\n"
-"да го изтриете, изпълнете „git branch -D %s“."
+"Ако сте сигурни, че искате да го изтриете, изпълнете:\n"
+"\n"
+"    git branch -D %s"
 
-msgid "Update of config-file failed"
-msgstr "Ð\9dеуспешно обновяване на конфигурационния файл"
+msgid "update of config-file failed"
+msgstr "неуспешно обновяване на конфигурационния файл"
 
 msgid "cannot use -a with -d"
 msgstr "опциите „-a“ и „-d“ са несъвместими"
 
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "Не може да изтриете клона „%s“, който е изтеглен в пътя „%s“"
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr ""
+"не може да изтриете клона „%s“, който се ползва от работното дърво в „%s“"
 
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "Ñ\81ледÑ\8fÑ\89иÑ\8fÑ\82 ÐºÐ»Ð¾Ð½ â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¾Ñ\82кÑ\80иÑ\82."
+msgid "remote-tracking branch '%s' not found"
+msgstr "Ñ\81ледÑ\8fÑ\89иÑ\8fÑ\82 ÐºÐ»Ð¾Ð½ â\80\9e%sâ\80\9c Ð»Ð¸Ð¿Ñ\81ва"
 
 #, c-format
 msgid ""
@@ -3110,8 +3131,8 @@ msgstr ""
 "Пробвахте ли опцията „--remote“?"
 
 #, c-format
-msgid "branch '%s' not found."
-msgstr "клонÑ\8aÑ\82 â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¾Ñ\82кÑ\80иÑ\82."
+msgid "branch '%s' not found"
+msgstr "клонÑ\8aÑ\82 â\80\9e%sâ\80\9c Ð»Ð¸Ð¿Ñ\81ва"
 
 #, c-format
 msgid "Deleted remote-tracking branch %s (was %s).\n"
@@ -3129,55 +3150,55 @@ msgstr "подаването, сочено от указателя „HEAD“, 
 
 #, c-format
 msgid "HEAD (%s) points outside of refs/heads/"
-msgstr "„HEAD“ (%s) сочи извън директорията „refs/heads“"
+msgstr "„HEAD“ (%s) сочи извън директорията „refs/heads/“"
 
 #, c-format
-msgid "Branch %s is being rebased at %s"
-msgstr "Ð\9aлонът „%s“ се пребазира върху „%s“"
+msgid "branch %s is being rebased at %s"
+msgstr "клонът „%s“ се пребазира върху „%s“"
 
 #, c-format
-msgid "Branch %s is being bisected at %s"
-msgstr "Търси се двоично в клона „%s“ при „%s“"
+msgid "branch %s is being bisected at %s"
+msgstr "търси се двоично в клона „%s“ при „%s“"
 
 #, c-format
 msgid "HEAD of working tree %s is not updated"
 msgstr "Указателят „HEAD“ на работното дърво „%s“ не е обновен"
 
 #, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Ð\9dеправилно име на клон: „%s“"
+msgid "invalid branch name: '%s'"
+msgstr "неправилно име на клон: „%s“"
 
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Ð\92 ÐºÐ»Ð¾Ð½Ð° â\80\9e%sâ\80\9c Ð²Ñ\81е Ð¾Ñ\89е Ð½Ñ\8fма Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñ\8f."
+msgid "no commit on branch '%s' yet"
+msgstr "в ÐºÐ»Ð¾Ð½Ð° â\80\9e%sâ\80\9c Ð²Ñ\81е Ð¾Ñ\89е Ð½Ñ\8fма Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñ\8f"
 
 #, c-format
-msgid "No branch named '%s'."
-msgstr "Ð\9bипÑ\81ва ÐºÐ»Ð¾Ð½ Ð½Ð° Ð¸Ð¼Ðµ â\80\9e%sâ\80\9c."
+msgid "no branch named '%s'"
+msgstr "липÑ\81ва ÐºÐ»Ð¾Ð½ Ð½Ð° Ð¸Ð¼Ðµ â\80\9e%sâ\80\9c"
 
-msgid "Branch rename failed"
-msgstr "Ð\9dеуспешно преименуване на клон"
+msgid "branch rename failed"
+msgstr "неуспешно преименуване на клон"
 
-msgid "Branch copy failed"
-msgstr "Ð\9dеуспешно копиране на клон"
+msgid "branch copy failed"
+msgstr "неуспешно копиране на клон"
 
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "Ð\9aлонът с неправилно име „%s“ е копиран"
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "клонът с неправилно име „%s“ е копиран"
 
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
-msgstr "Ð\9aлонът с неправилно име „%s“ е преименуван"
+msgid "renamed a misnamed branch '%s' away"
+msgstr "клонът с неправилно име „%s“ е преименуван"
 
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "Ð\9aлонът е преименуван на „%s“, но указателят „HEAD“ не е обновен"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "клонът е преименуван на „%s“, но указателят „HEAD“ не е обновен"
 
-msgid "Branch is renamed, but update of config-file failed"
-msgstr "Ð\9aлонът е преименуван, но конфигурационният файл не е обновен"
+msgid "branch is renamed, but update of config-file failed"
+msgstr "клонът е преименуван, но конфигурационният файл не е обновен"
 
-msgid "Branch is copied, but update of config-file failed"
-msgstr "Ð\9aлонът е копиран, но конфигурационният файл не е обновен"
+msgid "branch is copied, but update of config-file failed"
+msgstr "клонът е копиран, но конфигурационният файл не е обновен"
 
 #, c-format
 msgid ""
@@ -3294,8 +3315,8 @@ msgstr "рекурсивно обхождане подмодулите"
 msgid "format to use for the output"
 msgstr "ФОРМАТ за изхода"
 
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "Не може да се открие към какво сочи указателят „HEAD“"
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "указателят „HEAD“ не сочи към обект"
 
 msgid "HEAD not found below refs/heads!"
 msgstr "В директорията „refs/heads“ липсва файл „HEAD“"
@@ -3314,16 +3335,16 @@ msgstr ""
 msgid "branch name required"
 msgstr "Необходимо е име на клон"
 
-msgid "Cannot give description to detached HEAD"
-msgstr "Ð\9dе може да зададете описание на несвързан „HEAD“"
+msgid "cannot give description to detached HEAD"
+msgstr "не може да зададете описание на несвързан „HEAD“"
 
 msgid "cannot edit description of more than one branch"
-msgstr "Ð\9dе може да редактирате описанието на повече от един клон едновременно"
+msgstr "не може да редактирате описанието на повече от един клон едновременно"
 
-msgid "cannot copy the current branch while not on any."
+msgid "cannot copy the current branch while not on any"
 msgstr "не може да копирате текущия клон, защото сте извън който и да е клон"
 
-msgid "cannot rename the current branch while not on any."
+msgid "cannot rename the current branch while not on any"
 msgstr ""
 "не може да преименувате текущия клон, защото сте извън който и да е клон"
 
@@ -3338,32 +3359,31 @@ msgstr "прекалено много аргументи към командат
 
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
-"Следеното от „HEAD“ не може да се зададе да е „%s“, защото то не сочи към "
-"никой клон."
+"следеното от „HEAD“ не може да се зададе да е „%s“, защото то не сочи към "
+"никой клон"
 
 #, c-format
 msgid "no such branch '%s'"
-msgstr "Ð\9dяма клон на име „%s“."
+msgstr "няма клон на име „%s“."
 
 #, c-format
 msgid "branch '%s' does not exist"
-msgstr "Ð\9dе съществува клон на име „%s“."
+msgstr "не съществува клон на име „%s“."
 
 msgid "too many arguments to unset upstream"
 msgstr "прекалено много аргументи към командата за спиране на следене"
 
-msgid "could not unset upstream of HEAD when it does not point to any branch."
-msgstr ""
-"Следеното от „HEAD“ не може да махне, защото то не сочи към никой клон."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
+msgstr "следеното от „HEAD“ не може да махне, защото то не сочи към никой клон"
 
 #, c-format
-msgid "Branch '%s' has no upstream information"
-msgstr "Ð\9dяма информация клонът „%s“ да следи някой друг"
+msgid "branch '%s' has no upstream information"
+msgstr "няма информация клонът „%s“ да следи някой друг"
 
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
 "опциите „-a“ и „-r“ на „git branch“ са несъвместими с име на клон.\n"
@@ -3371,7 +3391,7 @@ msgstr ""
 
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
 "опцията „--set-upstream“ вече не се поддържа.  Използвайте „--track“ или „--"
 "set-upstream-to“"
@@ -3396,7 +3416,7 @@ msgid ""
 "git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
 "              [--diagnose[=<mode>]]"
 msgstr ""
-"git bugreport [(-o | --output-directory) ПЪТ] [(-s | --suffix) ФОРМАТ]\n"
+"git bugreport [(-o|--output-directory) ПЪТ] [(-s|--suffix) ФОРМАТ]\n"
 "              [--diagnose[=РЕЖИМ]]"
 
 msgid ""
@@ -3449,6 +3469,10 @@ msgstr "укажете местоположение, в което да се з
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "укажете суфикса на файловете във формат за „strftime“"
 
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "непозната опция „%s“"
+
 #, c-format
 msgid "could not create leading directories for '%s'"
 msgstr "родителските директории на „%s“ не може да бъдат създадени"
@@ -3475,11 +3499,11 @@ msgid ""
 "git bundle create [-q | --quiet | --progress]\n"
 "                  [--version=<version>] <file> <git-rev-list-args>"
 msgstr ""
-"git bundle create [-q | --quiet | --progress ]\n"
+"git bundle create [-q|--quiet|--progress ]\n"
 "                  [--version=ВЕРСИЯ] ФАЙЛ ОПЦИЯ_ЗА_git-rev-list…"
 
 msgid "git bundle verify [-q | --quiet] <file>"
-msgstr "git bundle verify [-q | --quiet] ФАЙЛ"
+msgstr "git bundle verify [-q|--quiet] ФАЙЛ"
 
 msgid "git bundle list-heads <file> [<refname>...]"
 msgstr "git bundle list-heads ФАЙЛ [ИМЕ_НА_УКАЗАТЕЛ…]"
@@ -3550,28 +3574,27 @@ msgid "git cat-file <type> <object>"
 msgstr "git cat-file ВИД ОБЕКТ"
 
 msgid "git cat-file (-e | -p) <object>"
-msgstr "git cat-file (-e | -p) ОБЕКТ"
+msgstr "git cat-file (-e|-p) ОБЕКТ"
 
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
-msgstr "git cat-file (-t | -s) [--allow-unknown-type] ОБЕКТ"
+msgstr "git cat-file (-t|-s) [--allow-unknown-type] ОБЕКТ"
 
 msgid ""
-"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
-"objects]\n"
-"             [--buffer] [--follow-symlinks] [--unordered]\n"
-"             [--textconv | --filters] [-z]"
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
 msgstr ""
+"git cat-file (--textconv|--filters)\n"
+"             [ВЕРСИЯ:ПЪТ|ДЪРВО|--path=ПЪТ|ДЪРВО ВЕРСИЯ]"
+
+msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
 "objects]\n"
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
-"             [--textconv | --filters] [-z]"
-
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+"             [--textconv | --filters] [-Z]"
 msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [ВЕРСИЯ:ПЪТ|ДЪРВО | --path=ПЪТ|ДЪРВО ВЕРСИЯ]"
+"git cat-file (--batch|--batch-check|--batch-command) [--batch-all-objects]\n"
+"             [--buffer] [--follow-symlinks] [--unordered]\n"
+"             [--textconv|--filters] [-Z]"
 
 msgid "Check object existence or emit object contents"
 msgstr "Проверка за съществуването на обекта или извеждане на съдържанието му"
@@ -3615,6 +3638,9 @@ msgstr "като „--batch“, но без извеждане на съдърж
 msgid "stdin is NUL-terminated"
 msgstr "стандартният вход да ползва нулевия знак „NUL“ за разделител"
 
+msgid "stdin and stdout is NUL-terminated"
+msgstr "стандартните вход и изход да ползват нулевия знак „NUL“ за разделител"
+
 msgid "read commands from stdin"
 msgstr "изчитане на командите от стандартния вход"
 
@@ -3689,14 +3715,12 @@ msgid ""
 "git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
 "<pathname>..."
 msgstr ""
-"git check-attr [--source УКАЗАТЕЛ_КЪМ_ДЪРВО] [-a | --all | АТРИБУТ…] [--] "
-"ПЪТ…"
+"git check-attr [--source УКАЗАТЕЛ_КЪМ_ДЪРВО] [-a|--all|АТРИБУТ…] [--] ПЪТ…"
 
 msgid ""
 "git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
 msgstr ""
-"git check-attr --stdin [-z] [--source УКАЗАТЕЛ_КЪМ_ДЪРВО] [-a | --all | "
-"АТРИБУТ…]"
+"git check-attr --stdin [-z] [--source УКАЗАТЕЛ_КЪМ_ДЪРВО] [-a|--all|АТРИБУТ…]"
 
 msgid "report all attributes set on file"
 msgstr "извеждане на всички атрибути, зададени върху файл"
@@ -3875,6 +3899,10 @@ msgstr "опцията „%s“ е задължителна, когато „%s
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "опцията „%3$s“ е несъвместима както с „%1$s“, така и с „%2$s“"
 
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr "„%s“, „%s“ и „%s“ са несъвместими с изтеглянето на дърво"
+
 #, c-format
 msgid "path '%s' is unmerged"
 msgstr "пътят „%s“ не е слят"
@@ -4134,8 +4162,8 @@ msgstr "принудително изтегляне (вашите промѐн
 msgid "new-branch"
 msgstr "НОВ_КЛОН"
 
-msgid "new unparented branch"
-msgstr "нов ÐºÐ»Ð¾Ð½ Ð±ÐµÐ· Ñ\80одиÑ\82ел"
+msgid "new unborn branch"
+msgstr "нов Ð½ÐµÑ\80одеÌ\80н ÐºÐ»Ð¾Ð½"
 
 msgid "update ignored files (default)"
 msgstr "обновяване на игнорираните файлове (стандартно)"
@@ -4165,7 +4193,7 @@ msgstr "липсва име на клон, използвайте опцията
 
 #, c-format
 msgid "could not resolve %s"
-msgstr "â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¾Ñ\82кÑ\80иÑ\82"
+msgstr "â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¿Ñ\80оÑ\81леден"
 
 msgid "invalid path specification"
 msgstr "указан е неправилен път"
@@ -4240,7 +4268,7 @@ msgstr "използване на припокриващ режим"
 msgid ""
 "git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
 "[<pathspec>...]"
-msgstr "git clean [-d] [-f] [-i] [-n] [-q] [-e ШАБЛОН] [-x | -X] [--] [ПЪТ…]"
+msgstr "git clean [-d] [-f] [-i] [-n] [-q] [-e ШАБЛОН] [-x|-X] [--] [ПЪТ…]"
 
 #, c-format
 msgid "Removing %s\n"
@@ -4388,9 +4416,6 @@ msgstr ""
 "което изисква някоя от опциите „-i“, „-n“ или „-f“.  Няма да се извърши "
 "изчистване"
 
-msgid "-x and -X cannot be used together"
-msgstr "опциите „-x“ и „-X“ са несъвместими"
-
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [ОПЦИЯ…] [--] ХРАНИЛИЩЕ [ДИРЕКТОРИЯ]"
 
@@ -4482,6 +4507,9 @@ msgstr "СЛУЖЕБНА_ДИРЕКТОРИЯ"
 msgid "separate git dir from working tree"
 msgstr "отделна СЛУЖЕБНА_ДИРЕКТОРИЯ за git извън работното дърво"
 
+msgid "specify the reference format to use"
+msgstr "указване на форма̀та за указател"
+
 msgid "key=value"
 msgstr "КЛЮЧ=СТОЙНОСТ"
 
@@ -4494,12 +4522,6 @@ msgstr "специфични за сървъра"
 msgid "option to transmit"
 msgstr "опция за пренос"
 
-msgid "use IPv4 addresses only"
-msgstr "само адреси IPv4"
-
-msgid "use IPv6 addresses only"
-msgstr "само адреси IPv6"
-
 msgid "apply partial clone filters to submodules"
 msgstr "прилагане на филтрите за непълно хранилище към подмодулите"
 
@@ -4615,12 +4637,9 @@ msgstr "Прекалено много аргументи."
 msgid "You must specify a repository to clone."
 msgstr "Трябва да укажете кое хранилище искате да клонирате."
 
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"опцията „--bundle-uri“ е несъвместима с „--depth“, „--shallow-since“ и „--"
-"shallow-exclude“"
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "непознат формат на съхранение: „%s“"
 
 #, c-format
 msgid "repository '%s' does not exist"
@@ -4758,11 +4777,11 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir ДИРЕКТОРИЯ] [--append]\n"
-"                       [--split[=СТРАТЕГИЯ]] [--reachable | --stdin-packs | "
-"--stdin-commits]\n"
+"                       [--split[=СТРАТЕГИЯ]] [--reachable|--stdin-packs|--"
+"stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters БРОЙ] [--"
 "[no-]progress]\n"
 "                       ОПЦИИ_ЗА_РАЗДЕЛЯНЕ"
@@ -4775,12 +4794,16 @@ msgstr "ДИРекторията_с_ОБЕКТИ за запазване на г
 
 msgid "if the commit-graph is split, only verify the tip file"
 msgstr ""
-"ако гра̀фа с подаванията е раздробен, да се проверява само файлът на върха"
+"ако графът с подаванията е раздробен, да се проверява само файлът на върха"
 
 #, c-format
 msgid "Could not open commit-graph '%s'"
 msgstr "Графът с подаванията не може да се отвори: „%s“"
 
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "веригата на гра̀фа с подаванията не може да се отвори: „%s“"
+
 #, c-format
 msgid "unrecognized --split argument, %s"
 msgstr "непознат аргумент към „--split“: %s"
@@ -4900,13 +4923,13 @@ msgid ""
 "           [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
 "           [--] [<pathspec>...]"
 msgstr ""
-"git commit [-a | --interactive | --patch] [-s] [-v] [-u РЕЖИМ] [--amend]\n"
-"           [--dry-run] [(-c | -C | --squash) ПОДАВАНЕ | --fixup [(amend|"
+"git commit [-a|--interactive|--patch] [-s] [-v] [-u РЕЖИМ] [--amend]\n"
+"           [--dry-run] [(-c|-C|--squash) ПОДАВАНЕ |--fixup [(amend|"
 "reword):]ПОДАВАНЕ)]\n"
-"           [-F ФАЙЛ | -m СЪОБЩЕНИЕ] [--reset-author] [--allow-empty]\n"
+"           [-F ФАЙЛ|-m СЪОБЩЕНИЕ] [--reset-author] [--allow-empty]\n"
 "           [--allow-empty-message] [--no-verify] [-e] [--author=АВТОР]\n"
 "           [--date=ДАТА] [--cleanup=РЕЖИМ] [--[no-]status]\n"
-"           [-i | -o] [--pathspec-from-file=ФАЙЛ> [--pathspec-file-nul]]\n"
+"           [-i|-o] [--pathspec-from-file=ФАЙЛ> [--pathspec-file-nul]]\n"
 "           [(--trailer ЛЕКСЕМА[(=|:)СТОЙНОСТ])…] [-"
 "S[ИДЕНТИФИКАТОР_НА_КЛЮЧ]]\n"
 "           [--] [ПЪТ…]"
@@ -4972,6 +4995,9 @@ msgstr ""
 "    git cherry-pick --skip\n"
 "\n"
 
+msgid "updating files failed"
+msgstr "неуспешно обновяване на файловете"
+
 msgid "failed to unpack HEAD tree object"
 msgstr "върховото дърво (HEAD tree object) не може да бъде извадено от пакет"
 
@@ -4990,9 +5016,6 @@ msgstr "временният индекс не може да бъде обнов
 msgid "Failed to update main cache tree"
 msgstr "Кешът за обектите-дървета не може да бъде обновен"
 
-msgid "unable to write new_index file"
-msgstr "новият индекс (new_index) не може да бъде записан"
-
 msgid "cannot do a partial commit during a merge."
 msgstr "по време на сливане не може да се извърши частично подаване."
 
@@ -5031,7 +5054,7 @@ msgstr ""
 "използвани всички подобни знаци"
 
 #, c-format
-msgid "could not lookup commit %s"
+msgid "could not lookup commit '%s'"
 msgstr "следното подаване не може да бъде открито: %s"
 
 #, c-format
@@ -5404,12 +5427,12 @@ msgstr "Неизвършване на подаване поради празно
 
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
-"хранилището е обновено, но новият файл за индекс „new_index“\n"
-"не Ðµ Ð·Ð°Ð¿Ð¸Ñ\81ан.  Ð\9fÑ\80овеÑ\80еÑ\82е Ð´Ð°Ð»Ð¸ Ð´Ð¸Ñ\81кÑ\8aÑ\82 Ð½Ðµ Ðµ Ð¿Ñ\80епÑ\8aлнен Ð¸Ð»Ð¸ Ð½Ðµ Ñ\81Ñ\82е\n"
-"пÑ\80евиÑ\88или Ð´Ð¸Ñ\81коваÑ\82а Ñ\81и ÐºÐ²Ð¾Ñ\82а.  Ð\97а Ð²Ñ\8aзÑ\81Ñ\82ановÑ\8fване Ð¸Ð·Ð¿Ñ\8aлнеÑ\82е:\n"
+"хранилището е обновено, но новият файл за индекс не е записан.\n"
+"Ð\9fÑ\80овеÑ\80еÑ\82е Ð´Ð°Ð»Ð¸ Ð´Ð¸Ñ\81кÑ\8aÑ\82 Ð½Ðµ Ðµ Ð¿Ñ\80епÑ\8aлнен Ð¸Ð»Ð¸ Ð½Ðµ Ñ\81Ñ\82е Ð¿Ñ\80евиÑ\88или\n"
+"дисковата си квота.  За възстановяване изпълнете:\n"
 "\n"
 "    git restore --staged :/"
 
@@ -5857,7 +5880,7 @@ msgid ""
 "git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
 "             [--mode=<mode>]"
 msgstr ""
-"git diagnose [(-o | --output-directory) ПЪТ] [(-s | --suffix) ФОРМАТ]\n"
+"git diagnose [(-o|--output-directory) ПЪТ] [(-s|--suffix) ФОРМАТ]\n"
 "             [--diagnose[=РЕЖИМ]]"
 
 msgid "specify a destination for the diagnostics archive"
@@ -6100,7 +6123,7 @@ msgid "git fetch [<options>] <group>"
 msgstr "git fetch [ОПЦИЯ…] ГРУПА"
 
 msgid "git fetch --multiple [<options>] [(<repository> | <group>)...]"
-msgstr "git fetch --multiple [ОПЦИЯ…] [(ХРАНИЛИЩЕ | ГРУПА)…]"
+msgstr "git fetch --multiple [ОПЦИЯ…] [(ХРАНИЛИЩЕ|ГРУПА)…]"
 
 msgid "git fetch --all [<options>]"
 msgstr "git fetch --all [ОПЦИЯ…]"
@@ -6442,8 +6465,7 @@ msgstr "опцията „--stdin“ поддържа доставяне сам
 
 msgid ""
 "git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"
-msgstr ""
-"git fmt-merge-msg [-m СЪОБЩЕНИЕ] [--log[=БРОЙ] | --no-log] [--file ФАЙЛ]"
+msgstr "git fmt-merge-msg [-m СЪОБЩЕНИЕ] [--log[=БРОЙ]|--no-log] [--file ФАЙЛ]"
 
 msgid "populate log with at most <n> entries from shortlog"
 msgstr ""
@@ -6676,7 +6698,7 @@ msgstr "%s: несвързаният връх „HEAD“ не сочи към н
 
 #, c-format
 msgid "notice: %s points to an unborn branch (%s)"
-msgstr "пÑ\80едÑ\83пÑ\80еждение: â\80\9e%sâ\80\9c Ñ\81оÑ\87и ÐºÑ\8aм Ð²Ñ\81е Ð¾Ñ\89е Ð½ÐµÑ\81Ñ\8aÑ\89еÑ\81Ñ\82вÑ\83ваÑ\89 клон (%s)"
+msgstr "пÑ\80едÑ\83пÑ\80еждение: â\80\9e%sâ\80\9c Ñ\81оÑ\87и ÐºÑ\8aм Ð½ÐµÑ\80одеÌ\80н клон (%s)"
 
 #, c-format
 msgid "Checking cache tree of %s"
@@ -6888,6 +6910,9 @@ msgstr "окастряне на обектите, към които нищо н
 msgid "pack unreferenced objects separately"
 msgstr "пакетиране на обектите, към които нищо не сочи, отделно"
 
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "с „--cruft“ размерът на новите ненужни пакети се ограничава"
+
 msgid "be more thorough (increased runtime)"
 msgstr "изчерпателно търсене на боклука (за сметка на повече време работа)"
 
@@ -7070,12 +7095,6 @@ msgstr ""
 msgid "'crontab' died"
 msgstr "процесът на „crontab“ умря"
 
-msgid "failed to start systemctl"
-msgstr "неуспешно стартиране на „systemctl“"
-
-msgid "failed to run systemctl"
-msgstr "неуспешно изпълнение на „systemctl“"
-
 #, c-format
 msgid "failed to delete '%s'"
 msgstr "неуспешно изтриване на „%s“"
@@ -7084,6 +7103,12 @@ msgstr "неуспешно изтриване на „%s“"
 msgid "failed to flush '%s'"
 msgstr "грешка при изчистването на буферите при записването на „%s“"
 
+msgid "failed to start systemctl"
+msgstr "неуспешно стартиране на „systemctl“"
+
+msgid "failed to run systemctl"
+msgstr "неуспешно изпълнение на „systemctl“"
+
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
 msgstr "непознат аргумент към „--scheduler“: %s"
@@ -7107,6 +7132,9 @@ msgstr "ПЛАНИРАЩ_МОДУЛ"
 msgid "scheduler to trigger git maintenance run"
 msgstr "ПЛАНИРАЩият_МОДУЛ, който да изпълнява задачите"
 
+msgid "failed to set up maintenance schedule"
+msgstr "неуспешно насрочване на задачите по поддръжка"
+
 msgid "failed to add repo to global config"
 msgstr "неуспешно добавяне на хранилище към файла с глобални настройки"
 
@@ -7137,6 +7165,10 @@ msgstr "липсва поддръжка за нишки.  „%s“ ще се п
 msgid "unable to read tree (%s)"
 msgstr "дървото не може да бъде прочетено (%s)"
 
+#, c-format
+msgid "unable to read tree %s"
+msgstr "дървото не може да бъде прочетено: %s"
+
 #, c-format
 msgid "unable to grep from object of type %s"
 msgstr "не може да се изпълни „grep“ от обект от вида %s"
@@ -7182,7 +7214,7 @@ msgstr ""
 msgid "search in subdirectories (default)"
 msgstr "търсене в поддиректориите (стандартно)"
 
-msgid "descend at most <depth> levels"
+msgid "descend at most <n> levels"
 msgstr "навлизане максимално на тази ДЪЛБОЧИНА в дървото"
 
 msgid "use extended POSIX regular expressions"
@@ -7335,7 +7367,7 @@ msgid ""
 "git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
 "                [--stdin [--literally]] [--] <file>..."
 msgstr ""
-"git hash-object [-t ВИД] [-w] [--path=ФАЙЛ | --no-filters]\n"
+"git hash-object [-t ВИД] [-w] [--path=ФАЙЛ|--no-filters]\n"
 "                [--stdin [--literally]] [--] ФАЙЛ…"
 
 msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
@@ -7558,10 +7590,6 @@ msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr ""
 "СЪВПАДЕНИЕ НА СТОЙНОСТИТЕ ЗА СУМИТЕ ЗА SHA1: „%s“ НА ДВА РАЗЛИЧНИ ОБЕКТА!"
 
-#, c-format
-msgid "unable to read %s"
-msgstr "обектът „%s“ не може да бъде прочетен"
-
 #, c-format
 msgid "cannot read existing object info %s"
 msgstr "съществуващият обект в „%s“ не може да бъде прочетен"
@@ -7701,89 +7729,16 @@ msgstr "опцията „--verify“ изисква име на пакетен
 msgid "fsck error in pack objects"
 msgstr "грешка при проверка с „fsck“ на пакетните обекти"
 
-#, c-format
-msgid "cannot stat template '%s'"
-msgstr "не може да се получи информация чрез „stat“ за шаблона „%s“"
-
-#, c-format
-msgid "cannot opendir '%s'"
-msgstr "директорията „%s“ не може да бъде отворена"
-
-#, c-format
-msgid "cannot readlink '%s'"
-msgstr "връзката „%s“ не може да бъде прочетена"
-
-#, c-format
-msgid "cannot symlink '%s' '%s'"
-msgstr "не може да се създаде символна връзка „%s“ в „%s“"
-
-#, c-format
-msgid "cannot copy '%s' to '%s'"
-msgstr "„%s“ не може да се копира в „%s“"
-
-#, c-format
-msgid "ignoring template %s"
-msgstr "игнориране на шаблона „%s“"
-
-#, c-format
-msgid "templates not found in %s"
-msgstr "няма шаблони в „%s“"
-
-#, c-format
-msgid "not copying templates from '%s': %s"
-msgstr "шаблоните няма да бъдат копирани от „%s“: „%s“"
-
-#, c-format
-msgid "invalid initial branch name: '%s'"
-msgstr "неправилно име на първоначалния клон: „%s“"
-
-#, c-format
-msgid "unable to handle file type %d"
-msgstr "файлове от вид %d не се поддържат"
-
-#, c-format
-msgid "unable to move %s to %s"
-msgstr "„%s“ не може да се премести в „%s“"
-
-msgid "attempt to reinitialize repository with different hash"
-msgstr ""
-"опит за повторно задаване на първото подаване в хранилището с различна "
-"контролна сума"
-
-#, c-format
-msgid "%s already exists"
-msgstr "Директорията „%s“ вече съществува"
-
-#, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-init: „--initial-branch=%s“ се пропуска"
-
-#, c-format
-msgid "Reinitialized existing shared Git repository in %s%s\n"
-msgstr ""
-"Инициализиране наново на съществуващо, споделено хранилище на Git в „%s%s“\n"
-
-#, c-format
-msgid "Reinitialized existing Git repository in %s%s\n"
-msgstr "Инициализиране наново на съществуващо хранилище на Git в „%s%s“\n"
-
-#, c-format
-msgid "Initialized empty shared Git repository in %s%s\n"
-msgstr "Инициализиране на празно, споделено хранилище на Git в „%s%s“\n"
-
-#, c-format
-msgid "Initialized empty Git repository in %s%s\n"
-msgstr "Инициализиране на празно хранилище на Git в „%s%s“\n"
-
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
-"git init [-q | --quiet] [--bare] [--template=ДИРЕКТОРИЯ_С_ШАБЛОНИ]\n"
+"git init [-q|--quiet] [--bare] [--template=ДИРЕКТОРИЯ_С_ШАБЛОНИ]\n"
 "         [--separate-git-dir ДИРЕКТОРИЯ_НА_GIT] [--object-format=ФОРМАТ]\n"
-"         [-b КЛОН | --initial-branch=КЛОН]\n"
+"         [-b КЛОН|--initial-branch=КЛОН]\n"
 "         [--shared[=ПРАВА̀]] [ДИРЕКТОРИЯ]"
 
 msgid "permissions"
@@ -7828,11 +7783,11 @@ msgstr "опцията „--separate-git-dir“ е несъвместима с 
 
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer ЛЕКСЕМА[(=|:)СТОЙНОСТ])…]\n"
+"                       [(--trailer (КЛЮЧ|СИНОНИМ)[(=|:)СТОЙНОСТ])…]\n"
 "                       [--parse] [ФАЙЛ…]"
 
 msgid "edit files in place"
@@ -7841,6 +7796,9 @@ msgstr "директно редактиране на файловете"
 msgid "trim empty trailers"
 msgstr "изчистване на празните епилози"
 
+msgid "placement"
+msgstr "местоположение"
+
 msgid "where to place the new trailer"
 msgstr "къде да се постави новият епилог"
 
@@ -7853,17 +7811,19 @@ msgstr "действие при липсващ епилог"
 msgid "output only the trailers"
 msgstr "извеждане само на епилозите"
 
-msgid "do not apply config rules"
-msgstr "без Ð¿Ñ\80илагане Ð½Ð° Ð¿Ñ\80авилаÑ\82а Ð·Ð° Ð½Ð°Ñ\81Ñ\82Ñ\80ойкиÑ\82е"
+msgid "do not apply trailer.* configuration variables"
+msgstr "без Ð¿Ñ\80илагане Ð½Ð° ÐºÐ¾Ð½Ñ\84игÑ\83Ñ\80иÑ\80аÑ\89и Ð¿Ñ\80оменливи, Ð·Ð°Ð²Ñ\8aÑ\80Ñ\88ваÑ\89и Ñ\81 ÐµÐ¿Ð¸Ð»Ð¾Ð³.*"
 
-msgid "join whitespace-continued values"
-msgstr "сливане на стойностите последване от знаци за интервали"
+msgid "reformat multiline trailer values as single-line values"
+msgstr ""
+"форматиране на епилози, които заемат повече от един ред, в стойности на един "
+"ред"
 
-msgid "set parsing options"
-msgstr "опÑ\86ии Ð¿Ñ\80и Ð°Ð½Ð°Ð»Ð¸Ð·"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "пÑ\81евдоним Ð½Ð° ÐºÐ¾Ð¼Ð±Ð¸Ð½Ð°Ñ\86иÑ\8fÑ\82а â\80\9e--only-trailers --only-input --unfoldâ\80\9c"
 
-msgid "do not treat --- specially"
-msgstr "„---“ няма специално значение"
+msgid "do not treat \"---\" as the end of input"
+msgstr "„---“ не отбелязва края на входа"
 
 msgid "trailer(s) to add"
 msgstr "епилози за добавяне"
@@ -7952,6 +7912,10 @@ msgstr "трябва да зададете точно един диапазон"
 msgid "not a range"
 msgstr "не е диапазон"
 
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "файлът с описанието на клона „%s“ не може да бъде прочетен"
+
 msgid "cover letter needs email format"
 msgstr "придружаващото писмо трябва да е форматирано като е-писмо"
 
@@ -7963,7 +7927,7 @@ msgid "insane in-reply-to: %s"
 msgstr "неправилен формат на заглавната част за отговор „in-reply-to“: %s"
 
 msgid "git format-patch [<options>] [<since> | <revision-range>]"
-msgstr "git format-patch [ОПЦИЯ…] [ОТ | ДИАПАЗОН_НА_ВЕРСИИТЕ]"
+msgstr "git format-patch [ОПЦИЯ…] [ОТ|ДИАПАЗОН_НА_ВЕРСИИТЕ]"
 
 msgid "two output directories?"
 msgstr "може да укажете максимум една директория за изход"
@@ -8054,6 +8018,9 @@ msgstr ""
 "генериране на частите на придружаващото писмо на базата на описанието на "
 "клона"
 
+msgid "use branch description from file"
+msgstr "ползване на описание на клон от файл"
+
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "използване на този „[ПРЕФИКС]“ вместо „[PATCH]“"
 
@@ -8225,6 +8192,10 @@ msgstr ""
 "Следеният отдалечен клон не бе открит, затова изрично задайте "
 "ОТДАЛЕЧЕН_КЛОН.\n"
 
+#, c-format
+msgid "could not get object info about '%s'"
+msgstr "не може да се получи информация за обекта „%s“"
+
 #, c-format
 msgid "bad ls-files format: element '%s' does not start with '('"
 msgstr "неправилен формат за „ls-tree“: елементът „%s“ не започва с „(“"
@@ -8337,7 +8308,7 @@ msgid ""
 "              [--symref] [<repository> [<patterns>...]]"
 msgstr ""
 "git ls-remote [--heads] [--tags] [--refs] [--upload-pack=КОМАНДА]\n"
-"              [-q | --quiet] [--exit-code] [--get-url] [--sort=КЛЮЧ]\n"
+"              [-q|--quiet] [--exit-code] [--get-url] [--sort=КЛЮЧ]\n"
 "              [--symref] [ХРАНИЛИЩЕ [ШАБЛОН]]"
 
 msgid "do not print remote URL"
@@ -8370,10 +8341,6 @@ msgstr "извеждане на указателя заедно с обекта
 msgid "git ls-tree [<options>] <tree-ish> [<path>...]"
 msgstr "git ls-tree [ОПЦИЯ…] УКАЗАТЕЛ_КЪМ_ДЪРВО [ПЪТ…]"
 
-#, c-format
-msgid "could not get object info about '%s'"
-msgstr "не може да се получи информация за обекта „%s“"
-
 #, c-format
 msgid "bad ls-tree format: element '%s' does not start with '('"
 msgstr "неправилен формат за „ls-tree“: елементът „%s“ не започва с „(“"
@@ -8467,10 +8434,10 @@ msgid "empty mbox: '%s'"
 msgstr "празна пощенска кутия mbox: „%s“"
 
 msgid "git merge-base [-a | --all] <commit> <commit>..."
-msgstr "git merge-base [-a | --all] ПОДАВАНЕ ПОДАВАНЕ…"
+msgstr "git merge-base [-a|--all] ПОДАВАНЕ ПОДАВАНЕ…"
 
 msgid "git merge-base [-a | --all] --octopus <commit>..."
-msgstr "git merge-base [-a | --all] --octopus ПОДАВАНЕ…"
+msgstr "git merge-base [-a|--all] --octopus ПОДАВАНЕ…"
 
 msgid "git merge-base --is-ancestor <commit> <commit>"
 msgstr "git merge-base --is-ancestor ПОДАВАНЕ_1 ПОДАВАНЕ_2"
@@ -8504,9 +8471,20 @@ msgstr ""
 "git merge-file [ОПЦИЯ…] [-L ИМЕ_1 [-L ОРИГИНАЛ [-L ИМЕ_2]]] ФАЙЛ_1 ОРИГ_ФАЙЛ "
 "ФАЙЛ_2"
 
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"опцията приема следните варианти за алгоритъм за разлики: „myers“ (по "
+"Майерс), „minimal“ (минимизиране на разликите), „patience“ (пасианс) и "
+"„histogram“ (хистограмен)"
+
 msgid "send results to standard output"
 msgstr "извеждане на резултатите на стандартния изход"
 
+msgid "use object IDs instead of filenames"
+msgstr "ползване на идентификатори на обекти вместо имена на файлове"
+
 msgid "use a diff3 based merge"
 msgstr "сливане на базата на „diff3“"
 
@@ -8522,6 +8500,12 @@ msgstr "при конфликти да се ползва чуждата верс
 msgid "for conflicts, use a union version"
 msgstr "при конфликти да се ползва обединена версия"
 
+msgid "<algorithm>"
+msgstr "АЛГОРИТЪМ"
+
+msgid "choose a diff algorithm"
+msgstr "избор на АЛГОРИТЪМа за разлики"
+
 msgid "for conflicts, use this marker size"
 msgstr "при конфликти да се ползва маркер с такъв БРОЙ знаци"
 
@@ -8531,6 +8515,13 @@ msgstr "без предупреждения при конфликти"
 msgid "set labels for file1/orig-file/file2"
 msgstr "задаване на етикети за ФАЙЛ_1/ОРИГИНАЛ/ФАЙЛ_2"
 
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "обектът „%s“ не съществува"
+
+msgid "Could not write object file"
+msgstr "Файлът с обекти не може да се запише"
+
 #, c-format
 msgid "unknown option %s"
 msgstr "непозната опция: „%s“"
@@ -8550,7 +8541,7 @@ msgstr "поддържа се само сливане на точно две и
 
 #, c-format
 msgid "could not resolve ref '%s'"
-msgstr "Ñ\83казаÑ\82елÑ\8fÑ\82 â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¸Ð·Ñ\82Ñ\80иÑ\82"
+msgstr "Ñ\83казаÑ\82елÑ\8fÑ\82 â\80\9e%sâ\80\9c Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð´Ð° Ð±Ñ\8aде Ð¿Ñ\80оÑ\81леден"
 
 #, c-format
 msgid "Merging %s with %s\n"
@@ -8593,11 +8584,18 @@ msgstr "извършване на множество сливания, по ед
 msgid "specify a merge-base for the merge"
 msgstr "база за сливането"
 
+msgid "option=value"
+msgstr "ОПЦИЯ=СТОЙНОСТ"
+
+msgid "option for selected merge strategy"
+msgstr "ОПЦИЯ за избраната стратегия за сливане"
+
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "„--trivial-merge“ е несъвместима с другите опции"
 
-msgid "--merge-base is incompatible with --stdin"
-msgstr "опциите „--merge-base“ и „--stdin“ са несъвместими"
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "непозната опция за стратегия: -X%s"
 
 #, c-format
 msgid "malformed input line: '%s'."
@@ -8641,7 +8639,7 @@ msgstr "(псевдоним на „--stat“)"
 msgid "add (at most <n>) entries from shortlog to merge commit message"
 msgstr ""
 "добавяне (на максимум такъв БРОЙ) записи от съкратения журнал в съобщението "
-"за подаване"
+"за подаване със сливане"
 
 msgid "create a single commit instead of doing a merge"
 msgstr "създаване на едно подаване вместо извършване на сливане"
@@ -8667,12 +8665,6 @@ msgstr "СТРАТЕГИЯ"
 msgid "merge strategy to use"
 msgstr "СТРАТЕГИЯ за сливане, която да се ползва"
 
-msgid "option=value"
-msgstr "ОПЦИЯ=СТОЙНОСТ"
-
-msgid "option for selected merge strategy"
-msgstr "ОПЦИЯ за избраната стратегия за сливане"
-
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr "СЪОБЩЕНИЕ при подаването със сливане (при същински сливания)"
 
@@ -8735,10 +8727,6 @@ msgstr "Индексът не може да бъде прочетен"
 msgid "Not handling anything other than two heads merge."
 msgstr "Поддържа се само сливане на точно две истории."
 
-#, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "непозната опция за стратегия: -X%s"
-
 #, c-format
 msgid "unable to write %s"
 msgstr "„%s“ не може да бъде записан"
@@ -9044,8 +9032,8 @@ msgstr "целта съществува"
 msgid "can not move directory into itself"
 msgstr "директория не може да се премести в себе си"
 
-msgid "cannot move directory over file"
-msgstr "директория не може да се премести върху файл"
+msgid "destination already exists"
+msgstr "целта съществува"
 
 msgid "source directory is empty"
 msgstr "първоначалната директория е празна"
@@ -9126,22 +9114,26 @@ msgid "git notes [--ref <notes-ref>] [list [<object>]]"
 msgstr "git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] [list [ОБЕКТ]]"
 
 msgid ""
-"git notes [--ref <notes-ref>] add [-f] [--allow-empty] [-m <msg> | -F <file> "
-"| (-c | -C) <object>] [<object>]"
+"git notes [--ref <notes-ref>] add [-f] [--allow-empty] [--[no-]separator|--"
+"separator=<paragraph-break>] [--[no-]stripspace] [-m <msg> | -F <file> | (-c "
+"| -C) <object>] [<object>]"
 msgstr ""
-"git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] add [-f] [--allow-empty] [-m СЪОБЩЕНИЕ "
-"| -F ФАЙЛ | (-c | -C) ОБЕКТ] [ОБЕКТ]"
+"git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] add [-f] [--allow-empty] [--"
+"[no-]separator|--separator=<paragraph-break>] [--[no-]stripspace] [-m "
+"СЪОБЩЕНИЕ|-F ФАЙЛ|(-c|-C) ОБЕКТ] [ОБЕКТ]"
 
 msgid "git notes [--ref <notes-ref>] copy [-f] <from-object> <to-object>"
 msgstr ""
 "git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] copy [-f] ОБЕКТ_ИЗТОЧНИК ОБЕКТ_ЦЕЛ"
 
 msgid ""
-"git notes [--ref <notes-ref>] append [--allow-empty] [-m <msg> | -F <file> | "
-"(-c | -C) <object>] [<object>]"
+"git notes [--ref <notes-ref>] append [--allow-empty] [--[no-]separator|--"
+"separator=<paragraph-break>] [--[no-]stripspace] [-m <msg> | -F <file> | (-c "
+"| -C) <object>] [<object>]"
 msgstr ""
-"git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] append [--allow-empty] [-m СЪОБЩЕНИЕ | "
-"-F ФАЙЛ | (-c | -C) ОБЕКТ] [ОБЕКТ]"
+"git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] append [--allow-empty] [--"
+"[no-]separator|--separator=КРАЙ_НА_АБЗАЦ] [--[no-]stripspace] [-m СЪОБЩЕНИЕ "
+"| -F ФАЙЛ|(-c|-C) ОБЕКТ] [ОБЕКТ]"
 
 msgid "git notes [--ref <notes-ref>] edit [--allow-empty] [<object>]"
 msgstr "git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] edit [--allow-empty] [ОБЕКТ]"
@@ -9152,7 +9144,7 @@ msgstr "git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] show [ОБЕКТ]
 msgid ""
 "git notes [--ref <notes-ref>] merge [-v | -q] [-s <strategy>] <notes-ref>"
 msgstr ""
-"git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] merge [-v | -q] [-s СТРАТЕГИЯ] "
+"git notes [--ref УКАЗАТЕЛ_ЗА_БЕЛЕЖКА] merge [-v|-q] [-s СТРАТЕГИЯ] "
 "УКАЗАТЕЛ_ЗА_БЕЛЕЖКА"
 
 msgid "git notes [--ref <notes-ref>] remove [<object>...]"
@@ -9276,6 +9268,15 @@ msgstr "приемане и на празни бележки"
 msgid "replace existing notes"
 msgstr "замяна на съществуващите бележки"
 
+msgid "<paragraph-break>"
+msgstr "КРАЙ_НА_АБЗАЦ"
+
+msgid "insert <paragraph-break> between paragraphs"
+msgstr "вмъкване на такъв КРАЙ_НА_АБЗАЦ между абзаците"
+
+msgid "remove unnecessary whitespace"
+msgstr "премахване на излишните знаци за интервали"
+
 #, c-format
 msgid ""
 "Cannot add notes. Found existing notes for object %s. Use '-f' to overwrite "
@@ -9440,12 +9441,12 @@ msgstr "непозната подкоманда: „%s“"
 
 msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
 msgstr ""
-"git pack-objects --stdout [ОПЦИЯ…] [< СПИСЪК_С_УКАЗАТЕЛИ | < СПИСЪК_С_ОБЕКТИ]"
+"git pack-objects --stdout [ОПЦИЯ…] [< СПИСЪК_С_УКАЗАТЕЛИ|< СПИСЪК_С_ОБЕКТИ]"
 
 msgid ""
 "git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
 msgstr ""
-"git pack-objects [ОПЦИЯ…] ПРЕФИКС_НА_ИМЕТО [< СПИСЪК_С_УКАЗАТЕЛИ | < "
+"git pack-objects [ОПЦИЯ…] ПРЕФИКС_НА_ИМЕТО [< СПИСЪК_С_УКАЗАТЕЛИ|< "
 "СПИСЪК_С_ОБЕКТИ]"
 
 #, c-format
@@ -9554,6 +9555,11 @@ msgstr "Компресиране на обектите"
 msgid "inconsistency with delta count"
 msgstr "неправилен брой разлики"
 
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr ""
+"неправилна стойност за преизползването на пакети „pack.allowPackReuse“: „%s“"
+
 #, c-format
 msgid ""
 "value of uploadpack.blobpackfileuri must be of the form '<object-hash> <pack-"
@@ -9582,13 +9588,13 @@ msgid "packfile %s cannot be accessed"
 msgstr "пакетният файл „%s“ не може да бъде достъпен"
 
 msgid "Enumerating cruft objects"
-msgstr "Ð\98збÑ\80оÑ\8fване Ð½Ð° Ð¸Ð·Ð»Ð¸Ñ\88ните обекти"
+msgstr "Ð\98збÑ\80оÑ\8fване Ð½Ð° Ð½ÐµÐ½Ñ\83жните обекти"
 
 msgid "unable to add cruft objects"
-msgstr "неÑ\83Ñ\81пеÑ\88но Ð´Ð¾Ð±Ð°Ð²Ñ\8fне Ð½Ð° Ð¸Ð·Ð»Ð¸Ñ\88ни обекти"
+msgstr "неÑ\83Ñ\81пеÑ\88но Ð´Ð¾Ð±Ð°Ð²Ñ\8fне Ð½Ð° Ð½ÐµÐ½Ñ\83жни обекти"
 
 msgid "Traversing cruft objects"
-msgstr "Ð\9eбÑ\85ождане Ð½Ð° Ð¸Ð·Ð»Ð¸Ñ\88ните обекти"
+msgstr "Ð\9eбÑ\85ождане Ð½Ð° Ð½ÐµÐ½Ñ\83жните обекти"
 
 #, c-format
 msgid ""
@@ -9608,7 +9614,7 @@ msgstr ""
 
 msgid "could not load cruft pack .mtimes"
 msgstr ""
-"вÑ\80еменаÑ\82а Ð½Ð° Ð¿Ñ\80омÑ\8fна (.mtimes) Ð½Ð° Ð¿Ð°ÐºÐµÑ\82а Ñ\81 Ð¸Ð·Ð»Ð¸Ñ\88ни файлове не може да се "
+"вÑ\80еменаÑ\82а Ð½Ð° Ð¿Ñ\80омÑ\8fна (.mtimes) Ð½Ð° Ð¿Ð°ÐºÐµÑ\82а Ñ\81 Ð½ÐµÐ½Ñ\83жни файлове не може да се "
 "заредят"
 
 msgid "cannot open pack index"
@@ -9727,10 +9733,10 @@ msgid "unpack unreachable objects newer than <time>"
 msgstr "разпакетиране на недостижимите обекти, които са по-нови от това ВРЕМЕ"
 
 msgid "create a cruft pack"
-msgstr "Ñ\81Ñ\8aздаване Ð½Ð° Ð¿Ð°ÐºÐµÑ\82 Ñ\81 Ð¸Ð·Ð»Ð¸Ñ\88ните обекти"
+msgstr "Ñ\81Ñ\8aздаване Ð½Ð° Ð¿Ð°ÐºÐµÑ\82 Ñ\81 Ð½ÐµÐ½Ñ\83жните обекти"
 
 msgid "expire cruft objects older than <time>"
-msgstr "обÑ\8fвÑ\8fване Ð½Ð° Ð¸Ð·Ð»Ð¸Ñ\88ните обекти по-стари от това ВРЕМЕ за остарели"
+msgstr "обÑ\8fвÑ\8fване Ð½Ð° Ð½ÐµÐ½Ñ\83жните обекти по-стари от това ВРЕМЕ за остарели"
 
 msgid "use the sparse reachability algorithm"
 msgstr "използване на алгоритъм за частична достижимост"
@@ -9808,9 +9814,6 @@ msgstr ""
 "опцията „--thin“не може да се използва за създаване на пакетни файлове с "
 "индекс"
 
-msgid "cannot use --filter without --stdout"
-msgstr "опцията „--filter“ изисква „--stdout“"
-
 msgid "cannot use --filter with --stdin-packs"
 msgstr "опциите „--filter“ и „--stdin-packs“ са несъвместими"
 
@@ -9824,19 +9827,16 @@ msgstr "вътрешният списък на версии и опцията 
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "опциите „--stdin-packs“ и „--cruft“ са несъвместими"
 
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "опциите „--max-pack-size“ и „--cruft“ са несъвместими"
-
 msgid "Enumerating objects"
 msgstr "Изброяване на обектите"
 
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Общо: %<PRIu32> (разлики: %<PRIu32>), преизползвани: %<PRIu32> (разлики: "
-"%<PRIu32>), преизползвани при пакетиране: %<PRIu32>"
+"%<PRIu32>), преизползвани при пакетиране: %<PRIu32> (от %<PRIuMAX>)"
 
 msgid ""
 "'git pack-redundant' is nominated for removal.\n"
@@ -9854,8 +9854,11 @@ msgstr ""
 msgid "refusing to run without --i-still-use-this"
 msgstr "трябва да добавите и опцията „--i-still-use-this“"
 
-msgid "git pack-refs [--all] [--no-prune]"
-msgstr "git pack-refs [--all] [--no-prune]"
+msgid ""
+"git pack-refs [--all] [--no-prune] [--include <pattern>] [--exclude "
+"<pattern>]"
+msgstr ""
+"git pack-refs [--all] [--no-prune] [--include ШАБЛОН] [--exclude ШАБЛОН]"
 
 msgid "pack everything"
 msgstr "пакетиране на всичко"
@@ -9863,14 +9866,20 @@ msgstr "пакетиране на всичко"
 msgid "prune loose refs (default)"
 msgstr "окастряне на недостижимите указатели (стандартно)"
 
+msgid "references to include"
+msgstr "кои указатели да се включат"
+
+msgid "references to exclude"
+msgstr "кои указатели да се прескочат"
+
 msgid "git patch-id [--stable | --unstable | --verbatim]"
-msgstr "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable|--unstable|--verbatim]"
 
 msgid "use the unstable patch-id algorithm"
-msgstr "използване Ð½Ð° Ð½ÐµÑ\81Ñ\82абилен алгоритъм за идентифициране на кръпка"
+msgstr "използване Ð½Ð° Ð½ÐµÑ\81Ñ\82абилниÑ\8f алгоритъм за идентифициране на кръпка"
 
 msgid "use the stable patch-id algorithm"
-msgstr "използване Ð½Ð° Ñ\81Ñ\82абилен алгоритъм за идентифициране на кръпка"
+msgstr "използване Ð½Ð° Ñ\81Ñ\82абилниÑ\8f алгоритъм за идентифициране на кръпка"
 
 msgid "don't strip whitespace from the patch"
 msgstr "без махане на празните знаци в кръпката"
@@ -9922,6 +9931,12 @@ msgstr "принудително презаписване на локалния
 msgid "number of submodules pulled in parallel"
 msgstr "брой подмодули издърпани паралелно"
 
+msgid "use IPv4 addresses only"
+msgstr "само адреси IPv4"
+
+msgid "use IPv6 addresses only"
+msgstr "само адреси IPv6"
+
 msgid ""
 "There is no candidate for rebasing against among the refs that you just "
 "fetched."
@@ -10023,7 +10038,7 @@ msgstr ""
 "приоритет пред настройките.\n"
 
 msgid "Updating an unborn branch with changes added to the index."
-msgstr "Ð\9eбновÑ\8fване Ð½Ð° Ð²Ñ\81е Ð¾Ñ\89е Ð½ÐµÑ\81Ñ\8aздаден клон с промѐните от индекса"
+msgstr "Ð\9eбновÑ\8fване Ð½Ð° Ð½ÐµÑ\80одеÌ\80н клон с промѐните от индекса"
 
 msgid "pull with rebase"
 msgstr "издърпване с пребазиране"
@@ -10187,35 +10202,37 @@ msgstr ""
 
 msgid ""
 "Updates were rejected because the tip of your current branch is behind\n"
-"its remote counterpart. Integrate the remote changes (e.g.\n"
-"'git pull ...') before pushing again.\n"
+"its remote counterpart. If you want to integrate the remote changes,\n"
+"use 'git pull' before pushing again.\n"
 "See the 'Note about fast-forwards' in 'git push --help' for details."
 msgstr ""
-"Обновяването е отхвърлено, защото върхът на текущия ви клон е преди върха "
-"на\n"
+"Обновяването е отхвърлено, защото върхът на текущия ви клон следва върха на\n"
 "отдалечения клон.  Внесете отдалечените промѐни (напр. с командата „git "
 "pull…“),\n"
-"преди отново да изтласкате промѐните.  За повече информация вижте раздела\n"
-"„Note about fast-forwards“ в страницата от ръководството „git push --help“."
+"преди отново да изтласкате промѐните.\n"
+"За повече информация вижте раздела „Note about fast-forwards“ в страницата "
+"от\n"
+"ръководството „git push --help“."
 
 msgid ""
 "Updates were rejected because a pushed branch tip is behind its remote\n"
-"counterpart. Check out this branch and integrate the remote changes\n"
-"(e.g. 'git pull ...') before pushing again.\n"
+"counterpart. If you want to integrate the remote changes, use 'git pull'\n"
+"before pushing again.\n"
 "See the 'Note about fast-forwards' in 'git push --help' for details."
 msgstr ""
-"Обновяването е отхвърлено, защото върхът на изтласквания клон е преди върха\n"
+"Обновяването е отхвърлено, защото върхът на изтласквания клон следва върха\n"
 "на отдалечения клон.  Преминете към клона и внесете отдалечените промѐни "
 "(напр.\n"
-"с командата „git pull…“), преди отново да изтласкате промѐните.  За повече\n"
-"информация погледнете раздела „Note about fast-forwards“ в страницата от\n"
+"с командата „git pull…“), преди отново да изтласкате промѐните.\n"
+"За повече информация вижте раздела „Note about fast-forwards“ в страницата "
+"от\n"
 "ръководството „git push --help“."
 
 msgid ""
-"Updates were rejected because the remote contains work that you do\n"
-"not have locally. This is usually caused by another repository pushing\n"
-"to the same ref. You may want to first integrate the remote changes\n"
-"(e.g., 'git pull ...') before pushing again.\n"
+"Updates were rejected because the remote contains work that you do not\n"
+"have locally. This is usually caused by another repository pushing to\n"
+"the same ref. If you want to integrate the remote changes, use\n"
+"'git pull' before pushing again.\n"
 "See the 'Note about fast-forwards' in 'git push --help' for details."
 msgstr ""
 "Обновяването е отхвърлено, защото хранилището, към което изтласквате, "
@@ -10245,14 +10262,17 @@ msgstr ""
 "да го променѝте да сочи към подобен обект.\n"
 
 msgid ""
-"Updates were rejected because the tip of the remote-tracking\n"
-"branch has been updated since the last checkout. You may want\n"
-"to integrate those changes locally (e.g., 'git pull ...')\n"
-"before forcing an update.\n"
+"Updates were rejected because the tip of the remote-tracking branch has\n"
+"been updated since the last checkout. If you want to integrate the\n"
+"remote changes, use 'git pull' before pushing again.\n"
+"See the 'Note about fast-forwards' in 'git push --help' for details."
 msgstr ""
-"Обновяването е отхвърлено, защото върхът на следящия клон е обновяван след\n"
-"последното изтегляне.  Внесете отдалечените промѐни (напр. с командата\n"
-"„git pull…“), преди отново принудително да изтласкате промѐните.\n"
+"Обновяването е отхвърлено, защото върхът на отдалечения клон съдържа "
+"промени\n"
+"след последното изтегляне.  Внесете отдалечените промѐни (напр. с командата\n"
+"„git pull…“), преди отново да изтласкате промѐните.\n"
+"За повече информация вижте раздела „Note about fast-forwards“ в страницата\n"
+"от ръководството „git push --help“."
 
 #, c-format
 msgid "Pushing to %s\n"
@@ -10414,9 +10434,9 @@ msgid ""
 "              [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
 "              (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
 msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=ПРЕФИКС)\n"
-"              [-u | -i]] [--index-output=ФАЙЛ] [--no-sparse-checkout]\n"
-"              (--empty | УКАЗАТЕЛ_КЪМ_ДЪРВО_1 [УКАЗАТЕЛ_КЪМ_ДЪРВО_2 "
+"git read-tree [(-m [--trivial] [--aggressive]|--reset|--prefix=ПРЕФИКС)\n"
+"              [-u|-i]] [--index-output=ФАЙЛ] [--no-sparse-checkout]\n"
+"              (--empty|УКАЗАТЕЛ_КЪМ_ДЪРВО_1 [УКАЗАТЕЛ_КЪМ_ДЪРВО_2 "
 "[УКАЗАТЕЛ_КЪМ_ДЪРВО_3]])"
 
 msgid "write resulting index to <file>"
@@ -10477,7 +10497,7 @@ msgid ""
 "git rebase [-i] [options] [--exec <cmd>] [--onto <newbase> | --keep-base] "
 "[<upstream> [<branch>]]"
 msgstr ""
-"git rebase [-i] [ОПЦИЯ…] [--exec КОМАНДА] [--onto НОВА_БАЗА | --keep-base] "
+"git rebase [-i] [ОПЦИЯ…] [--exec КОМАНДА] [--onto НОВА_БАЗА|--keep-base] "
 "[КЛОН_ИЗТОЧНИК [КЛОН]]"
 
 msgid ""
@@ -10809,17 +10829,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "опцията „C“ очаква число за аргумент"
 
-msgid "--strategy requires --merge or --interactive"
-msgstr ""
-"опцията „--strategy“ изисква някоя от опциите „--merge“ или „--interactive“"
-
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"опциите за прилагане са несъвместими с „rebase.autoSquash“.  Пробвайте да "
-"добавите опцията „--no-autosquash“"
-
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
 "no-rebase-merges"
@@ -10983,7 +10992,7 @@ msgid ""
 msgstr ""
 "git reflog expire [--expire=ВРЕМЕ] [--expire-unreachable=ВРЕМЕ]\n"
 "                  [--rewrite] [--updateref] [--stale-fix]\n"
-"                  [--dry-run | -n] [--verbose] [--all [--single-worktree] | "
+"                  [--dry-run|-n] [--verbose] [--all [--single-worktree]|"
 "УКАЗАТЕЛ…]"
 
 msgid ""
@@ -10991,7 +11000,7 @@ msgid ""
 "                  [--dry-run | -n] [--verbose] <ref>@{<specifier>}..."
 msgstr ""
 "git reflog delete [--rewrite] [--updateref]\n"
-"                  [--dry-run | -n] [--verbose] УКАЗАТЕЛ@{УТОЧНЕНИЕ}…"
+"                  [--dry-run|-n] [--verbose] УКАЗАТЕЛ@{УТОЧНЕНИЕ}…"
 
 msgid "git reflog exists <ref>"
 msgstr "git reflog exists УКАЗАТЕЛ"
@@ -11059,7 +11068,7 @@ msgid ""
 "git remote add [-t <branch>] [-m <master>] [-f] [--tags | --no-tags] [--"
 "mirror=<fetch|push>] <name> <url>"
 msgstr ""
-"git remote add [-t КЛОН] [-m ОСНОВЕН_КЛОН] [-f] [--tags | --no-tags] [--"
+"git remote add [-t КЛОН] [-m ОСНОВЕН_КЛОН] [-f] [--tags|--no-tags] [--"
 "mirror=<fetch|push>] ИМЕ АДРЕС"
 
 msgid "git remote rename [--[no-]progress] <old> <new>"
@@ -11069,19 +11078,18 @@ msgid "git remote remove <name>"
 msgstr "git remote remove ИМЕ"
 
 msgid "git remote set-head <name> (-a | --auto | -d | --delete | <branch>)"
-msgstr "git remote set-head ИМЕ (-a | --auto | -d | --delete | КЛОН)"
+msgstr "git remote set-head ИМЕ (-a|--auto|-d|--delete|КЛОН)"
 
 msgid "git remote [-v | --verbose] show [-n] <name>"
-msgstr "git remote [-v | --verbose] show [-n] ИМЕ"
+msgstr "git remote [-v|--verbose] show [-n] ИМЕ"
 
 msgid "git remote prune [-n | --dry-run] <name>"
-msgstr "git remote prune [-n | --dry-run] ИМЕ"
+msgstr "git remote prune [-n|--dry-run] ИМЕ"
 
 msgid ""
 "git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]"
 msgstr ""
-"git remote [-v | --verbose] update [-p | --prune] [(ГРУПА | "
-"ОТДАЛЕЧЕНО_ХРАНИЛИЩЕ)…]"
+"git remote [-v|--verbose] update [-p|--prune] [(ГРУПА|ОТДАЛЕЧЕНО_ХРАНИЛИЩЕ)…]"
 
 msgid "git remote set-branches [--add] <name> <branch>..."
 msgstr "git remote set-branches [--add] ИМЕ КЛОН…"
@@ -11114,7 +11122,7 @@ msgid "git remote prune [<options>] <name>"
 msgstr "git remote prune [ОПЦИЯ…] ИМЕ"
 
 msgid "git remote update [<options>] [<group> | <remote>]..."
-msgstr "git remote update [ОПЦИЯ…] [ГРУПА | ОТДАЛЕЧЕНО_ХРАНИЛИЩЕ…]"
+msgstr "git remote update [ОПЦИЯ…] [ГРУПА|ОТДАЛЕЧЕНО_ХРАНИЛИЩЕ…]"
 
 #, c-format
 msgid "Updating %s"
@@ -11138,11 +11146,12 @@ msgstr "неправилна стойност за „--mirror“: %s"
 msgid "fetch the remote branches"
 msgstr "отдалечените клони не може да бъдат доставени"
 
-msgid "import all tags and associated objects when fetching"
-msgstr "внасяне на всички етикети и принадлежащите им обекти при доставяне"
-
-msgid "or do not fetch any tag at all (--no-tags)"
-msgstr "може и да не се доставят никакви етикети (чрез опцията „--no-tags“)"
+msgid ""
+"import all tags and associated objects when fetching\n"
+"or do not fetch any tag at all (--no-tags)"
+msgstr ""
+"внасяне на всички етикети и принадлежащите им обекти при доставяне\n"
+"или да не се доставят никакви етикети (чрез опцията „--no-tags“)"
 
 msgid "branch(es) to track"
 msgstr "клон/и за следене"
@@ -11541,6 +11550,10 @@ msgstr "временният файл със снимка на указател
 msgid "could not remove stale bitmap: %s"
 msgstr "изтриването на остарялата битова маска „%s“ е невъзможно"
 
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "името на пакетния файл „%s“ не започва с директорията за обекти с „%s“"
+
 msgid "pack everything in a single pack"
 msgstr "пакетиране на всичко в пакет"
 
@@ -11551,7 +11564,7 @@ msgstr ""
 
 msgid "same as -a, pack unreachable cruft objects separately"
 msgstr ""
-"Ñ\81Ñ\8aÑ\89оÑ\82о ÐºÐ°Ñ\82о Ð¾Ð¿Ñ\86иÑ\8fÑ\82а â\80\9e-aâ\80\9c.  Ð\9dедоÑ\81Ñ\82ижимиÑ\82е Ð¸Ð·Ð»Ð¸Ñ\88ни обекти да се пакетират "
+"Ñ\81Ñ\8aÑ\89оÑ\82о ÐºÐ°Ñ\82о Ð¾Ð¿Ñ\86иÑ\8fÑ\82а â\80\9e-aâ\80\9c.  Ð\9dедоÑ\81Ñ\82ижимиÑ\82е Ð½ÐµÐ½Ñ\83жни обекти да се пакетират "
 "отделно"
 
 msgid "approxidate"
@@ -11626,18 +11639,21 @@ msgid "write a multi-pack index of the resulting packs"
 msgstr "запазване на многопакетен индекс за създадените пакети"
 
 msgid "pack prefix to store a pack containing pruned objects"
-msgstr "префикс на името на пакетния за пакети за окастрени обекти"
+msgstr "префикс на имената на пакетите за окастрени обекти"
+
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "префикс на имената на пакетите за филтрирани обекти"
 
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "пакетите в хранилище с важни обекти не може да се трият"
 
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "опцията „%s“ изисква „%s“"
+
 msgid "Nothing new to pack."
 msgstr "Нищо ново за пакетиране"
 
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "името на пакетния файл „%s“ не започва с директорията за обекти с „%s“"
-
 #, c-format
 msgid "renaming pack to '%s' failed"
 msgstr "неуспешно преименуване на пакетния файл на „%s“"
@@ -11838,9 +11854,79 @@ msgstr "опцията „--convert-graft-file“ не приема аргуме
 msgid "only one pattern can be given with -l"
 msgstr "опцията „-l“ приема точно един шаблон"
 
+msgid "need some commits to replay"
+msgstr "необходимо е да има подавания за прилагане отново"
+
+msgid "--onto and --advance are incompatible"
+msgstr "опциите „--onto“ и „--advance“ са несъвместими"
+
+msgid "all positive revisions given must be references"
+msgstr "всички зададени положителни версии трябва да са указатели"
+
+msgid "argument to --advance must be a reference"
+msgstr "аргументът към „--advance“ трябва да е указател"
+
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"цели с множество източници не може да се придвижат напред, защото подредбата "
+"не е добре дефинирана"
+
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr ""
+"не може да се определи дали това действие е за „--advance“ или „--onto“"
+
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"цели с множество клони-източници не може да се придвижат напред, защото "
+"подредбата не е добре дефинирана"
+
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "правилната база за „--onto“ не може да се определи"
+
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(ЕКСПЕРИМЕНТАЛНО!) git replay ([--contained] --onto НОВА_БАЗА | --advance "
+"КЛОН) ДИАПАЗОН_ПОДАВАНИЯ…"
+
+msgid "make replay advance given branch"
+msgstr "прилагането наново придвижва дадения КЛОН напред"
+
+msgid "replay onto given commit"
+msgstr "прилагането наново върху даденото ПОДАВАНЕ"
+
+msgid "advance all branches contained in revision-range"
+msgstr "придвижване на всички КЛОНи в ДИАПАЗОНа_ПОДАВАНИЯ"
+
+msgid "option --onto or --advance is mandatory"
+msgstr "изисква се някоя от опциите „--onto“ или „--advance“"
+
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"някои опции за проследяване на указатели ще бъдат променени, защото битът "
+"„%s“ в структурата „struct rev_info“ има превес"
+
+msgid "error preparing revisions"
+msgstr "грешка при подготовката на версии"
+
+msgid "replaying down to root commit is not supported yet!"
+msgstr "не се поддържа прилагане наново и на началното подаване!"
+
+msgid "replaying merge commits is not supported yet!"
+msgstr "не се поддържа прилагане наново и на подавания със сливане!"
+
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
-msgstr "git rerere [clear | forget ПЪТ… | diff | status | remaining | gc]"
+msgstr "git rerere [clear|forget ПЪТ…|diff|status|remaining|gc]"
 
 msgid "register clean resolutions in index"
 msgstr "регистриране на чисти корекции на конфликти в индекса"
@@ -11854,8 +11940,7 @@ msgstr "неуспешно генериране на разлика за „%s
 
 msgid ""
 "git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]"
-msgstr ""
-"git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [ПОДАВАНЕ]"
+msgstr "git reset [--mixed|--soft|--hard|--merge|--keep] [-q] [ПОДАВАНЕ]"
 
 msgid "git reset [-q] [<tree-ish>] [--] <pathspec>..."
 msgstr "git reset [-q] [УКАЗАТЕЛ_КЪМ_ДЪРВО] [--] ПЪТИЩА…"
@@ -12046,18 +12131,12 @@ msgstr "опцията „--prefix“ изисква аргумент"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "непознат режим за „--abbrev-ref“: „%s“"
 
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "опциите „--exclude-hidden“ и „--branches“ са несъвместими"
-
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "опциите „--exclude-hidden“ и „--tags“ са несъвместими"
-
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "опциите „--exclude-hidden“ и „--remotes“ са несъвместими"
-
 msgid "this operation must be run in a work tree"
 msgstr "тази команда трябва да се изпълни в работно дърво"
 
+msgid "Could not read the index"
+msgstr "Индексът не може да бъде прочетен"
+
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
 msgstr "непознат режим за „--show-object-format“: „%s“"
@@ -12070,7 +12149,7 @@ msgstr ""
 "           [-S[ИДЕНТИФИКАТОР_НА_КЛЮЧ]] ПОДАВАНЕ…"
 
 msgid "git revert (--continue | --skip | --abort | --quit)"
-msgstr "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue|--skip|--abort|--quit)"
 
 msgid ""
 "git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
@@ -12080,7 +12159,7 @@ msgstr ""
 "                [-S[ИДЕНТИФИКАТОР_НА_КЛЮЧ]] ПОДАВАНЕ…"
 
 msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
-msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue|--skip|--abort|--quit)"
 
 #, c-format
 msgid "option `%s' expects a number greater than zero"
@@ -12146,7 +12225,7 @@ msgid ""
 "       [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
 "       [--] [<pathspec>...]"
 msgstr ""
-"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+"git rm [-f|--force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
 "       [--quiet] [--pathspec-from-file=ФАЙЛ [--pathspec-file-nul]]\n"
 "       [--] [ПЪТ…]"
 
@@ -12233,8 +12312,8 @@ msgstr ""
 "git send-pack [--mirror] [--dry-run] [--force]\n"
 "              [--receive-pack=ПАКЕТ]\n"
 "              [--verbose] [--thin] [--atomic]\n"
-"              [--[no-]signed | --signed=(true|false|if-asked)]\n"
-"              [ХОСТ:]ДИРЕКТОРИЯ (--all | УКАЗАТЕЛ…)"
+"              [--[no-]signed|--signed=(true|false|if-asked)]\n"
+"              [ХОСТ:]ДИРЕКТОРИЯ (--all|УКАЗАТЕЛ…)"
 
 msgid "remote name"
 msgstr "име на отдалечено хранилище"
@@ -12302,14 +12381,14 @@ msgid ""
 "                [--no-name | --sha1-name] [--topics]\n"
 "                [(<rev> | <glob>)...]"
 msgstr ""
-"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
-"                [--current] [--color[=КОГА] | --no-color] [--sparse]\n"
-"                [--more=<n> | --list | --independent | --merge-base]\n"
-"                [--no-name | --sha1-name] [--topics]\n"
-"                [(РЕВИЗИЯ | УКАЗАТЕЛ)…]"
+"git show-branch [-a|--all] [-r|--remotes] [--topo-order|--date-order]\n"
+"                [--current] [--color[=КОГА]|--no-color] [--sparse]\n"
+"                [--more=<n>|--list|--independent|--merge-base]\n"
+"                [--no-name|--sha1-name] [--topics]\n"
+"                [(РЕВИЗИЯ|УКАЗАТЕЛ)…]"
 
 msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
-msgstr "git show-branch (-g | --reflog)[=БРОЙ[,БАЗА]] [--list] [УКАЗАТЕЛ]"
+msgstr "git show-branch (-g|--reflog)[=БРОЙ[,БАЗА]] [--list] [УКАЗАТЕЛ]"
 
 #, c-format
 msgid "ignoring %s; cannot handle more than %d ref"
@@ -12408,25 +12487,46 @@ msgid "Unknown hash algorithm"
 msgstr "Непознат алгоритъм за контролни суми"
 
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
-"             [-s | --hash[=БРОЙ]] [--abbrev[=БРОЙ]] [--tags]\n"
+"git show-ref [--head] [-d|--dereference]\n"
+"             [-s|--hash[=БРОЙ]] [--abbrev[=БРОЙ]] [--tags]\n"
 "             [--heads] [--] [ШАБЛОН…]"
 
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q|--quiet] [-d|--dereference]\n"
+"             [-s|--hash[=БРОЙ]] [--abbrev[=БРОЙ]]\n"
+"             [--] [ШАБЛОН…]"
+
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=ШАБЛОН]"
 
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists УКАЗАТЕЛ"
+
+msgid "reference does not exist"
+msgstr "указателят не съществува"
+
+msgid "failed to look up reference"
+msgstr "соченото от указателя липсва"
+
 msgid "only show tags (can be combined with heads)"
 msgstr "извеждане на етикетите (може да се комбинира с върховете)"
 
 msgid "only show heads (can be combined with tags)"
 msgstr "извеждане на върховете (може да се комбинира с етикетите)"
 
+msgid "check for reference existence without resolving"
+msgstr "проверка за съществуване на указател без проследяването му"
+
 msgid "stricter reference checking, requires exact ref path"
-msgstr "строга проверка на указателите, изисква се указател с пълен път"
+msgstr "по-строга проверка за указатели, изисква точен път на указател"
 
 msgid "show the HEAD reference, even if it would be filtered out"
 msgstr "задължително извеждане и на указателя HEAD"
@@ -12451,8 +12551,7 @@ msgid ""
 "git sparse-checkout (init | list | set | add | reapply | disable | check-"
 "rules) [<options>]"
 msgstr ""
-"git sparse-checkout (init | list | set | add | reapply | disable | check-"
-"rules) ОПЦИЯ…"
+"git sparse-checkout (init|list|set|add|reapply|disable|check-rules) ОПЦИЯ…"
 
 msgid "this worktree is not sparse"
 msgstr "това работно дърво не е частично"
@@ -12549,7 +12648,7 @@ msgstr ""
 "ръководството на командата „git-sparse-checkout“)."
 
 msgid "git sparse-checkout add [--skip-checks] (--stdin | <patterns>)"
-msgstr "git sparse-checkout add [--skip-checks] (--stdin | ШАБЛОН…)"
+msgstr "git sparse-checkout add [--skip-checks] (--stdin|ШАБЛОН…)"
 
 msgid ""
 "skip some sanity checks on the given paths that might give false positives"
@@ -12568,7 +12667,7 @@ msgid ""
 "(--stdin | <patterns>)"
 msgstr ""
 "git sparse-checkout set [--[no-]cone] [--[no-]sparse-index] [--skip-checks] "
-"(--stdin | ШАБЛОН…)"
+"(--stdin|ШАБЛОН…)"
 
 msgid "must be in a sparse-checkout to reapply sparsity patterns"
 msgstr ""
@@ -12603,23 +12702,23 @@ msgid ""
 "git stash show [-u | --include-untracked | --only-untracked] [<diff-"
 "options>] [<stash>]"
 msgstr ""
-"git stash show [-u | --include-untracked | --only-untracked] "
-"[Ð\9eÐ\9fЦÐ\98Я_Ð\97Ð\90_РÐ\90Ð\97Ð\9bÐ\98Ð\9aÐ\90â\80¦] [СÐ\9aÐ\90ТÐ\90Ð\9dÐ\9e]"
+"git stash show [-u|--include-untracked|--only-untracked] [ОПЦИЯ_ЗА_РАЗЛИКА…] "
+"[СКАТАНО]"
 
 msgid "git stash drop [-q | --quiet] [<stash>]"
-msgstr "git stash drop [-q | --quiet] [СКАТАНО]"
+msgstr "git stash drop [-q|--quiet] [СКАТАНО]"
 
 msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q | --quiet] [СКАТАНО]"
+msgstr "git stash pop [--index] [-q|--quiet] [СКАТАНО]"
 
 msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q | --quiet] [СКАТАНО]"
+msgstr "git stash apply [--index] [-q|--quiet] [СКАТАНО]"
 
 msgid "git stash branch <branchname> [<stash>]"
 msgstr "git stash branch КЛОН [СКАТАНО]"
 
 msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
-msgstr "git stash store [-m | --message СЪОБЩЕНИЕ] [-q | --quiet] ПОДАВАНЕ"
+msgstr "git stash store [-m|--message СЪОБЩЕНИЕ] [-q|--quiet] ПОДАВАНЕ"
 
 msgid ""
 "git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
@@ -12629,10 +12728,9 @@ msgid ""
 "          [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
 "          [--] [<pathspec>...]]"
 msgstr ""
-"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
-"| --quiet]\n"
-"          [-u | --include-untracked] [-a | --all] [(-m | --message) "
-"СЪОБЩЕНИЕ]\n"
+"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q | --"
+"quiet]\n"
+"          [-u|--include-untracked] [-a|--all] [(-m|--message) СЪОБЩЕНИЕ]\n"
 "          [--pathspec-from-file=ФАЙЛ [--pathspec-file-nul]]\n"
 "          [--] [ПЪТ…]]"
 
@@ -12641,9 +12739,9 @@ msgid ""
 "--quiet]\n"
 "          [-u | --include-untracked] [-a | --all] [<message>]"
 msgstr ""
-"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
-"--quiet]\n"
-"          [-u | --include-untracked] [-a | --all] [СЪОБЩЕНИЕ]"
+"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
+"quiet]\n"
+"          [-u|--include-untracked] [-a|--all] [СЪОБЩЕНИЕ]"
 
 msgid "git stash create [<message>]"
 msgstr "git stash create [СЪОБЩЕНИЕ]"
@@ -13022,7 +13120,7 @@ msgstr "премахване на регистрациите на всички 
 
 msgid ""
 "git submodule deinit [--quiet] [-f | --force] [--all | [--] [<path>...]]"
-msgstr "git submodule deinit [--quiet] [-f | --force] [--all | [--] [ПЪТ…]]"
+msgstr "git submodule deinit [--quiet] [-f|--force] [--all|[--] [ПЪТ…]]"
 
 msgid "Use '--all' if you really want to deinitialize all submodules"
 msgstr "Използвайте „--all“, за да премахнете всички подмодули"
@@ -13123,6 +13221,10 @@ msgstr "Прескачане на неслетия подмодул „%s“"
 msgid "Skipping submodule '%s'"
 msgstr "Прескачане на подмодула „%s“"
 
+#, c-format
+msgid "cannot clone submodule '%s' without a URL"
+msgstr "не може да се клонира подмодул „%s“ без адрес"
+
 #, c-format
 msgid "Failed to clone '%s'. Retry scheduled"
 msgstr "Неуспешен опит за клониране на „%s“.  Насрочен е втори опит"
@@ -13257,6 +13359,9 @@ msgstr ""
 "shallow] [--reference <repository>] [--recursive] [--[no-]single-branch] "
 "[--] [ПЪТ…]"
 
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "Не може да се открие към какво сочи указателят „HEAD“"
+
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [ОПЦИЯ…] [ПЪТ…]"
 
@@ -13429,9 +13534,8 @@ msgid ""
 "git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
 "        <tagname> [<commit> | <object>]"
 msgstr ""
-"git tag [-a | -s | -u ИДЕНТИФИКАТОР_НА_КЛЮЧ] [-f] [-m СЪОБЩЕНИЕ | -F ФАЙЛ] [-"
-"e]\n"
-"        ЕТИКЕТ [ПОДАВАНЕ | ОБЕКТ]"
+"git tag [-a|-s|-u ИДЕНТИФИКАТОР_НА_КЛЮЧ] [-f] [-m СЪОБЩЕНИЕ|-F ФАЙЛ] [-e]\n"
+"        ЕТИКЕТ [ПОДАВАНЕ|ОБЕКТ]"
 
 msgid "git tag -d <tagname>..."
 msgstr "git tag -d ЕТИКЕТ…"
@@ -13443,7 +13547,7 @@ msgid ""
 "        [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
 msgstr ""
 "git tag [-n[БРОЙ]] -l [--contains ПОДАВАНЕ] [--no-contains ПОДАВАНЕ]\n"
-"        [--points-at ОБЕКТ] [--column[=ОПЦИЯ…] | --no-column]\n"
+"        [--points-at ОБЕКТ] [--column[=ОПЦИЯ…]|--no-column]\n"
 "        [--create-reflog] [--sort=<key>] [--format=ФОРМАТ]\n"
 "        [--merged ПОДАВАНЕ] [--no-merged ПОДАВАНЕ] [ШАБЛОН…]"
 
@@ -13744,6 +13848,9 @@ msgstr ""
 msgid "write index in this format"
 msgstr "записване на индекса в този формат"
 
+msgid "report on-disk index format version"
+msgstr "извеждане на версията на форма̀та на индекса на диска"
+
 msgid "enable or disable split index"
 msgstr "включване или изключване на разделянето на индекса"
 
@@ -13769,6 +13876,14 @@ msgstr "отбелязване на файловете, че може да се
 msgid "clear fsmonitor valid bit"
 msgstr "изчистване на флага за следенето чрез файловата система"
 
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "версия на индекс: бе %d, променена на %d"
+
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
 "enable split index"
@@ -13868,7 +13983,7 @@ msgid "interrupt transfer after <n> seconds of inactivity"
 msgstr "трансферът да се преустанови след този БРОЙ секунди"
 
 msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
-msgstr "git verify-commit [-v | --verbose] [--raw] ПОДАВАНЕ…"
+msgstr "git verify-commit [-v|--verbose] [--raw] ПОДАВАНЕ…"
 
 msgid "print commit contents"
 msgstr "извеждане на съдържанието на подаването"
@@ -13877,7 +13992,7 @@ msgid "print raw gpg status output"
 msgstr "извеждане на необработения изход от състоянието на „gpg“"
 
 msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] [--] ПАКЕТ.idx…"
+msgstr "git verify-pack [-v|--verbose] [-s|--stat-only] [--] ПАКЕТ.idx…"
 
 msgid "verbose"
 msgstr "извеждане на подробна информация"
@@ -13886,20 +14001,20 @@ msgid "show statistics only"
 msgstr "извеждане само на статистиката"
 
 msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=ФОРМАТ] [--raw] ЕТИКЕТ…"
+msgstr "git verify-tag [-v|--verbose] [--format=ФОРМАТ] [--raw] ЕТИКЕТ…"
 
 msgid "print tag contents"
 msgstr "извеждане на съдържанието на ЕТИКЕТи"
 
 msgid ""
 "git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
-"                 [-b <new-branch>] <path> [<commit-ish>]"
+"                 [--orphan] [(-b | -B) <new-branch>] <path> [<commit-ish>]"
 msgstr ""
 "git worktree add [-f] [--detach] [--checkout] [--lock [--reason НИЗ]]\n"
-"                 [-b НОВ_КЛОН] ПЪТ [УКАЗАТЕЛ_КЪМ_ПОДАВАНЕ]"
+"                 [--orphan] [(-b|-B) НОВ_КЛОН] ПЪТ [УКАЗАТЕЛ_КЪМ_ПОДАВАНЕ]"
 
 msgid "git worktree list [-v | --porcelain [-z]]"
-msgstr "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v|--porcelain [-z]]"
 
 msgid "git worktree lock [--reason <string>] <worktree>"
 msgstr "git worktree lock [--reason ПРИЧИНА] ФОРМАТ"
@@ -13919,6 +14034,37 @@ msgstr "git worktree repair [ПЪТ…]"
 msgid "git worktree unlock <worktree>"
 msgstr "git worktree unlock ДЪРВО"
 
+msgid "No possible source branch, inferring '--orphan'"
+msgstr "Липсва клон-източник, затова се приема „--orphan“"
+
+#, c-format
+msgid ""
+"If you meant to create a worktree containing a new unborn branch\n"
+"(branch with no commits) for this repository, you can do so\n"
+"using the --orphan flag:\n"
+"\n"
+"    git worktree add --orphan -b %s %s\n"
+msgstr ""
+"За да създадете работно дърво за това хранилище\n"
+"с нов неродѐн клон — който няма дори и начално подаване,\n"
+"ползвайте опцията „--orphan“:\n"
+"\n"
+"    git worktree add --orphan -b %s %s\n"
+
+#, c-format
+msgid ""
+"If you meant to create a worktree containing a new unborn branch\n"
+"(branch with no commits) for this repository, you can do so\n"
+"using the --orphan flag:\n"
+"\n"
+"    git worktree add --orphan %s\n"
+msgstr ""
+"За да създадете работно дърво за това хранилище\n"
+"с нов неродѐн клон — който няма дори и начално подаване,\n"
+"ползвайте опцията „--orphan“:\n"
+"\n"
+"    git worktree add --orphan %s\n"
+
 #, c-format
 msgid "Removing %s/%s: %s"
 msgstr "Изтриване на „%s/%s“: %s"
@@ -13976,6 +14122,10 @@ msgstr "директорията „%s“ не може да бъде създа
 msgid "initializing"
 msgstr "инициализация"
 
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "създаденото в „%s“ работно дърво липсва"
+
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
 msgstr "Приготвяне на работното дърво (нов клон „%s“)"
@@ -13990,10 +14140,34 @@ msgstr ""
 msgid "Preparing worktree (checking out '%s')"
 msgstr "Приготвяне на работното дърво (изтегляне на „%s“)"
 
+#, c-format
+msgid "unreachable: invalid reference: %s"
+msgstr "недостижим обект: неправилен указател: %s"
+
 #, c-format
 msgid "Preparing worktree (detached HEAD %s)"
 msgstr "Подготвяне на работно дърво (указателят „HEAD“ не свързан: %s)"
 
+#, c-format
+msgid ""
+"HEAD points to an invalid (or orphaned) reference.\n"
+"HEAD path: '%s'\n"
+"HEAD contents: '%s'"
+msgstr ""
+"HEAD сочи към неправилен или неродѐн указател.\n"
+"HEAD path: „%s“\n"
+"HEAD contents: „%s“"
+
+msgid ""
+"No local or remote refs exist despite at least one remote\n"
+"present, stopping; use 'add -f' to override or fetch a remote first"
+msgstr ""
+"Не съществуват никакви локални или отдалечени указатели, въпреки че има\n"
+"поне едно следено хранилище. Работата спира.\n"
+"Ползвайте комбинацията „add -f“ за принудително действие или първо "
+"доставете\n"
+"обектите от отдалеченото хранилище"
+
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr "Изтегляне КЛОНа, дори и да е изтеглен в друго работно дърво"
 
@@ -14003,6 +14177,9 @@ msgstr "създаване на нов клон"
 msgid "create or reset a branch"
 msgstr "създаване или зануляване на клони"
 
+msgid "create unborn branch"
+msgstr "създаване на неродѐн клон"
+
 msgid "populate the new working tree"
 msgstr "подготвяне на новото работно дърво"
 
@@ -14022,6 +14199,10 @@ msgstr "опит за напасване на името на новия кло
 msgid "options '%s', '%s', and '%s' cannot be used together"
 msgstr "опциите „%s“, „%s“ и „%s“ са несъвместими"
 
+#, c-format
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "опциите „%s“ и указателите към подавания са несъвместими"
+
 msgid "added with --lock"
 msgstr "добавена с „--lock“"
 
@@ -14258,6 +14439,14 @@ msgid_plural "The bundle requires these %<PRIuMAX> refs:"
 msgstr[0] "Пратката изисква следния указател:"
 msgstr[1] "Пратката изисква следните %<PRIuMAX> указатели:"
 
+#, c-format
+msgid "The bundle uses this hash algorithm: %s"
+msgstr "Пратката ползва следния алгоритъм за контролни суми „%s“"
+
+#, c-format
+msgid "The bundle uses this filter: %s"
+msgstr "Пратката изисква следния филтър: %s"
+
 msgid "unable to dup bundle descriptor"
 msgstr "неуспешно дублиране на дескриптора на пратката с „dup“"
 
@@ -14293,6 +14482,10 @@ msgstr "командата „git index-pack“ не завърши успешн
 msgid "terminating chunk id appears earlier than expected"
 msgstr "идентификаторът за краен откъс се явява по-рано от очакваното"
 
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "откъсът с идентификатор %<PRIx32> не е подравнен по %d-байта"
+
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
 msgstr "неправилно отместване на откъс/и %<PRIx64> и %<PRIx64>"
@@ -14347,9 +14540,9 @@ msgstr "Събиране на информация за потребителя 
 msgid "Move objects and refs by archive"
 msgstr "Местене на обекти и указатели по архиви"
 
-msgid "Provide content or type and size information for repository objects"
+msgid "Provide contents or details of repository objects"
 msgstr ""
-"Ð\9fÑ\80едоÑ\81Ñ\82авÑ\8fне Ð½Ð° Ñ\81Ñ\8aдÑ\8aÑ\80жаниеÑ\82о Ð¸Ð»Ð¸ Ð²Ð¸Ð´Ð° Ð¸ Ñ\80азмеÑ\80иÑ\82е на обекти от хранилище"
+"Ð\9fÑ\80едоÑ\81Ñ\82авÑ\8fне Ð½Ð° Ñ\81Ñ\8aдÑ\8aÑ\80жаниеÑ\82о Ð¸Ð»Ð¸ Ð´Ñ\80Ñ\83га Ð¸Ð½Ñ\84оÑ\80маÑ\86иÑ\8f на обекти от хранилище"
 
 msgid "Display gitattributes information"
 msgstr "Извеждане на информацията за атрибутите на git (gitattributes)"
@@ -14496,10 +14689,9 @@ msgstr "Извеждане на редовете напасващи на шаб
 msgid "A portable graphical interface to Git"
 msgstr "Графичен интерфейс към Git"
 
-msgid "Compute object ID and optionally creates a blob from a file"
+msgid "Compute object ID and optionally create an object from a file"
 msgstr ""
-"Изчисляване на идентификатор на обект и евентуално създаване на обект-BLOB "
-"от файл"
+"Изчисляване на идентификатор на обект и евентуално създаване на обект от файл"
 
 msgid "Display help information about Git"
 msgstr "Извеждане на помощта за Git"
@@ -14646,6 +14838,11 @@ msgstr "Пакетиране на непакетираните обекти в 
 msgid "Create, list, delete refs to replace objects"
 msgstr "Създаване, извеждане, изтриване на указатели за замяна на обекти"
 
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"ЕКСПЕРИМЕНТАЛНО: прилагане на подавания върху нова база, работи и с голи "
+"хранилища"
+
 msgid "Generates a summary of pending changes"
 msgstr "Обобщение на предстоящите промѐни"
 
@@ -14767,7 +14964,7 @@ msgstr "Проверка на подписите GPG върху етикетит
 msgid "Display version information about Git"
 msgstr "Извеждане на версията на Git"
 
-msgid "Show logs with difference each commit introduces"
+msgid "Show logs with differences each commit introduces"
 msgstr "Извеждане на журнал с разликите, въведени с всяко подаване"
 
 msgid "Manage multiple working trees"
@@ -14884,6 +15081,36 @@ msgstr "Инструмент за управление на големи хра
 msgid "commit-graph file is too small"
 msgstr "файлът за гра̀фа с подаванията е твърде малък"
 
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "откъсът за разпределянето в гра̀фа с подаванията е прекалено малък"
+
+msgid "commit-graph fanout values out of order"
+msgstr ""
+"стойностите за откъс за разпределяне в гра̀фа с подаванията не са подредени"
+
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "откъсът за търсенето в гра̀фа с подаванията е прекалено малък"
+
+msgid "commit-graph commit data chunk is wrong size"
+msgstr ""
+"откъсът за данните за подаванията в гра̀фа с подаванията е с неправилен размер"
+
+msgid "commit-graph generations chunk is wrong size"
+msgstr "откъсът за поколенията в гра̀фа с подаванията е с неправилен размер"
+
+msgid "commit-graph changed-path index chunk is too small"
+msgstr ""
+"откъсът за индекса с промѐни в пътищата в гра̀фа с подаванията е прекалено "
+"малък"
+
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"прескачане на прекалено малък откъс за индекса с промѐни (%<PRIuMAX> < "
+"%<PRIuMAX>) в пътищата в гра̀фа с подаванията"
+
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
 msgstr "отпечатъкът на гра̀фа с подаванията %X не съвпада с %X"
@@ -14900,12 +15127,35 @@ msgstr "версията на контролната сума на гра̀фа
 msgid "commit-graph file is too small to hold %u chunks"
 msgstr "файлът с гра̀фа на подаванията е твърде малък, за да съдържа %u откъси"
 
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr ""
+"откъсът за разпределянето необходимо на гра̀фа с подаванията липсва или е "
+"повреден"
+
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr ""
+"откъсът за търсенето необходимо на гра̀фа с подаванията липсва или е повреден"
+
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr ""
+"откъсът за данните необходими на гра̀фа с подаванията липсва или е повреден"
+
 msgid "commit-graph has no base graphs chunk"
 msgstr "базовият откъс липсва в гра̀фа с подаванията"
 
+msgid "commit-graph base graphs chunk is too small"
+msgstr "базовият откъс в гра̀фа с подаванията е прекалено малък"
+
 msgid "commit-graph chain does not match"
 msgstr "веригата на гра̀фа с подаванията не съвпада"
 
+#, c-format
+msgid "commit count in base graph too high: %<PRIuMAX>"
+msgstr "броят подавания в основния граф е прекалено голям: %<PRIuMAX>"
+
+msgid "commit-graph chain file too small"
+msgstr "веригата на гра̀фа с подаванията е твърде малка"
+
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
 msgstr ""
@@ -14924,8 +15174,15 @@ msgstr "подаването „%s“ не може да бъде открито
 
 msgid "commit-graph requires overflow generation data but has none"
 msgstr ""
-"графът с подаванията изисква генериране на данни за отместването, но такива "
-"липсват"
+"графът с подаванията изисква данни за прелелите поколения, но такива липсват"
+
+msgid "commit-graph overflow generation data is too small"
+msgstr "прекалено малко данни за прелелите поколения в гра̀фа с подаванията"
+
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr ""
+"указателят за допълнителните ребра в гра̀фа с подаванията е извън позволения "
+"диапазон"
 
 msgid "Loading known commits in commit graph"
 msgstr "Зареждане на познатите подавания в гра̀фа с подаванията"
@@ -14969,7 +15226,8 @@ msgid "Finding extra edges in commit graph"
 msgstr "Откриване на още върхове в гра̀фа с подаванията"
 
 msgid "failed to write correct number of base graph ids"
-msgstr "правилният брой на базовите идентификатори не може да се запише"
+msgstr ""
+"правилният брой на идентификаторите в основния граф не може да се запише"
 
 msgid "unable to create temporary graph layer"
 msgstr "не може да бъде създаден временен слой за гра̀фа с подаванията"
@@ -14993,6 +15251,15 @@ msgstr "основният файл на гра̀фа с подаванията
 msgid "failed to rename temporary commit-graph file"
 msgstr "временният файл на гра̀фа с подаванията не може да бъде преименуван"
 
+#, c-format
+msgid "cannot merge graphs with %<PRIuMAX>, %<PRIuMAX> commits"
+msgstr ""
+"не може да се слеят графове с %<PRIuMAX> и %<PRIuMAX> подавания (съответно)"
+
+#, c-format
+msgid "cannot merge graph %s, too many commits: %<PRIuMAX>"
+msgstr "графът „%s“ не може да се слее, прекалено много подавания: %<PRIuMAX>"
+
 msgid "Scanning merged commits"
 msgstr "Търсене на подаванията със сливания"
 
@@ -15019,16 +15286,13 @@ msgstr ""
 #, c-format
 msgid "commit-graph has incorrect fanout value: fanout[%d] = %u != %u"
 msgstr ""
-"непÑ\80авилна Ñ\81Ñ\82ойноÑ\81Ñ\82 Ð·Ð° Ð¾Ñ\82кÑ\8aÑ\81 Ð² Ð³Ñ\80аÌ\80Ñ\84а Ñ\81 Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñ\8fÑ\82а: fanout[%d] = %u, Ð° "
-"трябва да е %u"
+"непÑ\80авилна Ñ\81Ñ\82ойноÑ\81Ñ\82 Ð·Ð° Ð¾Ñ\82кÑ\8aÑ\81 Ð·Ð° Ñ\80азпÑ\80еделÑ\8fне Ð² Ð³Ñ\80аÌ\80Ñ\84а Ñ\81 Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñ\8fÑ\82а: "
+"fanout[%d] = %u, а трябва да е %u"
 
 #, c-format
 msgid "failed to parse commit %s from commit-graph"
 msgstr "подаване „%s“ в гра̀фа с подаванията не може да се анализира"
 
-msgid "Verifying commits in commit graph"
-msgstr "Проверка на подаванията в гра̀фа"
-
 #, c-format
 msgid "failed to parse commit %s from object database for commit-graph"
 msgstr ""
@@ -15053,20 +15317,6 @@ msgstr "родителят на „%s“ в гра̀фа с подаваният
 msgid "commit-graph parent list for commit %s terminates early"
 msgstr "списъкът с родители на „%s“ в гра̀фа с подаванията е прекалено къс"
 
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"номерът на поколението на подаване „%s“ в гра̀фа с подаванията е 0, а другаде "
-"не е"
-
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"номерът на поколението на подаване „%s“ в гра̀фа с подаванията не е 0, а "
-"другаде е"
-
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
 msgstr ""
@@ -15079,6 +15329,17 @@ msgstr ""
 "датата на подаване на „%s“ в гра̀фа с подаванията е %<PRIuMAX>, а трябва да е "
 "%<PRIuMAX>"
 
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"гра̀фа с подаванията съдържа както нулеви, така и ненулеви поколения (напр. "
+"подаванията „%s“ и „%s“)"
+
+msgid "Verifying commits in commit graph"
+msgstr "Проверка на подаванията в гра̀фа"
+
 #, c-format
 msgid "%s %s is not a commit!"
 msgstr "%s %s не е подаване!"
@@ -15105,6 +15366,12 @@ msgstr ""
 "\n"
 "    git config advice.graftFileDeprecated false"
 
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr ""
+"подаването „%s“ присъства в гра̀фа с подаванията, но липсва в базата от данни "
+"за обектите"
+
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
 msgstr ""
@@ -15567,10 +15834,6 @@ msgstr "указателят „%s“ не сочи към обект-BLOB"
 msgid "unable to resolve config blob '%s'"
 msgstr "обектът-BLOB „%s“ с конфигурации не може да бъде открит"
 
-#, c-format
-msgid "failed to parse %s"
-msgstr "„%s“ не може да бъде анализиран"
-
 msgid "unable to parse command-line config"
 msgstr "неправилни настройки от командния ред"
 
@@ -16055,9 +16318,6 @@ msgstr "неуспешен запис на архива"
 msgid "--merge-base does not work with ranges"
 msgstr "опцията „--merge-base“ не работи с диапазони"
 
-msgid "--merge-base only works with commits"
-msgstr "опцията „--merge-base“ работи само с подавания"
-
 msgid "unable to get HEAD"
 msgstr "Указателят „HEAD“ не може да бъде получен"
 
@@ -16067,6 +16327,12 @@ msgstr "липсва база за сливане"
 msgid "multiple merge bases found"
 msgstr "много бази за сливане"
 
+msgid "cannot compare stdin to a directory"
+msgstr "стандартният вход не може да се сравни с директория"
+
+msgid "cannot compare a named pipe to a directory"
+msgstr "именован канал не може да се сравни с директория"
+
 msgid "git diff --no-index [<options>] <path> <path>"
 msgstr "git diff --no-index [ОПЦИЯ…] ПЪТ ПЪТ"
 
@@ -16118,6 +16384,10 @@ msgstr ""
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr "Непозната стойност „%s“ за настройката „diff.submodule“"
 
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "непозната стойност за настройката „%s“: „%s“"
+
 #, c-format
 msgid ""
 "Found errors in 'diff.dirstat' config variable:\n"
@@ -16131,6 +16401,13 @@ msgid "external diff died, stopping at %s"
 msgstr ""
 "външната програма за разлики завърши неуспешно.  Спиране на работата при „%s“"
 
+msgid "--follow requires exactly one pathspec"
+msgstr "опцията „--follow“ изисква точно един път"
+
+#, c-format
+msgid "pathspec magic not supported by --follow: %s"
+msgstr "магическите пътища не се поддържат от „--follow“: %s"
+
 #, c-format
 msgid "options '%s', '%s', '%s', and '%s' cannot be used together"
 msgstr "опциите „%s“, „%s“, „%s“ и „%s“ са несъвместими"
@@ -16144,9 +16421,6 @@ msgid ""
 "options '%s' and '%s' cannot be used together, use '%s' with '%s' and '%s'"
 msgstr "опциите „%s“ и „%s“ са несъвместими, използвайте „%s“ с „%s“ и „%s“"
 
-msgid "--follow requires exactly one pathspec"
-msgstr "опцията „--follow“ изисква точно един път"
-
 #, c-format
 msgid "invalid --stat value: %s"
 msgstr "неправилна стойност за „--stat“: %s"
@@ -16193,14 +16467,6 @@ msgstr "неправилен аргумент за „--color-moved“: „%s“
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "неправилен режим „%s“ за „ --color-moved-ws“"
 
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"опцията приема следните варианти за алгоритъм за разлики: „myers“ (по "
-"Майерс), „minimal“ (минимизиране на разликите), „patience“ (пасианс) и "
-"„histogram“ (хистограмен)"
-
 #, c-format
 msgid "invalid argument to %s"
 msgstr "неправилен аргумент към „%s“"
@@ -16244,8 +16510,8 @@ msgstr "„--stat“ във формат за четене от програма
 msgid "output only the last line of --stat"
 msgstr "извеждане само на последния ред на „--stat“"
 
-msgid "<param1,param2>..."
-msgstr "ПАРАМЕТЪР_1, ПАРАМЕТЪР_2, …"
+msgid "<param1>,<param2>..."
+msgstr "ПАРАМЕТЪР_1,ПАРАМЕТЪР_2,…"
 
 msgid ""
 "output the distribution of relative amount of changes for each sub-directory"
@@ -16254,8 +16520,8 @@ msgstr "извеждане на разпределението на промѐ
 msgid "synonym for --dirstat=cumulative"
 msgstr "псевдоним на „--dirstat=cumulative“"
 
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "псевдоним на „--dirstat=ФАЙЛ…,ПАРАМЕТЪР_1,ПАРАМЕТЪР_2,…“"
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "псевдоним на „--dirstat=files,ПАРАМЕТЪР_1,ПАРАМЕТЪР_2,…“"
 
 msgid "warn if changes introduce conflict markers or whitespace errors"
 msgstr ""
@@ -16439,12 +16705,6 @@ msgstr "разлика чрез алгоритъм за подредба кат
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "разлика по хистограмния алгоритъм"
 
-msgid "<algorithm>"
-msgstr "АЛГОРИТЪМ"
-
-msgid "choose a diff algorithm"
-msgstr "избор на АЛГОРИТЪМа за разлики"
-
 msgid "<text>"
 msgstr "ТЕКСТ"
 
@@ -16918,16 +17178,9 @@ msgid ""
 "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
 "           [--config-env=<name>=<envvar>] <command> [<args>]"
 msgstr ""
-"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
-"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
-"           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
-"bare]\n"
-"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-"           [--config-env=<name>=<envvar>] <command> [<args>]\n"
-"git [-v | --version] [-h | --help] [-C ПЪТ] [-c ИМЕ=СТОЙНОСТ]\n"
+"git [-v|--version] [-h|--help] [-C ПЪТ] [-c ИМЕ=СТОЙНОСТ]\n"
 "           [--exec-path[=ПЪТ]] [--html-path] [--man-path] [--info-path]\n"
-"           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
-"bare]\n"
+"           [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]\n"
 "           [--git-dir=ПЪТ] [--work-tree=ПЪТ] [--namespace=ИМЕ]\n"
 "           [--config-env=ИМЕ=ПРОМЕНЛИВА_НА_СРЕДАТА] КОМАНДА [АРГ…]"
 
@@ -17513,12 +17766,12 @@ msgstr ""
 "Неуспешно сливане на подмодула „%s“, но са открити множество решения:\n"
 "%s"
 
-msgid "Failed to execute internal merge"
-msgstr "Ð\9dеуспешно вътрешно сливане"
+msgid "failed to execute internal merge"
+msgstr "неуспешно вътрешно сливане"
 
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "„%s“ не може да се добави в базата с данни"
+msgid "unable to add %s to database"
+msgstr "„%s“ не може да се добави в базата от данни"
 
 #, c-format
 msgid "Auto-merging %s"
@@ -17967,7 +18220,22 @@ msgid "failed to read the cache"
 msgstr "кешът не може да бъде прочетен"
 
 msgid "multi-pack-index OID fanout is of the wrong size"
-msgstr "неправилен размер на откъс (OID fanout) на индекса за множество пакети"
+msgstr ""
+"неправилен размер на откъса за разпределянето в индекса за множество пакети"
+
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"неправилна подредба на откъси (OID fanout): fanout[%d] = %<PRIx32> > "
+"%<PRIx32> = fanout[%d]"
+
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "неправилен размер на откъса за търсенето в индекса за множество пакети"
+
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr ""
+"неправилен размер на откъса за отместванията в индекса за множество пакети"
 
 #, c-format
 msgid "multi-pack-index file %s is too small"
@@ -17987,17 +18255,25 @@ msgstr ""
 "версията на контролната сума на индекса за множество пакети %u не съвпада с "
 "%u"
 
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "липсва откъс (pack-name) от индекс за множество пакети"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr ""
+"откъсът за имена на пакети в индекса за множество пакети липсва или е "
+"повреден"
+
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr ""
+"откъсът за разпределянето в индекса за множество пакети липсва или е повреден"
 
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "липÑ\81ва Ð¾Ñ\82кÑ\8aÑ\81 (OID fanout) Ð¾Ñ\82 Ð¸Ð½Ð´ÐµÐºÑ\81 Ð·Ð° Ð¼Ð½Ð¾Ð¶ÐµÑ\81Ñ\82во Ð¿Ð°ÐºÐµÑ\82и"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr "оÑ\82кÑ\8aÑ\81Ñ\8aÑ\82 Ð·Ð° Ñ\82Ñ\8aÑ\80Ñ\81ене Ð² Ð¸Ð½Ð´ÐµÐºÑ\81 Ð·Ð° Ð¼Ð½Ð¾Ð¶ÐµÑ\81Ñ\82во Ð¿Ð°ÐºÐµÑ\82и Ð»Ð¸Ð¿Ñ\81ва Ð¸Ð»Ð¸ Ðµ Ð¿Ð¾Ð²Ñ\80еден"
 
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "липсва откъс (OID lookup) от индекс за множество пакети"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr ""
+"откъсът за отмествания в индекс за множество пакети липсва или е повреден"
 
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "липсва откъс за отместванията на обекти от индекс за множество пакети"
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr ""
+"откъсът за име на пакет в индекс за множество пакети липсва или е повреден"
 
 #, c-format
 msgid "multi-pack-index pack names out of order: '%s' before '%s'"
@@ -18010,11 +18286,23 @@ msgid "bad pack-int-id: %u (%u total packs)"
 msgstr ""
 "неправилен идентификатор на пакет (pack-int-id): %u (от общо %u пакети)"
 
+msgid "MIDX does not contain the BTMP chunk"
+msgstr ""
+"липсва откъс за побитова маска във файла за индекса за множество пакети"
+
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "пакетът за битови маски %<PRIu32> не може да се отвори"
+
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr ""
 "индексът за множество пакети съдържа 64-битови отмествания, но размерът на "
 "„off_t“ е недостатъчен"
 
+msgid "multi-pack-index large offset out of bounds"
+msgstr ""
+"стойността на отместването в индекса за множество пакети е извън диапазона"
+
 #, c-format
 msgid "failed to add packfile '%s'"
 msgstr "пакетният файл „%s“ не може да бъде добавен"
@@ -18088,7 +18376,9 @@ msgid "failed to clear multi-pack-index at %s"
 msgstr "индексът за множество пакети не може да бъде изчистен при „%s“"
 
 msgid "multi-pack-index file exists, but failed to parse"
-msgstr "файлът с индекса за множество пакети, но не може да бъде анализиран"
+msgstr ""
+"файлът с индекса за множество пакети съществува, но не може да бъде "
+"анализиран"
 
 msgid "incorrect checksum"
 msgstr "неправилна сума за проверка"
@@ -18096,13 +18386,6 @@ msgstr "неправилна сума за проверка"
 msgid "Looking for referenced packfiles"
 msgstr "Търсене на указаните пакетни файлове"
 
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr ""
-"неправилна подредба на откъси (OID fanout): fanout[%d] = %<PRIx32> > "
-"%<PRIx32> = fanout[%d]"
-
 msgid "the midx contains no oid"
 msgstr "във файла с индекса за множество пакети няма идентификатори на обекти"
 
@@ -18647,6 +18930,11 @@ msgstr "задължителният обратен индекс липсва в
 msgid "could not open pack %s"
 msgstr "пакетът „%s“ не може да се отвори"
 
+msgid "could not determine MIDX preferred pack"
+msgstr ""
+"предпочитаният пакет за файла с индекса за множество пакети не може да се "
+"определи"
+
 #, c-format
 msgid "preferred pack (%s) is invalid"
 msgstr "предпочитаният пакет „%s“ е неправилен"
@@ -18673,6 +18961,11 @@ msgstr ""
 "повредена битова маска във формат EWAH: отрязана заглавна част за битовата "
 "маска на подаване „%s“"
 
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr ""
+"пакетът не може да се зареди: „%s“, преизползването на пакети се изключва"
+
 #, c-format
 msgid "object '%s' not found in type bitmaps"
 msgstr "обектът „%s“ липсва в битовата маска на видовете"
@@ -18768,6 +19061,13 @@ msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr ""
 "неправилна позиция в обратния индекс при %<PRIu64>: %<PRIu32> != %<PRIu32>"
 
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr ""
+"неправилен размер на откъс за обратен индекс в индекса за множество пакети"
+
+msgid "could not determine preferred pack"
+msgstr "предпочитаният пакет не може да се определи"
+
 msgid "cannot both write and verify reverse index"
 msgstr "обратният индекс не може едновременно да се записва и да се проверява"
 
@@ -18825,14 +19125,6 @@ msgstr "опцията „%s“ изисква някоя от стойност
 msgid "%s requires a value"
 msgstr "опцията „%s“ изисква аргумент"
 
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "опциите „%s“ и „%s“ са несъвместими"
-
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "опцията „%s“ е несъвместима с нещо"
-
 #, c-format
 msgid "%s takes no value"
 msgstr "опцията „%s“ не приема аргументи"
@@ -18917,6 +19209,10 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-ЧИСЛО"
 
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "обратното на „--no-%s“"
+
 msgid "expiry-date"
 msgstr "период на валидност/запазване"
 
@@ -18947,6 +19243,14 @@ msgstr ""
 "при ползването на „--pathspec-from-file“, пътищата са разделени с нулевия "
 "знак „NUL“"
 
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "неправилна булева стойност „%s“ за „%s“"
+
+#, c-format
+msgid "failed to parse %s"
+msgstr "„%s“ не може да бъде анализиран"
+
 #, c-format
 msgid "Could not make %s writable by group"
 msgstr "Не може да се дадат права̀ за запис в директорията „%s“ на групата"
@@ -18994,6 +19298,10 @@ msgstr "Магическите пътища „%c“ са без реализа
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s: опциите „literal“ и „glob“ са несъвместими"
 
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "„%s“ е извън дървото на директориите"
+
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
 msgstr "%s: „%s“ е извън хранилището при „%s“"
@@ -19125,6 +19433,13 @@ msgstr "неуспешно търсене на разлика"
 msgid "could not parse log for '%s'"
 msgstr "журналът с подаванията на „%s“ не може да бъде анализиран"
 
+#, c-format
+msgid "invalid extra cruft tip: '%s'"
+msgstr "неправилен ненужен връх: „%s“"
+
+msgid "unable to enumerate additional recent objects"
+msgstr "допълнителните скорошни обекти не може да се изброят"
+
 #, c-format
 msgid "will not add file alias '%s' ('%s' already exists in index)"
 msgstr ""
@@ -19147,10 +19462,6 @@ msgstr "файлът „%s“ не може да бъде индексиран"
 msgid "unable to add '%s' to index"
 msgstr "„%s“ не може да се добави в индекса"
 
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "„stat“ не може да се изпълни върху „%s“"
-
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
 msgstr "„%s“ съществува и като файл, и като директория"
@@ -19268,10 +19579,6 @@ msgstr "не може да се запише разделѐн, частиче
 msgid "failed to convert to a sparse-index"
 msgstr "индексът не може да бъде превърнат в частичен"
 
-#, c-format
-msgid "could not stat '%s'"
-msgstr "неуспешно изпълнение на „stat“ върху „%s“"
-
 #, c-format
 msgid "unable to open git dir: %s"
 msgstr "не може да се отвори директорията на git: %s"
@@ -19288,6 +19595,14 @@ msgstr "права̀та за достъп до „%s“ не може да бъ
 msgid "%s: cannot drop to stage #0"
 msgstr "%s: не може да се премине към етап №0"
 
+#, c-format
+msgid "unexpected diff status %c"
+msgstr "неочакван изходен код при генериране на разлика: %c"
+
+#, c-format
+msgid "remove '%s'\n"
+msgstr "изтриване на „%s“\n"
+
 msgid ""
 "You can fix this with 'git rebase --edit-todo' and then run 'git rebase --"
 "continue'.\n"
@@ -19337,7 +19652,7 @@ msgstr ""
 " e, edit ПОДАВАНЕ   — прилагане на подаването и спиране при него за още "
 "промѐни\n"
 " s, squash ПОДАВАНЕ — вкарване на подаването в предходното му\n"
-" f, fixup [-C | -c] ПОДАВАНЕ\n"
+" f, fixup [-C|-c] ПОДАВАНЕ\n"
 "                    — вкарване на подаването в предходното му, без смяна на\n"
 "                      съобщението.  С „-C“ се използва само съобщението на\n"
 "                      настоящото, а с „-c“ освен това се отваря редакторът\n"
@@ -19349,7 +19664,7 @@ msgstr ""
 " d, drop ПОДАВАНЕ   — прескачане на подаването\n"
 " l, label ЕТИКЕТ    — задаване на етикет на указаното от HEAD\n"
 " t, reset ЕТИКЕТ    — зануляване на HEAD към ЕТИКЕТа\n"
-" m, merge [-C ПОДАВАНЕ | -c ПОДАВАНЕ] ЕТИКЕТ [# ЕДИН_РЕД]\n"
+" m, merge [-C ПОДАВАНЕ|-c ПОДАВАНЕ] ЕТИКЕТ [# ЕДИН_РЕД]\n"
 "                    — създаване на подаване със сливане със съобщението от\n"
 "                      първоначалното подаване (или съобщението от ЕДИН_РЕД,\n"
 "                      ако не е зададено подаване със сливане.  С опцията\n"
@@ -19489,6 +19804,22 @@ msgstr "непознат аргумент „%%(trailers)“: %s"
 msgid "positive value expected contents:lines=%s"
 msgstr "очаква се положителна стойност за „contents:lines=%s“"
 
+#, c-format
+msgid "argument expected for %s"
+msgstr "„%s“ изисква аргумент"
+
+#, c-format
+msgid "positive value expected %s=%s"
+msgstr "очаква се положителна стойност за „%s=%s“"
+
+#, c-format
+msgid "cannot fully parse %s=%s"
+msgstr "„%s=%s“ не може да се анализира докрай"
+
+#, c-format
+msgid "value expected %s="
+msgstr "очаква се стойност за „%s=“"
+
 #, c-format
 msgid "positive value expected '%s' in %%(%s)"
 msgstr "очаква се положителна стойност за „%s“ в %%(%s)"
@@ -19563,6 +19894,9 @@ msgid "--format=%.*s cannot be used with --python, --shell, --tcl"
 msgstr ""
 "опцията „--format=%.*s“ е несъвместима с „--python“, „--shell“, „--tcl“"
 
+msgid "failed to run 'describe'"
+msgstr "неуспешно изпълнение на „describe“"
+
 #, c-format
 msgid "(no branch, rebasing %s)"
 msgstr "(извън клон, пребазиране на „%s“)"
@@ -19624,6 +19958,9 @@ msgstr "КЛЮЧ"
 msgid "field name to sort on"
 msgstr "име на полето, по което да е подредбата"
 
+msgid "exclude refs which match pattern"
+msgstr "прескачана на указателите напасващи на ШАБЛОНа"
+
 #, c-format
 msgid "not a reflog: %s"
 msgstr "„%s“ не е журнал с подавания"
@@ -19670,7 +20007,7 @@ msgstr "неправилно име на клон: „%s = %s“"
 
 #, c-format
 msgid "ignoring dangling symref %s"
-msgstr "игнориране на указател на обект извън клон „%s“"
+msgstr "игноÑ\80иÑ\80ане Ð½Ð° Ñ\84айл Ñ\81 Ñ\83казаÑ\82ел Ð½Ð° Ð¾Ð±ÐµÐºÑ\82 Ð¸Ð·Ð²Ñ\8aн ÐºÐ»Ð¾Ð½ â\80\9e%sâ\80\9c"
 
 #, c-format
 msgid "log for ref %s has gap after %s"
@@ -19710,10 +20047,6 @@ msgstr "„%s“ съществува, не може да се създаде 
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "невъзможно е едновременно да се обработват „%s“ и „%s“"
 
-#, c-format
-msgid "could not remove reference %s"
-msgstr "Указателят „%s“ не може да бъде изтрит"
-
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "Указателят „%s“ не може да бъде изтрит: %s"
@@ -20074,7 +20407,8 @@ msgstr[1] ""
 "Текущият клон се е раздалечил от „%s“,\n"
 "двата имат съответно по %d и %d несъвпадащи подавания.\n"
 
-msgid "  (use \"git pull\" to merge the remote branch into yours)\n"
+msgid ""
+"  (use \"git pull\" if you want to integrate the remote branch with yours)\n"
 msgstr "  (слейте отдалечения клон в локалния чрез „git pull“)\n"
 
 #, c-format
@@ -20193,6 +20527,10 @@ msgstr "подаването „%s“ към опцията „--ancestry-path
 msgid "--unpacked=<packfile> no longer supported"
 msgstr "опцията „--unpacked=ПАКЕТЕН_ФАЙЛ“ вече не се поддържа"
 
+#, c-format
+msgid "invalid option '%s' in --stdin mode"
+msgstr "опциите „%s“ и „--stdin“ са несъвместими"
+
 msgid "your current branch appears to be broken"
 msgstr "Текущият клон е повреден"
 
@@ -20281,8 +20619,15 @@ msgstr "при клониране да се създава пълна работ
 msgid "only download metadata for the branch that will be checked out"
 msgstr "да се свалят метаданните само за изтегляния клон"
 
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [ОПЦИЯ…] [--] ХРАНИЛИЩЕ [ДИРЕКТОРИЯ]"
+msgid "create repository within 'src' directory"
+msgstr "създаване на хранилище в директория „src“"
+
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch ОСНОВЕН_КЛОН] [--full-clone]\n"
+"    [--[no-]src] АДРЕС [ЗАЧИСЛЕНА_ДИРЕКТОРИЯ]"
 
 #, c-format
 msgid "cannot deduce worktree name from '%s'"
@@ -20323,7 +20668,7 @@ msgid "reconfigure all registered enlistments"
 msgstr "пренастройване на всички зачислени директории"
 
 msgid "scalar reconfigure [--all | <enlistment>]"
-msgstr "scalar reconfigure [--all | ЗАЧИСЛЕНА_ДИРЕКТОРИЯ]"
+msgstr "scalar reconfigure [--all|ЗАЧИСЛЕНА_ДИРЕКТОРИЯ]"
 
 msgid "--all or <enlistment>, but not both"
 msgstr "опцията „--all“ и указването на зачислена директория не са съвместими"
@@ -20333,12 +20678,29 @@ msgid "could not remove stale scalar.repo '%s'"
 msgstr "остарялото скаларно хранилище (scalar.repo) „%s“ не може да се изтрие"
 
 #, c-format
-msgid "removing stale scalar.repo '%s'"
+msgid "removed stale scalar.repo '%s'"
 msgstr "изтриване на остарялото скаларно хранилище (scalar.repo) „%s“"
 
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "вече няма хранилище на git в „%s“"
+msgid "repository at '%s' has different owner"
+msgstr "хранилището „%s“ се притежава от друг"
+
+#, c-format
+msgid "repository at '%s' has a format issue"
+msgstr "хранилището в „%s“ е с неправилен формат"
+
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "в „%s“ липсва хранилище на git"
+
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"за да преустановите регистрацията на хранилището в Scalar, изпълнете\n"
+"\n"
+"    git config --global --unset --fixed-value scalar.repo \"%s\""
 
 msgid ""
 "scalar run <task> [<enlistment>]\n"
@@ -20367,7 +20729,7 @@ msgid "include Git's build options"
 msgstr "включване и на опциите за компилиране на git"
 
 msgid "scalar verbose [-v | --verbose] [--build-options]"
-msgstr "scalar verbose [-v | --verbose] [--build-options]"
+msgstr "scalar verbose [-v|--verbose] [--build-options]"
 
 msgid "-C requires a <directory>"
 msgstr "„-C“ изисква ДИРЕКТОРИЯ"
@@ -20774,10 +21136,6 @@ msgstr "неуспешно извличане на съобщението за 
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s: неразпозната стойност за родителското подаване „%s“"
 
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "„%s“ не може да се преименува на „%s“"
-
 #, c-format
 msgid "could not revert %s... %s"
 msgstr "подаването „%s“… не може да бъде отменено: „%s“"
@@ -20873,14 +21231,14 @@ msgstr "в момента вече се извършва отмяна на по
 
 #, c-format
 msgid "try \"git revert (--continue | %s--abort | --quit)\""
-msgstr "използвайте „git revert (--continue | %s--abort | --quit)“"
+msgstr "използвайте „git revert (--continue|%s--abort|--quit)“"
 
 msgid "cherry-pick is already in progress"
 msgstr "в момента вече се извършва отбиране на подавания"
 
 #, c-format
 msgid "try \"git cherry-pick (--continue | %s--abort | --quit)\""
-msgstr "използвайте „git cherry-pick (--continue | %s--abort | --quit)“"
+msgstr "използвайте „git cherry-pick (--continue|%s--abort|--quit)“"
 
 #, c-format
 msgid "could not create sequencer directory '%s'"
@@ -21114,6 +21472,9 @@ msgstr "Конфликти при прилагането на автоматич
 msgid "Autostash exists; creating a new stash entry."
 msgstr "Вече има запис за автоматично скатано, затова се създава нов запис."
 
+msgid "autostash reference is a symref"
+msgstr "указателят за автоматично скатано e файл с указател"
+
 msgid "could not detach HEAD"
 msgstr "указателят „HEAD“ не може да се отдели"
 
@@ -21147,14 +21508,14 @@ msgstr ""
 "    git rebase --edit-todo\n"
 "    git rebase --continue\n"
 
-#, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "Пребазиране (%d/%d)%s"
-
 #, c-format
 msgid "Stopped at %s...  %.*s\n"
 msgstr "Спиране при „%s“…  %.*s\n"
 
+#, c-format
+msgid "Rebasing (%d/%d)%s"
+msgstr "Пребазиране (%d/%d)%s"
+
 #, c-format
 msgid "unknown command %d"
 msgstr "непозната команда %d"
@@ -21401,6 +21762,85 @@ msgstr "неуспешно създаване на процес чрез „fork
 msgid "setsid failed"
 msgstr "неуспешно изпълнение на „setsid“"
 
+#, c-format
+msgid "cannot stat template '%s'"
+msgstr "не може да се получи информация чрез „stat“ за шаблона „%s“"
+
+#, c-format
+msgid "cannot opendir '%s'"
+msgstr "директорията „%s“ не може да бъде отворена"
+
+#, c-format
+msgid "cannot readlink '%s'"
+msgstr "връзката „%s“ не може да бъде прочетена"
+
+#, c-format
+msgid "cannot symlink '%s' '%s'"
+msgstr "не може да се създаде символна връзка „%s“ в „%s“"
+
+#, c-format
+msgid "cannot copy '%s' to '%s'"
+msgstr "„%s“ не може да се копира в „%s“"
+
+#, c-format
+msgid "ignoring template %s"
+msgstr "игнориране на шаблона „%s“"
+
+#, c-format
+msgid "templates not found in %s"
+msgstr "няма шаблони в „%s“"
+
+#, c-format
+msgid "not copying templates from '%s': %s"
+msgstr "шаблоните няма да бъдат копирани от „%s“: „%s“"
+
+#, c-format
+msgid "invalid initial branch name: '%s'"
+msgstr "неправилно име на първоначалния клон: „%s“"
+
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-init: „--initial-branch=%s“ се пропуска"
+
+#, c-format
+msgid "unable to handle file type %d"
+msgstr "файлове от вид %d не се поддържат"
+
+#, c-format
+msgid "unable to move %s to %s"
+msgstr "„%s“ не може да се премести в „%s“"
+
+msgid "attempt to reinitialize repository with different hash"
+msgstr ""
+"опит за зануляване на хранилището и инициализиране с различна контролна сума"
+
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr ""
+"опит за зануляване на хранилището и инициализиране с различен формат на "
+"съхраняване"
+
+#, c-format
+msgid "%s already exists"
+msgstr "Директорията „%s“ вече съществува"
+
+#, c-format
+msgid "Reinitialized existing shared Git repository in %s%s\n"
+msgstr ""
+"Инициализиране наново на съществуващо, споделено хранилище на Git в „%s%s“\n"
+
+#, c-format
+msgid "Reinitialized existing Git repository in %s%s\n"
+msgstr "Инициализиране наново на съществуващо хранилище на Git в „%s%s“\n"
+
+#, c-format
+msgid "Initialized empty shared Git repository in %s%s\n"
+msgstr "Инициализиране на празно, споделено хранилище на Git в „%s%s“\n"
+
+#, c-format
+msgid "Initialized empty Git repository in %s%s\n"
+msgstr "Инициализиране на празно хранилище на Git в „%s%s“\n"
+
 #, c-format
 msgid "index entry is a directory, but not sparse (%08x)"
 msgstr "обектът в индекса е директория, но не частично изтеглена (%08x)"
@@ -21655,12 +22095,6 @@ msgstr ""
 "какъв брой записи в кеша на обектите-дървета да се отбележат като невалидни "
 "(стандартно е 0)"
 
-msgid "unhandled options"
-msgstr "неподдържани опции"
-
-msgid "error preparing revisions"
-msgstr "грешка при подготовката на версии"
-
 #, c-format
 msgid "commit %s is not marked reachable"
 msgstr "подаването „%s“ не е отбелязано като достижимо"
@@ -21817,9 +22251,6 @@ msgstr "протоколът не поддържа задаването на п
 msgid "invalid remote service path"
 msgstr "неправилен път на отдалечената услуга"
 
-msgid "operation not supported by protocol"
-msgstr "опцията не се поддържа от протокола"
-
 #, c-format
 msgid "can't connect to subservice %s"
 msgstr "неуспешно свързване към подуслугата „%s“"
@@ -21954,10 +22385,6 @@ msgstr "стойността на настройката „transport.color.*“
 msgid "support for protocol v2 not implemented yet"
 msgstr "протокол версия 2 все още не се поддържа"
 
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "непозната стойност за настройката „%s“: „%s“"
-
 #, c-format
 msgid "transport '%s' not allowed"
 msgstr "преносът по „%s“ не е позволен"
@@ -22011,6 +22438,9 @@ msgstr ""
 "спъсъкът с адреси на пратки обявени за налични от сървъра не може да се "
 "получи "
 
+msgid "operation not supported by protocol"
+msgstr "опцията не се поддържа от протокола"
+
 msgid "too-short tree object"
 msgstr "прекалено кратък обект-дърво"
 
@@ -22399,6 +22829,9 @@ msgstr "няма достъп до „%s“"
 msgid "unable to get current working directory"
 msgstr "текущата работна директория е недостъпна"
 
+msgid "unable to get random bytes"
+msgstr "не може да се получат случайни байтове"
+
 msgid "Unmerged paths:"
 msgstr "Неслети пътища:"
 
@@ -22851,6 +23284,10 @@ msgstr "освен това в индекса има неподадени про
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "не може да извършите „%s“, защото в индекса има неподадени промѐни."
 
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "непознат стил „%s“ за „%s“"
+
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
 "merge"
@@ -23043,14 +23480,14 @@ msgstr ""
 "\n"
 "Изтрийте всичко, ако не искате да изпратите обобщаващо писмо.\n"
 
-#, perl-format
-msgid "Failed to open %s: %s"
-msgstr "„%s“ не може да се отвори: %s"
-
 #, perl-format
 msgid "Failed to open %s.final: %s"
 msgstr "„%s.final“ не може да се отвори: %s"
 
+#, perl-format
+msgid "Failed to open %s: %s"
+msgstr "„%s“ не може да се отвори: %s"
+
 msgid "Summary email is empty, skipping it\n"
 msgstr "Обобщаващото писмо е празно и се прескача\n"
 
index 6d64d7259a093df6e136ecf5ac27d8d7d2c89bc8..bcb4da80fb9afe7ad62f65326ff6e0564c236550 100644 (file)
--- a/po/ca.po
+++ b/po/ca.po
@@ -1,7 +1,7 @@
 # Catalan translations for Git.
 # This file is distributed under the same license as the Git package.
 # Alex Henrie <alexhenrie24@gmail.com>, 2014-2016.
-# Jordi Mas i Hernàndez <jmas@softcatala.org>, 2016-2023
+# Jordi Mas i Hernàndez <jmas@softcatala.org>, 2016-2024
 #
 # Terminologia
 #
@@ -14,6 +14,7 @@
 #   bundle           |  farcell
 #   check out        |  agafar
 #   chunk            |  fragment
+#   commit           |  comissió
 #   cover letter     |  carta de presentació
 #   cruft            |  superflu
 #   delta            |  diferència
@@ -28,6 +29,7 @@
 #   hint             |  consell
 #   hook             |  lligam
 #   hunk             |  tros
+#   multi-pack-index |  índex multipaquet
 #   not supported    |  no està admès
 #   pull             |  baixar
 #   push             |  pujar
@@ -54,6 +56,7 @@
 #   Anglès           |  Català
 #   -----------------+---------------------------------
 #   blame            |  «blame»
+#   fanout           |  «fanout»
 #   HEAD             |  HEAD (f, la branca actual) - (no s'apostrofa)
 #   cherry pick      |  «cherry pick»
 #   promisor         |  «promisor»
 #
 # Criteris
 #   - Mantingueu en anglès les referències a seccions de la documentació, ja que no està traduïda.
-#   - Usem la convenció valenciana per a «per / per a», que inclou l'ús de «per a» davant d'infintiu
+#   - Usem la convenció valenciana per a «per / per a», que inclou l'ús de «per a» davant d'infinitiu
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: Git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-16 18:22+0200\n"
-"PO-Revision-Date: 2023-08-16 19:00-0600\n"
+"POT-Creation-Date: 2024-02-16 07:14+0100\n"
+"PO-Revision-Date: 2024-02-16 07:16+0100\n"
 "Last-Translator: Jordi Mas i Hernàndez <jmas@softcatala.org>\n"
 "Language-Team: Catalan\n"
 "Language: ca\n"
@@ -1501,6 +1504,10 @@ msgstr "l'opció «%s» requereix «%s»"
 msgid "Unexpected option --output"
 msgstr "Opció inesperada --output"
 
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "paràmetre extra de la línia d'ordres «%s»"
+
 #, c-format
 msgid "Unknown archive format '%s'"
 msgstr "Format d'arxiu desconegut «%s»"
@@ -1537,15 +1544,23 @@ msgstr "no es pot fer fstat gitattributes al fitxer «%s»"
 
 #, c-format
 msgid "ignoring overly large gitattributes file '%s'"
-msgstr "s'ignorarà el fitxer «%s» gitattributes per ser massa gran"
+msgstr "s'ignorarà el fitxer «%s» gitattributes per ser massa gran"
 
 #, c-format
 msgid "ignoring overly large gitattributes blob '%s'"
-msgstr "s'ignorarà el blob «%s» gitattributes per ser massa gran"
+msgstr "s'ignorarà el blob «%s» gitattributes per ser massa gran"
 
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "--attr-source incorrecte o GIT_ATTR_SOURCE"
 
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "no s'ha pogut fer «stat» a «%s»"
+
+#, c-format
+msgid "unable to read %s"
+msgstr "no s'ha pogut llegir %s"
+
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
 msgstr "Comentari amb cometes errònies en el fitxer «%s»: %s"
@@ -1835,8 +1850,8 @@ msgid "submodule '%s': cannot create branch '%s'"
 msgstr "submòdul «%s»: no es pot crear la branca: «%s»"
 
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "«%s» ja s'ha agafat a «%s»"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "«%s» ja s'utilitza en l'arbre de treball a «%s»"
 
 msgid "git add [<options>] [--] <pathspec>..."
 msgstr "git add [<opcions>] [--] <especificació-de-camí>..."
@@ -1855,25 +1870,22 @@ msgstr ""
 "s'ha eliminat la configuració add.interactive.useBuiltin\n"
 "Per a més detalls, vegeu la seva entrada a «git help config»."
 
-msgid "Could not read the index"
-msgstr "No s'ha pogut llegir l'índex"
-
-msgid "Could not write patch"
-msgstr "No s'ha pogut escriure el pedaç"
+msgid "could not read the index"
+msgstr "no s'ha pogut llegir l'índex"
 
 msgid "editing patch failed"
 msgstr "l'edició del pedaç ha fallat"
 
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "No s'ha pogut fer stat a «%s»"
+msgid "could not stat '%s'"
+msgstr "no s'ha pogut fer stat a «%s»"
 
-msgid "Empty patch. Aborted."
-msgstr "El pedaç és buit. S'ha avortat."
+msgid "empty patch. aborted"
+msgstr "pedaç buit. interromput"
 
 #, c-format
-msgid "Could not apply '%s'"
-msgstr "No s'ha pogut aplicar «%s»"
+msgid "could not apply '%s'"
+msgstr "no s'ha pogut aplicar «%s»"
 
 msgid "The following paths are ignored by one of your .gitignore files:\n"
 msgstr ""
@@ -2002,6 +2014,9 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "fitxer d'índex malmès"
 
+msgid "unable to write new index file"
+msgstr "no s'ha pogut escriure un fitxer d'índex nou"
+
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "acció «%s» incorrecta per a «%s»"
@@ -2210,9 +2225,6 @@ msgstr ""
 "Podeu executar «git rm» en un fitxer per a acceptar «suprimit per ells» pel "
 "fitxer."
 
-msgid "unable to write new index file"
-msgstr "no s'ha pogut escriure un fitxer d'índex nou"
-
 #, c-format
 msgid "Could not parse object '%s'."
 msgstr "No s'ha pogut analitzar l'objecte «%s»."
@@ -2231,10 +2243,6 @@ msgstr ""
 msgid "failed to read '%s'"
 msgstr "s'ha produït un error en llegir «%s»"
 
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "les opcions «%s=%s» i «%s=%s» no es poden usar juntes"
-
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<opcions>] [(<bústia> | <directori-de-correu>)...]"
 
@@ -2387,10 +2395,10 @@ msgid "git archive: expected a flush"
 msgstr "git archive: s'esperava una neteja"
 
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 
 msgid "git bisect (good|bad) [<rev>...]"
@@ -2405,8 +2413,8 @@ msgstr "git bisect reset [<comissió>]"
 msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <logfile>"
 
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <ordre>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <cmd> [<arg>...]"
 
 #, c-format
 msgid "cannot open file '%s' in mode '%s'"
@@ -2834,46 +2842,45 @@ msgstr "git branch [<opcions>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
-"s'està suprimint la branca «%s» que s'ha\n"
-"         fusionat a «%s», però encara no\n"
-"         s'ha fusionat a HEAD."
+"s'està suprimint la branca «%s» que s'ha fusionat a\n"
+"         «%s», però encara no s'ha fusionat a HEAD"
 
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
-"no s'està suprimint la branca «%s» que encara no\n"
-"         s'ha fusionat a «%s», encara que està\n"
-"         fusionada a HEAD."
+"no s'està suprimint la branca «%s» que encara no s'ha fusionat a\n"
+"         «%s», encara que s'hagi fusionat a HEAD"
 
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
-msgstr "No s'ha pogut trobar l'objecte de comissió de «%s»"
+msgid "couldn't look up commit object for '%s'"
+msgstr "no s'ha pogut cercar l'objecte de comissió per a «%s»"
 
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
-msgstr ""
-"La branca «%s» no està totalment fusionada.\n"
-"Si esteu segur que la voleu suprimir, executeu «git branch -D %s»."
+msgid "the branch '%s' is not fully merged"
+msgstr "la branca «%s» no està completament fusionada"
+
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
+msgstr "Si esteu segur que voleu suprimir-la, executeu «git branch -D %s»"
 
-msgid "Update of config-file failed"
-msgstr "L'actualització del fitxer de configuració ha fallat"
+msgid "update of config-file failed"
+msgstr "ha fallat l'actualització del fitxer de configuració"
 
 msgid "cannot use -a with -d"
 msgstr "no es pot usar -a amb -d"
 
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "No es pot suprimir la branca «%s» agafada a «%s»"
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr ""
+"no es pot suprimir la branca «%s» utilitzada per l'arbre de treball a «%s»"
 
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "no s'ha trobat la branca amb seguiment remot «%s»."
+msgid "remote-tracking branch '%s' not found"
+msgstr "no s'ha trobat la branca de seguiment remot «%s»"
 
 #, c-format
 msgid ""
@@ -2884,8 +2891,8 @@ msgstr ""
 "Us heu oblidat de --remote?"
 
 #, c-format
-msgid "branch '%s' not found."
-msgstr "no s'ha trobat la branca «%s»."
+msgid "branch '%s' not found"
+msgstr "no s'ha trobat la branca «%s»"
 
 #, c-format
 msgid "Deleted remote-tracking branch %s (was %s).\n"
@@ -2906,56 +2913,56 @@ msgid "HEAD (%s) points outside of refs/heads/"
 msgstr "HEAD (%s) apunta fora de refs/heads/"
 
 #, c-format
-msgid "Branch %s is being rebased at %s"
-msgstr "S'està fent «rebase» en la branca %s a %s"
+msgid "branch %s is being rebased at %s"
+msgstr "a la branca %s se li està fent a «rebase» a %s"
 
 #, c-format
-msgid "Branch %s is being bisected at %s"
-msgstr "La branca %s s'està bisecant a %s"
+msgid "branch %s is being bisected at %s"
+msgstr "la branca %s s'està bisecant a %s"
 
 #, c-format
 msgid "HEAD of working tree %s is not updated"
 msgstr "HEAD de l'arbre de treball %s no està actualitzat"
 
 #, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Nom de branca no vàlid: «%s»"
+msgid "invalid branch name: '%s'"
+msgstr "el nom de la branca no és vàlid: «%s»"
 
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Encara no hi ha cap comissió en la branca «%s»."
+msgid "no commit on branch '%s' yet"
+msgstr "encara no hi ha cap comissió a la branca «%s»"
 
 #, c-format
-msgid "No branch named '%s'."
-msgstr "No hi ha cap branca amb nom «%s»."
+msgid "no branch named '%s'"
+msgstr "no hi ha cap branca anomenada «%s»"
 
-msgid "Branch rename failed"
-msgstr "El canvi de nom de branca ha fallat"
+msgid "branch rename failed"
+msgstr "ha fallat el canvi de nom de la branca"
 
-msgid "Branch copy failed"
-msgstr "La còpia de la branca ha fallat"
+msgid "branch copy failed"
+msgstr "ha fallat la còpia de la branca"
 
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "S'ha creat una còpia d'una branca mal anomenada «%s»"
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "s'ha creat una còpia d'una branca mal anomenada «%s»"
 
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
-msgstr "S'ha canviat el nom de la branca mal anomenada «%s»"
+msgid "renamed a misnamed branch '%s' away"
+msgstr "s'ha canviat el nom d'una branca «%s» mal anomenada"
 
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "S'ha canviat el nom de la branca a %s, però HEAD no està actualitzat!"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "s'ha canviat el nom de la branca a %s, però HEAD no s'ha actualitzat"
 
-msgid "Branch is renamed, but update of config-file failed"
+msgid "branch is renamed, but update of config-file failed"
 msgstr ""
-"La branca està canviada de nom, però l'actualització del fitxer de "
-"configuració ha fallat"
+"s'ha canviat el nom de la branca, però ha fallat l'actualització del fitxer "
+"de configuració"
 
-msgid "Branch is copied, but update of config-file failed"
+msgid "branch is copied, but update of config-file failed"
 msgstr ""
-"La branca està copiada, però l'actualització del fitxer de configuració ha "
-"fallat"
+"s'ha copiat la branca, però ha fallat l'actualització del fitxer de "
+"configuració"
 
 #, c-format
 msgid ""
@@ -3069,8 +3076,8 @@ msgstr "inclou recursivament els submòduls"
 msgid "format to use for the output"
 msgstr "format a usar en la sortida"
 
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "S'ha produït un error en resoldre HEAD com a referència vàlida."
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "no s'ha pogut resoldre HEAD com a referència vàlida"
 
 msgid "HEAD not found below refs/heads!"
 msgstr "HEAD no trobat sota refs/heads!"
@@ -3088,17 +3095,18 @@ msgstr "--recurse-submodules només es pot utilitzar per a crear branques"
 msgid "branch name required"
 msgstr "cal el nom de branca"
 
-msgid "Cannot give description to detached HEAD"
-msgstr "No es pot donar descripció a una HEAD separada"
+msgid "cannot give description to detached HEAD"
+msgstr "no s'ha pogut donar la descripció al HEAD separat"
 
 msgid "cannot edit description of more than one branch"
 msgstr "no es pot editar la descripció de més d'una branca"
 
-msgid "cannot copy the current branch while not on any."
-msgstr "no es pot copiar branca actual mentre no s'és a cap."
+msgid "cannot copy the current branch while not on any"
+msgstr "no es pot copiar la branca actual mentre no pertanyi a cap"
 
-msgid "cannot rename the current branch while not on any."
-msgstr "no es pot canviar el nom de la branca actual mentre no s'és a cap."
+msgid "cannot rename the current branch while not on any"
+msgstr ""
+"no s'ha pogut canviar el nom de la branca actual mentre no pertanyi a cap"
 
 msgid "too many branches for a copy operation"
 msgstr "hi ha massa branques per a una operació de còpia"
@@ -3111,9 +3119,9 @@ msgstr "hi ha massa arguments per a establir una nova font"
 
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
-"no s'ha pogut establir la font de HEAD com a %s quan no assenyala cap branca."
+"no s'ha pogut configurar la font de HEAD a %s quan no apunta a cap branca"
 
 #, c-format
 msgid "no such branch '%s'"
@@ -3126,27 +3134,26 @@ msgstr "la branca «%s» no existeix"
 msgid "too many arguments to unset upstream"
 msgstr "hi ha massa arguments per a desassignar la font"
 
-msgid "could not unset upstream of HEAD when it does not point to any branch."
-msgstr ""
-"no s'ha pogut desassignar la font de HEAD perquè no assenyala cap branca."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
+msgstr "no s'ha pogut desassignar la font del HEAD quan no apunta a cap branca"
 
 #, c-format
-msgid "Branch '%s' has no upstream information"
-msgstr "La branca «%s» no té informació de font"
+msgid "branch '%s' has no upstream information"
+msgstr "la branca «%s» no té informació de la font"
 
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
-"Les opcions -a i -r a «git branch» no prenen un nom de branca.\n"
-"Volíeu usar -a|-r --list <patró>?"
+"les opcions -a, i -r, a «git branch» no prenen un nom de branca.\n"
+"Volíeu utilitzar: -a|-r --list <patró>?"
 
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
-"l'opció --set-upstream ja no s'admet. En lloc seu, useu «--track» o «--set-"
-"upstream-to»."
+"l'opció «--set-upstream» ja no és admesa. Utilitzeu en comptes «--track» o "
+"«--set-upstream-to»"
 
 msgid "git version:\n"
 msgstr "versió de git:\n"
@@ -3219,6 +3226,10 @@ msgstr "especifiqueu una destinació per al fitxer de l'informe d'error"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "especifiqueu un sufix en format strftime per al nom de fitxer"
 
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "argument desconegut «%s»"
+
 #, c-format
 msgid "could not create leading directories for '%s'"
 msgstr "no s'han pogut crear els directoris principals de «%s»"
@@ -3325,6 +3336,13 @@ msgstr "git cat-file (-e | -p) <objecte>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <objecte>"
 
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
 "objects]\n"
@@ -3336,13 +3354,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-
 msgid "Check object existence or emit object contents"
 msgstr "Comprova l'existència de l'objecte o emet el contingut de l'objecte"
 
@@ -3639,6 +3650,10 @@ msgstr "«%s» s'ha d'utilitzar quan no s'especifica «%s»"
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "«%s» o «%s» no poden utilitzar-se amb %s"
 
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr "«%s», «%s» o «%s» no es poden utilitzar en agafar un arbre"
+
 #, c-format
 msgid "path '%s' is unmerged"
 msgstr "el camí «%s» està sense fusionar"
@@ -3891,8 +3906,8 @@ msgstr "agafa a la força (descarta qualsevol modificació local)"
 msgid "new-branch"
 msgstr "branca-nova"
 
-msgid "new unparented branch"
-msgstr "branca òrfena nova"
+msgid "new unborn branch"
+msgstr "branca no nascuda nova"
 
 msgid "update ignored files (default)"
 msgstr "actualitza els fitxers ignorats (per defecte)"
@@ -4144,9 +4159,6 @@ msgstr ""
 "clean.requireForce és per defecte cert i ni -i, -n ni -f s'han indicat; "
 "refusant netejar"
 
-msgid "-x and -X cannot be used together"
-msgstr "-x i -X no es poden usar junts"
-
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<opcions>] [--] <repositori> [<directori>]"
 
@@ -4235,6 +4247,9 @@ msgstr "directori de git"
 msgid "separate git dir from working tree"
 msgstr "separa el directori de git de l'arbre de treball"
 
+msgid "specify the reference format to use"
+msgstr "especifiqueu el format de referència a usar"
+
 msgid "key=value"
 msgstr "clau=valor"
 
@@ -4354,11 +4369,9 @@ msgstr "Hi ha massa arguments."
 msgid "You must specify a repository to clone."
 msgstr "Heu d'especificar un repositori per a clonar."
 
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"--bundle-uri és incompatible amb --depth, --shallow-since i --shallow-exclude"
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "el format d'emmagatzematge de referència «%s» és desconegut"
 
 #, c-format
 msgid "repository '%s' does not exist"
@@ -4488,14 +4501,14 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <dir>] [--append]\n"
 "                       [--split[=<strategy>]] [--reachable | --stdin-packs | "
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 
 msgid "dir"
 msgstr "directori"
@@ -4511,6 +4524,10 @@ msgstr ""
 msgid "Could not open commit-graph '%s'"
 msgstr "No s'ha pogut obrir el graf de comissions «%s»"
 
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "no s'ha pogut obrir la cadena «%s» del graf de comissions"
+
 #, c-format
 msgid "unrecognized --split argument, %s"
 msgstr "argument --split no reconegut, %s"
@@ -4709,9 +4726,6 @@ msgstr "no s'ha pogut actualitzar l'índex temporal"
 msgid "Failed to update main cache tree"
 msgstr "S'ha produït un error en actualitzar l'arbre principal de memòria cau"
 
-msgid "unable to write new_index file"
-msgstr "no s'ha pogut escriure el fitxer new_index"
-
 msgid "cannot do a partial commit during a merge."
 msgstr "no es pot fer una comissió parcial durant una fusió."
 
@@ -5114,13 +5128,13 @@ msgstr ""
 
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
 "s'ha actualitzat el repositori, però no s'ha pogut escriure\n"
-" el fitxer «new_index». Comproveu que el disc no està ple i\n"
-"que la quota no s'ha excedit, i després, feu\n"
-"«git restore --staged :/» per a recuperar-lo."
+"el fitxer d'índex nou. Comproveu que el disc no està ple i\n"
+"la quota no s'ha excedit, i després feu «git restore --staged :/n»\n"
+"per a recuperar-ho."
 
 msgid "git config [<options>]"
 msgstr "git config [<opcions>]"
@@ -5551,7 +5565,7 @@ msgstr "No s'ha trobat cap nom, no es pot descriure res."
 
 #, c-format
 msgid "option '%s' and commit-ishes cannot be used together"
-msgstr "les opcions «%s» i de comissió no es poden usar juntes"
+msgstr "opció «%s» i les de comissió no es poden usar juntes"
 
 msgid ""
 "git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
@@ -5716,7 +5730,7 @@ msgstr "selecciona la gestió de les etiquetes que etiquetin objectes filtrats"
 
 msgid "select handling of commit messages in an alternate encoding"
 msgstr ""
-"selecciona la gestió dels missatges de publicació en una codificació "
+"selecciona la gestió dels missatges de comissió en una codificació "
 "alternativa"
 
 msgid "dump marks to this file"
@@ -6585,6 +6599,9 @@ msgstr "poda objectes sense referència"
 msgid "pack unreferenced objects separately"
 msgstr "empaqueta els objectes no referenciats de forma separada"
 
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "amb --cruft, limiteu la mida dels paquets cruft nous"
+
 msgid "be more thorough (increased runtime)"
 msgstr "sigues més exhaustiu (el temps d'execució augmenta)"
 
@@ -6763,12 +6780,6 @@ msgstr ""
 msgid "'crontab' died"
 msgstr "«crontab» ha mort"
 
-msgid "failed to start systemctl"
-msgstr "s'ha produït un error en iniciar systemctl"
-
-msgid "failed to run systemctl"
-msgstr "s'ha produït un error en executar systemctl"
-
 #, c-format
 msgid "failed to delete '%s'"
 msgstr "s'ha produït un error en suprimir «%s»"
@@ -6777,6 +6788,12 @@ msgstr "s'ha produït un error en suprimir «%s»"
 msgid "failed to flush '%s'"
 msgstr "no s'ha pogut buidar «%s»"
 
+msgid "failed to start systemctl"
+msgstr "s'ha produït un error en iniciar systemctl"
+
+msgid "failed to run systemctl"
+msgstr "s'ha produït un error en executar systemctl"
+
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
 msgstr "l'argument --scheduler no reconegut «%s»"
@@ -6800,6 +6817,9 @@ msgstr "planificador"
 msgid "scheduler to trigger git maintenance run"
 msgstr "planificador per a activar l'execució de manteniment del git"
 
+msgid "failed to set up maintenance schedule"
+msgstr "no s'ha pogut configurar la planificació del manteniment"
+
 msgid "failed to add repo to global config"
 msgstr "no s'ha pogut afegir un repositori a la configuració global"
 
@@ -6830,6 +6850,10 @@ msgstr "no s'admeten fils, s'ignorarà %s"
 msgid "unable to read tree (%s)"
 msgstr "no s'ha pogut llegir l'arbre (%s)"
 
+#, c-format
+msgid "unable to read tree %s"
+msgstr "no s'ha pogut llegir l'arbre %s"
+
 #, c-format
 msgid "unable to grep from object of type %s"
 msgstr "no es pot fer grep des d'un objecte de tipus %s"
@@ -6874,8 +6898,8 @@ msgstr "processa els fitxers binaris amb filtres de textconv"
 msgid "search in subdirectories (default)"
 msgstr "cerca als subdirectoris (per defecte)"
 
-msgid "descend at most <depth> levels"
-msgstr "descendeix com a màxim <profunditat> nivells"
+msgid "descend at most <n> levels"
+msgstr "descendeix com a màxim <n> nivells"
 
 msgid "use extended POSIX regular expressions"
 msgstr "usa les expressions regulars POSIX ampliades"
@@ -7248,10 +7272,6 @@ msgstr "hi ha una inconsistència seriosa d'inflació"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "S'HA TROBAT UNA COL·LISIÓ SHA1 AMB %s !"
 
-#, c-format
-msgid "unable to read %s"
-msgstr "no s'ha pogut llegir %s"
-
 #, c-format
 msgid "cannot read existing object info %s"
 msgstr "no es pot llegir la informació d'objecte existent %s"
@@ -7392,11 +7412,13 @@ msgstr "error fsck als objectes del paquet"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 
@@ -7441,12 +7463,12 @@ msgstr "--separate-git-dir és incompatible amb un repositori nu"
 
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
-"                       [--parse] [<fitxer>...]"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
+"                       [--parse] [<file>...]"
 
 msgid "edit files in place"
 msgstr "edita els fitxers in situ"
@@ -7454,6 +7476,9 @@ msgstr "edita els fitxers in situ"
 msgid "trim empty trailers"
 msgstr "escurça els remolcs buits"
 
+msgid "placement"
+msgstr "posicionament"
+
 msgid "where to place the new trailer"
 msgstr "on ubicar el «trailer» nou"
 
@@ -7466,17 +7491,18 @@ msgstr "acció si el «trailer» falta"
 msgid "output only the trailers"
 msgstr "mostra només els «trailer»"
 
-msgid "do not apply config rules"
-msgstr "no apliquis les regles de configuració"
+msgid "do not apply trailer.* configuration variables"
+msgstr "no apliquis les variables de configuració trailer.*"
 
-msgid "join whitespace-continued values"
-msgstr "uneix els valors continus amb espais en blanc"
+msgid "reformat multiline trailer values as single-line values"
+msgstr ""
+"reformata els valors del tràiler multilínia com a valors de línia única"
 
-msgid "set parsing options"
-msgstr "estableix les opcions d'anàlisi"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "àlies per a --only-trailers --only-input --unfold"
 
-msgid "do not treat --- specially"
-msgstr "no tractis --- especialment"
+msgid "do not treat \"---\" as the end of input"
+msgstr "no tractis «---» com el final de l'entrada"
 
 msgid "trailer(s) to add"
 msgstr "remolcs a afegir"
@@ -7565,6 +7591,10 @@ msgstr "necessita exactament un interval"
 msgid "not a range"
 msgstr "no és un interval"
 
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "no es pot llegir el fitxer de descripció de la branca «%s»"
+
 msgid "cover letter needs email format"
 msgstr "la carta de presentació necessita un format de correu electrònic"
 
@@ -7666,6 +7696,9 @@ msgstr ""
 "genera parts d'una carta de presentació basant-se en la descripció d'una "
 "branca"
 
+msgid "use branch description from file"
+msgstr "utilitza la descripció de la branca des del fitxer"
+
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "useu [<prefix>] en comptes de [PATCH]"
 
@@ -8101,9 +8134,18 @@ msgstr ""
 "git merge-file [<opcions>] [-L <nom1> [-L <original> [-L <nom2>]]] <fitxer1> "
 "<fitxer-original> <fitxer2>"
 
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"l'opció diff-algorithm accepta «myers», «minimal», «patience» i «histogram»"
+
 msgid "send results to standard output"
 msgstr "envia els resultats a la sortida estàndard"
 
+msgid "use object IDs instead of filenames"
+msgstr "utilitza els ID dels objectes en comptes dels noms de fitxer"
+
 msgid "use a diff3 based merge"
 msgstr "usa una fusió basada en diff3"
 
@@ -8119,6 +8161,12 @@ msgstr "en conflictes, usa la seva versió"
 msgid "for conflicts, use a union version"
 msgstr "en conflictes, usa una versió d'unió"
 
+msgid "<algorithm>"
+msgstr "<algorisme>"
+
+msgid "choose a diff algorithm"
+msgstr "trieu un algorisme per al diff"
+
 msgid "for conflicts, use this marker size"
 msgstr "en conflictes, usa aquesta mida de marcador"
 
@@ -8128,6 +8176,13 @@ msgstr "no avisis de conflictes"
 msgid "set labels for file1/orig-file/file2"
 msgstr "estableix les etiquetes per a fitxer1/fitxer-original/fitxer2"
 
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "l'objecte «%s» no existeix"
+
+msgid "Could not write object file"
+msgstr "No s'ha pogut escriure el fitxer de l'objecte"
+
 #, c-format
 msgid "unknown option %s"
 msgstr "opció desconeguda %s"
@@ -8189,11 +8244,18 @@ msgstr "realitza múltiples fusions, una per línia d'entrada"
 msgid "specify a merge-base for the merge"
 msgstr "cal especificar una referència base per a la fusió"
 
+msgid "option=value"
+msgstr "opció=valor"
+
+msgid "option for selected merge strategy"
+msgstr "opció per a l'estratègia de fusió seleccionada"
+
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge és incompatible amb totes les altres opcions"
 
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base és incompatible amb --stdin"
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "opció d'estratègia desconeguda: -X%s"
 
 #, c-format
 msgid "malformed input line: '%s'."
@@ -8263,12 +8325,6 @@ msgstr "estratègia"
 msgid "merge strategy to use"
 msgstr "estratègia de fusió a usar"
 
-msgid "option=value"
-msgstr "opció=valor"
-
-msgid "option for selected merge strategy"
-msgstr "opció per a l'estratègia de fusió seleccionada"
-
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr "missatge de comissió de fusió (per a una fusió no d'avanç ràpid)"
 
@@ -8328,10 +8384,6 @@ msgstr "No s'ha pogut escriure l'índex."
 msgid "Not handling anything other than two heads merge."
 msgstr "No s'està gestionant res a part de la fusió de dos caps."
 
-#, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "opció d'estratègia desconeguda: -X%s"
-
 #, c-format
 msgid "unable to write %s"
 msgstr "no s'ha pogut escriure %s"
@@ -8631,8 +8683,8 @@ msgstr "el destí existeix"
 msgid "can not move directory into itself"
 msgstr "no es pot moure un directori a dins d'ell mateix"
 
-msgid "cannot move directory over file"
-msgstr "no es pot moure un directori sobre un fitxer"
+msgid "destination already exists"
+msgstr "la destinació ja existeix"
 
 msgid "source directory is empty"
 msgstr "el directori d'origen està buit"
@@ -9147,6 +9199,10 @@ msgstr "S'estan comprimint els objectes"
 msgid "inconsistency with delta count"
 msgstr "inconsistència amb el comptador de diferències"
 
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "valor pack.allowPackReuse value no vàlid: «%s»"
+
 #, c-format
 msgid ""
 "value of uploadpack.blobpackfileuri must be of the form '<object-hash> <pack-"
@@ -9394,9 +9450,6 @@ msgstr "el límit mínim de mida del paquet és 1 MiB"
 msgid "--thin cannot be used to build an indexable pack"
 msgstr "--thin no es pot utilitzar per a construir un paquet indexable"
 
-msgid "cannot use --filter without --stdout"
-msgstr "no es pot utilitzar --filter sense --stdout"
-
 msgid "cannot use --filter with --stdin-packs"
 msgstr "no es pot utilitzar --filter sense --stdin-packs"
 
@@ -9409,19 +9462,16 @@ msgstr "no es pot utilitzar la llista de revisió interna amb --cruft"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "no es pot --stdin-packs amb --cruft"
 
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "no es pot usar --max-pack-size amb --cruft"
-
 msgid "Enumerating objects"
 msgstr "S'estan enumerant els objectes"
 
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Total %<PRIu32> (%<PRIu32> diferències), reusats %<PRIu32> (%<PRIu32> "
-"diferències), paquets reusats %<PRIu32>"
+"diferències), paquets reusats %<PRIu32> (de %<PRIuMAX>)"
 
 msgid ""
 "'git pack-redundant' is nominated for removal.\n"
@@ -10385,16 +10435,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "«switch» «c» espera un valor numèric"
 
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy requereix --merge o --interactive"
-
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"les opcions «apply» són incompatibles amb rebase.autoSquash. Considereu "
-"afegir-hi --no-autosquash"
-
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
 "no-rebase-merges"
@@ -11106,6 +11146,10 @@ msgstr ""
 msgid "could not remove stale bitmap: %s"
 msgstr "no s'ha pogut eliminar el mapa de bits estancat: %s"
 
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "el prefix de paquet %s no comença amb objdir %s"
+
 msgid "pack everything in a single pack"
 msgstr "empaqueta-ho tot en un únic paquet"
 
@@ -11186,16 +11230,21 @@ msgid "pack prefix to store a pack containing pruned objects"
 msgstr ""
 "prefix del paquet per a emmagatzemar un paquet que contingui objectes podats"
 
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr ""
+"prefix del paquet per a emmagatzemar un paquet que contingui objectes "
+"filtrats"
+
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "no es poden suprimir paquets en un repositori d'objectes preciosos"
 
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "l'opció «%s» només es pot utilitzar juntament amb «%s»"
+
 msgid "Nothing new to pack."
 msgstr "Res nou a empaquetar."
 
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "el prefix de paquet %s no comença amb objdir %s"
-
 #, c-format
 msgid "renaming pack to '%s' failed"
 msgstr "el canvi del nom a «%s» ha fallat"
@@ -11397,6 +11446,77 @@ msgstr "--convert-graft-file arguments"
 msgid "only one pattern can be given with -l"
 msgstr "només es pot especificar un patró amb -l"
 
+msgid "need some commits to replay"
+msgstr "calen algunes comissions per tornar a reproduir"
+
+msgid "--onto and --advance are incompatible"
+msgstr "--onto i --advance són incompatibles"
+
+msgid "all positive revisions given must be references"
+msgstr "totes les revisions positives que s'han donat han de ser referències"
+
+msgid "argument to --advance must be a reference"
+msgstr "l'argument per a --advance ha de ser una referència"
+
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"no es pot avançar l'objectiu amb múltiples fonts perquè l'ordenació no "
+"estaria definida correctament"
+
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr ""
+"no es pot determinar implícitament si aquesta és una operació --advance o --"
+"onto"
+
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"no es pot avançar l'objectiu amb múltiples branques d'origen perquè "
+"l'ordenació no estaria definida correctament"
+
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "no es pot determinar implícitament la base correcta per a --onto"
+
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+
+msgid "make replay advance given branch"
+msgstr "fes avançar la repetició de la branca donada"
+
+msgid "replay onto given commit"
+msgstr "torna a reproduir a la comissió donada"
+
+msgid "advance all branches contained in revision-range"
+msgstr "avança totes les branques contingudes a l'interval de revisions"
+
+msgid "option --onto or --advance is mandatory"
+msgstr "l'opció --onto o --advance és obligatòria"
+
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"algunes opcions de referència se sobreescriuran de forma forçada com a «%s» "
+"bits a «struct rev_info»"
+
+msgid "error preparing revisions"
+msgstr "s'ha produït un error en preparar les revisions"
+
+msgid "replaying down to root commit is not supported yet!"
+msgstr "encara no s'admet la reproducció cap avall en una comissió arrel"
+
+msgid "replaying merge commits is not supported yet!"
+msgstr "encara no s'admet la repetició de les comissió de fusió"
+
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
 msgstr ""
@@ -11605,18 +11725,12 @@ msgstr "--prefix requereix un argument"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "mode desconegut per a --abbrev-ref: %s"
 
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden no es pot utilitzar juntament amb --branches"
-
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden no es pot utilitzar juntament amb --tags"
-
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden no es pot utilitzar juntament amb --remotes"
-
 msgid "this operation must be run in a work tree"
 msgstr "aquesta operació s'ha d'executar en un arbre de treball"
 
+msgid "Could not read the index"
+msgstr "No s'ha pogut llegir l'índex"
+
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
 msgstr "mode desconegut per a --show-object-format: %s"
@@ -11962,23 +12076,44 @@ msgid "Unknown hash algorithm"
 msgstr "Algorisme de resum desconegut"
 
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
-"             [--heads] [--] [<patró>...]"
+"             [--heads] [--] [<pattern>...]"
+
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
 
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<patró>]"
 
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <ref>"
+
+msgid "reference does not exist"
+msgstr "la referència no existeix"
+
+msgid "failed to look up reference"
+msgstr "s'ha produït en cercar la referència"
+
 msgid "only show tags (can be combined with heads)"
 msgstr "mostra només les etiquetes (es pot combinar amb heads)"
 
 msgid "only show heads (can be combined with tags)"
 msgstr "mostra només els caps (es pot combinar amb tags)"
 
+msgid "check for reference existence without resolving"
+msgstr "comprova l'existència de referència sense resoldre"
+
 msgid "stricter reference checking, requires exact ref path"
 msgstr ""
 "comprovació de referència més estricta, requereix el camí de referència "
@@ -12808,6 +12943,9 @@ msgstr ""
 "shallow] [--reference <repository>] [--recursive] [--[no-]single-branch] "
 "[--] [<camí>...]"
 
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "S'ha produït un error en resoldre HEAD com a referència vàlida."
+
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<opcions>] [<camí>...]"
 
@@ -13282,6 +13420,9 @@ msgstr "(per a porcellanes) oblida't dels conflictes no resolts ni desats"
 msgid "write index in this format"
 msgstr "escriu l'índex en aquest format"
 
+msgid "report on-disk index format version"
+msgstr "informa sobre la versió del format de l'índex del disc"
+
 msgid "enable or disable split index"
 msgstr "habilita o inhabilita l'índex dividit"
 
@@ -13306,6 +13447,14 @@ msgstr "marca els fitxers com a vàlids pel fsmonitor"
 msgid "clear fsmonitor valid bit"
 msgstr "esborra el bit de validesa del fsmonitor"
 
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "index-version: era %d, s'ha establert a %d"
+
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
 "enable split index"
@@ -13460,28 +13609,28 @@ msgstr "No hi ha cap branca d'origen possible, inferint «--orphan»"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
-"Si voleu crear un arbre de treball que contingui una branca orfe nova\n"
-"(branca sense comissions) per a aquest repositori, podeu fer-ho\n"
+"Si voleu crear un arbre de treball que contingui una branca no nascuda\n"
+"nova (branca sense comissions) per a aquest repositori, podeu fer-ho\n"
 "utilitzant l'argument --orphan:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
-"Si voleu crear un arbre de treball que contingui una branca orfe nova\n"
-"(branca sense comissions) per a aquest repositori, podeu fer-ho\n"
+"Si voleu crear un arbre de treball que contingui una branca no nascuda\n"
+"nova (branca sense comissions) per a aquest repositori, podeu fer-ho\n"
 "utilitzant l'argument --orphan:\n"
 "\n"
 "    git worktree add --orphan %s\n"
@@ -13543,6 +13692,10 @@ msgstr "no s'ha pogut crear directori de «%s»"
 msgid "initializing"
 msgstr "s'està inicialitzant"
 
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "no s'ha pogut trobar l'arbre de treball creat «%s»"
+
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
 msgstr "S'està preparant l'arbre de treball (branca nova «%s»)"
@@ -13577,14 +13730,10 @@ msgstr ""
 
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
-"No hi ha referències locals o remotes malgrat que hi existeix almenys un\n"
-"remot, aturat; useu «add -f» per a forcar-ho o obtenir primer un remot"
-
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "les opcions «%s» i «%s» no es poden usar juntes"
+"No hi ha referències locals o remotes malgrat hi existeix almenys un\n"
+"remot, aturada; useu «add -f» per a anul·lar o obtenir primer un remot"
 
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr "agafa <branca> encara que sigui agafada en altre arbre de treball"
@@ -13595,8 +13744,8 @@ msgstr "crea una branca nova"
 msgid "create or reset a branch"
 msgstr "crea o restableix una branca"
 
-msgid "create unborn/orphaned branch"
-msgstr "crea una branca no nascuda/òrfena"
+msgid "create unborn branch"
+msgstr "crea una branca no nascuda"
 
 msgid "populate the new working tree"
 msgstr "emplena l'arbre de treball nou"
@@ -13620,11 +13769,8 @@ msgid "options '%s', '%s', and '%s' cannot be used together"
 msgstr "les opcions «%s», «%s», i «%s» no es poden usar juntes"
 
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "les opcions «%s» i «%s» no es poden usar juntes"
-
-msgid "<commit-ish>"
-msgstr "<commit-ish>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "opció «%s» i les de comissió no es poden usar juntes"
 
 msgid "added with --lock"
 msgstr "afegit amb --lock"
@@ -13900,6 +14046,10 @@ msgid "terminating chunk id appears earlier than expected"
 msgstr ""
 "l'identificador de fragment de finalització apareix abans del que s'esperava"
 
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "ID del fragment %<PRIx32> no alineat %d-byte"
+
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
 msgstr "desplaçament incorrecte del fragment %<PRIx64> i %<PRIx64>"
@@ -13954,10 +14104,8 @@ msgstr "Recopila la informació per a l'usuari per a enviar un informe d'error"
 msgid "Move objects and refs by archive"
 msgstr "Mou els objectes i les referències per arxiu"
 
-msgid "Provide content or type and size information for repository objects"
-msgstr ""
-"Proveeix contingut o informació del tipus i mida per als objectes del "
-"repositori"
+msgid "Provide contents or details of repository objects"
+msgstr "Proporcioneu el contingut o els detalls dels objectes del repositori"
 
 msgid "Display gitattributes information"
 msgstr "Mostra la informació de .gitattributes"
@@ -14185,7 +14333,7 @@ msgid "Build a tree-object from ls-tree formatted text"
 msgstr "Construeix un objecte en arbre a partir de text formatat amb ls-tree"
 
 msgid "Write and verify multi-pack-indexes"
-msgstr "Escriu i verifica els índexs dels paquets multipaquet"
+msgstr "Escriu i verifica els índexs multipaquet"
 
 msgid "Move or rename a file, a directory, or a symlink"
 msgstr "Mou o canvia de nom a un fitxer, directori o enllaç simbòlic"
@@ -14252,6 +14400,11 @@ msgstr "Empaqueta els objectes desempaquetats en un repositori"
 msgid "Create, list, delete refs to replace objects"
 msgstr "Crea, llista i esborra referències per a substituir objectes"
 
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"EXPERIMENTAL: torna a reproduir comissions sobre una nova base, també "
+"funciona amb repositoris nus"
+
 msgid "Generates a summary of pending changes"
 msgstr "Genera un resum dels canvis pendents"
 
@@ -14376,8 +14529,8 @@ msgstr "Verifica la signatura GPG de les etiquetes"
 msgid "Display version information about Git"
 msgstr "Mostra informació de la versió del Git"
 
-msgid "Show logs with difference each commit introduces"
-msgstr "Mostra registres amb la diferència introduïda per cada comissió"
+msgid "Show logs with differences each commit introduces"
+msgstr "Mostra els registres amb les diferències que introdueix cada comissió"
 
 msgid "Manage multiple working trees"
 msgstr "Gestiona múltiples arbres de treball"
@@ -14493,6 +14646,35 @@ msgstr "Una eina per a gestionar dipòsits Git grans"
 msgid "commit-graph file is too small"
 msgstr "el fitxer del graf de comissions és massa petit"
 
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr ""
+"el fragment de «fanout» de l'oid del graf de comissions és de mida incorrecta"
+
+msgid "commit-graph fanout values out of order"
+msgstr "valors de graf de comissions de «fanout» estan fora d'ordre"
+
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "el fragment de cerca OID és de mida incorrecta"
+
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "el fragment de dades del graf de comissions és de mida incorrecta"
+
+msgid "commit-graph generations chunk is wrong size"
+msgstr ""
+"el fragment de les generacions del graf de comissions és de mida incorrecta"
+
+msgid "commit-graph changed-path index chunk is too small"
+msgstr ""
+"el fragment d'índex del canvi del camí del graf de comissions és massa petit"
+
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"s'ignorarà un fragment massa petit de camí canviat (%<PRIuMAX> < %<PRIuMAX>) "
+"al fitxer del graf de comissions"
+
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
 msgstr ""
@@ -14512,9 +14694,26 @@ msgid "commit-graph file is too small to hold %u chunks"
 msgstr ""
 "el fitxer del graf de comissions és massa petit per a guardar %u fragments"
 
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr ""
+"manca o està malmès el fragment del «fanout» OID requerit al graf de "
+"comissions"
+
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr ""
+"manca o està malmès el fragment de cerca d'OID requerit al graf de comissions"
+
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr ""
+"manca o està corromput el fragment de dades de publicació requerit al graf "
+"de comissions"
+
 msgid "commit-graph has no base graphs chunk"
 msgstr "el fragment del graf de comissions no té grafs de base"
 
+msgid "commit-graph base graphs chunk is too small"
+msgstr "el fragment de grafs base de la gràfica de comissió és massa petit"
+
 msgid "commit-graph chain does not match"
 msgstr "la cadena del graf de comissions no coincideix"
 
@@ -14522,6 +14721,9 @@ msgstr "la cadena del graf de comissions no coincideix"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "el nombre de comissions en el graf base és massa alt: %<PRIuMAX>"
 
+msgid "commit-graph chain file too small"
+msgstr "el fitxer de cadena del graf de comissions és massa petit"
+
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
 msgstr ""
@@ -14544,6 +14746,14 @@ msgstr ""
 "el graf de comissions requereix dades de generació de desbordaments però no "
 "en té cap"
 
+msgid "commit-graph overflow generation data is too small"
+msgstr ""
+"les dades de generació de desbordament del graf de comissions són massa "
+"petites"
+
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "punter de vores extra del graf de comissió està fora dels límits"
+
 msgid "Loading known commits in commit graph"
 msgstr "S'estan carregant comissions conegudes al graf de comissions"
 
@@ -14684,20 +14894,6 @@ msgstr "el pare pel graf de comissions %s és %s != %s"
 msgid "commit-graph parent list for commit %s terminates early"
 msgstr "la llista pare del graf de comissions per %s acaba aviat"
 
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"el graf de comissions té nombre de generació zero per a la comissió %s, però "
-"té no zero en altres llocs"
-
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"el graf de comissions té un nombre de generació diferent de zero per a "
-"comissió %s però té zero en altres llocs"
-
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
 msgstr ""
@@ -14710,6 +14906,14 @@ msgstr ""
 "la data d'enviament per a la comissió %s en el graf de comissions és "
 "%<PRIuMAX> != %<PRIuMAX>"
 
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"El graf de comissió té tant generacions zero com no nul·les (p. ex., "
+"comissions «%s» i «%s»)"
+
 msgid "Verifying commits in commit graph"
 msgstr "S'estan verificant les comissions al graf de comissions"
 
@@ -14736,6 +14940,12 @@ msgstr ""
 "Desactiveu aquest missatge executant\n"
 "«git config advice.graftFileDeprecated false»"
 
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr ""
+"la comissió %s existeix al graf de comissions però no a la base de dades "
+"d'objectes"
+
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
 msgstr "La comissió %s té una signatura GPG no fiable, suposadament de %s."
@@ -14918,7 +15128,7 @@ msgid "Regular expression too big"
 msgstr "Expressió regular és massa gran"
 
 msgid "Unmatched ) or \\)"
-msgstr ") o \\) no no emparellat"
+msgstr ") o \\) no emparellat"
 
 msgid "No previous regular expression"
 msgstr "No hi ha expressió regular anterior"
@@ -15176,10 +15386,6 @@ msgstr "la referència «%s» no assenyala a un blob"
 msgid "unable to resolve config blob '%s'"
 msgstr "no s'ha pogut resoldre el blob de configuració: «%s»"
 
-#, c-format
-msgid "failed to parse %s"
-msgstr "s'ha produït un error en analitzar %s"
-
 msgid "unable to parse command-line config"
 msgstr "no s'ha pogut analitzar la configuració de la línia d'ordres"
 
@@ -15657,9 +15863,6 @@ msgstr "s'ha produït un error en escriure arxiu"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base no funciona amb intervals"
 
-msgid "--merge-base only works with commits"
-msgstr "--merge-base només funciona amb comissions"
-
 msgid "unable to get HEAD"
 msgstr "no s'ha pogut obtenir HEAD"
 
@@ -15723,6 +15926,10 @@ msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr ""
 "Valor desconegut de la variable de configuració de «diff.submodule»: «%s»"
 
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "valor desconegut per al config «%s»': %s"
+
 #, c-format
 msgid ""
 "Found errors in 'diff.dirstat' config variable:\n"
@@ -15800,12 +16007,6 @@ msgstr "argument --color-moved incorrecte: %s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "mode «%s» no vàlid en --color-moved-ws"
 
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"l'opció diff-algorithm accepta «myers», «minimal», «patience» i «histogram»"
-
 #, c-format
 msgid "invalid argument to %s"
 msgstr "argument no vàlid a %s"
@@ -15850,8 +16051,8 @@ msgstr "llegible per una màquina --stat"
 msgid "output only the last line of --stat"
 msgstr "mostra només l'última línia de --stat"
 
-msgid "<param1,param2>..."
-msgstr "<param1,param2>..."
+msgid "<param1>,<param2>..."
+msgstr "<param1>,<param2>..."
 
 msgid ""
 "output the distribution of relative amount of changes for each sub-directory"
@@ -15862,8 +16063,8 @@ msgstr ""
 msgid "synonym for --dirstat=cumulative"
 msgstr "sinònim de --dirstat=cumulative"
 
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "sinònim de --dirstat=files,param1,param2..."
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "sinònim de --dirstat=files,<param1>,<param2>..."
 
 msgid "warn if changes introduce conflict markers or whitespace errors"
 msgstr ""
@@ -16046,12 +16247,6 @@ msgstr "genera diff usant l'algorisme «patience diff»"
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "genera diff usant l'algorisme «histogram diff»"
 
-msgid "<algorithm>"
-msgstr "<algorisme>"
-
-msgid "choose a diff algorithm"
-msgstr "trieu un algorisme per al diff"
-
 msgid "<text>"
 msgstr "<text>"
 
@@ -17102,12 +17297,12 @@ msgstr ""
 "solucions possibles:\n"
 "%s"
 
-msgid "Failed to execute internal merge"
-msgstr "S'ha produït un error en executar la fusió interna"
+msgid "failed to execute internal merge"
+msgstr "no s'ha pogut executar la fusió interna"
 
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "No s'ha pogut afegir %s a la base de dades"
+msgid "unable to add %s to database"
+msgstr "no s'ha pogut afegir %s a la base de dades"
 
 #, c-format
 msgid "Auto-merging %s"
@@ -17556,7 +17751,21 @@ msgid "failed to read the cache"
 msgstr "s'ha produït un error en llegir la memòria cau"
 
 msgid "multi-pack-index OID fanout is of the wrong size"
-msgstr "l'OID de l'índex multipaquet és d'una mida incorrecta"
+msgstr "l'OID «fanout» de l'índex multipaquet és d'una mida incorrecta"
+
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"oid «fanout» desordenat: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "El fragment de cerca OID índex multipaquet és de mida incorrecta"
+
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr ""
+"el fragment de desplaçament de l'objecte índex multipaquet és d'una mida "
+"incorrecta"
 
 #, c-format
 msgid "multi-pack-index file %s is too small"
@@ -17577,17 +17786,28 @@ msgid "multi-pack-index hash version %u does not match version %u"
 msgstr ""
 "la versió del resum índex multipaquet %u no coincideix amb la versió %u"
 
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "falta un fragment de nom de paquet necessari al multi-index"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr ""
+"manca o està malmès el fragment del nom de paquet requerit de l'índex "
+"multipaquet"
 
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "falta un fragment «fanout» OID necessari al multi-pack-index"
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr ""
+"manca o està malmès el fragment del «fanout» OID requerit a l'índex "
+"multipaquet"
 
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "falta un fragment de cerca «fanout» OID necessari al multi-pack-index"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr ""
+"manca o està malmès el fragment de cerca d'OID necessari a l'índex "
+"multipaquet"
 
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "falta un fragment necessari dels desplaçaments al multi-pack-index"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr ""
+"manca o està malmès el fragment de l'índex multipaquet dels objectes "
+"requerits"
+
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "el fragment de nom de l'índex multipaquet és massa curt"
 
 #, c-format
 msgid "multi-pack-index pack names out of order: '%s' before '%s'"
@@ -17599,11 +17819,21 @@ msgstr ""
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "pack-int-id: %u incorrecte (%u paquets en total)"
 
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "MIDX no conté el fragment BTMP"
+
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "no s'ha pogut carregar el paquet amb bits %<PRIu32>"
+
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr ""
 "l'índex multipaquet emmagatzema un desplaçament de 64 bits, però off_t és "
 "massa petit"
 
+msgid "multi-pack-index large offset out of bounds"
+msgstr "desplaçament gran de l'índex multipaquet està fora dels límits"
+
 #, c-format
 msgid "failed to add packfile '%s'"
 msgstr "no s'ha pogut afegir el fitxer de paquet «%s»"
@@ -17684,11 +17914,6 @@ msgstr "suma de verificació incorrecta"
 msgid "Looking for referenced packfiles"
 msgstr "S'estan cercant fitxers empaquetats referenciats"
 
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr "oid fanout desordenat: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-
 msgid "the midx contains no oid"
 msgstr "el midx no conté cap oid"
 
@@ -18163,7 +18388,7 @@ msgid "hash mismatch %s"
 msgstr "el resum no coincideix %s"
 
 msgid "trying to write commit not in index"
-msgstr "s'està intentant no escriure la publicació a l'índex"
+msgstr "s'està intentant no escriure la comissió a l'índex"
 
 msgid "failed to load bitmap index (corrupted?)"
 msgstr ""
@@ -18220,6 +18445,9 @@ msgstr "falta l'índex invers necessari al mapa de bits multipaquet"
 msgid "could not open pack %s"
 msgstr "no s'ha pogut obrir el paquet %s"
 
+msgid "could not determine MIDX preferred pack"
+msgstr "no s'ha pogut determinar el paquet preferit MIDX"
+
 #, c-format
 msgid "preferred pack (%s) is invalid"
 msgstr "el paquet preferit (%s) no és vàlid"
@@ -18245,6 +18473,12 @@ msgstr ""
 "mapa de bits ewah malmès: capçalera truncada per al mapa de bits de la "
 "comissió «%s»"
 
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr ""
+"no s'ha pogut carregar el paquet: «%s», s'està inhabilitant lareutilització "
+"de paquets"
+
 #, c-format
 msgid "object '%s' not found in type bitmaps"
 msgstr "no s'ha trobat l'objecte «%s» als tipus de mapes de bits"
@@ -18334,6 +18568,13 @@ msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr ""
 "posició no vàlida de l'índex de reversió a %<PRIu64>: %<PRIu32> != %<PRIu32>"
 
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr ""
+"el fragment de l'index invers de l'índex multipaquet és de mida incorrecta"
+
+msgid "could not determine preferred pack"
+msgstr "no s'ha pogut determinar el paquet preferit"
+
 msgid "cannot both write and verify reverse index"
 msgstr "no es pot escriure i verificar l'índex invers"
 
@@ -18386,14 +18627,6 @@ msgstr "l'opció «%s» espera «%s» o «%s»"
 msgid "%s requires a value"
 msgstr "%s requereix un valor"
 
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s és incompatible amb %s"
-
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s: és incompatible amb alguna altra cosa"
-
 #, c-format
 msgid "%s takes no value"
 msgstr "%s no accepta cap valor"
@@ -18477,6 +18710,10 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-NUM"
 
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "oposat a --no-%s"
+
 msgid "expiry-date"
 msgstr "data-de-caducitat"
 
@@ -18507,6 +18744,14 @@ msgstr ""
 "amb --pathspec-from-file els elements d'especificació del camí estan "
 "separats amb el caràcter NUL"
 
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "el valor «%s» booleà de l'entorn és incorrecte per a «%s»"
+
+#, c-format
+msgid "failed to parse %s"
+msgstr "s'ha produït un error en analitzar %s"
+
 #, c-format
 msgid "Could not make %s writable by group"
 msgstr "No s'ha pogut fer %s escrivible pel grup"
@@ -18557,6 +18802,10 @@ msgstr "Màgia d'especificació de camí no implementada «%c» en «%s»"
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s: «literal» i «glob» són incompatibles"
 
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "«%s» és fora de l'arbre de directoris"
+
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
 msgstr "%s: «%s» està fora del repositori en «%s»"
@@ -18712,10 +18961,6 @@ msgstr "no es pot llegir indexar el fitxer «%s»"
 msgid "unable to add '%s' to index"
 msgstr "no s'ha pogut afegir «%s» a l'índex"
 
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "no s'ha pogut fer «stat» a «%s»"
-
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
 msgstr "«%s» apareix com a fitxer i com a directori"
@@ -18823,10 +19068,6 @@ msgstr "no es pot escriure l'índex dividit per a un índex dispers"
 msgid "failed to convert to a sparse-index"
 msgstr "s'ha produït un error en convertir a un índex dispers"
 
-#, c-format
-msgid "could not stat '%s'"
-msgstr "no s'ha pogut fer stat a «%s»"
-
 #, c-format
 msgid "unable to open git dir: %s"
 msgstr "no s'ha pogut obrir el directori git: %s"
@@ -19301,10 +19542,6 @@ msgstr "«%s» existeix; no es pot crear «%s»"
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "no es poden processar «%s» i «%s» a la vegada"
 
-#, c-format
-msgid "could not remove reference %s"
-msgstr "no s'ha pogut eliminar la referència %s"
-
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "no s'ha pogut suprimir la referència %s: %s"
@@ -19529,7 +19766,7 @@ msgid ""
 "'%s:refs/tags/%s'?"
 msgstr ""
 "La part <src> de l'especificació de la referència és un objecte d'etiqueta.\n"
-"Voleu crear una etiqueta pujant-la a «%srefs/tags/%s»?"
+"Voleu crear una etiqueta pujant-la a «%s:refs/tags/%s»?"
 
 #, c-format
 msgid ""
@@ -19538,7 +19775,7 @@ msgid ""
 "'%s:refs/tags/%s'?"
 msgstr ""
 "La part <src> de l'especificació de la referència és un objecte d'arbre.\n"
-"Voleu crear una etiqueta pujant-la a «%srefs/tags/%s»?"
+"Voleu crear una etiqueta pujant-la a «%s:refs/tags/%s»?"
 
 #, c-format
 msgid ""
@@ -19870,8 +20107,15 @@ msgstr "quan es clona, crear un directori de treball complet"
 msgid "only download metadata for the branch that will be checked out"
 msgstr "només baixa les metadades per a la branca que s'agafarà"
 
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<opcions>] [--] <repositori> [<dir>]"
+msgid "create repository within 'src' directory"
+msgstr "crea un repositori dins del directori «src»"
+
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
 
 #, c-format
 msgid "cannot deduce worktree name from '%s'"
@@ -19922,12 +20166,28 @@ msgid "could not remove stale scalar.repo '%s'"
 msgstr "no s'ha pogut suprimir el scalar.repo «%s» estancat"
 
 #, c-format
-msgid "removing stale scalar.repo '%s'"
-msgstr "s'està eliminant el scalar.repo «%s» estancat"
+msgid "removed stale scalar.repo '%s'"
+msgstr "s'ha eliminat l'scalar.repo estancat «%s»"
 
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "no existeix un repositori de git a: «%s»"
+msgid "repository at '%s' has different owner"
+msgstr "el dipòsit a «%s» té un propietari diferent"
+
+#, c-format
+msgid "repository at '%s' has a format issue"
+msgstr "el dipòsit a «%s» té un problema de format"
+
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "no s'ha trobat el dipòsit a «%s»"
+
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"per a desregistrar aquest dipòsit de l'escalar, executeu\n"
+"\tgit config --global --unset --fixed-value scalar.repo «%s»"
 
 msgid ""
 "scalar run <task> [<enlistment>]\n"
@@ -20334,10 +20594,6 @@ msgstr "no es pot obtenir el missatge de comissió de %s"
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s: no es pot analitzar la comissió pare %s"
 
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "no s'ha pogut canviar el nom «%s» a «%s»"
-
 #, c-format
 msgid "could not revert %s... %s"
 msgstr "no s'ha pogut revertir %s... %s"
@@ -20663,6 +20919,9 @@ msgid "Autostash exists; creating a new stash entry."
 msgstr ""
 "El «stash» automàtic ja existeix; s'està creant una entrada «stash» nova."
 
+msgid "autostash reference is a symref"
+msgstr "la referència d'autostash és un symref"
+
 msgid "could not detach HEAD"
 msgstr "no s'ha pogut separar HEAD"
 
@@ -20694,14 +20953,14 @@ msgstr ""
 "    git rebase --edit-todo\n"
 "    git rebase --continue\n"
 
-#, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "S'està fent «rebase» (%d/%d)%s"
-
 #, c-format
 msgid "Stopped at %s...  %.*s\n"
 msgstr "Aturat a %s...  %.*s\n"
 
+#, c-format
+msgid "Rebasing (%d/%d)%s"
+msgstr "S'està fent «rebase» (%d/%d)%s"
+
 #, c-format
 msgid "unknown command %d"
 msgstr "ordre %d desconeguda"
@@ -20906,7 +21165,8 @@ msgid ""
 "not a git repository (or any parent up to mount point %s)\n"
 "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)."
 msgstr ""
-"no és un repositori de git (ni cap pare fins al punt de muntatge %s)\n"
+"no és un repositori de git (ni existeix cap pare fins al punt de muntatge "
+"%s)\n"
 "S'atura a la frontera de sistema de fitxers (GIT_DISCOVERY_ACROSS_FILESYSTEM "
 "no està establert)."
 
@@ -20978,6 +21238,10 @@ msgstr "no s'estan copiant plantilles de «%s»: %s"
 msgid "invalid initial branch name: '%s'"
 msgstr "nom de branca inicial no vàlid: «%s»"
 
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "reinicialització: s'ha ignorat --initial-branch=%s"
+
 #, c-format
 msgid "unable to handle file type %d"
 msgstr "no s'ha pogut gestionar el tipus de fitxer %d"
@@ -20989,14 +21253,16 @@ msgstr "no s'ha pogut moure %s a %s"
 msgid "attempt to reinitialize repository with different hash"
 msgstr "s'ha intentat reinicialitzar el repositori amb un resum diferent"
 
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr ""
+"s'ha intentat reactivar el repositori amb un format d'emmagatzematge de "
+"referència diferent"
+
 #, c-format
 msgid "%s already exists"
 msgstr "%s ja existeix"
 
-#, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "reinicialització: s'ha ignorat --initial-branch=%s"
-
 #, c-format
 msgid "Reinitialized existing shared Git repository in %s%s\n"
 msgstr "S'ha reinicialitzat el repositori compartit existent del Git en %s%s\n"
@@ -21266,12 +21532,6 @@ msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr ""
 "nombre d'entrades a l'arbre de la memòria cau a invalidar (per defecte 0)"
 
-msgid "unhandled options"
-msgstr "opcions no gestionades"
-
-msgid "error preparing revisions"
-msgstr "s'ha produït un error en preparar les revisions"
-
 #, c-format
 msgid "commit %s is not marked reachable"
 msgstr "la comissió %s no està marcada com abastable"
@@ -21424,9 +21684,6 @@ msgstr "el protocol no permet establir el camí del servei remot"
 msgid "invalid remote service path"
 msgstr "el camí del servei remot no és vàlid"
 
-msgid "operation not supported by protocol"
-msgstr "opció no admesa pel protocol"
-
 #, c-format
 msgid "can't connect to subservice %s"
 msgstr "no es pot connectar al subservei %s"
@@ -21558,10 +21815,6 @@ msgid "support for protocol v2 not implemented yet"
 msgstr ""
 "encara no s'ha implementat la compatibilitat amb la versió v2 del protocol"
 
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "valor desconegut per al config «%s»': %s"
-
 #, c-format
 msgid "transport '%s' not allowed"
 msgstr "no es permet el transport «%s»"
@@ -21615,6 +21868,9 @@ msgid "could not retrieve server-advertised bundle-uri list"
 msgstr ""
 "no s'ha pogut recuperar la llista de paquets d'URI anunciats pel servidor"
 
+msgid "operation not supported by protocol"
+msgstr "opció no admesa pel protocol"
+
 msgid "too-short tree object"
 msgstr "objecte d'arbre massa curt"
 
@@ -22012,6 +22268,9 @@ msgstr "no s'ha pogut accedir a «%s»"
 msgid "unable to get current working directory"
 msgstr "no s'ha pogut obtenir el directori de treball actual"
 
+msgid "unable to get random bytes"
+msgstr "no s'han pogut obtenir bytes aleatoris"
+
 msgid "Unmerged paths:"
 msgstr "Camins sense fusionar:"
 
@@ -22453,6 +22712,10 @@ msgstr "addicionalment, el vostre índex conté canvis sense cometre."
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "no es pot %s: El vostre índex conté canvis sense cometre."
 
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "estil desconegut «%s» donat per a «%s»"
+
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
 "merge"
@@ -22638,14 +22901,14 @@ msgstr ""
 "\n"
 "Esborreu el contingut del cos si no voleu enviar cap resum.\n"
 
-#, perl-format
-msgid "Failed to open %s: %s"
-msgstr "S'ha produït un error en obrir %s: %s"
-
 #, perl-format
 msgid "Failed to open %s.final: %s"
 msgstr "S'ha produït un error en obrir %s.final: %s"
 
+#, perl-format
+msgid "Failed to open %s: %s"
+msgstr "S'ha produït un error en obrir %s: %s"
+
 msgid "Summary email is empty, skipping it\n"
 msgstr "El correu electrònic de resum està buit, s'omet\n"
 
index f7e49ce4a50e004ef64d065849f8b9e56e464610..37d6c8099836c5f335f8007d363e170af75ad540 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -8,8 +8,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-17 16:53+0200\n"
-"PO-Revision-Date: 2023-08-17 16:55+0200\n"
+"POT-Creation-Date: 2024-02-17 18:07+0100\n"
+"PO-Revision-Date: 2024-02-17 18:14+0100\n"
 "Last-Translator: Ralf Thielow <ralf.thielow@gmail.com>\n"
 "Language-Team: German\n"
 "Language: de\n"
@@ -17,7 +17,7 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n!=1);\n"
-"X-Generator: Poedit 3.3.2\n"
+"X-Generator: Poedit 3.4.1\n"
 
 #, c-format
 msgid "Huh (%s)?"
@@ -1473,6 +1473,10 @@ msgstr "die Option '%s' erfordert '%s'"
 msgid "Unexpected option --output"
 msgstr "Unerwartete Option --output"
 
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "zusätzlicher Befehlszeilenparameter '%s'"
+
 #, c-format
 msgid "Unknown archive format '%s'"
 msgstr "Unbekanntes Archivformat '%s'"
@@ -1518,6 +1522,14 @@ msgstr "ignoriere übermäßig großen gitattribute-Blob '%s'"
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "ungültiges --attr-source oder GIT_ATTR_SOURCE"
 
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "konnte '%s' nicht lesen"
+
+#, c-format
+msgid "unable to read %s"
+msgstr "kann %s nicht lesen"
+
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
 msgstr "Ungültiger Inhalt bzgl. Anführungszeichen in Datei '%s': %s"
@@ -1807,8 +1819,8 @@ msgid "submodule '%s': cannot create branch '%s'"
 msgstr "Submodul '%s': kann Branch nicht erzeugen: '%s'"
 
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "'%s' ist bereits in '%s' ausgecheckt"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "'%s' wird bereits von Arbeitsverzeichnis in '%s' verwendet"
 
 msgid "git add [<options>] [--] <pathspec>..."
 msgstr "git add [<Optionen>] [--] <Pfadspezifikation>..."
@@ -1828,25 +1840,22 @@ msgstr ""
 "Die Einstellung add.interactive.useBuiltin wurde entfernt!\n"
 "Siehe den Eintrag in 'git help config' für Details."
 
-msgid "Could not read the index"
-msgstr "Konnte den Index nicht lesen"
-
-msgid "Could not write patch"
-msgstr "Konnte Patch nicht schreiben"
+msgid "could not read the index"
+msgstr "konnte den Index nicht lesen"
 
 msgid "editing patch failed"
 msgstr "Bearbeitung des Patches fehlgeschlagen"
 
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "Konnte Verzeichnis '%s' nicht lesen"
+msgid "could not stat '%s'"
+msgstr "Konnte '%s' nicht lesen."
 
-msgid "Empty patch. Aborted."
-msgstr "Leerer Patch. Abgebrochen."
+msgid "empty patch. aborted"
+msgstr "leerer Patch. Abgebrochen"
 
 #, c-format
-msgid "Could not apply '%s'"
-msgstr "Konnte '%s' nicht anwenden."
+msgid "could not apply '%s'"
+msgstr "konnte '%s' nicht anwenden"
 
 msgid "The following paths are ignored by one of your .gitignore files:\n"
 msgstr ""
@@ -1985,6 +1994,9 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "Index-Datei beschädigt"
 
+msgid "unable to write new index file"
+msgstr "Konnte neue Index-Datei nicht schreiben."
+
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "ungültige Aktion '%s' für '%s'"
@@ -2199,9 +2211,6 @@ msgstr ""
 "Sie können `git rm` auf Dateien ausführen, um \"von denen gelöscht\" für\n"
 "diese zu akzeptieren."
 
-msgid "unable to write new index file"
-msgstr "Konnte neue Index-Datei nicht schreiben."
-
 #, c-format
 msgid "Could not parse object '%s'."
 msgstr "Konnte Objekt '%s' nicht parsen."
@@ -2220,11 +2229,6 @@ msgstr ""
 msgid "failed to read '%s'"
 msgstr "Fehler beim Lesen von '%s'"
 
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr ""
-"die Optionen '%s=%s' und '%s=%s' können nicht gemeinsam verwendet werden"
-
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<Optionen>] [(<mbox> | <E-Mail-Verzeichnis>)...]"
 
@@ -2376,11 +2380,11 @@ msgid "git archive: expected a flush"
 msgstr "git archive: erwartete eine Spülung (flush)"
 
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<Begriff> --term-{old,good}=<Begriff>] [--"
-"no-checkout] [--first-parent] [<schlecht> [<gut>...]] [--] "
+"git bisect start [--term-(new|bad)=<Begriff> --term-(old|good)=<Begriff>]    "
+"[--no-checkout] [--first-parent] [<schlecht> [<gut>...]] [--]    "
 "[<Pfadspezifikation>...]"
 
 msgid "git bisect (good|bad) [<rev>...]"
@@ -2395,8 +2399,8 @@ msgstr "git bisect reset [<Commit>]"
 msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <Logdatei>"
 
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <Programm>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <Programm> [<Argument>...]"
 
 #, c-format
 msgid "cannot open file '%s' in mode '%s'"
@@ -2818,44 +2822,46 @@ msgstr "git branch [<Optionen>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
-"entferne Branch '%s', der zusammengeführt wurde mit\n"
-"         '%s', aber noch nicht mit HEAD zusammengeführt wurde."
+"Löschen des Branches '%s', der mit\n"
+"         '%s', aber noch nicht in HEAD zusammengeführt wurde"
 
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
 "entferne Branch '%s' nicht, der noch nicht zusammengeführt wurde mit\n"
-"         '%s', obwohl er mit HEAD zusammengeführt wurde."
+"         '%s', obwohl er mit HEAD zusammengeführt wurde"
 
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
-msgstr "Konnte Commit-Objekt für '%s' nicht nachschlagen."
+msgid "couldn't look up commit object for '%s'"
+msgstr "konnte Commit-Objekt für '%s' nicht nachschlagen"
 
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
+msgid "the branch '%s' is not fully merged"
+msgstr "der Branch '%s' ist nicht vollständig zusammengeführt"
+
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
 msgstr ""
-"Der Branch '%s' ist nicht vollständig zusammengeführt.\n"
-"Wenn Sie sicher sind diesen Branch zu entfernen, führen Sie 'git branch -D "
-"%s' aus."
+"Wenn Sie sicher sind, dass Sie den Branch löschen wollen, führen Sie 'git "
+"branch -D %s' aus."
 
-msgid "Update of config-file failed"
+msgid "update of config-file failed"
 msgstr "Aktualisierung der Konfigurationsdatei fehlgeschlagen."
 
 msgid "cannot use -a with -d"
 msgstr "kann -a nicht mit -d benutzen"
 
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "Kann Branch '%s' nicht entfernen, ausgecheckt in '%s'."
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr ""
+"kann Branch '%s' nicht löschen, der in Arbeitsverzeichnis '%s' verwendet wird"
 
 #, c-format
-msgid "remote-tracking branch '%s' not found."
+msgid "remote-tracking branch '%s' not found"
 msgstr "Remote-Tracking-Branch '%s' nicht gefunden"
 
 #, c-format
@@ -2867,8 +2873,8 @@ msgstr ""
 "Haben Sie --remote vergessen?"
 
 #, c-format
-msgid "branch '%s' not found."
-msgstr "Branch '%s' nicht gefunden."
+msgid "branch '%s' not found"
+msgstr "Branch '%s' nicht gefunden"
 
 #, c-format
 msgid "Deleted remote-tracking branch %s (was %s).\n"
@@ -2889,56 +2895,56 @@ msgid "HEAD (%s) points outside of refs/heads/"
 msgstr "HEAD (%s) wurde nicht unter \"refs/heads/\" gefunden!"
 
 #, c-format
-msgid "Branch %s is being rebased at %s"
-msgstr "Branch %s wird auf %s umgesetzt"
+msgid "branch %s is being rebased at %s"
+msgstr "Rebase von Branch %s in %s im Gange"
 
 #, c-format
-msgid "Branch %s is being bisected at %s"
-msgstr "Binäre Suche von Branch %s zu %s im Gange"
+msgid "branch %s is being bisected at %s"
+msgstr "Binäre Suche von Branch %s in %s im Gange"
 
 #, c-format
 msgid "HEAD of working tree %s is not updated"
 msgstr "HEAD des Arbeitsverzeichnisses %s ist nicht aktualisiert"
 
 #, c-format
-msgid "Invalid branch name: '%s'"
+msgid "invalid branch name: '%s'"
 msgstr "Ungültiger Branchname: '%s'"
 
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Noch kein Commit in Branch '%s'."
+msgid "no commit on branch '%s' yet"
+msgstr "Noch kein Commit in Branch '%s'"
 
 #, c-format
-msgid "No branch named '%s'."
-msgstr "Branch '%s' nicht vorhanden."
+msgid "no branch named '%s'"
+msgstr "kein Branch mit dem Namen '%s'"
 
-msgid "Branch rename failed"
+msgid "branch rename failed"
 msgstr "Umbenennung des Branches fehlgeschlagen"
 
-msgid "Branch copy failed"
+msgid "branch copy failed"
 msgstr "Kopie des Branches fehlgeschlagen"
 
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "Kopie eines falsch benannten Branches '%s' erstellt."
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "Kopie eines falsch benannten Branches '%s' erstellt"
 
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
+msgid "renamed a misnamed branch '%s' away"
 msgstr "falsch benannten Branch '%s' umbenannt"
 
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "Branch umbenannt zu %s, aber HEAD ist nicht aktualisiert!"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "Branch wird in %s umbenannt, aber HEAD wird nicht aktualisiert"
 
-msgid "Branch is renamed, but update of config-file failed"
+msgid "branch is renamed, but update of config-file failed"
 msgstr ""
-"Branch ist umbenannt, aber die Aktualisierung der Konfigurationsdatei ist "
-"fehlgeschlagen."
+"Branch wurde umbenannt, aber die Aktualisierung der Konfigurationsdatei\n"
+"ist fehlgeschlagen"
 
-msgid "Branch is copied, but update of config-file failed"
+msgid "branch is copied, but update of config-file failed"
 msgstr ""
-"Branch wurde kopiert, aber die Aktualisierung der Konfigurationsdatei ist\n"
-"fehlgeschlagen."
+"Branch wurde kopiert, aber die Aktualisierung der Konfigurationsdatei\n"
+"ist fehlgeschlagen"
 
 #, c-format
 msgid ""
@@ -3053,8 +3059,8 @@ msgstr "Rekursion in Submodulen durchführen"
 msgid "format to use for the output"
 msgstr "für die Ausgabe zu verwendendes Format"
 
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "Konnte HEAD nicht als gültige Referenz auflösen."
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "HEAD konnte nicht als gültige Referenz aufgelöst werden"
 
 msgid "HEAD not found below refs/heads!"
 msgstr "HEAD wurde nicht unter \"refs/heads\" gefunden!"
@@ -3072,18 +3078,18 @@ msgstr "--recurse-submodules kann nur genutzt werden, um Branches zu erstellen"
 msgid "branch name required"
 msgstr "Branchname erforderlich"
 
-msgid "Cannot give description to detached HEAD"
+msgid "cannot give description to detached HEAD"
 msgstr "zu losgelöstem HEAD kann keine Beschreibung hinterlegt werden"
 
 msgid "cannot edit description of more than one branch"
 msgstr "Beschreibung von mehr als einem Branch kann nicht bearbeitet werden"
 
-msgid "cannot copy the current branch while not on any."
+msgid "cannot copy the current branch while not on any"
 msgstr ""
 "Kann den aktuellen Branch nicht kopieren, solange Sie sich auf keinem "
 "befinden."
 
-msgid "cannot rename the current branch while not on any."
+msgid "cannot rename the current branch while not on any"
 msgstr ""
 "Kann aktuellen Branch nicht umbenennen, solange Sie sich auf keinem befinden."
 
@@ -3098,10 +3104,10 @@ msgstr "zu viele Argumente angegeben, um Upstream-Branch zu setzen"
 
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
-"Konnte keinen neuen Upstream-Branch von HEAD zu %s setzen, da dieser auf\n"
-"keinen Branch zeigt."
+"konnte den Upstream von HEAD nicht auf %s setzen, wenn er auf keinen Zweig "
+"verweist"
 
 #, c-format
 msgid "no such branch '%s'"
@@ -3116,17 +3122,17 @@ msgstr ""
 "zu viele Argumente angegeben, um Konfiguration zu Upstream-Branch zu "
 "entfernen"
 
-msgid "could not unset upstream of HEAD when it does not point to any branch."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
 msgstr ""
-"Konnte Konfiguration zu Upstream-Branch von HEAD nicht entfernen, da dieser\n"
-"auf keinen Branch zeigt."
+"konnte den Upstream von HEAD nicht aufheben, wenn er nicht auf einen Zweig "
+"verweist"
 
 #, c-format
-msgid "Branch '%s' has no upstream information"
-msgstr "Branch '%s' hat keinen Upstream-Branch gesetzt"
+msgid "branch '%s' has no upstream information"
+msgstr "Branch '%s' hat keine Upstream-Informationen"
 
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
 "Die Optionen -a und -r bei 'git branch' können nicht mit einem Branchnamen "
@@ -3135,7 +3141,7 @@ msgstr ""
 
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
 "Die '--set-upstream' Option wird nicht länger unterstützt.\n"
 "Bitte benutzen Sie stattdessen '--track' oder '--set-upstream-to'."
@@ -3214,6 +3220,10 @@ msgstr "einen Zielort für die Fehlerberichtsdatei(en) angeben"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "ein Suffix im strftime-Format für den/die Dateinamen angeben"
 
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "unbekanntes Argument `%s'"
+
 #, c-format
 msgid "could not create leading directories for '%s'"
 msgstr "konnte vorangehende Verzeichnisse für '%s' nicht erstellen"
@@ -3320,6 +3330,14 @@ msgstr "git cat-file (-e | -p) <Objekt>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <Objekt>"
 
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<Commit>:<Pfad|Commit-Referenz> | --path=<Pfad|Commit-"
+"Referenz> <Commit>]"
+
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
 "objects]\n"
@@ -3331,14 +3349,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<Commit>:<Pfad|Commit-Referenz> | --path=<Pfad|Commit-"
-"Referenz> <Commit>]"
-
 msgid "Check object existence or emit object contents"
 msgstr "Überprüfen von Objektexistenz oder Ausgeben von Objekt-Inhalten"
 
@@ -3640,6 +3650,12 @@ msgstr "'%s' kann nur genutzt werden, wenn '%s' nicht verwendet wird"
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "'%s' oder '%s' kann nicht mit %s verwendet werden"
 
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr ""
+"'%s', '%s' oder '%s' können beim Auschecken aus einem Verzeichnis nicht "
+"verwendet werden"
+
 #, c-format
 msgid "path '%s' is unmerged"
 msgstr "Pfad '%s' ist nicht zusammengeführt"
@@ -3900,8 +3916,8 @@ msgstr "Auschecken erzwingen (verwirft lokale Änderungen)"
 msgid "new-branch"
 msgstr "neuer Branch"
 
-msgid "new unparented branch"
-msgstr "neuer Branch ohne Eltern-Commit"
+msgid "new unborn branch"
+msgstr "neuer ungeborener Branch"
 
 msgid "update ignored files (default)"
 msgstr "ignorierte Dateien aktualisieren (Standard)"
@@ -4155,9 +4171,6 @@ msgstr ""
 "clean.requireForce standardmäßig auf \"true\" gesetzt und weder -i, -n noch -"
 "f gegeben; \"clean\" verweigert"
 
-msgid "-x and -X cannot be used together"
-msgstr "-x und -X können nicht gemeinsam verwendet werden"
-
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<Optionen>] [--] <Repository> [<Verzeichnis>]"
 
@@ -4251,6 +4264,9 @@ msgstr ".git-Verzeichnis"
 msgid "separate git dir from working tree"
 msgstr "Git-Verzeichnis vom Arbeitsverzeichnis separieren"
 
+msgid "specify the reference format to use"
+msgstr "das zu verwendende Referenzformat angeben"
+
 msgid "key=value"
 msgstr "Schlüssel=Wert"
 
@@ -4374,12 +4390,9 @@ msgstr "Zu viele Argumente."
 msgid "You must specify a repository to clone."
 msgstr "Sie müssen ein Repository zum Klonen angeben."
 
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"--bundle-uri ist inkompatibel mit --depth, --shallow-since und --shallow-"
-"exclude"
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "unbekanntes Speicherformat für Referenzen '%s'"
 
 #, c-format
 msgid "repository '%s' does not exist"
@@ -4521,7 +4534,7 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <Verzeichnis>] [--append]\n"
 "                       [--split[=<Strategie>]] [--reachable | --stdin-packs "
@@ -4544,6 +4557,10 @@ msgstr ""
 msgid "Could not open commit-graph '%s'"
 msgstr "Konnte Commit-Graph '%s' nicht öffnen."
 
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "konnte die Commit-Graph-Kette '%s' nicht öffnen"
+
 #, c-format
 msgid "unrecognized --split argument, %s"
 msgstr "nicht erkanntes --split Argument, %s"
@@ -4747,9 +4764,6 @@ msgstr "Konnte temporären Index nicht aktualisieren."
 msgid "Failed to update main cache tree"
 msgstr "Konnte Haupt-Cache-Verzeichnis nicht aktualisieren"
 
-msgid "unable to write new_index file"
-msgstr "Konnte new_index Datei nicht schreiben"
-
 msgid "cannot do a partial commit during a merge."
 msgstr "Kann keinen Teil-Commit durchführen, während ein Merge im Gange ist."
 
@@ -5159,13 +5173,13 @@ msgstr "Commit aufgrund leerer Commit-Beschreibung abgebrochen.\n"
 
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
-"Das Repository wurde aktualisiert, aber die \"new_index\"-Datei\n"
+"Das Repository wurde aktualisiert, aber die neue Index-Datei\n"
 "konnte nicht geschrieben werden. Prüfen Sie, dass Ihre Festplatte nicht\n"
 "voll und Ihr Kontingent nicht aufgebraucht ist und führen Sie\n"
-"anschließend \"git restore HEAD --staged :/\" zur Wiederherstellung aus."
+"anschließend \"git restore --staged :/\" zur Wiederherstellung aus."
 
 msgid "git config [<options>]"
 msgstr "git config [<Optionen>]"
@@ -6643,6 +6657,9 @@ msgstr "unreferenzierte Objekte entfernen"
 msgid "pack unreferenced objects separately"
 msgstr "unreferenzierte Objekte separat verpacken"
 
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "mit --cruft, die Größe neuer Cruft-Pakete begrenzen"
+
 msgid "be more thorough (increased runtime)"
 msgstr "mehr Gründlichkeit (erhöht Laufzeit)"
 
@@ -6826,12 +6843,6 @@ msgstr ""
 msgid "'crontab' died"
 msgstr "'crontab' abgebrochen"
 
-msgid "failed to start systemctl"
-msgstr "Fehler beim Starten von systemctl"
-
-msgid "failed to run systemctl"
-msgstr "Fehler beim Ausführen von systemctl"
-
 #, c-format
 msgid "failed to delete '%s'"
 msgstr "Fehler beim Löschen von '%s'"
@@ -6840,6 +6851,12 @@ msgstr "Fehler beim Löschen von '%s'"
 msgid "failed to flush '%s'"
 msgstr "Flush bei '%s' fehlgeschlagen."
 
+msgid "failed to start systemctl"
+msgstr "Fehler beim Starten von systemctl"
+
+msgid "failed to run systemctl"
+msgstr "Fehler beim Ausführen von systemctl"
+
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
 msgstr "nicht erkanntes --scheduler Argument '%s'"
@@ -6863,6 +6880,9 @@ msgstr "Scheduler"
 msgid "scheduler to trigger git maintenance run"
 msgstr "Scheduler, um \"git maintenance run\" auzuführen"
 
+msgid "failed to set up maintenance schedule"
+msgstr "Fehler beim Einrichten des Wartungsplans"
+
 msgid "failed to add repo to global config"
 msgstr "Repository konnte nicht zur globalen Konfiguration hinzugefügt werden"
 
@@ -6892,6 +6912,10 @@ msgstr "keine Unterstützung von Threads, '%s' wird ignoriert"
 msgid "unable to read tree (%s)"
 msgstr "konnte \"Tree\"-Objekt (%s) nicht lesen"
 
+#, c-format
+msgid "unable to read tree %s"
+msgstr "konnte \"Tree\"-Objekt (%s) nicht lesen"
+
 #, c-format
 msgid "unable to grep from object of type %s"
 msgstr "kann \"grep\" nicht mit Objekten des Typs %s durchführen"
@@ -6936,8 +6960,8 @@ msgstr "binäre Dateien mit \"textconv\"-Filtern verarbeiten"
 msgid "search in subdirectories (default)"
 msgstr "in Unterverzeichnissen suchen (Standard)"
 
-msgid "descend at most <depth> levels"
-msgstr "höchstens <Tiefe> Ebenen durchlaufen"
+msgid "descend at most <n> levels"
+msgstr "höchstens <n> Ebenen absteigen"
 
 msgid "use extended POSIX regular expressions"
 msgstr "erweiterte reguläre Ausdrücke aus POSIX verwenden"
@@ -7313,10 +7337,6 @@ msgstr "ernsthafte Inkonsistenz nach Dekomprimierung"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "SHA1 KOLLISION MIT %s GEFUNDEN !"
 
-#, c-format
-msgid "unable to read %s"
-msgstr "kann %s nicht lesen"
-
 #, c-format
 msgid "cannot read existing object info %s"
 msgstr "Kann existierende Informationen zu Objekt %s nicht lesen."
@@ -7457,11 +7477,13 @@ msgstr "fsck Fehler beim Packen von Objekten"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<Vorlagenverzeichnis>]\n"
 "         [--separate-git-dir <Git-Verzeichnis>] [--object-format=<Format>]\n"
+"         [--ref-format=<Format>]\n"
 "         [-b <Branchname> | --initial-branch=<Branchname>]\n"
 "         [--shared[=<Berechtigungen>]] [<Verzeichnis>]"
 
@@ -7505,11 +7527,12 @@ msgstr "--separate-git-dir nicht kompatibel mit Bare-Repository"
 
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <Token>[(=|:)<Wert>])...]\n"
+"                       [(--trailer (<Schlüssel>|<Schlüssel-Alias>)"
+"[(=|:)<Wert>])...]\n"
 "                       [--parse] [<Datei>...]"
 
 msgid "edit files in place"
@@ -7518,6 +7541,9 @@ msgstr "vorhandene Dateien direkt bearbeiten"
 msgid "trim empty trailers"
 msgstr "kürzt leere Anhänge"
 
+msgid "placement"
+msgstr "Platzierung"
+
 msgid "where to place the new trailer"
 msgstr "wo der neue Anhang platziert wird"
 
@@ -7530,17 +7556,17 @@ msgstr "Aktion, wenn Anhang fehlt"
 msgid "output only the trailers"
 msgstr "nur Anhänge ausgeben"
 
-msgid "do not apply config rules"
-msgstr "Regeln aus Konfiguration nicht anwenden"
+msgid "do not apply trailer.* configuration variables"
+msgstr "trailer.* Konfigurationsvariablen nicht anwenden"
 
-msgid "join whitespace-continued values"
-msgstr "durch Leerzeichen fortgesetzte Werte verbinden"
+msgid "reformat multiline trailer values as single-line values"
+msgstr "mehrzeilige Trailer als einzeilige Werte umformatieren"
 
-msgid "set parsing options"
-msgstr "Optionen für das Parsen setzen"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "Alias für --only-trailers --only-input --unfold"
 
-msgid "do not treat --- specially"
-msgstr "--- nicht speziell behandeln"
+msgid "do not treat \"---\" as the end of input"
+msgstr "\"---\" nicht als Ende der Eingabe behandeln"
 
 msgid "trailer(s) to add"
 msgstr "Anhang/Anhänge hinzufügen"
@@ -7630,6 +7656,10 @@ msgstr "Brauche genau einen Commit-Bereich."
 msgid "not a range"
 msgstr "Kein Commit-Bereich."
 
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "konnte Datei mit Branchbeschreibung '%s' nicht lesen"
+
 msgid "cover letter needs email format"
 msgstr "Anschreiben benötigt E-Mail-Format"
 
@@ -7729,6 +7759,9 @@ msgid "generate parts of a cover letter based on a branch's description"
 msgstr ""
 "Erzeuge Teile des Deckblattes basierend auf der Beschreibung des Branches"
 
+msgid "use branch description from file"
+msgstr "Branchbeschreibung aus Datei verwenden"
+
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "nutze [<Präfix>] statt [PATCH]"
 
@@ -8171,9 +8204,19 @@ msgstr ""
 "git merge-file [<Optionen>] [-L <Name1> [-L <orig> [-L <Name2>]]] <Datei1> "
 "<orig-Datei> <Datei2>"
 
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"Option diff-algorithm akzeptiert: \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+
 msgid "send results to standard output"
 msgstr "Ergebnisse zur Standard-Ausgabe senden"
 
+msgid "use object IDs instead of filenames"
+msgstr "Objekt-IDs anstelle von Dateinamen verwenden"
+
 msgid "use a diff3 based merge"
 msgstr "einen diff3 basierten Merge verwenden"
 
@@ -8189,6 +8232,12 @@ msgstr "bei Konflikten ihre Variante verwenden"
 msgid "for conflicts, use a union version"
 msgstr "bei Konflikten eine gemeinsame Variante verwenden"
 
+msgid "<algorithm>"
+msgstr "<Algorithmus>"
+
+msgid "choose a diff algorithm"
+msgstr "einen Algorithmus für Änderungen wählen"
+
 msgid "for conflicts, use this marker size"
 msgstr "bei Konflikten diese Kennzeichnungslänge verwenden"
 
@@ -8198,6 +8247,13 @@ msgstr "keine Warnung bei Konflikten"
 msgid "set labels for file1/orig-file/file2"
 msgstr "Beschriftung für Datei1/orig-Datei/Datei2 setzen"
 
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "Objekt '%s' existiert nicht"
+
+msgid "Could not write object file"
+msgstr "konnte Objektdatei nicht schreiben"
+
 #, c-format
 msgid "unknown option %s"
 msgstr "unbekannte Option: %s"
@@ -8260,11 +8316,18 @@ msgstr "mehrere Merges durchführen, eine pro Eingabezeile"
 msgid "specify a merge-base for the merge"
 msgstr "Merge-Basis für den Merge angeben"
 
+msgid "option=value"
+msgstr "Option=Wert"
+
+msgid "option for selected merge strategy"
+msgstr "Option für ausgewählte Merge-Strategie"
+
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge ist mit allen anderen Optionen inkompatibel"
 
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base ist inkompatibel mit --stdin"
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "unbekannte Strategie-Option: -X%s"
 
 #, c-format
 msgid "malformed input line: '%s'."
@@ -8335,12 +8398,6 @@ msgstr "Strategie"
 msgid "merge strategy to use"
 msgstr "zu verwendende Merge-Strategie"
 
-msgid "option=value"
-msgstr "Option=Wert"
-
-msgid "option for selected merge strategy"
-msgstr "Option für ausgewählte Merge-Strategie"
-
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr ""
 "Commit-Beschreibung zusammenführen (für einen Merge, der kein Vorspulen war)"
@@ -8401,10 +8458,6 @@ msgstr "Konnte Index nicht schreiben."
 msgid "Not handling anything other than two heads merge."
 msgstr "Es wird nur der Merge von zwei Branches behandelt."
 
-#, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "unbekannte Strategie-Option: -X%s"
-
 #, c-format
 msgid "unable to write %s"
 msgstr "konnte %s nicht schreiben"
@@ -8710,8 +8763,8 @@ msgstr "Ziel existiert bereits"
 msgid "can not move directory into itself"
 msgstr "kann Verzeichnis nicht in sich selbst verschieben"
 
-msgid "cannot move directory over file"
-msgstr "kann Verzeichnis nicht über Datei verschieben"
+msgid "destination already exists"
+msgstr "Ziel existiert bereits"
 
 msgid "source directory is empty"
 msgstr "Quellverzeichnis ist leer"
@@ -9230,6 +9283,10 @@ msgstr "Komprimiere Objekte"
 msgid "inconsistency with delta count"
 msgstr "Inkonsistenz mit der Anzahl von Deltas"
 
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "ungültiger Wert für pack.allowPackReuse: '%s'"
+
 #, c-format
 msgid ""
 "value of uploadpack.blobpackfileuri must be of the form '<object-hash> <pack-"
@@ -9480,9 +9537,6 @@ msgid "--thin cannot be used to build an indexable pack"
 msgstr ""
 "--thin kann nicht benutzt werden, um ein indizierbares Paket zu erstellen."
 
-msgid "cannot use --filter without --stdout"
-msgstr "Kann --filter nicht ohne --stdout benutzen."
-
 msgid "cannot use --filter with --stdin-packs"
 msgstr "kann --filter nicht mit --stdin-packs benutzen"
 
@@ -9496,19 +9550,16 @@ msgstr "interne Commit-Liste kann nicht gemeinsam mit --cruft verwendet werden"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "kann --stdin-packs nicht mit --cruft benutzen"
 
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "kann --max-pack-size nicht mit --cruft benutzen"
-
 msgid "Enumerating objects"
 msgstr "Objekte aufzählen"
 
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Gesamt %<PRIu32> (Delta %<PRIu32>), Wiederverwendet %<PRIu32> (Delta "
-"%<PRIu32>), Pack wiederverwendet %<PRIu32>"
+"%<PRIu32>), Paket wiederverwendet %<PRIu32> (von %<PRIuMAX>)"
 
 msgid ""
 "'git pack-redundant' is nominated for removal.\n"
@@ -9893,9 +9944,9 @@ msgstr ""
 "Branches hinter seinem externen Gegenstück zurückgefallen ist. Wenn Sie\n"
 "die externen Änderungen integrieren wollen, verwenden Sie 'git pull' bevor\n"
 "Sie erneut push ausführen.\n"
-"Siehe auch die Sektion 'Note about fast-forwards' in 'git push --help' für "
-"weitere\n"
-"Informationen."
+"Siehe auch den Abschnitt 'Note about fast-forwards' in 'git push --help' "
+"für\n"
+"weitere Informationen."
 
 msgid ""
 "Updates were rejected because a pushed branch tip is behind its remote\n"
@@ -9907,9 +9958,9 @@ msgstr ""
 "Branches hinter seinem externen Gegenstück zurückgefallen ist. Wenn Sie die\n"
 "externen Änderungen integrieren wollen, verwenden Sie 'git pull'\n"
 "bevor Sie erneut push ausführen.\n"
-"Siehe auch die Sektion 'Note about fast-forwards' in 'git push --help' für "
-"weitere\n"
-"Informationen."
+"Siehe auch den Abschnitt 'Note about fast-forwards' in 'git push --help' "
+"für\n"
+"weitere Informationen."
 
 msgid ""
 "Updates were rejected because the remote contains work that you do not\n"
@@ -9926,9 +9977,9 @@ msgstr ""
 "Wenn Sie die externen Änderungen integrieren wollen, verwenden Sie 'git "
 "pull'\n"
 "bevor Sie erneut push ausführen.\n"
-"Siehe auch die Sektion 'Note about fast-forwards' in 'git push --help' für "
-"weitere\n"
-"Informationen."
+"Siehe auch den Abschnitt 'Note about fast-forwards' in 'git push --help' "
+"für\n"
+"weitere Informationen."
 
 msgid "Updates were rejected because the tag already exists in the remote."
 msgstr ""
@@ -10519,16 +10570,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "Schalter `C' erwartet einen numerischen Wert."
 
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy erfordert --merge oder --interactive"
-
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"apply-Optionen sind mit rebase.autoSquash nicht kompatibel. Erwägen Sie das "
-"Hinzufügen von --no-autosquash"
-
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
 "no-rebase-merges"
@@ -11246,6 +11287,10 @@ msgstr "konnte temporäre Referenzen-Snapshot-Datei nicht schließen"
 msgid "could not remove stale bitmap: %s"
 msgstr "konnte veraltete Bitmap nicht entfernen: %s"
 
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "Pack-Präfix %s fängt nicht mit objdir %s an"
+
 msgid "pack everything in a single pack"
 msgstr "alles in eine einzige Pack-Datei packen"
 
@@ -11324,16 +11369,19 @@ msgstr "ein Multi-Pack-Index des resultierenden Pakets schreiben"
 msgid "pack prefix to store a pack containing pruned objects"
 msgstr "pack-Präfix zum Speichern eines Pakets mit gelöschten Objekten"
 
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "Paketpräfix, um ein Paket mit herausgefilterten Objekten zu speichern"
+
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "kann Pack-Dateien in precious-objects Repository nicht löschen"
 
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "Option '%s' kann nur zusammen mit '%s' verwendet werden"
+
 msgid "Nothing new to pack."
 msgstr "Nichts Neues zum Packen."
 
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "Pack-Präfix %s fängt nicht mit objdir %s an"
-
 #, c-format
 msgid "renaming pack to '%s' failed"
 msgstr "Umbenennung des Pakets in '%s' fehlgeschlagen"
@@ -11535,6 +11583,77 @@ msgstr "--convert-graft-file erwartet keine Argumente"
 msgid "only one pattern can be given with -l"
 msgstr "Mit -l kann nur ein Muster angegeben werden"
 
+msgid "need some commits to replay"
+msgstr "zum erneuten Abspielen werden Commits benötigt"
+
+msgid "--onto and --advance are incompatible"
+msgstr "--onto und --advance sind inkompatibel"
+
+msgid "all positive revisions given must be references"
+msgstr "alle angegebenen positiven Commits müssen Referenzen sein"
+
+msgid "argument to --advance must be a reference"
+msgstr "Argument für --advance muss eine Referenz sein"
+
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"kann Ziel nicht mit mehreren Quellen erweitern, da die Reihenfolge unklar "
+"wäre"
+
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr ""
+"kann nicht implizit bestimmen, ob es sich um eine --advance oder --onto "
+"Operation handelt"
+
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"kann Ziel nicht mit mehreren Quell-Branches erweitern, da die Reihenfolge "
+"unklar wäre"
+
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "kann nicht implizit die richtige Basis für --onto bestimmen"
+
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(EXPERIMENTELL!) git replay ([--contained] --onto <neue-Basis> | --advance "
+"<Branch>) <Commitbereich>..."
+
+msgid "make replay advance given branch"
+msgstr "angegebenen Branch durch neues Abspielen erweitern"
+
+msgid "replay onto given commit"
+msgstr "auf angegebenen Commit neu abspielen"
+
+msgid "advance all branches contained in revision-range"
+msgstr "alle Branches erweitern, die in Commitbereich liegen"
+
+msgid "option --onto or --advance is mandatory"
+msgstr "Option --onto oder --advance erforderlich"
+
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"einige Optionen für das Abgehen von Commits werden außer Kraft gesetzt, da "
+"das '%s' Bit in 'struct rev_info' erzwungen wird"
+
+msgid "error preparing revisions"
+msgstr "Fehler beim Vorbereiten der Commits"
+
+msgid "replaying down to root commit is not supported yet!"
+msgstr "erneutes Abspielen bis zum Root-Commit wird noch nicht unterstützt!"
+
+msgid "replaying merge commits is not supported yet!"
+msgstr "erneutes Abspielen von Merge-Commits wird noch nicht unterstützt!"
+
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
 msgstr ""
@@ -11746,18 +11865,12 @@ msgstr "--prefix benötigt ein Argument"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "unbekannter Modus für --abbrev-ref: %s"
 
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden kann nicht zusammen mit --branches verwendet werden"
-
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden kann nicht zusammen mit --tags verwendet werden"
-
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden kann nicht zusammen mit --remotes verwendet werden"
-
 msgid "this operation must be run in a work tree"
 msgstr "Diese Operation muss in einem Arbeitsverzeichnis ausgeführt werden."
 
+msgid "Could not read the index"
+msgstr "Konnte den Index nicht lesen"
+
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
 msgstr "unbekannter Modus für --show-object-format: %s"
@@ -12107,23 +12220,44 @@ msgid "Unknown hash algorithm"
 msgstr "Unbekannter Hash-Algorithmus"
 
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<Muster>...]"
 
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<Referenz>...]"
+
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<Muster>]"
 
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <Referenz>"
+
+msgid "reference does not exist"
+msgstr "Referenz nicht vorhanden"
+
+msgid "failed to look up reference"
+msgstr "Fehler beim Nachschlagen der Referenz"
+
 msgid "only show tags (can be combined with heads)"
 msgstr "nur Tags anzeigen (kann mit \"heads\" kombiniert werden)"
 
 msgid "only show heads (can be combined with tags)"
 msgstr "nur Branches anzeigen (kann mit \"tags\" kombiniert werden)"
 
+msgid "check for reference existence without resolving"
+msgstr "Prüfung auf Vorhandensein einer Referenz, ohne diese aufzulösen"
+
 msgid "stricter reference checking, requires exact ref path"
 msgstr "strengere Referenzprüfung, erfordert exakten Referenzpfad"
 
@@ -12973,6 +13107,9 @@ msgstr ""
 "shallow] [--reference <Repository>] [--recursive] [--[no-]single-branch] "
 "[--] [<Pfad>...]"
 
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "Konnte HEAD nicht als gültige Referenz auflösen."
+
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<Optionen>] [<Pfad>...]"
 
@@ -13456,6 +13593,9 @@ msgstr "(für Fremdprogramme) keine gespeicherten, nicht aufgelöste Konflikte"
 msgid "write index in this format"
 msgstr "Index-Datei in diesem Format schreiben"
 
+msgid "report on-disk index format version"
+msgstr "Bericht über die Version des Indexformats auf der Festplatte"
+
 msgid "enable or disable split index"
 msgstr "aufgeteilten Index aktivieren oder deaktivieren"
 
@@ -13482,6 +13622,14 @@ msgstr "Dateien als \"fsmonitor valid\" markieren"
 msgid "clear fsmonitor valid bit"
 msgstr "\"fsmonitor valid\"-Bit löschen"
 
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "index-version: war %d, wurde auf %d gesetzt"
+
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
 "enable split index"
@@ -13643,33 +13791,29 @@ msgstr "Kein möglicher Quell-Branch, der auf '--orphan' schließen lässt"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
-"Wenn Sie ein Arbeitsverzeichnis erstellen möchten, um einen neuen verwaisten "
-"Branch\n"
-"(Branch ohne Commits) für dieses Repository zu erstellen, können Sie dies "
-"mit\n"
-"der Option --orphan tun:\n"
+"Wenn Sie ein Arbeitsverzeichnis erstellen möchten, welches einen neuen\n"
+"ungeborenen Branch (Branch ohne Commits) für dieses Repository erzeugt,\n"
+"können Sie dies mit der Option --orphan tun:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
-"Wenn Sie ein Arbeitsverzeichnis erstellen möchten, um einen neuen verwaisten "
-"Branch\n"
-"(Branch ohne Commits) für dieses Repository zu erstellen, können Sie dies "
-"mit\n"
-"der Option --orphan tun:\n"
+"Wenn Sie ein Arbeitsverzeichnis erstellen möchten, welches einen neuen\n"
+"ungeborenen Branch (Branch ohne Commits) für dieses Repository erzeugt,\n"
+"können Sie dies mit der Option --orphan tun:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 
@@ -13731,6 +13875,10 @@ msgstr "Konnte Verzeichnis '%s' nicht erstellen."
 msgid "initializing"
 msgstr "initialisiere"
 
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "konnte erstelltes Arbeitsverzeichnis '%s' nicht finden"
+
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
 msgstr "Bereite Arbeitsverzeichnis vor (neuer Branch '%s')"
@@ -13763,7 +13911,7 @@ msgstr ""
 
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
 "Es gibt keine lokalen oder entfernten Referenzen, obwohl mindestens ein "
 "Remote-Repository\n"
@@ -13771,10 +13919,6 @@ msgstr ""
 "Referenz zu überschreiben\n"
 "oder rufen Sie diese zuerst ab"
 
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "'%s' und '%s' können nicht zusammen verwendet werden"
-
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr ""
 "<Branch> auschecken, auch wenn dieser bereits in einem anderen "
@@ -13786,8 +13930,8 @@ msgstr "neuen Branch erstellen"
 msgid "create or reset a branch"
 msgstr "Branch erstellen oder umsetzen"
 
-msgid "create unborn/orphaned branch"
-msgstr "ungeborenen/verwaisten Branch erstellen"
+msgid "create unborn branch"
+msgstr "ungeborenen Branch erzeugen"
 
 msgid "populate the new working tree"
 msgstr "das neue Arbeitsverzeichnis auschecken"
@@ -13812,11 +13956,8 @@ msgstr ""
 "die Optionen '%s', '%s' und '%s' können nicht gemeinsam verwendet werden"
 
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "die Optionen '%s' und '%s' können nicht gemeinsam verwendet werden"
-
-msgid "<commit-ish>"
-msgstr "<Commit-Angabe>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "Option '%s' und commit-ish können nicht gemeinsam verwendet werden"
 
 msgid "added with --lock"
 msgstr "mit --lock hinzugefügt"
@@ -14099,6 +14240,10 @@ msgstr "Erstellung der Paketindexdatei abgebrochen"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "abschließende Chunk-ID erscheint eher als erwartet"
 
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "Chunk id %<PRIx32> nicht %d-byte-aligned"
+
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
 msgstr "unzulässige(r) Chunk-Offset(s) %<PRIx64> und %<PRIx64>"
@@ -14156,10 +14301,8 @@ msgstr ""
 msgid "Move objects and refs by archive"
 msgstr "Objekte und Referenzen über ein Archiv verteilen"
 
-msgid "Provide content or type and size information for repository objects"
-msgstr ""
-"Inhalt oder Informationen zu Typ und Größe für Repository-Objekte "
-"bereitstellen"
+msgid "Provide contents or details of repository objects"
+msgstr "Bereitstellung von Inhalten oder Details von Repository-Objekten"
 
 msgid "Display gitattributes information"
 msgstr "gitattributes Informationen darstellen"
@@ -14465,6 +14608,11 @@ msgstr "ungepackte Objekte in einem Repository packen"
 msgid "Create, list, delete refs to replace objects"
 msgstr "Referenzen für ersetzende Objekte erstellen, auflisten, löschen"
 
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"EXPERIMENTELL: Commits auf neuer Basis abspielen, funktioniert auch mit Bare-"
+"Repositories"
+
 msgid "Generates a summary of pending changes"
 msgstr "eine Übersicht über ausstehende Änderungen generieren"
 
@@ -14591,8 +14739,8 @@ msgstr "die GPG-Signatur von Tags prüfen"
 msgid "Display version information about Git"
 msgstr "Versionsinformationen über Git anzeigen"
 
-msgid "Show logs with difference each commit introduces"
-msgstr "Logs mit dem Unterschied, den jeder Commit einführt, anzeigen"
+msgid "Show logs with differences each commit introduces"
+msgstr "Logs mit den Unterschieden anzeigen, den jeder Commit einführt"
 
 msgid "Manage multiple working trees"
 msgstr "mehrere Arbeitsverzeichnisse verwalten"
@@ -14709,6 +14857,32 @@ msgstr "Ein Werkzeug zur Verwaltung großer Git-Repositories"
 msgid "commit-graph file is too small"
 msgstr "Commit-Graph-Datei ist zu klein"
 
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "Commit-Graph OID fanout Chunk hat die falsche Größe"
+
+msgid "commit-graph fanout values out of order"
+msgstr "Commit-Graph fanout-Werte sind nicht in Ordnung"
+
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "Commit-Graph OID Lookup Chunk hat die falsche Größe"
+
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "Commit-Graph Commit Daten Chunk hat die falsche Größe"
+
+msgid "commit-graph generations chunk is wrong size"
+msgstr "Commit-Graph Generations Chunk hat die falsche Größe"
+
+msgid "commit-graph changed-path index chunk is too small"
+msgstr "Commit-Graph changed-path Index Chunk ist zu klein"
+
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"ignoriere zu kleinen Chunk für geänderte Pfade (%<PRIuMAX> < %<PRIuMAX>) in "
+"Commit-Graph-Datei"
+
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
 msgstr "Commit-Graph-Signatur %X stimmt nicht mit Signatur %X überein"
@@ -14725,9 +14899,22 @@ msgstr "Hash-Version des Commit-Graph %X stimmt nicht mit Version %X überein"
 msgid "commit-graph file is too small to hold %u chunks"
 msgstr "Commit-Graph-Datei ist zu klein, um %u Chunks zu enthalten"
 
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr "Commit-Graph benötigter OID fanout Chunk fehlt oder ist beschädigt"
+
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr "Commit-Graph benötigter OID lookup Chunk fehlt oder ist beschädigt"
+
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr ""
+"Commit-Graph erforderlicher Commit-Daten Chunk fehlt oder ist beschädigt"
+
 msgid "commit-graph has no base graphs chunk"
 msgstr "Commit-Graph hat keinen Basis-Graph-Chunk"
 
+msgid "commit-graph base graphs chunk is too small"
+msgstr "Commit-Graph Basis-Graph-Chunk ist zu klein"
+
 msgid "commit-graph chain does not match"
 msgstr "Commit-Graph Verkettung stimmt nicht überein"
 
@@ -14735,6 +14922,9 @@ msgstr "Commit-Graph Verkettung stimmt nicht überein"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "Anzahl der Commits im Basisgraph zu hoch: %<PRIuMAX>"
 
+msgid "commit-graph chain file too small"
+msgstr "Commit-Graph Chain-Datei zu klein"
+
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
 msgstr "Ungültige Commit-Graph Verkettung: Zeile '%s' ist kein Hash"
@@ -14752,6 +14942,12 @@ msgstr "konnte Commit %s nicht finden"
 msgid "commit-graph requires overflow generation data but has none"
 msgstr "Commit-Graph erfordert Überlaufgenerierungsdaten, aber hat keine"
 
+msgid "commit-graph overflow generation data is too small"
+msgstr "Commit-Graph Überlaufgenerierungsdaten sind zu klein"
+
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "commit-graph extra-edges Zeiger außerhalb der Grenzen"
+
 msgid "Loading known commits in commit graph"
 msgstr "Lade bekannte Commits in Commit-Graph"
 
@@ -14882,20 +15078,6 @@ msgstr "Commit-Graph-Vorgänger für %s ist %s != %s"
 msgid "commit-graph parent list for commit %s terminates early"
 msgstr "Commit-Graph Vorgänger-Liste für Commit %s endet zu früh"
 
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"Commit-Graph hat Generationsnummer null für Commit %s, aber sonst ungleich "
-"null"
-
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"Commit-Graph hat Generationsnummer ungleich null für Commit %s, aber sonst "
-"null"
-
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
 msgstr "Commit-Graph Erstellung für Commit %s ist %<PRIuMAX> < %<PRIuMAX>"
@@ -14905,6 +15087,14 @@ msgid "commit date for commit %s in commit-graph is %<PRIuMAX> != %<PRIuMAX>"
 msgstr ""
 "Commit-Datum für Commit %s in Commit-Graph ist %<PRIuMAX> != %<PRIuMAX>"
 
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"Commit-Graph hat sowohl Null- als auch Nicht-Null-Generationen (z. B. "
+"Commits '%s' und '%s')"
+
 msgid "Verifying commits in commit graph"
 msgstr "Commit in Commit-Graph überprüfen"
 
@@ -14932,6 +15122,11 @@ msgstr ""
 "Sie können diese Meldung unterdrücken, indem Sie\n"
 "\"git config advice.graftFileDeprecated false\" ausführen."
 
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr ""
+"Commit %s existiert im Commit-Graphen, aber nicht in der Objektdatenbank"
+
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
 msgstr ""
@@ -15380,10 +15575,6 @@ msgstr "Referenz '%s' zeigt auf keinen Blob."
 msgid "unable to resolve config blob '%s'"
 msgstr "Konnte Blob '%s' für Konfiguration nicht auflösen."
 
-#, c-format
-msgid "failed to parse %s"
-msgstr "Fehler beim Parsen von %s."
-
 msgid "unable to parse command-line config"
 msgstr ""
 "Konnte die über die Befehlszeile angegebene Konfiguration nicht parsen."
@@ -15863,9 +16054,6 @@ msgstr "Schreiben des Archivs fehlgeschlagen"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base funktioniert nicht mit Bereichen"
 
-msgid "--merge-base only works with commits"
-msgstr "--merge-base funktioniert nur mit Commits"
-
 msgid "unable to get HEAD"
 msgstr "konnte HEAD nicht bekommen"
 
@@ -15926,6 +16114,10 @@ msgstr ""
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr "Unbekannter Wert in Konfigurationsvariable 'diff.submodule': '%s'"
 
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "Unbekannter Wert für Konfiguration '%s': %s"
+
 #, c-format
 msgid ""
 "Found errors in 'diff.dirstat' config variable:\n"
@@ -16008,13 +16200,6 @@ msgstr "ungültiges --color-moved Argument: %s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "ungültiger Modus '%s' in --color-moved-ws"
 
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"Option diff-algorithm akzeptiert: \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-
 #, c-format
 msgid "invalid argument to %s"
 msgstr "ungültiges Argument für %s"
@@ -16058,8 +16243,8 @@ msgstr "maschinenlesbare Ausgabe von --stat"
 msgid "output only the last line of --stat"
 msgstr "nur die letzte Zeile von --stat ausgeben"
 
-msgid "<param1,param2>..."
-msgstr "<Parameter1,Parameter2>..."
+msgid "<param1>,<param2>..."
+msgstr "<Parameter1>,<Parameter2>..."
 
 msgid ""
 "output the distribution of relative amount of changes for each sub-directory"
@@ -16070,8 +16255,8 @@ msgstr ""
 msgid "synonym for --dirstat=cumulative"
 msgstr "Synonym für --dirstat=cumulative"
 
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "Synonym für --dirstat=files,Parameter1,Parameter2..."
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "Synonym für --dirstat=files,<Parameter1>,<Parameter2>..."
 
 msgid "warn if changes introduce conflict markers or whitespace errors"
 msgstr ""
@@ -16254,12 +16439,6 @@ msgstr "Änderungen durch Nutzung des Algorithmus \"Patience Diff\" erzeugen"
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "Änderungen durch Nutzung des Algorithmus \"Histogram Diff\" erzeugen"
 
-msgid "<algorithm>"
-msgstr "<Algorithmus>"
-
-msgid "choose a diff algorithm"
-msgstr "einen Algorithmus für Änderungen wählen"
-
 msgid "<text>"
 msgstr "<Text>"
 
@@ -17312,12 +17491,12 @@ msgstr ""
 "sind vorhanden:\n"
 "%s"
 
-msgid "Failed to execute internal merge"
+msgid "failed to execute internal merge"
 msgstr "Fehler bei Ausführung des internen Merges"
 
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "Konnte %s nicht zur Datenbank hinzufügen"
+msgid "unable to add %s to database"
+msgstr "konnte %s nicht zur Datenbank hinzufügen"
 
 #, c-format
 msgid "Auto-merging %s"
@@ -17774,6 +17953,19 @@ msgstr "Lesen des Zwischenspeichers fehlgeschlagen"
 msgid "multi-pack-index OID fanout is of the wrong size"
 msgstr "Multi-Pack-Index OID fanout hat die falsche Größe"
 
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"Ungültige oid fanout Reihenfolge: fanout[%d] = %<PRIx32> > %<PRIx32> = "
+"fanout[%d]"
+
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "multi-pack-index OID-Lookup-Chunk hat die falsche Größe"
+
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr "multi-pack-index Object-Offset-Chunk hat die falsche Größe"
+
 #, c-format
 msgid "multi-pack-index file %s is too small"
 msgstr "Multi-Pack-Index-Datei %s ist zu klein."
@@ -17791,17 +17983,24 @@ msgstr "Multi-Pack-Index-Version %d nicht erkannt."
 msgid "multi-pack-index hash version %u does not match version %u"
 msgstr "Multi-Pack-Index Hash-Version %u stimmt nicht mit Version %u überein"
 
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "Multi-Pack-Index fehlt erforderlicher Pack-Namen Chunk"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr ""
+"multi-pack-index erforderlicher Pack-Name Chunk fehlt oder ist beschädigt"
+
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr ""
+"multi-pack-index erforderlicher OID-Fanout-Chunk fehlt oder ist beschädigt"
 
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "Multi-Pack-Index fehlt erforderlicher OID fanout Chunk"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr ""
+"multi-pack-index erforderlicher OID Lookup Chunk fehlt oder ist beschädigt"
 
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "Multi-Pack-Index fehlt erforderlicher OID lookup Chunk"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr ""
+"multi-pack-index benötigte Objekt Offsets Chunk fehlt oder ist beschädigt"
 
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "Multi-Pack-Index fehlt erforderlicher Objekt offset Chunk"
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "multi-pack-index Pack-Name Chunk ist zu klein"
 
 #, c-format
 msgid "multi-pack-index pack names out of order: '%s' before '%s'"
@@ -17811,10 +18010,20 @@ msgstr "Falsche Reihenfolge bei Multi-Pack-Index Pack-Namen: '%s' vor '%s'"
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "Ungültige pack-int-id: %u (%u Pakete insgesamt)"
 
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "MIDX enthält keinen BTMP-Chunk"
+
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "konnte Bitmap-Paket nicht laden %<PRIu32>"
+
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr ""
 "Multi-Pack-Index speichert einen 64-Bit Offset, aber off_t ist zu klein"
 
+msgid "multi-pack-index large offset out of bounds"
+msgstr "multi-pack-index großer Offset außerhalb der Grenzen"
+
 #, c-format
 msgid "failed to add packfile '%s'"
 msgstr "Fehler beim Hinzufügen von Packdatei '%s'"
@@ -17893,13 +18102,6 @@ msgstr "Prüfsumme nicht korrekt"
 msgid "Looking for referenced packfiles"
 msgstr "Suche nach referenzierten Pack-Dateien"
 
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr ""
-"Ungültige oid fanout Reihenfolge: fanout[%d] = %<PRIx32> > %<PRIx32> = "
-"fanout[%d]"
-
 msgid "the midx contains no oid"
 msgstr "das midx enthält keine oid"
 
@@ -18435,6 +18637,9 @@ msgstr "Multi-Pack-Bitmap fehlt erforderlicher Reverse-Index"
 msgid "could not open pack %s"
 msgstr "konnte Paket '%s' nicht öffnen"
 
+msgid "could not determine MIDX preferred pack"
+msgstr "konnte das von MIDX bevorzugte Paket nicht ermitteln"
+
 #, c-format
 msgid "preferred pack (%s) is invalid"
 msgstr "bevorzugtes Paket (%s) ist ungültig"
@@ -18457,6 +18662,12 @@ msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
 msgstr ""
 "fehlerhafte ewah-Bitmap: abgeschnittener Header für Bitmap des Commits \"%s\""
 
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr ""
+"Paket kann nicht geladen werden: '%s', Deaktivierung der Paket-"
+"Wiederverwendung"
+
 #, c-format
 msgid "object '%s' not found in type bitmaps"
 msgstr "Objekt '%s' nicht im Typ Bitmaps gefunden"
@@ -18545,6 +18756,12 @@ msgstr "ungültige Prüfsumme"
 msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr "ungültige rev-index Position bei %<PRIu64>: %<PRIu32> != %<PRIu32>"
 
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr "multi-pack-index Reverse-Index Chunk hat die falsche Größe"
+
+msgid "could not determine preferred pack"
+msgstr "konnte das bevorzugte Paket nicht bestimmen"
+
 msgid "cannot both write and verify reverse index"
 msgstr ""
 "Reverse-Index kann nicht gleichzeitig geschrieben und verifiziert werden"
@@ -18596,14 +18813,6 @@ msgstr "Option `%s' erwartet \"%s\" oder \"%s\""
 msgid "%s requires a value"
 msgstr "%s erfordert einen Wert."
 
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s ist inkompatibel mit %s."
-
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s: inkompatibel mit etwas anderem"
-
 #, c-format
 msgid "%s takes no value"
 msgstr "%s erwartet keinen Wert"
@@ -18689,6 +18898,10 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-NUM"
 
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "Gegenteil von --no-%s"
+
 msgid "expiry-date"
 msgstr "Verfallsdatum"
 
@@ -18719,6 +18932,14 @@ msgid ""
 msgstr ""
 "Mit der Option --pathspec-from-file sind Pfade durch NUL-Zeichen getrennt"
 
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "falscher boolescher Wert von Umgebungsvariable '%s' für '%s'"
+
+#, c-format
+msgid "failed to parse %s"
+msgstr "Fehler beim Parsen von %s."
+
 #, c-format
 msgid "Could not make %s writable by group"
 msgstr "Konnte Gruppenschreibrecht für %s nicht setzen."
@@ -18767,6 +18988,10 @@ msgstr "nicht unterstützte Pfadspezifikationsangabe '%c' in '%s'"
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s: 'literal' und 'glob' sind inkompatibel"
 
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "'%s' liegt außerhalb des Verzeichnisbaums"
+
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
 msgstr "%s: '%s' liegt außerhalb des Repositories von '%s'"
@@ -18925,10 +19150,6 @@ msgstr "Konnte Datei '%s' nicht indizieren."
 msgid "unable to add '%s' to index"
 msgstr "Konnte '%s' nicht dem Index hinzufügen."
 
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "konnte '%s' nicht lesen"
-
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
 msgstr "'%s' scheint eine Datei und ein Verzeichnis zu sein"
@@ -19036,10 +19257,6 @@ msgstr "kann aufgeteilten Index nicht für ein Sparse-Index schreiben"
 msgid "failed to convert to a sparse-index"
 msgstr "Konvertierung zu einem Sparse-Index fehlgeschlagen"
 
-#, c-format
-msgid "could not stat '%s'"
-msgstr "Konnte '%s' nicht lesen."
-
 #, c-format
 msgid "unable to open git dir: %s"
 msgstr "konnte Git-Verzeichnis nicht öffnen: %s"
@@ -19511,10 +19728,6 @@ msgstr "'%s' existiert; kann '%s' nicht erstellen"
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "kann '%s' und '%s' nicht zur selben Zeit verarbeiten"
 
-#, c-format
-msgid "could not remove reference %s"
-msgstr "konnte Referenz %s nicht löschen"
-
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "konnte Referenz %s nicht entfernen: %s"
@@ -19709,16 +19922,13 @@ msgid ""
 "\n"
 "Neither worked, so we gave up. You must fully qualify the ref."
 msgstr ""
-"Das angegebene Ziel ist kein vollständiger Referenzname (startet mit \"refs/"
-"\").\n"
-"Wir versuchten zu erraten, was Sie meinten, mit:\n"
+"Das angegebene Ziel ist kein vollständiger Referenzname (startet mit\n"
+"\"refs/\"). Wir versuchten zu erraten, was Sie meinten, mit:\n"
 "\n"
 "- Suche einer Referenz, die mit '%s' übereinstimmt, auf der Remote-Seite\n"
-"- Prüfung, ob die versendete <Quelle> ('%s') eine Referenz in \"refs/{heads,"
-"tags}\"\n"
-"  ist, in dessen Falle wir einen entsprechenden refs/{heads,tags} Präfix "
-"auf\n"
-"  der Remote-Seite hinzufügen würden.\n"
+"- Prüfung, ob die versendete <Quelle> ('%s') eine Referenz in\n"
+"  \"refs/{heads,tags}/\" ist, in dessen Falle wir einen entsprechenden\n"
+"  refs/{heads,tags}/ Präfix auf der Remote-Seite hinzufügen würden.\n"
 "\n"
 "Keines hat funktioniert, sodass wir aufgegeben haben. Sie müssen die\n"
 "Referenz mit vollqualifizierten Namen angeben."
@@ -20084,8 +20294,15 @@ msgstr "vollständiges Arbeitsverzeichnis beim Klonen erstellen"
 msgid "only download metadata for the branch that will be checked out"
 msgstr "lade nur Metadaten des Branches herunter, der ausgecheckt wird"
 
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<Optionen>] [--] <Repository> [<Verzeichnis>]"
+msgid "create repository within 'src' directory"
+msgstr "Repository im Verzeichnis 'src' erstellen"
+
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <Haupt-Branch>] [--full-clone]\n"
+"\t[--[no-]src] <URL> [<Eintragung>]"
 
 #, c-format
 msgid "cannot deduce worktree name from '%s'"
@@ -20136,12 +20353,28 @@ msgid "could not remove stale scalar.repo '%s'"
 msgstr "konnte veraltetes scalar.repo '%s' nicht entfernen"
 
 #, c-format
-msgid "removing stale scalar.repo '%s'"
-msgstr "entferne veraltetes scalar.repo '%s'"
+msgid "removed stale scalar.repo '%s'"
+msgstr "veraltetes scalar.repo '%s' entfernt"
+
+#, c-format
+msgid "repository at '%s' has different owner"
+msgstr "Repository bei '%s' hat anderen Eigentümer"
 
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "Git-Repository entfernt in '%s'"
+msgid "repository at '%s' has a format issue"
+msgstr "Repository bei '%s' hat ein Formatproblem"
+
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "Kein Repository in '%s' gefunden"
+
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"um dieses Repository von Scalar abzumelden, führen Sie aus\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 msgid ""
 "scalar run <task> [<enlistment>]\n"
@@ -20551,10 +20784,6 @@ msgstr "Kann keine Commit-Beschreibung für %s bekommen."
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s: kann Eltern-Commit %s nicht parsen"
 
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "Konnte '%s' nicht zu '%s' umbenennen."
-
 #, c-format
 msgid "could not revert %s... %s"
 msgstr "Konnte \"revert\" nicht auf %s... (%s) ausführen"
@@ -20884,6 +21113,9 @@ msgstr "Beim Anwenden des automatischen Stash traten Konflikte auf."
 msgid "Autostash exists; creating a new stash entry."
 msgstr "Automatischer Stash existiert; ein neuer Stash-Eintrag wird erstellt."
 
+msgid "autostash reference is a symref"
+msgstr "Referenz für autostash ist eine symbolische Referenz"
+
 msgid "could not detach HEAD"
 msgstr "konnte HEAD nicht loslösen"
 
@@ -20916,14 +21148,14 @@ msgstr ""
 "    git rebase --edit-todo\n"
 "    git rebase --continue\n"
 
-#, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "Rebase (%d/%d)%s"
-
 #, c-format
 msgid "Stopped at %s...  %.*s\n"
 msgstr "Angehalten bei %s... %.*s\n"
 
+#, c-format
+msgid "Rebasing (%d/%d)%s"
+msgstr "Rebase (%d/%d)%s"
+
 #, c-format
 msgid "unknown command %d"
 msgstr "Unbekannter Befehl %d"
@@ -21193,7 +21425,7 @@ msgstr "ignoriere Vorlage %s"
 
 #, c-format
 msgid "templates not found in %s"
-msgstr "Keine Vorlagen in %s gefunden."
+msgstr "keine Vorlagen in %s gefunden"
 
 #, c-format
 msgid "not copying templates from '%s': %s"
@@ -21203,25 +21435,31 @@ msgstr "kopiere keine Vorlagen von '%s': %s"
 msgid "invalid initial branch name: '%s'"
 msgstr "ungültiger initialer Branchname: '%s'"
 
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "Neu-Initialisierung: --initial-branch=%s ignoriert"
+
 #, c-format
 msgid "unable to handle file type %d"
 msgstr "kann nicht mit Dateityp %d umgehen"
 
 #, c-format
 msgid "unable to move %s to %s"
-msgstr "Konnte %s nicht nach %s verschieben"
+msgstr "konnte %s nicht nach %s verschieben"
 
 msgid "attempt to reinitialize repository with different hash"
 msgstr "Versuch, das Repository mit einem anderen Hash zu reinitialisieren"
 
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr ""
+"Versuch, das Repository mit einem anderen Referenzspeicherformat neu zu "
+"initialisieren"
+
 #, c-format
 msgid "%s already exists"
 msgstr "%s existiert bereits"
 
-#, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "Neu-Initialisierung: --initial-branch=%s ignoriert"
-
 #, c-format
 msgid "Reinitialized existing shared Git repository in %s%s\n"
 msgstr "Bestehendes verteiltes Git-Repository in %s%s neuinitialisiert\n"
@@ -21491,12 +21729,6 @@ msgstr ""
 "Anzahl der Einträge im Cache-Verzeichnis, die ungültig gemacht werden sollen "
 "(Standardwert 0)"
 
-msgid "unhandled options"
-msgstr "unbehandelte Optionen"
-
-msgid "error preparing revisions"
-msgstr "Fehler beim Vorbereiten der Commits"
-
 #, c-format
 msgid "commit %s is not marked reachable"
 msgstr "Commit %s ist nicht als erreichbar gekennzeichnet."
@@ -21652,9 +21884,6 @@ msgstr ""
 msgid "invalid remote service path"
 msgstr "ungültiger Remote-Service Pfad."
 
-msgid "operation not supported by protocol"
-msgstr "die Operation wird von dem Protokoll nicht unterstützt"
-
 #, c-format
 msgid "can't connect to subservice %s"
 msgstr "kann keine Verbindung zu Subservice %s herstellen"
@@ -21784,10 +22013,6 @@ msgstr "Konnte transport.color.* Konfiguration nicht parsen."
 msgid "support for protocol v2 not implemented yet"
 msgstr "Unterstützung für Protokoll v2 noch nicht implementiert."
 
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "Unbekannter Wert für Konfiguration '%s': %s"
-
 #, c-format
 msgid "transport '%s' not allowed"
 msgstr "Übertragungsart '%s' nicht erlaubt."
@@ -21841,6 +22066,9 @@ msgstr "bundle-uri Operation wird vom Protokoll nicht unterstützt"
 msgid "could not retrieve server-advertised bundle-uri list"
 msgstr "konnte die vom Server angekündigte bundle-uri-Liste nicht abrufen"
 
+msgid "operation not supported by protocol"
+msgstr "die Operation wird von dem Protokoll nicht unterstützt"
+
 msgid "too-short tree object"
 msgstr "zu kurzes Tree-Objekt"
 
@@ -22248,6 +22476,9 @@ msgstr "konnte nicht auf '%s' zugreifen"
 msgid "unable to get current working directory"
 msgstr "konnte aktuelles Arbeitsverzeichnis nicht bekommen"
 
+msgid "unable to get random bytes"
+msgstr "konnte keine Zufallsbytes abrufen"
+
 msgid "Unmerged paths:"
 msgstr "Nicht zusammengeführte Pfade:"
 
@@ -22726,6 +22957,10 @@ msgid "cannot %s: Your index contains uncommitted changes."
 msgstr ""
 "%s nicht möglich: Die Staging-Area enthält nicht committete Änderungen."
 
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "unbekannter Stil '%s' für '%s' angegeben"
+
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
 "merge"
@@ -22929,14 +23164,14 @@ msgstr ""
 "Leeren Sie den Inhalt des Bodys, wenn Sie keine Zusammenfassung senden "
 "möchten.\n"
 
-#, perl-format
-msgid "Failed to open %s: %s"
-msgstr "Fehler beim Öffnen von %s: %s"
-
 #, perl-format
 msgid "Failed to open %s.final: %s"
 msgstr "Fehler beim Öffnen von %s.final: %s"
 
+#, perl-format
+msgid "Failed to open %s: %s"
+msgstr "Fehler beim Öffnen von %s: %s"
+
 msgid "Summary email is empty, skipping it\n"
 msgstr "E-Mail mit Zusammenfassung ist leer, wird ausgelassen\n"
 
index 68a4d45fd8f6a734113f78dc26f246a1dbe48b76..736a90f6bb68e1b25f3a666513e0b2de4930cb12 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,6 +21,7 @@
 #   bypass           |  éviter d'utiliser
 #   to checkout      |  extraire
 #   cherry-pick      |  picorer
+#   chunk            |  tronçon
 #   to commit        |  valider
 #   commit-ish       |  commit ou apparenté
 #   config file      |  fichier de configuration
@@ -29,6 +30,7 @@
 #   debugging        |  débogage
 #   to deflate       |  compresser
 #   email            |  courriel
+#   enlistment       |  enrôlement
 #   entry            |  élément
 #   fanout           |  dispersion
 #   fast-forward     |  avance rapide
@@ -78,8 +80,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-16 11:48+0200\n"
-"PO-Revision-Date: 2023-08-16 11:49+0200\n"
+"POT-Creation-Date: 2024-02-16 19:18+0100\n"
+"PO-Revision-Date: 2024-02-16 19:19+0100\n"
 "Last-Translator: Cédric Malard <c.malard-git@valdun.net>\n"
 "Language-Team: Jean-Noël Avila <jn.avila@free.fr>\n"
 "Language: fr\n"
@@ -1523,6 +1525,10 @@ msgstr "l'option '%s' requiert '%s'"
 msgid "Unexpected option --output"
 msgstr "Option --output inattendue"
 
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "paramètre de commande supplémentaire '%s'"
+
 #, c-format
 msgid "Unknown archive format '%s'"
 msgstr "Format d'archive inconnu '%s'"
@@ -1568,6 +1574,14 @@ msgstr "blob gitattributes trop gros ignoré '%s'"
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "mauvais --attr-source ou GIT_ATTR_SOURCE"
 
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "fstat de '%s' impossible"
+
+#, c-format
+msgid "unable to read %s"
+msgstr "impossible de lire %s"
+
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
 msgstr "Contenu mal cité dans le fichier '%s' : %s"
@@ -1855,8 +1869,8 @@ msgid "submodule '%s': cannot create branch '%s'"
 msgstr "sous-module '%s' : impossible de créer la branche '%s'"
 
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "'%s' est déjà extrait dans '%s'"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "'%s' est déjà utilisé par l'arbre-de-travail dans '%s'"
 
 msgid "git add [<options>] [--] <pathspec>..."
 msgstr "git add [<options>] [--] <chemin>..."
@@ -1875,25 +1889,22 @@ msgstr ""
 "le réglage add.interactive.useBuiltin a été supprimé !\n"
 "Référez-vous à cette entrée dans 'git help config' pour plus de détails."
 
-msgid "Could not read the index"
-msgstr "Impossible de lire l'index"
-
-msgid "Could not write patch"
-msgstr "Impossible d'écrire le patch"
+msgid "could not read the index"
+msgstr "impossible de lire l'index"
 
 msgid "editing patch failed"
 msgstr "échec de l'édition du patch"
 
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "Stat de '%s' impossible"
+msgid "could not stat '%s'"
+msgstr "impossible de stat '%s'"
 
-msgid "Empty patch. Aborted."
-msgstr "Patch vide. Abandon."
+msgid "empty patch. aborted"
+msgstr "rustine vide. abandon"
 
 #, c-format
-msgid "Could not apply '%s'"
-msgstr "Impossible d'appliquer '%s'"
+msgid "could not apply '%s'"
+msgstr "impossible d'appliquer '%s'"
 
 msgid "The following paths are ignored by one of your .gitignore files:\n"
 msgstr ""
@@ -2027,6 +2038,9 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "fichier d'index corrompu"
 
+msgid "unable to write new index file"
+msgstr "impossible d'écrire le nouveau fichier d'index"
+
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "action invalide '%s' pour '%s'"
@@ -2236,9 +2250,6 @@ msgstr ""
 "Vous pouvez lancer 'git rm' sur un fichier \"supprimé par eux\" pour "
 "accepter son état."
 
-msgid "unable to write new index file"
-msgstr "impossible d'écrire le nouveau fichier d'index"
-
 #, c-format
 msgid "Could not parse object '%s'."
 msgstr "Impossible d'analyser l'objet '%s'."
@@ -2257,10 +2268,6 @@ msgstr ""
 msgid "failed to read '%s'"
 msgstr "échec de la lecture de '%s'"
 
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "les options '%s=%s' et '%s=%s' ne peuvent pas être utilisées ensemble"
-
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<options>] [(<mbox> | <Maildir>)...]"
 
@@ -2414,7 +2421,7 @@ msgid "git archive: expected a flush"
 msgstr "git archive : vidage attendu"
 
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
 "git bisect start [--term-{new,bad}=<terme> --term-{old,good}=<terme>]    [--"
@@ -2433,8 +2440,8 @@ msgstr "git bisect reset [<commit>]"
 msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <fichier-journal>"
 
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <cmd>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <cmd>  [<arg>...]"
 
 #, c-format
 msgid "cannot open file '%s' in mode '%s'"
@@ -2861,44 +2868,46 @@ msgstr "git branch [<options>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
 "suppression de la branche '%s' qui a été fusionnée dans\n"
-"         '%s', mais pas dans HEAD."
+"         '%s', mais pas encore dans HEAD"
 
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
-"branche '%s' non supprimée car elle n'a pas été fusionnée dans\n"
-"         '%s', même si elle est fusionnée dans HEAD."
+"branche '%s' non supprimée car elle n'a pas encore été fusionnée dans\n"
+"         '%s', même si elle est fusionnée dans HEAD"
 
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
-msgstr "Impossible de rechercher l'objet commit pour '%s'"
+msgid "couldn't look up commit object for '%s'"
+msgstr "impossible de rechercher l'objet commit pour '%s'"
 
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
-msgstr ""
-"La branche '%s' n'est pas totalement fusionnée.\n"
-"Si vous souhaitez réellement la supprimer, lancez 'git branch -D %s'."
+msgid "the branch '%s' is not fully merged"
+msgstr "la branche '%s' n'est pas complètement fusionnée"
+
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
+msgstr "Si vous souhaitez réellement la supprimer, lancez 'git branch -D %s'"
 
-msgid "Update of config-file failed"
-msgstr "Ã\89chec de la mise à jour du fichier de configuration"
+msgid "update of config-file failed"
+msgstr "échec de la mise à jour du fichier de configuration"
 
 msgid "cannot use -a with -d"
 msgstr "impossible d'utiliser -a avec -d"
 
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "Impossible de supprimer la branche '%s' extraite dans '%s'"
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr ""
+"impossible de supprimer la branche '%s' utilisée par l'arbre-de-travail dans "
+"'%s'"
 
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "branche de suivi '%s' non trouvée."
+msgid "remote-tracking branch '%s' not found"
+msgstr "branche de suivi '%s' non trouvée"
 
 #, c-format
 msgid ""
@@ -2909,8 +2918,8 @@ msgstr ""
 "Avez-vous oublié --remote ?"
 
 #, c-format
-msgid "branch '%s' not found."
-msgstr "branche '%s' non trouvée."
+msgid "branch '%s' not found"
+msgstr "branche '%s' non trouvée"
 
 #, c-format
 msgid "Deleted remote-tracking branch %s (was %s).\n"
@@ -2931,55 +2940,55 @@ msgid "HEAD (%s) points outside of refs/heads/"
 msgstr "HEAD (%s) pointe hors de refs/heads/"
 
 #, c-format
-msgid "Branch %s is being rebased at %s"
-msgstr "La branche %s est en cours de rebasage sur %s"
+msgid "branch %s is being rebased at %s"
+msgstr "la branche %s est en cours de rebasage sur %s"
 
 #, c-format
-msgid "Branch %s is being bisected at %s"
-msgstr "La branche %s est en cours de bissection sur %s"
+msgid "branch %s is being bisected at %s"
+msgstr "la branche %s est en cours de bissection sur %s"
 
 #, c-format
 msgid "HEAD of working tree %s is not updated"
 msgstr "la HEAD de la copie de travail %s n'est pas mise à jour"
 
 #, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Nom de branche invalide : '%s'"
+msgid "invalid branch name: '%s'"
+msgstr "nom de branche invalide : '%s'"
 
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Aucun commit sur la branche '%s'."
+msgid "no commit on branch '%s' yet"
+msgstr "aucun commit encore sur la branche '%s'"
 
 #, c-format
-msgid "No branch named '%s'."
-msgstr "Aucune branche nommée '%s'."
+msgid "no branch named '%s'"
+msgstr "aucune branche nommée '%s'"
 
-msgid "Branch rename failed"
-msgstr "Ã\89chec de renommage de la branche"
+msgid "branch rename failed"
+msgstr "échec de renommage de la branche"
 
-msgid "Branch copy failed"
-msgstr "Ã\89chec de copie de la branche"
+msgid "branch copy failed"
+msgstr "échec de copie de la branche"
 
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "Création d'une copie d'une branche mal nommée '%s'"
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "création d'une copie d'une branche mal nommée '%s'"
 
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
-msgstr "Renommage d'une branche mal nommée '%s'"
+msgid "renamed a misnamed branch '%s' away"
+msgstr "renommage d'une branche mal nommée '%s'"
 
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "La branche a été renommée en %s, mais HEAD n'est pas mise à jour !"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "la branche a été renommée en %s, mais HEAD n'est pas mise à jour"
 
-msgid "Branch is renamed, but update of config-file failed"
+msgid "branch is renamed, but update of config-file failed"
 msgstr ""
-"La branche est renommée, mais la mise à jour du fichier de configuration a "
+"la branche est renommée, mais la mise à jour du fichier de configuration a "
 "échoué"
 
-msgid "Branch is copied, but update of config-file failed"
+msgid "branch is copied, but update of config-file failed"
 msgstr ""
-"La branche est copiée, mais la mise à jour du fichier de configuration a "
+"la branche est copiée, mais la mise à jour du fichier de configuration a "
 "échoué"
 
 #, c-format
@@ -3094,8 +3103,8 @@ msgstr "parcourir récursivement les sous-modules"
 msgid "format to use for the output"
 msgstr "format à utiliser pour la sortie"
 
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "Ã\89chec de résolution de HEAD comme référence valide."
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "échec de résolution de HEAD comme référence valide"
 
 msgid "HEAD not found below refs/heads!"
 msgstr "HEAD non trouvée sous refs/heads !"
@@ -3113,17 +3122,17 @@ msgstr "--recurse-submodules ne peut être utilisé que pour créer des branches
 msgid "branch name required"
 msgstr "le nom de branche est requis"
 
-msgid "Cannot give description to detached HEAD"
-msgstr "Impossible de décrire une HEAD détachée"
+msgid "cannot give description to detached HEAD"
+msgstr "impossible de décrire une HEAD détachée"
 
 msgid "cannot edit description of more than one branch"
 msgstr "impossible d'éditer la description de plus d'une branche"
 
-msgid "cannot copy the current branch while not on any."
-msgstr "impossible de copier la branche actuelle, il n'y en a pas."
+msgid "cannot copy the current branch while not on any"
+msgstr "impossible de copier la branche actuelle, il n'y en a pas"
 
-msgid "cannot rename the current branch while not on any."
-msgstr "impossible de renommer la branche actuelle, il n'y en a pas."
+msgid "cannot rename the current branch while not on any"
+msgstr "impossible de renommer la branche actuelle, il n'y en a pas"
 
 msgid "too many branches for a copy operation"
 msgstr "trop de branches pour une opération de copie"
@@ -3136,10 +3145,10 @@ msgstr "trop d'arguments pour spécifier une branche amont"
 
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
 "impossible de spécifier une branche amont de HEAD par %s qui ne pointe sur "
-"aucune branche."
+"aucune branche"
 
 #, c-format
 msgid "no such branch '%s'"
@@ -3152,29 +3161,29 @@ msgstr "la branche '%s' n'existe pas"
 msgid "too many arguments to unset upstream"
 msgstr "trop d'arguments pour désactiver un amont"
 
-msgid "could not unset upstream of HEAD when it does not point to any branch."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
 msgstr ""
 "impossible de désactiver une branche amont de HEAD quand elle ne pointe sur "
-"aucune branche."
+"aucune branche"
 
 #, c-format
-msgid "Branch '%s' has no upstream information"
-msgstr "La branche '%s' n'a aucune information de branche amont"
+msgid "branch '%s' has no upstream information"
+msgstr "la branche '%s' n'a aucune information de branche amont"
 
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
-"Les options -a et -r de 'git branch' n'ont pas de sens avec un nom de "
+"les options -a et -r de 'git branch' n'ont pas de sens avec un nom de "
 "branche.\n"
 "Vouliez-vous plutôt dire -a|-r --list <motif> ?"
 
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
 "l'option '--set-upstream' est obsolète. Utilisez '--track' ou '--set-"
-"upstream-to' à la place."
+"upstream-to' à la place"
 
 msgid "git version:\n"
 msgstr "version git ::\n"
@@ -3251,6 +3260,10 @@ msgstr "spécifier la destination du/des fichier(s) de rapport de bogue"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "spécifier une suffixe au format strftime pour le(s) nom(s) de fichier"
 
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "argument inconnu '%s'"
+
 #, c-format
 msgid "could not create leading directories for '%s'"
 msgstr "impossible de créer les répertoires de premier niveau pour '%s'"
@@ -3357,6 +3370,13 @@ msgstr "git cat-file (-e | -p) <objet>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <objet>"
 
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<chemin|arbresque> | --path=<chemin|arbresque> <rev>]"
+
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
 "objects]\n"
@@ -3368,13 +3388,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<chemin|arbresque> | --path=<chemin|arbresque> <rev>]"
-
 msgid "Check object existence or emit object contents"
 msgstr "Vérifie l'existence d'un objet ou émettre le contenu de l'objet"
 
@@ -3675,6 +3688,12 @@ msgstr "'%s' ne peut pas être utilisé quand '%s' n'est pas spécifié"
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "'%s' ou '%s' ne peut pas être utilisé avec %s"
 
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr ""
+"'%s', '%s' ou '%s' ne peuvent pas être utilisés lors de l'extraction d'un "
+"arbre"
+
 #, c-format
 msgid "path '%s' is unmerged"
 msgstr "le chemin '%s' n'est pas fusionné"
@@ -3930,8 +3949,8 @@ msgstr "forcer l'extraction (laisser tomber les modifications locales)"
 msgid "new-branch"
 msgstr "nouvelle branche"
 
-msgid "new unparented branch"
-msgstr "nouvelle branche sans parent"
+msgid "new unborn branch"
+msgstr "nouvelle branche non née"
 
 msgid "update ignored files (default)"
 msgstr "mettre à jour les fichiers ignorés (par défaut)"
@@ -4185,9 +4204,6 @@ msgstr ""
 "clean.requireForce à true par défaut et ni -i, -n ou -f fourni ; refus de "
 "nettoyer"
 
-msgid "-x and -X cannot be used together"
-msgstr "-x et -X ne peuvent pas être utilisés ensemble"
-
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<options>] [--] <dépôt> [<répertoire>]"
 
@@ -4278,6 +4294,9 @@ msgstr "gitdir"
 msgid "separate git dir from working tree"
 msgstr "séparer le répertoire git de la copie de travail"
 
+msgid "specify the reference format to use"
+msgstr "spécifier le format de réference à utiliser"
+
 msgid "key=value"
 msgstr "clé=valeur"
 
@@ -4400,12 +4419,9 @@ msgstr "Trop d'arguments."
 msgid "You must specify a repository to clone."
 msgstr "Vous devez spécifier un dépôt à cloner."
 
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"--bundle-uri est incompatible avec --depth, --shallow-since, et --shallow-"
-"exclude"
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "Format de stockage de réf inconnu '%s'"
 
 #, c-format
 msgid "repository '%s' does not exist"
@@ -4539,14 +4555,14 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <rép>] [--append]\n"
 "                       [--split[=<stratégie>]] [--reachable | --stdin-packs "
 "| --stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <options de division>"
+"                       <options-de-division>"
 
 msgid "dir"
 msgstr "répertoire"
@@ -4562,6 +4578,10 @@ msgstr ""
 msgid "Could not open commit-graph '%s'"
 msgstr "Impossible d'ouvrir le graphe de commit '%s'"
 
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "impossible d'ouvrir le graphe de commit '%s'"
+
 #, c-format
 msgid "unrecognized --split argument, %s"
 msgstr "argument de --split non reconnu, %s"
@@ -4762,9 +4782,6 @@ msgstr "impossible de mettre à jour l'index temporaire"
 msgid "Failed to update main cache tree"
 msgstr "Impossible de mettre à jour l'arbre de cache principal"
 
-msgid "unable to write new_index file"
-msgstr "impossible d'écrire le fichier new_index"
-
 msgid "cannot do a partial commit during a merge."
 msgstr "impossible de faire une validation partielle pendant une fusion."
 
@@ -5174,11 +5191,11 @@ msgstr ""
 
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
-"le dépôt a été mis à jour, mais impossible d'écrire le fichier\n"
-"new_index. Vérifiez que le disque n'est pas plein ou que le quota\n"
+"le dépôt a été mis à jour, mais impossible d'écrire le nouveau fichier\n"
+"d'index. Vérifiez que le disque n'est pas plein ou que le quota\n"
 "n'a pas été dépassé, puis lancez \"git restore --staged :/\" pour réparer."
 
 msgid "git config [<options>]"
@@ -6644,6 +6661,9 @@ msgstr "élaguer les objets non référencés"
 msgid "pack unreferenced objects separately"
 msgstr "empaqueter les objets non référencés séparément"
 
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "avec --cruft, limiter la taille des nouveaux paquets déchets"
+
 msgid "be more thorough (increased runtime)"
 msgstr "être plus consciencieux (durée de traitement allongée)"
 
@@ -6823,12 +6843,6 @@ msgstr ""
 msgid "'crontab' died"
 msgstr "'crontab' est mort"
 
-msgid "failed to start systemctl"
-msgstr "échec du démarrage de systemctl"
-
-msgid "failed to run systemctl"
-msgstr "échec pour lancer systemctl"
-
 #, c-format
 msgid "failed to delete '%s'"
 msgstr "échec de la suppression de '%s'"
@@ -6837,6 +6851,12 @@ msgstr "échec de la suppression de '%s'"
 msgid "failed to flush '%s'"
 msgstr "échec du flush de '%s'"
 
+msgid "failed to start systemctl"
+msgstr "échec du démarrage de systemctl"
+
+msgid "failed to run systemctl"
+msgstr "échec pour lancer systemctl"
+
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
 msgstr "argument '%s' de --scheduler non reconnu"
@@ -6862,6 +6882,9 @@ msgstr "planificateur"
 msgid "scheduler to trigger git maintenance run"
 msgstr "planificateur qui lancera les maintenances git"
 
+msgid "failed to set up maintenance schedule"
+msgstr "impossible de mettre en place la planification de maintenance"
+
 msgid "failed to add repo to global config"
 msgstr "échec de l'ajout du dépôt à la config globale"
 
@@ -6892,6 +6915,10 @@ msgstr "pas de support des fils, ignore %s"
 msgid "unable to read tree (%s)"
 msgstr "impossible de lire l'arbre (%s)"
 
+#, c-format
+msgid "unable to read tree %s"
+msgstr "impossible de lire l'arbre %s"
+
 #, c-format
 msgid "unable to grep from object of type %s"
 msgstr "impossible de faire un grep sur un objet de type %s"
@@ -6936,8 +6963,8 @@ msgstr "traiter les fichiers binaires avec les filtres textconv"
 msgid "search in subdirectories (default)"
 msgstr "rechercher dans les sous-répertoires (défaut)"
 
-msgid "descend at most <depth> levels"
-msgstr "descendre au plus de <profondeur> dans l'arborescence"
+msgid "descend at most <n> levels"
+msgstr "descendre au plus de <n> niveaux"
 
 msgid "use extended POSIX regular expressions"
 msgstr "utiliser des expressions régulières étendues POSIX"
@@ -7310,10 +7337,6 @@ msgstr "grave incohérence dans la décompression (inflate)"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "COLLISION SHA1 TROUVÉE AVEC %s !"
 
-#, c-format
-msgid "unable to read %s"
-msgstr "impossible de lire %s"
-
 #, c-format
 msgid "cannot read existing object info %s"
 msgstr "impossible de lire l'information existante de l'objet %s"
@@ -7455,12 +7478,14 @@ msgstr "erreur de fsck dans les objets paquets"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<répertoire-modèle>]\n"
-"         [--separate-git-dir <rép-git>] [--object-format=<format>]\\n\"\n"
-"         [-b <nom-de-branche> | --initial-branch=<nom-de-branche>]\\n\"\n"
+"git init [-q | --quiet] [--bare] [--template=<répertoire-de-modèles>]\n"
+"         [--separate-git-dir <rép-git>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
+"         [-b <nom-de-branch> | --initial-branch=<nom-de-branche>]\n"
 "         [--shared[=<permissions>]] [<répertoire>]"
 
 msgid "permissions"
@@ -7503,11 +7528,12 @@ msgstr "--separate-git-dir est incompatible avec un dépôt nu"
 
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <symbole>[(=|:)<valeur>])...]\n"
+"                       [(--trailer (<clé>|<alias-de-clé>)"
+"[(=|:)<valeur>])...]\n"
 "                       [--parse] [<fichier>...]"
 
 msgid "edit files in place"
@@ -7516,6 +7542,9 @@ msgstr "éditer les fichiers sur place"
 msgid "trim empty trailers"
 msgstr "éliminer les lignes de fin vides"
 
+msgid "placement"
+msgstr "placement"
+
 msgid "where to place the new trailer"
 msgstr "où placer les nouvelles lignes terminales"
 
@@ -7528,17 +7557,19 @@ msgstr "action si les lignes terminales manquent"
 msgid "output only the trailers"
 msgstr "éliminer les lignes terminales vides"
 
-msgid "do not apply config rules"
-msgstr "ne pas appliquer les règles de la configuration"
+msgid "do not apply trailer.* configuration variables"
+msgstr "ne pas appliquer les variables de configuration trailer.*"
 
-msgid "join whitespace-continued values"
-msgstr "joindre les valeurs continuées avec des caractères blancs"
+msgid "reformat multiline trailer values as single-line values"
+msgstr ""
+"reformatter les valeurs de ligne terminales multi-lignes en valeurs sur une "
+"seule ligne"
 
-msgid "set parsing options"
-msgstr "paramètres d'analyse"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "alias pour --only-trailers --only-input --unfold"
 
-msgid "do not treat --- specially"
-msgstr "ne pas traiter spécialement ---"
+msgid "do not treat \"---\" as the end of input"
+msgstr "ne pas traiter \"---\" comme la fin d'entrée"
 
 msgid "trailer(s) to add"
 msgstr "ligne(s) de fin à ajouter"
@@ -7628,6 +7659,10 @@ msgstr "exactement une plage nécessaire"
 msgid "not a range"
 msgstr "ceci n'est pas une plage"
 
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "lecture du fichier de description de branche '%s' impossible"
+
 msgid "cover letter needs email format"
 msgstr "la lettre de motivation doit être au format courriel"
 
@@ -7734,6 +7769,9 @@ msgstr ""
 "générer des parties de la lettre d'introduction à partir de la description "
 "de la branche"
 
+msgid "use branch description from file"
+msgstr "utiliser la description de branche dans le fichier"
+
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "utiliser [<préfixe>] au lieu de [PATCH]"
 
@@ -8177,9 +8215,19 @@ msgstr ""
 "git merge-file [<options>] [-L <nom1> [-L <orig> [-L <nom2>]]] <fichier1> "
 "<fichier-orig> <fichier2>"
 
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"l'option diff-algorithm accept \"myers\", \"minimal\", \"patience\" et "
+"\"histogram\""
+
 msgid "send results to standard output"
 msgstr "envoyer les résultats sur la sortie standard"
 
+msgid "use object IDs instead of filenames"
+msgstr "utiliser les IDs d'objet au lieu de noms de fichier"
+
 msgid "use a diff3 based merge"
 msgstr "utiliser une fusion basée sur diff3"
 
@@ -8195,6 +8243,12 @@ msgstr "pour les conflits, utiliser leur version (their)"
 msgid "for conflicts, use a union version"
 msgstr "pour les conflits, utiliser l'ensemble des versions"
 
+msgid "<algorithm>"
+msgstr "<algorithme>"
+
+msgid "choose a diff algorithm"
+msgstr "choisir un algorithme de différence"
+
 msgid "for conflicts, use this marker size"
 msgstr "pour les conflits, utiliser cette taille de marqueur"
 
@@ -8204,6 +8258,13 @@ msgstr "ne pas avertir à propos des conflits"
 msgid "set labels for file1/orig-file/file2"
 msgstr "définir les labels pour fichier1/fichier-orig/fichier2"
 
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "l'objet '%s' n'existe pas"
+
+msgid "Could not write object file"
+msgstr "impossible d'écrire le fichier d'objet"
+
 #, c-format
 msgid "unknown option %s"
 msgstr "option inconnue %s"
@@ -8265,11 +8326,18 @@ msgstr "réaliser des fusions multiples, une par ligne d'entrée"
 msgid "specify a merge-base for the merge"
 msgstr "spécifier une base de fusion pour la fusion"
 
+msgid "option=value"
+msgstr "option=valeur"
+
+msgid "option for selected merge strategy"
+msgstr "option pour la stratégie de fusion sélectionnée"
+
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge est incompatible avec d'autres options"
 
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base est incompatible avec --stdin"
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "option de stratégie inconnue : -X%s"
 
 #, c-format
 msgid "malformed input line: '%s'."
@@ -8339,12 +8407,6 @@ msgstr "stratégie"
 msgid "merge strategy to use"
 msgstr "stratégie de fusion à utiliser"
 
-msgid "option=value"
-msgstr "option=valeur"
-
-msgid "option for selected merge strategy"
-msgstr "option pour la stratégie de fusion sélectionnée"
-
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr ""
 "message de validation de la fusion (pour une fusion sans avance rapide)"
@@ -8405,10 +8467,6 @@ msgstr "Impossible d'écrire l'index."
 msgid "Not handling anything other than two heads merge."
 msgstr "Impossible de gérer autre chose que la fusion de deux têtes."
 
-#, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "option de stratégie inconnue : -X%s"
-
 #, c-format
 msgid "unable to write %s"
 msgstr "impossible d'écrire %s"
@@ -8710,8 +8768,8 @@ msgstr "la destination existe"
 msgid "can not move directory into itself"
 msgstr "impossible de déplacer un répertoire dans lui-même"
 
-msgid "cannot move directory over file"
-msgstr "impossible de déplacer un répertoire sur un fichier"
+msgid "destination already exists"
+msgstr "la destination existe déjà"
 
 msgid "source directory is empty"
 msgstr "le répertoire source est vide"
@@ -9227,6 +9285,10 @@ msgstr "Compression des objets"
 msgid "inconsistency with delta count"
 msgstr "inconsistance dans le compte de delta"
 
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "valeur invalide de pack.allowPackReuse : '%s'"
+
 #, c-format
 msgid ""
 "value of uploadpack.blobpackfileuri must be of the form '<object-hash> <pack-"
@@ -9471,9 +9533,6 @@ msgstr "la taille limite minimale d'un paquet est 1 MiB"
 msgid "--thin cannot be used to build an indexable pack"
 msgstr "--thin ne peut pas être utilisé pour construire un paquet indexable"
 
-msgid "cannot use --filter without --stdout"
-msgstr "impossible d'utiliser --filter sans --stdout"
-
 msgid "cannot use --filter with --stdin-packs"
 msgstr "impossible d'utiliser --filter avec --stdin-packs"
 
@@ -9487,19 +9546,16 @@ msgstr "impossible d'utiliser une liste interne de révisions avec --cruft"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "impossible d'utiliser --stdin-packs avec --cruft"
 
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "impossible d'utiliser --max-pack-size avec --cruft"
-
 msgid "Enumerating objects"
 msgstr "Énumération des objets"
 
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Total %<PRIu32> (delta %<PRIu32>), réutilisés %<PRIu32> (delta %<PRIu32>), "
-"réutilisés du pack %<PRIu32>"
+"réutilisés du paquet %<PRIu32> (depuis %<PRIuMAX>)"
 
 msgid ""
 "'git pack-redundant' is nominated for removal.\n"
@@ -10488,16 +10544,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "l'option `C' attend un valeur numérique"
 
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy requiert --merge ou --interactive"
-
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"les options d'application sont incompatibles avec rebase.autoSquash. "
-"Considérez l'ajout de --no-autosquash"
-
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
 "no-rebase-merges"
@@ -11213,6 +11259,10 @@ msgstr "impossible de fermer le fichier temporaire d'instantané des réfs"
 msgid "could not remove stale bitmap: %s"
 msgstr "impossible de revenir la bitmap obsolète : %s"
 
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "le préfixe %s ne commence pas avec objdir %s"
+
 msgid "pack everything in a single pack"
 msgstr "empaqueter tout dans un seul paquet"
 
@@ -11290,16 +11340,19 @@ msgstr "écrire un index de multi-paquet des paquets résultants"
 msgid "pack prefix to store a pack containing pruned objects"
 msgstr "préfixe de paquet pour stocker un paquet contenant les objets élagués"
 
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "préfixe de paquet pour stocker un paquet contenant les objets filtrés"
+
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "impossible de supprimer les paquets dans un dépôt d'objets précieux"
 
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "l'option '%s' ne peut être utilisé qu'avec '%s'"
+
 msgid "Nothing new to pack."
 msgstr "Rien de neuf à empaqueter."
 
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "le préfixe %s ne commence pas avec objdir %s"
-
 #, c-format
 msgid "renaming pack to '%s' failed"
 msgstr "le renommage du paquet en '%s' a échoué"
@@ -11500,6 +11553,77 @@ msgstr "--convert-graft-file ne supporte aucun argument"
 msgid "only one pattern can be given with -l"
 msgstr "-l n'accepte qu'un motifs"
 
+msgid "need some commits to replay"
+msgstr "commits requis pour pouvoir rejouer"
+
+msgid "--onto and --advance are incompatible"
+msgstr "--onto et --advance sont incompatibles"
+
+msgid "all positive revisions given must be references"
+msgstr "toutes les révisions positives fournies doivent être des références"
+
+msgid "argument to --advance must be a reference"
+msgstr "l'argument de --advance doit être une référence"
+
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"impossible d'avancer la cible avec des sources multiples parce l'ordre ne "
+"serait pas total"
+
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr ""
+"impossible de déterminer implicitement s'il y a une opération --advance ou --"
+"onto"
+
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"impossible d'avancer la cible sur des branches sources multiples parce que "
+"l'ordre ne serait pas total"
+
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "impossible de déterminer implicitement une base correcte pour --onto"
+
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <nouvelle-base> | --advance "
+"<branche>) <plage-de-révision>..."
+
+msgid "make replay advance given branch"
+msgstr "faire rejouer en avançant la branche indiquée"
+
+msgid "replay onto given commit"
+msgstr "rejouer par-dessus le commit indiqué"
+
+msgid "advance all branches contained in revision-range"
+msgstr "avancer toutes les branches contenues dans la plage-de-révisions"
+
+msgid "option --onto or --advance is mandatory"
+msgstr "une option --onto ou --advance est obligatoire"
+
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"certaines options de parcours de révs seront surchargées car le bit '%s' "
+"dans 'struct rev_info' sera forcé"
+
+msgid "error preparing revisions"
+msgstr "erreur lors de la préparation des révisions"
+
+msgid "replaying down to root commit is not supported yet!"
+msgstr "rejouer jusqu'au commit racine n'est pas encore géré !"
+
+msgid "replaying merge commits is not supported yet!"
+msgstr "rejouer des commits de fusion n'est pas encore géré !"
+
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
 msgstr ""
@@ -11711,18 +11835,12 @@ msgstr "--prefix exige un argument"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "mode inconnu pour --abbrev-ref : %s"
 
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden ne peut être utilisé avec --branches"
-
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden ne peut pas être utilisé avec --tags"
-
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden ne peut pas être utilisé avec --remotes"
-
 msgid "this operation must be run in a work tree"
 msgstr "cette opération doit être effectuée dans un arbre de travail"
 
+msgid "Could not read the index"
+msgstr "Impossible de lire l'index"
+
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
 msgstr "mode inconnu pour --show-object-format : %s"
@@ -12072,23 +12190,44 @@ msgid "Unknown hash algorithm"
 msgstr "Algorithme d'empreinte inconnu"
 
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<motif>...]"
 
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<motif>]"
 
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <réf>"
+
+msgid "reference does not exist"
+msgstr "la référence n'existe pas"
+
+msgid "failed to look up reference"
+msgstr "échec de la recherche de la référence"
+
 msgid "only show tags (can be combined with heads)"
 msgstr "afficher seulement les étiquettes (peut être combiné avec heads)"
 
 msgid "only show heads (can be combined with tags)"
 msgstr "afficher seulement les têtes (peut être combiné avec tags)"
 
+msgid "check for reference existence without resolving"
+msgstr "vérifier l'existence de la référence sans la résoudre"
+
 msgid "stricter reference checking, requires exact ref path"
 msgstr ""
 "vérification de référence plus stricte, nécessite un chemin de référence "
@@ -12935,6 +13074,9 @@ msgstr ""
 "[no-]recommend-shallow] [--reference <dépôt>] [--recursive] [--[no-]single-"
 "branch] [--] [<chemin>...]"
 
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "Échec de résolution de HEAD comme référence valide."
+
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<options>] [<chemin>...]"
 
@@ -13413,6 +13555,9 @@ msgstr "(pour porcelaines) oublier les conflits sauvés et non résolus"
 msgid "write index in this format"
 msgstr "écrire l'index dans ce format"
 
+msgid "report on-disk index format version"
+msgstr "afficher la version du format d'index sur disque"
+
 msgid "enable or disable split index"
 msgstr "activer ou désactiver l'index scindé"
 
@@ -13438,6 +13583,14 @@ msgstr "marquer les fichiers comme valides pour fsmonitor"
 msgid "clear fsmonitor valid bit"
 msgstr "effacer le bit de validité fsmonitor"
 
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "index-version : précédemment %d, mis à %d"
+
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
 "enable split index"
@@ -13596,28 +13749,28 @@ msgstr "Aucune branche source possible, activation de '--orphan'"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
 "Si vous vouliez créer un arbre-de-travail contenant une nouvelle branche\n"
-"orpheline (une branche sans commit) pour ce dépôt, vous pouvez le faire\n"
+"non-née (une branche sans commit) pour ce dépôt, vous pouvez le faire\n"
 "en utilisant le drapeau --orphan :\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
 "Si vous vouliez créer un arbre-de-travail contenant une nouvelle branche\n"
-"orpheline (une branche sans commit) pour ce dépôt, vous pouvez le faire\n"
+"non-née (une branche sans commit) pour ce dépôt, vous pouvez le faire\n"
 "en utilisant le drapeau --orphan :\n"
 "\n"
 "    git worktree add --orphan %s\n"
@@ -13679,6 +13832,10 @@ msgstr "impossible de créer le répertoire de '%s'"
 msgid "initializing"
 msgstr "initialisation"
 
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "impossible de trouver l'arbre-de-travail créé '%s'"
+
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
 msgstr "Préparation de l'arbre de travail (nouvelle branche '%s')"
@@ -13713,15 +13870,12 @@ msgstr ""
 
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
 "Aucune réf locale ou distant n'existe malgré la présence d'au moins un "
 "distant,\n"
-"on arrête ; utilisez 'add -f' pour passe outre ou récupérer le distant avant"
-
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "'%s' et '%s' ne peuvent pas être utilisées ensemble"
+"on arrête ; utilisez 'add -f' pour passe outre ou récupérer le distant en "
+"premier"
 
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr ""
@@ -13734,8 +13888,8 @@ msgstr "créer une nouvelle branche"
 msgid "create or reset a branch"
 msgstr "créer ou réinitialiser une branche"
 
-msgid "create unborn/orphaned branch"
-msgstr "créer une branche non née/orpheline"
+msgid "create unborn branch"
+msgstr "créer une branche non née"
 
 msgid "populate the new working tree"
 msgstr "remplissage de la nouvelle copie de travail"
@@ -13757,11 +13911,9 @@ msgid "options '%s', '%s', and '%s' cannot be used together"
 msgstr "les options '%s', '%s' et '%s' ne peuvent pas être utilisées ensemble"
 
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "les options '%s' et '%s' ne peuvent pas être utilisées ensemble"
-
-msgid "<commit-ish>"
-msgstr "<commit-esque>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr ""
+"l'option '%s' et des commit-esques ne peuvent pas être utilisés ensemble"
 
 msgid "added with --lock"
 msgstr "ajouté avec --lock"
@@ -14042,17 +14194,21 @@ msgstr "l'index de groupe a disparu"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "l'identifiant de terminaison de tronçon apparaît plus tôt qu'attendu"
 
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "id de tronçon %<PRIx32> non alignés sur %d octets"
+
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
-msgstr "décalage(s) de section incorrect(s) %<PRIx64> et %<PRIx64>"
+msgstr "décalage(s) de tronçon incorrect(s) %<PRIx64> et %<PRIx64>"
 
 #, c-format
 msgid "duplicate chunk ID %<PRIx32> found"
-msgstr "ID de section dupliqué %<PRIx32>"
+msgstr "ID de tronçon dupliqué %<PRIx32>"
 
 #, c-format
 msgid "final chunk has non-zero id %<PRIx32>"
-msgstr "la section finale a un id non nul %<PRIx32>"
+msgstr "le tronçon final a un id non nul %<PRIx32>"
 
 msgid "invalid hash version"
 msgstr "version d'empreinte invalide"
@@ -14097,10 +14253,8 @@ msgstr ""
 msgid "Move objects and refs by archive"
 msgstr "Déplacer les objets et références par archive"
 
-msgid "Provide content or type and size information for repository objects"
-msgstr ""
-"Fournir le contenu ou l'information de type et taille pour les objets du "
-"dépôt"
+msgid "Provide contents or details of repository objects"
+msgstr "Fournir le contenu ou les détails des objets du dépôt"
 
 msgid "Display gitattributes information"
 msgstr "Afficher les informations gitattributes"
@@ -14400,6 +14554,11 @@ msgstr "Empaqueter les objets non-empaquetés d'un dépôt"
 msgid "Create, list, delete refs to replace objects"
 msgstr "Créer, lister, supprimer des référence pour remplacer des objets"
 
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"EXPÉRIMENTAL ; rejoue des commits sur une nouvelle base, fonctionne aussi "
+"avec les dépôts nus"
+
 msgid "Generates a summary of pending changes"
 msgstr "Générer une résumé des modifications en attentes"
 
@@ -14524,7 +14683,7 @@ msgstr "Vérifier la signature GPG d'étiquettes"
 msgid "Display version information about Git"
 msgstr "Afficher l'information de version à propos de Git"
 
-msgid "Show logs with difference each commit introduces"
+msgid "Show logs with differences each commit introduces"
 msgstr "Afficher les journaux avec la différence que chaque commit introduit"
 
 msgid "Manage multiple working trees"
@@ -14561,7 +14720,7 @@ msgid "The bundle file format"
 msgstr "le format du fichier de colis"
 
 msgid "Chunk-based file formats"
-msgstr "format de fichier avec des sections"
+msgstr "format de fichier avec des tronçons"
 
 msgid "Git commit-graph format"
 msgstr "format de graphe de commit de Git"
@@ -14642,6 +14801,35 @@ msgstr "Un outil pour gérer les grands dépôts Git"
 msgid "commit-graph file is too small"
 msgstr "le graphe de commit est trop petit"
 
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr ""
+"le tronçon de distribution d'oid du graphe de commit n'a pas la bonne taille"
+
+msgid "commit-graph fanout values out of order"
+msgstr "les valeurs de distribution du graphe de commit sont désordonnées"
+
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr ""
+"le tronçon de recherche de l'OID du graphe de commits n'a pas la bonne taille"
+
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "le tronçon de données du graphe de commit n'a pas la bonne taille"
+
+msgid "commit-graph generations chunk is wrong size"
+msgstr "le tronçon des générations du graphe de commit n'a pas la bonne taille"
+
+msgid "commit-graph changed-path index chunk is too small"
+msgstr ""
+"le tronçon d'index des chemins modifiés du graphe de commit est trop petit"
+
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"tronçon de chemin modifié dans le fichier de graphe de commits trop petit "
+"((%<PRIuMAX> < %<PRIuMAX>)) ignoré"
+
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
 msgstr ""
@@ -14659,10 +14847,28 @@ msgstr ""
 
 #, c-format
 msgid "commit-graph file is too small to hold %u chunks"
-msgstr "le graphe de commit est trop petit pour contenir %u sections"
+msgstr "le graphe de commit est trop petit pour contenir %u tronçons"
+
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr ""
+"le tronçon de distribution des OID requis du graphe de commits est manquant "
+"ou corrompu"
+
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr ""
+"le tronçon de recherche OID requis par le graphe de commits est manquant ou "
+"corrompu"
+
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr ""
+"le tronçon d'étalement OID requis par le graphe de commits est manquant ou "
+"corrompu"
 
 msgid "commit-graph has no base graphs chunk"
-msgstr "le graphe de commit n'a pas de section de graphes de base"
+msgstr "le graphe de commit n'a pas de tronçon de graphes de base"
+
+msgid "commit-graph base graphs chunk is too small"
+msgstr "le tronçon de graphes de base du graphe de commit est trop petit"
 
 msgid "commit-graph chain does not match"
 msgstr "la chaîne de graphe de commit ne correspond pas"
@@ -14671,6 +14877,9 @@ msgstr "la chaîne de graphe de commit ne correspond pas"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "nombre de commits dans le graphe de base trop haut : %<PRIuMAX>"
 
+msgid "commit-graph chain file too small"
+msgstr "la chaine du graphe de commit est trop petite"
+
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
 msgstr ""
@@ -14693,6 +14902,14 @@ msgstr ""
 "le graphe de commits requiert des données de génération de débordement mais "
 "n'en contient pas"
 
+msgid "commit-graph overflow generation data is too small"
+msgstr ""
+"les données de génération de débordement du graphe de commits sont trop "
+"petites"
+
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "pointeur hors-gamme d'arêtes supplémentaires du graphe de commits"
+
 msgid "Loading known commits in commit graph"
 msgstr "Lecture des commits connus dans un graphe de commit"
 
@@ -14829,20 +15046,6 @@ msgid "commit-graph parent list for commit %s terminates early"
 msgstr ""
 "la liste de parents du graphe de commit pour le commit %s se termine trop tôt"
 
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"le graphe de commit a un numéro de génération nul pour le commit %s, mais "
-"non-nul ailleurs"
-
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"le graphe de commit a un numéro de génération non-nul pour le commit %s, "
-"mais nul ailleurs"
-
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
 msgstr ""
@@ -14855,6 +15058,14 @@ msgstr ""
 "la date de validation pour le commit %s dans le graphe de commit est "
 "%<PRIuMAX> != %<PRIuMAX>"
 
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"le graphe de commit a des numéros de génération à la fois nuls et non-nuls "
+"(par ex. les commits %s et %s)"
+
 msgid "Verifying commits in commit graph"
 msgstr "Verification des commits dans le graphe de commits"
 
@@ -14881,6 +15092,12 @@ msgstr ""
 "Supprimez ce message en lançant\n"
 "\"git config advice.graftFileDeprecated false\""
 
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr ""
+"le commit '%s' existe dans la graphe de commit mais pas dans la base de "
+"données d'objets"
+
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
 msgstr "La validation %s a une signature GPG non fiable, prétendument par %s."
@@ -15328,10 +15545,6 @@ msgstr "la référence '%s' ne pointe pas sur un blob"
 msgid "unable to resolve config blob '%s'"
 msgstr "impossible de résoudre le blob de config '%s'"
 
-#, c-format
-msgid "failed to parse %s"
-msgstr "échec de l'analyse de %s"
-
 msgid "unable to parse command-line config"
 msgstr "lecture de la configuration de ligne de commande impossible"
 
@@ -15814,9 +16027,6 @@ msgstr "impossible d'écrire l'archive"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base ne fonctionne pas avec des plages"
 
-msgid "--merge-base only works with commits"
-msgstr "--merge-base ne fonctionne qu'avec des commits"
-
 msgid "unable to get HEAD"
 msgstr "impossible d'acquérir HEAD"
 
@@ -15879,6 +16089,10 @@ msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr ""
 "Valeur inconnue pour la variable de configuration 'diff.submodule' : '%s'"
 
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "valeur inconnue pour la config '%s' : %s"
+
 #, c-format
 msgid ""
 "Found errors in 'diff.dirstat' config variable:\n"
@@ -15961,13 +16175,6 @@ msgstr "mauvais argument --color-moved : %s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "mode invalide '%s' dans --color-moved-ws"
 
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"l'option diff-algorithm accept \"myers\", \"minimal\", \"patience\" et "
-"\"histogram\""
-
 #, c-format
 msgid "invalid argument to %s"
 msgstr "argument invalide pour %s"
@@ -16011,8 +16218,8 @@ msgstr "--stat pour traitement automatique"
 msgid "output only the last line of --stat"
 msgstr "afficher seulement la dernière ligne de --stat"
 
-msgid "<param1,param2>..."
-msgstr "<param1,param2>..."
+msgid "<param1>,<param2>..."
+msgstr "<param1>,<param2>..."
 
 msgid ""
 "output the distribution of relative amount of changes for each sub-directory"
@@ -16023,8 +16230,8 @@ msgstr ""
 msgid "synonym for --dirstat=cumulative"
 msgstr "synonyme pour --dirstat=cumulative"
 
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "synonyme pour --dirstat=files,param1,param2..."
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "synonyme pour --dirstat=files,<param1>,<param2>..."
 
 msgid "warn if changes introduce conflict markers or whitespace errors"
 msgstr ""
@@ -16212,12 +16419,6 @@ msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr ""
 "générer un diff en utilisant l'algorithme de différence \"histogramme\""
 
-msgid "<algorithm>"
-msgstr "<algorithme>"
-
-msgid "choose a diff algorithm"
-msgstr "choisir un algorithme de différence"
-
 msgid "<text>"
 msgstr "<texte>"
 
@@ -17280,12 +17481,12 @@ msgstr ""
 "existent :\n"
 "%s"
 
-msgid "Failed to execute internal merge"
-msgstr "Ã\89chec à l'exécution de la fusion interne"
+msgid "failed to execute internal merge"
+msgstr "échec à l'exécution de la fusion interne"
 
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "Impossible d'ajouter %s à la base de données"
+msgid "unable to add %s to database"
+msgstr "impossible d'ajouter %s à la base de données"
 
 #, c-format
 msgid "Auto-merging %s"
@@ -17727,6 +17928,21 @@ msgstr "impossible de lire le cache"
 msgid "multi-pack-index OID fanout is of the wrong size"
 msgstr "l'étalement de l'OID d'index multi-paquet n'a pas la bonne taille"
 
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"étalement oid en désordre : étalement[%d] = %<PRIx32> > %<PRIx32> = "
+"étalement[%d]"
+
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr ""
+"le tronçon de recherche de l'OID d'index multi-paquet n'a pas la bonne taille"
+
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr ""
+"le tronçon de décalage de l'OID d'index multi-paquet n'a pas la bonne taille"
+
 #, c-format
 msgid "multi-pack-index file %s is too small"
 msgstr "le fichier d'index multi-paquet %s est trop petit"
@@ -17747,17 +17963,28 @@ msgstr ""
 "la version d'empreinte d'index multi-paquet %u ne correspond pas à la "
 "version %u"
 
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "index multi-paquet manque de tronçon de nom de paquet"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr ""
+"le tronçon de nom de paquet requis par l'index multi-paquet est manquant ou "
+"corrompu"
+
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr ""
+"le tronçon d'étalement OID requis de l'index multi-paquet est manquant ou "
+"corrompu"
 
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "index multi-paquet manque de tronçon de d'étalement OID requis"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr ""
+"le tronçon de recherche OID requis de l'index multi-paquet est manquant ou "
+"corrompu"
 
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "index multi-paquet manque de tronçon de recherche OID requis"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr ""
+"le tronçon de décalage d'objet requis de l'index multi-paquet est manquant "
+"ou corrompu"
 
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "index multi-paquet manque de tronçon de décalage d'objet requis"
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "le tronçon de nom de paquet de l'index multi-paquet est trop petit"
 
 #, c-format
 msgid "multi-pack-index pack names out of order: '%s' before '%s'"
@@ -17768,9 +17995,19 @@ msgstr ""
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "mauvais pack-int-id : %u (%u paquets au total)"
 
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "le MIDX ne contient pas de tronçon BTMP"
+
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "impossible d'ouvrir le paquet bitmappé %<PRIu32>"
+
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr ""
-"l'index multi-paquet stock un décalage en 64-bit, mais off_t est trop petit"
+"l'index multi-paquet stocke un décalage en 64-bit, mais off_t est trop petit"
+
+msgid "multi-pack-index large offset out of bounds"
+msgstr "le grand décalage de l'index-multi-paquet est hors limite"
 
 #, c-format
 msgid "failed to add packfile '%s'"
@@ -17850,13 +18087,6 @@ msgstr "somme de contrôle incorrecte"
 msgid "Looking for referenced packfiles"
 msgstr "Recherche de fichiers paquets référencés"
 
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr ""
-"étalement oid en désordre : étalement[%d] = %<PRIx32> > %<PRIx32> = "
-"étalement[%d]"
-
 msgid "the midx contains no oid"
 msgstr "le midx ne contient aucun oid"
 
@@ -18383,6 +18613,9 @@ msgstr "l'index inverse requis manque dans l'index multi-paquet"
 msgid "could not open pack %s"
 msgstr "impossible d'ouvrir le paquet '%s'"
 
+msgid "could not determine MIDX preferred pack"
+msgstr "impossible de déterminer le paquet préféré de MIDX"
+
 #, c-format
 msgid "preferred pack (%s) is invalid"
 msgstr "le paquet préféré (%s) est invalide"
@@ -18404,6 +18637,10 @@ msgstr "table de recherche en bitmap corrompue : index de commit %u hors plage"
 msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
 msgstr "bitmap ewah corrompue : entête tronqué pour la bitmap du commit '%s'"
 
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr "impossible de charger le paquet : '%s', pack-reuse désactivé"
+
 #, c-format
 msgid "object '%s' not found in type bitmaps"
 msgstr "objet '%s' non trouvé dans les bitmaps de type"
@@ -18492,6 +18729,13 @@ msgstr "somme de contrôle invalide"
 msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr "position de rev-index invalide à %<PRIu64> : %<PRIu32> != %<PRIu32>"
 
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr ""
+"le tronçon d'index inversé de l'index multi-paquet n'a pas la bonne taille"
+
+msgid "could not determine preferred pack"
+msgstr "impossible de déterminer le paquet préféré"
+
 msgid "cannot both write and verify reverse index"
 msgstr "impossible de lire et vérifier à la fois l'index inverse"
 
@@ -18543,14 +18787,6 @@ msgstr "l'option '%s' attend \"%s\" ou \"%s\""
 msgid "%s requires a value"
 msgstr "%s a besoin d'une valeur"
 
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s est incompatible avec %s"
-
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s est incompatible avec toute autre option"
-
 #, c-format
 msgid "%s takes no value"
 msgstr "%s n'accepte aucune valeur"
@@ -18634,6 +18870,10 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-NUM"
 
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "opposé de --no-%s"
+
 msgid "expiry-date"
 msgstr "date-d'expiration"
 
@@ -18664,6 +18904,14 @@ msgstr ""
 "avec --pathspec-from-file, les spécificateurs de chemin sont séparés par un "
 "caractère NUL"
 
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "valeur booléenne d'environnement invalide '%s' pour '%s'"
+
+#, c-format
+msgid "failed to parse %s"
+msgstr "échec de l'analyse de %s"
+
 #, c-format
 msgid "Could not make %s writable by group"
 msgstr "Impossible de rendre %s inscriptible pour le groupe"
@@ -18714,6 +18962,10 @@ msgstr "Spécificateur magique '%c' non implémenté dans '%s'"
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s : 'literal' et 'glob' sont incompatibles"
 
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "'%s' est hors de l'arbre de répertoire"
+
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
 msgstr "%s : '%s' est hors du dépôt à '%s'"
@@ -18875,10 +19127,6 @@ msgstr "indexation du fichier '%s' impossible"
 msgid "unable to add '%s' to index"
 msgstr "impossible d'ajouter '%s' à l'index"
 
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "fstat de '%s' impossible"
-
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
 msgstr "'%s' existe à la fois comme un fichier et un répertoire"
@@ -18986,10 +19234,6 @@ msgstr "impossible d'écrire un index scindé pour un index clairsemé"
 msgid "failed to convert to a sparse-index"
 msgstr "échec de conversion d'un index clairsemé"
 
-#, c-format
-msgid "could not stat '%s'"
-msgstr "impossible de stat '%s'"
-
 #, c-format
 msgid "unable to open git dir: %s"
 msgstr "impossible d'ouvrir le répertoire git : %s"
@@ -19459,10 +19703,6 @@ msgstr "'%s' existe ; impossible de créer '%s'"
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "impossible de traiter '%s' et '%s' en même temps"
 
-#, c-format
-msgid "could not remove reference %s"
-msgstr "impossible de supprimer la référence %s"
-
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "impossible de supprimer la référence %s : %s"
@@ -19658,7 +19898,7 @@ msgid ""
 "Neither worked, so we gave up. You must fully qualify the ref."
 msgstr ""
 "La destination que vous avez fournie n'est pas un nom de référence complète\n"
-"(c'est-à-dire commençant par \"ref/\"). Essai d'approximation par :\n"
+"(c'est-à-dire commençant par \"refs/\"). Essai d'approximation par :\n"
 "\n"
 "- Recherche d'une référence qui correspond à '%s' sur le serveur distant.\n"
 "- Vérification si la <source> en cours de poussée ('%s')\n"
@@ -20032,8 +20272,16 @@ msgstr "lors d'un clonage, créer un répertoire de travail complet"
 msgid "only download metadata for the branch that will be checked out"
 msgstr "ne télécharger les méta-données que pour la branche qui sera extraite"
 
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<options>] [--] <dépôt> [<répertoire>]"
+msgid "create repository within 'src' directory"
+msgstr "Créer un dépôt dans le repertoire 'src'"
+
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <branche-principale>] [--full-"
+"clone]\n"
+"\t[--[no-]src] <url> [<enrôlement>]"
 
 #, c-format
 msgid "cannot deduce worktree name from '%s'"
@@ -20084,12 +20332,28 @@ msgid "could not remove stale scalar.repo '%s'"
 msgstr "impossible de supprimé le scalar.repo obsolète '%s'"
 
 #, c-format
-msgid "removing stale scalar.repo '%s'"
+msgid "removed stale scalar.repo '%s'"
 msgstr "suppression du scalar.repo obsolète '%s'"
 
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "dépôt git parti dans '%s'"
+msgid "repository at '%s' has different owner"
+msgstr "le dépôt dans '%s' a un propriétaire différent"
+
+#, c-format
+msgid "repository at '%s' has a format issue"
+msgstr "le dépôt dans '%s' a un problème de format"
+
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "dépôt non trouvé dans '%s'"
+
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"pour désinscrire ce dépôt de Scalar, lancez\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 msgid ""
 "scalar run <task> [<enlistment>]\n"
@@ -20496,10 +20760,6 @@ msgstr "impossible d'obtenir un message de validation pour %s"
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s : impossible d'analyser le commit parent %s"
 
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "impossible de renommer '%s' en '%s'"
-
 #, c-format
 msgid "could not revert %s... %s"
 msgstr "impossible d'annuler %s... %s"
@@ -20826,6 +21086,9 @@ msgid "Autostash exists; creating a new stash entry."
 msgstr ""
 "Un remisage automatique existe ; création d'une nouvelle entrée de remisage."
 
+msgid "autostash reference is a symref"
+msgstr "la référence d'auto-remisage est une symref"
+
 msgid "could not detach HEAD"
 msgstr "impossible de détacher HEAD"
 
@@ -20857,14 +21120,14 @@ msgstr ""
 "    git rebase --edit-todo\n"
 "    git rebase --continue\n"
 
-#, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "Rebasage (%d/%d)%s"
-
 #, c-format
 msgid "Stopped at %s...  %.*s\n"
 msgstr "Arrêt à %s... %.*s\n"
 
+#, c-format
+msgid "Rebasing (%d/%d)%s"
+msgstr "Rebasage (%d/%d)%s"
+
 #, c-format
 msgid "unknown command %d"
 msgstr "commande inconnue %d"
@@ -21144,6 +21407,10 @@ msgstr "pas de copie des modèles depuis '%s' : %s"
 msgid "invalid initial branch name: '%s'"
 msgstr "nom de branche initiale invalide : '%s'"
 
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-initialisation : --initial-branch=%s ignoré"
+
 #, c-format
 msgid "unable to handle file type %d"
 msgstr "impossible de traiter le fichier de type %d"
@@ -21155,14 +21422,16 @@ msgstr "impossible de déplacer %s vers %s"
 msgid "attempt to reinitialize repository with different hash"
 msgstr "essai de réinitialisation du dépôt avec une empreinte différente"
 
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr ""
+"essai de réinitialisation du dépôt avec un format de stockage de références "
+"différent"
+
 #, c-format
 msgid "%s already exists"
 msgstr "%s existe déjà"
 
-#, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-initialisation : --initial-branch=%s ignoré"
-
 #, c-format
 msgid "Reinitialized existing shared Git repository in %s%s\n"
 msgstr "Dépôt Git existant partagé réinitialisé dans %s%s\n"
@@ -21432,12 +21701,6 @@ msgstr "effacer l'arbre de cache avant chaque itération"
 msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr "nombre d'entrées dans l'arbre de cache à invalider (par défaut, 0)"
 
-msgid "unhandled options"
-msgstr "options non gérées"
-
-msgid "error preparing revisions"
-msgstr "erreur lors de la préparation des révisions"
-
 #, c-format
 msgid "commit %s is not marked reachable"
 msgstr "le commit %s n'est pas marqué joignable"
@@ -21597,9 +21860,6 @@ msgstr ""
 msgid "invalid remote service path"
 msgstr "chemin de service distant invalide"
 
-msgid "operation not supported by protocol"
-msgstr "option non supportée par le protocole"
-
 #, c-format
 msgid "can't connect to subservice %s"
 msgstr "impossible de se connecter au sous-service %s"
@@ -21731,10 +21991,6 @@ msgstr "impossible d'analyser la configuration transport.color.*"
 msgid "support for protocol v2 not implemented yet"
 msgstr "le support du protocole v2 n'est pas encore implanté"
 
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "valeur inconnue pour la config '%s' : %s"
-
 #, c-format
 msgid "transport '%s' not allowed"
 msgstr "transport '%s' non permis"
@@ -21789,6 +22045,9 @@ msgid "could not retrieve server-advertised bundle-uri list"
 msgstr ""
 "impossible de récupérer la liste de bundle-uris annoncée par le serveur"
 
+msgid "operation not supported by protocol"
+msgstr "option non supportée par le protocole"
+
 msgid "too-short tree object"
 msgstr "objet arbre trop court"
 
@@ -22189,6 +22448,9 @@ msgstr "impossible d'accéder à '%s'"
 msgid "unable to get current working directory"
 msgstr "impossible d'accéder au répertoire de travail courant"
 
+msgid "unable to get random bytes"
+msgstr "impossible d'acquérir des octets aléatoires"
+
 msgid "Unmerged paths:"
 msgstr "Chemins non fusionnés :"
 
@@ -22635,6 +22897,10 @@ msgstr "de plus, votre index contient des modifications non validées."
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "%s impossible : votre index contient des modifications non validées."
 
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "style inconnu '%s' pour '%s'"
+
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
 "merge"
@@ -22827,14 +23093,14 @@ msgstr ""
 "\n"
 "Effacez le corps si vous ne souhaitez pas envoyer un résumé.\n"
 
-#, perl-format
-msgid "Failed to open %s: %s"
-msgstr "Échec à l'ouverture de %s : %s"
-
 #, perl-format
 msgid "Failed to open %s.final: %s"
 msgstr "Échec à l'ouverture de %s.final : %s"
 
+#, perl-format
+msgid "Failed to open %s: %s"
+msgstr "Échec à l'ouverture de %s : %s"
+
 msgid "Summary email is empty, skipping it\n"
 msgstr "Le courriel de résumé étant vide, il a été ignoré\n"
 
@@ -23036,6 +23302,123 @@ msgstr "%s sauté avec un suffix de sauvegarde '%s'.\n"
 msgid "Do you really want to send %s? [y|N]: "
 msgstr "Souhaitez-vous réellement envoyer %s ?[y|N] : "
 
+#~ msgid "-x and -X cannot be used together"
+#~ msgstr "-x et -X ne peuvent pas être utilisés ensemble"
+
+#~ msgid ""
+#~ "--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
+#~ "exclude"
+#~ msgstr ""
+#~ "--bundle-uri est incompatible avec --depth, --shallow-since, et --shallow-"
+#~ "exclude"
+
+#~ msgid "--merge-base is incompatible with --stdin"
+#~ msgstr "--merge-base est incompatible avec --stdin"
+
+#~ msgid ""
+#~ "apply options are incompatible with rebase.autoSquash.  Consider adding --"
+#~ "no-autosquash"
+#~ msgstr ""
+#~ "les options d'application sont incompatibles avec rebase.autoSquash. "
+#~ "Considérez l'ajout de --no-autosquash"
+
+#~ msgid "--exclude-hidden cannot be used together with --branches"
+#~ msgstr "--exclude-hidden ne peut être utilisé avec --branches"
+
+#~ msgid "--exclude-hidden cannot be used together with --tags"
+#~ msgstr "--exclude-hidden ne peut pas être utilisé avec --tags"
+
+#~ msgid "--exclude-hidden cannot be used together with --remotes"
+#~ msgstr "--exclude-hidden ne peut pas être utilisé avec --remotes"
+
+#, c-format
+#~ msgid "only one of '%s', '%s' or '%s' can be given"
+#~ msgstr "les options '%s', '%s' et '%s' sont mutuellement exclusives"
+
+#, c-format
+#~ msgid "'%s' and '%s' cannot be used together"
+#~ msgstr "'%s' et '%s' ne peuvent pas être utilisées ensemble"
+
+#, c-format
+#~ msgid "options '%s', and '%s' cannot be used together"
+#~ msgstr "les options '%s' et '%s' ne peuvent pas être utilisées ensemble"
+
+#~ msgid "<commit-ish>"
+#~ msgstr "<commit-esque>"
+
+#, c-format
+#~ msgid "%s is incompatible with %s"
+#~ msgstr "%s est incompatible avec %s"
+
+#, c-format
+#~ msgid "could not remove reference %s"
+#~ msgstr "impossible de supprimer la référence %s"
+
+#~ msgid "unhandled options"
+#~ msgstr "options non gérées"
+
+#, c-format
+#~ msgid "options '%s=%s' and '%s=%s' cannot be used together"
+#~ msgstr ""
+#~ "les options '%s=%s' et '%s=%s' ne peuvent pas être utilisées ensemble"
+
+#, c-format
+#~ msgid "%s : incompatible with something else"
+#~ msgstr "%s est incompatible avec toute autre option"
+
+#~ msgid "Could not write patch"
+#~ msgstr "Impossible d'écrire le patch"
+
+#, c-format
+#~ msgid "Could not stat '%s'"
+#~ msgstr "Stat de '%s' impossible"
+
+#, c-format
+#~ msgid "Cannot delete branch '%s' checked out at '%s'"
+#~ msgstr "Impossible de supprimer la branche '%s' extraite dans '%s'"
+
+#~ msgid "unable to write new_index file"
+#~ msgstr "impossible d'écrire le fichier new_index"
+
+#~ msgid "do not apply config rules"
+#~ msgstr "ne pas appliquer les règles de la configuration"
+
+#~ msgid "join whitespace-continued values"
+#~ msgstr "joindre les valeurs continuées avec des caractères blancs"
+
+#~ msgid "set parsing options"
+#~ msgstr "paramètres d'analyse"
+
+#~ msgid "cannot move directory over file"
+#~ msgstr "impossible de déplacer un répertoire sur un fichier"
+
+#~ msgid "cannot use --filter without --stdout"
+#~ msgstr "impossible d'utiliser --filter sans --stdout"
+
+#~ msgid "cannot use --max-pack-size with --cruft"
+#~ msgstr "impossible d'utiliser --max-pack-size avec --cruft"
+
+#~ msgid "--strategy requires --merge or --interactive"
+#~ msgstr "--strategy requiert --merge ou --interactive"
+
+#, c-format
+#~ msgid ""
+#~ "commit-graph has generation number zero for commit %s, but non-zero "
+#~ "elsewhere"
+#~ msgstr ""
+#~ "le graphe de commit a un numéro de génération nul pour le commit %s, mais "
+#~ "non-nul ailleurs"
+
+#~ msgid "--merge-base only works with commits"
+#~ msgstr "--merge-base ne fonctionne qu'avec des commits"
+
+#~ msgid "scalar clone [<options>] [--] <repo> [<dir>]"
+#~ msgstr "scalar clone [<options>] [--] <dépôt> [<répertoire>]"
+
+#, c-format
+#~ msgid "could not rename '%s' to '%s'"
+#~ msgstr "impossible de renommer '%s' en '%s'"
+
 #, c-format
 #~ msgid "It is not possible to %s because you have unmerged files."
 #~ msgstr "%s n'est pas possible car vous avez des fichiers non fusionnés."
index e20e18e8931d9a5e08ce353cdc14df8d7bd71355..3e8b212b6178f52813fd16b603653a447692da7a 100644 (file)
--- a/po/id.po
+++ b/po/id.po
@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-06 17:06+0700\n"
-"PO-Revision-Date: 2023-08-06 17:06+0700\n"
+"POT-Creation-Date: 2024-02-16 09:36+0700\n"
+"PO-Revision-Date: 2024-02-16 10:45+0700\n"
 "Last-Translator: Bagas Sanjaya <bagasdotme@gmail.com>\n"
 "Language-Team: Indonesian\n"
 "Language: id\n"
@@ -764,9 +764,8 @@ msgid "Reverting is not possible because you have unmerged files."
 msgstr "Pembalikkan tidak mungkin sebab Anda punya berkas tak tergabung."
 
 #: advice.c
-#, c-format
-msgid "It is not possible to %s because you have unmerged files."
-msgstr "Tidak mungkin untuk %s sebab Anda punya berkas tak tergabung."
+msgid "Rebasing is not possible because you have unmerged files."
+msgstr "Pendasaran ulang tidak mungkin sebab Anda punya berkas tak tergabung."
 
 #: advice.c
 msgid ""
@@ -910,7 +909,7 @@ msgid "unclosed quote"
 msgstr "tanda kutip tak ditutup"
 
 #: alias.c builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
-#: builtin/receive-pack.c builtin/tag.c
+#: builtin/receive-pack.c builtin/tag.c t/helper/test-pkt-line.c
 msgid "too many arguments"
 msgstr "terlalu banyak argumen"
 
@@ -924,14 +923,16 @@ msgstr "opsi spasi putih tidak dikenal '%s'"
 msgid "unrecognized whitespace ignore option '%s'"
 msgstr "opsi abai spasi putih tidak dikenal '%s'"
 
-#: apply.c archive.c builtin/add.c builtin/branch.c builtin/checkout.c
-#: builtin/clone.c builtin/commit.c builtin/describe.c builtin/diff-tree.c
-#: builtin/difftool.c builtin/fast-export.c builtin/fetch.c builtin/help.c
-#: builtin/index-pack.c builtin/init-db.c builtin/log.c builtin/ls-files.c
-#: builtin/merge-base.c builtin/merge.c builtin/pack-objects.c builtin/push.c
-#: builtin/rebase.c builtin/repack.c builtin/reset.c builtin/rev-list.c
-#: builtin/show-branch.c builtin/stash.c builtin/submodule--helper.c
-#: builtin/tag.c builtin/worktree.c parse-options.c range-diff.c revision.c
+#: apply.c archive.c builtin/add.c builtin/branch.c builtin/checkout-index.c
+#: builtin/checkout.c builtin/clean.c builtin/clone.c builtin/commit.c
+#: builtin/describe.c builtin/diff-tree.c builtin/difftool.c
+#: builtin/fast-export.c builtin/fetch.c builtin/help.c builtin/index-pack.c
+#: builtin/init-db.c builtin/log.c builtin/ls-files.c builtin/merge-base.c
+#: builtin/merge-tree.c builtin/merge.c builtin/pack-objects.c builtin/rebase.c
+#: builtin/repack.c builtin/replay.c builtin/reset.c builtin/rev-list.c
+#: builtin/rev-parse.c builtin/show-branch.c builtin/stash.c
+#: builtin/submodule--helper.c builtin/tag.c builtin/worktree.c parse-options.c
+#: range-diff.c revision.c
 #, c-format
 msgid "options '%s' and '%s' cannot be used together"
 msgstr "Opsi '%s' dan '%s' tidak dapat digunakan bersamaan"
@@ -1421,7 +1422,7 @@ msgid_plural "%d lines applied after fixing whitespace errors."
 msgstr[0] "%d baris diterapkan setelah memperbaiki kesalahan spasi putih."
 msgstr[1] "%d baris diterapkan setelah memperbaiki kesalahan spasi putih."
 
-#: apply.c builtin/add.c builtin/mv.c builtin/rm.c
+#: apply.c builtin/mv.c builtin/rm.c
 msgid "Unable to write new index file"
 msgstr "Tidak dapat menulis berkas indeks baru"
 
@@ -1752,6 +1753,11 @@ msgstr "opsi `%s' butuh '%s'"
 msgid "Unexpected option --output"
 msgstr "Opsi --output tak diharapkan"
 
+#: archive.c
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "parameter konfigurasi tambahan: '%s'"
+
 #: archive.c
 #, c-format
 msgid "Unknown archive format '%s'"
@@ -1808,6 +1814,17 @@ msgstr "mengabaikan blob gitattributes '%s' yang terlalu besar"
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "--attr-source atau GIT_ATTR_SOURCE jelek"
 
+#: attr.c read-cache.c
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "tidak dapat men-stat '%s'"
+
+#: bisect.c builtin/cat-file.c builtin/index-pack.c builtin/notes.c
+#: builtin/pack-objects.c combine-diff.c rerere.c
+#, c-format
+msgid "unable to read %s"
+msgstr "tidak dapat membaca %s"
+
 #: bisect.c
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
@@ -2143,8 +2160,8 @@ msgstr "submodul '%s': tidak dapat membuat cabang '%s'"
 
 #: branch.c
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "'%s' sudah di-checkout pada '%s'"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "'%s' sudah digunakan oleh pohon kerja di '%s'"
 
 #: builtin/add.c
 msgid "git add [<options>] [--] <pathspec>..."
@@ -2167,31 +2184,27 @@ msgstr ""
 "setelan add.interactive.useBuiltin sudah dihapus!\n"
 "Selengkapnya lihat entrinya di 'git help config'."
 
-#: builtin/add.c builtin/rev-parse.c
-msgid "Could not read the index"
-msgstr "Tidak dapat membaca indeks"
-
 #: builtin/add.c
-msgid "Could not write patch"
-msgstr "Tidak dapat menulis tambalan"
+msgid "could not read the index"
+msgstr "tidak dapat membaca indeks"
 
 #: builtin/add.c
 msgid "editing patch failed"
 msgstr "Gagal menyunting tambalan"
 
-#: builtin/add.c
+#: builtin/add.c read-cache.c
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "Tidak dapat men-stat '%s'"
+msgid "could not stat '%s'"
+msgstr "tidak dapat men-stat '%s'"
 
 #: builtin/add.c
-msgid "Empty patch. Aborted."
-msgstr "Tambalan kosong. Dibatalkan."
+msgid "empty patch. aborted"
+msgstr "tambalan kosong, dibatalkan"
 
 #: builtin/add.c
 #, c-format
-msgid "Could not apply '%s'"
-msgstr "Tidak dapat terapkan '%s'"
+msgid "could not apply '%s'"
+msgstr "tidak dapat menerapkan '%s'"
 
 #: builtin/add.c
 msgid "The following paths are ignored by one of your .gitignore files:\n"
@@ -2352,14 +2365,19 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "berkas indeks rusak"
 
+#: builtin/add.c builtin/am.c builtin/checkout.c builtin/clone.c
+#: builtin/commit.c builtin/stash.c merge.c rerere.c
+msgid "unable to write new index file"
+msgstr "gagal menulis berkas indeks baru"
+
 #: builtin/am.c builtin/mailinfo.c mailinfo.c
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "tindakan jelek '%s' untuk '%s'"
 
 #: builtin/am.c builtin/blame.c builtin/fetch.c builtin/pack-objects.c
-#: builtin/pull.c diff-merges.c gpg-interface.c ls-refs.c parallel-checkout.c
-#: sequencer.c setup.c
+#: builtin/pull.c config.c diff-merges.c gpg-interface.c ls-refs.c
+#: parallel-checkout.c sequencer.c setup.c
 #, c-format
 msgid "invalid value for '%s': '%s'"
 msgstr "nilai tidak valid untuk '%s': '%s'"
@@ -2522,8 +2540,7 @@ msgstr "git write-tree gagal menulis sebuah pohon"
 msgid "applying to an empty history"
 msgstr "menerapkan ke sebuah riwayat kosong"
 
-#: builtin/am.c builtin/commit.c builtin/merge.c sequencer.c
-#: t/helper/test-fast-rebase.c
+#: builtin/am.c builtin/commit.c builtin/merge.c builtin/replay.c sequencer.c
 msgid "failed to write commit object"
 msgstr "gagal menulis objek komit"
 
@@ -2615,11 +2632,6 @@ msgstr ""
 "Anda mungkin jalankan `git rm` pada berkas untuk menerima \"penghapusan oleh "
 "mereka\" untuk itu."
 
-#: builtin/am.c builtin/checkout.c builtin/clone.c builtin/stash.c merge.c
-#: rerere.c
-msgid "unable to write new index file"
-msgstr "gagal menulis berkas indeks baru"
-
 #: builtin/am.c builtin/reset.c
 #, c-format
 msgid "Could not parse object '%s'."
@@ -2642,11 +2654,6 @@ msgstr ""
 msgid "failed to read '%s'"
 msgstr "gagal membaca '%s'"
 
-#: builtin/am.c
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "Opsi '%s=%s' dan '%s=%s' tidak dapat digunakan bersamaan"
-
 #: builtin/am.c
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<opsi>] [(<mbox> | <Maildir>)...]"
@@ -2719,8 +2726,9 @@ msgid "n"
 msgstr "n"
 
 #: builtin/am.c builtin/branch.c builtin/bugreport.c builtin/cat-file.c
-#: builtin/diagnose.c builtin/for-each-ref.c builtin/ls-files.c
-#: builtin/ls-tree.c builtin/replace.c builtin/tag.c builtin/verify-tag.c
+#: builtin/clone.c builtin/diagnose.c builtin/for-each-ref.c builtin/init-db.c
+#: builtin/ls-files.c builtin/ls-tree.c builtin/replace.c builtin/tag.c
+#: builtin/verify-tag.c
 msgid "format"
 msgstr "format"
 
@@ -2851,10 +2859,10 @@ msgstr "git archive: sebuah bilasan diharapkan"
 
 #: builtin/bisect.c
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<istilah> --term-{old, good}=<istilah>] "
+"git bisect start [--term-(new,bad)=<istilah> --term-(old, good)=<istilah>] "
 "[--no-checkout] [--first-parent] [<jelek> [<bagus>...]] [--] [<jalur>...]"
 
 #: builtin/bisect.c
@@ -2874,8 +2882,8 @@ msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <berkas log>"
 
 #: builtin/bisect.c
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <perintah>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <perintah> [<argumen>...]"
 
 #: builtin/bisect.c
 #, c-format
@@ -3394,37 +3402,38 @@ msgstr "git branch [<opsi>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
 "menghapus cabang '%s' yang sudah digabungkan ke\n"
-"         '%s', tapi belum digabungkan ke HEAD."
+"         '%s', tapi belum digabungkan ke HEAD"
 
 #: builtin/branch.c
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
 "tidak menghapus cabang '%s' yang belum digabungkan ke\n"
-"         '%s', walaupun tergabung ke HEAD."
+"         '%s', walaupun tergabung ke HEAD"
 
 #: builtin/branch.c
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
-msgstr "Tidak dapat mencari objek komit untuk '%s'"
+msgid "couldn't look up commit object for '%s'"
+msgstr "tidak dapat mencari objek komit untuk '%s'"
 
 #: builtin/branch.c
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
-msgstr ""
-"Cabang '%s' belum sepenuhnya tergabung.\n"
-"Kalau Anda yakin ingin menghapusnya, jalankan 'git branch -D %s'."
+msgid "the branch '%s' is not fully merged"
+msgstr "cabang '%s' belum sepenuhnya digabungkan"
+
+#: builtin/branch.c
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
+msgstr "Jika anda yakin untuk menghapusnya, lakukan 'git branch -D %s'"
 
 #: builtin/branch.c
-msgid "Update of config-file failed"
-msgstr "Pembaruan berkas konfigurasi gagal"
+msgid "update of config-file failed"
+msgstr "pembaruan berkas konfigurasi gagal"
 
 #: builtin/branch.c
 msgid "cannot use -a with -d"
@@ -3432,13 +3441,14 @@ msgstr "tidak dapat gunakan -a dengan -d"
 
 #: builtin/branch.c
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "Tidak dapat menghapus cabang '%s' yang ter-checkout pada '%s'"
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr ""
+"tidak dapat menghapus cabang '%s' yang digunakan oleh pohon kerja di '%s'"
 
 #: builtin/branch.c
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "cabang pelacak remote '%s' tidak ditemukan."
+msgid "remote-tracking branch '%s' not found"
+msgstr "cabang pelacak remote '%s' tidak ditemukan"
 
 #: builtin/branch.c
 #, c-format
@@ -3451,8 +3461,8 @@ msgstr ""
 
 #: builtin/branch.c
 #, c-format
-msgid "branch '%s' not found."
-msgstr "cabang '%s' tidak ditemukan."
+msgid "branch '%s' not found"
+msgstr "cabang '%s' tidak ditemukan"
 
 #: builtin/branch.c
 #, c-format
@@ -3479,13 +3489,13 @@ msgstr "HEAD (%s) merujuk diluar refs/heads/"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch %s is being rebased at %s"
-msgstr "Cabang %s sedang didasarkan ulang pada %s"
+msgid "branch %s is being rebased at %s"
+msgstr "cabang %s sedang didasarkan ulang pada %s"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch %s is being bisected at %s"
-msgstr "Cabang %s sedang dibagi dua pada %s"
+msgid "branch %s is being bisected at %s"
+msgstr "cabang %s sedang dibagi dua pada %s"
 
 #: builtin/branch.c
 #, c-format
@@ -3494,49 +3504,49 @@ msgstr "HEAD dari pohon kerja %s tidak diperbarui"
 
 #: builtin/branch.c
 #, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Nama cabang tidak valid: '%s'"
+msgid "invalid branch name: '%s'"
+msgstr "nama cabang tidak valid: '%s'"
 
 #: builtin/branch.c
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Belum ada komit pada cabang '%s'."
+msgid "no commit on branch '%s' yet"
+msgstr "belum ada komit pada cabang '%s'."
 
 #: builtin/branch.c
 #, c-format
-msgid "No branch named '%s'."
-msgstr "Tidak ada cabang bernama '%s'."
+msgid "no branch named '%s'"
+msgstr "tidak ada cabang bernama '%s'"
 
 #: builtin/branch.c
-msgid "Branch rename failed"
-msgstr "Penggantian nama cabang gagal"
+msgid "branch rename failed"
+msgstr "penggantian nama cabang gagal"
 
 #: builtin/branch.c
-msgid "Branch copy failed"
-msgstr "Penyalinan cabang gagal"
+msgid "branch copy failed"
+msgstr "penyalinan cabang gagal"
 
 #: builtin/branch.c
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "Salinan cabang salah nama '%s' dibuat"
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "salinan cabang salah nama '%s' dibuat"
 
 #: builtin/branch.c
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
-msgstr "Cabang salah nama '%s' berganti nama"
+msgid "renamed a misnamed branch '%s' away"
+msgstr "cabang salah nama '%s' berganti nama"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "Cabang berganti nama ke %s, tapi HEAD tidak diperbarui!"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "cabang berganti nama ke %s, tapi HEAD tidak diperbarui"
 
 #: builtin/branch.c
-msgid "Branch is renamed, but update of config-file failed"
-msgstr "Cabang berganti nama, tapi pembaruan berkas konfigurasi gagal"
+msgid "branch is renamed, but update of config-file failed"
+msgstr "cabang berganti nama, tapi pembaruan berkas konfigurasi gagal"
 
 #: builtin/branch.c
-msgid "Branch is copied, but update of config-file failed"
-msgstr "Cabang disalin, tapi pembaruan berkas konfigurasi gagal"
+msgid "branch is copied, but update of config-file failed"
+msgstr "cabang disalin, tapi pembaruan berkas konfigurasi gagal"
 
 #: builtin/branch.c
 #, c-format
@@ -3686,9 +3696,9 @@ msgstr "rekursi melalui submodul"
 msgid "format to use for the output"
 msgstr "format yang digunakan untuk keluaran"
 
-#: builtin/branch.c builtin/submodule--helper.c submodule.c
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "Gagal menguraikan HEAD sebagai referensi valid."
+#: builtin/branch.c
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "gagal menguraikan HEAD sebagai referensi valid."
 
 #: builtin/branch.c builtin/clone.c
 msgid "HEAD not found below refs/heads!"
@@ -3711,20 +3721,20 @@ msgid "branch name required"
 msgstr "nama cabang diperlukan"
 
 #: builtin/branch.c
-msgid "Cannot give description to detached HEAD"
-msgstr "Tidak dapat memberikan deskripsi ke HEAD terpisah"
+msgid "cannot give description to detached HEAD"
+msgstr "tidak dapat memberikan deskripsi ke HEAD terpisah"
 
 #: builtin/branch.c
 msgid "cannot edit description of more than one branch"
 msgstr "tidak dapat menyunting deskripsi lebih dari satu cabang"
 
 #: builtin/branch.c
-msgid "cannot copy the current branch while not on any."
-msgstr "tidak dapat menyalin cabang saat ini ketika tidak ada."
+msgid "cannot copy the current branch while not on any"
+msgstr "tidak dapat menyalin cabang saat ini ketika tidak ada"
 
 #: builtin/branch.c
-msgid "cannot rename the current branch while not on any."
-msgstr "tidak dapat mengganti nama cabang saat ini ketika tidak ada."
+msgid "cannot rename the current branch while not on any"
+msgstr "tidak dapat mengganti nama cabang saat ini ketika tidak ada"
 
 #: builtin/branch.c
 msgid "too many branches for a copy operation"
@@ -3741,10 +3751,9 @@ msgstr "terlalu banyak argumen untuk menyetel hulu baru"
 #: builtin/branch.c
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
-"tidak dapat menyetel hulu HEAD ke %s ketika itu tak menunjuk pada cabang "
-"apapun."
+"tidak dapat menyetel hulu HEAD ke %s ketika tak menunjuk pada cabang apapun"
 
 #: builtin/branch.c
 #, c-format
@@ -3761,31 +3770,30 @@ msgid "too many arguments to unset upstream"
 msgstr "terlalu banyak argumen untuk batal-setel hulu"
 
 #: builtin/branch.c
-msgid "could not unset upstream of HEAD when it does not point to any branch."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
 msgstr ""
-"tidak dapat membatal-setel hulu HEAD ketika itu tak menunjuk pada cabang "
-"apapun."
+"tidak dapat membatal-setel hulu HEAD ketika tak menunjuk pada cabang apapun"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch '%s' has no upstream information"
-msgstr "Cabang '%s' tidak ada informasi hulu"
+msgid "branch '%s' has no upstream information"
+msgstr "cabang '%s' tidak ada informasi hulu"
 
 #: builtin/branch.c
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
-"Opsi -a dan -r tidak mengambil nama cabang.\n"
-"Mungkin maksud Anda gunakan: -a|-r --list <pola>?"
+"opsi -a dan -r tidak mengambil nama cabang.\n"
+"Mungkin maksud Anda menggunakan: -a|-r --list <pola>?"
 
 #: builtin/branch.c
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
 "opsi '--set-upstream' tidak lagi didukung. Mohon gunakan '--track' atau '--"
-"set-upstream-to' sebagai gantinya."
+"set-upstream-to' sebagai gantinya"
 
 #: builtin/bugreport.c
 msgid "git version:\n"
@@ -3871,6 +3879,11 @@ msgstr "sebutkan tujuan untuk berkas(-berkas) laporan bug"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "sebutkan akhiran format strftime untuk nama(-nama) berkas"
 
+#: builtin/bugreport.c
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "argumen tidak dikenal `%s'"
+
 #: builtin/bugreport.c builtin/diagnose.c
 #, c-format
 msgid "could not create leading directories for '%s'"
@@ -4008,6 +4021,15 @@ msgstr "git cat-file (-e | -p) <objek>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <objek>"
 
+#: builtin/cat-file.c
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<revisi>:<jalur|mirip-pohon> | --path=<jalur|mirip-pohon>] "
+"<revisi>"
+
 #: builtin/cat-file.c
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
@@ -4020,15 +4042,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-z]"
 
-#: builtin/cat-file.c
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<revisi>:<jalur|mirip-pohon> | --path=<jalur|mirip-pohon>] "
-"<revisi>"
-
 #: builtin/cat-file.c
 msgid "Check object existence or emit object contents"
 msgstr "Periksa keberadaan objek atau keluarkan isi objek"
@@ -4415,6 +4428,11 @@ msgstr "'%s' harus disebutkan ketika '%s' tidak disebutkan"
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "'%s' atau '%s' tidak dapat digunakan untuk %s"
 
+#: builtin/checkout.c
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr "'%s', '%s', atau '%s' tidak dapat digunakan ketika men-checkout pohon"
+
 #: builtin/checkout.c
 #, c-format
 msgid "path '%s' is unmerged"
@@ -4443,7 +4461,7 @@ msgstr "Tidak dapat melakukan reflog untuk '%s': %s\n"
 msgid "HEAD is now at"
 msgstr "HEAD sekarang berada di"
 
-#: builtin/checkout.c builtin/clone.c t/helper/test-fast-rebase.c
+#: builtin/checkout.c builtin/clone.c
 msgid "unable to update HEAD"
 msgstr "tidak dapat memperbarui HEAD"
 
@@ -4714,8 +4732,8 @@ msgid "new-branch"
 msgstr "cabang baru"
 
 #: builtin/checkout.c
-msgid "new unparented branch"
-msgstr "cabang baru tanpa induk"
+msgid "new unborn branch"
+msgstr "cabang yatim baru"
 
 #: builtin/checkout.c builtin/merge.c
 msgid "update ignored files (default)"
@@ -4783,7 +4801,7 @@ msgstr ""
 msgid "you must specify path(s) to restore"
 msgstr "Anda harus sebutkan jalur untuk dipulihkan"
 
-#: builtin/checkout.c builtin/clone.c builtin/remote.c
+#: builtin/checkout.c builtin/clone.c builtin/remote.c builtin/replay.c
 #: builtin/submodule--helper.c builtin/worktree.c
 msgid "branch"
 msgstr "cabang"
@@ -5027,10 +5045,6 @@ msgstr ""
 "clean.requireForce asal ke true dan baik -i, -n, atau -f tidak diberikan; "
 "menolak membersihkan"
 
-#: builtin/clean.c
-msgid "-x and -X cannot be used together"
-msgstr "-x dan -X tidak dapat digunakan bersamaan"
-
 #: builtin/clone.c
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<opsi>] [--] <repo> [<direktori>]"
@@ -5109,7 +5123,7 @@ msgstr "checkout <cabang> daripada HEAD remote"
 msgid "path to git-upload-pack on the remote"
 msgstr "jalur ke git-upload-pack pada remote"
 
-#: builtin/clone.c builtin/fetch.c builtin/grep.c builtin/pull.c
+#: builtin/clone.c builtin/fetch.c builtin/pull.c
 msgid "depth"
 msgstr "kedalaman"
 
@@ -5122,6 +5136,7 @@ msgid "create a shallow clone since a specific time"
 msgstr "buat klon dangkal sejak waktu yang disebutkan"
 
 #: builtin/clone.c builtin/fetch.c builtin/pull.c builtin/rebase.c
+#: builtin/replay.c
 msgid "revision"
 msgstr "revisi"
 
@@ -5149,6 +5164,10 @@ msgstr "direktori git"
 msgid "separate git dir from working tree"
 msgstr "pisahkan direktori git dari pohon kerja"
 
+#: builtin/clone.c builtin/init-db.c
+msgid "specify the reference format to use"
+msgstr "sebutkan format referensi untuk digunakan"
+
 #: builtin/clone.c
 msgid "key=value"
 msgstr "kunci=nilai"
@@ -5299,13 +5318,10 @@ msgstr "Terlalu banyak argumen."
 msgid "You must specify a repository to clone."
 msgstr "Anda harus sebutkan repositori untuk diklon."
 
-#: builtin/clone.c
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"--bundle-uri tidak kompatibel dengan --depth, --shallow-since, dan --shallow-"
-"exclude"
+#: builtin/clone.c builtin/init-db.c setup.c
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "format penyimpanan referensi tidak dikenal '%s'"
 
 #: builtin/clone.c
 #, c-format
@@ -5471,13 +5487,13 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <direktori>] [--append]\n"
 "                       [--split[=<strategi>]] [--reachable | --stdin-packs | "
 "--stdin-commits]\n"
-"                       [--changed-paths] [--[no-]max-new-filters <n>] [--[-"
-"no-]progress]\n"
+"                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
 "                       <opsi pemisahan>"
 
 #: builtin/commit-graph.c builtin/fetch.c builtin/log.c builtin/repack.c
@@ -5497,6 +5513,11 @@ msgstr "jika grafik komit terpisah, hanya verifikasi berkas ujung"
 msgid "Could not open commit-graph '%s'"
 msgstr "Tidak dapat membuka grafik komit '%s'"
 
+#: builtin/commit-graph.c
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "tidak dapat membuka grafik komit '%s'"
+
 #: builtin/commit-graph.c
 #, c-format
 msgid "unrecognized --split argument, %s"
@@ -5742,10 +5763,6 @@ msgstr "tidak dapat memperbarui indeks sementara"
 msgid "Failed to update main cache tree"
 msgstr "gagal memperbarui tembolok pohon utama"
 
-#: builtin/commit.c
-msgid "unable to write new_index file"
-msgstr "tidak dapat menulis berkas new_index"
-
 #: builtin/commit.c
 msgid "cannot do a partial commit during a merge."
 msgstr "tidak dapat melakukan komit sebagian selama penggabungan."
@@ -6244,11 +6261,11 @@ msgstr "Batalkan komit karena badan pesan komit kosong.\n"
 #: builtin/commit.c
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
 "repositori sudah diperbarui, tetapi tidak dapat menulis\n"
-"berkas new_index. Periksa bahwa disk tidak penuh dan kuota\n"
+"berkas indeks baru. Periksa bahwa disk tidak penuh dan kuota\n"
 "tidak terlampaui, lalu \"git restore --staged :/\" untuk pulihkan."
 
 #: builtin/config.c
@@ -8085,6 +8102,10 @@ msgstr "pangkas objek tak tereferensi"
 msgid "pack unreferenced objects separately"
 msgstr "pak objek tak terujuk secara terpisah"
 
+#: builtin/gc.c builtin/repack.c
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "batasi ukuran pak sisa dengan --cruft"
+
 #: builtin/gc.c
 msgid "be more thorough (increased runtime)"
 msgstr "jadi lebih cermat (waktu yang dijalankan bertambah)"
@@ -8306,14 +8327,6 @@ msgstr ""
 msgid "'crontab' died"
 msgstr "'crontab' mati"
 
-#: builtin/gc.c
-msgid "failed to start systemctl"
-msgstr "gagal memulai systemctl"
-
-#: builtin/gc.c
-msgid "failed to run systemctl"
-msgstr "gagal menjalankan systemctl"
-
 #: builtin/gc.c builtin/worktree.c
 #, c-format
 msgid "failed to delete '%s'"
@@ -8324,6 +8337,14 @@ msgstr "gagal menghapus '%s'"
 msgid "failed to flush '%s'"
 msgstr "gagal membilas '%s'"
 
+#: builtin/gc.c
+msgid "failed to start systemctl"
+msgstr "gagal memulai systemctl"
+
+#: builtin/gc.c
+msgid "failed to run systemctl"
+msgstr "gagal menjalankan systemctl"
+
 #: builtin/gc.c
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
@@ -8354,6 +8375,10 @@ msgstr "penjadwal"
 msgid "scheduler to trigger git maintenance run"
 msgstr "penjadwal untuk memicu git maintenance run"
 
+#: builtin/gc.c
+msgid "failed to set up maintenance schedule"
+msgstr "gagal mempersiapkan jadwal pemeliharaan"
+
 #: builtin/gc.c
 msgid "failed to add repo to global config"
 msgstr "gagal menambahkan repositori ke konfigurasi global"
@@ -8391,6 +8416,11 @@ msgstr "tidak ada dukungan utas, abaikan %s"
 msgid "unable to read tree (%s)"
 msgstr "tidak dapat membaca pohon (%s)"
 
+#: builtin/grep.c
+#, c-format
+msgid "unable to read tree %s"
+msgstr "tidak dapat membaca pohon %s"
+
 #: builtin/grep.c
 #, c-format
 msgid "unable to grep from object of type %s"
@@ -8450,7 +8480,7 @@ msgid "search in subdirectories (default)"
 msgstr "cari dalam subdirektori (asali)"
 
 #: builtin/grep.c
-msgid "descend at most <depth> levels"
+msgid "descend at most <n> levels"
 msgstr "turun paling banyak <kedalaman> tingkat"
 
 #: builtin/grep.c
@@ -8920,11 +8950,6 @@ msgstr "inkonsistensi inflate serius"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "TUMBUKAN SHA1 DITEMUKAN DENGAN %s !"
 
-#: builtin/index-pack.c builtin/pack-objects.c
-#, c-format
-msgid "unable to read %s"
-msgstr "tidak dapat membaca %s"
-
 #: builtin/index-pack.c
 #, c-format
 msgid "cannot read existing object info %s"
@@ -9102,11 +9127,13 @@ msgstr "kesalahan fsck dalam objek paket"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<direktori templat>]\n"
 "         [--separate-git-dir <direktori git>] [--object-format=<format>]\n"
+"\t  [--ref-format=<format>]\n"
 "         [-b <nama cabang> | --initial-branch=<nama cabang>]\n"
 "         [--shared[=<perizinan>]] [<direktori>]"
 
@@ -9162,11 +9189,12 @@ msgstr "--separate-git-dir tidak kompatibel dengan repositori bare"
 #: builtin/interpret-trailers.c
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<nilai>])...]\n"
+"                       [(--trailer (<kunci>|<alias kunci>)"
+"[(=|:)<nilai>])...]\n"
 "                       [--parse] [<berkas>...]"
 
 #: builtin/interpret-trailers.c
@@ -9177,6 +9205,10 @@ msgstr "sunting berkas di tempat"
 msgid "trim empty trailers"
 msgstr "pangkas trailer kosong"
 
+#: builtin/interpret-trailers.c
+msgid "placement"
+msgstr "penempatan"
+
 #: builtin/interpret-trailers.c
 msgid "where to place the new trailer"
 msgstr "dimana trailer baru ditempatkan"
@@ -9194,20 +9226,20 @@ msgid "output only the trailers"
 msgstr "keluarkan hanya trailer"
 
 #: builtin/interpret-trailers.c
-msgid "do not apply config rules"
-msgstr "jangan terapkan aturan konfigurasi"
+msgid "do not apply trailer.* configuration variables"
+msgstr "jangan terapkan variabel konfigurasi trailer.*"
 
 #: builtin/interpret-trailers.c
-msgid "join whitespace-continued values"
-msgstr "gabungkan nilai yang dilanjutkan oleh spasi"
+msgid "reformat multiline trailer values as single-line values"
+msgstr "format ulang nilai trailer multibaris sebagai nilai satu baris."
 
 #: builtin/interpret-trailers.c
-msgid "set parsing options"
-msgstr "setel opsi penguraian"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "alias untuk --only-trailers --only-input --unfold"
 
 #: builtin/interpret-trailers.c
-msgid "do not treat --- specially"
-msgstr "jangan memperlakukan khusus ---"
+msgid "do not treat \"---\" as the end of input"
+msgstr "jangan perlakukan \"---\" sebagai ujung masukan"
 
 #: builtin/interpret-trailers.c
 msgid "trailer(s) to add"
@@ -9266,7 +9298,7 @@ msgstr ""
 "lacak evolusi rentang baris <awal>,<akhir> atau fungsi :<nama fungsi> dalam "
 "<berkas>"
 
-#: builtin/log.c builtin/shortlog.c bundle.c
+#: builtin/log.c builtin/replay.c builtin/shortlog.c bundle.c
 #, c-format
 msgid "unrecognized argument: %s"
 msgstr "argumen tidak dikenal: %s"
@@ -9321,6 +9353,11 @@ msgstr "butuh tepatnya satu rentang"
 msgid "not a range"
 msgstr "bukan sebuah rentang"
 
+#: builtin/log.c
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "tidak dapat membaca berkas deskripsi cabang '%s'"
+
 #: builtin/log.c
 msgid "cover letter needs email format"
 msgstr "sampul surat butuh format email"
@@ -9449,6 +9486,10 @@ msgstr "cover-from-description-mode"
 msgid "generate parts of a cover letter based on a branch's description"
 msgstr "buat bagian dari sampul surat berdasarkan deskripsi cabang"
 
+#: builtin/log.c
+msgid "use branch description from file"
+msgstr "gunakan deskripsi cabang dari berkas"
+
 #: builtin/log.c
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "gunakan [<prefix>] daripada [PATCH]"
@@ -10013,10 +10054,22 @@ msgstr ""
 "git merge-file [<opsi>] [-L <nama 1> [-L <asli> [-L <nama 2>]]] <berkas 1> "
 "<berkas asli> <berkas 2>"
 
+#: builtin/merge-file.c diff.c
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"opsi diff-algorithm terima \"myers\", \"minimal\", \"patience\" dan "
+"\"histogram\""
+
 #: builtin/merge-file.c
 msgid "send results to standard output"
 msgstr "kirim hasil ke keluaran standar"
 
+#: builtin/merge-file.c
+msgid "use object IDs instead of filenames"
+msgstr "gunakan ID objek daripada nama berkas"
+
 #: builtin/merge-file.c
 msgid "use a diff3 based merge"
 msgstr "gunakan penggabungan berdasarkan diff3"
@@ -10037,6 +10090,14 @@ msgstr "untuk konflik, gunakan versi mereka"
 msgid "for conflicts, use a union version"
 msgstr "untuk konflik, gunakan versi bersatu"
 
+#: builtin/merge-file.c diff.c
+msgid "<algorithm>"
+msgstr "<algoritma>"
+
+#: builtin/merge-file.c diff.c
+msgid "choose a diff algorithm"
+msgstr "pilih algoritma diff"
+
 #: builtin/merge-file.c
 msgid "for conflicts, use this marker size"
 msgstr "untuk konflik, gunakan ukuran penanda ini"
@@ -10049,6 +10110,15 @@ msgstr "jangan peringatkan tentang konflik"
 msgid "set labels for file1/orig-file/file2"
 msgstr "setel label untuk file1/orig-file/file2"
 
+#: builtin/merge-file.c
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "objek '%s' tidak ada"
+
+#: builtin/merge-file.c
+msgid "Could not write object file"
+msgstr "Tidak dapat menulis berkas objek"
+
 #: builtin/merge-recursive.c
 #, c-format
 msgid "unknown option %s"
@@ -10128,13 +10198,22 @@ msgstr "lakukan banyak penggabungan, satu per baris masukan"
 msgid "specify a merge-base for the merge"
 msgstr "harus menyebutkan sebuah dasar penggabungan untuk penggabungan"
 
+#: builtin/merge-tree.c builtin/merge.c builtin/pull.c
+msgid "option=value"
+msgstr "opsi=nilai"
+
+#: builtin/merge-tree.c builtin/merge.c builtin/pull.c
+msgid "option for selected merge strategy"
+msgstr "opsi untuk strategi penggabungan yang dipilih"
+
 #: builtin/merge-tree.c
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge tidak kompatibel dengan semua opsi lainnya"
 
-#: builtin/merge-tree.c
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base tidak kompatibel dengan --stdin"
+#: builtin/merge-tree.c builtin/merge.c
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "opsi strategi tidak dikenal: -X%s"
 
 #: builtin/merge-tree.c builtin/notes.c
 #, c-format
@@ -10224,14 +10303,6 @@ msgstr "strategi"
 msgid "merge strategy to use"
 msgstr "strategi penggabungan yang digunakan"
 
-#: builtin/merge.c builtin/pull.c
-msgid "option=value"
-msgstr "opsi=nilai"
-
-#: builtin/merge.c builtin/pull.c
-msgid "option for selected merge strategy"
-msgstr "opsi untuk strategi penggabungan yang dipilih"
-
 #: builtin/merge.c
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr "pesan komit penggabungan (untuk penggabungan bukan maju cepat)"
@@ -10301,7 +10372,7 @@ msgstr "'%s' tidak menunjuk pada sebuah komit"
 msgid "Bad branch.%s.mergeoptions string: %s"
 msgstr "Untai branch.%s.mergeoptions jelek: %s"
 
-#: builtin/merge.c builtin/stash.c merge-recursive.c
+#: builtin/merge.c merge-recursive.c
 msgid "Unable to write index."
 msgstr "Tidak dapat menulis indeks."
 
@@ -10311,11 +10382,6 @@ msgstr "Tak tangani apapun selain penggabungan dua kepala."
 
 #: builtin/merge.c
 #, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "opsi strategi tidak dikenal: -X%s"
-
-#: builtin/merge.c t/helper/test-fast-rebase.c
-#, c-format
 msgid "unable to write %s"
 msgstr "tidak dapat menulis %s"
 
@@ -10682,8 +10748,8 @@ msgid "can not move directory into itself"
 msgstr "tidak dapat memindahkan direktori ke dirinya sendiri"
 
 #: builtin/mv.c
-msgid "cannot move directory over file"
-msgstr "tidak dapat memindahkan direktori ke berkas"
+msgid "destination already exists"
+msgstr "tujuan sudah ada"
 
 #: builtin/mv.c
 msgid "source directory is empty"
@@ -11327,6 +11393,11 @@ msgstr "Memampatkan objek"
 msgid "inconsistency with delta count"
 msgstr "ketidakkonsistenan dengan hitungan delta"
 
+#: builtin/pack-objects.c
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "nilai pack.allowPackReuse tidak valid: '%s'"
+
 #: builtin/pack-objects.c
 #, c-format
 msgid ""
@@ -11634,10 +11705,6 @@ msgid "--thin cannot be used to build an indexable pack"
 msgstr ""
 "--thin tidak dapat digunakan untuk membangun sebuah pak yang dapat diindeks"
 
-#: builtin/pack-objects.c
-msgid "cannot use --filter without --stdout"
-msgstr "tidak dapat menggunakan --filter tanpa --stdout"
-
 #: builtin/pack-objects.c
 msgid "cannot use --filter with --stdin-packs"
 msgstr "tidak dapat menggunakan --filter dengan --stdin-packs"
@@ -11654,10 +11721,6 @@ msgstr "tidak dapat menggunakan daftar revisi internal dengan --cruft"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "tidak dapat menggunakan --stdin-packs dengan --cruft"
 
-#: builtin/pack-objects.c
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "tidak dapat menggunakan --max-pack-size dengan --cruft"
-
 #: builtin/pack-objects.c
 msgid "Enumerating objects"
 msgstr "Menghitung objek"
@@ -11666,10 +11729,10 @@ msgstr "Menghitung objek"
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Total %<PRIu32> (delta %<PRIu32>), digunakan ulang %<PRIu32> (delta "
-"%<PRIu32>), pak yang digunakan ulang %<PRIu32>"
+"%<PRIu32>), pak yang digunakan ulang %<PRIu32> (dari %<PRIuMAX>)"
 
 #: builtin/pack-redundant.c
 msgid ""
@@ -12788,7 +12851,7 @@ msgid "The --edit-todo action can only be used during interactive rebase."
 msgstr ""
 "Aksi --edit-todo hanya dapat digunakan selama pendasaran ulang interaktif."
 
-#: builtin/rebase.c t/helper/test-fast-rebase.c
+#: builtin/rebase.c
 msgid "Cannot read HEAD"
 msgstr "Tidak dapat membaca HEAD"
 
@@ -12834,18 +12897,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "tombol `C' harap nilai numerik"
 
-#: builtin/rebase.c
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy butuh --merge atau --interactive"
-
-#: builtin/rebase.c
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"opsi penerapan tidak kompatibel dengan rebase.autoSquash. "
-"Pertimbangkanmenambahkan --no-autosquash"
-
 #: builtin/rebase.c
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
@@ -13344,10 +13395,10 @@ msgid_plural ""
 "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
 "to delete them, use:"
 msgstr[0] ""
-"Catatan: Sebuah cabang diluar hierarki refs/remotes tidak dihapus;\n"
+"Catatan: Sebuah cabang diluar hierarki refs/remotes/ tidak dihapus;\n"
 "untuk menghapusnya, gunakan:"
 msgstr[1] ""
-"Catatan: Beberapa cabang diluar hierarki refs/remotes tidak dihapus;\n"
+"Catatan: Beberapa cabang diluar hierarki refs/remotes/ tidak dihapus;\n"
 "untuk menghapusnya, gunakan:"
 
 #: builtin/remote.c
@@ -13707,6 +13758,11 @@ msgstr "tidak dapat menutup berkas sementara jepretan referensi"
 msgid "could not remove stale bitmap: %s"
 msgstr "tidak dapt memindahkan bitmap basi: %s"
 
+#: builtin/repack.c
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "nama berkas paket %s tidak diawali dengan %s"
+
 #: builtin/repack.c
 msgid "pack everything in a single pack"
 msgstr "pak semuanya dalam satu pak"
@@ -13809,18 +13865,22 @@ msgstr "tulis indeks multipak dari pak yang dihasilkan"
 msgid "pack prefix to store a pack containing pruned objects"
 msgstr "awalan pak untuk menyimpan pak berisi objek terpangkas"
 
+#: builtin/repack.c
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "awalan pak untuk menyimpan pak berisi objek tersaring"
+
 #: builtin/repack.c
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "tidak dapat menghapus pak dalam repositori objek berharga"
 
 #: builtin/repack.c
-msgid "Nothing new to pack."
-msgstr "Tidak ada yang baru untuk dipak."
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "opsi '%s' tidak dapat digunakan bersamaan dengan '%s'"
 
 #: builtin/repack.c
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "nama berkas paket %s tidak diawali dengan %s"
+msgid "Nothing new to pack."
+msgstr "Tidak ada yang baru untuk dipak."
 
 #: builtin/repack.c
 #, c-format
@@ -14075,6 +14135,94 @@ msgstr "--convert-graft-file tidak mengambil argumen"
 msgid "only one pattern can be given with -l"
 msgstr "hanya satu pola yang dapat diberikan dengan -l"
 
+#: builtin/replay.c
+msgid "need some commits to replay"
+msgstr "butuh beberapa komit untuk dimainkan ulang"
+
+#: builtin/replay.c
+msgid "--onto and --advance are incompatible"
+msgstr "--onto dan --advance tidak kompatibel"
+
+#: builtin/replay.c
+msgid "all positive revisions given must be references"
+msgstr "semua revisi positif yang diberikan haruslah referensi"
+
+#: builtin/replay.c
+msgid "argument to --advance must be a reference"
+msgstr "argumen pada --advance harus sebuah referensi"
+
+#: builtin/replay.c
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"tidak dapat memajukan target dengan banyak sumber karena pengurutannya akan "
+"menjadi tidak jelas"
+
+#: builtin/replay.c
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr ""
+"tidak dapat menentukan secara tidak langsung apakah ini operasi --advance "
+"atau --onto"
+
+#: builtin/replay.c
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"tidak dapat memajukan target dengan banyak cabang sumber karena "
+"pengurutannya akan menjadi tidak jelas"
+
+#: builtin/replay.c
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "tidak dapat menentukan secara tidak langsung dasar untuk --onto"
+
+#: builtin/replay.c
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(EKSPERIMENTAL!) git replay ([--contained] --onto <dasar baru> | --advance "
+"<cabang>) <rentang revisi>..."
+
+#: builtin/replay.c
+msgid "make replay advance given branch"
+msgstr "buat pemainan ulang memajukan caban yang diberikan"
+
+#: builtin/replay.c
+msgid "replay onto given commit"
+msgstr "mainkan ulang pada komit yang diberikan"
+
+#: builtin/replay.c
+msgid "advance all branches contained in revision-range"
+msgstr "majukan semua cabang yang berada pada rentang komit"
+
+#: builtin/replay.c
+msgid "option --onto or --advance is mandatory"
+msgstr "opsi --onto atau --advance diwajibkan"
+
+#: builtin/replay.c
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"beberapa opsi jalan revisi akan ditimpa oleh karena bit '%s' di 'struct "
+"rev_info' akan dipaksakan"
+
+#: builtin/replay.c
+msgid "error preparing revisions"
+msgstr "kesalahan menyiapkan revisi"
+
+#: builtin/replay.c
+msgid "replaying down to root commit is not supported yet!"
+msgstr "memainkan ulang ke komit akar belum didukung!"
+
+#: builtin/replay.c
+msgid "replaying merge commits is not supported yet!"
+msgstr "memainkan ulang komit penggabungan belum didukung!"
+
 #: builtin/rerere.c
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
@@ -14337,22 +14485,14 @@ msgstr "--prefix butuh sebuah argumen"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "mode untuk --abbrev-ref tidak dikenal: %s"
 
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden tidak dapat digunakan bersamaan dengan --branches"
-
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden tidak dapat digunakan bersamaan dengan --tags"
-
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden tidak dapat digunakan dengan --remotes"
-
 #: builtin/rev-parse.c setup.c
 msgid "this operation must be run in a work tree"
 msgstr "operasi ini harus dijalankan di dalam pohon kerja"
 
+#: builtin/rev-parse.c
+msgid "Could not read the index"
+msgstr "Tidak dapat membaca indeks"
+
 #: builtin/rev-parse.c
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
@@ -14785,11 +14925,21 @@ msgstr "algoritma hash tidak dikenal"
 
 #: builtin/show-ref.c
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+"             [--heads] [--] [<pola>...]"
+
+#: builtin/show-ref.c
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pola>...]"
 
@@ -14797,6 +14947,18 @@ msgstr ""
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<pola>]"
 
+#: builtin/show-ref.c
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <referensi>"
+
+#: builtin/show-ref.c
+msgid "reference does not exist"
+msgstr "referensi tidak ada"
+
+#: builtin/show-ref.c
+msgid "failed to look up reference"
+msgstr "gagal mencari referensi"
+
 #: builtin/show-ref.c
 msgid "only show tags (can be combined with heads)"
 msgstr "hanya perlihatkan tag (bisa dikombinasikan dengan kepala)"
@@ -14805,6 +14967,10 @@ msgstr "hanya perlihatkan tag (bisa dikombinasikan dengan kepala)"
 msgid "only show heads (can be combined with tags)"
 msgstr "hanya perlihatkan kepala (bisa dikombinasikan dengan tag)"
 
+#: builtin/show-ref.c
+msgid "check for reference existence without resolving"
+msgstr "periksa adanya referensi tanpa penguraian"
+
 #: builtin/show-ref.c
 msgid "stricter reference checking, requires exact ref path"
 msgstr "pemeriksaan referensi lebih ketat, butuh jalur referensi eksak"
@@ -15827,6 +15993,10 @@ msgstr ""
 "shallow] [--reference <repositori>] [--recursive] [--[no-]single-branch] "
 "[--] [<jalur>...]"
 
+#: builtin/submodule--helper.c submodule.c
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "Gagal menguraikan HEAD sebagai referensi valid."
+
 #: builtin/submodule--helper.c
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<opsi>] [<jalur>...]"
@@ -16408,6 +16578,10 @@ msgstr "(untuk porselen) lupakan konflik tak terselesaikan yang disimpan"
 msgid "write index in this format"
 msgstr "tulis indeks dalam format ini"
 
+#: builtin/update-index.c
+msgid "report on-disk index format version"
+msgstr "laporkan versi format indeks pada-disk"
+
 #: builtin/update-index.c
 msgid "enable or disable split index"
 msgstr "aktifkan atau nonaktifkan indeks terpisah"
@@ -16440,6 +16614,16 @@ msgstr "tandai berkas sebagai fsmonitor valid"
 msgid "clear fsmonitor valid bit"
 msgstr "bersihkan bita fsmonitor valid"
 
+#: builtin/update-index.c
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#: builtin/update-index.c
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "index-version: sebelumnya %d, disetel ke %d"
+
 #: builtin/update-index.c
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
@@ -16634,7 +16818,7 @@ msgstr "Tidak ada cabang sumber yang mungkin, menyimpulkan '--orphan'"
 #: builtin/worktree.c
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
@@ -16648,7 +16832,7 @@ msgstr ""
 #: builtin/worktree.c
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
@@ -16726,6 +16910,11 @@ msgstr "tidak dapat membuat direktori '%s'"
 msgid "initializing"
 msgstr "menginisialisasi"
 
+#: builtin/worktree.c
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "tidak dapat menemukan pohon kerja yang dibuat '%s'"
+
 #: builtin/worktree.c
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
@@ -16766,17 +16955,11 @@ msgstr ""
 #: builtin/worktree.c
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
 "Tidak ada referensi lokal atau remote yang ada meskipun salah satu remote\n"
-"ada, berhenti. Gunakan 'add -f' untuk menimpa atau mengambil remote "
-"terlebih\n"
-"dahulu"
-
-#: builtin/worktree.c
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "'%s' dan '%s' tidak dapat digunakan bersamaan"
+"ada, berhenti; gunakan 'add -f' untuk menimpa atau mengambil remote\n"
+"terlebih dahulu"
 
 #: builtin/worktree.c
 msgid "checkout <branch> even if already checked out in other worktree"
@@ -16792,7 +16975,7 @@ msgid "create or reset a branch"
 msgstr "buat atau setel ulang sebuah cabang"
 
 #: builtin/worktree.c
-msgid "create unborn/orphaned branch"
+msgid "create unborn branch"
 msgstr "buat cabang belum lahir/yatim"
 
 #: builtin/worktree.c
@@ -16822,12 +17005,8 @@ msgstr "Opsi '%s', '%s', dan '%s' tidak dapat digunakan bersamaan"
 
 #: builtin/worktree.c
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "Opsi '%s', dan '%s' tidak dapat digunakan bersamaan"
-
-#: builtin/worktree.c
-msgid "<commit-ish>"
-msgstr "<mirip-komit>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "opsi '%s' dan mirip-komit tidak dapat digunakan bersamaan"
 
 #: builtin/worktree.c
 msgid "added with --lock"
@@ -17168,6 +17347,11 @@ msgstr "index-pack mati"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "id bingkah pengakhiran muncul lebih awal dari yang diharapkan"
 
+#: chunk-format.c
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "id bingkah %<PRIx32> tidak terata %d-bita"
+
 #: chunk-format.c
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
@@ -17239,9 +17423,8 @@ msgid "Move objects and refs by archive"
 msgstr "Pindahkan objek dan referensi oleh arsip"
 
 #: command-list.h
-msgid "Provide content or type and size information for repository objects"
-msgstr ""
-"Sediakan isi atau informasi tipe dan ukuran berkas untuk objek repositori"
+msgid "Provide contents or details of repository objects"
+msgstr "Sediakan isi atau detail objek repositori"
 
 #: command-list.h
 msgid "Display gitattributes information"
@@ -17625,6 +17808,12 @@ msgstr "Pak objek tak terpak di dalam repositori"
 msgid "Create, list, delete refs to replace objects"
 msgstr "Buat, daftar, hapus referensi untuk mengganti objek"
 
+#: command-list.h
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"EKSPERIMENTAL: Mainkan ulang komit pada dasar baru, dan juga bekerja pada "
+"repositori bare"
+
 #: command-list.h
 msgid "Generates a summary of pending changes"
 msgstr "Buat ringkasan perubahan tertunda"
@@ -17787,8 +17976,8 @@ msgid "Display version information about Git"
 msgstr "Perlihatkan info versi Git"
 
 #: command-list.h
-msgid "Show logs with difference each commit introduces"
-msgstr "Perlihatkan log dengan perbedaan yang dimasukkan setiap komit"
+msgid "Show logs with differences each commit introduces"
+msgstr "Perlihatkan log dengan perbedaan yang diperkenalkan pada setiap komit"
 
 #: command-list.h
 msgid "Manage multiple working trees"
@@ -17942,6 +18131,39 @@ msgstr "Alat untuk mengelola repositori Git besar"
 msgid "commit-graph file is too small"
 msgstr "berkas grafik komit terlalu kecil"
 
+#: commit-graph.c
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "bingkah oid grafik komit kipas keluar salah ukuran"
+
+#: commit-graph.c
+msgid "commit-graph fanout values out of order"
+msgstr "nilai kipas keluar grafik komit tidak berurutan"
+
+#: commit-graph.c
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "bingkah OID pencarian grafik komit salah ukuran"
+
+#: commit-graph.c
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "bingkah data grafik komit salah ukuran"
+
+#: commit-graph.c
+msgid "commit-graph generations chunk is wrong size"
+msgstr "bingkah generasi grafik komit salah ukuran"
+
+#: commit-graph.c
+msgid "commit-graph changed-path index chunk is too small"
+msgstr "bingkah indeks grafik komit jalur berubah terlalu kecil"
+
+#: commit-graph.c
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"mengabaikan bingkah jalur berubah yang terlalu kecil (%<PRIuMAX> < "
+"%<PRIuMAX>) di dalam berkas grafik komit"
+
 #: commit-graph.c
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
@@ -17962,10 +18184,27 @@ msgstr "versi hash grafik komit %X tidak cocok dengan versi %X"
 msgid "commit-graph file is too small to hold %u chunks"
 msgstr "berkas grafik komit terlalu kecil untuk menyimpan %u bingkah"
 
+#: commit-graph.c
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr ""
+"bingkah grafik komit OID kipas keluar yang diperlukan hilang atau rusak"
+
+#: commit-graph.c
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr "bingkah grafik komit OID pencarian yang diperlukan hilang atau rusak"
+
+#: commit-graph.c
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr "bingkah grafik komit data komit yang diperlukan hilang atau rusak"
+
 #: commit-graph.c
 msgid "commit-graph has no base graphs chunk"
 msgstr "grafik komit tidak punya bingkah grafik dasar"
 
+#: commit-graph.c
+msgid "commit-graph base graphs chunk is too small"
+msgstr "bingkah grafik komit dasar terlalu kecil"
+
 #: commit-graph.c
 msgid "commit-graph chain does not match"
 msgstr "rantai grafik komit tidak cocok"
@@ -17975,6 +18214,10 @@ msgstr "rantai grafik komit tidak cocok"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "jumlah komit pada grafik dasar terlalu tinggi: %<PRIuMAX>"
 
+#: commit-graph.c
+msgid "commit-graph chain file too small"
+msgstr "berkas rantai grafik komit terlalu kecil"
+
 #: commit-graph.c
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
@@ -17997,6 +18240,14 @@ msgstr "tidak dapat menemukan komit %s"
 msgid "commit-graph requires overflow generation data but has none"
 msgstr "grafik komit memerlukan pembuatan data meluap tapi tidak punya"
 
+#: commit-graph.c
+msgid "commit-graph overflow generation data is too small"
+msgstr "data generasi luapan grafik komit terlalu kecil"
+
+#: commit-graph.c
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "penunjuk tepi tambahan grafik komit di luar batas"
+
 #: commit-graph.c
 msgid "Loading known commits in commit graph"
 msgstr "Memuat komit yang dikenal di grafik komit"
@@ -18152,22 +18403,6 @@ msgstr "induk grafik komit untuk %s adalah %s != %s"
 msgid "commit-graph parent list for commit %s terminates early"
 msgstr "daftar induk grafik komit untuk komit %s berakhir lebih awal"
 
-#: commit-graph.c
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"grafik komit punya angka pembuatan nol untuk komit %s, tapi bukan nol di "
-"tempat lain"
-
-#: commit-graph.c
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"grafik komit punya angka pembuatan bukan nol untuk komit %s, tapi nol di "
-"tempat lain"
-
 #: commit-graph.c
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
@@ -18180,6 +18415,15 @@ msgstr ""
 "tanggal komit untuk komit %s di dalam grafik komit yaitu %<PRIuMAX> != "
 "%<PRIuMAX>"
 
+#: commit-graph.c
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"grafik komit punya baik generasi nol dan bukan nol (seperti komit '%s' dan "
+"'%s')"
+
 #: commit-graph.c
 msgid "Verifying commits in commit graph"
 msgstr "Memverifikasi komit di dalam grafik komit"
@@ -18209,6 +18453,12 @@ msgstr ""
 "Matikan pesan ini dengan menjalankan\n"
 "\"git config advice.graftFileDeprecated false\""
 
+#: commit.c
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr ""
+"komit %s ada pada grafik komit tapi tidak ada di dalam basis data objek"
+
 #: commit.c
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
@@ -18757,11 +19007,6 @@ msgstr "referensi '%s' tidak menunjuk pada sebuah blob"
 msgid "unable to resolve config blob '%s'"
 msgstr "tidak dapat menguraikan blob konfigurasi '%s'"
 
-#: config.c
-#, c-format
-msgid "failed to parse %s"
-msgstr "gagal menguraikan %s"
-
 #: config.c
 msgid "unable to parse command-line config"
 msgstr "gagal menguraikan konfigurasi baris perintah"
@@ -19341,10 +19586,6 @@ msgstr "gagal menulis arsip"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base tidak bekerja dengan rentang"
 
-#: diff-lib.c
-msgid "--merge-base only works with commits"
-msgstr "--merge-base hanya bekerja dengan komit"
-
 #: diff-lib.c
 msgid "unable to get HEAD"
 msgstr "tidak dapat mendapatkan HEAD"
@@ -19418,6 +19659,11 @@ msgstr ""
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr "Nilai tidak dikenal untuk variabel konfigurasi 'diff.submodule': '%s'"
 
+#: diff.c transport.c
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "nilai tidak dikenal untuk konfigurasi '%s': %s"
+
 #: diff.c
 #, c-format
 msgid ""
@@ -19514,14 +19760,6 @@ msgstr "argumen --color-moved jelek: %s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "mode tidak valid '%s' dalam --color-moved-ws"
 
-#: diff.c
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"opsi diff-algorithm terima \"myers\", \"minimal\", \"patience\" dan "
-"\"histogram\""
-
 #: diff.c
 #, c-format
 msgid "invalid argument to %s"
@@ -19579,8 +19817,8 @@ msgid "output only the last line of --stat"
 msgstr "keluarkan hanya baris terakhir --stat"
 
 #: diff.c
-msgid "<param1,param2>..."
-msgstr "<parameter 1,parameter 2>..."
+msgid "<param1>,<param2>..."
+msgstr "<parameter 1>,<parameter 2>..."
 
 #: diff.c
 msgid ""
@@ -19593,8 +19831,8 @@ msgid "synonym for --dirstat=cumulative"
 msgstr "sinonim untuk --dirstat=cumulative"
 
 #: diff.c
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "sinonim untuk --dirstat=files,param1,param2..."
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "sinonim untuk --dirstat=files,<parameter 1>,<parameter 2>..."
 
 #: diff.c
 msgid "warn if changes introduce conflict markers or whitespace errors"
@@ -19826,14 +20064,6 @@ msgstr "buat diff menggunakan algoritma \"diff sabar\""
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "buat diff menggunakan algoritma \"diff histogram\""
 
-#: diff.c
-msgid "<algorithm>"
-msgstr "<algoritma>"
-
-#: diff.c
-msgid "choose a diff algorithm"
-msgstr "pilih algoritma diff"
-
 #: diff.c
 msgid "<text>"
 msgstr "<teks>"
@@ -21113,13 +21343,13 @@ msgstr ""
 "%s"
 
 #: merge-ort.c merge-recursive.c
-msgid "Failed to execute internal merge"
-msgstr "Gagal menjalankan penggabungan internal"
+msgid "failed to execute internal merge"
+msgstr "gagal menjalankan penggabungan internal"
 
 #: merge-ort.c merge-recursive.c
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "Tidak dapat menambahkan %s ke basis data"
+msgid "unable to add %s to database"
+msgstr "tidak dapat menambahkan %s ke basis data"
 
 #: merge-ort.c merge-recursive.c
 #, c-format
@@ -21642,6 +21872,22 @@ msgstr "gagal membaca tembolok"
 msgid "multi-pack-index OID fanout is of the wrong size"
 msgstr "OID kipas-keluar indeks multipak salah ukuran"
 
+#: midx.c
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"kipas-keluar oid tidak berurutan: fanout[%d] =%<PRIx32> > %<PRIx32> = "
+"fanout[%d]"
+
+#: midx.c
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "bingkah pencarian OID kipas-keluar indeks multipak salah ukuran"
+
+#: midx.c
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr "bingkah offset OID kipas-keluar indeks multipak salah ukuran"
+
 #: midx.c
 #, c-format
 msgid "multi-pack-index file %s is too small"
@@ -21664,20 +21910,26 @@ msgid "multi-pack-index hash version %u does not match version %u"
 msgstr "versi hash indeks multipak %u tidak cocok dengan versi %u"
 
 #: midx.c
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "indeks multipak kehilangan bingkah pack-name yang diperlukan"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr "bingkah nama pak indeks multipak yang diperlukan hilang atau rusak"
 
 #: midx.c
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "indeks multipak kehilangan bingkah OID kipas keluar yang diperlukan"
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr ""
+"bingkah OID kipas-keluar indeks multipak yang diperlukan hilang atau rusak"
 
 #: midx.c
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "indeks multipak kehilangan bingkah pencarian OID yang diperlukan"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr ""
+"bingkah pencarian OID indeks multipak yang diperlukan  hilang atau rusak"
 
 #: midx.c
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "indeks multipak kehilangan bingkah offset objek yang diperlukan"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr "bingkah offset objek indeks multipak yang diperlukan hilang atau rusak"
+
+#: midx.c
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "bingkah nama pak indeks multipak terlalu kecil"
 
 #: midx.c
 #, c-format
@@ -21689,10 +21941,23 @@ msgstr "nama pak indeks multipak tidak berurutan: '%s' sebelum '%s'"
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "pack-int-id jelek: %u (total pak %u)"
 
+#: midx.c
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "MIDX tidak berisi bingkah BTMP"
+
+#: midx.c
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "tidak dapat membuka pak terbitmap %<PRIu32>"
+
 #: midx.c
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr "indeks multipak simpan offset 64-bit, tapi off_t terlalu kecil"
 
+#: midx.c
+msgid "multi-pack-index large offset out of bounds"
+msgstr "offset indeks multipak besar di luar jangkauan"
+
 #: midx.c
 #, c-format
 msgid "failed to add packfile '%s'"
@@ -21792,14 +22057,6 @@ msgstr "checksum salah"
 msgid "Looking for referenced packfiles"
 msgstr "Mencari berkas pak yang direferensikan"
 
-#: midx.c
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr ""
-"kipas-keluar oid tidak berurutan: fanout[%d] =%<PRIx32> > %<PRIx32> = "
-"fanout[%d]"
-
 #: midx.c
 msgid "the midx contains no oid"
 msgstr "midx tidak berisi oid"
@@ -22437,6 +22694,10 @@ msgstr "bitmap multipak kehilangan indeks balik yang diperlukan"
 msgid "could not open pack %s"
 msgstr "tidak dapat membuka '%s'"
 
+#: pack-bitmap.c t/helper/test-read-midx.c
+msgid "could not determine MIDX preferred pack"
+msgstr "tidak dapat menentukan pak MIDX terpilih"
+
 #: pack-bitmap.c
 #, c-format
 msgid "preferred pack (%s) is invalid"
@@ -22460,6 +22721,11 @@ msgstr "tabel pencarian bitmap rusak: indeks komit %u di luar jangkauan"
 msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
 msgstr "bitmap ewah rusak: kepala terpotong untuk bitmap komit \"%s\""
 
+#: pack-bitmap.c
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr "tidak dapat memuat pak: '%s', mematikan penggunaan ulang pak"
+
 #: pack-bitmap.c
 #, c-format
 msgid "object '%s' not found in type bitmaps"
@@ -22571,6 +22837,14 @@ msgstr "checksum tidak valid"
 msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr "posisi indeks balik tidak valid pada %<PRIu64>: %<PRIu32> != %<PRIu32>"
 
+#: pack-revindex.c
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr "bingkah indeks balik multipak salah ukuran"
+
+#: pack-revindex.c
+msgid "could not determine preferred pack"
+msgstr "tidak dapat menentukan pak terpilih"
+
 #: pack-write.c
 msgid "cannot both write and verify reverse index"
 msgstr "tidak dapat kedua-duanya menulis dan memverifikasi indeks balik"
@@ -22634,16 +22908,6 @@ msgstr "opsi `%s' mengharapkan \"%s\" atau \"%s\""
 msgid "%s requires a value"
 msgstr "%s butuh sebuah nilai"
 
-#: parse-options.c
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s tidak kompatibel dengan %s"
-
-#: parse-options.c
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s : tidak kompatibel dengan sesuatu yang lain"
-
 #: parse-options.c
 #, c-format
 msgid "%s takes no value"
@@ -22745,6 +23009,11 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-NUM"
 
+#: parse-options.c
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "lawan dari --no-%s"
+
 #: parse-options.h
 msgid "expiry-date"
 msgstr "tanggal kadaluarsa"
@@ -22783,6 +23052,16 @@ msgid ""
 msgstr ""
 "dengan --pathspec-from-file, elemen spek jalur dipisahkan dengan karakter NUL"
 
+#: parse.c
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "nilai lingkungan boolean '%s' jelek untuk '%s'"
+
+#: parse.c
+#, c-format
+msgid "failed to parse %s"
+msgstr "gagal menguraikan %s"
+
 #: path.c
 #, c-format
 msgid "Could not make %s writable by group"
@@ -22843,6 +23122,11 @@ msgstr "Spek jalur ajaib '%c' tidak diterapkan di '%s'"
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s: 'literal' dan 'glob' tidak kompatibel"
 
+#: pathspec.c
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "'%s' di luar pohon direktori"
+
 #: pathspec.c
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
@@ -23040,11 +23324,6 @@ msgstr "tidak dapat menulis berkas indeks '%s'"
 msgid "unable to add '%s' to index"
 msgstr "tidak dapat menambahkan '%s' ke indeks"
 
-#: read-cache.c
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "tidak dapat men-stat '%s'"
-
 #: read-cache.c
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
@@ -23178,11 +23457,6 @@ msgstr "tidak dapat membuat indeks terpisah untuk indeks jarang"
 msgid "failed to convert to a sparse-index"
 msgstr "gagal mengubah ke indeks jarang"
 
-#: read-cache.c
-#, c-format
-msgid "could not stat '%s'"
-msgstr "tidak dapat men-stat '%s'"
-
 #: read-cache.c
 #, c-format
 msgid "unable to open git dir: %s"
@@ -23736,17 +24010,12 @@ msgstr "'%s' ada; tidak dapat membuat '%s'"
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "tidak dapat memproses '%s' dan '%s' pada waktu yang bersamaan"
 
-#: refs/files-backend.c
-#, c-format
-msgid "could not remove reference %s"
-msgstr "tidak dapat menghapus referensi %s"
-
-#: refs/files-backend.c refs/packed-backend.c
+#: refs.c
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "tidak dapat menghapus referensi %s: %s"
 
-#: refs/files-backend.c refs/packed-backend.c
+#: refs.c
 #, c-format
 msgid "could not delete references: %s"
 msgstr "tidak dapat menghapus referensi: %s"
@@ -23981,9 +24250,9 @@ msgid ""
 msgstr ""
 "Tujuan yang Anda berikan bukan nama referensi penuh (seperti \n"
 "dimulai dengan \"refs/\"). Kami mencoba menebak maksud Anda dengan:\n"
-"- Cari referensi yang cocok dengan '%s' pada sisi remote.\n"
-"- Perika apakah <src> yang sedang didorong ('%s') adalah \n"
-"  referensi pada \"refs/{heads,tags}\". Bila demikian kami \n"
+"- mencari referensi yang cocok dengan '%s' pada sisi remote.\n"
+"- memeriksa apakah <src> yang sedang didorong ('%s') adalah \n"
+"  referensi pada \"refs/{heads,tags}/\". Bila demikian kami \n"
 "  menambahkan awalan refs/{heads,tags}/ yang bersesuaian pada sisi \n"
 "  remote.\n"
 "\n"
@@ -24434,8 +24703,16 @@ msgid "only download metadata for the branch that will be checked out"
 msgstr "hanya unduh metadata untuk cabang yang akan dicheckout"
 
 #: scalar.c
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<options>] [--] <repositori> [<direktori>]"
+msgid "create repository within 'src' directory"
+msgstr "salin repositori di dalam direktori 'src'"
+
+#: scalar.c
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <cabang utama>] [--full-clone]\n"
+"\t[--[-no-]src] <url> [<pendaftaran>]"
 
 #: scalar.c
 #, c-format
@@ -24501,13 +24778,32 @@ msgstr "tidak dapat menghapus scalar.repo basi '%s'"
 
 #: scalar.c
 #, c-format
-msgid "removing stale scalar.repo '%s'"
+msgid "removed stale scalar.repo '%s'"
 msgstr "menghapus scalar.repo basi '%s'"
 
 #: scalar.c
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "repositori git pergi di '%s'"
+msgid "repository at '%s' has different owner"
+msgstr "repositori pada '%s' berpemilik lain"
+
+#: scalar.c
+#, c-format
+msgid "repository at '%s' has a format issue"
+msgstr "repositori pada '%s' ada masalah format"
+
+#: scalar.c
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "repositori tidak ditemukan di '%s'"
+
+#: scalar.c
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"untuk mencabut repositori ini dari Scalar, jalankan\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 #: scalar.c
 msgid ""
@@ -24896,7 +25192,7 @@ msgstr "identitas pengarang tidak valid '%s'"
 msgid "corrupt author: missing date information"
 msgstr "pengarang rusak: informasi tanggal hilang"
 
-#: sequencer.c t/helper/test-fast-rebase.c
+#: sequencer.c
 #, c-format
 msgid "could not update %s"
 msgstr "tidak dapat memperbarui %s"
@@ -24991,11 +25287,6 @@ msgstr "tidak dapat mendapatkan pesan komit untuk %s"
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s: tidak dapat menguraikan komit induk %s"
 
-#: sequencer.c
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "tidak dapat menamai ulang '%s' ke '%s'"
-
 #: sequencer.c
 #, c-format
 msgid "could not revert %s... %s"
@@ -25395,6 +25686,10 @@ msgstr "Menerapkan stase otomatis menghasilkan konflik."
 msgid "Autostash exists; creating a new stash entry."
 msgstr "Stase otomatis sudah ada; membuat entri stase baru."
 
+#: sequencer.c
+msgid "autostash reference is a symref"
+msgstr "referensi autostase itu referensi simbolik"
+
 #: sequencer.c
 msgid "could not detach HEAD"
 msgstr "tidak dapat melepas HEAD"
@@ -25432,13 +25727,13 @@ msgstr ""
 
 #: sequencer.c
 #, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "Mendasarkan ulang (%d/%d)%s"
+msgid "Stopped at %s...  %.*s\n"
+msgstr "Berhenti pada %s... %.*s\n"
 
 #: sequencer.c
 #, c-format
-msgid "Stopped at %s...  %.*s\n"
-msgstr "Berhenti pada %s... %.*s\n"
+msgid "Rebasing (%d/%d)%s"
+msgstr "Mendasarkan ulang (%d/%d)%s"
 
 #: sequencer.c
 #, c-format
@@ -25775,6 +26070,11 @@ msgstr "tidak menyalin templat dari '%s': %s"
 msgid "invalid initial branch name: '%s'"
 msgstr "nama cabang asal salah: '%s'"
 
+#: setup.c
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-init: --initial-branch=%s diabaikan"
+
 #: setup.c
 #, c-format
 msgid "unable to handle file type %d"
@@ -25790,14 +26090,16 @@ msgid "attempt to reinitialize repository with different hash"
 msgstr "mencoba menginisialisasi ulang repositori dengan hash yang berbeda"
 
 #: setup.c
-#, c-format
-msgid "%s already exists"
-msgstr "%s sudah ada"
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr ""
+"mencoba menginisialisasi ulang repositori dengan format penyimpanan "
+"referensi yang berbeda"
 
 #: setup.c
 #, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-init: --initial-branch=%s diabaikan"
+msgid "%s already exists"
+msgstr "%s sudah ada"
 
 #: setup.c
 #, c-format
@@ -26123,14 +26425,6 @@ msgstr "bersihkan pohon tembolok sebelum setiap iterasi"
 msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr "jumlah entri di dalam pohon tembolok untuk dinirvalidasi (asali 0)"
 
-#: t/helper/test-fast-rebase.c
-msgid "unhandled options"
-msgstr "opsi tak tertangani"
-
-#: t/helper/test-fast-rebase.c
-msgid "error preparing revisions"
-msgstr "kesalahan menyiapkan revisi"
-
 #: t/helper/test-reach.c
 #, c-format
 msgid "commit %s is not marked reachable"
@@ -26328,10 +26622,6 @@ msgstr "menyetel jalur layanan remote tidak didukung oleh protokol"
 msgid "invalid remote service path"
 msgstr "jalur layanan remote tidak valid"
 
-#: transport-helper.c transport.c
-msgid "operation not supported by protocol"
-msgstr "operasi tidak didukung oleh protokol"
-
 #: transport-helper.c
 #, c-format
 msgid "can't connect to subservice %s"
@@ -26495,11 +26785,6 @@ msgstr "tidak dapat menguraikan konfigurasi transport.color.*"
 msgid "support for protocol v2 not implemented yet"
 msgstr "dukungan untuk protokol v2 belum diterapkan"
 
-#: transport.c
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "nilai tidak dikenal untuk konfigurasi '%s': %s"
-
 #: transport.c
 #, c-format
 msgid "transport '%s' not allowed"
@@ -26560,6 +26845,10 @@ msgstr "operasi bundle-uri tidak didukung oleh protokol"
 msgid "could not retrieve server-advertised bundle-uri list"
 msgstr "tidak dapat menerima daftar bundle-uri teriklankan server"
 
+#: transport.c
+msgid "operation not supported by protocol"
+msgstr "operasi tidak didukung oleh protokol"
+
 #: tree-walk.c
 msgid "too-short tree object"
 msgstr "objek pohon terlalu pendek"
@@ -27020,6 +27309,10 @@ msgstr "tidak dapat mengakses '%s'"
 msgid "unable to get current working directory"
 msgstr "tidak dapat mendapatkan direktori kerja saat ini"
 
+#: wrapper.c
+msgid "unable to get random bytes"
+msgstr "tidak dapat mendapatkan bita acak"
+
 #: wt-status.c
 msgid "Unmerged paths:"
 msgstr "Jalur yang tak tergabung:"
@@ -27577,6 +27870,11 @@ msgstr "juga indeks Anda berisi perubahan yang belum dikomit."
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "tidak dapat %s: indeks Anda berisi perubahan yang belum dikomit."
 
+#: xdiff-interface.c
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "nilai gaya tidak dikenal '%s' diberikan untuk '%s'"
+
 #: git-merge-octopus.sh git-merge-resolve.sh
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
@@ -27799,13 +28097,13 @@ msgstr ""
 
 #: git-send-email.perl
 #, perl-format
-msgid "Failed to open %s: %s"
-msgstr "Gagal membuka %s: %s"
+msgid "Failed to open %s.final: %s"
+msgstr "Gagal membuka %s.final: %s"
 
 #: git-send-email.perl
 #, perl-format
-msgid "Failed to open %s.final: %s"
-msgstr "Gagal membuka %s.final: %s"
+msgid "Failed to open %s: %s"
+msgstr "Gagal membuka %s: %s"
 
 #: git-send-email.perl
 msgid "Summary email is empty, skipping it\n"
@@ -28046,22 +28344,3 @@ msgstr "Melewati %s dengan akhiran cadangan '%s'.\n"
 #, perl-format
 msgid "Do you really want to send %s? [y|N]: "
 msgstr "Anda benar-benar ingin mengirim %s? [y|N]: "
-
-#~ msgid "do not pass --keep-cr flag to git-mailsplit independent of am.keepcr"
-#~ msgstr ""
-#~ "jangan lewatkan opsi --keep-cr ke git-mailsplit tak bergantung pada am."
-#~ "keepcr"
-
-#~ msgid ""
-#~ "Updates were rejected because the tip of the remote-tracking\n"
-#~ "branch has been updated since the last checkout. You may want\n"
-#~ "to integrate those changes locally (e.g., 'git pull ...')\n"
-#~ "before forcing an update.\n"
-#~ msgstr ""
-#~ "Pembaruan ditolak karena ujung dari cabang pelacak remote\n"
-#~ "sudah diperbarui sejak checkout terakhir. Mungkin Anda ingin\n"
-#~ "integrasikan perubahan tersebut ke lokal (seperti 'git pull...')\n"
-#~ "sebelum memaksa pembaruan.\n"
-
-#~ msgid "or do not fetch any tag at all (--no-tags)"
-#~ msgstr "atau jangan mengambil tag apapun (--no-tags)"
index a14d0d6f38a3daefadd1bda92fddaa751ed807b7..786c2f749e71b1973245e9d43e6f6ebaa619d637 100644 (file)
--- a/po/sv.po
+++ b/po/sv.po
@@ -1,14 +1,14 @@
 # Swedish translations for Git.
-# Copyright (C) 2010-2023 Peter Krefting <peter@softwolves.pp.se>
+# Copyright (C) 2010-2024 Peter Krefting <peter@softwolves.pp.se>
 # This file is distributed under the same license as the Git package.
-# Peter Krefting <peter@softwolves.pp.se>, 2010-2023.
+# Peter Krefting <peter@softwolves.pp.se>, 2010-2024.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: git 2.42.0\n"
+"Project-Id-Version: git 2.44.0\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-16 07:40+0100\n"
-"PO-Revision-Date: 2023-08-16 07:42+0100\n"
+"POT-Creation-Date: 2024-02-16 07:58+0100\n"
+"PO-Revision-Date: 2024-02-16 07:59+0100\n"
 "Last-Translator: Peter Krefting <peter@softwolves.pp.se>\n"
 "Language-Team: Svenska <tp-sv@listor.tp-sv.se>\n"
 "Language: sv\n"
@@ -16,7 +16,7 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Gtranslator 3.38.0\n"
+"X-Generator: Gtranslator 42.0\n"
 
 #, c-format
 msgid "Huh (%s)?"
@@ -39,7 +39,7 @@ msgstr "Uppdatera"
 
 #, c-format
 msgid "could not stage '%s'"
-msgstr "kunde inte köa \"%s\""
+msgstr "kunde inte köa ”%s”"
 
 msgid "could not write index"
 msgstr "kunde inte skriva indexet"
@@ -56,7 +56,7 @@ msgstr "observera: %s spåras inte längre.\n"
 
 #, c-format
 msgid "make_cache_entry failed for path '%s'"
-msgstr "make_cache_entry misslyckades för sökvägen \"%s\""
+msgstr "make_cache_entry misslyckades för sökvägen ”%s”"
 
 msgid "Revert"
 msgstr "Återställ"
@@ -228,7 +228,7 @@ msgid ""
 "stashing."
 msgstr ""
 "Om patchen kan appliceras rent kommer det redigerade stycket att läggas till "
-"i \"stash\" omedelbart."
+"i ”stash” omedelbart."
 
 msgid ""
 "y - stash this hunk\n"
@@ -237,11 +237,11 @@ msgid ""
 "a - stash this hunk and all later hunks in the file\n"
 "d - do not stash this hunk or any of the later hunks in the file\n"
 msgstr ""
-"y - \"stash\":a stycket\n"
-"n - \"stash\":a inte stycket\n"
-"q - avsluta; \"stash\":a inte stycket eller något av de följande\n"
-"a - \"stash\":a stycket och alla följande i filen\n"
-"d - \"stash\":a inte stycket eller något av de följande i filen\n"
+"y - ”stash”:a stycket\n"
+"n - ”stash”:a inte stycket\n"
+"q - avsluta; ”stash”:a inte stycket eller något av de följande\n"
+"a - ”stash”:a stycket och alla följande i filen\n"
+"d - ”stash”:a inte stycket eller något av de följande i filen\n"
 
 #, c-format
 msgid "Unstage mode change [y,n,q,a,d%s,?]? "
@@ -440,7 +440,7 @@ msgstr ""
 
 #, c-format
 msgid "could not parse hunk header '%.*s'"
-msgstr "kunde inte tolka styckehuvudet \"%.*s\""
+msgstr "kunde inte tolka styckehuvudet ”%.*s”"
 
 msgid "could not parse diff"
 msgstr "kunde inte tolka diff"
@@ -450,7 +450,7 @@ msgstr "kunde inte tolka färgad diff"
 
 #, c-format
 msgid "failed to run '%s'"
-msgstr "misslyckades att köra \"%s\""
+msgstr "misslyckades att köra ”%s”"
 
 msgid "mismatched output from interactive.diffFilter"
 msgstr "omaka utdata från interactive.diffFilter"
@@ -493,8 +493,8 @@ msgid ""
 "Lines starting with %c will be removed.\n"
 msgstr ""
 "---\n"
-"Ta bort \"%c\" rader genom att göra dem \" \"-rader (sammanhang).\n"
-"Ta bort \"%c\" rader genom att radera dem.\n"
+"Ta bort ”%c” rader genom att göra dem ” ”-rader (sammanhang).\n"
+"Ta bort ”%c” rader genom att radera dem.\n"
 "Rader som börjar med %c kommer att tas bort.\n"
 
 msgid ""
@@ -510,7 +510,7 @@ msgid "could not parse hunk header"
 msgstr "kunde inte tolka styckehuvud"
 
 msgid "'git apply --cached' failed"
-msgstr "\"git apply --cached\" misslyckades"
+msgstr "”git apply --cached” misslyckades"
 
 #. TRANSLATORS: do not translate [y/n]
 #. The program will only accept that input at this point.
@@ -521,8 +521,8 @@ msgstr "\"git apply --cached\" misslyckades"
 msgid ""
 "Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
 msgstr ""
-"Ditt redigerade stycke kan inte appliceras. Redigera igen (\"nej\" kastar!) "
-"[y/n]? "
+"Ditt redigerade stycke kan inte appliceras. Redigera igen (”nej” kastar!) [y/"
+"n]? "
 
 msgid "The selected hunks do not apply to the index!"
 msgstr "Markerade stycken kan inte appliceras på indexet!"
@@ -571,7 +571,7 @@ msgstr "gå till vilket stycke? "
 
 #, c-format
 msgid "Invalid number: '%s'"
-msgstr "Ogiltigt siffervärde: \"%s\""
+msgstr "Ogiltigt siffervärde: ”%s”"
 
 #, c-format
 msgid "Sorry, only %d hunk available."
@@ -603,7 +603,7 @@ msgid "Sorry, cannot edit this hunk"
 msgstr "Beklagar, kan inte redigera stycket"
 
 msgid "'git apply' failed"
-msgstr "\"git apply\" misslyckades"
+msgstr "”git apply” misslyckades"
 
 #, c-format
 msgid ""
@@ -611,7 +611,7 @@ msgid ""
 "Disable this message with \"git config advice.%s false\""
 msgstr ""
 "\n"
-"Slå av meddelandet med \"git config advice.%s false\""
+"Slå av meddelandet med ”git config advice.%s false”"
 
 #, c-format
 msgid "%shint: %.*s%s\n"
@@ -619,7 +619,7 @@ msgstr "%stips: %.*s%s\n"
 
 msgid "Cherry-picking is not possible because you have unmerged files."
 msgstr ""
-"Du kan inte utföra en \"cherry-pick\" eftersom du har filer som inte slagits "
+"Du kan inte utföra en ”cherry-pick” eftersom du har filer som inte slagits "
 "samman."
 
 msgid "Committing is not possible because you have unmerged files."
@@ -632,7 +632,7 @@ msgstr ""
 
 msgid "Pulling is not possible because you have unmerged files."
 msgstr ""
-"Du kan inte utföra en \"pull\" eftersom du har filer som inte slagits samman."
+"Du kan inte utföra en ”pull” eftersom du har filer som inte slagits samman."
 
 msgid "Reverting is not possible because you have unmerged files."
 msgstr "Du kan inte återställa eftersom du har filer som inte slagits samman."
@@ -644,7 +644,7 @@ msgid ""
 "Fix them up in the work tree, and then use 'git add/rm <file>'\n"
 "as appropriate to mark resolution and make a commit."
 msgstr ""
-"Rätta dem i din arbetskatalog och använd sedan \"git add/rm <fil>\"\n"
+"Rätta dem i din arbetskatalog och använd sedan ”git add/rm <fil>”\n"
 "som lämpligt för att ange lösning och checka in."
 
 msgid "Exiting because of an unresolved conflict."
@@ -686,7 +686,7 @@ msgid ""
 "updated in the index:\n"
 msgstr ""
 "Följande sökvägar och/eller sökvägsangivelser motsvarar sökvägar\n"
-"utanför din \"sparse-checkout\"-definition, så de kommer inte\n"
+"utanför din ”sparse-checkout”-definition, så de kommer inte\n"
 "uppdateras i indexet:\n"
 
 msgid ""
@@ -719,9 +719,9 @@ msgid ""
 "false\n"
 "\n"
 msgstr ""
-"Observera: checkar ut \"%s\".\n"
+"Observera: checkar ut ”%s”.\n"
 "\n"
-"Du har nu ett \"frånkopplat HEAD\". Du kan se dig omkring, experimentera\n"
+"Du har nu ett ”frånkopplat HEAD”. Du kan se dig omkring, experimentera\n"
 "med ändringar och checka in dem, och du kan kasta incheckningar du gör\n"
 "i det här läget utan att det påverkar grenar genom att växla tillbaka\n"
 "till en gren.\n"
@@ -747,7 +747,7 @@ msgid ""
 "modifications.\n"
 msgstr ""
 "Följande sökvägar har flyttats ut från din\n"
-"\"sparse-checkout\"-definition, men är inte glesa på grund av\n"
+"”sparse-checkout”-definition, men är inte glesa på grund av\n"
 "lokala ändringar.\n"
 
 msgid ""
@@ -756,8 +756,8 @@ msgid ""
 "* Use \"git sparse-checkout reapply\" to apply the sparsity rules"
 msgstr ""
 "För att korrigera glesheten för dessa sökvägar, gör följande:\n"
-"* Använd \"git add --sparse <sökväg>\" för att uppdatera indexet\n"
-"* Använd \"git sparse-checkout reapply\" för att tillämpa gleshetsreglerna"
+"* Använd ”git add --sparse <sökväg>” för att uppdatera indexet\n"
+"* Använd ”git sparse-checkout reapply” för att tillämpa gleshetsreglerna"
 
 msgid "cmdline ends with \\"
 msgstr "kommandorad avslutas med \\"
@@ -770,19 +770,19 @@ msgstr "för många argument"
 
 #, c-format
 msgid "unrecognized whitespace option '%s'"
-msgstr "okänt alternativ för whitespace: \"%s\""
+msgstr "okänt alternativ för whitespace: ”%s”"
 
 #, c-format
 msgid "unrecognized whitespace ignore option '%s'"
-msgstr "okänt alternativ för ignore-whitespace: \"%s\""
+msgstr "okänt alternativ för ignore-whitespace: ”%s”"
 
 #, c-format
 msgid "options '%s' and '%s' cannot be used together"
-msgstr "flaggorna \"%s\" och \"%s\" kan inte användas samtidigt"
+msgstr "flaggorna ”%s” och ”%s” kan inte användas samtidigt"
 
 #, c-format
 msgid "'%s' outside a repository"
-msgstr "\"%s\" utanför arkiv"
+msgstr "”%s” utanför arkiv"
 
 msgid "failed to read patch"
 msgstr "misslyckades läsa patchen"
@@ -897,7 +897,7 @@ msgstr "kunde inte öppna eller läsa %s"
 
 #, c-format
 msgid "invalid start of line: '%c'"
-msgstr "felaktig inledning på rad: \"%c\""
+msgstr "felaktig inledning på rad: ”%c”"
 
 #, c-format
 msgid "Hunk #%d succeeded at %d (offset %d line)."
@@ -919,41 +919,38 @@ msgstr ""
 
 #, c-format
 msgid "missing binary patch data for '%s'"
-msgstr "saknar binära patchdata för \"%s\""
+msgstr "saknar binära patchdata för ”%s”"
 
 #, c-format
 msgid "cannot reverse-apply a binary patch without the reverse hunk to '%s'"
 msgstr ""
-"kan inte applicera en binärpatch baklänges utan den omvända patchen för \"%s"
-"\""
+"kan inte applicera en binärpatch baklänges utan den omvända patchen för ”%s”"
 
 #, c-format
 msgid "cannot apply binary patch to '%s' without full index line"
-msgstr ""
-"kan inte applicera binärpatch på \"%s\" utan den fullständiga indexraden"
+msgstr "kan inte applicera binärpatch på ”%s” utan den fullständiga indexraden"
 
 #, c-format
 msgid ""
 "the patch applies to '%s' (%s), which does not match the current contents."
 msgstr ""
-"patchen appliceras på \"%s\" (%s), som inte motsvarar det nuvarande "
-"innehållet."
+"patchen appliceras på ”%s” (%s), som inte motsvarar det nuvarande innehållet."
 
 #, c-format
 msgid "the patch applies to an empty '%s' but it is not empty"
-msgstr "patchen appliceras på en tom \"%s\", men den är inte tom"
+msgstr "patchen appliceras på en tom ”%s”, men den är inte tom"
 
 #, c-format
 msgid "the necessary postimage %s for '%s' cannot be read"
-msgstr "nödvändig efterbild %s för \"%s\" kan inte läsas"
+msgstr "nödvändig efterbild %s för ”%s” kan inte läsas"
 
 #, c-format
 msgid "binary patch does not apply to '%s'"
-msgstr "binärpatchen kan inte tillämpas på \"%s\""
+msgstr "binärpatchen kan inte tillämpas på ”%s”"
 
 #, c-format
 msgid "binary patch to '%s' creates incorrect result (expecting %s, got %s)"
-msgstr "binärpatchen på \"%s\" ger felaktigt resultat (förväntade %s, fick %s)"
+msgstr "binärpatchen på ”%s” ger felaktigt resultat (förväntade %s, fick %s)"
 
 #, c-format
 msgid "patch failed: %s:%ld"
@@ -969,7 +966,7 @@ msgstr "misslyckades läsa %s"
 
 #, c-format
 msgid "reading from '%s' beyond a symbolic link"
-msgstr "läser från \"%s\" som är på andra sidan av en symbolisk länk"
+msgstr "läser från ”%s” som är på andra sidan av en symbolisk länk"
 
 #, c-format
 msgid "path %s has been renamed/deleted"
@@ -992,7 +989,7 @@ msgstr "Utför trevägssammanslagning...\n"
 
 #, c-format
 msgid "cannot read the current contents of '%s'"
-msgstr "kunde inte läsa aktuellt innehåll i \"%s\""
+msgstr "kunde inte läsa aktuellt innehåll i ”%s”"
 
 #, c-format
 msgid "Failed to perform three-way merge...\n"
@@ -1000,11 +997,11 @@ msgstr "Misslyckades utföra trevägssammanslagning...\n"
 
 #, c-format
 msgid "Applied patch to '%s' with conflicts.\n"
-msgstr "Applicerade patchen på \"%s\" med konflikter.\n"
+msgstr "Applicerade patchen på ”%s” med konflikter.\n"
 
 #, c-format
 msgid "Applied patch to '%s' cleanly.\n"
-msgstr "Tillämpade patchen på  \"%s\" rent.\n"
+msgstr "Tillämpade patchen på  ”%s” rent.\n"
 
 #, c-format
 msgid "Falling back to direct application...\n"
@@ -1023,7 +1020,7 @@ msgstr "%s har typen %o, förväntade %o"
 
 #, c-format
 msgid "invalid path '%s'"
-msgstr "ogiltig sökväg \"%s\""
+msgstr "ogiltig sökväg ”%s”"
 
 #, c-format
 msgid "%s: already exists in index"
@@ -1043,7 +1040,7 @@ msgstr "nytt läge (%o) för %s motsvarar inte gammalt läge (%o) för %s"
 
 #, c-format
 msgid "affected file '%s' is beyond a symbolic link"
-msgstr "den berörda filen \"%s\" är på andra sidan av en symbolisk länk"
+msgstr "den berörda filen ”%s” är på andra sidan av en symbolisk länk"
 
 #, c-format
 msgid "%s: patch does not apply"
@@ -1083,7 +1080,7 @@ msgstr "trasig patch för undermodulen %s"
 
 #, c-format
 msgid "unable to stat newly created file '%s'"
-msgstr "kan inte ta status på nyligen skapade filen \"%s\""
+msgstr "kan inte ta status på nyligen skapade filen ”%s”"
 
 #, c-format
 msgid "unable to create backing store for newly created file %s"
@@ -1095,15 +1092,15 @@ msgstr "kan inte lägga till cachepost för %s"
 
 #, c-format
 msgid "failed to write to '%s'"
-msgstr "misslyckades skriva till \"%s\""
+msgstr "misslyckades skriva till ”%s”"
 
 #, c-format
 msgid "closing file '%s'"
-msgstr "stänger filen \"%s\""
+msgstr "stänger filen ”%s”"
 
 #, c-format
 msgid "unable to write file '%s' mode %o"
-msgstr "kan inte skriva filen \"%s\" läge %o"
+msgstr "kan inte skriva filen ”%s” läge %o"
 
 #, c-format
 msgid "Applied patch %s cleanly."
@@ -1128,7 +1125,7 @@ msgstr "kan inte öppna %s"
 
 #, c-format
 msgid "cannot unlink '%s'"
-msgstr "kan inte ta bort länken \"%s\""
+msgstr "kan inte ta bort länken ”%s”"
 
 #, c-format
 msgid "Hunk #%d applied cleanly."
@@ -1140,17 +1137,17 @@ msgstr "Refuserar stycke %d."
 
 #, c-format
 msgid "Skipped patch '%s'."
-msgstr "Ignorerar patch \"%s\"."
+msgstr "Ignorerar patch ”%s”."
 
 msgid "No valid patches in input (allow with \"--allow-empty\")"
-msgstr "Inga giltiga patchar i indata (tillåt med \"--allow-empty\")"
+msgstr "Inga giltiga patchar i indata (tillåt med ”--allow-empty”)"
 
 msgid "unable to read index file"
 msgstr "kan inte läsa indexfilen"
 
 #, c-format
 msgid "can't open patch '%s': %s"
-msgstr "kan inte öppna patchen \"%s\": %s"
+msgstr "kan inte öppna patchen ”%s”: %s"
 
 #, c-format
 msgid "squelched %d whitespace error"
@@ -1204,7 +1201,7 @@ msgid "make sure the patch is applicable to the current index"
 msgstr "se till att patchen kan tillämpas på aktuellt index"
 
 msgid "mark new files with `git add --intent-to-add`"
-msgstr "markera nya filer med \"git add --intent-to-add\""
+msgstr "markera nya filer med ”git add --intent-to-add”"
 
 msgid "apply a patch without touching the working tree"
 msgstr "tillämpa en patch utan att röra arbetskatalogen"
@@ -1279,14 +1276,14 @@ msgstr "fel i deflate (%d)"
 
 #, c-format
 msgid "unable to start '%s' filter"
-msgstr "kunde inte starta filtret \"%s\""
+msgstr "kunde inte starta filtret ”%s”"
 
 msgid "unable to redirect descriptor"
 msgstr "kan inte omdirigera handtag"
 
 #, c-format
 msgid "'%s' filter reported error"
-msgstr "filtret \"%s\" rapporterade fel"
+msgstr "filtret ”%s” rapporterade fel"
 
 #, c-format
 msgid "path is not valid UTF-8: %s"
@@ -1314,15 +1311,15 @@ msgstr "git archive --remote <arkiv> [--exec <kmd>] --list"
 
 #, c-format
 msgid "cannot read '%s'"
-msgstr "kunde inte läsa \"%s\""
+msgstr "kunde inte läsa ”%s”"
 
 #, c-format
 msgid "pathspec '%s' matches files outside the current directory"
-msgstr "sökvägsangivelsen \"%s\" motsvarar filer utanför aktuell katalog"
+msgstr "sökvägsangivelsen ”%s” motsvarar filer utanför aktuell katalog"
 
 #, c-format
 msgid "pathspec '%s' did not match any files"
-msgstr "sökvägsangivelsen \"%s\" motsvarade inte några filer"
+msgstr "sökvägsangivelsen ”%s” motsvarade inte några filer"
 
 #, c-format
 msgid "no such ref: %.*s"
@@ -1346,15 +1343,15 @@ msgstr "Inte en vanlig fil: %s"
 
 #, c-format
 msgid "unclosed quote: '%s'"
-msgstr "citat ej stängt: \"%s\""
+msgstr "citat ej stängt: ”%s”"
 
 #, c-format
 msgid "missing colon: '%s'"
-msgstr "kolon saknas: \"%s\""
+msgstr "kolon saknas: ”%s”"
 
 #, c-format
 msgid "empty file name: '%s'"
-msgstr "tomt filnamn: \"%s\""
+msgstr "tomt filnamn: ”%s”"
 
 msgid "fmt"
 msgstr "fmt"
@@ -1415,18 +1412,22 @@ msgstr "Oväntad flagga --remote"
 
 #, c-format
 msgid "the option '%s' requires '%s'"
-msgstr "flaggan \"%s\" kräver \"%s\""
+msgstr "flaggan ”%s” kräver ”%s”"
 
 msgid "Unexpected option --output"
 msgstr "Oväntad flagga --output"
 
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "falsk konfigureringsparameter: ”%s”"
+
 #, c-format
 msgid "Unknown archive format '%s'"
-msgstr "Okänt arkivformat \"%s\""
+msgstr "Okänt arkivformat ”%s”"
 
 #, c-format
 msgid "Argument not supported for format '%s': -%d"
-msgstr "Argumentet stöd inte för formatet \"%s\": -%d"
+msgstr "Argumentet stöd inte för formatet ”%s”: -%d"
 
 #, c-format
 msgid "%.*s is not a valid attribute name"
@@ -1452,26 +1453,34 @@ msgstr ""
 
 #, c-format
 msgid "cannot fstat gitattributes file '%s'"
-msgstr "kan inte utföra fstat på gitattributes-filen \"%s\""
+msgstr "kan inte utföra fstat på gitattributes-filen ”%s”"
 
 #, c-format
 msgid "ignoring overly large gitattributes file '%s'"
-msgstr "ignorerar allt för stor gitattributes-fil \"%s\""
+msgstr "ignorerar allt för stor gitattributes-fil ”%s”"
 
 #, c-format
 msgid "ignoring overly large gitattributes blob '%s'"
-msgstr "ignorerar allt för stor gitattributes-objekt \"%s\""
+msgstr "ignorerar allt för stor gitattributes-objekt ”%s”"
 
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "felaktig --attr-source eller GIT_ATTR_SOURCE"
 
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "kan inte ta status på ”%s”"
+
+#, c-format
+msgid "unable to read %s"
+msgstr "kunde inte läsa %s"
+
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
-msgstr "Felaktigt citerat innehåll i filen \"%s\": %s"
+msgstr "Felaktigt citerat innehåll i filen ”%s”: %s"
 
 #, c-format
 msgid "We cannot bisect more!\n"
-msgstr "Det finns inte mer att göra \"bisect\" på!\n"
+msgstr "Det finns inte mer att göra ”bisect” på!\n"
 
 #, c-format
 msgid "Not a valid commit name %s"
@@ -1499,7 +1508,7 @@ msgid ""
 "This means the first '%s' commit is between %s and [%s].\n"
 msgstr ""
 "Sammanslagningsbasen %s är %s.\n"
-"Det betyder att den första \"%s\" incheckningen är mellan %s och [%s].\n"
+"Det betyder att den första ”%s” incheckningen är mellan %s och [%s].\n"
 
 #, c-format
 msgid ""
@@ -1532,11 +1541,11 @@ msgstr "en %s-revision behövs"
 
 #, c-format
 msgid "could not create file '%s'"
-msgstr "kunde inte skapa filen \"%s\""
+msgstr "kunde inte skapa filen ”%s”"
 
 #, c-format
 msgid "could not read file '%s'"
-msgstr "kunde inte läsa filen \"%s\""
+msgstr "kunde inte läsa filen ”%s”"
 
 msgid "reading bisect refs failed"
 msgstr "misslyckades läsa bisect-referenser"
@@ -1606,15 +1615,15 @@ msgstr "ställer inte in grenen %s som sin egen uppströmsgren"
 
 #, c-format
 msgid "branch '%s' set up to track '%s' by rebasing."
-msgstr "grenen \"%s\" inställd på att spåra \"%s\" genom ombasering."
+msgstr "grenen ”%s” inställd på att spåra ”%s” genom ombasering."
 
 #, c-format
 msgid "branch '%s' set up to track '%s'."
-msgstr "grenen \"%s\" inställd på att spåra \"%s\"."
+msgstr "grenen ”%s” inställd på att spåra ”%s”."
 
 #, c-format
 msgid "branch '%s' set up to track:"
-msgstr "grenen \"%s\" inställd på att spåra:"
+msgstr "grenen ”%s” inställd på att spåra:"
 
 msgid "unable to write upstream branch configuration"
 msgstr "kan inte skriva inställningar för uppströmsgren"
@@ -1630,17 +1639,17 @@ msgstr ""
 
 #, c-format
 msgid "asked to inherit tracking from '%s', but no remote is set"
-msgstr "bad om att ärva spårning från \"%s\", men ingen fjärr är vald"
+msgstr "bad om att ärva spårning från ”%s”, men ingen fjärr är vald"
 
 #, c-format
 msgid "asked to inherit tracking from '%s', but no merge configuration is set"
 msgstr ""
-"bad om att ärva spårning från \"%s\", men ingen sammanslagningsinställning "
-"är vald"
+"bad om att ärva spårning från ”%s”, men ingen sammanslagningsinställning är "
+"vald"
 
 #, c-format
 msgid "not tracking: ambiguous information for ref '%s'"
-msgstr "spårar inte: tvetydig information för referensen \"%s\""
+msgstr "spårar inte: tvetydig information för referensen ”%s”"
 
 #. #-#-#-#-#  branch.c.po  #-#-#-#-#
 #. TRANSLATORS: This is a line listing a remote with duplicate
@@ -1672,7 +1681,7 @@ msgid ""
 "tracking namespaces."
 msgstr ""
 "Flera fjärrars hämtnings-referensspecifikationer motsvarar fjärr-\n"
-"spårningsreferensen \"%s\":\n"
+"spårningsreferensen ”%s”:\n"
 "%s\n"
 "Detta är vanligtvis ett fel i konfigurationen.\n"
 "\n"
@@ -1682,26 +1691,26 @@ msgstr ""
 
 #, c-format
 msgid "'%s' is not a valid branch name"
-msgstr "\"%s\" är inte ett giltigt grennamn"
+msgstr "”%s” är inte ett giltigt grennamn"
 
 #, c-format
 msgid "a branch named '%s' already exists"
-msgstr "det finns redan en gren som heter \"%s\""
+msgstr "det finns redan en gren som heter ”%s”"
 
 #, c-format
 msgid "cannot force update the branch '%s' used by worktree at '%s'"
 msgstr ""
-"kan inte tvinga uppdatering av grenen \"%s\" som används av arbetskatalogen "
-"på \"%s\""
+"kan inte tvinga uppdatering av grenen ”%s” som används av arbetskatalogen på "
+"”%s”"
 
 #, c-format
 msgid "cannot set up tracking information; starting point '%s' is not a branch"
 msgstr ""
-"kan inte ställa in spårningsinformation; startpunkten \"%s\" är inte en gren"
+"kan inte ställa in spårningsinformation; startpunkten ”%s” är inte en gren"
 
 #, c-format
 msgid "the requested upstream branch '%s' does not exist"
-msgstr "den efterfrågade uppströmsgrenen \"%s\" finns inte"
+msgstr "den efterfrågade uppströmsgrenen ”%s” finns inte"
 
 msgid ""
 "\n"
@@ -1715,51 +1724,51 @@ msgid ""
 msgstr ""
 "\n"
 "Om du har tänkt basera ditt arbete på en uppströmsgren\n"
-"som redan finns på fjärren kan du behöva köra \"git fetch\"\n"
+"som redan finns på fjärren kan du behöva köra ”git fetch”\n"
 "för att hämta den.\n"
 "\n"
 "Om du har tänkt sända in en ny lokal gren som ska\n"
-"spåra dess fjärrmotsvarighet kan du använda \"git push -u\"\n"
+"spåra dess fjärrmotsvarighet kan du använda ”git push -u”\n"
 "för att ställa in uppströmskonfigurationen när du sänder in."
 
 #, c-format
 msgid "not a valid object name: '%s'"
-msgstr "objektnamnet är inte giltigt: \"%s\""
+msgstr "objektnamnet är inte giltigt: ”%s”"
 
 #, c-format
 msgid "ambiguous object name: '%s'"
-msgstr "objektnamnet är tvetydigt: \"%s\""
+msgstr "objektnamnet är tvetydigt: ”%s”"
 
 #, c-format
 msgid "not a valid branch point: '%s'"
-msgstr "avgreningspunkten är inte giltig: \"%s\""
+msgstr "avgreningspunkten är inte giltig: ”%s”"
 
 #, c-format
 msgid "submodule '%s': unable to find submodule"
-msgstr "undermodulen \"%s\": kan inte hitta undermodulen"
+msgstr "undermodulen ”%s”: kan inte hitta undermodulen"
 
 #, c-format
 msgid ""
 "You may try updating the submodules using 'git checkout --no-recurse-"
 "submodules %s && git submodule update --init'"
 msgstr ""
-"Du kan försöka uppdatera undermodulerna med \"git checkout --no-recurse-"
-"submodules %s && git submodule update --init\""
+"Du kan försöka uppdatera undermodulerna med git checkout --no-recurse-"
+"submodules %s && git submodule update --init"
 
 #, c-format
 msgid "submodule '%s': cannot create branch '%s'"
-msgstr "undermodulen \"%s\": kan inte skapa grenen \"%s\""
+msgstr "undermodulen ”%s”: kan inte skapa grenen ”%s”"
 
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "\"%s\" är redan utcheckad på \"%s\""
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "”%s” används redan av arbetskatalogen ”%s”"
 
 msgid "git add [<options>] [--] <pathspec>..."
 msgstr "git add [<flaggor>] [--] <sökväg>..."
 
 #, c-format
 msgid "cannot chmod %cx '%s'"
-msgstr "kan inte utföra chmod %cx \"%s\""
+msgstr "kan inte utföra chmod %cx ”%s”"
 
 msgid "Unstaged changes after refreshing the index:"
 msgstr "Oköade ändringar efter att ha uppdaterat indexet:"
@@ -1769,27 +1778,24 @@ msgid ""
 "See its entry in 'git help config' for details."
 msgstr ""
 "inställningen add.interactive.useBuiltin har tagits bort!\n"
-"Se dess post i \"git help config\" för detaljer."
-
-msgid "Could not read the index"
-msgstr "Kunde inte läsa indexet"
+"Se dess post i ”git help config” för detaljer."
 
-msgid "Could not write patch"
-msgstr "Kunde inte skriva patch"
+msgid "could not read the index"
+msgstr "kunde inte läsa indexet"
 
 msgid "editing patch failed"
 msgstr "redigering av patch misslyckades"
 
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "Kunde inte ta status på \"%s\""
+msgid "could not stat '%s'"
+msgstr "kunde inte ta status på ”%s”"
 
-msgid "Empty patch. Aborted."
-msgstr "Tom patch. Avbryter."
+msgid "empty patch. aborted"
+msgstr "tom patch. avbryter"
 
 #, c-format
-msgid "Could not apply '%s'"
-msgstr "Kunde inte tillämpa \"%s\""
+msgid "could not apply '%s'"
+msgstr "kunde inte tillämpa ”%s”"
 
 msgid "The following paths are ignored by one of your .gitignore files:\n"
 msgstr "Följande sökvägar ignoreras av en av dina .gitignore-filer:\n"
@@ -1837,7 +1843,7 @@ msgid "check if - even missing - files are ignored in dry run"
 msgstr "se om - även saknade - filer ignoreras i testkörning"
 
 msgid "allow updating entries outside of the sparse-checkout cone"
-msgstr "tillåt uppdatera poster utanför området angivet i \"sparse-checkout\""
+msgstr "tillåt uppdatera poster utanför området angivet i ”sparse-checkout”"
 
 msgid "override the executable bit of the listed files"
 msgstr "överstyr exekveringsbiten för angivna filer"
@@ -1873,7 +1879,7 @@ msgstr ""
 "\n"
 "\tgit rm --cached %s\n"
 "\n"
-"Se \"git help submodule\" för ytterligare information."
+"Se ”git help submodule” för ytterligare information."
 
 #, c-format
 msgid "adding embedded git repository: %s"
@@ -1886,18 +1892,18 @@ msgid ""
 msgstr ""
 "Använd -f om du verkligen vill lägga till dem.\n"
 "Slå av detta meddelande med\n"
-"\"git config advice.addIgnoredFile false\""
+"”git config advice.addIgnoredFile false”"
 
 msgid "adding files failed"
 msgstr "misslyckades lägga till filer"
 
 #, c-format
 msgid "--chmod param '%s' must be either -x or +x"
-msgstr "\"--chmod\"-parametern \"%s\" måste antingen vara -x eller +x"
+msgstr "”--chmod”-parametern ”%s” måste antingen vara -x eller +x"
 
 #, c-format
 msgid "'%s' and pathspec arguments cannot be used together"
-msgstr "\"%s\" kan inte användas tillsammans med sökvägsangivelser"
+msgstr "”%s” kan inte användas tillsammans med sökvägsangivelser"
 
 #, c-format
 msgid "Nothing specified, nothing added.\n"
@@ -1908,24 +1914,27 @@ msgid ""
 "Turn this message off by running\n"
 "\"git config advice.addEmptyPathspec false\""
 msgstr ""
-"Tänkte du kanske säga \"git add .\"?\n"
+"Tänkte du kanske säga ”git add .”?\n"
 "Slå av detta meddelande genom att köra\n"
-"\"git config advice.addEmptyPathspec false\""
+"”git config advice.addEmptyPathspec false”"
 
 msgid "index file corrupt"
 msgstr "indexfilen trasig"
 
+msgid "unable to write new index file"
+msgstr "kunde inte skriva ny indexfil"
+
 #, c-format
 msgid "bad action '%s' for '%s'"
-msgstr "felaktig funktion \"%s\" för \"%s\""
+msgstr "felaktig funktion ”%s” för ”%s”"
 
 #, c-format
 msgid "invalid value for '%s': '%s'"
-msgstr "felaktigt värde för \"%s\": \"%s\""
+msgstr "felaktigt värde för ”%s”: ”%s”"
 
 #, c-format
 msgid "could not read '%s'"
-msgstr "kunde inte läsa \"%s\""
+msgstr "kunde inte läsa ”%s”"
 
 msgid "could not parse author script"
 msgstr "kunde inte tolka författarskript"
@@ -1936,30 +1945,30 @@ msgstr "kunde inte tolka %s"
 
 #, c-format
 msgid "'%s' was deleted by the applypatch-msg hook"
-msgstr "\"%s\" togs bort av kroken applypatch-msg"
+msgstr "”%s” togs bort av kroken applypatch-msg"
 
 #, c-format
 msgid "Malformed input line: '%s'."
-msgstr "Felaktig indatarad: \"%s\"."
+msgstr "Felaktig indatarad: ”%s”."
 
 #, c-format
 msgid "Failed to copy notes from '%s' to '%s'"
-msgstr "Misslyckades kopiera anteckningar från \"%s\" till \"%s\""
+msgstr "Misslyckades kopiera anteckningar från ”%s” till ”%s”"
 
 msgid "fseek failed"
-msgstr "\"fseek\" misslyckades"
+msgstr "”fseek” misslyckades"
 
 #, c-format
 msgid "could not open '%s' for reading"
-msgstr "kunde inte öppna \"%s\" för läsning"
+msgstr "kunde inte öppna ”%s” för läsning"
 
 #, c-format
 msgid "could not open '%s' for writing"
-msgstr "kunde inte öppna \"%s\" för skrivning"
+msgstr "kunde inte öppna ”%s” för skrivning"
 
 #, c-format
 msgid "could not parse patch '%s'"
-msgstr "kunde inte tolka patchen \"%s\""
+msgstr "kunde inte tolka patchen ”%s”"
 
 msgid "Only one StGIT patch series can be applied at once"
 msgstr "Endast en StGIT-patchserie kan tillämpas åt gången"
@@ -1968,7 +1977,7 @@ msgid "invalid timestamp"
 msgstr "ogiltig tidsstämpel"
 
 msgid "invalid Date line"
-msgstr "ogiltig \"Date\"-rad"
+msgstr "ogiltig ”Date”-rad"
 
 msgid "invalid timezone offset"
 msgstr "ogiltig tidszons-offset"
@@ -1978,29 +1987,29 @@ msgstr "Misslyckades detektera patchformat."
 
 #, c-format
 msgid "failed to create directory '%s'"
-msgstr "misslyckades skapa katalogen \"%s\""
+msgstr "misslyckades skapa katalogen ”%s”"
 
 msgid "Failed to split patches."
 msgstr "Misslyckades dela patchar."
 
 #, c-format
 msgid "When you have resolved this problem, run \"%s --continue\"."
-msgstr "När du har löst problemet, kör \"%s --continue\"."
+msgstr "När du har löst problemet, kör ”%s --continue”."
 
 #, c-format
 msgid "If you prefer to skip this patch, run \"%s --skip\" instead."
-msgstr "Om du hellre vill hoppa över patchen, kör \"%s --skip\" i stället."
+msgstr "Om du hellre vill hoppa över patchen, kör ”%s --skip” i stället."
 
 #, c-format
 msgid "To record the empty patch as an empty commit, run \"%s --allow-empty\"."
 msgstr ""
-"För att registrera den tomma patchen som en tom incheckning, kör \"%s --"
-"allow-empty\"."
+"För att registrera den tomma patchen som en tom incheckning, kör ”%s --allow-"
+"empty”."
 
 #, c-format
 msgid "To restore the original branch and stop patching, run \"%s --abort\"."
 msgstr ""
-"För att återgå till ursprunglig gren och sluta patcha, kör \"%s --abort\"."
+"För att återgå till ursprunglig gren och sluta patcha, kör ”%s --abort”."
 
 msgid "Patch sent with format=flowed; space at the end of lines might be lost."
 msgstr ""
@@ -2008,7 +2017,7 @@ msgstr ""
 
 #, c-format
 msgid "missing author line in commit %s"
-msgstr "saknad \"author\"-rad i incheckningen %s"
+msgstr "saknad ”author”-rad i incheckningen %s"
 
 #, c-format
 msgid "invalid ident line: %.*s"
@@ -2095,8 +2104,7 @@ msgstr "Patch misslyckades på %s %.*s"
 
 msgid "Use 'git am --show-current-patch=diff' to see the failed patch"
 msgstr ""
-"Använd \"git am --show-current-patch=diff\" för att se patchen som "
-"misslyckades"
+"Använd ”git am --show-current-patch=diff” för att se patchen som misslyckades"
 
 msgid "No changes - recorded it as an empty commit."
 msgstr "Inga ändringar - sparat som en tom incheckning."
@@ -2106,7 +2114,7 @@ msgid ""
 "If there is nothing left to stage, chances are that something else\n"
 "already introduced the same changes; you might want to skip this patch."
 msgstr ""
-"Inga ändringar - glömde du att använda \"git add\"?\n"
+"Inga ändringar - glömde du att använda ”git add”?\n"
 "Om det inte är något kvar att köa kan det hända att något annat redan\n"
 "introducerat samma ändringar; kanske du bör hoppa över patchen."
 
@@ -2117,16 +2125,13 @@ msgid ""
 "You might run `git rm` on a file to accept \"deleted by them\" for it."
 msgstr ""
 "Du har fortfarande ej sammanslagna sökvägar i indexet.\n"
-"Du bör köra \"git add\" på filer med lösta konflikter för att ange dem som "
+"Du bör köra ”git add” på filer med lösta konflikter för att ange dem som "
 "lösta.\n"
-"Du kan köra \"git rm\" för att godta \"borttagen av dem\" för den."
-
-msgid "unable to write new index file"
-msgstr "kunde inte skriva ny indexfil"
+"Du kan köra ”git rm” för att godta ”borttagen av dem” för den."
 
 #, c-format
 msgid "Could not parse object '%s'."
-msgstr "Kan inte tolka objektet \"%s\"."
+msgstr "Kan inte tolka objektet ”%s”."
 
 msgid "failed to clean index"
 msgstr "misslyckades städa upp indexet"
@@ -2135,16 +2140,12 @@ msgid ""
 "You seem to have moved HEAD since the last 'am' failure.\n"
 "Not rewinding to ORIG_HEAD"
 msgstr ""
-"Du verkar ha flyttat HEAD sedan \"am\" sist misslyckades.\n"
+"Du verkar ha flyttat HEAD sedan ”am” sist misslyckades.\n"
 "Återställer inte till ORIG_HEAD"
 
 #, c-format
 msgid "failed to read '%s'"
-msgstr "misslyckades läsa \"%s\""
-
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "flaggorna \"%s=%s\" och \"%s=%s\" kan inte användas samtidigt"
+msgstr "misslyckades läsa ”%s”"
 
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<flaggor>] [(<mbox> | <Maildir>)...]"
@@ -2168,7 +2169,7 @@ msgid "be quiet"
 msgstr "var tyst"
 
 msgid "add a Signed-off-by trailer to the commit message"
-msgstr "lägg till \"Signed-off-by\"-släprad i incheckningsmeddelandet"
+msgstr "lägg till ”Signed-off-by”-släprad i incheckningsmeddelandet"
 
 msgid "recode into utf8 (default)"
 msgstr "koda om till utf8 (standard)"
@@ -2265,7 +2266,7 @@ msgid ""
 "Use \"git am --abort\" to remove it."
 msgstr ""
 "Kvarbliven katalog %s hittades.\n"
-"Använd \"git am --abort\" för att ta bort den."
+"Använd ”git am --abort” för att ta bort den."
 
 msgid "Resolve operation not in progress, we are not resuming."
 msgstr "Lösningsoperation pågår inte, vi återupptar inte."
@@ -2296,10 +2297,10 @@ msgid "git archive: expected a flush"
 msgstr "git archive: förväntade en tömning (flush)"
 
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<dålig> [<bra>...]] [--]    [<sökvägar>...]"
 
 msgid "git bisect (good|bad) [<rev>...]"
@@ -2314,32 +2315,32 @@ msgstr "git bisect reset [<incheckning>]"
 msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <loggfil>"
 
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <kommando>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <kommando> [<argument>]..."
 
 #, c-format
 msgid "cannot open file '%s' in mode '%s'"
-msgstr "kan inte kopiera filen \"%s\" i läget \"%s\""
+msgstr "kan inte kopiera filen ”%s” i läget ”%s”"
 
 #, c-format
 msgid "could not write to file '%s'"
-msgstr "kunde inte skriva till filen \"%s\""
+msgstr "kunde inte skriva till filen ”%s”"
 
 #, c-format
 msgid "cannot open file '%s' for reading"
-msgstr "kan inte öppna filen \"%s\" för läsning"
+msgstr "kan inte öppna filen ”%s” för läsning"
 
 #, c-format
 msgid "'%s' is not a valid term"
-msgstr "\"%s\" är inte en giltig term"
+msgstr "”%s” är inte en giltig term"
 
 #, c-format
 msgid "can't use the builtin command '%s' as a term"
-msgstr "kan inte använda det inbyggda kommandot \"%s\" som term"
+msgstr "kan inte använda det inbyggda kommandot ”%s” som term"
 
 #, c-format
 msgid "can't change the meaning of the term '%s'"
-msgstr "kan inte ändra betydelsen av termen \"%s\""
+msgstr "kan inte ändra betydelsen av termen ”%s”"
 
 msgid "please use two different terms"
 msgstr "termerna måste vara olika"
@@ -2350,14 +2351,14 @@ msgstr "Vi utför ingen bisect för tillfället.\n"
 
 #, c-format
 msgid "'%s' is not a valid commit"
-msgstr "\"%s\" är inte en giltig incheckning"
+msgstr "”%s” är inte en giltig incheckning"
 
 #, c-format
 msgid ""
 "could not check out original HEAD '%s'. Try 'git bisect reset <commit>'."
 msgstr ""
-"Kunde inte checka ut original-HEAD \"%s\". Försök \"git bisect reset "
-"<incheckning>\"."
+"Kunde inte checka ut original-HEAD ”%s”. Försök ”git bisect reset "
+"<incheckning>."
 
 #, c-format
 msgid "Bad bisect_write argument: %s"
@@ -2365,15 +2366,15 @@ msgstr "Felaktigt argument till bisect_write: %s"
 
 #, c-format
 msgid "couldn't get the oid of the rev '%s'"
-msgstr "kan inte läsa oid för referensen \"%s\""
+msgstr "kan inte läsa oid för referensen ”%s”"
 
 #, c-format
 msgid "couldn't open the file '%s'"
-msgstr "kunde inte öppna filen \"%s\""
+msgstr "kunde inte öppna filen ”%s”"
 
 #, c-format
 msgid "Invalid command: you're currently in a %s/%s bisect"
-msgstr "Ogiltigt kommando: du utför just nu en \"bisect\" med %s/%s."
+msgstr "Ogiltigt kommando: du utför just nu en ”bisect” med %s/%s."
 
 #, c-format
 msgid ""
@@ -2381,7 +2382,7 @@ msgid ""
 "You can use \"git bisect %s\" and \"git bisect %s\" for that."
 msgstr ""
 "Du måste ange åtminstone en %s och en %s version.\n"
-"(Du kan använda \"git bisect %s\" och \"git bisect %s\" för detta.)"
+"(Du kan använda ”git bisect %s” och ”git bisect %s” för detta.)"
 
 #, c-format
 msgid ""
@@ -2389,9 +2390,9 @@ msgid ""
 "You then need to give me at least one %s and %s revision.\n"
 "You can use \"git bisect %s\" and \"git bisect %s\" for that."
 msgstr ""
-"Du måste starta med \"git bisect start\".\n"
+"Du måste starta med ”git bisect start”.\n"
 "Du måste sedan ange åtminstone en %s och en %s version.\n"
-"(Du kan använda \"git bisect %s\" och \"git bisect %s\" för detta.)"
+"(Du kan använda ”git bisect %s” och ”git bisect %s” för detta.)"
 
 #, c-format
 msgid "bisecting only with a %s commit"
@@ -2432,7 +2433,7 @@ msgid ""
 "invalid argument %s for 'git bisect terms'.\n"
 "Supported options are: --term-good|--term-old and --term-bad|--term-new."
 msgstr ""
-"ogiltigt argument %s för \"git bisect terms\".\n"
+"ogiltigt argument %s för ”git bisect terms”.\n"
 "Flaggor som stöds är: --term-good|--term-old och --term-bad|--term-new."
 
 msgid "revision walk setup failed\n"
@@ -2440,10 +2441,10 @@ msgstr "misslyckades starta revisionstraversering\n"
 
 #, c-format
 msgid "could not open '%s' for appending"
-msgstr "kunde inte öppna \"%s\" för tillägg"
+msgstr "kunde inte öppna ”%s” för tillägg"
 
 msgid "'' is not a valid term"
-msgstr "\"\" är inte en giltig term"
+msgstr "”” är inte en giltig term"
 
 #, c-format
 msgid "unrecognized option: '%s'"
@@ -2451,25 +2452,24 @@ msgstr "okänd flagga: %s"
 
 #, c-format
 msgid "'%s' does not appear to be a valid revision"
-msgstr "\"%s\" verkar inte vara en giltig revision"
+msgstr "”%s” verkar inte vara en giltig revision"
 
 msgid "bad HEAD - I need a HEAD"
 msgstr "felaktigt HEAD - Jag behöver ett HEAD"
 
 #, c-format
 msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
-msgstr ""
-"misslyckades checka ut \"%s\". Försök \"git bisect reset <giltig_gren>\"."
+msgstr "misslyckades checka ut ”%s”. Försök ”git bisect reset <giltig_gren>”."
 
 msgid "bad HEAD - strange symbolic ref"
 msgstr "felaktigt HEAD - konstig symbolisk referens"
 
 #, c-format
 msgid "invalid ref: '%s'"
-msgstr "ogiltig referens: \"%s\""
+msgstr "ogiltig referens: ”%s”"
 
 msgid "You need to start by \"git bisect start\"\n"
-msgstr "Du måste starta med \"git bisect start\"\n"
+msgstr "Du måste starta med ”git bisect start”\n"
 
 #. TRANSLATORS: Make sure to include [Y] and [n] in your
 #. translation. The program will only accept English input
@@ -2479,11 +2479,11 @@ msgid "Do you want me to do it for you [Y/n]? "
 msgstr "Vill du att jag ska göra det åt dig [Y=ja/N=nej]? "
 
 msgid "Please call `--bisect-state` with at least one argument"
-msgstr "Anropa \"--bisect-state\" med minst ett argument."
+msgstr "Anropa ”--bisect-state” med minst ett argument."
 
 #, c-format
 msgid "'git bisect %s' can take only one argument."
-msgstr "\"git bisect %s\" kan bara ta ett argument."
+msgstr "”git bisect %s” kan bara ta ett argument."
 
 #, c-format
 msgid "Bad rev input: %s"
@@ -2498,11 +2498,11 @@ msgstr "Vi utför ingen bisect för tillfället."
 
 #, c-format
 msgid "'%s'?? what are you talking about?"
-msgstr "\"%s\"?? vad menar du?"
+msgstr "”%s”?? vad menar du?"
 
 #, c-format
 msgid "cannot read file '%s' for replaying"
-msgstr "kan inte läsa filen \"%s\" för återuppspelning"
+msgstr "kan inte läsa filen ”%s” för återuppspelning"
 
 #, c-format
 msgid "running %s\n"
@@ -2521,18 +2521,17 @@ msgstr "falsk slutkod %d för bra revision"
 
 #, c-format
 msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
-msgstr ""
-"\"bisect\"-körningen misslyckades: felkod %d från %s är < 0 eller >= 128"
+msgstr "”bisect”-körningen misslyckades: felkod %d från %s är < 0 eller >= 128"
 
 #, c-format
 msgid "cannot open file '%s' for writing"
-msgstr "kan inte öppna \"%s\" för skrivning"
+msgstr "kan inte öppna ”%s” för skrivning"
 
 msgid "bisect run cannot continue any more"
-msgstr "\"bisect\"-körningen kan inte fortsätta längre"
+msgstr "”bisect”-körningen kan inte fortsätta längre"
 
 msgid "bisect run success"
-msgstr "\"bisect\"-körningen lyckades"
+msgstr "”bisect”-körningen lyckades"
 
 msgid "bisect found first bad commit"
 msgstr "bisect hittade första trasiga incheckning"
@@ -2540,34 +2539,33 @@ msgstr "bisect hittade första trasiga incheckning"
 #, c-format
 msgid "bisect run failed: 'git bisect %s' exited with error code %d"
 msgstr ""
-"\"bisect\"-körningen misslyckades: \"git bisect %s\" avslutades med felkoden "
-"%d"
+"”bisect”-körningen misslyckades: ”git bisect %s” avslutades med felkoden %d"
 
 #, c-format
 msgid "'%s' requires either no argument or a commit"
-msgstr "\"%s\" kräver antingen inget argument eller en incheckning"
+msgstr "”%s” kräver antingen inget argument eller en incheckning"
 
 #, c-format
 msgid "'%s' requires 0 or 1 argument"
-msgstr "\"%s\" kräver noll eller ett argument"
+msgstr "”%s” kräver noll eller ett argument"
 
 #, c-format
 msgid "'%s' requires 0 arguments"
-msgstr "\"%s\" kräver noll argument"
+msgstr "”%s” kräver noll argument"
 
 msgid "no logfile given"
 msgstr "ingen loggfil angiven"
 
 #, c-format
 msgid "'%s' failed: no command provided."
-msgstr "\"%s\" misslyckades: inget kommando gavs."
+msgstr "”%s” misslyckades: inget kommando gavs."
 
 msgid "need a command"
 msgstr "behöver ett kommando"
 
 #, c-format
 msgid "unknown command: '%s'"
-msgstr "okänt kommando: \"%s\""
+msgstr "okänt kommando: ”%s”"
 
 msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
 msgstr "git blame [<flaggor>] [<rev-flaggor>] [<rev>] [--] <fil>"
@@ -2596,7 +2594,7 @@ msgid "do not show object names of boundary commits (Default: off)"
 msgstr "visa inte objektnamn för gränsincheckningar (Standard: av)"
 
 msgid "do not treat root commits as boundaries (Default: off)"
-msgstr "vehandla inte rotincheckningar som gränser (Standard: av)"
+msgstr "behandla inte rotincheckningar som gränser (Standard: av)"
 
 msgid "show work cost statistics"
 msgstr "visa statistik över arbetskostnad"
@@ -2730,56 +2728,56 @@ msgstr "git branch [<flaggor>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
-"tar bort grenen \"%s\" som har slagits ihop med\n"
-"         \"%s\", men ännu inte slagits ihop med HEAD."
+"tar bort grenen ”%s” som har slagits ihop med\n"
+"         ”%s”, men ännu inte slagits ihop med HEAD"
 
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
-"tar inte bort grenen \"%s\" som inte har slagits ihop med\n"
-"         \"%s\", trots att den har slagits ihop med HEAD."
+"tar inte bort grenen ”%s” som inte har slagits ihop med\n"
+"         ”%s”, trots att den har slagits ihop med HEAD"
 
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
-msgstr "Kunde inte slå upp incheckningsobjekt för \"%s\""
+msgid "couldn't look up commit object for '%s'"
+msgstr "kunde inte slå upp incheckningsobjekt för ”%s”"
 
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
-msgstr ""
-"Grenen \"%s\" har inte slagits samman i sin helhet.\n"
-"Om du är säker på att du vill ta bort den, kör \"git branch -D %s\"."
+msgid "the branch '%s' is not fully merged"
+msgstr "grenen ”%s” har inte slagits samman i sin helhet"
+
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
+msgstr "Om du är säker på att du vill ta bort den, kör ”git branch -D %s”"
 
-msgid "Update of config-file failed"
-msgstr "Misslyckades uppdatera konfigurationsfil"
+msgid "update of config-file failed"
+msgstr "misslyckades uppdatera konfigurationsfil"
 
 msgid "cannot use -a with -d"
 msgstr "kan inte ange -a med -d"
 
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "Kan inte ta bort grenen \"%s\" som är utcheckad på \"%s\""
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr "kan inte ta bort grenen ”%s” som används av arbetskatalogen på ”%s”"
 
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "fjärrspårande grenen \"%s\" hittades inte."
+msgid "remote-tracking branch '%s' not found"
+msgstr "fjärrspårande grenen ”%s” hittades inte"
 
 #, c-format
 msgid ""
 "branch '%s' not found.\n"
 "Did you forget --remote?"
 msgstr ""
-"grenen \"%s\" hittades inte.\n"
+"grenen ”%s” hittades inte.\n"
 "Glömde du --remote?"
 
 #, c-format
-msgid "branch '%s' not found."
-msgstr "grenen \"%s\" hittades inte."
+msgid "branch '%s' not found"
+msgstr "grenen ”%s” hittades inte"
 
 #, c-format
 msgid "Deleted remote-tracking branch %s (was %s).\n"
@@ -2800,52 +2798,52 @@ msgid "HEAD (%s) points outside of refs/heads/"
 msgstr "HEAD (%s) pekar utenför refs/heads/"
 
 #, c-format
-msgid "Branch %s is being rebased at %s"
-msgstr "Grenen %s ombaseras på %s"
+msgid "branch %s is being rebased at %s"
+msgstr "grenen %s ombaseras på %s"
 
 #, c-format
-msgid "Branch %s is being bisected at %s"
-msgstr "Grenen %s är i en \"bisect\" på %s"
+msgid "branch %s is being bisected at %s"
+msgstr "grenen %s är i en ”bisect” på %s"
 
 #, c-format
 msgid "HEAD of working tree %s is not updated"
 msgstr "HEAD i arbetskatalogen %s har inte uppdaterats"
 
 #, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Felaktigt namn på gren: \"%s\""
+msgid "invalid branch name: '%s'"
+msgstr "gelaktigt namn på gren: ”%s”"
 
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Inga incheckningar på grenen \"%s\" ännu."
+msgid "no commit on branch '%s' yet"
+msgstr "inga incheckningar på grenen ”%s” ännu"
 
 #, c-format
-msgid "No branch named '%s'."
-msgstr "Ingen gren vid namnet \"%s\"."
+msgid "no branch named '%s'"
+msgstr "ingen gren vid namnet ”%s”"
 
-msgid "Branch rename failed"
-msgstr "Misslyckades byta namn på gren"
+msgid "branch rename failed"
+msgstr "misslyckades byta namn på gren"
 
-msgid "Branch copy failed"
-msgstr "Misslyckades kopiera gren"
+msgid "branch copy failed"
+msgstr "misslyckades kopiera gren"
 
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "Skapade kopia av felaktigt namngiven gren \"%s\""
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "skapade kopia av felaktigt namngiven gren ”%s”"
 
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
-msgstr "Bytte bort namn på en felaktigt namngiven gren \"%s\""
+msgid "renamed a misnamed branch '%s' away"
+msgstr "bytte bort namn på en felaktigt namngiven gren ”%s”"
 
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "Grenen namnbytt till %s, men HEAD har inte uppdaterats!"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "grenen namnbytt till %s, men HEAD har inte uppdaterats"
 
-msgid "Branch is renamed, but update of config-file failed"
-msgstr "Grenen namnbytt, men misslyckades uppdatera konfigurationsfilen"
+msgid "branch is renamed, but update of config-file failed"
+msgstr "grenen namnbytt, men misslyckades uppdatera konfigurationsfilen"
 
-msgid "Branch is copied, but update of config-file failed"
-msgstr "Grenen kopierades, men misslyckades uppdatera konfigurationsfilen"
+msgid "branch is copied, but update of config-file failed"
+msgstr "grenen kopierades, men misslyckades uppdatera konfigurationsfilen"
 
 #, c-format
 msgid ""
@@ -2855,7 +2853,7 @@ msgid ""
 msgstr ""
 "Redigera beskrivningen för grenen\n"
 "  %s\n"
-"Rader som inleds med \"%c\" ignoreras.\n"
+"Rader som inleds med ”%c” ignoreras.\n"
 
 msgid "Generic options"
 msgstr "Allmänna flaggor"
@@ -2959,8 +2957,8 @@ msgstr "rekursera ner i undermoduler"
 msgid "format to use for the output"
 msgstr "format att använda för utdata"
 
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "Misslyckades slå upp HEAD som giltig referens."
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "misslyckades slå upp HEAD som giltig referens"
 
 msgid "HEAD not found below refs/heads!"
 msgstr "HEAD hittades inte under refs/heads!"
@@ -2978,18 +2976,17 @@ msgstr "--recurse-submodules kan endast användas för att skapa grenar"
 msgid "branch name required"
 msgstr "grennamn krävs"
 
-msgid "Cannot give description to detached HEAD"
-msgstr "Kan inte beskriva frånkopplad HEAD"
+msgid "cannot give description to detached HEAD"
+msgstr "kan inte beskriva frånkopplad HEAD"
 
 msgid "cannot edit description of more than one branch"
 msgstr "kan inte redigera beskrivning för mer än en gren"
 
-msgid "cannot copy the current branch while not on any."
-msgstr "kunde inte kopiera aktuell gren när du inte befinner dig på någon."
+msgid "cannot copy the current branch while not on any"
+msgstr "kunde inte kopiera aktuell gren när du inte befinner dig på någon"
 
-msgid "cannot rename the current branch while not on any."
-msgstr ""
-"kunde inte byta namn på aktuell gren när du inte befinner dig på någon."
+msgid "cannot rename the current branch while not on any"
+msgstr "kunde inte byta namn på aktuell gren när du inte befinner dig på någon"
 
 msgid "too many branches for a copy operation"
 msgstr "för många grenar för kopiering"
@@ -3002,49 +2999,48 @@ msgstr "för många flaggor för att byta uppström"
 
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
-"kunde inte sätta uppström för HEAD till %s när det inte pekar mot någon gren."
+"kunde inte sätta uppström för HEAD till %s när det inte pekar mot någon gren"
 
 #, c-format
 msgid "no such branch '%s'"
-msgstr "okänd gren \"%s\""
+msgstr "okänd gren ”%s”"
 
 #, c-format
 msgid "branch '%s' does not exist"
-msgstr "grenen \"%s\" finns inte"
+msgstr "grenen ”%s” finns inte"
 
 msgid "too many arguments to unset upstream"
 msgstr "för många flaggor för att ta bort uppström"
 
-msgid "could not unset upstream of HEAD when it does not point to any branch."
-msgstr ""
-"kunde inte ta bort uppström för HEAD när det inte pekar mot någon gren."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
+msgstr "kunde inte ta bort uppström för HEAD när det inte pekar mot någon gren"
 
 #, c-format
-msgid "Branch '%s' has no upstream information"
-msgstr "Grenen \"%s\" har ingen uppströmsinformation"
+msgid "branch '%s' has no upstream information"
+msgstr "grenen ”%s” har ingen uppströmsinformation"
 
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
-"Flaggorna -a och -r på \"git branch\" tar inte ett namn på gren.\n"
+"flaggorna -a och -r på ”git branch” tar inte ett namn på gren.\n"
 "Menade du att använda: -a|-r --list <mönster>?"
 
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
-"Flaggan --set-upstream rekommenderas ej och kommer tas bort. Använd --track "
-"eller --set-upstream-to istället."
+"flaggan ”--set-upstream” rekommenderas ej och kommer tas bort. Använd ”--"
+"track” eller ”--set-upstream-to” istället"
 
 msgid "git version:\n"
 msgstr "git version:\n"
 
 #, c-format
 msgid "uname() failed with error '%s' (%d)\n"
-msgstr "uname() misslyckades med felet \"%s\" (%d)\n"
+msgstr "uname() misslyckades med felet ”%s” (%d)\n"
 
 msgid "compiler info: "
 msgstr "kompilatorinfo:"
@@ -3103,8 +3099,7 @@ msgstr "läge"
 msgid ""
 "create an additional zip archive of detailed diagnostics (default 'stats')"
 msgstr ""
-"skapa ett ytterligare zip-arkiv med detaljerad diagnostik (förval är \"stats"
-"\")"
+"skapa ett ytterligare zip-arkiv med detaljerad diagnostik (förval är ”stats”)"
 
 msgid "specify a destination for the bugreport file(s)"
 msgstr "ange mål för buggrapporteringsfilen/-rna"
@@ -3112,9 +3107,13 @@ msgstr "ange mål för buggrapporteringsfilen/-rna"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "ange filändelse i strftime-format"
 
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "okänt argument ”%s”"
+
 #, c-format
 msgid "could not create leading directories for '%s'"
-msgstr "kunde inte skapa inledande kataloger för \"%s\""
+msgstr "kunde inte skapa inledande kataloger för ”%s”"
 
 #, c-format
 msgid "unable to create diagnostics archive %s"
@@ -3132,7 +3131,7 @@ msgstr "kunde inte skriva till %s"
 
 #, c-format
 msgid "Created new report at '%s'.\n"
-msgstr "Skapade ny rapport på \"%s\"\n"
+msgstr "Skapade ny rapport på ”%s”\n"
 
 msgid ""
 "git bundle create [-q | --quiet | --progress]\n"
@@ -3186,17 +3185,17 @@ msgstr "Packar upp objektbunt"
 
 #, c-format
 msgid "cannot read object %s '%s'"
-msgstr "kan inte läsa objektet %s: \"%s\""
+msgstr "kan inte läsa objektet %s: ”%s”"
 
 msgid "flush is only for --buffer mode"
-msgstr "flush är endast till för \"--buffer\"-läge"
+msgstr "flush är endast till för ”--buffer”-läge"
 
 msgid "empty command in input"
 msgstr "tomt kommando i indata"
 
 #, c-format
 msgid "whitespace before command: '%s'"
-msgstr "blanksteg före kommando: \"%s\""
+msgstr "blanksteg före kommando: ”%s”"
 
 #, c-format
 msgid "%s requires arguments"
@@ -3218,6 +3217,14 @@ msgstr "git cat-file (-e | -p) <objekt>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <objekt>"
 
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<revision>:<sökväg|träd-igt> | --path=<sökväg|träd-igt> "
+"<revision>]"
+
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
 "objects]\n"
@@ -3229,14 +3236,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<revision>:<sökväg|träd-igt> | --path=<sökväg|träd-igt> "
-"<revision>]"
-
 msgid "Check object existence or emit object contents"
 msgstr "Kontrollera om objektet finns eller mata ut objektets innehåll"
 
@@ -3250,7 +3249,7 @@ msgid "Emit [broken] object attributes"
 msgstr "Skriv ut [trasiga] objektattribut"
 
 msgid "show object type (one of 'blob', 'tree', 'commit', 'tag', ...)"
-msgstr "visa objekttyp (en av: \"blob\", \"tree\", \"commit\", \"tag\", ...)"
+msgstr "visa objekttyp (en av: ”blob”, ”tree”, ”commit”, ”tag”, ...)"
 
 msgid "show object size"
 msgstr "visa objektstorlek"
@@ -3322,22 +3321,22 @@ msgstr "sökväg|träd-igt"
 
 #, c-format
 msgid "'%s' requires a batch mode"
-msgstr "\"%s\" behöver ett buntläge"
+msgstr "”%s” behöver ett buntläge"
 
 #, c-format
 msgid "'-%c' is incompatible with batch mode"
-msgstr "\"-%c\" är inkompatibel med buntläge"
+msgstr "”-%c” är inkompatibel med buntläge"
 
 msgid "batch modes take no arguments"
 msgstr "buntlägen inte några argument"
 
 #, c-format
 msgid "<rev> required with '%s'"
-msgstr "<rev> krävs med \"%s\""
+msgstr "<rev> krävs med ”%s”"
 
 #, c-format
 msgid "<object> required with '-%c'"
-msgstr "<objekt> krävs med \"-%c\""
+msgstr "<objekt> krävs med ”-%c”"
 
 #, c-format
 msgid "only two arguments allowed in <type> <object> mode, not %d"
@@ -3426,7 +3425,7 @@ msgid "git checkout-index [<options>] [--] [<file>...]"
 msgstr "git checkout-index [<flaggor>] [--] [<fil>...]"
 
 msgid "stage should be between 1 and 3 or all"
-msgstr "etapp måste vara mellan 1 och 3 eller \"all\""
+msgstr "etapp måste vara mellan 1 och 3 eller ”all”"
 
 msgid "check out all files in the index"
 msgstr "checka ut alla filer i indexet"
@@ -3469,27 +3468,27 @@ msgstr "git restore [<flaggor>] [--source=<gren>] <fil>..."
 
 #, c-format
 msgid "path '%s' does not have our version"
-msgstr "sökvägen \"%s\" har inte vår version"
+msgstr "sökvägen ”%s” har inte vår version"
 
 #, c-format
 msgid "path '%s' does not have their version"
-msgstr "sökvägen \"%s\" har inte deras version"
+msgstr "sökvägen ”%s” har inte deras version"
 
 #, c-format
 msgid "path '%s' does not have all necessary versions"
-msgstr "sökvägen \"%s\" innehåller inte alla nödvändiga versioner"
+msgstr "sökvägen ”%s” innehåller inte alla nödvändiga versioner"
 
 #, c-format
 msgid "path '%s' does not have necessary versions"
-msgstr "sökvägen \"%s\" innehåller inte nödvändiga versioner"
+msgstr "sökvägen ”%s” innehåller inte nödvändiga versioner"
 
 #, c-format
 msgid "path '%s': cannot merge"
-msgstr "sökväg \"%s\": kan inte slå ihop"
+msgstr "sökväg ”%s”: kan inte slå ihop"
 
 #, c-format
 msgid "Unable to add merge result for '%s'"
-msgstr "Kunde inte lägga till sammanslagningsresultat för \"%s\""
+msgstr "Kunde inte lägga till sammanslagningsresultat för ”%s”"
 
 #, c-format
 msgid "Recreated %d merge conflict"
@@ -3511,27 +3510,31 @@ msgstr[1] "Uppdaterade %d sökvägar från indexet"
 
 #, c-format
 msgid "'%s' cannot be used with updating paths"
-msgstr "\"%s\" kan inte användas vid uppdatering av sökvägar"
+msgstr "”%s” kan inte användas vid uppdatering av sökvägar"
 
 #, c-format
 msgid "Cannot update paths and switch to branch '%s' at the same time."
-msgstr "Kan inte uppdatera sökvägar och växla till grenen \"%s\" samtidigt."
+msgstr "Kan inte uppdatera sökvägar och växla till grenen ”%s” samtidigt."
 
 #, c-format
 msgid "neither '%s' or '%s' is specified"
-msgstr "varken \"%s\" eller \"%s\" har angivits"
+msgstr "varken ”%s” eller ”%s” har angivits"
 
 #, c-format
 msgid "'%s' must be used when '%s' is not specified"
-msgstr "\"%s\" måste användas när \"%s\" inte anges"
+msgstr "”%s” måste användas när ”%s” inte anges"
 
 #, c-format
 msgid "'%s' or '%s' cannot be used with %s"
-msgstr "\"%s\" eller \"%s\" kan inte användas med %s"
+msgstr "”%s” eller ”%s” kan inte användas med %s"
+
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr "”%s”, ”%s” eller ”%s” kan inte användas när en katalog checkas ut"
 
 #, c-format
 msgid "path '%s' is unmerged"
-msgstr "sökvägen \"%s\" har inte slagits ihop"
+msgstr "sökvägen ”%s” har inte slagits ihop"
 
 msgid "you need to resolve your current index first"
 msgstr "du måste lösa ditt befintliga index först"
@@ -3546,7 +3549,7 @@ msgstr ""
 
 #, c-format
 msgid "Can not do reflog for '%s': %s\n"
-msgstr "Kan inte skapa referenslogg för \"%s\": %s\n"
+msgstr "Kan inte skapa referenslogg för ”%s”: %s\n"
 
 msgid "HEAD is now at"
 msgstr "HEAD är nu på"
@@ -3556,23 +3559,23 @@ msgstr "kan inte uppdatera HEAD"
 
 #, c-format
 msgid "Reset branch '%s'\n"
-msgstr "Återställ gren \"%s\"\n"
+msgstr "Återställ gren ”%s”\n"
 
 #, c-format
 msgid "Already on '%s'\n"
-msgstr "Redan på \"%s\"\n"
+msgstr "Redan på ”%s”\n"
 
 #, c-format
 msgid "Switched to and reset branch '%s'\n"
-msgstr "Växlade till och nollställde grenen \"%s\"\n"
+msgstr "Växlade till och nollställde grenen ”%s”\n"
 
 #, c-format
 msgid "Switched to a new branch '%s'\n"
-msgstr "Växlade till en ny gren \"%s\"\n"
+msgstr "Växlade till en ny gren ”%s”\n"
 
 #, c-format
 msgid "Switched to branch '%s'\n"
-msgstr "Växlade till grenen \"%s\"\n"
+msgstr "Växlade till grenen ”%s”\n"
 
 #, c-format
 msgid " ... and %d more.\n"
@@ -3640,7 +3643,7 @@ msgid ""
 "'%s' could be both a local file and a tracking branch.\n"
 "Please use -- (and optionally --no-guess) to disambiguate"
 msgstr ""
-"\"%s\" kan vara både en lokal fil och en spårande gren.\n"
+"”%s” kan vara både en lokal fil och en spårande gren.\n"
 "Använd -- (och möjligen --no-guess) för att göra otvetydig"
 
 msgid ""
@@ -3653,18 +3656,18 @@ msgid ""
 "one remote, e.g. the 'origin' remote, consider setting\n"
 "checkout.defaultRemote=origin in your config."
 msgstr ""
-"Om du menade checka ut en spårad fjärrgren på t.ex \"origin\", kan du\n"
+"Om du menade checka ut en spårad fjärrgren på t.ex ”origin”, kan du\n"
 "göra det genom att ange hela namnet med flaggan --track:\n"
 "\n"
 "    git checkout --track origin/<namn>\n"
 "\n"
 "Om du alltid vill att utcheckningar med tvetydiga <namn> ska\n"
-"föredra en fjärr, t.ex fjärren \"origin\" kan du ställa in\n"
+"föredra en fjärr, t.ex fjärren ”origin” kan du ställa in\n"
 "checkout.defaultRemote=origin i din konfiguration."
 
 #, c-format
 msgid "'%s' matched multiple (%d) remote tracking branches"
-msgstr "\"%s\" motsvarar flera (%d) spårade fjärrgrenar"
+msgstr "”%s” motsvarar flera (%d) spårade fjärrgrenar"
 
 msgid "only one reference expected"
 msgstr "endast en referens förväntades"
@@ -3683,19 +3686,19 @@ msgstr "referensen är inte ett träd: %s"
 
 #, c-format
 msgid "a branch is expected, got tag '%s'"
-msgstr "förväntade gren, fick taggen \"%s\""
+msgstr "förväntade gren, fick taggen ”%s”"
 
 #, c-format
 msgid "a branch is expected, got remote branch '%s'"
-msgstr "förväntade gren, fick fjärrgrenen \"%s\""
+msgstr "förväntade gren, fick fjärrgrenen ”%s”"
 
 #, c-format
 msgid "a branch is expected, got '%s'"
-msgstr "förväntade gren, fick \"%s\""
+msgstr "förväntade gren, fick ”%s”"
 
 #, c-format
 msgid "a branch is expected, got commit '%s'"
-msgstr "förväntade gren, fick incheckningen \"%s\""
+msgstr "förväntade gren, fick incheckningen ”%s”"
 
 msgid ""
 "If you want to detach HEAD at the commit, try again with the --detach option."
@@ -3708,57 +3711,57 @@ msgid ""
 "Consider \"git merge --quit\" or \"git worktree add\"."
 msgstr ""
 "kan inte växla gren vid sammanslagning\n"
-"Överväg \"git merge --quit\" eller \"git worktree add\"."
+"Överväg ”git merge --quit” eller ”git worktree add”."
 
 msgid ""
 "cannot switch branch in the middle of an am session\n"
 "Consider \"git am --quit\" or \"git worktree add\"."
 msgstr ""
-"kan inte växla gren mitt i en \"am\"-körning\n"
-"Överväg \"git am --quit\" eller \"git worktree add\"."
+"kan inte växla gren mitt i en ”am”-körning\n"
+"Överväg ”git am --quit” eller ”git worktree add”."
 
 msgid ""
 "cannot switch branch while rebasing\n"
 "Consider \"git rebase --quit\" or \"git worktree add\"."
 msgstr ""
 "kan inte växla gren vid ombasering\n"
-"Överväg \"git rebase --quit\" eller \"git worktree add\"."
+"Överväg ”git rebase --quit” eller ”git worktree add”."
 
 msgid ""
 "cannot switch branch while cherry-picking\n"
 "Consider \"git cherry-pick --quit\" or \"git worktree add\"."
 msgstr ""
-"kan inte växla gren i en \"cherry-pick\"\n"
-"Överväg \"git cherry-pick --quit\" eller \"git worktree add\"."
+"kan inte växla gren i en ”cherry-pick”\n"
+"Överväg ”git cherry-pick --quit” eller ”git worktree add”."
 
 msgid ""
 "cannot switch branch while reverting\n"
 "Consider \"git revert --quit\" or \"git worktree add\"."
 msgstr ""
-"kan inte växla gren i en \"revert\"\n"
-"Överväg \"git revert --quit\" eller \"git worktree add\"."
+"kan inte växla gren i en ”revert”\n"
+"Överväg ”git revert --quit” eller ”git worktree add”."
 
 msgid "you are switching branch while bisecting"
-msgstr "då växlar grenar medan du gör en \"bisect\""
+msgstr "då växlar grenar medan du gör en ”bisect”"
 
 msgid "paths cannot be used with switching branches"
 msgstr "sökvägar kan inte användas vid byte av gren"
 
 #, c-format
 msgid "'%s' cannot be used with switching branches"
-msgstr "\"%s\" kan inte användas vid byte av gren"
+msgstr "”%s” kan inte användas vid byte av gren"
 
 #, c-format
 msgid "'%s' cannot be used with '%s'"
-msgstr "\"%s\" kan inte användas med \"%s\""
+msgstr "”%s” kan inte användas med ”%s”"
 
 #, c-format
 msgid "'%s' cannot take <start-point>"
-msgstr "\"%s\" kan inte ta <startpunkt>"
+msgstr "”%s” kan inte ta <startpunkt>"
 
 #, c-format
 msgid "Cannot switch branch to a non-commit '%s'"
-msgstr "Kan inte växla gren till icke-incheckningen \"%s\""
+msgstr "Kan inte växla gren till icke-incheckningen ”%s”"
 
 msgid "missing branch or commit argument"
 msgstr "saknar gren- eller incheckingsargument"
@@ -3781,8 +3784,8 @@ msgstr "tvinga utcheckning (kasta bort lokala ändringar)"
 msgid "new-branch"
 msgstr "ny-gren"
 
-msgid "new unparented branch"
-msgstr "ny gren utan förälder"
+msgid "new unborn branch"
+msgstr "ny ofödd gren"
 
 msgid "update ignored files (default)"
 msgstr "uppdatera ignorerade filer (standard)"
@@ -3802,7 +3805,7 @@ msgstr "begränsa inte sökvägar till endast glesa poster"
 
 #, c-format
 msgid "options '-%c', '-%c', and '%s' cannot be used together"
-msgstr "flaggorna \"%-c\", \"-%c\" och \"%s\" kan inte användas samtidigt"
+msgstr "flaggorna ”%-c”, ”-%c” och ”%s” kan inte användas samtidigt"
 
 msgid "--track needs a branch name"
 msgstr "--track behöver ett namn på en gren"
@@ -3820,12 +3823,11 @@ msgstr "felaktig sökvägsangivelse"
 
 #, c-format
 msgid "'%s' is not a commit and a branch '%s' cannot be created from it"
-msgstr ""
-"\"%s\" är inte en incheckning och grenen \"%s\" kan inte skapas från den"
+msgstr "”%s” är inte en incheckning och grenen ”%s” kan inte skapas från den"
 
 #, c-format
 msgid "git checkout: --detach does not take a path argument '%s'"
-msgstr "git checkout: --detach tar inte en sökväg som argument \"%s\""
+msgstr "git checkout: --detach tar inte en sökväg som argument ”%s”"
 
 msgid ""
 "git checkout: --ours/--theirs, --force and --merge are incompatible when\n"
@@ -3850,7 +3852,7 @@ msgid "create reflog for new branch"
 msgstr "skapa reflogg för ny gren"
 
 msgid "second guess 'git checkout <no-such-branch>' (default)"
-msgstr "förutspå \"git checkout <gren-saknas>\" (förval)"
+msgstr "förutspå ”git checkout <gren-saknas>” (förval)"
 
 msgid "use overlay mode (default)"
 msgstr "använd överläggsläge (standard)"
@@ -3862,7 +3864,7 @@ msgid "create/reset and switch to a branch"
 msgstr "skapa/nollställ och växla till en gren"
 
 msgid "second guess 'git switch <no-such-branch>'"
-msgstr "förutspå \"git checkout <gren-saknas>\""
+msgstr "förutspå ”git checkout <gren-saknas>”"
 
 msgid "throw away local modifications"
 msgstr "kasta bort lokala ändringar"
@@ -3910,7 +3912,7 @@ msgstr "misslyckades ta bort %s"
 
 #, c-format
 msgid "could not lstat %s\n"
-msgstr "kunde inte ta status (\"lstat\") på %s\n"
+msgstr "kunde inte ta status (”lstat”) på %s\n"
 
 msgid "Refusing to remove current working directory\n"
 msgstr "Vägrar ta bort aktuell arbetskatalog\n"
@@ -3982,7 +3984,7 @@ msgstr ""
 "clean               - börja städa\n"
 "filter by pattern   - uteslut poster från borttagning\n"
 "select by numbers   - markera poster som ska tas bort med siffror\n"
-"ask each            - bekräfta varje borttagning (som \"rm -i\")\n"
+"ask each            - bekräfta varje borttagning (som ”rm -i”)\n"
 "quit                - sluta städa\n"
 "help                - denna skärm\n"
 "?                   - hjälp för kommandoval"
@@ -4033,9 +4035,6 @@ msgstr ""
 "clean.requireForce har standardvärdet true och varken -i, -n eller -f "
 "angavs; vägrar städa"
 
-msgid "-x and -X cannot be used together"
-msgstr "-x och -X kan inte användas samtidigt"
-
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<flaggor>] [--] <arkiv> [<kat>]"
 
@@ -4046,10 +4045,10 @@ msgid "don't create a checkout"
 msgstr "skapa inte någon utcheckning"
 
 msgid "create a bare repository"
-msgstr "skapa ett naket (\"bare\") arkiv"
+msgstr "skapa ett naket (”bare”) arkiv"
 
 msgid "create a mirror repository (implies bare)"
-msgstr "skapa ett spegelarkiv (implicerar \"bare\")"
+msgstr "skapa ett spegelarkiv (implicerar ”bare”)"
 
 msgid "to clone from a local repository"
 msgstr "för att klona från ett lokalt arkiv"
@@ -4085,7 +4084,7 @@ msgid "name"
 msgstr "namn"
 
 msgid "use <name> instead of 'origin' to track upstream"
-msgstr "använd <namn> istället för \"origin\" för att spåra uppströms"
+msgstr "använd <namn> istället för ”origin” för att spåra uppströms"
 
 msgid "checkout <branch> instead of the remote's HEAD"
 msgstr "checka ut <gren> istället för fjärrens HEAD"
@@ -4123,6 +4122,9 @@ msgstr "gitkat"
 msgid "separate git dir from working tree"
 msgstr "separera gitkatalogen från arbetskatalogen"
 
+msgid "specify the reference format to use"
+msgstr "använd referensformatet som ska användas"
+
 msgid "key=value"
 msgstr "nyckel=värde"
 
@@ -4152,11 +4154,11 @@ msgstr "en URI för att hämta buntar innan de hämtas från ursprungsfjärr"
 
 #, c-format
 msgid "info: Could not add alternate for '%s': %s\n"
-msgstr "info: Kan inte skapa suppleant för \"%s\": %s\n"
+msgstr "info: Kan inte skapa suppleant för ”%s”: %s\n"
 
 #, c-format
 msgid "failed to stat '%s'"
-msgstr "misslyckades ta status på \"%s\""
+msgstr "misslyckades ta status på ”%s”"
 
 #, c-format
 msgid "%s exists and is not a directory"
@@ -4164,31 +4166,31 @@ msgstr "%s finns och är ingen katalog"
 
 #, c-format
 msgid "'%s' is a symlink, refusing to clone with --local"
-msgstr "\"%s\" är en symbolisk länk, vägrar klona med --local"
+msgstr "”%s” är en symbolisk länk, vägrar klona med --local"
 
 #, c-format
 msgid "failed to start iterator over '%s'"
-msgstr "misslyckades starta iterator över \"%s\""
+msgstr "misslyckades starta iterator över ”%s”"
 
 #, c-format
 msgid "symlink '%s' exists, refusing to clone with --local"
-msgstr "symbolisk länk \"%s\" finns redan, vägrar klona med --local"
+msgstr "symbolisk länk ”%s” finns redan, vägrar klona med --local"
 
 #, c-format
 msgid "failed to unlink '%s'"
-msgstr "misslyckades ta bort länken \"%s\""
+msgstr "misslyckades ta bort länken ”%s”"
 
 #, c-format
 msgid "failed to create link '%s'"
-msgstr "misslyckades skapa länken \"%s\""
+msgstr "misslyckades skapa länken ”%s”"
 
 #, c-format
 msgid "failed to copy file to '%s'"
-msgstr "misslyckades kopiera filen till \"%s\""
+msgstr "misslyckades kopiera filen till ”%s”"
 
 #, c-format
 msgid "failed to iterate over '%s'"
-msgstr "misslyckades iterera över \"%s\""
+msgstr "misslyckades iterera över ”%s”"
 
 #, c-format
 msgid "done.\n"
@@ -4200,8 +4202,8 @@ msgid ""
 "and retry with 'git restore --source=HEAD :/'\n"
 msgstr ""
 "Klonen lyckades, men utcheckningen misslyckades.\n"
-"Du kan inspektera det som checkades ut med \"git status\"\n"
-"och försöka med \"git restore --source=HEAD :/\"\n"
+"Du kan inspektera det som checkades ut med ”git status”\n"
+"och försöka med ”git restore --source=HEAD :/”\n"
 
 #, c-format
 msgid "Could not find remote branch %s to clone."
@@ -4230,7 +4232,7 @@ msgid "cannot repack to clean up"
 msgstr "kan inte packa om för att städa upp"
 
 msgid "cannot unlink temporary alternates file"
-msgstr "kunde inte ta bort temporär \"alternates\"-fil"
+msgstr "kunde inte ta bort temporär ”alternates”-fil"
 
 msgid "Too many arguments."
 msgstr "För många argument."
@@ -4238,16 +4240,13 @@ msgstr "För många argument."
 msgid "You must specify a repository to clone."
 msgstr "Du måste ange ett arkiv att klona."
 
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"--bundle-uri är inkompatibelt med --depth, --shallow-since och --shallow-"
-"exclude"
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "okänt format för lagring av referenser ”%s”"
 
 #, c-format
 msgid "repository '%s' does not exist"
-msgstr "arkivet \"%s\" finns inte"
+msgstr "arkivet ”%s” finns inte"
 
 #, c-format
 msgid "depth %s is not a positive number"
@@ -4255,31 +4254,31 @@ msgstr "djupet %s är inte ett positivt tal"
 
 #, c-format
 msgid "destination path '%s' already exists and is not an empty directory."
-msgstr "destinationssökvägen \"%s\" finns redan och är inte en tom katalog."
+msgstr "destinationssökvägen ”%s” finns redan och är inte en tom katalog."
 
 #, c-format
 msgid "repository path '%s' already exists and is not an empty directory."
-msgstr "arkivsökvägen \"%s\" finns redan och är inte en tom katalog."
+msgstr "arkivsökvägen ”%s” finns redan och är inte en tom katalog."
 
 #, c-format
 msgid "working tree '%s' already exists."
-msgstr "arbetsträdet \"%s\" finns redan."
+msgstr "arbetsträdet ”%s” finns redan."
 
 #, c-format
 msgid "could not create leading directories of '%s'"
-msgstr "kunde inte skapa inledande kataloger för \"%s\""
+msgstr "kunde inte skapa inledande kataloger för ”%s”"
 
 #, c-format
 msgid "could not create work tree dir '%s'"
-msgstr "kunde inte skapa arbetskatalogen \"%s\""
+msgstr "kunde inte skapa arbetskatalogen ”%s”"
 
 #, c-format
 msgid "Cloning into bare repository '%s'...\n"
-msgstr "Klonar till ett naket arkiv \"%s\"...\n"
+msgstr "Klonar till ett naket arkiv ”%s”...\n"
 
 #, c-format
 msgid "Cloning into '%s'...\n"
-msgstr "Klonar till \"%s\"...\n"
+msgstr "Klonar till ”%s”...\n"
 
 msgid ""
 "clone --recursive is not compatible with both --reference and --reference-if-"
@@ -4289,7 +4288,7 @@ msgstr ""
 
 #, c-format
 msgid "'%s' is not a valid remote name"
-msgstr "\"%s\" är inte ett giltigt namn på fjärrarkiv"
+msgstr "”%s” är inte ett giltigt namn på fjärrarkiv"
 
 msgid "--depth is ignored in local clones; use file:// instead."
 msgstr "--depth ignoreras i lokala kloningar; använd file:// istället."
@@ -4321,7 +4320,7 @@ msgstr "misslyckades initiera arkivet, hoppar över bunt-URI"
 
 #, c-format
 msgid "failed to fetch objects from bundle URI '%s'"
-msgstr "misslyckades hämta objekt från bunt-URI \"%s\""
+msgstr "misslyckades hämta objekt från bunt-URI ”%s”"
 
 msgid "failed to fetch advertised bundles"
 msgstr "misslyckades hämta annonserade buntar"
@@ -4371,7 +4370,7 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <kat>] [--append]\n"
 "                       [--split[=<strategi>]] [--reachable | --stdin-packs | "
@@ -4391,7 +4390,11 @@ msgstr "om inchecknignsgrafen är delad, kontrollera bara spetsfilen"
 
 #, c-format
 msgid "Could not open commit-graph '%s'"
-msgstr "Kunde inte öppna incheckningsgrafen \"%s\""
+msgstr "Kunde inte öppna incheckningsgrafen ”%s”"
+
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "kunde inte öppna incheckningsgrafen ”%s”"
 
 #, c-format
 msgid "unrecognized --split argument, %s"
@@ -4407,7 +4410,7 @@ msgstr "ogiltigt objekt: %s"
 
 #, c-format
 msgid "option `%s' expects a numerical value"
-msgstr "flaggan \"%s\" antar ett numeriskt värde"
+msgstr "flaggan ”%s” antar ett numeriskt värde"
 
 msgid "start walk at all refs"
 msgstr "starta traversering vid alla referenser"
@@ -4467,11 +4470,11 @@ msgstr "objektnamnet är inte giltigt: %s"
 
 #, c-format
 msgid "git commit-tree: failed to read '%s'"
-msgstr "git commit-tree: misslyckades läsa \"%s\""
+msgstr "git commit-tree: misslyckades läsa ”%s”"
 
 #, c-format
 msgid "git commit-tree: failed to close '%s'"
-msgstr "git commit-tree: misslyckades stänga \"%s\""
+msgstr "git commit-tree: misslyckades stänga ”%s”"
 
 msgid "parent"
 msgstr "förälder"
@@ -4529,7 +4532,7 @@ msgid ""
 msgstr ""
 "Du bad om att utöka den senaste incheckningen, men om du gör det\n"
 "blir den tom. Du kan köra kommandot på nytt med --allow-empty, eller\n"
-"så kan du ta bort incheckningen helt med \"git reset HEAD^\".\n"
+"så kan du ta bort incheckningen helt med ”git reset HEAD^”.\n"
 
 msgid ""
 "The previous cherry-pick is now empty, possibly due to conflict resolution.\n"
@@ -4538,17 +4541,17 @@ msgid ""
 "    git commit --allow-empty\n"
 "\n"
 msgstr ""
-"Den tidigare \"cherry-pick\":en är nu tom, kanske på grund av en löst\n"
+"Den tidigare ”cherry-pick”:en är nu tom, kanske på grund av en löst\n"
 "konflikt. Om du vill checka in den ändå använder du:\n"
 "\n"
 "    git commit --allow-empty\n"
 "\n"
 
 msgid "Otherwise, please use 'git rebase --skip'\n"
-msgstr "Använd annars \"git rebase --skip\"\n"
+msgstr "Använd annars ”git rebase --skip”\n"
 
 msgid "Otherwise, please use 'git cherry-pick --skip'\n"
-msgstr "Använd annars \"git cherry-pick --skip\"\n"
+msgstr "Använd annars ”git cherry-pick --skip”\n"
 
 msgid ""
 "and then use:\n"
@@ -4565,7 +4568,7 @@ msgstr ""
 "\n"
 "    git cherry-pick --continue\n"
 "\n"
-"för att fortsätta \"cherry-pick\" med resterande incheckningar.\n"
+"för att fortsätta ”cherry-pick” med resterande incheckningar.\n"
 "Om du vill hoppa över den här incheckningen, använd:\n"
 "\n"
 "    git cherry-pick --skip\n"
@@ -4592,9 +4595,6 @@ msgstr "kan inte uppdatera temporärt index"
 msgid "Failed to update main cache tree"
 msgstr "Misslyckades uppdatera huvud-cacheträdet"
 
-msgid "unable to write new_index file"
-msgstr "kunde inte skriva filen new_index"
-
 msgid "cannot do a partial commit during a merge."
 msgstr "kan inte utföra en delvis incheckning under en sammanslagning."
 
@@ -4612,14 +4612,14 @@ msgstr "kunde inte skriva temporär indexfil"
 
 #, c-format
 msgid "commit '%s' lacks author header"
-msgstr "incheckningen \"%s\" saknar författarhuvud"
+msgstr "incheckningen ”%s” saknar författarhuvud"
 
 #, c-format
 msgid "commit '%s' has malformed author line"
-msgstr "incheckningen \"%s\" har felformaterat författarhuvud"
+msgstr "incheckningen ”%s” har felformaterat författarhuvud"
 
 msgid "malformed --author parameter"
-msgstr "felformad \"--author\"-flagga"
+msgstr "felformad ”--author”-flagga"
 
 #, c-format
 msgid "invalid date format: %s"
@@ -4634,7 +4634,7 @@ msgstr ""
 
 #, c-format
 msgid "could not lookup commit '%s'"
-msgstr "kunde inte slå upp incheckningen \"%s\""
+msgstr "kunde inte slå upp incheckningen ”%s”"
 
 #, c-format
 msgid "(reading log message from standard input)\n"
@@ -4645,11 +4645,11 @@ msgstr "kunde inte läsa logg från standard in"
 
 #, c-format
 msgid "could not read log file '%s'"
-msgstr "kunde inte läsa loggfilen \"%s\""
+msgstr "kunde inte läsa loggfilen ”%s”"
 
 #, c-format
 msgid "options '%s' and '%s:%s' cannot be used together"
-msgstr "flaggorna \"%s\" och \"%s:%s\" kan inte användas samtidigt"
+msgstr "flaggorna ”%s” och ”%s:%s” kan inte användas samtidigt"
 
 msgid "could not read SQUASH_MSG"
 msgstr "kunde inte läsa SQUASH_MSG"
@@ -4659,7 +4659,7 @@ msgstr "kunde inte läsa MERGE_MSG"
 
 #, c-format
 msgid "could not open '%s'"
-msgstr "kunde inte öppna \"%s\""
+msgstr "kunde inte öppna ”%s”"
 
 msgid "could not write commit template"
 msgstr "kunde inte skriva incheckningsmall"
@@ -4670,7 +4670,7 @@ msgid ""
 "with '%c' will be ignored.\n"
 msgstr ""
 "Ange incheckningsmeddelandet för dina ändringar. Rader som inleds\n"
-"med \"%c\" kommer ignoreras.\n"
+"med ”%c” kommer ignoreras.\n"
 
 #, c-format
 msgid ""
@@ -4678,8 +4678,7 @@ msgid ""
 "with '%c' will be ignored, and an empty message aborts the commit.\n"
 msgstr ""
 "Ange incheckningsmeddelandet för dina ändringar. Rader som inleds\n"
-"med \"%c\" kommer ignoreras, och ett tomt meddelande avbryter "
-"incheckningen.\n"
+"med ”%c” kommer ignoreras, och ett tomt meddelande avbryter incheckningen.\n"
 
 #, c-format
 msgid ""
@@ -4687,7 +4686,7 @@ msgid ""
 "with '%c' will be kept; you may remove them yourself if you want to.\n"
 msgstr ""
 "Ange incheckningsmeddelandet för dina ändringar. Rader som inleds\n"
-"med \"%c\" kommer behållas; du kan själv ta bort dem om du vill.\n"
+"med ”%c” kommer behållas; du kan själv ta bort dem om du vill.\n"
 
 #, c-format
 msgid ""
@@ -4696,7 +4695,7 @@ msgid ""
 "An empty message aborts the commit.\n"
 msgstr ""
 "Ange incheckningsmeddelandet för dina ändringar. Rader som inleds\n"
-"med \"%c\" kommer behållas; du kan själv ta bort dem om du vill.\n"
+"med ”%c” kommer behållas; du kan själv ta bort dem om du vill.\n"
 "Ett tomt meddelande avbryter incheckningen.\n"
 
 msgid ""
@@ -4757,11 +4756,11 @@ msgstr ""
 
 #, c-format
 msgid "Invalid ignored mode '%s'"
-msgstr "Ogiltigt ignorerat läge \"%s\""
+msgstr "Ogiltigt ignorerat läge ”%s”"
 
 #, c-format
 msgid "Invalid untracked files mode '%s'"
-msgstr "Ogiltigt läge för ospårade filer: \"%s\""
+msgstr "Ogiltigt läge för ospårade filer: ”%s”"
 
 msgid "You are in the middle of a merge -- cannot reword."
 msgstr "Du är i mitten av en sammanslagning -- kan inte omformulera."
@@ -4772,11 +4771,11 @@ msgstr "Du är i mitten av en cherry-pick -- kan inte omformulera."
 #, c-format
 msgid "reword option of '%s' and path '%s' cannot be used together"
 msgstr ""
-"reword-flaggan till \"%s\" och sökvägen \"%s\" kan inte användas tillsammans"
+"reword-flaggan till ”%s” och sökvägen ”%s” kan inte användas tillsammans"
 
 #, c-format
 msgid "reword option of '%s' and '%s' cannot be used together"
-msgstr "reword-flaggan till \"%s\" och \"%s\" kan inte användas tillsammans"
+msgstr "reword-flaggan till ”%s” och ”%s” kan inte användas tillsammans"
 
 msgid "You have nothing to amend."
 msgstr "Du har inget att utöka."
@@ -4799,7 +4798,7 @@ msgstr "okänd flagga: --fixup=%s:%s"
 
 #, c-format
 msgid "paths '%s ...' with -a does not make sense"
-msgstr "sökvägarna \"%s ...\" med -a ger ingen mening"
+msgstr "sökvägarna ”%s ...” med -a ger ingen mening"
 
 msgid "show status concisely"
 msgstr "visa koncis status"
@@ -4992,13 +4991,13 @@ msgstr "Avbryter på grund av tom incheckningsmeddelandekropp.\n"
 
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
-"arkivet har uppdaterats, men kunde inte skriva filen\n"
-"new_index. Kontrollera att disken inte är full och\n"
+"arkivet har uppdaterats, men kunde inte skriva ny\n"
+"indexfil. Kontrollera att disken inte är full och\n"
 "att kvoten inte har överskridits, och kör sedan\n"
-"\"git restore --staged :/\" för att återställa."
+"”git restore --staged :/” för att återställa."
 
 msgid "git config [<options>]"
 msgstr "git config [<flaggor>]"
@@ -5071,7 +5070,7 @@ msgid "list all"
 msgstr "visa alla"
 
 msgid "use string equality when comparing values to 'value-pattern'"
-msgstr "använd stränglikhet vid när värden jämförs med \"värde-mönster\""
+msgstr "använd stränglikhet vid när värden jämförs med ”värde-mönster”"
 
 msgid "open an editor"
 msgstr "öppna textredigeringsprogram"
@@ -5092,7 +5091,7 @@ msgid "value is given this type"
 msgstr "värdet har givits denna typ"
 
 msgid "value is \"true\" or \"false\""
-msgstr "värdet är \"true\" eller \"false\""
+msgstr "värdet är ”true” eller ”false”"
 
 msgid "value is decimal number"
 msgstr "värdet är ett decimalt tal"
@@ -5157,7 +5156,7 @@ msgstr "misslyckades formatera standardkonfigurationsvärde: %s"
 
 #, c-format
 msgid "cannot parse color '%s'"
-msgstr "kan inte tolka färgen \"%s\""
+msgstr "kan inte tolka färgen ”%s”"
 
 msgid "unable to parse default color value"
 msgstr "kan inte tolka standardfärgvärde"
@@ -5207,7 +5206,7 @@ msgid ""
 msgstr ""
 "--worktree kan inte användas med flera arbetskataloger om inte\n"
 "konfigurationsutöknignen worktreeConfig har aktiverats. Läsa stycket\n"
-"\"KONFIGURATIONSFIL\" i \"git help worktree\" för detaljer"
+"”KONFIGURATIONSFIL” i ”git help worktree” för detaljer"
 
 msgid "--get-color and variable type are incoherent"
 msgstr "--get-color och variabeltyp stämmer inte överens"
@@ -5228,11 +5227,11 @@ msgid "--default is only applicable to --get"
 msgstr "--default gäller bara för --get"
 
 msgid "--fixed-value only applies with 'value-pattern'"
-msgstr "--fixed-value gäller endast med \"värde-mönster\""
+msgstr "--fixed-value gäller endast med ”värde-mönster”"
 
 #, c-format
 msgid "unable to read config file '%s'"
-msgstr "kan inte konfigurationsfil \"%s\""
+msgstr "kan inte läsa konfigurationsfilen ”%s”"
 
 msgid "error processing config file(s)"
 msgstr "fel vid hantering av konfigurationsfil(er)"
@@ -5245,7 +5244,7 @@ msgstr "redigering av blobbar stöds ej"
 
 #, c-format
 msgid "cannot create configuration file %s"
-msgstr "kan inte skapa konfigurationsfilen \"%s\""
+msgstr "kan inte skapa konfigurationsfilen ”%s”"
 
 #, c-format
 msgid ""
@@ -5278,11 +5277,10 @@ msgid "print debugging messages to stderr"
 msgstr "skriv felsökningsmeddelanden på standard fel"
 
 msgid "credential-cache--daemon unavailable; no unix socket support"
-msgstr ""
-"\"credential-cache--daemon\" ej tillgänglig; stöd för unix-uttag saknas"
+msgstr "”credential-cache--daemon” ej tillgänglig; stöd för unix-uttag saknas"
 
 msgid "credential-cache unavailable; no unix socket support"
-msgstr "\"credential-cache\" ej tillgänglig; stöd för unix-uttag saknas"
+msgstr "”credential-cache” ej tillgänglig; stöd för unix-uttag saknas"
 
 #, c-format
 msgid "unable to get credential storage lock in %d ms"
@@ -5317,11 +5315,11 @@ msgstr "den annoterade taggen %s inte tillgänglig"
 
 #, c-format
 msgid "tag '%s' is externally known as '%s'"
-msgstr "taggen \"%s\" är utanför känd som \"%s\""
+msgstr "taggen ”%s” är utanför känd som ”%s”"
 
 #, c-format
 msgid "no tag exactly matches '%s'"
-msgstr "ingen tagg motsvarar \"%s\" exakt"
+msgstr "ingen tagg motsvarar ”%s” exakt"
 
 #, c-format
 msgid "No exact match on refs or tags, searching to describe\n"
@@ -5337,7 +5335,7 @@ msgid ""
 "No annotated tags can describe '%s'.\n"
 "However, there were unannotated tags: try --tags."
 msgstr ""
-"Inga annoterade taggar kan beskriva \"%s\".\n"
+"Inga annoterade taggar kan beskriva ”%s”.\n"
 "Det finns dock oannoterade taggar: testa --tags."
 
 #, c-format
@@ -5345,7 +5343,7 @@ msgid ""
 "No tags can describe '%s'.\n"
 "Try --always, or create some tags."
 msgstr ""
-"Inga taggar kan beskriva \"%s\".\n"
+"Inga taggar kan beskriva ”%s”.\n"
 "Testa --always, eller skapa några taggar."
 
 #, c-format
@@ -5409,17 +5407,17 @@ msgid "mark"
 msgstr "märke"
 
 msgid "append <mark> on dirty working tree (default: \"-dirty\")"
-msgstr "lägg till <märke> på lortigt arbetsträd (standard: \"-dirty\")"
+msgstr "lägg till <märke> på lortigt arbetsträd (standard: ”-dirty”)"
 
 msgid "append <mark> on broken working tree (default: \"-broken\")"
-msgstr "lägg till <märke> på trasigt arbetsträd (standard: \"-broken\")"
+msgstr "lägg till <märke> på trasigt arbetsträd (standard: ”-broken”)"
 
 msgid "No names found, cannot describe anything."
 msgstr "Inga namn hittades, kan inte beskriva något."
 
 #, c-format
 msgid "option '%s' and commit-ishes cannot be used together"
-msgstr "flaggorna \"%s\" och incheckning-igter kan inte användas samtidigt"
+msgstr "flaggorna ”%s” och incheckning-igter kan inte användas samtidigt"
 
 msgid ""
 "git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
@@ -5443,7 +5441,7 @@ msgstr "--merge-base fungerar endast med två incheckningar"
 
 #, c-format
 msgid "'%s': not a regular file or symlink"
-msgstr "\"%s\": inte en normal fil eller symbolisk länk"
+msgstr "”%s”: inte en normal fil eller symbolisk länk"
 
 msgid "no merge given, only parents."
 msgstr "ingen sammanslagning angiven, endast föräldrar."
@@ -5461,15 +5459,15 @@ msgstr "Inte ett git-arkiv"
 
 #, c-format
 msgid "invalid object '%s' given."
-msgstr "objektet \"%s\" som angavs är felaktigt."
+msgstr "objektet ”%s” som angavs är felaktigt."
 
 #, c-format
 msgid "more than two blobs given: '%s'"
-msgstr "mer än två blobbar angavs: \"%s\""
+msgstr "mer än två blobbar angavs: ”%s”"
 
 #, c-format
 msgid "unhandled object '%s' given."
-msgstr "ej hanterat objekt \"%s\" angavs."
+msgstr "ej hanterat objekt ”%s” angavs."
 
 #, c-format
 msgid "%s...%s: multiple merge bases, using %s"
@@ -5495,23 +5493,23 @@ msgid ""
 "combined diff formats ('-c' and '--cc') are not supported in\n"
 "directory diff mode ('-d' and '--dir-diff')."
 msgstr ""
-"kombinerade diff-format (\"-c\" och \"--cc\") stöds inte i\n"
-"katalogdiffläge (\"-d\" och \"--dir-diff\")."
+"kombinerade diff-format (”-c” och ”--cc”) stöds inte i\n"
+"katalogdiffläge (”-d” och ”--dir-diff”)."
 
 #, c-format
 msgid "both files modified: '%s' and '%s'."
-msgstr "bägge filerna ändrade: \"%s\" och \"%s\"."
+msgstr "bägge filerna ändrade: ”%s” och ”%s”."
 
 msgid "working tree file has been left."
 msgstr "filen i arbetskatalogen lämnades kvar."
 
 #, c-format
 msgid "could not copy '%s' to '%s'"
-msgstr "kunde inte kopiera in \"%s\" till \"%s\""
+msgstr "kunde inte kopiera in ”%s” till ”%s”"
 
 #, c-format
 msgid "temporary files exist in '%s'."
-msgstr "temporära filer finns i \"%s\"."
+msgstr "temporära filer finns i ”%s”."
 
 msgid "you may want to cleanup or recover these."
 msgstr "du kanske vill städa eller rädda dem."
@@ -5521,7 +5519,7 @@ msgid "failed: %d"
 msgstr "misslyckades: %d"
 
 msgid "use `diff.guitool` instead of `diff.tool`"
-msgstr "använd \"diff.guitool\" istället för \"diff.tool\""
+msgstr "använd ”diff.guitool” istället för ”diff.tool”"
 
 msgid "perform a full-directory diff"
 msgstr "utför diff för hela katalogen"
@@ -5539,20 +5537,20 @@ msgid "use the specified diff tool"
 msgstr "använd angivet diff-verktyg"
 
 msgid "print a list of diff tools that may be used with `--tool`"
-msgstr "visa en lista över diff-verktyg som kan användas med \"--tool\""
+msgstr "visa en lista över diff-verktyg som kan användas med ”--tool”"
 
 msgid ""
 "make 'git-difftool' exit when an invoked diff tool returns a non-zero exit "
 "code"
 msgstr ""
-"låt \"git-difftool\" avsluta när ett anropat diff-verktyg ger returvärde "
-"skilt från noll"
+"låt ”git-difftool” avsluta när ett anropat diff-verktyg ger returvärde skilt "
+"från noll"
 
 msgid "specify a custom command for viewing diffs"
 msgstr "ange eget kommando för att visa diffar"
 
 msgid "passed to `diff`"
-msgstr "sändes till \"diff\""
+msgstr "sändes till ”diff”"
 
 msgid "difftool requires worktree or --no-index"
 msgstr "difftool kräver en arbetskatalog eller --no-index"
@@ -5631,26 +5629,26 @@ msgstr "märk taggar med märke-id"
 
 #, c-format
 msgid "Missing from marks for submodule '%s'"
-msgstr "Saknar från-märken för undermodulen \"%s\""
+msgstr "Saknar från-märken för undermodulen ”%s”"
 
 #, c-format
 msgid "Missing to marks for submodule '%s'"
-msgstr "Saknar till-märken för undermodulen \"%s\""
+msgstr "Saknar till-märken för undermodulen ”%s”"
 
 #, c-format
 msgid "Expected 'mark' command, got %s"
-msgstr "Förväntade \"mark\"-kommando, fick %s"
+msgstr "Förväntade ”mark”-kommando, fick %s"
 
 #, c-format
 msgid "Expected 'to' command, got %s"
-msgstr "Förväntade \"to\"-kommando, fick %s"
+msgstr "Förväntade ”to”-kommando, fick %s"
 
 msgid "Expected format name:filename for submodule rewrite option"
 msgstr "Förvändae formatet namn:filnamn för undermodul-omskrivningsflaggan"
 
 #, c-format
 msgid "feature '%s' forbidden in input without --allow-unsafe-features"
-msgstr "funktionen \"%s\" förbjuden i indata utan --allow-unsafe-features"
+msgstr "funktionen ”%s” förbjuden i indata utan --allow-unsafe-features"
 
 #, c-format
 msgid "Lockfile created but not reported: %s"
@@ -5717,7 +5715,7 @@ msgstr "ej snabbspolad"
 
 #, c-format
 msgid "cannot open '%s'"
-msgstr "kan inte öppna \"%s\""
+msgstr "kan inte öppna ”%s”"
 
 msgid ""
 "fetch normally indicates which branches had a forced update,\n"
@@ -5726,8 +5724,8 @@ msgid ""
 msgstr ""
 "fetch visar normalt vilka grenar som tvångsuppdaterats, men testet har "
 "slagits\n"
-"av; för att slå på igen, använd flaggan \"--show-forced-updates\" eller kör\n"
-"\"git config fetch.showForcedUpdates true\""
+"av; för att slå på igen, använd flaggan ”--show-forced-updates” eller kör\n"
+"”git config fetch.showForcedUpdates true”"
 
 #, c-format
 msgid ""
@@ -5737,9 +5735,8 @@ msgid ""
 "to avoid this check\n"
 msgstr ""
 "det tog %.2f sekunder att se efter tvångsuppdateringar; Du kan använda\n"
-"\"--no-show-forced-updates\" eller köra \"git config fetch."
-"showForcedUpdates\n"
-"false\" för att undvika testet\n"
+"”--no-show-forced-updates” eller köra ”git config fetch.showForcedUpdates\n"
+"false” för att undvika testet\n"
 
 #, c-format
 msgid "%s did not send all necessary objects\n"
@@ -5755,7 +5752,7 @@ msgid ""
 " 'git remote prune %s' to remove any old, conflicting branches"
 msgstr ""
 "vissa lokala referenser kunde inte uppdateras; testa att köra\n"
-" \"git remote prune %s\" för att ta bort gamla grenar som står i konflikt"
+" ”git remote prune %s” för att ta bort gamla grenar som står i konflikt"
 
 #, c-format
 msgid "   (%s will become dangling)"
@@ -5773,15 +5770,15 @@ msgstr "(ingen)"
 
 #, c-format
 msgid "refusing to fetch into branch '%s' checked out at '%s'"
-msgstr "vägrar hämta till grenen \"%s\" som är utcheckad på \"%s\""
+msgstr "vägrar hämta till grenen ”%s” som är utcheckad på ”%s”"
 
 #, c-format
 msgid "option \"%s\" value \"%s\" is not valid for %s"
-msgstr "flaggan \"%s\" med värdet \"%s\" är inte giltigt för %s"
+msgstr "flaggan ”%s” med värdet ”%s” är inte giltigt för %s"
 
 #, c-format
 msgid "option \"%s\" is ignored for %s\n"
-msgstr "flaggan \"%s\" ignoreras för %s\n"
+msgstr "flaggan ”%s” ignoreras för %s\n"
 
 #, c-format
 msgid "%s is not a valid object"
@@ -5799,8 +5796,8 @@ msgid ""
 "could not set upstream of HEAD to '%s' from '%s' when it does not point to "
 "any branch."
 msgstr ""
-"kunde inte sätta uppström för HEAD till \"%s\" från \"%s\" när det inte "
-"pekar mot någon gren."
+"kunde inte sätta uppström för HEAD till ”%s” från ”%s” när det inte pekar "
+"mot någon gren."
 
 msgid "not setting upstream for a remote remote-tracking branch"
 msgstr "ställer inte in uppströmsgren för en fjärrspårande gren på fjärren"
@@ -5828,7 +5825,7 @@ msgstr "kunde inte hämta %s"
 
 #, c-format
 msgid "could not fetch '%s' (exit code: %d)\n"
-msgstr "kunde inte hämta \"%s\" (felkod: %d)\n"
+msgstr "kunde inte hämta ”%s” (felkod: %d)\n"
 
 msgid ""
 "no remote repository specified; please specify either a URL or a\n"
@@ -5926,7 +5923,7 @@ msgid "refmap"
 msgstr "referenskarta"
 
 msgid "specify fetch refmap"
-msgstr "ange referenskarta för \"fetch\""
+msgstr "ange referenskarta för ”fetch”"
 
 msgid "report that we have only objects reachable from this object"
 msgstr "rapportera att vi bara har objekt nåbara från detta objektet"
@@ -5935,7 +5932,7 @@ msgid "do not fetch a packfile; instead, print ancestors of negotiation tips"
 msgstr "hämta inte paketfil; skriv istället förfäder till förhandlingstips"
 
 msgid "run 'maintenance --auto' after fetching"
-msgstr "kör \"maintenance --auto\" efter hämtning"
+msgstr "kör ”maintenance --auto” efter hämtning"
 
 msgid "check for forced-updates on all updated branches"
 msgstr "se efter tvingade uppdateringar i alla uppdaterade grenar"
@@ -5957,7 +5954,7 @@ msgstr "--unshallow kan inte användas på ett komplett arkiv"
 
 #, c-format
 msgid "failed to fetch bundles from '%s'"
-msgstr "misslyckades hämta buntar från \"%s\""
+msgstr "misslyckades hämta buntar från ”%s”"
 
 msgid "fetch --all does not take a repository argument"
 msgstr "fetch --all tar inte namnet på ett arkiv som argument"
@@ -6133,11 +6130,11 @@ msgstr "kunde inte skapa lost-found"
 
 #, c-format
 msgid "could not write '%s'"
-msgstr "kunde inte skriva \"%s\""
+msgstr "kunde inte skriva ”%s”"
 
 #, c-format
 msgid "could not finish '%s'"
-msgstr "kunde inte avsluta \"%s\""
+msgstr "kunde inte avsluta ”%s”"
 
 #, c-format
 msgid "Checking %s"
@@ -6174,7 +6171,7 @@ msgstr "%s: ogiltig reflog-post %s"
 
 #, c-format
 msgid "Checking reflog %s->%s"
-msgstr "Kontrollerar reflog %s->%s"
+msgstr "Kontrollerar reflog %s%s"
 
 #, c-format
 msgid "%s: invalid sha1 pointer %s"
@@ -6197,7 +6194,7 @@ msgstr "%s: objektet trasigt eller saknas: %s"
 
 #, c-format
 msgid "%s: object is of unknown type '%s': %s"
-msgstr "%s: objektet har okänd typ \"%s\": %s"
+msgstr "%s: objektet har okänd typ ”%s”: %s"
 
 #, c-format
 msgid "%s: object could not be parsed: %s"
@@ -6250,11 +6247,11 @@ msgstr "%s: ogiltig sha1-pekare i resolve-undo för %s"
 
 #, c-format
 msgid "unable to load rev-index for pack '%s'"
-msgstr "kunde inte läsa rev-index för paketfil \"%s\""
+msgstr "kunde inte läsa rev-index för paketfil ”%s”"
 
 #, c-format
 msgid "invalid rev-index for pack '%s'"
-msgstr "ogiltigt rev-index för paketet \"%s\""
+msgstr "ogiltigt rev-index för paketet ”%s”"
 
 msgid ""
 "git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
@@ -6314,7 +6311,7 @@ msgstr "%s: objekt saknas"
 
 #, c-format
 msgid "invalid parameter: expected sha1, got '%s'"
-msgstr "ogiltig parameter: förväntade sha1, fick \"%s\""
+msgstr "ogiltig parameter: förväntade sha1, fick ”%s”"
 
 msgid "git fsmonitor--daemon start [<options>]"
 msgstr "git fsmonitor--daemon start [<flaggor>]"
@@ -6324,23 +6321,23 @@ msgstr "git fsmonitor--daemon run [<flaggor>]"
 
 #, c-format
 msgid "value of '%s' out of range: %d"
-msgstr "värdet för \"%s\" utanför intervallet: %d"
+msgstr "värdet för ”%s” utanför intervallet: %d"
 
 #, c-format
 msgid "value of '%s' not bool or int: %d"
-msgstr "värdet för \"%s\" är inte bool eller int: %d"
+msgstr "värdet för ”%s” är inte bool eller int: %d"
 
 #, c-format
 msgid "fsmonitor-daemon is watching '%s'\n"
-msgstr "fsmonitor-daemon bevakar \"%s\"\n"
+msgstr "fsmonitor-daemon bevakar ”%s”\n"
 
 #, c-format
 msgid "fsmonitor-daemon is not watching '%s'\n"
-msgstr "fsmonitor-daemon bevakar inte \"%s\"\n"
+msgstr "fsmonitor-daemon bevakar inte ”%s”\n"
 
 #, c-format
 msgid "could not create fsmonitor cookie '%s'"
-msgstr "kunde inte skapa fsmonitor-kaka \"%s\""
+msgstr "kunde inte skapa fsmonitor-kaka ”%s”"
 
 #, c-format
 msgid "fsmonitor: cookie_result '%d' != SEEN"
@@ -6348,7 +6345,7 @@ msgstr "fsmonitor: cookie_result '%d' != SEEN"
 
 #, c-format
 msgid "could not start IPC thread pool on '%s'"
-msgstr "kunde inte starta IPC-trådpol på \"%s\""
+msgstr "kunde inte starta IPC-trådpol på ”%s”"
 
 msgid "could not start fsmonitor listener thread"
 msgstr "kunde inte starta fsmonitor-lyssnartråd"
@@ -6364,19 +6361,19 @@ msgstr "kunde inte initiera hälsotråd"
 
 #, c-format
 msgid "could not cd home '%s'"
-msgstr "kunde inte byta katalog hem \"%s\""
+msgstr "kunde inte byta katalog hem ”%s”"
 
 #, c-format
 msgid "fsmonitor--daemon is already running '%s'"
-msgstr "fsmonitor--daemon körs redan på \"%s\""
+msgstr "fsmonitor--daemon körs redan på ”%s”"
 
 #, c-format
 msgid "running fsmonitor-daemon in '%s'\n"
-msgstr "kör fsmonitor-daemon i \"%s\"\n"
+msgstr "kör fsmonitor-daemon i ”%s”\n"
 
 #, c-format
 msgid "starting fsmonitor-daemon in '%s'\n"
-msgstr "startar fsmonitor-daemon i \"%s\"\n"
+msgstr "startar fsmonitor-daemon i ”%s”\n"
 
 msgid "daemon failed to start"
 msgstr "serverprocessen kunde inte startas"
@@ -6398,11 +6395,11 @@ msgstr "max sekunder att vänta på att serverprocessen startar"
 
 #, c-format
 msgid "invalid 'ipc-threads' value (%d)"
-msgstr "ogiltigt värde för \"ipc-threads\" (%d)"
+msgstr "ogiltigt värde för ”ipc-threads” (%d)"
 
 #, c-format
 msgid "Unhandled subcommand '%s'"
-msgstr "Ej hanterat underkommando \"%s\""
+msgstr "Ej hanterat underkommando ”%s”"
 
 msgid "fsmonitor--daemon not supported on this platform"
 msgstr "fsmonitor--daemon stöds inte på denna plattform"
@@ -6416,11 +6413,11 @@ msgstr "Misslyckades ta status (fstat) på %s: %s"
 
 #, c-format
 msgid "failed to parse '%s' value '%s'"
-msgstr "misslyckades tolka \"%s\" värde \"%s\""
+msgstr "misslyckades tolka ”%s” värde ”%s”"
 
 #, c-format
 msgid "cannot stat '%s'"
-msgstr "kan inte ta status på \"%s\""
+msgstr "kan inte ta status på ”%s”"
 
 #, c-format
 msgid ""
@@ -6442,6 +6439,9 @@ msgstr "rensa ej refererade objekt"
 msgid "pack unreferenced objects separately"
 msgstr "packa ej refererade objekt separat"
 
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "med --cruft, begränsa storleken på nya onödiga paket"
+
 msgid "be more thorough (increased runtime)"
 msgstr "var mer grundlig (ökar körtiden)"
 
@@ -6472,20 +6472,19 @@ msgstr "Packar arkivet automatiskt för optimal prestanda.\n"
 
 #, c-format
 msgid "See \"git help gc\" for manual housekeeping.\n"
-msgstr "Se \"git help gc\" för manuell hushållning.\n"
+msgstr "Se ”git help gc” för manuell hushållning.\n"
 
 #, c-format
 msgid ""
 "gc is already running on machine '%s' pid %<PRIuMAX> (use --force if not)"
 msgstr ""
-"gc körs redan på maskinen \"%s\" pid %<PRIuMAX> (använd --force om så inte "
-"är fallet)"
+"gc körs redan på maskinen ”%s” pid %<PRIuMAX> (använd --force om så inte är "
+"fallet)"
 
 msgid ""
 "There are too many unreachable loose objects; run 'git prune' to remove them."
 msgstr ""
-"Det finns för många onåbara lösa objekt; kör \"git prune\" för att ta bort "
-"dem."
+"Det finns för många onåbara lösa objekt; kör ”git prune” för att ta bort dem."
 
 msgid ""
 "git maintenance run [--auto] [--[no-]quiet] [--task=<task>] [--schedule]"
@@ -6506,41 +6505,41 @@ msgid "failed to prefetch remotes"
 msgstr "kunde inte förhämta fjärrar"
 
 msgid "failed to start 'git pack-objects' process"
-msgstr "kunde inte starta \"git pack-objects\"-process"
+msgstr "kunde inte starta ”git pack-objects”-process"
 
 msgid "failed to finish 'git pack-objects' process"
-msgstr "kunde inte avsluta \"git pack-objects\"-process"
+msgstr "kunde inte avsluta ”git pack-objects”-process"
 
 msgid "failed to write multi-pack-index"
 msgstr "kunde inte skriva multi-pack-index"
 
 msgid "'git multi-pack-index expire' failed"
-msgstr "\"git multi-pack-index expire\" misslyckades"
+msgstr "”git multi-pack-index expire” misslyckades"
 
 msgid "'git multi-pack-index repack' failed"
-msgstr "\"git multi-pack-index repack\" misslyckades"
+msgstr "”git multi-pack-index repack” misslyckades"
 
 msgid ""
 "skipping incremental-repack task because core.multiPackIndex is disabled"
 msgstr ""
-"hoppar över \"incremental-repack\"-uppgift eftersom core.multiPackIndex är "
+"hoppar över ”incremental-repack”-uppgift eftersom core.multiPackIndex är "
 "inaktiverat"
 
 #, c-format
 msgid "lock file '%s' exists, skipping maintenance"
-msgstr "låsfilen \"%s\" finns, hoppar över underhåll"
+msgstr "låsfilen ”%s” finns, hoppar över underhåll"
 
 #, c-format
 msgid "task '%s' failed"
-msgstr "uppgiften \"%s\" misslyckades"
+msgstr "uppgiften ”%s” misslyckades"
 
 #, c-format
 msgid "'%s' is not a valid task"
-msgstr "\"%s\" är inte en giltig uppgift"
+msgstr "”%s” är inte en giltig uppgift"
 
 #, c-format
 msgid "task '%s' cannot be selected multiple times"
-msgstr "uppgiften \"%s\" kan inte väljas flera gånger"
+msgstr "uppgiften ”%s” kan inte väljas flera gånger"
 
 msgid "run tasks based on the state of the repository"
 msgstr "kör uppgifter baserad på arkivets tillstånd"
@@ -6565,29 +6564,29 @@ msgstr "använd som mest en av --auto och --schedule=<frekvens>"
 
 #, c-format
 msgid "unable to add '%s' value of '%s'"
-msgstr "kan inte lägga till \"%s\"-värdet för \"%s\""
+msgstr "kan inte lägga till ”%s”-värdet för ”%s”"
 
 msgid "return success even if repository was not registered"
 msgstr "returnera framgång även om arkivet inte var registrerat"
 
 #, c-format
 msgid "unable to unset '%s' value of '%s'"
-msgstr "kan inte ta bort \"%s\"-värdet för \"%s\""
+msgstr "kan inte ta bort ”%s”-värdet för ”%s”"
 
 #, c-format
 msgid "repository '%s' is not registered"
-msgstr "arkivet \"%s\" har inte registrerats"
+msgstr "arkivet ”%s” har inte registrerats"
 
 #, c-format
 msgid "failed to expand path '%s'"
-msgstr "misslyckades expandera sökvägen \"%s\""
+msgstr "misslyckades expandera sökvägen ”%s”"
 
 msgid "failed to start launchctl"
 msgstr "misslyckades starta launchctl"
 
 #, c-format
 msgid "failed to create directories for '%s'"
-msgstr "misslyckades skapa kataloger för \"%s\""
+msgstr "misslyckades skapa kataloger för ”%s”"
 
 #, c-format
 msgid "failed to bootstrap service %s"
@@ -6600,8 +6599,7 @@ msgid "failed to start schtasks"
 msgstr "misslyckades starta schtasks"
 
 msgid "failed to run 'crontab -l'; your system might not support 'cron'"
-msgstr ""
-"misslyckades köra \"crontab -l\"; ditt system kanske inte stöder \"cron\""
+msgstr "misslyckades köra ”crontab -l”; ditt system kanske inte stöder ”cron”"
 
 msgid "failed to create crontab temporary file"
 msgstr "misslyckades skapa temporär crontab-fil"
@@ -6610,28 +6608,28 @@ msgid "failed to open temporary file"
 msgstr "misslyckades öppna temporär fil"
 
 msgid "failed to run 'crontab'; your system might not support 'cron'"
-msgstr "misslyckades köra \"crontab\"; ditt system kanske inte stöder \"cron\""
+msgstr "misslyckades köra ”crontab”; ditt system kanske inte stöder ”cron”"
 
 msgid "'crontab' died"
-msgstr "\"crontab\" dog"
-
-msgid "failed to start systemctl"
-msgstr "misslyckades starta systemctl"
-
-msgid "failed to run systemctl"
-msgstr "misslyckades att köra systemctl"
+msgstr "”crontab” dog"
 
 #, c-format
 msgid "failed to delete '%s'"
-msgstr "misslyckades ta bort \"%s\""
+msgstr "misslyckades ta bort ”%s”"
 
 #, c-format
 msgid "failed to flush '%s'"
-msgstr "misslyckades spola \"%s\""
+msgstr "misslyckades spola ”%s”"
+
+msgid "failed to start systemctl"
+msgstr "misslyckades starta systemctl"
+
+msgid "failed to run systemctl"
+msgstr "misslyckades att köra systemctl"
 
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
-msgstr "okänt argument för --scheduler, \"%s\""
+msgstr "okänt argument för --scheduler, ”%s”"
 
 msgid "neither systemd timers nor crontab are available"
 msgstr "varken systemd-timer eller crontab är tillgänglig"
@@ -6650,7 +6648,10 @@ msgid "scheduler"
 msgstr "schemaläggare"
 
 msgid "scheduler to trigger git maintenance run"
-msgstr "schemaläggare som utlöser \"git maintenance\"-körning"
+msgstr "schemaläggare som utlöser ”git maintenance”-körning"
+
+msgid "failed to set up maintenance schedule"
+msgstr "misslyckades uppdatera underhållsschema"
 
 msgid "failed to add repo to global config"
 msgstr "misslyckades lägga till arkiv till global konfiguration"
@@ -6682,13 +6683,17 @@ msgstr "trådstöd saknas, ignorerar %s"
 msgid "unable to read tree (%s)"
 msgstr "kunde inte läsa träd (%s)"
 
+#, c-format
+msgid "unable to read tree %s"
+msgstr "kunde inte läsa trädet %s"
+
 #, c-format
 msgid "unable to grep from object of type %s"
-msgstr "kunde inte \"grep\" från objekt av typen %s"
+msgstr "kunde inte ”grep” från objekt av typen %s"
 
 #, c-format
 msgid "switch `%c' expects a numerical value"
-msgstr "flaggan \"%c\" antar ett numeriskt värde"
+msgstr "flaggan ”%c” antar ett numeriskt värde"
 
 msgid "search in index instead of in the work tree"
 msgstr "sök i indexet istället för i arbetskatalogen"
@@ -6700,7 +6705,7 @@ msgid "search in both tracked and untracked files"
 msgstr "sök i både spårade och ospårade filer"
 
 msgid "ignore files specified via '.gitignore'"
-msgstr "ignorera filer angivna i \".gitignore\""
+msgstr "ignorera filer angivna i ”.gitignore”"
 
 msgid "recursively search in each submodule"
 msgstr "sök varje undermodul rekursivt"
@@ -6726,8 +6731,8 @@ msgstr "hantera binärfiler med textconv-filter"
 msgid "search in subdirectories (default)"
 msgstr "sök i underkataloger (standard)"
 
-msgid "descend at most <depth> levels"
-msgstr "gå som mest ned <djup> nivåer"
+msgid "descend at most <n> levels"
+msgstr "gå som mest ned <n> nivåer"
 
 msgid "use extended POSIX regular expressions"
 msgstr "använd utökade POSIX-reguljära uttryck"
@@ -6934,7 +6939,7 @@ msgstr "git help [[-i|--info] [-m|--man] [-w|--web]] [<kommando>|<doc>]"
 
 #, c-format
 msgid "unrecognized help format '%s'"
-msgstr "okänt hjälpformat: \"%s\""
+msgstr "okänt hjälpformat: ”%s”"
 
 msgid "Failed to start emacsclient."
 msgstr "Misslyckades starta emacsclient."
@@ -6944,31 +6949,31 @@ msgstr "Kunde inte tolka emacsclient-version."
 
 #, c-format
 msgid "emacsclient version '%d' too old (< 22)."
-msgstr "emacsclient version \"%d\" för gammal (< 22)."
+msgstr "emacsclient version ”%d” för gammal (< 22)."
 
 #, c-format
 msgid "failed to exec '%s'"
-msgstr "exec misslyckades för \"%s\""
+msgstr "exec misslyckades för ”%s”"
 
 #, c-format
 msgid ""
 "'%s': path for unsupported man viewer.\n"
 "Please consider using 'man.<tool>.cmd' instead."
 msgstr ""
-"\"%s\": sökväg för man-visare som ej stöds.\n"
-"Använd \"man.<verktyg>.cmd\" istället."
+"”%s”: sökväg för man-visare som ej stöds.\n"
+"Använd ”man.<verktyg>.cmd” istället."
 
 #, c-format
 msgid ""
 "'%s': cmd for supported man viewer.\n"
 "Please consider using 'man.<tool>.path' instead."
 msgstr ""
-"\"%s\": kommando för man-visare som stöds.\n"
-"Använd \"man.<verktyg>.path\" istället."
+"”%s”: kommando för man-visare som stöds.\n"
+"Använd ”man.<verktyg>.path” istället."
 
 #, c-format
 msgid "'%s': unknown man viewer."
-msgstr "\"%s\": okänd man-visare."
+msgstr "”%s”: okänd man-visare."
 
 msgid "no man viewer handled the request"
 msgstr "ingen man-visare hanterade förfrågan"
@@ -6978,7 +6983,7 @@ msgstr "ingen info-visare hanterade förfrågan"
 
 #, c-format
 msgid "'%s' is aliased to '%s'"
-msgstr "\"%s\" är ett alias för \"%s\""
+msgstr "”%s” är ett alias för ”%s”"
 
 #, c-format
 msgid "bad alias.%s string: %s"
@@ -6986,20 +6991,19 @@ msgstr "felaktig alias.%s-sträng: %s"
 
 #, c-format
 msgid "the '%s' option doesn't take any non-option arguments"
-msgstr "flaggan \"%s\" tar inte några argument som inte är flaggor"
+msgstr "flaggan ”%s” tar inte några argument som inte är flaggor"
 
 msgid ""
 "the '--no-[external-commands|aliases]' options can only be used with '--all'"
 msgstr ""
-"flaggorna '--no-[external-commands|aliases]' kan endast användas med \"--all"
-"\""
+"flaggorna '--no-[external-commands|aliases]' kan endast användas med ”--all”"
 
 #, c-format
 msgid "usage: %s%s"
 msgstr "användning: %s%s"
 
 msgid "'git help config' for more information"
-msgstr "\"git help config\" för mer information"
+msgstr "”git help config” för mer information"
 
 msgid ""
 "git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
@@ -7074,7 +7078,7 @@ msgid "unknown object type %d"
 msgstr "okänd objekttyp %d"
 
 msgid "cannot pread pack file"
-msgstr "kan inte utföra \"pread\" på paketfil"
+msgstr "kan inte utföra ”pread” på paketfil"
 
 #, c-format
 msgid "premature end of pack file, %<PRIuMAX> byte missing"
@@ -7089,10 +7093,6 @@ msgstr "allvarlig inflate-inkonsekvens"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "SHA1-KOLLISION UPPTÄCKT VID %s !"
 
-#, c-format
-msgid "unable to read %s"
-msgstr "kunde inte läsa %s"
-
 #, c-format
 msgid "cannot read existing object info %s"
 msgstr "kan inte läsa information om befintligt objekt %s"
@@ -7125,7 +7125,7 @@ msgid "pack is corrupted (SHA1 mismatch)"
 msgstr "paketet är trasigt (SHA1 stämmer inte)"
 
 msgid "cannot fstat packfile"
-msgstr "kan inte utföra \"fstat\" på paketfil"
+msgstr "kan inte utföra ”fstat” på paketfil"
 
 msgid "pack has junk at the end"
 msgstr "paket har skräp i slutet"
@@ -7161,7 +7161,7 @@ msgstr[1] "paketet har %d oanalyserade delta"
 
 #, c-format
 msgid "unable to deflate appended object (%d)"
-msgstr "kunde inte utföra \"deflate\" på tillagt objekt (%d)"
+msgstr "kunde inte utföra ”deflate” på tillagt objekt (%d)"
 
 #, c-format
 msgid "local object %s is corrupt"
@@ -7169,19 +7169,19 @@ msgstr "lokalt objekt %s är trasigt"
 
 #, c-format
 msgid "packfile name '%s' does not end with '.%s'"
-msgstr "paketfilnamnet \"%s\" slutar inte med \".%s\""
+msgstr "paketfilnamnet ”%s” slutar inte med ”.%s”"
 
 #, c-format
 msgid "cannot write %s file '%s'"
-msgstr "kan inte ta skriva %s-fil \"%s\""
+msgstr "kan inte ta skriva %s-fil ”%s”"
 
 #, c-format
 msgid "cannot close written %s file '%s'"
-msgstr "kan inte stänga skriven %s-fil \"%s\""
+msgstr "kan inte stänga skriven %s-fil ”%s”"
 
 #, c-format
 msgid "unable to rename temporary '*.%s' file to '%s'"
-msgstr "kunde inte byta namn på temporär \"*.%s\"-fil till \"%s\""
+msgstr "kunde inte byta namn på temporär ”*.%s”-fil till ”%s”"
 
 msgid "error while closing pack file"
 msgstr "fel vid stängning av paketfil"
@@ -7192,11 +7192,11 @@ msgstr "felaktig pack.indexVersion=%<PRIu32>"
 
 #, c-format
 msgid "Cannot open existing pack file '%s'"
-msgstr "Kan inte öppna befintlig paketfil \"%s\""
+msgstr "Kan inte öppna befintlig paketfil ”%s”"
 
 #, c-format
 msgid "Cannot open existing pack idx file for '%s'"
-msgstr "Kan inte öppna befintlig paket-idx-fil för \"%s\""
+msgstr "Kan inte öppna befintlig paket-idx-fil för ”%s”"
 
 #, c-format
 msgid "non delta: %d object"
@@ -7219,7 +7219,7 @@ msgstr "felaktig %s"
 
 #, c-format
 msgid "unknown hash algorithm '%s'"
-msgstr "okänd hashningsalgoritm \"%s\""
+msgstr "okänd hashningsalgoritm ”%s”"
 
 msgid "--stdin requires a git repository"
 msgstr "--stdin kräver ett git-arkiv"
@@ -7233,11 +7233,13 @@ msgstr "fsck-fel i packat objekt"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<mallkatalog>]\n"
 "         [--separate-git-dir <git-kat>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <grennamn> | --initial-branch=<grennamn>]\n"
 "         [--shared[=<behörigheter>]] [<katalog>]"
 
@@ -7274,18 +7276,19 @@ msgstr ""
 
 #, c-format
 msgid "Cannot access work tree '%s'"
-msgstr "Kan inte komma åt arbetskatalogen \"%s\""
+msgstr "Kan inte komma åt arbetskatalogen ”%s”"
 
 msgid "--separate-git-dir incompatible with bare repository"
 msgstr "--separate-git-dir är inkompatibelt med naket arkiv"
 
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <symbol>[(=|:)<värde>])...]\n"
+"                       [(--trailer (<nyckel>|<nyckelAlias>)"
+"[(=|:)<värde>])...]\n"
 "                       [--parse] [<fil>...]"
 
 msgid "edit files in place"
@@ -7294,6 +7297,9 @@ msgstr "redigera filer på plats"
 msgid "trim empty trailers"
 msgstr "ta bort tomma släprader"
 
+msgid "placement"
+msgstr "placering"
+
 msgid "where to place the new trailer"
 msgstr "var nya släprader ska placeras"
 
@@ -7306,17 +7312,17 @@ msgstr "att göra om släprader saknas"
 msgid "output only the trailers"
 msgstr "visa endast släprader"
 
-msgid "do not apply config rules"
-msgstr "använd inte regler från konfigurationen"
+msgid "do not apply trailer.* configuration variables"
+msgstr "tillämpa inte konfigurationsvariablerna trailer.*"
 
-msgid "join whitespace-continued values"
-msgstr "slå ihop värden avdelade med blanksteg"
+msgid "reformat multiline trailer values as single-line values"
+msgstr "omformatera flerradiga släpradsvärden som enradsvärden"
 
-msgid "set parsing options"
-msgstr "välj tolkningsalternativ"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "alias för --only-trailers --only-input --unfold"
 
-msgid "do not treat --- specially"
-msgstr "tolka inte --- speciellt"
+msgid "do not treat \"---\" as the end of input"
+msgstr "tolka inte ”---” som slut på indata"
 
 msgid "trailer(s) to add"
 msgstr "släprad(er) att lägga till"
@@ -7405,6 +7411,10 @@ msgstr "behöver precis ett intervall"
 msgid "not a range"
 msgstr "inte ett intervall"
 
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "kan inte läsa grenbeskrivningsfilen ”%s”"
+
 msgid "cover letter needs email format"
 msgstr "omslagsbrevet behöver e-postformat"
 
@@ -7427,7 +7437,7 @@ msgstr "okänd incheckning %s"
 
 #, c-format
 msgid "failed to resolve '%s' as a valid ref"
-msgstr "misslyckades slå upp \"%s\" som en giltig referens"
+msgstr "misslyckades slå upp ”%s” som en giltig referens"
 
 msgid "could not find exact merge base"
 msgstr "kunde inte hitta exakt sammanslagningsbas"
@@ -7458,7 +7468,7 @@ msgstr "misslyckades räkna ut intervalldiff-ursprung för aktuell serie"
 
 #, c-format
 msgid "using '%s' as range-diff origin of current series"
-msgstr "använd \"%s\" som intervalldiff-ursprung för aktuell serie"
+msgstr "använd ”%s” som intervalldiff-ursprung för aktuell serie"
 
 msgid "use [PATCH n/m] even with a single patch"
 msgstr "använd [PATCH n/m] även för en ensam patch"
@@ -7479,7 +7489,7 @@ msgid "sfx"
 msgstr "sfx"
 
 msgid "use <sfx> instead of '.patch'"
-msgstr "använd <sfx> istället för \".patch\""
+msgstr "använd <sfx> istället för ”.patch”"
 
 msgid "start numbering patches at <n> instead of 1"
 msgstr "börja numrera patchar på <n> istället för 1"
@@ -7502,6 +7512,9 @@ msgstr "cover-from-description-läge"
 msgid "generate parts of a cover letter based on a branch's description"
 msgstr "skapa delar av omslagsbrevet baserat på grenbeskrivelsen"
 
+msgid "use branch description from file"
+msgstr "använd grenbeskrivningar från fil"
+
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "använd [<prefix>] istället för [PATCH]"
 
@@ -7536,10 +7549,10 @@ msgid "email"
 msgstr "epost"
 
 msgid "add To: header"
-msgstr "lägg till mottagarhuvud (\"To:\")"
+msgstr "lägg till mottagarhuvud (”To:”)"
 
 msgid "add Cc: header"
-msgstr "lägg till kopiehuvud (\"Cc:\")"
+msgstr "lägg till kopiehuvud (”Cc:”)"
 
 msgid "ident"
 msgstr "ident"
@@ -7616,7 +7629,7 @@ msgstr "kan inte använda --remerge-diff"
 
 #, c-format
 msgid "could not create directory '%s'"
-msgstr "kunde inte skapa katalogen \"%s\""
+msgstr "kunde inte skapa katalogen ”%s”"
 
 msgid "--interdiff requires --cover-letter or single patch"
 msgstr "--interdiff kräver --cover-letter eller ensam patch"
@@ -7640,7 +7653,7 @@ msgstr "Intervall-diff mot v%d:"
 
 #, c-format
 msgid "unable to read signature file '%s'"
-msgstr "kunde inte läsa signaturfil \"%s\""
+msgstr "kunde inte läsa signaturfil ”%s”"
 
 msgid "Generating patches"
 msgstr "Skapar patchar"
@@ -7658,15 +7671,15 @@ msgstr "Kunde inte hitta en spårad fjärrgren, ange <uppström> manuellt.\n"
 
 #, c-format
 msgid "could not get object info about '%s'"
-msgstr "kunde inte hämta objektinfo om \"%s\""
+msgstr "kunde inte hämta objektinfo om ”%s”"
 
 #, c-format
 msgid "bad ls-files format: element '%s' does not start with '('"
-msgstr "felaktigt ls-files-format: elementet \"%s\" börjar inte med \"(\""
+msgstr "felaktigt ls-files-format: elementet ”%s” börjar inte med ”(”"
 
 #, c-format
 msgid "bad ls-files format: element '%s' does not end in ')'"
-msgstr "felaktigt ls-files-format: elementet \"%s\" slutar inte med \")\""
+msgstr "felaktigt ls-files-format: elementet ”%s” slutar inte med ”)”"
 
 #, c-format
 msgid "bad ls-files format: %%%.*s"
@@ -7682,10 +7695,10 @@ msgid "identify the file status with tags"
 msgstr "identifiera filstatus med taggar"
 
 msgid "use lowercase letters for 'assume unchanged' files"
-msgstr "använd små bokstäver för \"anta oförändrade\"-filer"
+msgstr "använd små bokstäver för ”anta oförändrade”-filer"
 
 msgid "use lowercase letters for 'fsmonitor clean' files"
-msgstr "använd små bokstäver för \"fsmonitor clean\"-filer"
+msgstr "använd små bokstäver för ”fsmonitor clean”-filer"
 
 msgid "show cached files in the output (default)"
 msgstr "visa cachade filer i utdata (standard)"
@@ -7709,7 +7722,7 @@ msgid "show files on the filesystem that need to be removed"
 msgstr "visa filer i filsystemet som behöver tas bort"
 
 msgid "show 'other' directories' names only"
-msgstr "visa endast namn för \"andra\" kataloger"
+msgstr "visa endast namn för ”andra” kataloger"
 
 msgid "show line endings of files"
 msgstr "visa radslut i filer"
@@ -7721,7 +7734,7 @@ msgid "show unmerged files in the output"
 msgstr "visa ej sammanslagna filer i utdata"
 
 msgid "show resolve-undo information"
-msgstr "visa \"resolve-undo\"-information"
+msgstr "visa ”resolve-undo”-information"
 
 msgid "skip files matching pattern"
 msgstr "hoppa över filer som motsvarar mönster"
@@ -7804,11 +7817,11 @@ msgstr "git ls-tree [<flaggor>] <träd-igt> [<sökväg>...]"
 
 #, c-format
 msgid "bad ls-tree format: element '%s' does not start with '('"
-msgstr "felaktigt ls-tree-format: elementet \"%s\" börjar inte med \"(\""
+msgstr "felaktigt ls-tree-format: elementet ”%s” börjar inte med ”(”"
 
 #, c-format
 msgid "bad ls-tree format: element '%s' does not end in ')'"
-msgstr "felaktigt ls-tree-format: elementet \"%s\" slutar inte med \")\""
+msgstr "felaktigt ls-tree-format: elementet ”%s” slutar inte med ”)”"
 
 #, c-format
 msgid "bad ls-tree format: %%%.*s"
@@ -7852,7 +7865,7 @@ msgid "keep subject"
 msgstr "behåll ärenderad"
 
 msgid "keep non patch brackets in subject"
-msgstr "behåll hakparanterser som inte är \"patch\" i ärenderaden"
+msgstr "behåll hakparanterser som inte är ”patch” i ärenderaden"
 
 msgid "copy Message-ID to the end of commit message"
 msgstr "kopiera Message-ID till slutet av incheckningsmeddelandet"
@@ -7886,7 +7899,7 @@ msgstr "läser patchar från standard in/tty..."
 
 #, c-format
 msgid "empty mbox: '%s'"
-msgstr "tom mbox: \"%s\""
+msgstr "tom mbox: ”%s”"
 
 msgid "git merge-base [-a | --all] <commit> <commit>..."
 msgstr "git merge-base [-a | --all] <incheckning> <incheckning>..."
@@ -7925,9 +7938,18 @@ msgstr ""
 "git merge-file [<alternativ>] [-L <namn1> [-L <orig> [-L <namn2>]]] <fil1> "
 "<origfil> <fil2>"
 
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"flaggan diff-algorithm godtar ”myers”, ”minimal”, ”patience” och ”histogram”"
+
 msgid "send results to standard output"
 msgstr "sänd resultat till standard ut"
 
+msgid "use object IDs instead of filenames"
+msgstr "använd objekt-ID istället för filnamn"
+
 msgid "use a diff3 based merge"
 msgstr "använd diff3-baserad sammanslagning"
 
@@ -7943,6 +7965,12 @@ msgstr "för konflikter, använd deras version"
 msgid "for conflicts, use a union version"
 msgstr "för konflikter, använd en förenad version"
 
+msgid "<algorithm>"
+msgstr "<algoritm>"
+
+msgid "choose a diff algorithm"
+msgstr "välj en diff-algoritm"
+
 msgid "for conflicts, use this marker size"
 msgstr "för konflikter, använd denna markörstorlek"
 
@@ -7952,13 +7980,20 @@ msgstr "varna inte om konflikter"
 msgid "set labels for file1/orig-file/file2"
 msgstr "sätt etiketter för fil1/origfil/fil2"
 
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "objektet ”%s” finns inte"
+
+msgid "Could not write object file"
+msgstr "Kunde inte skriva objektfilen"
+
 #, c-format
 msgid "unknown option %s"
 msgstr "okänd flagga %s"
 
 #, c-format
 msgid "could not parse object '%s'"
-msgstr "kunde inte tolka objektet \"%s\""
+msgstr "kunde inte tolka objektet ”%s”"
 
 #, c-format
 msgid "cannot handle more than %d base. Ignoring %s."
@@ -7971,7 +8006,7 @@ msgstr "hanterar inte något annat än en sammanslagning av två huvuden."
 
 #, c-format
 msgid "could not resolve ref '%s'"
-msgstr "kunde inte bestämma referensen \"%s\""
+msgstr "kunde inte bestämma referensen ”%s”"
 
 #, c-format
 msgid "Merging %s with %s\n"
@@ -8013,15 +8048,22 @@ msgstr "utför flera sammanslagningar, en per indatarad"
 msgid "specify a merge-base for the merge"
 msgstr "ange en sammanslagningsbas för sammanslagningen"
 
+msgid "option=value"
+msgstr "alternativ=värde"
+
+msgid "option for selected merge strategy"
+msgstr "alternativ för vald sammanslagningsstrategi"
+
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge är inkompatibelt med andra flaggor"
 
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base är inkompatibel med --stdin"
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "okänd strategiflagga: -X%s"
 
 #, c-format
 msgid "malformed input line: '%s'."
-msgstr "felaktig indatarad: \"%s\"."
+msgstr "felaktig indatarad: ”%s”."
 
 #, c-format
 msgid "merging cannot continue; got unclean result of %d"
@@ -8031,15 +8073,15 @@ msgid "git merge [<options>] [<commit>...]"
 msgstr "git merge [<flaggor>] [<incheckning>...]"
 
 msgid "switch `m' requires a value"
-msgstr "flaggan \"m\" behöver ett värde"
+msgstr "flaggan ”m” behöver ett värde"
 
 #, c-format
 msgid "option `%s' requires a value"
-msgstr "flaggan \"%s\" behöver ett värde"
+msgstr "flaggan ”%s” behöver ett värde"
 
 #, c-format
 msgid "Could not find merge strategy '%s'.\n"
-msgstr "Kunde inte hitta sammanslagningsstrategin \"%s\".\n"
+msgstr "Kunde inte hitta sammanslagningsstrategin ”%s”.\n"
 
 #, c-format
 msgid "Available strategies are:"
@@ -8086,12 +8128,6 @@ msgstr "strategi"
 msgid "merge strategy to use"
 msgstr "sammanslagningsstrategi att använda"
 
-msgid "option=value"
-msgstr "alternativ=värde"
-
-msgid "option for selected merge strategy"
-msgstr "alternativ för vald sammanslagningsstrategi"
-
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr "incheckningsmeddelande för (icke snabbspolande) sammanslagning"
 
@@ -8139,7 +8175,7 @@ msgstr "Inget sammanslagningsmeddelande -- uppdaterar inte HEAD\n"
 
 #, c-format
 msgid "'%s' does not point to a commit"
-msgstr "\"%s\" verkar inte peka på en incheckning"
+msgstr "”%s” verkar inte peka på en incheckning"
 
 #, c-format
 msgid "Bad branch.%s.mergeoptions string: %s"
@@ -8151,23 +8187,18 @@ msgstr "Kunde inte skriva indexet."
 msgid "Not handling anything other than two heads merge."
 msgstr "Hanterar inte något annat än en sammanslagning av två huvuden."
 
-#, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "okänd strategiflagga: -X%s"
-
 #, c-format
 msgid "unable to write %s"
 msgstr "kunde inte skriva %s"
 
 #, c-format
 msgid "Could not read from '%s'"
-msgstr "Kunde inte läsa från \"%s\""
+msgstr "Kunde inte läsa från ”%s”"
 
 #, c-format
 msgid "Not committing merge; use 'git commit' to complete the merge.\n"
 msgstr ""
-"Checkar inte in sammanslagningen; använd \"git commit\" för att slutföra "
-"den.\n"
+"Checkar inte in sammanslagningen; använd ”git commit” för att slutföra den.\n"
 
 msgid ""
 "Please enter a commit message to explain why this merge is necessary,\n"
@@ -8187,7 +8218,7 @@ msgid ""
 "Lines starting with '%c' will be ignored, and an empty message aborts\n"
 "the commit.\n"
 msgstr ""
-"Rader som inleds med \"%c\" kommer ignoreras, och ett tomt meddelande\n"
+"Rader som inleds med ”%c” kommer ignoreras, och ett tomt meddelande\n"
 "avbryter incheckningen.\n"
 
 msgid "Empty commit message."
@@ -8217,11 +8248,11 @@ msgstr "Ingen fjärrspårande gren för %s från %s"
 
 #, c-format
 msgid "Bad value '%s' in environment '%s'"
-msgstr "Felaktigt värde \"%s\" i miljövariabeln \"%s\""
+msgstr "Felaktigt värde ”%s” i miljövariabeln ”%s”"
 
 #, c-format
 msgid "could not close '%s'"
-msgstr "kunde inte stänga \"%s\""
+msgstr "kunde inte stänga ”%s”"
 
 #, c-format
 msgid "not something we can merge in %s: %s"
@@ -8253,11 +8284,11 @@ msgid ""
 "You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
 "Please, commit your changes before you merge."
 msgstr ""
-"Du har inte avslutat din \"cherry-pick\" (CHERRY_PICK_HEAD finns).\n"
+"Du har inte avslutat din ”cherry-pick” (CHERRY_PICK_HEAD finns).\n"
 "Checka in dina ändringar innan du slår ihop."
 
 msgid "You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists)."
-msgstr "Du har inte avslutat din \"cherry-pick\" (CHERRY_PICK_HEAD finns)."
+msgstr "Du har inte avslutat din ”cherry-pick” (CHERRY_PICK_HEAD finns)."
 
 msgid "No commit specified and merge.defaultToUpstream not set."
 msgstr "Ingen incheckning angiven och merge.defaultToUpstream är ej satt."
@@ -8323,7 +8354,7 @@ msgstr ""
 
 #, c-format
 msgid "When finished, apply stashed changes with `git stash pop`\n"
-msgstr "När färdig, applicerade sparade ändringar med \"git stash pop\"\n"
+msgstr "När färdig, applicerade sparade ändringar med ”git stash pop”\n"
 
 #, c-format
 msgid "warning: tag input does not pass fsck: %s"
@@ -8339,11 +8370,11 @@ msgstr "%d (FSCK_IGNORE?) skulle aldrig utlösa detta återanrop"
 
 #, c-format
 msgid "could not read tagged object '%s'"
-msgstr "kunde inte läsa det taggade objektet \"%s\""
+msgstr "kunde inte läsa det taggade objektet ”%s”"
 
 #, c-format
 msgid "object '%s' tagged as '%s', but is a '%s' type"
-msgstr "objektet \"%s\" taggat som \"%s\", men är av typen \"%s\""
+msgstr "objektet ”%s” taggat som ”%s”, men är av typen ”%s”"
 
 msgid "could not read from stdin"
 msgstr "kunde inte läsa från standard in"
@@ -8419,7 +8450,7 @@ msgstr "Katalogen %s är i indexet och inte en undermodul?"
 
 msgid "Please stage your changes to .gitmodules or stash them to proceed"
 msgstr ""
-"Köa dina ändringar i .gitmodules eller använd \"stash\" för att fortsätta"
+"Köa dina ändringar i .gitmodules eller använd ”stash” för att fortsätta"
 
 #, c-format
 msgid "%.*s is in index"
@@ -8433,11 +8464,11 @@ msgstr "hoppa över fel vid flytt/namnändring"
 
 #, c-format
 msgid "destination '%s' is not a directory"
-msgstr "destinationen \"%s\" är ingen katalog"
+msgstr "destinationen ”%s” är ingen katalog"
 
 #, c-format
 msgid "Checking rename of '%s' to '%s'\n"
-msgstr "Kontrollerar namnbyte av \"%s\" till \"%s\"\n"
+msgstr "Kontrollerar namnbyte av ”%s” till ”%s”\n"
 
 msgid "bad source"
 msgstr "felaktig källa"
@@ -8448,8 +8479,8 @@ msgstr "destinationen finns"
 msgid "can not move directory into itself"
 msgstr "kan inte flytta katalog till sig själv"
 
-msgid "cannot move directory over file"
-msgstr "kan inte flytta katalog över fil"
+msgid "destination already exists"
+msgstr "destinationen finns redan"
 
 msgid "source directory is empty"
 msgstr "källkatalogen är tom"
@@ -8462,7 +8493,7 @@ msgstr "i konflikt"
 
 #, c-format
 msgid "overwriting '%s'"
-msgstr "skriver över \"%s\""
+msgstr "skriver över ”%s”"
 
 msgid "Cannot overwrite"
 msgstr "Kan inte skriva över"
@@ -8486,7 +8517,7 @@ msgstr "Byter namn på %s till %s\n"
 
 #, c-format
 msgid "renaming '%s' failed"
-msgstr "misslyckades byta namn på \"%s\""
+msgstr "misslyckades byta namn på ”%s”"
 
 msgid "git name-rev [<options>] <commit>..."
 msgstr "git name-rev [<flaggor>] <incheckning>..."
@@ -8519,7 +8550,7 @@ msgid "annotate text from stdin"
 msgstr "annotera text från standard in"
 
 msgid "allow to print `undefined` names (default)"
-msgstr "tillåt att skriva \"odefinierade\" namn (standard)"
+msgstr "tillåt att skriva ”odefinierade” namn (standard)"
 
 msgid "dereference tags in the input (internal use)"
 msgstr "avreferera taggar i indata (används internt)"
@@ -8611,14 +8642,14 @@ msgstr "Skriv/redigera anteckningar för följande objekt:"
 
 #, c-format
 msgid "unable to start 'show' for object '%s'"
-msgstr "kunde inte starta \"show\" för objektet \"%s\""
+msgstr "kunde inte starta ”show” för objektet ”%s”"
 
 msgid "could not read 'show' output"
-msgstr "kunde inte läsa utdata från \"show\""
+msgstr "kunde inte läsa utdata från ”show”"
 
 #, c-format
 msgid "failed to finish 'show' for object '%s'"
-msgstr "kunde inte avsluta \"show\" för objektet \"%s\""
+msgstr "kunde inte avsluta ”show” för objektet ”%s”"
 
 msgid "please supply the note contents using either -m or -F option"
 msgstr "ange innehåll för anteckningen med antingen -m eller -F"
@@ -8632,30 +8663,30 @@ msgstr "anteckningens innehåll har lämnats kvar i %s"
 
 #, c-format
 msgid "could not open or read '%s'"
-msgstr "kunde inte öppna eller läsa \"%s\""
+msgstr "kunde inte öppna eller läsa ”%s”"
 
 #, c-format
 msgid "failed to resolve '%s' as a valid ref."
-msgstr "kunde inte slå upp \"%s\" som en giltig referens."
+msgstr "kunde inte slå upp ”%s” som en giltig referens."
 
 #, c-format
 msgid "failed to read object '%s'."
-msgstr "kunde inte läsa objektet \"%s\"."
+msgstr "kunde inte läsa objektet ”%s”."
 
 #, c-format
 msgid "cannot read note data from non-blob object '%s'."
-msgstr "kan inte läsa anteckningsdata från icke-blob-objektet \"%s\"."
+msgstr "kan inte läsa anteckningsdata från icke-blob-objektet ”%s”."
 
 #, c-format
 msgid "failed to copy notes from '%s' to '%s'"
-msgstr "misslyckades kopiera anteckningar från \"%s\" till \"%s\""
+msgstr "misslyckades kopiera anteckningar från ”%s” till ”%s”"
 
 #. TRANSLATORS: the first %s will be replaced by a git
 #. notes command: 'add', 'merge', 'remove', etc.
 #.
 #, c-format
 msgid "refusing to %s notes in %s (outside of refs/notes/)"
-msgstr "vägrar utföra \"%s\" på anteckningar i %s (utanför refs/notes/)"
+msgstr "vägrar utföra ”%s” på anteckningar i %s (utanför refs/notes/)"
 
 #, c-format
 msgid "no note found for object %s."
@@ -8694,7 +8725,7 @@ msgid ""
 "existing notes"
 msgstr ""
 "Kan inte lägga till anteckningar. Hittade befintliga anteckningar för "
-"objektet %s. Använd \"-f\" för att skriva över befintliga anteckningar"
+"objektet %s. Använd ”-f” för att skriva över befintliga anteckningar"
 
 #, c-format
 msgid "Overwriting existing notes for object %s\n"
@@ -8719,7 +8750,7 @@ msgid ""
 "existing notes"
 msgstr ""
 "Kan inte kopiera anteckningar. Hittade befintliga anteckningar för objektet "
-"%s. Använd \"-f\" för att skriva över befintliga anteckningar"
+"%s. Använd ”-f” för att skriva över befintliga anteckningar"
 
 #, c-format
 msgid "missing notes on source object %s. Cannot copy."
@@ -8730,8 +8761,8 @@ msgid ""
 "The -m/-F/-c/-C options have been deprecated for the 'edit' subcommand.\n"
 "Please use 'git notes add -f -m/-F/-c/-C' instead.\n"
 msgstr ""
-"Flaggorna -m/-F/-c/-C rekommenderas inte för underkommandot \"edit\".\n"
-"Använd \"git notes add -f -m/-F/-c/-C\" istället.\n"
+"Flaggorna -m/-F/-c/-C rekommenderas inte för underkommandot ”edit”.\n"
+"Använd ”git notes add -f -m/-F/-c/-C” istället.\n"
 
 msgid "failed to delete ref NOTES_MERGE_PARTIAL"
 msgstr "misslyckades ta bort referensen NOTES_MERGE_PARTIAL"
@@ -8740,7 +8771,7 @@ msgid "failed to delete ref NOTES_MERGE_REF"
 msgstr "misslyckades ta bort referensen NOTES_MERGE_REF"
 
 msgid "failed to remove 'git notes merge' worktree"
-msgstr "misslyckades ta bort arbetskatalogen för \"git notes merge\""
+msgstr "misslyckades ta bort arbetskatalogen för ”git notes merge”"
 
 msgid "failed to read ref NOTES_MERGE_PARTIAL"
 msgstr "misslyckades läsa references NOTES_MERGE_PARTIAL"
@@ -8813,12 +8844,12 @@ msgid ""
 "abort'.\n"
 msgstr ""
 "Automatisk sammanslagning av anteckningar misslyckades. Rätta konflikter i "
-"%s och checka in resultatet med \"git notes merge --commit\", eller avbryt "
-"sammanslagningen med \"git notes merge --abort\".\n"
+"%s och checka in resultatet med ”git notes merge --commit”, eller avbryt "
+"sammanslagningen med ”git notes merge --abort”.\n"
 
 #, c-format
 msgid "Failed to resolve '%s' as a valid ref."
-msgstr "Kunde inte slå upp \"%s\" som en giltig referens."
+msgstr "Kunde inte slå upp ”%s” som en giltig referens."
 
 #, c-format
 msgid "Object %s has no note\n"
@@ -8844,7 +8875,7 @@ msgstr "använd anteckningar från <anteckningsref>"
 
 #, c-format
 msgid "unknown subcommand: `%s'"
-msgstr "okänt underkommando: \"%s\""
+msgstr "okänt underkommando: ”%s”"
 
 msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
 msgstr "git pack-objects --stdout [<flaggor>] [< <reflista> | < <objektlista>]"
@@ -8895,7 +8926,7 @@ msgstr "misslyckades ta status på %s"
 
 #, c-format
 msgid "failed utime() on %s"
-msgstr "\"utime()\" misslyckades på %s"
+msgstr "”utime()” misslyckades på %s"
 
 msgid "failed to write bitmap index"
 msgstr "misslyckade skriva bitkarteindex"
@@ -8955,6 +8986,10 @@ msgstr "Komprimerar objekt"
 msgid "inconsistency with delta count"
 msgstr "deltaräknaren är inkonsekvent"
 
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "felaktigt värde för pack.allowPackReuse: ”%s”"
+
 #, c-format
 msgid ""
 "value of uploadpack.blobpackfileuri must be of the form '<object-hash> <pack-"
@@ -8975,7 +9010,7 @@ msgstr "kunde inte hämta typ för objektet %s i paketet %s"
 
 #, c-format
 msgid "could not find pack '%s'"
-msgstr "kunde inte hitta paketet \"%s\""
+msgstr "kunde inte hitta paketet ”%s”"
 
 #, c-format
 msgid "packfile %s cannot be accessed"
@@ -9021,11 +9056,11 @@ msgstr "kan inte tvinga lösa objekt"
 
 #, c-format
 msgid "not a rev '%s'"
-msgstr "inte en referens \"%s\""
+msgstr "inte en referens ”%s”"
 
 #, c-format
 msgid "bad revision '%s'"
-msgstr "felaktig revision \"%s\""
+msgstr "felaktig revision ”%s”"
 
 msgid "unable to add recent objects"
 msgstr "kan inte lägga till nya objekt"
@@ -9036,7 +9071,7 @@ msgstr "indexversionen %s stöds ej"
 
 #, c-format
 msgid "bad index version '%s'"
-msgstr "felaktig indexversion \"%s\""
+msgstr "felaktig indexversion ”%s”"
 
 msgid "show progress meter during object writing phase"
 msgstr "visa förloppsindikator under objektskrivningsfasen"
@@ -9141,7 +9176,7 @@ msgid "pack compression level"
 msgstr "komprimeringsgrad för paket"
 
 msgid "do not hide commits by grafts"
-msgstr "göm inte incheckningar med ympningar (\"grafts\")"
+msgstr "göm inte incheckningar med ympningar (”grafts”)"
 
 msgid "use a bitmap index if available to speed up counting objects"
 msgstr "använd bitkartindex om tillgängligt för att räkna objekt snabbare"
@@ -9190,9 +9225,6 @@ msgstr "minsta packstorlek är 1 MiB"
 msgid "--thin cannot be used to build an indexable pack"
 msgstr "--thin kan inte användas för att bygga ett indexerbart paket"
 
-msgid "cannot use --filter without --stdout"
-msgstr "kan inte använda --filter utan --stdout"
-
 msgid "cannot use --filter with --stdin-packs"
 msgstr "kan inte använda --filter med --stdin-packs"
 
@@ -9205,19 +9237,16 @@ msgstr "kan inte använda intern revisionslista med --cruft"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "kan inte använda --stdin-packs med --cruft"
 
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "kan inte använda --max-pack-size med --cruft"
-
 msgid "Enumerating objects"
 msgstr "Räknar upp objekt"
 
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Totalt %<PRIu32> (delta %<PRIu32>), återanvände %<PRIu32> (delta %<PRIu32>), "
-"paket-återanvända %<PRIu32>"
+"paket-återanvända %<PRIu32> (från %<PRIuMAX>)"
 
 msgid ""
 "'git pack-redundant' is nominated for removal.\n"
@@ -9226,9 +9255,9 @@ msgid ""
 "and let us know you still use it by sending an e-mail\n"
 "to <git@vger.kernel.org>.  Thanks.\n"
 msgstr ""
-"\"git pack-redundant\" har nominerats för borttagning.\n"
+"”git pack-redundant” har nominerats för borttagning.\n"
 "Om du fortfarande använder kommandot, lägg till flaggan\n"
-"\"--i-still-use-this\" på kommandoraden och berätta för\n"
+"”--i-still-use-this” på kommandoraden och berätta för\n"
 "oss att du fortfarande använder det på e-post till\n"
 "<git@vger.kernel.org>. Tack.\n"
 
@@ -9279,7 +9308,7 @@ msgid "limit traversal to objects outside promisor packfiles"
 msgstr "begränsa vandring av objekt utanför kontraktspackfiler."
 
 msgid "cannot prune in a precious-objects repo"
-msgstr "kan inte rensa i ett \"precious-objekt\"-arkiv"
+msgstr "kan inte rensa i ett ”precious-objekt”-arkiv"
 
 msgid "git pull [<options>] [<repository> [<refspec>...]]"
 msgstr "git pull [<flaggor>] [<arkiv> [<refspec>...]]"
@@ -9343,7 +9372,7 @@ msgid ""
 "a branch. Because this is not the default configured remote\n"
 "for your current branch, you must specify a branch on the command line."
 msgstr ""
-"Du bad om att hämta från fjärren \"%s\", men angav inte någon\n"
+"Du bad om att hämta från fjärren ”%s”, men angav inte någon\n"
 "gren. Eftersom det inte är den fjärr som är konfigurerad som\n"
 "standard för aktuell gren måste du ange en gren på kommandoraden."
 
@@ -9377,7 +9406,7 @@ msgid ""
 "Your configuration specifies to merge with the ref '%s'\n"
 "from the remote, but no such ref was fetched."
 msgstr ""
-"Dina inställningar anger sammanslagning med referensen \"%s\"\n"
+"Dina inställningar anger sammanslagning med referensen ”%s”\n"
 "från fjärren, men någon sådan referens togs inte emot."
 
 #, c-format
@@ -9404,13 +9433,13 @@ msgid ""
 msgstr ""
 "Du har avvikande grenar och måste ange hur de skall förlikas.\n"
 "Du kan göra detta genom att köra ett av följande kommando innan du\n"
-"gör \"pull\" nästa gång: \n"
+"gör ”pull” nästa gång: \n"
 "\n"
 "  git config pull.rebase false  # sammanslagning\n"
 "  git config pull.rebase true   # ombasering\n"
 "  git config pull.ff only       # endast snabbspolning\n"
 "\n"
-"Du kan ersätta \"git config\" med \"git config --global\" för att välja en\n"
+"Du kan ersätta ”git config” med ”git config --global” för att välja en\n"
 "förvald inställning för alla arkiv. Du kan också ange --rebase, --no-rebase\n"
 "eller --ff-only på kommandoraden för att överstyra det konfigurerade\n"
 "förvalet vid körning.\n"
@@ -9422,7 +9451,7 @@ msgid "pull with rebase"
 msgstr "pull med ombasering"
 
 msgid "Please commit or stash them."
-msgstr "Checka in eller använd \"stash\" på dem."
+msgstr "Checka in eller använd ”stash” på dem."
 
 #, c-format
 msgid ""
@@ -9479,8 +9508,8 @@ msgid ""
 "To choose either option permanently, see push.default in 'git help config'.\n"
 msgstr ""
 "\n"
-"För att välja ett av alternativen permanent, se push.default i \"git help "
-"config\".\n"
+"För att välja ett av alternativen permanent, se push.default i git help "
+"config.\n"
 
 msgid ""
 "\n"
@@ -9490,9 +9519,9 @@ msgid ""
 msgstr ""
 "\n"
 "För att undvika att en uppströmsgren automatiskt konfigureras när dess namn\n"
-"inte motsvarar den lokala grenen, se värdet \"simple\" i branch."
+"inte motsvarar den lokala grenen, se värdet ”simple” i branch."
 "autoSetupMerge\n"
-"i \"git help config\".\n"
+"i ”git help config”.\n"
 
 #, c-format
 msgid ""
@@ -9539,7 +9568,7 @@ msgid ""
 msgstr ""
 "\n"
 "För att detta ska ske automatiskt för grenar som saknar en spårande\n"
-"uppströmsgren, se \"push.autoSetupRemote\" i \"git help config\".\n"
+"uppströmsgren, se ”push.autoSetupRemote” i ”git help config”.\n"
 
 #, c-format
 msgid ""
@@ -9563,7 +9592,7 @@ msgid ""
 "You didn't specify any refspecs to push, and push.default is \"nothing\"."
 msgstr ""
 "Du angav inga referensspecifikationer att sända, och push.default är "
-"\"nothing\"."
+"”nothing”."
 
 #, c-format
 msgid ""
@@ -9571,8 +9600,8 @@ msgid ""
 "your current branch '%s', without telling me what to push\n"
 "to update which remote branch."
 msgstr ""
-"Du sänder till fjärren \"%s\", som inte är uppströms för den\n"
-"aktuella grenen \"%s\", utan att tala om för mig vad som\n"
+"Du sänder till fjärren ”%s”, som inte är uppströms för den\n"
+"aktuella grenen ”%s”, utan att tala om för mig vad som\n"
 "ska sändas för att uppdatera fjärrgrenen."
 
 msgid ""
@@ -9583,8 +9612,8 @@ msgid ""
 msgstr ""
 "Uppdateringar avvisades då änden på din befintliga gren är bakom\n"
 "dess fjärrmotsvarighet. Om du vill integrera fjärrändringarna,\n"
-"använd \"git pull\" innan du sänder igen.\t\n"
-"Se avsnittet \"Note about fast-forward\" i \"git push --help\" för detaljer."
+"använd ”git pull” innan du sänder igen.\t\n"
+"Se avsnittet ”Note about fast-forward” i ”git push --help” för detaljer."
 
 msgid ""
 "Updates were rejected because a pushed branch tip is behind its remote\n"
@@ -9593,10 +9622,9 @@ msgid ""
 "See the 'Note about fast-forwards' in 'git push --help' for details."
 msgstr ""
 "Uppdateringar avvisades då änden på en gren som sänds in är bakom dess\n"
-"fjärrmotsvarighet. Om du vill integrera fjärrändringarna, använd \"git pull"
-"\"\n"
+"fjärrmotsvarighet. Om du vill integrera fjärrändringarna, använd ”git pull”\n"
 "innan du sänder igen.\n"
-"Se avsnittet \"Note about fast-forward\" i \"git push --help\" för detaljer."
+"Se avsnittet ”Note about fast-forward” i ”git push --help” för detaljer."
 
 msgid ""
 "Updates were rejected because the remote contains work that you do not\n"
@@ -9607,9 +9635,9 @@ msgid ""
 msgstr ""
 "Uppdateringar avvisades då fjärren innehåller ändringar som du inte\n"
 "har lokalt. Det beror oftast på att ett annat arkiv har sänt in samma\n"
-"referenser. Om du vill integrera fjärrändringarna, använd \"git pull\"\n"
+"referenser. Om du vill integrera fjärrändringarna, använd ”git pull”\n"
 "innan du sänder igen.\n"
-"Se avsnittet \"Note about fast-forwards\" i \"git push --help\" för detaljer."
+"Se avsnittet ”Note about fast-forwards” i ”git push --help” för detaljer."
 
 msgid "Updates were rejected because the tag already exists in the remote."
 msgstr "Uppdateringarna avvisades eftersom taggen redan finns på fjärren."
@@ -9622,7 +9650,7 @@ msgstr ""
 "Du kan inte uppdatera en fjärr-referens som pekar på ett objekt som\n"
 "inte är en incheckning, eller uppdatera en fjärr-referens så att den\n"
 "pekar på något som inte är en incheckning, utan att använda flaggan\n"
-"\"--force\".\n"
+"”--force”.\n"
 
 msgid ""
 "Updates were rejected because the tip of the remote-tracking branch has\n"
@@ -9632,8 +9660,8 @@ msgid ""
 msgstr ""
 "Uppdateringar avvisades då änden på din befintliga gren är bakom\n"
 "dess fjärrmotsvarighet. Om du vill integrera fjärrändringarna,\n"
-"använd \"git pull\" innan du sänder igen.\n"
-"Se avsnittet \"Note about fast-forward\" i \"git push --help\" för detaljer."
+"använd ”git pull” innan du sänder igen.\n"
+"Se avsnittet ”Note about fast-forward” i ”git push --help” för detaljer."
 
 #, c-format
 msgid "Pushing to %s\n"
@@ -9641,7 +9669,7 @@ msgstr "Sänder till %s\n"
 
 #, c-format
 msgid "failed to push some refs to '%s'"
-msgstr "misslyckades sända vissa referenser till \"%s\""
+msgstr "misslyckades sända vissa referenser till ”%s”"
 
 msgid ""
 "recursing into submodule with push.recurseSubmodules=only; using on-demand "
@@ -9652,7 +9680,7 @@ msgstr ""
 
 #, c-format
 msgid "invalid value for '%s'"
-msgstr "ogiltigt värde för \"%s\""
+msgstr "ogiltigt värde för ”%s”"
 
 msgid "repository"
 msgstr "arkiv"
@@ -9714,7 +9742,7 @@ msgstr "--delete kan inte användas utan referenser"
 
 #, c-format
 msgid "bad repository '%s'"
-msgstr "felaktigt arkiv \"%s\""
+msgstr "felaktigt arkiv ”%s”"
 
 msgid ""
 "No configured push destination.\n"
@@ -9762,7 +9790,7 @@ msgid "notes"
 msgstr "anteckningar"
 
 msgid "passed to 'git log'"
-msgstr "sänds till \"git log\""
+msgstr "sänds till ”git log”"
 
 msgid "only emit output related to the first range"
 msgstr "visa endast utdata för det första intervallet"
@@ -9772,15 +9800,15 @@ msgstr "visa endast utdata för det andra intervallet"
 
 #, c-format
 msgid "not a revision: '%s'"
-msgstr "inte en revision: \"%s\""
+msgstr "inte en revision: ”%s”"
 
 #, c-format
 msgid "not a commit range: '%s'"
-msgstr "inte ett incheckningsintervall: \"%s\""
+msgstr "inte ett incheckningsintervall: ”%s”"
 
 #, c-format
 msgid "not a symmetric range: '%s'"
-msgstr "inte ett symmetriskt intervall: \"%s\""
+msgstr "inte ett symmetriskt intervall: ”%s”"
 
 msgid "need two commit ranges"
 msgstr "behöver två incheckningsintervall"
@@ -9864,7 +9892,7 @@ msgstr ""
 
 #, c-format
 msgid "could not read '%s'."
-msgstr "kunde inte läsa \"%s\"."
+msgstr "kunde inte läsa ”%s”."
 
 #, c-format
 msgid "could not create temporary %s"
@@ -9881,23 +9909,23 @@ msgstr "en basincheckning måste anges med --upstream eller --onto"
 
 #, c-format
 msgid "%s requires the merge backend"
-msgstr "%s kräver \"merge\"-bakändan"
+msgstr "%s kräver ”merge”-bakändan"
 
 #, c-format
 msgid "invalid onto: '%s'"
-msgstr "ogiltig \"onto\": \"%s\""
+msgstr "ogiltig ”onto”: ”%s”"
 
 #, c-format
 msgid "invalid orig-head: '%s'"
-msgstr "ogiltig \"orig-head\": \"%s\""
+msgstr "ogiltig ”orig-head”: ”%s”"
 
 #, c-format
 msgid "ignoring invalid allow_rerere_autoupdate: '%s'"
-msgstr "ignorera ogiltigt allow_rerere_autoupdate: \"%s\""
+msgstr "ignorera ogiltigt allow_rerere_autoupdate: ”%s”"
 
 #, c-format
 msgid "could not remove '%s'"
-msgstr "kunde inte ta bort \"%s\""
+msgstr "kunde inte ta bort ”%s”"
 
 msgid ""
 "Resolve all conflicts manually, mark them as resolved with\n"
@@ -9907,10 +9935,10 @@ msgid ""
 "abort\"."
 msgstr ""
 "Lös alla konflikter manuellt, märk dem som lösta med\n"
-"\"git add/rm <filer_i_konflikt>\", kör sedan \"git rebase --continue\".\n"
-"Du kan hoppa över incheckningen istället: kör \"git rebase --skip\".\n"
-"För att avbryta och återgå till där du var före ombaseringen, kör \"git "
-"rebase --abort\"."
+"”git add/rm <filer_i_konflikt>”, kör sedan ”git rebase --continue”.\n"
+"Du kan hoppa över incheckningen istället: kör ”git rebase --skip”.\n"
+"För att avbryta och återgå till där du var före ombaseringen, kör git "
+"rebase --abort."
 
 #, c-format
 msgid ""
@@ -9944,10 +9972,9 @@ msgstr ""
 
 #, c-format
 msgid ""
-"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask"
-"\"."
-msgstr ""
-"okänd tom-typ \"%s\"; giltiga värden är \"drop\", \"keep\" och \"ask\"."
+"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
+"\"ask\"."
+msgstr "okänd tom-typ ”%s”; giltiga värden är ”drop”, ”keep” och ”ask”."
 
 msgid ""
 "--rebase-merges with an empty string argument is deprecated and will stop "
@@ -10011,7 +10038,7 @@ msgid "do not show diffstat of what changed upstream"
 msgstr "visa inte en diffstat för vad som ändrats uppströms"
 
 msgid "add a Signed-off-by trailer to each commit"
-msgstr "lägg \"Signed-off-by:\"-släprad till varje incheckning"
+msgstr "lägg ”Signed-off-by:”-släprad till varje incheckning"
 
 msgid "make committer date match author date"
 msgstr "sätt incheckningsdatum till författardatum"
@@ -10023,7 +10050,7 @@ msgid "synonym of --reset-author-date"
 msgstr "synonym för --reset-author-date"
 
 msgid "passed to 'git apply'"
-msgstr "sänds till \"git apply\""
+msgstr "sänds till ”git apply”"
 
 msgid "ignore changes in whitespace"
 msgstr "ignorera ändringar i blanksteg"
@@ -10085,7 +10112,7 @@ msgid "try to rebase merges instead of skipping them"
 msgstr "försök ombasera sammanslagningar istället för att ignorera dem"
 
 msgid "use 'merge-base --fork-point' to refine upstream"
-msgstr "använd \"merge-base --fork-point\" för att förfina uppström"
+msgstr "använd ”merge-base --fork-point” för att förfina uppström"
 
 msgid "use the given merge strategy"
 msgstr "använd angiven sammanslagningsstrategi"
@@ -10100,21 +10127,21 @@ msgid "rebase all reachable commits up to the root(s)"
 msgstr "ombasera alla nåbara incheckningar upp till roten/rötterna"
 
 msgid "automatically re-schedule any `exec` that fails"
-msgstr "kör automatiskt alla \"exec\" som misslyckas på nytt"
+msgstr "kör automatiskt alla ”exec” som misslyckas på nytt"
 
 msgid "apply all changes, even those already present upstream"
 msgstr "applicera alla ändringar, även de som redan finns uppströms"
 
 msgid "It looks like 'git am' is in progress. Cannot rebase."
-msgstr "Det verkar som en \"git am\" körs. Kan inte ombasera."
+msgstr "Det verkar som en ”git am” körs. Kan inte ombasera."
 
 msgid ""
 "`rebase --preserve-merges` (-p) is no longer supported.\n"
 "Use `git rebase --abort` to terminate current rebase.\n"
 "Or downgrade to v2.33, or earlier, to complete the rebase."
 msgstr ""
-"\"rebase --preserve-merges\" (-p) stöds ej längre.\n"
-"Använd \"git rebase --abort\" för att avsluta aktuell ombasering.\n"
+"”rebase --preserve-merges” (-p) stöds ej längre.\n"
+"Använd ”git rebase --abort” för att avsluta aktuell ombasering.\n"
 "Eller nedgradera till v2.33 eller tidigare för att slutföra ombaseringen."
 
 msgid ""
@@ -10123,8 +10150,8 @@ msgid ""
 "which is no longer supported; use 'merges' instead"
 msgstr ""
 "--preserve-merges ersattes av --rebase-merges\n"
-"Observera: Din inställning för \"pull.rebase\" kan också vara satt till\n"
-"\"preserve\", som inte längre stöds; använd \"merges\" istället"
+"Observera: Din inställning för ”pull.rebase” kan också vara satt till\n"
+"”preserve”, som inte längre stöds; använd ”merges” istället"
 
 msgid "No rebase in progress?"
 msgstr "Ingen ombasering pågår?"
@@ -10170,30 +10197,20 @@ msgstr ""
 "något av värde där.\n"
 
 msgid "switch `C' expects a numerical value"
-msgstr "flaggan \"C\" förväntar ett numeriskt värde"
-
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy kräver --merge eller --interactive"
-
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"argument för \"apply\" är inkompatibla med rebase.autoSquash. Överväg att "
-"lägga till --no-autosquash"
+msgstr "flaggan ”C” förväntar ett numeriskt värde"
 
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
 "no-rebase-merges"
 msgstr ""
-"argument för \"apply\" är inkompatibla med rebase.rebaseMerges. Överväg att "
+"argument för ”apply” är inkompatibla med rebase.rebaseMerges. Överväg att "
 "lägga till --no-rebase-merges"
 
 msgid ""
 "apply options are incompatible with rebase.updateRefs.  Consider adding --no-"
 "update-refs"
 msgstr ""
-"argument för \"apply\" är inkompatibla med rebase.updateRefs. Överväg att "
+"argument för ”apply” är inkompatibla med rebase.updateRefs. Överväg att "
 "lägga till --no-update-refs"
 
 #, c-format
@@ -10205,14 +10222,14 @@ msgstr "--reschedule-failed-exec kräver --exec eller --interactive"
 
 #, c-format
 msgid "invalid upstream '%s'"
-msgstr "felaktig uppström \"%s\""
+msgstr "felaktig uppström ”%s”"
 
 msgid "Could not create new root commit"
 msgstr "kunde inte skapa ny rotincheckning"
 
 #, c-format
 msgid "no such branch/commit '%s'"
-msgstr "ingen sådan gren/incheckning: \"%s\""
+msgstr "ingen sådan gren/incheckning: ”%s”"
 
 #, c-format
 msgid "No such ref: %s"
@@ -10223,15 +10240,15 @@ msgstr "Kunde inte bestämma en incheckning för HEAD"
 
 #, c-format
 msgid "'%s': need exactly one merge base with branch"
-msgstr "\"%s\": behöver precis en sammanslagningsbas med gren"
+msgstr "”%s”: behöver precis en sammanslagningsbas med gren"
 
 #, c-format
 msgid "'%s': need exactly one merge base"
-msgstr "\"%s\": behöver precis en sammanslagningsbas"
+msgstr "”%s”: behöver precis en sammanslagningsbas"
 
 #, c-format
 msgid "Does not point to a valid commit '%s'"
-msgstr "Pekar inte på en giltig incheckning: \"%s\""
+msgstr "Pekar inte på en giltig incheckning: ”%s”"
 
 msgid "HEAD is up to date."
 msgstr "HEAD är à jour."
@@ -10290,17 +10307,17 @@ msgid ""
 msgstr ""
 "Normalt tillåts inte uppdatering av aktuell gren i ett icke-naket\n"
 "arkiv, då index och arbetskatalog inte kommer stämma med det du\n"
-"sände och \"git reset --hard\" krävs för att få arbetskatalogen och\n"
+"sände och ”git reset --hard” krävs för att få arbetskatalogen och\n"
 "HEAD att stämma överens.\n"
 "\n"
-"Du kan ställa in variabeln \"receive.denyCurrentBranch\" till\n"
-"\"ignore\" eller \"warn\" i fjärrarkivet för att tillåta sändning till\n"
+"Du kan ställa in variabeln ”receive.denyCurrentBranch” till\n"
+"”ignore” eller ”warn” i fjärrarkivet för att tillåta sändning till\n"
 "dess aktuella gren; detta rekommenderas dock inte såvida du inte\n"
 "sett till att dess arbetskatalog uppdateras till det tu sände in\n"
 "på annat sätt.\n"
 "\n"
 "För att undvika detta meddelande och fortfarande behålla det\n"
-"normala beteendet, sätt \"receive.denyCurrentBranch\" till \"refuse\"."
+"normala beteendet, sätt ”receive.denyCurrentBranch” till ”refuse”."
 
 msgid ""
 "By default, deleting the current branch is denied, because the next\n"
@@ -10313,14 +10330,14 @@ msgid ""
 "To squelch this message, you can set it to 'refuse'."
 msgstr ""
 "Normalt tillåts inte radering av aktuell gren, eftersom nästa\n"
-"\"git clone\" inte kommer innebära att några filer checkas ut,\n"
+"”git clone” inte kommer innebära att några filer checkas ut,\n"
 "vilket är förvirrande.\n"
 "\n"
-"Du kan ställa in variabeln \"receive.denyDeleteCurrent\" till\n"
-"\"warn\" eller \"ignore\" i fjärrarkivet för att tillåta borttagning\n"
+"Du kan ställa in variabeln ”receive.denyDeleteCurrent” till\n"
+"”warn” eller ”ignore” i fjärrarkivet för att tillåta borttagning\n"
 "av aktuell gren, med eller utan varningsmeddelande.\n"
 "\n"
-"För att undvika detta meddelande kan du sätta det till \"refuse\"."
+"För att undvika detta meddelande kan du sätta det till ”refuse”."
 
 msgid "quiet"
 msgstr "tyst"
@@ -10354,7 +10371,7 @@ msgstr "git reflog exists <referens>"
 
 #, c-format
 msgid "invalid timestamp '%s' given to '--%s'"
-msgstr "ogiltig tidsstämpel \"%s\" given i \"--%s\""
+msgstr "ogiltig tidsstämpel ”%s” given i ”--%s”"
 
 msgid "do not actually prune any entries"
 msgstr "rensa faktiskt inte några poster"
@@ -10515,7 +10532,7 @@ msgstr "fjärrarkivet %s finns redan."
 
 #, c-format
 msgid "Could not setup master '%s'"
-msgstr "Kunde inte skapa master \"%s\""
+msgstr "Kunde inte skapa master ”%s”"
 
 #, c-format
 msgid "more than one %s"
@@ -10523,7 +10540,7 @@ msgstr "mer än en %s"
 
 #, c-format
 msgid "unhandled branch.%s.rebase=%s; assuming 'true'"
-msgstr "ohanterad branch.%s.rebase=%s; antar \"true\""
+msgstr "ohanterad branch.%s.rebase=%s; antar ”true”"
 
 #, c-format
 msgid "Could not get fetch map for refspec %s"
@@ -10537,11 +10554,11 @@ msgstr "(ta bort)"
 
 #, c-format
 msgid "could not set '%s'"
-msgstr "kunde inte ställa in \"%s\""
+msgstr "kunde inte ställa in ”%s”"
 
 #, c-format
 msgid "could not unset '%s'"
-msgstr "kunde inte ta bort inställning för \"%s\""
+msgstr "kunde inte ta bort inställning för ”%s”"
 
 #, c-format
 msgid ""
@@ -10551,15 +10568,15 @@ msgid ""
 msgstr ""
 "Konfigurationen för %s för remote.pushDefault i:\n"
 "\t%s:%d\n"
-"anger nu den icke-existerande fjärren \"%s\""
+"anger nu den icke-existerande fjärren ”%s”"
 
 #, c-format
 msgid "No such remote: '%s'"
-msgstr "Ingen sådan fjärr: \"%s\""
+msgstr "Ingen sådan fjärr: ”%s”"
 
 #, c-format
 msgid "Could not rename config section '%s' to '%s'"
-msgstr "Kunde inte byta namn på konfigurationssektionen \"%s\" till \"%s\""
+msgstr "Kunde inte byta namn på konfigurationssektionen ”%s” till ”%s”"
 
 #, c-format
 msgid ""
@@ -10576,11 +10593,11 @@ msgstr "Byter namn på fjärreferenser"
 
 #, c-format
 msgid "deleting '%s' failed"
-msgstr "misslyckades ta bort \"%s\""
+msgstr "misslyckades ta bort ”%s”"
 
 #, c-format
 msgid "creating '%s' failed"
-msgstr "misslyckades skapa \"%s\""
+msgstr "misslyckades skapa ”%s”"
 
 msgid ""
 "Note: A branch outside the refs/remotes/ hierarchy was not removed;\n"
@@ -10597,7 +10614,7 @@ msgstr[1] ""
 
 #, c-format
 msgid "Could not remove config section '%s'"
-msgstr "Kunde inte ta bort konfigurationssektionen \"%s\""
+msgstr "Kunde inte ta bort konfigurationssektionen ”%s”"
 
 #, c-format
 msgid " new (next fetch will store in remotes/%s)"
@@ -10610,7 +10627,7 @@ msgid " skipped"
 msgstr " överhoppad"
 
 msgid " stale (use 'git remote prune' to remove)"
-msgstr " förlegad (använd \"git remote prune\" för att ta bort)"
+msgstr " förlegad (använd ”git remote prune” för att ta bort)"
 
 msgid " ???"
 msgstr " ???"
@@ -10722,17 +10739,17 @@ msgstr " (status inte förfrågad)"
 
 msgid "  Local branch configured for 'git pull':"
 msgid_plural "  Local branches configured for 'git pull':"
-msgstr[0] "  Lokal gren konfigurerad för \"git pull\":"
-msgstr[1] "  Lokala grenar konfigurerade för \"git pull\":"
+msgstr[0] "  Lokal gren konfigurerad för ”git pull”:"
+msgstr[1] "  Lokala grenar konfigurerade för ”git pull”:"
 
 msgid "  Local refs will be mirrored by 'git push'"
-msgstr "  Lokala referenser speglas av \"git push\""
+msgstr "  Lokala referenser speglas av ”git push”"
 
 #, c-format
 msgid "  Local ref configured for 'git push'%s:"
 msgid_plural "  Local refs configured for 'git push'%s:"
-msgstr[0] "  Lokal referens konfigurerad för \"git push\"%s:"
-msgstr[1] "  Lokala referenser konfigurerade för \"git push\"%s:"
+msgstr[0] "  Lokal referens konfigurerad för ”git push”%s:"
+msgstr[1] "  Lokala referenser konfigurerade för ”git push”%s:"
 
 msgid "set refs/remotes/<name>/HEAD according to remote"
 msgstr "sätt refs/remotes/<namn>/HEAD enligt fjärren"
@@ -10787,7 +10804,7 @@ msgstr "rensa fjärrar efter hämtning"
 
 #, c-format
 msgid "No such remote '%s'"
-msgstr "Ingen sådan fjärr \"%s\""
+msgstr "Ingen sådan fjärr ”%s”"
 
 msgid "add branch"
 msgstr "lägg till gren"
@@ -10803,7 +10820,7 @@ msgstr "returnera alla URL:er"
 
 #, c-format
 msgid "no URLs configured for remote '%s'"
-msgstr "ingen URL:er angivna för fjärren \"%s\""
+msgstr "ingen URL:er angivna för fjärren ”%s”"
 
 msgid "manipulate push URLs"
 msgstr "manipulera URL:ar för sändning"
@@ -10875,6 +10892,10 @@ msgstr "kunde inte stänga temporär fil för refs-ögonblicksbild"
 msgid "could not remove stale bitmap: %s"
 msgstr "kunde inte ta bort gammal bitkarta: %s"
 
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "paketprefixet %s börjar inte med objkat %s"
+
 msgid "pack everything in a single pack"
 msgstr "packa allt i ett enda paket"
 
@@ -10950,27 +10971,30 @@ msgstr "skriv ett flerpaketsindex för de skapade paketen"
 msgid "pack prefix to store a pack containing pruned objects"
 msgstr "paketprefix att lagra ett paket som innehåller bortrensade objekt"
 
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "paketprefix att lagra ett paket som innehåller utfiltrerade objekt"
+
 msgid "cannot delete packs in a precious-objects repo"
-msgstr "kan inte ta bort paket i ett \"precious-objects\"-arkiv"
+msgstr "kan inte ta bort paket i ett ”precious-objects”-arkiv"
+
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "flaggan ”%s” kan inte användas med ”%s”"
 
 msgid "Nothing new to pack."
 msgstr "Inget nytt att packa."
 
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "paketprefixet %s börjar inte med objkat %s"
-
 #, c-format
 msgid "renaming pack to '%s' failed"
-msgstr "misslyckades byta namn på paket till \"%s\""
+msgstr "misslyckades byta namn på paket till ”%s”"
 
 #, c-format
 msgid "pack-objects did not write a '%s' file for pack %s-%s"
-msgstr "pack-objects skrev inte en \"%s\"-fil för paketet %s-%s"
+msgstr "pack-objects skrev inte en ”%s”-fil för paketet %s-%s"
 
 #, c-format
 msgid "could not unlink: %s"
-msgstr "kunde inte ta bort: \"%s\""
+msgstr "kunde inte ta bort: ”%s”"
 
 msgid "git replace [-f] <object> <replacement>"
 msgstr "git replace [-f] <objekt> <ersättning>"
@@ -10992,24 +11016,24 @@ msgid ""
 "invalid replace format '%s'\n"
 "valid formats are 'short', 'medium' and 'long'"
 msgstr ""
-"ogiltigt ersättningsformat \"%s\"\n"
-"giltiga format är \"short\", \"medium\" och \"long\""
+"ogiltigt ersättningsformat ”%s”\n"
+"giltiga format är ”short”, ”medium” och ”long”"
 
 #, c-format
 msgid "replace ref '%s' not found"
-msgstr "ersättningsreferensen \"%s\" hittades inte"
+msgstr "ersättningsreferensen ”%s” hittades inte"
 
 #, c-format
 msgid "Deleted replace ref '%s'"
-msgstr "Tog bort ersättningsreferensen \"%s\""
+msgstr "Tog bort ersättningsreferensen ”%s”"
 
 #, c-format
 msgid "'%s' is not a valid ref name"
-msgstr "\"%s\" är inte ett giltigt referensnamn"
+msgstr "”%s” är inte ett giltigt referensnamn"
 
 #, c-format
 msgid "replace ref '%s' already exists"
-msgstr "ersättningsreferensen \"%s\" finns redan"
+msgstr "ersättningsreferensen ”%s” finns redan"
 
 #, c-format
 msgid ""
@@ -11018,8 +11042,8 @@ msgid ""
 "while '%s' points to a replacement object of type '%s'."
 msgstr ""
 "Objekt måste vara av samma typ.\n"
-"\"%s\" pekar på ett ersatt objekt med typen \"%s\"\n"
-"medan \"%s\" pekar på ett ersättningsobjekt av typen \"%s\"."
+"”%s” pekar på ett ersatt objekt med typen ”%s”\n"
+"medan ”%s” pekar på ett ersättningsobjekt av typen ”%s”."
 
 #, c-format
 msgid "unable to open %s for writing"
@@ -11046,7 +11070,7 @@ msgstr "mktree returnerade inte ett objektnamn"
 
 #, c-format
 msgid "unable to fstat %s"
-msgstr "kan inte utföra \"fstat\" på %s"
+msgstr "kan inte utföra ”fstat” på %s"
 
 msgid "unable to write object to database"
 msgstr "kan inte skriva objektet till databasen"
@@ -11060,7 +11084,7 @@ msgstr "misslyckades redigera objektfilen"
 
 #, c-format
 msgid "new object is the same as the old one: '%s'"
-msgstr "nytt objekt är samma som det gamla: \"%s\""
+msgstr "nytt objekt är samma som det gamla: ”%s”"
 
 #, c-format
 msgid "could not parse %s as a commit"
@@ -11068,38 +11092,38 @@ msgstr "kunde inte tolka %s som incheckning"
 
 #, c-format
 msgid "bad mergetag in commit '%s'"
-msgstr "felaktig sammanslagningstagg i incheckningen \"%s\""
+msgstr "felaktig sammanslagningstagg i incheckningen ”%s”"
 
 #, c-format
 msgid "malformed mergetag in commit '%s'"
-msgstr "felformad sammanslagningstagg i incheckningen \"%s\""
+msgstr "felformad sammanslagningstagg i incheckningen ”%s”"
 
 #, c-format
 msgid ""
 "original commit '%s' contains mergetag '%s' that is discarded; use --edit "
 "instead of --graft"
 msgstr ""
-"den ursprungliga incheckningen \"%s\" innehåller sammanslagningstaggen \"%s"
-"\" som har förkastats; använd --edit istället för --graft"
+"den ursprungliga incheckningen ”%s” innehåller sammanslagningstaggen ”%s” "
+"som har förkastats; använd --edit istället för --graft"
 
 #, c-format
 msgid "the original commit '%s' has a gpg signature"
-msgstr "den ursprungliga incheckningen \"%s\" har en gpg-signatur"
+msgstr "den ursprungliga incheckningen ”%s” har en gpg-signatur"
 
 msgid "the signature will be removed in the replacement commit!"
 msgstr "signaturen kommer att tas bort i ersättningsincheckningen!"
 
 #, c-format
 msgid "could not write replacement commit for: '%s'"
-msgstr "kunde inte skriva ersättningsincheckning för: \"%s\""
+msgstr "kunde inte skriva ersättningsincheckning för: ”%s”"
 
 #, c-format
 msgid "graft for '%s' unnecessary"
-msgstr "ympning för \"%s\" behövs inte"
+msgstr "ympning för ”%s” behövs inte"
 
 #, c-format
 msgid "new commit is the same as the old one: '%s'"
-msgstr "ny incheckning är samma som den gamla: \"%s\""
+msgstr "ny incheckning är samma som den gamla: ”%s”"
 
 #, c-format
 msgid ""
@@ -11160,6 +11184,76 @@ msgstr "--convert-graft-file tar inga argument"
 msgid "only one pattern can be given with -l"
 msgstr "endast ett mönster kan anges med -l"
 
+msgid "need some commits to replay"
+msgstr "behöver några incheckningar för omspelning"
+
+msgid "--onto and --advance are incompatible"
+msgstr "--onto och --advance kan inte kombineras"
+
+msgid "all positive revisions given must be references"
+msgstr "alla positiva revisioner som anges måste vara referenser"
+
+msgid "argument to --advance must be a reference"
+msgstr "argumentet till --advance måste vara en referens"
+
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"kan inte flytta målet framåt när det finns flera källor eftersom ordningen "
+"inte kan fastställas"
+
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr ""
+"kan inte avgöra om den underförstådda processen är --advance eller --onto"
+
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"kan inte flytta målet framåt när det finns flera källgrenar eftersom "
+"ordningen inte kan fastställas"
+
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "kan inte avgöra den underförstådda basen för --onto"
+
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(EXPERIMENTELLT!) git replay ([--contained] --onto <nybas> | --advance "
+"<gren>) <revisions-intervall>..."
+
+msgid "make replay advance given branch"
+msgstr "låt omspelningen flytta den givna grenen framåt"
+
+msgid "replay onto given commit"
+msgstr "spela om ovanpå en given incheckning"
+
+msgid "advance all branches contained in revision-range"
+msgstr "flytta alla grenar som finns i revisionsintervallet framåt"
+
+msgid "option --onto or --advance is mandatory"
+msgstr "flaggan --onto eller --advance måste anges"
+
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"några flaggor för revisionstraversering kommer överstyras eftersom ”%s”-"
+"biten i ”struct rev_info” kommer att tvingas"
+
+msgid "error preparing revisions"
+msgstr "fel när revisioner skulle förberedas"
+
+msgid "replaying down to root commit is not supported yet!"
+msgstr "kan ännu inte spela om hela vägen ned till rotincheckningen!"
+
+msgid "replaying merge commits is not supported yet!"
+msgstr "kan ännu inte spela om sammanslagningsincheckningar!"
+
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
 msgstr ""
@@ -11169,11 +11263,11 @@ msgid "register clean resolutions in index"
 msgstr "registrera rena lösningar i indexet"
 
 msgid "'git rerere forget' without paths is deprecated"
-msgstr "\"git rerere forget\" utan sökvägar är föråldrat"
+msgstr "”git rerere forget” utan sökvägar är föråldrat"
 
 #, c-format
 msgid "unable to generate diff for '%s'"
-msgstr "misslyckades skapa diff för \"%s\""
+msgstr "misslyckades skapa diff för ”%s”"
 
 msgid ""
 "git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]"
@@ -11247,15 +11341,15 @@ msgstr "registrera endast att borttagna sökvägar kommer läggas till senare"
 
 #, c-format
 msgid "Failed to resolve '%s' as a valid revision."
-msgstr "Kunde inte slå upp \"%s\" som en giltig revision."
+msgstr "Kunde inte slå upp ”%s” som en giltig revision."
 
 #, c-format
 msgid "Failed to resolve '%s' as a valid tree."
-msgstr "Kunde inte slå upp \"%s\" som ett giltigt träd."
+msgstr "Kunde inte slå upp ”%s” som ett giltigt träd."
 
 msgid "--mixed with paths is deprecated; use 'git reset -- <paths>' instead."
 msgstr ""
-"--mixed rekommenderas inte med sökvägar; använd \"git reset -- <sökvägar>\"."
+"--mixed rekommenderas inte med sökvägar; använd ”git reset -- <sökvägar>”."
 
 #, c-format
 msgid "Cannot do %s reset with paths."
@@ -11274,11 +11368,11 @@ msgid ""
 "'--no-refresh' to avoid this."
 msgstr ""
 "Det tog %.2f sekunder att uppdatera indexet efter återställning.\n"
-"Du kan använda \"--no-refresh\" för undvika detta."
+"Du kan använda ”--no-refresh” för undvika detta."
 
 #, c-format
 msgid "Could not reset index file to revision '%s'."
-msgstr "Kunde inte återställa indexfilen till versionen \"%s\"."
+msgstr "Kunde inte återställa indexfilen till versionen ”%s”."
 
 msgid "Could not write new index file."
 msgstr "Kunde inte skriva ny indexfil."
@@ -11289,21 +11383,20 @@ msgstr "kan inte hämta diskanvändning för %s"
 
 #, c-format
 msgid "invalid value for '%s': '%s', the only allowed format is '%s'"
-msgstr ""
-"felaktigt värde för \"%s\": \"%s\", det enda tillåtna formatet är \"%s\""
+msgstr "felaktigt värde för ”%s”: ”%s”, det enda tillåtna formatet är ”%s”"
 
 msgid "rev-list does not support display of notes"
 msgstr "rev-list stöder inte visning av anteckningar"
 
 #, c-format
 msgid "marked counting and '%s' cannot be used together"
-msgstr "markerad räkning och \"%s\" kan inte användas samtidigt."
+msgstr "markerad räkning och ”%s” kan inte användas samtidigt."
 
 msgid "git rev-parse --parseopt [<options>] -- [<args>...]"
 msgstr "git rev-parse --parseopt [<options>] -- [<argument>...]"
 
 msgid "keep the `--` passed as an arg"
-msgstr "behåll \"--\" sänt som argument"
+msgstr "behåll ”--” sänt som argument"
 
 msgid "stop parsing after the first non-option argument"
 msgstr "sluta tolka efter första argument som inte är flagga"
@@ -11315,7 +11408,7 @@ msgid "premature end of input"
 msgstr "för tidigt slut på indata"
 
 msgid "no usage string given before the `--' separator"
-msgstr "ingen användningssträng angavs före \"--\"-avdelaren"
+msgstr "ingen användningssträng angavs före ”--”-avdelaren"
 
 msgid "missing opt-spec before option flags"
 msgstr "saknar flagg-spec före alternativflaggor"
@@ -11334,7 +11427,7 @@ msgstr ""
 "     eller: git rev-parse --sq-quote [<argument>...]\n"
 "     eller: git rev-parse [<flaggor>] [<argument>...]\n"
 "\n"
-"Kör \"git rev-parse --parseopt -h\" för mer information om den första "
+"Kör ”git rev-parse --parseopt -h” för mer information om den första "
 "varianten."
 
 msgid "--resolve-git-dir requires an argument"
@@ -11342,7 +11435,7 @@ msgstr "--resolve-git-dir kräver ett argument"
 
 #, c-format
 msgid "not a gitdir '%s'"
-msgstr "inte en gitkatalog \"%s\""
+msgstr "inte en gitkatalog ”%s”"
 
 msgid "--git-path requires an argument"
 msgstr "--git-path kräver ett argument"
@@ -11367,18 +11460,12 @@ msgstr "--prefix kräver ett argument"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "okänt läge för --abbrev-ref: %s"
 
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden kan endast användas tillsammans med --branches"
-
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden kan  kan inte användas tillsammans med --tags"
-
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden kan  kan inte användas tillsammans med --remotes"
-
 msgid "this operation must be run in a work tree"
 msgstr "funktionen måste köras i en arbetskatalog"
 
+msgid "Could not read the index"
+msgstr "Kunde inte läsa indexet"
+
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
 msgstr "okänt läge för --show-object-format: %s"
@@ -11405,7 +11492,7 @@ msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
 
 #, c-format
 msgid "option `%s' expects a number greater than zero"
-msgstr "flaggan \"%s\" antar ett numeriskt värde större än noll"
+msgstr "flaggan ”%s” antar ett numeriskt värde större än noll"
 
 #, c-format
 msgid "%s: %s cannot be used with %s"
@@ -11454,13 +11541,13 @@ msgid "keep redundant, empty commits"
 msgstr "behåll redundanta, tomma incheckningar"
 
 msgid "use the 'reference' format to refer to commits"
-msgstr "använd \"referens\"-format för att referera till incheckningar"
+msgstr "använd ”referens”-format för att referera till incheckningar"
 
 msgid "revert failed"
-msgstr "\"revert\" misslyckades"
+msgstr "”revert” misslyckades"
 
 msgid "cherry-pick failed"
-msgstr "\"cherry-pick\" misslyckades"
+msgstr "”cherry-pick” misslyckades"
 
 msgid ""
 "git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
@@ -11526,11 +11613,11 @@ msgstr "Ingen sökvägsangivelse gavs. Vilka filer ska jag ta bort?"
 
 msgid "please stage your changes to .gitmodules or stash them to proceed"
 msgstr ""
-"löa dina ändringar i .gitmodules eller använd \"stash\" för att fortsätta"
+"löa dina ändringar i .gitmodules eller använd ”stash” för att fortsätta"
 
 #, c-format
 msgid "not removing '%s' recursively without -r"
-msgstr "tar inte bort \"%s\" rekursivt utan -r"
+msgstr "tar inte bort ”%s” rekursivt utan -r"
 
 #, c-format
 msgid "git rm: unable to remove %s"
@@ -11571,7 +11658,7 @@ msgid "git log --pretty=short | git shortlog [<options>]"
 msgstr "git log --pretty=short | git shortlog [<flaggor>]"
 
 msgid "using multiple --group options with stdin is not supported"
-msgstr "mer än en \"--group\"-flagga stöds inte med standard in"
+msgstr "mer än en ”--group”-flagga stöds inte med standard in"
 
 #, c-format
 msgid "using %s with stdin is not supported"
@@ -11641,7 +11728,7 @@ msgid "show remote-tracking branches"
 msgstr "visa fjärrspårande grenar"
 
 msgid "color '*!+-' corresponding to the branch"
-msgstr "färga \"*!+-\" enligt grenen"
+msgstr "färga ”*!+-” enligt grenen"
 
 msgid "show <n> more commits after the common ancestor"
 msgstr "visa <n> ytterligare incheckningar efter gemensam anfader"
@@ -11706,7 +11793,7 @@ msgstr[1] "kan inte hantera mer än %d revisioner."
 
 #, c-format
 msgid "'%s' is not a valid ref."
-msgstr "\"%s\" är inte en giltig referens."
+msgstr "”%s” är inte en giltig referens."
 
 #, c-format
 msgid "cannot find commit %s (%s)"
@@ -11719,23 +11806,44 @@ msgid "Unknown hash algorithm"
 msgstr "okänd hashningsalgoritm"
 
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<mönster>...]"
 
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<mönster>]"
 
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <ref>"
+
+msgid "reference does not exist"
+msgstr "referensen existerar inte"
+
+msgid "failed to look up reference"
+msgstr "misslyckades slå upp referensen"
+
 msgid "only show tags (can be combined with heads)"
 msgstr "visa endast taggar (kan kombineras med huvuden)"
 
 msgid "only show heads (can be combined with tags)"
 msgstr "visa endast huvuden (kan kombineras med taggar)"
 
+msgid "check for reference existence without resolving"
+msgstr "kontrollerar att referensen existerar utan att slå upp dem"
+
 msgid "stricter reference checking, requires exact ref path"
 msgstr "striktare referenskontroll, kräver exakt referenssökväg"
 
@@ -11773,15 +11881,15 @@ msgid ""
 "directory '%s' contains untracked files, but is not in the sparse-checkout "
 "cone"
 msgstr ""
-"katalogen \"%s\" innehåller ospårade filer, men är inte i området som ages i "
-"\"sparse-checkout\""
+"katalogen ”%s” innehåller ospårade filer, men är inte i området som ages i "
+"”sparse-checkout”"
 
 #, c-format
 msgid "failed to remove directory '%s'"
-msgstr "misslyckades ta bort katalogen \"%s\""
+msgstr "misslyckades ta bort katalogen ”%s”"
 
 msgid "failed to create directory for sparse-checkout file"
-msgstr "misslyckades skapa katalog för \"sparse-checkout\"-filen"
+msgstr "misslyckades skapa katalog för ”sparse-checkout”-filen"
 
 msgid "failed to initialize worktree config"
 msgstr "misslyckades initiera arbetskataloginställning"
@@ -11801,15 +11909,15 @@ msgstr "kunde inte skapa inledande kataloger för %s"
 
 #, c-format
 msgid "failed to open '%s'"
-msgstr "misslyckades öppna \"%s\""
+msgstr "misslyckades öppna ”%s”"
 
 #, c-format
 msgid "could not normalize path %s"
-msgstr "kunde inte normalisera sökvägen \"%s\""
+msgstr "kunde inte normalisera sökvägen ”%s”"
 
 #, c-format
 msgid "unable to unquote C-style string '%s'"
-msgstr "kan inte ta bort citering av C-sträng \"%s\""
+msgstr "kan inte ta bort citering av C-sträng ”%s”"
 
 msgid "unable to load existing sparse-checkout patterns"
 msgstr "kunde inte läsa in existerande mönster för gles utcheckning"
@@ -11827,8 +11935,8 @@ msgid ""
 "specify directories rather than patterns.  If your directory starts with a "
 "'!', pass --skip-checks"
 msgstr ""
-"ange kataloger istället för mönster. Om din katalog börjar med ett \"!\", "
-"sänd med --skip-checks"
+"ange kataloger istället för mönster. Om din katalog börjar med ett ”!”, sänd "
+"med --skip-checks"
 
 msgid ""
 "specify directories rather than patterns.  If your directory really has any "
@@ -11842,7 +11950,7 @@ msgid ""
 "'%s' is not a directory; to treat it as a directory anyway, rerun with --"
 "skip-checks"
 msgstr ""
-"\"%s\" är inte en katalog: för att ändå behandla det som en katalog, kör på "
+"”%s” är inte en katalog: för att ändå behandla det som en katalog, kör på "
 "nytt med --skip-checks"
 
 #, c-format
@@ -11850,7 +11958,7 @@ msgid ""
 "pass a leading slash before paths such as '%s' if you want a single file "
 "(see NON-CONE PROBLEMS in the git-sparse-checkout manual)."
 msgstr ""
-"sänd med ett inledande snedstreck före sökvägar som \"%s\" om du vill ha en "
+"sänd med ett inledande snedstreck före sökvägar som ”%s” om du vill ha en "
 "enstaka file (se NON-CONE PROBLEMS i manualen git-sparse-checkout)."
 
 msgid "git sparse-checkout add [--skip-checks] (--stdin | <patterns>)"
@@ -11899,13 +12007,13 @@ msgid "use patterns in <file> instead of the current ones."
 msgstr "använd mönster i <fil> istället för de nuvarande."
 
 msgid "git stash list [<log-options>]"
-msgstr "git stash list [<\"log\"-flaggor>]"
+msgstr "git stash list [<”log”-flaggor>]"
 
 msgid ""
 "git stash show [-u | --include-untracked | --only-untracked] [<diff-"
 "options>] [<stash>]"
 msgstr ""
-"git stash show [-u | --include-untracked | --only-untracked] [<\"diff\"-"
+"git stash show [-u | --include-untracked | --only-untracked] [<”diff”-"
 "flaggor>] [<stash>]"
 
 msgid "git stash drop [-q | --quiet] [<stash>]"
@@ -11953,21 +12061,21 @@ msgstr "git stash create [<meddelande>]"
 
 #, c-format
 msgid "'%s' is not a stash-like commit"
-msgstr "\"%s\" är inte en \"stash\"-liknande incheckning"
+msgstr "”%s” är inte en ”stash”-liknande incheckning"
 
 #, c-format
 msgid "Too many revisions specified:%s"
 msgstr "För många revisioner angivna:%s"
 
 msgid "No stash entries found."
-msgstr "Inga \"stash\"-poster hittades."
+msgstr "Inga ”stash”-poster hittades."
 
 #, c-format
 msgid "%s is not a valid reference"
 msgstr "%s är inte en giltigt referens"
 
 msgid "git stash clear with arguments is unimplemented"
-msgstr "\"git stash clear\" med argument har inte implementerats"
+msgstr "”git stash clear” med argument har inte implementerats"
 
 #, c-format
 msgid ""
@@ -11976,11 +12084,11 @@ msgid ""
 "         to make room.\n"
 msgstr ""
 "VARNING: En ospårad fil är i vägen för en spårad fil! Byter namn\n"
-"            %s -> %s\n"
+"            %s  %s\n"
 "         för att lämna plats.\n"
 
 msgid "cannot apply a stash in the middle of a merge"
-msgstr "kan inte tillämpa en \"stash\" mitt i en sammanslagning"
+msgstr "kan inte tillämpa en ”stash” mitt i en sammanslagning"
 
 #, c-format
 msgid "could not generate diff %s^!."
@@ -11997,7 +12105,7 @@ msgid "Merging %s with %s"
 msgstr "Slår ihop %s med %s"
 
 msgid "Index was not unstashed."
-msgstr "Indexet har inte tagits upp ur \"stash\":en"
+msgstr "Indexet har inte tagits upp ur ”stash”:en"
 
 msgid "could not restore untracked files from stash"
 msgstr "kunde inte återställa ospårade filer från stash-post"
@@ -12011,11 +12119,11 @@ msgstr "Kastade %s (%s)"
 
 #, c-format
 msgid "%s: Could not drop stash entry"
-msgstr "%s: Kunde inte kasta \"stash\"-post"
+msgstr "%s: Kunde inte kasta ”stash”-post"
 
 #, c-format
 msgid "'%s' is not a stash reference"
-msgstr "\"%s\" är inte en \"stash\"-referens"
+msgstr "”%s” är inte en ”stash”-referens"
 
 msgid "The stash entry is kept in case you need it again."
 msgstr "Stash-posten behålls ifall du behöver den igen."
@@ -12030,20 +12138,20 @@ msgid "failed to unpack trees"
 msgstr "misslyckades packa upp träd"
 
 msgid "include untracked files in the stash"
-msgstr "ta med ospårade filer i \"stash\""
+msgstr "ta med ospårade filer i ”stash”"
 
 msgid "only show untracked files in the stash"
-msgstr "visa bara ospårade filer i \"stash\""
+msgstr "visa bara ospårade filer i ”stash”"
 
 #, c-format
 msgid "Cannot update %s with %s"
 msgstr "Kan inte uppdatera %s med %s"
 
 msgid "stash message"
-msgstr "\"stash\"-meddelande"
+msgstr "”stash”-meddelande"
 
 msgid "\"git stash store\" requires one <commit> argument"
-msgstr "\"git stash store\" kräver ett <incheckning>-argument"
+msgstr "”git stash store” kräver ett <incheckning>-argument"
 
 msgid "No staged changes"
 msgstr "Inga köade ändringar"
@@ -12077,13 +12185,13 @@ msgstr ""
 "Kan inte använda --staged och --include-untracked eller --all samtidigt"
 
 msgid "Did you forget to 'git add'?"
-msgstr "Glömde du använda \"git add\"?"
+msgstr "Glömde du använda ”git add”?"
 
 msgid "No local changes to save"
 msgstr "Inga lokala ändringar att spara"
 
 msgid "Cannot initialize stash"
-msgstr "Kan inte initiera \"stash\""
+msgstr "Kan inte initiera ”stash”"
 
 msgid "Cannot save the current status"
 msgstr "Kan inte spara aktuell status"
@@ -12102,13 +12210,13 @@ msgid "stash staged changes only"
 msgstr "stash:a endast köade ändringar"
 
 msgid "stash in patch mode"
-msgstr "\"stash\" i \"patch\"-läge"
+msgstr "”stash” i ”patch”-läge"
 
 msgid "quiet mode"
 msgstr "tyst läge"
 
 msgid "include untracked files in stash"
-msgstr "ta med ospårade filer i \"stash\""
+msgstr "ta med ospårade filer i ”stash”"
 
 msgid "include ignore files"
 msgstr "ta med ignorerade filer"
@@ -12125,23 +12233,23 @@ msgstr "Förväntade fullt referensnamn, fick %s"
 
 #, c-format
 msgid "could not get a repository handle for submodule '%s'"
-msgstr "kunde inte få tag i arkivhandtag för undermodulen \"%s\""
+msgstr "kunde inte få tag i arkivhandtag för undermodulen ”%s”"
 
 #, c-format
 msgid ""
 "could not look up configuration '%s'. Assuming this repository is its own "
 "authoritative upstream."
 msgstr ""
-"kunde inte slå upp konfigurationen \"%s\". Antar att arkivet är sin eget "
+"kunde inte slå upp konfigurationen ”%s”. Antar att arkivet är sin eget "
 "officiella uppström."
 
 #, c-format
 msgid "No url found for submodule path '%s' in .gitmodules"
-msgstr "Hittade ingen url för undermodulsökvägen \"%s\" i .gitmodules"
+msgstr "Hittade ingen url för undermodulsökvägen ”%s” i .gitmodules"
 
 #, c-format
 msgid "Entering '%s'\n"
-msgstr "Går in i \"%s\"\n"
+msgstr "Går in i ”%s”\n"
 
 #, c-format
 msgid ""
@@ -12172,19 +12280,19 @@ msgstr "git submodule foreach [--quiet] [--recursive] [--] <kommando>"
 
 #, c-format
 msgid "Failed to register url for submodule path '%s'"
-msgstr "Misslyckades registrera url för undermodulsökväg \"%s\""
+msgstr "Misslyckades registrera url för undermodulsökväg ”%s”"
 
 #, c-format
 msgid "Submodule '%s' (%s) registered for path '%s'\n"
-msgstr "Undermodulen \"%s\" (%s) registrerad för sökvägen \"%s\"\n"
+msgstr "Undermodulen ”%s” (%s) registrerad för sökvägen ”%s”\n"
 
 #, c-format
 msgid "warning: command update mode suggested for submodule '%s'\n"
-msgstr "varning: kommandouppdateringsläge föreslogs för undermodulen \"%s\"\n"
+msgstr "varning: kommandouppdateringsläge föreslogs för undermodulen ”%s”\n"
 
 #, c-format
 msgid "Failed to register update mode for submodule path '%s'"
-msgstr "Misslyckades registrera uppdateringsläge för undermodulsökväg \"%s\""
+msgstr "Misslyckades registrera uppdateringsläge för undermodulsökväg ”%s”"
 
 msgid "suppress output for initializing a submodule"
 msgstr "dölj utdata från initiering av undermodul"
@@ -12194,15 +12302,15 @@ msgstr "git submodule init [<flaggor>] [<sökväg>]"
 
 #, c-format
 msgid "no submodule mapping found in .gitmodules for path '%s'"
-msgstr "hittade ingen undermodulmappning i .gitmodules för sökvägen \"%s\""
+msgstr "hittade ingen undermodulmappning i .gitmodules för sökvägen ”%s”"
 
 #, c-format
 msgid "could not resolve HEAD ref inside the submodule '%s'"
-msgstr "kunde inte bestämma HEAD:s incheckning i undermodulen \"%s\""
+msgstr "kunde inte bestämma HEAD:s incheckning i undermodulen ”%s”"
 
 #, c-format
 msgid "failed to recurse into submodule '%s'"
-msgstr "misslyckades rekursera in i undermodulen \"%s\""
+msgstr "misslyckades rekursera in i undermodulen ”%s”"
 
 msgid "suppress submodule status output"
 msgstr "hindra statusutskrift för undermodul"
@@ -12219,11 +12327,11 @@ msgstr "git submodule status [--quitet] [--cached] [--recursive] [<sökväg>...]
 
 #, c-format
 msgid "* %s %s(blob)->%s(submodule)"
-msgstr "* %s %s(blob)->%s(submodule)"
+msgstr "* %s %s(blob)%s(submodule)"
 
 #, c-format
 msgid "* %s %s(submodule)->%s(blob)"
-msgstr "* %s %s(submodule)->%s(blob)"
+msgstr "* %s %s(submodule)%s(blob)"
 
 #, c-format
 msgid "%s"
@@ -12231,7 +12339,7 @@ msgstr "%s"
 
 #, c-format
 msgid "couldn't hash object from '%s'"
-msgstr "kunde inte hasha objekt från \"%s\""
+msgstr "kunde inte hasha objekt från ”%s”"
 
 #, c-format
 msgid "unexpected mode %o\n"
@@ -12245,7 +12353,7 @@ msgstr "jämför incheckningen i indexet med den i undermodulens HEAD"
 
 msgid "skip submodules with 'ignore_config' value set to 'all'"
 msgstr ""
-"hoppa över undermoduler där värdet för \"ignore_config\" är satt till \"all\""
+"hoppa över undermoduler där värdet för ”ignore_config” är satt till ”all”"
 
 msgid "limit the summary size"
 msgstr "begränsa översiktsstorleken"
@@ -12258,15 +12366,15 @@ msgstr "kunde inte hämta en version för HEAD"
 
 #, c-format
 msgid "Synchronizing submodule url for '%s'\n"
-msgstr "Synkroniserar undermodul-url för \"%s\"\n"
+msgstr "Synkroniserar undermodul-url för ”%s”\n"
 
 #, c-format
 msgid "failed to register url for submodule path '%s'"
-msgstr "misslyckades registrera url för undermodulsökväg \"%s\""
+msgstr "misslyckades registrera url för undermodulsökväg ”%s”"
 
 #, c-format
 msgid "failed to update remote for submodule '%s'"
-msgstr "misslyckades uppdatera fjärr för undermodulsökväg \"%s\""
+msgstr "misslyckades uppdatera fjärr för undermodulsökväg ”%s”"
 
 msgid "suppress output of synchronizing submodule url"
 msgstr "dölj utdata från synkronisering av undermodul-url"
@@ -12279,7 +12387,7 @@ msgid ""
 "Submodule work tree '%s' contains a .git directory. This will be replaced "
 "with a .git file by using absorbgitdirs."
 msgstr ""
-"Undermodulsarbetskatalogen \"%s\" innehåller en .git-katalog. Denna kommer "
+"Undermodulsarbetskatalogen ”%s” innehåller en .git-katalog. Denna kommer "
 "ersättas med en .git-fil med absorbgitdirs."
 
 #, c-format
@@ -12287,16 +12395,15 @@ msgid ""
 "Submodule work tree '%s' contains local modifications; use '-f' to discard "
 "them"
 msgstr ""
-"Undermodulens arbetskatalog \"%s\" har lokala ändringar; \"-f\" kastar bort "
-"dem"
+"Undermodulens arbetskatalog ”%s” har lokala ändringar; ”-f” kastar bort dem"
 
 #, c-format
 msgid "Cleared directory '%s'\n"
-msgstr "Rensade katalogen \"%s\"\n"
+msgstr "Rensade katalogen ”%s”\n"
 
 #, c-format
 msgid "Could not remove submodule work tree '%s'\n"
-msgstr "Kunde inte ta bort undermodulens arbetskatalog \"%s\"\n"
+msgstr "Kunde inte ta bort undermodulens arbetskatalog ”%s”\n"
 
 #, c-format
 msgid "could not create empty submodule directory %s"
@@ -12304,7 +12411,7 @@ msgstr "kunde inte skapa tom undermodulskatalog %s"
 
 #, c-format
 msgid "Submodule '%s' (%s) unregistered for path '%s'\n"
-msgstr "Undermodulen \"%s\" (%s) registrerad för sökvägen \"%s\"\n"
+msgstr "Undermodulen ”%s” (%s) registrerad för sökvägen ”%s”\n"
 
 msgid "remove submodule working trees even if they contain local changes"
 msgstr ""
@@ -12319,7 +12426,7 @@ msgstr ""
 "git submodule deinit [--quiet] [-f | --force] [--all | [--] [<sökväg>...]]"
 
 msgid "Use '--all' if you really want to deinitialize all submodules"
-msgstr "Använd \"--all\" om du verkligen vill avinitiera alla undermoduler"
+msgstr "Använd ”--all” om du verkligen vill avinitiera alla undermoduler"
 
 msgid ""
 "An alternate computed from a superproject's alternate is invalid.\n"
@@ -12329,40 +12436,40 @@ msgid ""
 msgstr ""
 "En suppleant beräknad från huvudprojektets suppleant är ogiltig.\n"
 "För att i så fall låta Git klona utan ett suppleant, sätt\n"
-"submodule.alternateErrorStrategy till \"info\" eller, likvärdigt, klona\n"
-"med \"--reference-if-able\" istället för \"--reference\"."
+"submodule.alternateErrorStrategy till ”info” eller, likvärdigt, klona\n"
+"med ”--reference-if-able” istället för ”--reference”."
 
 #, c-format
 msgid "could not get a repository handle for gitdir '%s'"
-msgstr "kunde inte få tag i arkivhandtag för gitkatalogen \"%s\""
+msgstr "kunde inte få tag i arkivhandtag för gitkatalogen ”%s”"
 
 #, c-format
 msgid "submodule '%s' cannot add alternate: %s"
-msgstr "undermodulen \"%s\" kan inte lägga till suppleant: %s"
+msgstr "undermodulen ”%s” kan inte lägga till suppleant: %s"
 
 #, c-format
 msgid "Value '%s' for submodule.alternateErrorStrategy is not recognized"
-msgstr "Värdet \"%s\" i submodule.alternateErrorStrategy förstås inte"
+msgstr "Värdet ”%s” i submodule.alternateErrorStrategy förstås inte"
 
 #, c-format
 msgid "Value '%s' for submodule.alternateLocation is not recognized"
-msgstr "Värdet \"%s\" i submodule.alternateLocation förstås inte"
+msgstr "Värdet ”%s” i submodule.alternateLocation förstås inte"
 
 #, c-format
 msgid "refusing to create/use '%s' in another submodule's git dir"
-msgstr "vägrar skapa/använda \"%s\" i en annan undermoduls gitkatalog"
+msgstr "vägrar skapa/använda ”%s” i en annan undermoduls gitkatalog"
 
 #, c-format
 msgid "clone of '%s' into submodule path '%s' failed"
-msgstr "misslyckades klona \"%s\" till undermodulsökvägen \"%s\""
+msgstr "misslyckades klona ”%s” till undermodulsökvägen ”%s”"
 
 #, c-format
 msgid "directory not empty: '%s'"
-msgstr "katalogen inte tom: \"%s\""
+msgstr "katalogen inte tom: ”%s”"
 
 #, c-format
 msgid "could not get submodule directory for '%s'"
-msgstr "kunde inte få tag i undermodulkatalog för \"%s\""
+msgstr "kunde inte få tag i undermodulkatalog för ”%s”"
 
 msgid "alternative anchor for relative paths"
 msgstr "alternativa ankare för relativa sökvägar"
@@ -12396,15 +12503,14 @@ msgstr ""
 
 #, c-format
 msgid "Invalid update mode '%s' configured for submodule path '%s'"
-msgstr ""
-"Ogiltigt uppdateringsläge \"%s\" konfigurerat för undermodulsökväg \"%s\""
+msgstr "Ogiltigt uppdateringsläge ”%s” konfigurerat för undermodulsökväg ”%s”"
 
 #, c-format
 msgid "Submodule path '%s' not initialized"
-msgstr "Undermodulsökvägen \"%s\" har inte initierats"
+msgstr "Undermodulsökvägen ”%s” har inte initierats"
 
 msgid "Maybe you want to use 'update --init'?"
-msgstr "Kanske menade du att använda \"update --init\"?"
+msgstr "Kanske menade du att använda ”update --init”?"
 
 #, c-format
 msgid "Skipping unmerged submodule %s"
@@ -12412,67 +12518,67 @@ msgstr "Hoppar över ej sammanslagen undermodul %s"
 
 #, c-format
 msgid "Skipping submodule '%s'"
-msgstr "Hoppar över undermodulen \"%s\""
+msgstr "Hoppar över undermodulen ”%s”"
 
 #, c-format
 msgid "cannot clone submodule '%s' without a URL"
-msgstr "kan inte klona undermodulen \"%s\" utan en URL"
+msgstr "kan inte klona undermodulen ”%s” utan en URL"
 
 #, c-format
 msgid "Failed to clone '%s'. Retry scheduled"
-msgstr "Misslyckades klona \"%s\". Nytt försök planlagt"
+msgstr "Misslyckades klona ”%s”. Nytt försök planlagt"
 
 #, c-format
 msgid "Failed to clone '%s' a second time, aborting"
-msgstr "Misslyckades klona \"%s\" för andra gången, avbryter"
+msgstr "Misslyckades klona ”%s” för andra gången, avbryter"
 
 #, c-format
 msgid "Unable to checkout '%s' in submodule path '%s'"
-msgstr "Kan inte checka ut \"%s\" i undermodulsökvägen \"%s\""
+msgstr "Kan inte checka ut ”%s” i undermodulsökvägen ”%s”"
 
 #, c-format
 msgid "Unable to rebase '%s' in submodule path '%s'"
-msgstr "Kan inte ombasera \"%s\" i undermodulsökvägen \"%s\""
+msgstr "Kan inte ombasera ”%s” i undermodulsökvägen ”%s”"
 
 #, c-format
 msgid "Unable to merge '%s' in submodule path '%s'"
-msgstr "Kan inte slå ihop \"%s\" i undermodulsökvägen \"%s\""
+msgstr "Kan inte slå ihop ”%s” i undermodulsökvägen ”%s”"
 
 #, c-format
 msgid "Execution of '%s %s' failed in submodule path '%s'"
-msgstr "Misslyckades köra \"%s %s\" i undermodulsökvägen \"%s\""
+msgstr "Misslyckades köra ”%s %s” i undermodulsökvägen ”%s”"
 
 #, c-format
 msgid "Submodule path '%s': checked out '%s'\n"
-msgstr "Undermodulsökvägen \"%s\": checkade ut \"%s\"\n"
+msgstr "Undermodulsökvägen ”%s”: checkade ut ”%s”\n"
 
 #, c-format
 msgid "Submodule path '%s': rebased into '%s'\n"
-msgstr "Undermodulsökvägen \"%s\": ombaserade in i \"%s\"\n"
+msgstr "Undermodulsökvägen ”%s”: ombaserade in i ”%s”\n"
 
 #, c-format
 msgid "Submodule path '%s': merged in '%s'\n"
-msgstr "Undermodulsökvägen \"%s\": sammanslagen i \"%s\"\n"
+msgstr "Undermodulsökvägen ”%s”: sammanslagen i ”%s”\n"
 
 #, c-format
 msgid "Submodule path '%s': '%s %s'\n"
-msgstr "Undermodulsökvägen \"%s\": \"%s %s\"\n"
+msgstr "Undermodulsökvägen ”%s”: ”%s %s”\n"
 
 #, c-format
 msgid "Unable to fetch in submodule path '%s'; trying to directly fetch %s:"
-msgstr "Kan inte hämta i undermodulsökväg \"%s\"; försökte hämta %s direkt:"
+msgstr "Kan inte hämta i undermodulsökväg ”%s”; försökte hämta %s direkt:"
 
 #, c-format
 msgid ""
 "Fetched in submodule path '%s', but it did not contain %s. Direct fetching "
 "of that commit failed."
 msgstr ""
-"Hämtade i undermodulssökvägen \"%s\", men den innehöll inte %s. Direkt "
+"Hämtade i undermodulssökvägen ”%s”, men den innehöll inte %s. Direkt "
 "hämtning av incheckningen misslyckades."
 
 #, c-format
 msgid "could not initialize submodule at path '%s'"
-msgstr "kunde inte initiera undermodul i sökvägen \"%s\""
+msgstr "kunde inte initiera undermodul i sökvägen ”%s”"
 
 #, c-format
 msgid ""
@@ -12484,19 +12590,19 @@ msgstr ""
 
 #, c-format
 msgid "Unable to find current revision in submodule path '%s'"
-msgstr "Kan inte hitta aktuell revision i undermodulsökvägen \"%s\""
+msgstr "Kan inte hitta aktuell revision i undermodulsökvägen ”%s”"
 
 #, c-format
 msgid "Unable to fetch in submodule path '%s'"
-msgstr "Kan inte hämta i undermodulsökväg \"%s\""
+msgstr "Kan inte hämta i undermodulsökväg ”%s”"
 
 #, c-format
 msgid "Unable to find %s revision in submodule path '%s'"
-msgstr "Kan inte hitta %s revision i undermodulsökvägen \"%s\""
+msgstr "Kan inte hitta %s revision i undermodulsökvägen ”%s”"
 
 #, c-format
 msgid "Failed to recurse into submodule path '%s'"
-msgstr "Misslyckades rekursera in i undermodulsökväg \"%s\""
+msgstr "Misslyckades rekursera in i undermodulsökväg ”%s”"
 
 msgid "force checkout updates"
 msgstr "tvinga utcheckningsuppdateringar"
@@ -12514,13 +12620,13 @@ msgid "don't fetch new objects from the remote site"
 msgstr "hämta inte nya objekt från fjärrplatsen"
 
 msgid "use the 'checkout' update strategy (default)"
-msgstr "använd uppdateringsstrategin \"checkout\" (utcheckning; förval)"
+msgstr "använd uppdateringsstrategin ”checkout” (utcheckning; förval)"
 
 msgid "use the 'merge' update strategy"
-msgstr "använd uppdateringsstrategin \"merge\" (sammanslagning)"
+msgstr "använd uppdateringsstrategin ”merge” (sammanslagning)"
 
 msgid "use the 'rebase' update strategy"
-msgstr "använd uppdateringsstrategin \"rebase\" (ombasering)"
+msgstr "använd uppdateringsstrategin ”rebase” (ombasering)"
 
 msgid "create a shallow clone truncated to the specified number of revisions"
 msgstr "skapa en grund klon trunkerad till angivet antal revisioner"
@@ -12548,6 +12654,9 @@ msgstr ""
 "[no-]recommend-shallow] [--reference <arkiv>] [--recursive] [--[no-]single-"
 "branch] [--] [<sökväg>...]"
 
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "Misslyckades slå upp HEAD som giltig referens."
+
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<flaggor>] [<sökväg>...]"
 
@@ -12590,19 +12699,19 @@ msgstr ""
 
 #, c-format
 msgid "creating branch '%s'"
-msgstr "skapar grenen \"%s\""
+msgstr "skapar grenen ”%s”"
 
 #, c-format
 msgid "Adding existing repo at '%s' to the index\n"
-msgstr "Lägger till befintligt arkiv i \"%s\" i indexet\n"
+msgstr "Lägger till befintligt arkiv i ”%s” i indexet\n"
 
 #, c-format
 msgid "'%s' already exists and is not a valid git repo"
-msgstr "\"%s\" finns redan och är inte ett giltigt git-arkiv"
+msgstr "”%s” finns redan och är inte ett giltigt git-arkiv"
 
 #, c-format
 msgid "A git directory for '%s' is found locally with remote(s):\n"
-msgstr "En git-katalog för \"%s\" hittades lokalt med fjärr(ar):\n"
+msgstr "En git-katalog för ”%s” hittades lokalt med fjärr(ar):\n"
 
 #, c-format
 msgid ""
@@ -12616,41 +12725,41 @@ msgstr ""
 "Om du vill återanvända den lokala git-katalogen istället för att klona på "
 "nytt från\n"
 "  %s\n"
-"kan du använda flaggan \"--force\". Om den lokala git-katalogen inte är "
+"kan du använda flaggan ”--force”. Om den lokala git-katalogen inte är "
 "korrekt\n"
 "arkiv eller om du är osäker på vad det här betyder, välj ett annat namn med\n"
-"flaggan \"--name\"."
+"flaggan ”--name”."
 
 #, c-format
 msgid "Reactivating local git directory for submodule '%s'\n"
-msgstr "Aktiverar lokal git-katalog för undermodulen \"%s\" på nytt.\n"
+msgstr "Aktiverar lokal git-katalog för undermodulen ”%s” på nytt.\n"
 
 #, c-format
 msgid "unable to checkout submodule '%s'"
-msgstr "Kan inte checka ut undermodulen \"%s\""
+msgstr "Kan inte checka ut undermodulen ”%s”"
 
 msgid "please make sure that the .gitmodules file is in the working tree"
 msgstr "se till att .gitmodules finns i arbetskatalogen"
 
 #, c-format
 msgid "Failed to add submodule '%s'"
-msgstr "Misslyckades lägga till undermodulen \"%s\""
+msgstr "Misslyckades lägga till undermodulen ”%s”"
 
 #, c-format
 msgid "Failed to register submodule '%s'"
-msgstr "Misslyckades registrera undermodulen \"%s\""
+msgstr "Misslyckades registrera undermodulen ”%s”"
 
 #, c-format
 msgid "'%s' already exists in the index"
-msgstr "\"%s\" finns redan i indexet"
+msgstr "”%s” finns redan i indexet"
 
 #, c-format
 msgid "'%s' already exists in the index and is not a submodule"
-msgstr "\"%s\" finns redan i indexet och är inte en undermodul"
+msgstr "”%s” finns redan i indexet och är inte en undermodul"
 
 #, c-format
 msgid "'%s' does not have a commit checked out"
-msgstr "\"%s\" har inte någon utcheckad incheckning"
+msgstr "”%s” har inte någon utcheckad incheckning"
 
 msgid "branch of repository to add as submodule"
 msgstr "gren från arkivet att lägga till som undermodul"
@@ -12676,11 +12785,11 @@ msgstr "Relativ sökväg kan endast användas från arbetskatalogens toppnivå"
 
 #, c-format
 msgid "repo URL: '%s' must be absolute or begin with ./|../"
-msgstr "arkiv-URL: \"%s\" måste vara absolut eller börja med ./|../"
+msgstr "arkiv-URL: ”%s” måste vara absolut eller börja med ./|../"
 
 #, c-format
 msgid "'%s' is not a valid submodule name"
-msgstr "\"%s\" är inte ett giltigt namn på undermodul"
+msgstr "”%s” är inte ett giltigt namn på undermodul"
 
 msgid "git submodule--helper <command>"
 msgstr "git submodule--helper <kommando>"
@@ -12740,11 +12849,11 @@ msgstr "git tag -v [--format=<format>] <taggnamn>..."
 
 #, c-format
 msgid "tag '%s' not found."
-msgstr "taggen \"%s\" hittades inte."
+msgstr "taggen ”%s” hittades inte."
 
 #, c-format
 msgid "Deleted tag '%s' (was %s)\n"
-msgstr "Tog bort tagg \"%s\" (var %s)\n"
+msgstr "Tog bort tagg ”%s” (var %s)\n"
 
 #, c-format
 msgid ""
@@ -12756,7 +12865,7 @@ msgstr ""
 "\n"
 "Skriv ett meddelande för taggen:\n"
 "  %s\n"
-"Rader som inleds med \"%c\" ignoreras.\n"
+"Rader som inleds med ”%c” ignoreras.\n"
 
 #, c-format
 msgid ""
@@ -12769,7 +12878,7 @@ msgstr ""
 "\n"
 "Skriv ett meddelande för taggen:\n"
 "  %s\n"
-"Rader som inleds med \"%c\" kommer behållas; du kan själv ta bort dem om\n"
+"Rader som inleds med ”%c” kommer behållas; du kan själv ta bort dem om\n"
 "du vill.\n"
 
 msgid "unable to sign the tag"
@@ -12856,15 +12965,15 @@ msgstr "visa endast taggar för objektet"
 
 #, c-format
 msgid "the '%s' option is only allowed in list mode"
-msgstr "flaggan \"%s\" är endast tillåten i listläge"
+msgstr "flaggan ”%s” är endast tillåten i listläge"
 
 #, c-format
 msgid "'%s' is not a valid tag name."
-msgstr "\"%s\" är inte ett giltigt taggnamn."
+msgstr "”%s” är inte ett giltigt taggnamn."
 
 #, c-format
 msgid "tag '%s' already exists"
-msgstr "taggen \"%s\" finns redan"
+msgstr "taggen ”%s” finns redan"
 
 #, c-format
 msgid "Invalid cleanup mode %s"
@@ -12872,7 +12981,7 @@ msgstr "Felaktigt städningsläge %s"
 
 #, c-format
 msgid "Updated tag '%s' (was %s)\n"
-msgstr "Uppdaterad tagg \"%s\" (var %s)\n"
+msgstr "Uppdaterad tagg ”%s” (var %s)\n"
 
 msgid "pack exceeds maximum allowed size"
 msgstr "paket är större än tillåten maximal storlek"
@@ -12904,7 +13013,7 @@ msgstr "misslyckades ta bort katalogen %s"
 
 #, c-format
 msgid "Testing mtime in '%s' "
-msgstr "Testar mtime i \"%s\" "
+msgstr "Testar mtime i ”%s” "
 
 msgid "directory stat info does not change after adding a new file"
 msgstr "stat-informationen för en katalog ändras inte när nya filer läggs till"
@@ -12964,19 +13073,19 @@ msgid "add the specified entry to the index"
 msgstr "lägg till angiven post i indexet"
 
 msgid "mark files as \"not changing\""
-msgstr "markera filer som \"ändras inte\""
+msgstr "markera filer som ”ändras inte”"
 
 msgid "clear assumed-unchanged bit"
-msgstr "rensa \"assume-unchanged\"-biten"
+msgstr "rensa ”assume-unchanged”-biten"
 
 msgid "mark files as \"index-only\""
-msgstr "markera filer som \"endast index\""
+msgstr "markera filer som ”endast index”"
 
 msgid "clear skip-worktree bit"
-msgstr "töm \"skip-worktree\"-biten"
+msgstr "töm ”skip-worktree”-biten"
 
 msgid "do not touch index-only entries"
-msgstr "rör inte \"endast index\"-poster"
+msgstr "rör inte ”endast index”-poster"
 
 msgid "add to index only; do not add content to object database"
 msgstr "lägg endast till indexet; lägg inte till innehållet i objektdatabasen"
@@ -13011,6 +13120,9 @@ msgstr "(för porslin) glöm sparade olösta konflikter"
 msgid "write index in this format"
 msgstr "skriv index i detta format"
 
+msgid "report on-disk index format version"
+msgstr "rapportera formatversion för indexfilen på disk"
+
 msgid "enable or disable split index"
 msgstr "aktivera eller inaktivera delat index"
 
@@ -13030,10 +13142,18 @@ msgid "enable or disable file system monitor"
 msgstr "aktivera eller inaktivera filsystemsövervakning"
 
 msgid "mark files as fsmonitor valid"
-msgstr "markera filer som \"fsmonitor valid\""
+msgstr "markera filer som ”fsmonitor valid”"
 
 msgid "clear fsmonitor valid bit"
-msgstr "töm \"fsmonitor valid\"-bit"
+msgstr "töm ”fsmonitor valid”-bit"
+
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "index-version: vad %d, sattes till %d"
 
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
@@ -13068,7 +13188,7 @@ msgstr ""
 
 #, c-format
 msgid "Untracked cache enabled for '%s'"
-msgstr "Ospårad cache är aktiverad för \"%s\""
+msgstr "Ospårad cache är aktiverad för ”%s”"
 
 msgid "core.fsmonitor is unset; set it if you really want to enable fsmonitor"
 msgstr "core.fsmonitor inte satt; sätt om du verkligen vill aktivera fsmonitor"
@@ -13182,17 +13302,17 @@ msgid "git worktree unlock <worktree>"
 msgstr "git worktree unlock <arbetskatalog>"
 
 msgid "No possible source branch, inferring '--orphan'"
-msgstr "Ingen möjlig källgren, använder \"--orphan\""
+msgstr "Ingen möjlig källgren, använder ”--orphan”"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
-"Om meningen var att skapa en arbetskatalog från en ny föräldrals\n"
+"Om meningen var att skapa en arbetskatalog från en ny ofödd\n"
 "gren (gren utan incheckningar) för det här arkivet kan du göra\n"
 "det med flaggan --orphan:\n"
 "\n"
@@ -13200,13 +13320,13 @@ msgstr ""
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
-"Om meningen var att skapa en arbetskatalog från en ny föräldrals\n"
+"Om meningen var att skapa en arbetskatalog från en ny ofödd\n"
 "gren (gren utan incheckningar) för det här arkivet kan du göra\n"
 "det med flaggan --orphan:\n"
 "\n"
@@ -13224,63 +13344,65 @@ msgstr "låt tid gå ut för arbetskataloger äldre än <tid>"
 
 #, c-format
 msgid "'%s' already exists"
-msgstr "\"%s\" finns redan"
+msgstr "”%s” finns redan"
 
 #, c-format
 msgid "unusable worktree destination '%s'"
-msgstr "oanvändbar mål för arbetskatalog \"%s\""
+msgstr "oanvändbar mål för arbetskatalog ”%s”"
 
 #, c-format
 msgid ""
 "'%s' is a missing but locked worktree;\n"
 "use '%s -f -f' to override, or 'unlock' and 'prune' or 'remove' to clear"
 msgstr ""
-"\"%s\" är en saknad men låst arbetskatalog;\n"
-"använd \"%s -f -f\" för att överstyra, eller \"unlock\" och \"prune\" eller "
-"\"remove\" för att rensa"
+"”%s” är en saknad men låst arbetskatalog;\n"
+"använd ”%s -f -f” för att överstyra, eller ”unlock” och ”prune” eller "
+"”remove” för att rensa"
 
 #, c-format
 msgid ""
 "'%s' is a missing but already registered worktree;\n"
 "use '%s -f' to override, or 'prune' or 'remove' to clear"
 msgstr ""
-"\"%s\" är en saknad men redan registrerad arbetskatalog;\n"
-"använd \"%s -f\" för att överstyra, eller \"prune\" eller \"remove\" för att "
-"rensa"
+"”%s” är en saknad men redan registrerad arbetskatalog;\n"
+"använd ”%s -f” för att överstyra, eller ”prune” eller ”remove” för att rensa"
 
 #, c-format
 msgid "failed to copy '%s' to '%s'; sparse-checkout may not work correctly"
 msgstr ""
-"misslyckades kopiera \"%s\" till \"%s\"; sparse-checkout kanske inte kommer "
-"att fungera korrekt"
+"misslyckades kopiera ”%s” till ”%s”; sparse-checkout kanske inte kommer att "
+"fungera korrekt"
 
 #, c-format
 msgid "failed to copy worktree config from '%s' to '%s'"
-msgstr ""
-"misslyckades kopiera arbetskatalogkonfiguration från \"%s\" till \"%s\""
+msgstr "misslyckades kopiera arbetskatalogkonfiguration från ”%s” till ”%s”"
 
 #, c-format
 msgid "failed to unset '%s' in '%s'"
-msgstr "misslyckades slå av \"%s\" i \"%s\""
+msgstr "misslyckades slå av ”%s” i ”%s”"
 
 #, c-format
 msgid "could not create directory of '%s'"
-msgstr "kunde inte skapa katalogen \"%s\""
+msgstr "kunde inte skapa katalogen ”%s”"
 
 msgid "initializing"
 msgstr "initierar"
 
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "kunde inte hitta den skapade arbetskatalogen ”%s”"
+
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
-msgstr "Förbereder arbetskatalog (ny gren \"%s\")"
+msgstr "Förbereder arbetskatalog (ny gren ”%s”)"
 
 #, c-format
 msgid "Preparing worktree (resetting branch '%s'; was at %s)"
-msgstr "Förbereder arbetskatalog (återställer gren \"%s\"; var på %s)"
+msgstr "Förbereder arbetskatalog (återställer gren ”%s”; var på %s)"
 
 #, c-format
 msgid "Preparing worktree (checking out '%s')"
-msgstr "Förbereder arbetskatalog (checkar ut \"%s\")"
+msgstr "Förbereder arbetskatalog (checkar ut ”%s”)"
 
 #, c-format
 msgid "unreachable: invalid reference: %s"
@@ -13297,20 +13419,16 @@ msgid ""
 "HEAD contents: '%s'"
 msgstr ""
 "HEAD pekar på en ogiltig (eller övergiven) referens.\n"
-"HEAD-sökväg: \"%s\"\n"
-"HEAD-innehåll: \"%s\""
+"HEAD-sökväg: ”%s”\n"
+"HEAD-innehåll: ”%s”"
 
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
 "Ingen lokal eller fjärr-referens finns trots att åtminstone en fjärr\n"
-"finns, avslutar; använd \"add -f\" för att överstyra eller hämta från en "
-"fjärr först"
-
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "\"%s\" och \"%s\" kan inte användas samtidigt"
+"finns, avslutar; använd ”add -f” för att överstyra eller hämta från en fjärr "
+"först"
 
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr ""
@@ -13322,8 +13440,8 @@ msgstr "skapa en ny gren"
 msgid "create or reset a branch"
 msgstr "skapa eller återställ en gren"
 
-msgid "create unborn/orphaned branch"
-msgstr "skapa en ofödd/övergiven gren"
+msgid "create unborn branch"
+msgstr "skapa en ofödd gren"
 
 msgid "populate the new working tree"
 msgstr "befolka den nya arbetskatalogen"
@@ -13342,14 +13460,11 @@ msgstr "försök träffa namn på ny gren mot en fjärrspårande gren"
 
 #, c-format
 msgid "options '%s', '%s', and '%s' cannot be used together"
-msgstr "flaggorna \"%s\", \"%s\" och \"%s\" kan inte användas samtidigt"
+msgstr "flaggorna ”%s”, ”%s” och ”%s” kan inte användas samtidigt"
 
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "flaggorna \"%s\" och \"%s\" kan inte användas samtidigt"
-
-msgid "<commit-ish>"
-msgstr "<incheckning-igt>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "flaggorna ”%s” och incheckning-igt kan inte användas samtidigt"
 
 msgid "added with --lock"
 msgstr "lagt till med --lock"
@@ -13361,30 +13476,29 @@ msgid "show extended annotations and reasons, if available"
 msgstr "visa utökade annoteringar och grunder, om tillgängliga"
 
 msgid "add 'prunable' annotation to worktrees older than <time>"
-msgstr ""
-"lägg till \"prunable\"-annoteringar till arbetskataloger äldre än <tid>"
+msgstr "lägg till ”prunable”-annoteringar till arbetskataloger äldre än <tid>"
 
 msgid "terminate records with a NUL character"
 msgstr "avsluta poster med NUL-tecken"
 
 #, c-format
 msgid "'%s' is not a working tree"
-msgstr "\"%s\" är inte en arbetskatalog"
+msgstr "”%s” är inte en arbetskatalog"
 
 msgid "The main working tree cannot be locked or unlocked"
 msgstr "Huvudarbetskatalogen kan inte låsas eller låsas upp"
 
 #, c-format
 msgid "'%s' is already locked, reason: %s"
-msgstr "\"%s\" är redan låst, orsak: %s"
+msgstr "”%s” är redan låst, orsak: %s"
 
 #, c-format
 msgid "'%s' is already locked"
-msgstr "\"%s\" är redan låst"
+msgstr "”%s” är redan låst"
 
 #, c-format
 msgid "'%s' is not locked"
-msgstr "\"%s\" är inte låst"
+msgstr "”%s” är inte låst"
 
 msgid "working trees containing submodules cannot be moved or removed"
 msgstr "arbetskataloger med undermoduler kan inte flyttas eller tas bort"
@@ -13394,11 +13508,11 @@ msgstr "tvinga flyttning även om arbetskatalogen är smutsig eller låst"
 
 #, c-format
 msgid "'%s' is a main working tree"
-msgstr "\"%s\" är inte en huvudarbetskatalog"
+msgstr "”%s” är inte en huvudarbetskatalog"
 
 #, c-format
 msgid "could not figure out destination name from '%s'"
-msgstr "kunde inte lista ut målnamn från \"%s\""
+msgstr "kunde inte lista ut målnamn från ”%s”"
 
 #, c-format
 msgid ""
@@ -13406,14 +13520,14 @@ msgid ""
 "use 'move -f -f' to override or unlock first"
 msgstr ""
 "kan inte flytta en låst arbetskatalog, orsak till lås: %s\n"
-"använd \"move -f -f\" för att överstyra, eller lås upp först"
+"använd ”move -f -f” för att överstyra, eller lås upp först"
 
 msgid ""
 "cannot move a locked working tree;\n"
 "use 'move -f -f' to override or unlock first"
 msgstr ""
 "kan inte flytta en låst arbetskatalog;\n"
-"använd \"move -f -f\" för att överstyra, eller lås upp först"
+"använd ”move -f -f” för att överstyra, eller lås upp först"
 
 #, c-format
 msgid "validation failed, cannot move working tree: %s"
@@ -13421,21 +13535,21 @@ msgstr "kontroll misslyckades, kan inte flytta arbetskatalog: %s"
 
 #, c-format
 msgid "failed to move '%s' to '%s'"
-msgstr "misslyckades flytta \"%s\" till \"%s\""
+msgstr "misslyckades flytta ”%s” till ”%s”"
 
 #, c-format
 msgid "failed to run 'git status' on '%s'"
-msgstr "misslyckades köra \"git status\" på \"%s\""
+msgstr "misslyckades köra ”git status” på ”%s”"
 
 #, c-format
 msgid "'%s' contains modified or untracked files, use --force to delete it"
 msgstr ""
-"\"%s\" innehåller ändrade eller ospårade filer, använd --force för att ta "
-"bort det"
+"”%s” innehåller ändrade eller ospårade filer, använd --force för att ta bort "
+"det"
 
 #, c-format
 msgid "failed to run 'git status' on '%s', code %d"
-msgstr "misslyckades köra \"git status\" på \"%s\", kod %d"
+msgstr "misslyckades köra ”git status” på ”%s”, kod %d"
 
 msgid "force removal even if worktree is dirty or locked"
 msgstr "tvinga ta bort även om arbetskatalogen är smutsig eller låst"
@@ -13446,14 +13560,14 @@ msgid ""
 "use 'remove -f -f' to override or unlock first"
 msgstr ""
 "kan inte ta bort en låst arbetskatalog, orsak till låset: %s\n"
-"använd \"remove -f -f\" för att överstyra, eller lås upp först"
+"använd ”remove -f -f” för att överstyra, eller lås upp först"
 
 msgid ""
 "cannot remove a locked working tree;\n"
 "use 'remove -f -f' to override or unlock first"
 msgstr ""
 "kan inte ta bort en låst arbetskatalog;\n"
-"använd \"remove -f -f\" för att överstyra, eller lås upp först"
+"använd ”remove -f -f” för att överstyra, eller lås upp först"
 
 #, c-format
 msgid "validation failed, cannot remove working tree: %s"
@@ -13484,11 +13598,11 @@ msgstr "core.fsyncMethod = batch stöds inte på denna plattform"
 
 #, c-format
 msgid "could not parse bundle list key %s with value '%s'"
-msgstr "kunde inte tolka listnyckeln %s med värdet \"%s\""
+msgstr "kunde inte tolka listnyckeln %s med värdet ”%s”"
 
 #, c-format
 msgid "bundle list at '%s' has no mode"
-msgstr "buntlistan på \"%s\" har inget läge"
+msgstr "buntlistan på ”%s” har inget läge"
 
 msgid "failed to create temporary file"
 msgstr "misslyckades skapa temporär fil"
@@ -13498,14 +13612,14 @@ msgstr "otillräckliga kapabiliteter"
 
 #, c-format
 msgid "file downloaded from '%s' is not a bundle"
-msgstr "filen hämtad från \"%s\" är inte en bunt"
+msgstr "filen hämtad från ”%s” är inte en bunt"
 
 msgid "failed to store maximum creation token"
 msgstr "misslyckades lagra maximal skaparsymbol"
 
 #, c-format
 msgid "unrecognized bundle mode from URI '%s'"
-msgstr "okänt buntlägre från URI:en \"%s\""
+msgstr "okänt buntlägre från URI:en ”%s”"
 
 #, c-format
 msgid "exceeded bundle URI recursion limit (%d)"
@@ -13513,35 +13627,35 @@ msgstr "överskred buntens URI-rekursionsgräns (%d)"
 
 #, c-format
 msgid "failed to download bundle from URI '%s'"
-msgstr "kunde inte hämta bunt från URI:en \"%s\""
+msgstr "kunde inte hämta bunt från URI:en ”%s”"
 
 #, c-format
 msgid "file at URI '%s' is not a bundle or bundle list"
-msgstr "filen på URI:en \"%s\" är inte en bunt eller buntlista"
+msgstr "filen på URI:en ”%s” är inte en bunt eller buntlista"
 
 #, c-format
 msgid "bundle-uri: unexpected argument: '%s'"
-msgstr "bundle-uri: okänt argument: \"%s\""
+msgstr "bundle-uri: okänt argument: ”%s”"
 
 msgid "bundle-uri: expected flush after arguments"
-msgstr "bundle-uri: förväntade \"flush\" efter argument"
+msgstr "bundle-uri: förväntade ”flush” efter argument"
 
 msgid "bundle-uri: got an empty line"
 msgstr "bunt-uri: fick en tom rad"
 
 msgid "bundle-uri: line is not of the form 'key=value'"
-msgstr "bunt-uri: raden är inte på formen \"nyckel=värde\""
+msgstr "bunt-uri: raden är inte på formen ”nyckel=värde”"
 
 msgid "bundle-uri: line has empty key or value"
 msgstr "bunt-uri: raden har tom nyckel eller värde"
 
 #, c-format
 msgid "unrecognized bundle hash algorithm: %s"
-msgstr "okänd hashningsalgoritm för bunt: \"%s\""
+msgstr "okänd hashningsalgoritm för bunt: ”%s”"
 
 #, c-format
 msgid "unknown capability '%s'"
-msgstr "okänd kapabilitet \"%s\""
+msgstr "okänd kapabilitet ”%s”"
 
 #, c-format
 msgid "'%s' does not look like a v2 or v3 bundle file"
@@ -13598,7 +13712,7 @@ msgstr "pack-objects misslyckades"
 
 #, c-format
 msgid "ref '%s' is excluded by the rev-list options"
-msgstr "referensen \"%s\" exkluderas av argumenten till rev-list"
+msgstr "referensen ”%s” exkluderas av argumenten till rev-list"
 
 #, c-format
 msgid "unsupported bundle version %d"
@@ -13613,7 +13727,7 @@ msgstr "Vägrar skapa en tom bunt."
 
 #, c-format
 msgid "cannot create '%s'"
-msgstr "kan inte skapa \"%s\""
+msgstr "kan inte skapa ”%s”"
 
 msgid "index-pack died"
 msgstr "index-pack dog"
@@ -13621,6 +13735,10 @@ msgstr "index-pack dog"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "avslutande stycke-id förekommer tidigare än förväntat"
 
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "stycke-id %<PRIx32> är inte %d-byte-justerad"
+
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
 msgstr "felaktigt stycke-offset %<PRIx64> och %<PRIx64>"
@@ -13673,9 +13791,8 @@ msgstr "Samla information från användaren för att sända en felrapport"
 msgid "Move objects and refs by archive"
 msgstr "Flytta objekt och referenser efter arkiv"
 
-msgid "Provide content or type and size information for repository objects"
-msgstr ""
-"Visa innehåller eller typ- och storleksinformation för objekt i arkivet"
+msgid "Provide contents or details of repository objects"
+msgstr "Visa innehåll eller detaljer för objekt i arkivet"
 
 msgid "Display gitattributes information"
 msgstr "Visa information från gitattributes"
@@ -13960,6 +14077,11 @@ msgstr "Packa opackade objekt i ett arkiv"
 msgid "Create, list, delete refs to replace objects"
 msgstr "Skapa, visa, ta bort referenser för att ersätta objekt"
 
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"EXPERIMENTELLT: Spela om incheckningar ovanpå en ny bas, fungerar även med "
+"nakna arkiv"
+
 msgid "Generates a summary of pending changes"
 msgstr "Skapar en sammanfattning av väntande ändringar"
 
@@ -14000,7 +14122,7 @@ msgid "Restricted login shell for Git-only SSH access"
 msgstr "Begränsat inloggningsskal för SSH-åtkomst till bara Git"
 
 msgid "Summarize 'git log' output"
-msgstr "Summera \"git log\"-utdata"
+msgstr "Summera ”git log”-utdata"
 
 msgid "Show various types of objects"
 msgstr "Visa olika sorters objekt"
@@ -14080,8 +14202,8 @@ msgstr "Kontrollera GPG-signaturer i taggar"
 msgid "Display version information about Git"
 msgstr "Visa versionsinformation om Git"
 
-msgid "Show logs with difference each commit introduces"
-msgstr "Visa loggar med differenser varje incheckning introducerar"
+msgid "Show logs with differences each commit introduces"
+msgstr "Visa loggar med ändringarna varje incheckning introducerar"
 
 msgid "Manage multiple working trees"
 msgstr "Hantera ytterligare arbetskataloger"
@@ -14197,6 +14319,32 @@ msgstr "Verktyg för att hantera stora Git-arkiv"
 msgid "commit-graph file is too small"
 msgstr "incheckningsgraffilen %s är för liten"
 
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "incheckningsgrafens oid-utbredningsstycke har fel storlek"
+
+msgid "commit-graph fanout values out of order"
+msgstr "incheckningsgrafens utbredningsvärden är i fel ordning"
+
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "incheckningsgrafens OID-uppslagningsstycket har fel storlek"
+
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "incheckningsgrafens incheckningsdatastycke har fel storlek"
+
+msgid "commit-graph generations chunk is wrong size"
+msgstr "incheckningsgrafens generationsstycke har fel storlek"
+
+msgid "commit-graph changed-path index chunk is too small"
+msgstr "incheckningsgrafens ändrade-sökvägar-indexstycke är förö litet"
+
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"ignorerar för litet ändrade-sökvägar-stycke (%<PRIuMAX> < %<PRIuMAX>) i "
+"incheckningsgraffilen"
+
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
 msgstr "incheckningsgrafens signatur %X stämmer inte med signaturen %X"
@@ -14213,9 +14361,24 @@ msgstr "incheckningsgrafens hashversion %X stämmer inte med versionen %X"
 msgid "commit-graph file is too small to hold %u chunks"
 msgstr "incheckningsgraffilen är för liten för att innehålla %u stycken"
 
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr ""
+"incheckningsgrafens nödvändiga OID-utbredningsstycke saknas eller är trasigt"
+
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr ""
+"incheckningsgrafens nödvändiga OID-uppslagningsstycke saknas eller är trasigt"
+
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr ""
+"incheckningsgrafens nödvändiga incheckningsdatastycke saknas eller är trasigt"
+
 msgid "commit-graph has no base graphs chunk"
 msgstr "incheckningsgrafen har inga bas-graf-stycken"
 
+msgid "commit-graph base graphs chunk is too small"
+msgstr "incheckningsgrafens bas-graf-stycken är för små"
+
 msgid "commit-graph chain does not match"
 msgstr "incheckningsgrafens kedja stämmer inte"
 
@@ -14223,9 +14386,12 @@ msgstr "incheckningsgrafens kedja stämmer inte"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "antalet incheckningar i basgrafen för högt: %<PRIuMAX>"
 
+msgid "commit-graph chain file too small"
+msgstr "incheckningsgrafens kedjefil är för liten"
+
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
-msgstr "ogiltig incheckingsgrafkedja: rad \"%s\" är inte ett hash-värde"
+msgstr "ogiltig incheckingsgrafkedja: rad ”%s” är inte ett hash-värde"
 
 msgid "unable to find all commit-graph files"
 msgstr "kan inte hitta alla incheckingsgraffiler"
@@ -14240,6 +14406,12 @@ msgstr "kunde inte hitta incheckningen %s"
 msgid "commit-graph requires overflow generation data but has none"
 msgstr "incheckningsgraf kräver spillgenerationsdata, men har ingen"
 
+msgid "commit-graph overflow generation data is too small"
+msgstr "incheckningsgrafens spillgenerationsdata är för liten"
+
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "incheckningsgrafens extra-kant-pekare är utanför intervallet"
+
 msgid "Loading known commits in commit graph"
 msgstr "Läser in kända incheckningar i incheckningsgraf"
 
@@ -14289,7 +14461,7 @@ msgstr "kan inte skapa temporärt graflager"
 
 #, c-format
 msgid "unable to adjust shared permissions for '%s'"
-msgstr "kan inte justera delade behörigheter för \"%s\""
+msgstr "kan inte justera delade behörigheter för ”%s”"
 
 #, c-format
 msgid "Writing out commit graph in %d pass"
@@ -14322,7 +14494,7 @@ msgstr "Slår ihop incheckningsgraf"
 
 msgid "attempting to write a commit-graph, but 'core.commitGraph' is disabled"
 msgstr ""
-"försöker skriva en incheckningsgraf, men \"core.commitGraph\" är inaktiverad"
+"försöker skriva en incheckningsgraf, men ”core.commitGraph” är inaktiverad"
 
 msgid "too many commits to write graph"
 msgstr "för många incheckningar för att skriva graf"
@@ -14367,20 +14539,6 @@ msgid "commit-graph parent list for commit %s terminates early"
 msgstr ""
 "incheckningsgrafens föräldralista för incheckningen %s avslutas för tidigt"
 
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"incheckningsgrafen har generationsnummer noll för incheckningen %s, men icke-"
-"noll på annan plats"
-
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"incheckningsgrafen har generationsnummer skilt från noll för incheckningen "
-"%s, men noll på annan plats"
-
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
 msgstr ""
@@ -14393,6 +14551,14 @@ msgstr ""
 "incheckningsdatumet för incheckningen %s i incheckningsgrafen är %<PRIuMAX> !"
 "= %<PRIuMAX>"
 
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"incheckningsgrafen har generationsnummer som både är noll och icke-noll "
+"(dvs, incheckningarna ”%s” och ”%s”)"
+
 msgid "Verifying commits in commit graph"
 msgstr "Bekräftar incheckningar i incheckningsgrafen"
 
@@ -14413,11 +14579,16 @@ msgstr ""
 "Stöd för <GIT_DIR>/info/grafts avråds från och\n"
 "kommer tas bort i en framtida version av Git.\n"
 "\n"
-"Använd \"git replace --convert-graft-file\"\n"
+"Använd ”git replace --convert-graft-file”\n"
 "för att omvandla grafts till ersättningsreferenser.\n"
 "\n"
 "Slå av detta meddelande genom att skriva\n"
-"\"git config advice.graftFileDeprecated false\""
+"”git config advice.graftFileDeprecated false”"
+
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr ""
+"incheckningen %s finns i incheckningsgrafen, men inte i objektdatabasen"
 
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
@@ -14454,31 +14625,31 @@ msgstr "ingen libc-information tillgänglig\n"
 
 #, c-format
 msgid "could not determine free disk size for '%s'"
-msgstr "kunde inte ta reda på ledigt diskutrymme för \"%s\""
+msgstr "kunde inte ta reda på ledigt diskutrymme för ”%s”"
 
 #, c-format
 msgid "could not get info for '%s'"
-msgstr "kunde inte hämta info för \"%s\""
+msgstr "kunde inte hämta info för ”%s”"
 
 #, c-format
 msgid "[GLE %ld] health thread could not open '%ls'"
-msgstr "[GLE %ld] hälsotråden kunde inte öppna \"%ls\""
+msgstr "[GLE %ld] hälsotråden kunde inte öppna ”%ls”"
 
 #, c-format
 msgid "[GLE %ld] health thread getting BHFI for '%ls'"
-msgstr "[GLE %ld] hälsotråden hämtar BHFI för \"%ls\""
+msgstr "[GLE %ld] hälsotråden hämtar BHFI för ”%ls”"
 
 #, c-format
 msgid "could not convert to wide characters: '%s'"
-msgstr "kunde inte konvertera till breda tecken: \"%s\""
+msgstr "kunde inte konvertera till breda tecken: ”%s”"
 
 #, c-format
 msgid "BHFI changed '%ls'"
-msgstr "BHFI ändrade \"%ls\""
+msgstr "BHFI ändrade ”%ls”"
 
 #, c-format
 msgid "unhandled case in 'has_worktree_moved': %d"
-msgstr "ohanterat fall i \"has_worktree_moved\": %d"
+msgstr "ohanterat fall i ”has_worktree_moved”: %d"
 
 #, c-format
 msgid "health thread wait failed [GLE %ld]"
@@ -14496,23 +14667,23 @@ msgstr "Misslyckades starta FSEventStream:en"
 
 #, c-format
 msgid "[GLE %ld] could not convert path to UTF-8: '%.*ls'"
-msgstr "[GLE %ld] kunde inte konvertera sökväg till UTF-8: \"%.*ls\""
+msgstr "[GLE %ld] kunde inte konvertera sökväg till UTF-8: ”%.*ls”"
 
 #, c-format
 msgid "[GLE %ld] could not watch '%s'"
-msgstr "[GLE %ld] kunde inte övervaka \"%s\""
+msgstr "[GLE %ld] kunde inte övervaka ”%s”"
 
 #, c-format
 msgid "[GLE %ld] could not get longname of '%s'"
-msgstr "[GLE %ld] kunde inte hämta långt namn för \"%s\""
+msgstr "[GLE %ld] kunde inte hämta långt namn för ”%s”"
 
 #, c-format
 msgid "ReadDirectoryChangedW failed on '%s' [GLE %ld]"
-msgstr "ReadDirectoryChangedW misslyckades på \"%s\" [GLE %ld]"
+msgstr "ReadDirectoryChangedW misslyckades på ”%s” [GLE %ld]"
 
 #, c-format
 msgid "GetOverlappedResult failed on '%s' [GLE %ld]"
-msgstr "GetOverlappedResult misslyckades på \"%s\" [GLE %ld]"
+msgstr "GetOverlappedResult misslyckades på ”%s” [GLE %ld]"
 
 #, c-format
 msgid "could not read directory changes [GLE %ld]"
@@ -14536,11 +14707,11 @@ msgstr "closedir('%s') misslyckades"
 
 #, c-format
 msgid "[GLE %ld] unable to open for read '%ls'"
-msgstr "[GLE %ld] kunde inte öppna \"%ls\" för läsning"
+msgstr "[GLE %ld] kunde inte öppna ”%ls” för läsning"
 
 #, c-format
 msgid "[GLE %ld] unable to get protocol information for '%ls'"
-msgstr "[GLE %ld] kunde inte hämta protokollinformation för \"%ls\""
+msgstr "[GLE %ld] kunde inte hämta protokollinformation för ”%ls”"
 
 #, c-format
 msgid "failed to copy SID (%ld)"
@@ -14548,7 +14719,7 @@ msgstr "misslyckades kopiera SID (%ld)"
 
 #, c-format
 msgid "failed to get owner for '%s' (%ld)"
-msgstr "misslyckades hämta ägaren för \"%s\" (%ld)"
+msgstr "misslyckades hämta ägaren för ”%s” (%ld)"
 
 msgid "memory exhausted"
 msgstr "minnet slut"
@@ -14615,15 +14786,15 @@ msgstr "kunde inte läsa IPC-svar"
 
 #, c-format
 msgid "could not start accept_thread '%s'"
-msgstr "kunde inte ta status \"accept_thread\" \"%s\""
+msgstr "kunde inte ta status ”accept_thread” ”%s”"
 
 #, c-format
 msgid "could not start worker[0] for '%s'"
-msgstr "kunde inte starta \"worker[0]\" för \"%s\""
+msgstr "kunde inte starta ”worker[0]” för ”%s”"
 
 #, c-format
 msgid "ConnectNamedPipe failed for '%s' (%lu)"
-msgstr "ConnectNamedPipe misslyckades för \"%s\" (%lu)"
+msgstr "ConnectNamedPipe misslyckades för ”%s” (%lu)"
 
 #, c-format
 msgid "could not create fd from pipe for '%s'"
@@ -14631,14 +14802,14 @@ msgstr "kunde inte skapa filhandtag från rör för %s"
 
 #, c-format
 msgid "could not start thread[0] for '%s'"
-msgstr "kunde inte starta thread[0] för \"%s\""
+msgstr "kunde inte starta thread[0] för ”%s”"
 
 #, c-format
 msgid "wait for hEvent failed for '%s'"
-msgstr "misslyckades vänta på hEvent för \"%s\""
+msgstr "misslyckades vänta på hEvent för ”%s”"
 
 msgid "cannot resume in the background, please use 'fg' to resume"
-msgstr "kan inte fortsätta i bakgrunden, använd \"fg\" för att återuppta"
+msgstr "kan inte fortsätta i bakgrunden, använd ”fg” för att återuppta"
 
 msgid "cannot restore terminal settings"
 msgstr "kan inte återställa terminalinställningar"
@@ -14659,7 +14830,7 @@ msgstr ""
 
 #, c-format
 msgid "could not expand include path '%s'"
-msgstr "kunde inte expandera inkluderingssökväg \"%s\""
+msgstr "kunde inte expandera inkluderingssökväg ”%s”"
 
 msgid "relative config includes must come from files"
 msgstr "relativa konfigureringsinkluderingar måste komma från filer"
@@ -14680,11 +14851,11 @@ msgstr "felaktigt konfigurationsformat: %s"
 
 #, c-format
 msgid "missing environment variable name for configuration '%.*s'"
-msgstr "miljövariabelnamn saknas för konfigurationen \"%.*s\""
+msgstr "miljövariabelnamn saknas för konfigurationen ”%.*s”"
 
 #, c-format
 msgid "missing environment variable '%s' for configuration '%.*s'"
-msgstr "miljövariabeln \"%s\" saknas för konfigurationen \"%.*s\""
+msgstr "miljövariabeln ”%s” saknas för konfigurationen ”%.*s”"
 
 #, c-format
 msgid "key does not contain a section: %s"
@@ -14761,38 +14932,35 @@ msgstr "ogiltig enhet"
 
 #, c-format
 msgid "bad numeric config value '%s' for '%s': %s"
-msgstr "felaktigt numeriskt konfigurationsvärde \"%s\" för \"%s\": %s"
+msgstr "felaktigt numeriskt konfigurationsvärde ”%s” för ”%s”: %s"
 
 #, c-format
 msgid "bad numeric config value '%s' for '%s' in blob %s: %s"
-msgstr ""
-"felaktigt numeriskt konfigurationsvärde \"%s\" för \"%s\" i blob:en %s: %s"
+msgstr "felaktigt numeriskt konfigurationsvärde ”%s” för ”%s” i blob:en %s: %s"
 
 #, c-format
 msgid "bad numeric config value '%s' for '%s' in file %s: %s"
-msgstr ""
-"felaktigt numeriskt konfigurationsvärde \"%s\" för \"%s\" i filen %s: %s"
+msgstr "felaktigt numeriskt konfigurationsvärde ”%s” för ”%s” i filen %s: %s"
 
 #, c-format
 msgid "bad numeric config value '%s' for '%s' in standard input: %s"
 msgstr ""
-"felaktigt numeriskt konfigurationsvärde \"%s\" för \"%s\" i standard in: %s"
+"felaktigt numeriskt konfigurationsvärde ”%s” för ”%s” i standard in: %s"
 
 #, c-format
 msgid "bad numeric config value '%s' for '%s' in submodule-blob %s: %s"
 msgstr ""
-"felaktigt numeriskt konfigurationsvärde \"%s\" för \"%s\" i undermodul-blob:"
-"en %s: %s"
+"felaktigt numeriskt konfigurationsvärde ”%s” för ”%s” i undermodul-blob:en "
+"%s: %s"
 
 #, c-format
 msgid "bad numeric config value '%s' for '%s' in command line %s: %s"
 msgstr ""
-"felaktigt numeriskt konfigurationsvärde \"%s\" för \"%s\" i kommandoraden "
-"%s: %s"
+"felaktigt numeriskt konfigurationsvärde ”%s” för ”%s” i kommandoraden %s: %s"
 
 #, c-format
 msgid "bad numeric config value '%s' for '%s' in %s: %s"
-msgstr "felaktigt numeriskt konfigurationsvärde \"%s\" för \"%s\" i %s: %s"
+msgstr "felaktigt numeriskt konfigurationsvärde ”%s” för ”%s” i %s: %s"
 
 #, c-format
 msgid "invalid value for variable %s"
@@ -14800,19 +14968,19 @@ msgstr "ogiltigt värde för variabeln %s"
 
 #, c-format
 msgid "ignoring unknown core.fsync component '%s'"
-msgstr "ignorerar okänd core.fsync-komponent \"%s\""
+msgstr "ignorerar okänd core.fsync-komponent ”%s”"
 
 #, c-format
 msgid "bad boolean config value '%s' for '%s'"
-msgstr "felaktigt booleskt konfigurationsvärde \"%s\" för \"%s\""
+msgstr "felaktigt booleskt konfigurationsvärde ”%s” för ”%s”"
 
 #, c-format
 msgid "failed to expand user dir in: '%s'"
-msgstr "misslyckades expandera användarkatalog i: \"%s\""
+msgstr "misslyckades expandera användarkatalog i: ”%s”"
 
 #, c-format
 msgid "'%s' for '%s' is not a valid timestamp"
-msgstr "\"%s\" för \"%s\" är inte en giltig tidsstämpel"
+msgstr "”%s” för ”%s” är inte en giltig tidsstämpel"
 
 #, c-format
 msgid "abbrev length out of range: %d"
@@ -14827,7 +14995,7 @@ msgstr "core.commentChar kan bara vara ett ASCII-tecken"
 
 #, c-format
 msgid "ignoring unknown core.fsyncMethod value '%s'"
-msgstr "ignorerar okänt core.fsyncMethod-värde \"%s\""
+msgstr "ignorerar okänt core.fsyncMethod-värde ”%s”"
 
 msgid "core.fsyncObjectFiles is deprecated; use core.fsync instead"
 msgstr "core.fsyncObjectFiles avråds från; använd core.fsync istället"
@@ -14849,19 +15017,15 @@ msgstr "måste vara en av nothing, matching, simple, upstream eller current"
 
 #, c-format
 msgid "unable to load config blob object '%s'"
-msgstr "kunde inte läsa konfigurerings-blobobjektet \"%s\""
+msgstr "kunde inte läsa konfigurerings-blobobjektet ”%s”"
 
 #, c-format
 msgid "reference '%s' does not point to a blob"
-msgstr "referensen \"%s\" pekar inte på en blob"
+msgstr "referensen ”%s” pekar inte på en blob"
 
 #, c-format
 msgid "unable to resolve config blob '%s'"
-msgstr "kan inte slå upp konfigurerings-bloben \"%s\""
-
-#, c-format
-msgid "failed to parse %s"
-msgstr "kunde inte tolka %s"
+msgstr "kan inte slå upp konfigurerings-bloben ”%s”"
 
 msgid "unable to parse command-line config"
 msgstr "kan inte tolka kommandoradskonfiguration"
@@ -14871,24 +15035,24 @@ msgstr "okänt fel uppstod vid läsning av konfigurationsfilerna"
 
 #, c-format
 msgid "Invalid %s: '%s'"
-msgstr "Felaktigt %s: \"%s\""
+msgstr "Felaktigt %s: ”%s”"
 
 #, c-format
 msgid "splitIndex.maxPercentChange value '%d' should be between 0 and 100"
 msgstr ""
-"värdet \"%d\" för splitIndex.maxPercentChange borde vara mellan 0 och 100"
+"värdet ”%d” för splitIndex.maxPercentChange borde vara mellan 0 och 100"
 
 #, c-format
 msgid "unable to parse '%s' from command-line config"
-msgstr "kunde inte tolka värdet \"%s\" från kommandoradskonfiguration"
+msgstr "kunde inte tolka värdet ”%s” från kommandoradskonfiguration"
 
 #, c-format
 msgid "bad config variable '%s' in file '%s' at line %d"
-msgstr "felaktig konfigurationsvariabel \"%s\" i filen \"%s\" på rad %d"
+msgstr "felaktig konfigurationsvariabel ”%s” i filen ”%s” på rad %d"
 
 #, c-format
 msgid "invalid section name '%s'"
-msgstr "felaktigt sektionsnamn \"%s\""
+msgstr "felaktigt sektionsnamn ”%s”"
 
 #, c-format
 msgid "%s has multiple values"
@@ -14896,7 +15060,7 @@ msgstr "%s har flera värden"
 
 #, c-format
 msgid "failed to write new configuration file %s"
-msgstr "kan inte skriva nya konfigurationsfilen \"%s\""
+msgstr "kan inte skriva nya konfigurationsfilen ”%s”"
 
 #, c-format
 msgid "could not lock config file %s"
@@ -14908,7 +15072,7 @@ msgstr "öppnar %s"
 
 #, c-format
 msgid "invalid config file %s"
-msgstr "ogiltig konfigurationsfil: \"%s\""
+msgstr "ogiltig konfigurationsfil: ”%s”"
 
 #, c-format
 msgid "fstat on %s failed"
@@ -14916,7 +15080,7 @@ msgstr "fstat misslyckades på %s"
 
 #, c-format
 msgid "unable to mmap '%s'%s"
-msgstr "kunde inte utföra mmap på \"%s\"%s"
+msgstr "kunde inte utföra mmap på ”%s”%s"
 
 #, c-format
 msgid "chmod on %s failed"
@@ -14928,7 +15092,7 @@ msgstr "kunde inte skriva konfigurationsfilen %s"
 
 #, c-format
 msgid "could not set '%s' to '%s'"
-msgstr "kunde inte ställa in \"%s\" till \"%s\""
+msgstr "kunde inte ställa in ”%s” till ”%s”"
 
 #, c-format
 msgid "invalid section name: %s"
@@ -14936,11 +15100,11 @@ msgstr "felaktigt namn på stycke: %s"
 
 #, c-format
 msgid "refusing to work with overly long line in '%s' on line %<PRIuMAX>"
-msgstr "vägrar arbeta med för långa rader i \"%s\" på rad %<PRIuMAX>"
+msgstr "vägrar arbeta med för långa rader i ”%s” på rad %<PRIuMAX>"
 
 #, c-format
 msgid "missing value for '%s'"
-msgstr "värde saknas för \"%s\""
+msgstr "värde saknas för ”%s”"
 
 msgid "the remote end hung up upon initial contact"
 msgstr "fjärren lade på vid inledande kontakt"
@@ -14958,25 +15122,25 @@ msgstr ""
 
 #, c-format
 msgid "server doesn't support '%s'"
-msgstr "Servern stöder inte \"%s\""
+msgstr "Servern stöder inte ”%s”"
 
 #, c-format
 msgid "server doesn't support feature '%s'"
-msgstr "servern stöder inte funktionen \"%s\""
+msgstr "servern stöder inte funktionen ”%s”"
 
 msgid "expected flush after capabilities"
-msgstr "förväntade \"flush\" efter förmågor"
+msgstr "förväntade ”flush” efter förmågor"
 
 #, c-format
 msgid "ignoring capabilities after first line '%s'"
-msgstr "ignorerar förmågor efter första raden \"%s\""
+msgstr "ignorerar förmågor efter första raden ”%s”"
 
 msgid "protocol error: unexpected capabilities^{}"
 msgstr "protokollfel: förväntade inte capabilities^{}"
 
 #, c-format
 msgid "protocol error: expected shallow sha-1, got '%s'"
-msgstr "protokollfel: förväntade \"shallow sha-1\" fick \"%s\""
+msgstr "protokollfel: förväntade ”shallow sha-1” fick ”%s”"
 
 msgid "repository on the other end cannot be shallow"
 msgstr "arkivet på andra sidan kan inte vara grunt"
@@ -14986,18 +15150,18 @@ msgstr "ogiltigt paket"
 
 #, c-format
 msgid "protocol error: unexpected '%s'"
-msgstr "protokollfel: förväntade inte \"%s\""
+msgstr "protokollfel: förväntade inte ”%s”"
 
 #, c-format
 msgid "unknown object format '%s' specified by server"
-msgstr "okänt objektformat \"%s\" angavs av servern"
+msgstr "okänt objektformat ”%s” angavs av servern"
 
 #, c-format
 msgid "error on bundle-uri response line %d: %s"
 msgstr "fel på bundle-uri-svar rad %d: %s"
 
 msgid "expected flush after bundle-uri listing"
-msgstr "förväntade \"flush\" efter bundle-uri-listan"
+msgstr "förväntade ”flush” efter bundle-uri-listan"
 
 msgid "expected response end packet after ref listing"
 msgstr "förväntade svarsavslutningspaket efter ref-listan"
@@ -15007,11 +15171,11 @@ msgid "invalid ls-refs response: %s"
 msgstr "ogiltigt svar på ls-refs: %s"
 
 msgid "expected flush after ref listing"
-msgstr "förväntade \"flush\" efter ref-listan"
+msgstr "förväntade ”flush” efter ref-listan"
 
 #, c-format
 msgid "protocol '%s' is not supported"
-msgstr "protokollet \"%s\" stöds inte"
+msgstr "protokollet ”%s” stöds inte"
 
 msgid "unable to set SO_KEEPALIVE on socket"
 msgstr "kunde inte sätta SO_KEEPALIVE på uttaget"
@@ -15055,40 +15219,40 @@ msgstr "okänd port %s"
 
 #, c-format
 msgid "strange hostname '%s' blocked"
-msgstr "konstigt värdnamn \"%s\" blockerat"
+msgstr "konstigt värdnamn ”%s” blockerat"
 
 #, c-format
 msgid "strange port '%s' blocked"
-msgstr "konstig port \"%s\" blockerad"
+msgstr "konstig port ”%s” blockerad"
 
 #, c-format
 msgid "cannot start proxy %s"
 msgstr "kan inte starta mellanserver (proxy) %s"
 
 msgid "no path specified; see 'git help pull' for valid url syntax"
-msgstr "ingen sökväg angavs; se \"git help pull\" för giltig URL-syntax"
+msgstr "ingen sökväg angavs; se ”git help pull” för giltig URL-syntax"
 
 msgid "newline is forbidden in git:// hosts and repo paths"
 msgstr "radbrytningar är förbjudna i git://-värdnamn och arkivsökvägar"
 
 msgid "ssh variant 'simple' does not support -4"
-msgstr "ssh-varianten \"simple\" stöder inte -4"
+msgstr "ssh-varianten ”simple” stöder inte -4"
 
 msgid "ssh variant 'simple' does not support -6"
-msgstr "ssh-varianten \"simple\" stöder inte -6"
+msgstr "ssh-varianten ”simple” stöder inte -6"
 
 msgid "ssh variant 'simple' does not support setting port"
-msgstr "ssh-varianten \"simple\" stöder inte val av port"
+msgstr "ssh-varianten ”simple” stöder inte val av port"
 
 #, c-format
 msgid "strange pathname '%s' blocked"
-msgstr "konstigt sökvägsnamn \"%s\" blockerat"
+msgstr "konstigt sökvägsnamn ”%s” blockerat"
 
 msgid "unable to fork"
 msgstr "kunde inte grena (fork)"
 
 msgid "Could not run 'git rev-list'"
-msgstr "Kunde inte köra \"git rev-list\""
+msgstr "Kunde inte köra ”git rev-list”"
 
 msgid "failed write to rev-list"
 msgstr "kunde inte skriva till rev-list"
@@ -15109,7 +15273,7 @@ msgid ""
 "in the working copy of '%s', CRLF will be replaced by LF the next time Git "
 "touches it"
 msgstr ""
-"CRLF i arbetskopian av \"%s\" kommer ersättas med LF nästa gång Git rör den"
+"CRLF i arbetskopian av ”%s” kommer ersättas med LF nästa gång Git rör den"
 
 #, c-format
 msgid "LF would be replaced by CRLF in %s"
@@ -15120,60 +15284,59 @@ msgid ""
 "in the working copy of '%s', LF will be replaced by CRLF the next time Git "
 "touches it"
 msgstr ""
-"LF i arbetskopian av \"%s\" kommer ersättas med CRLF nästa gång Git rör den"
+"LF i arbetskopian av ”%s” kommer ersättas med CRLF nästa gång Git rör den"
 
 #, c-format
 msgid "BOM is prohibited in '%s' if encoded as %s"
-msgstr "BOM är förbjudet i \"%s\" om kodat som %s"
+msgstr "BOM är förbjudet i ”%s” om kodat som %s"
 
 #, c-format
 msgid ""
 "The file '%s' contains a byte order mark (BOM). Please use UTF-%.*s as "
 "working-tree-encoding."
 msgstr ""
-"Filen \"%s\" innehåller byte order mark (BOM). Använd UTF-%.*s som "
+"Filen ”%s” innehåller byte order mark (BOM). Använd UTF-%.*s som "
 "teckenkodning i arbetskatalogen."
 
 #, c-format
 msgid "BOM is required in '%s' if encoded as %s"
-msgstr "BOM krävs om \"%s\" kodas som %s"
+msgstr "BOM krävs om ”%s” kodas som %s"
 
 #, c-format
 msgid ""
 "The file '%s' is missing a byte order mark (BOM). Please use UTF-%sBE or UTF-"
 "%sLE (depending on the byte order) as working-tree-encoding."
 msgstr ""
-"Filen \"%s\" saknar byte order mark (BOM). Använd UTF-%sBE eller UTF-%sLE "
+"Filen ”%s” saknar byte order mark (BOM). Använd UTF-%sBE eller UTF-%sLE "
 "(beroende på byteordning) som teckenkodning i arbetskatalogen."
 
 #, c-format
 msgid "failed to encode '%s' from %s to %s"
-msgstr "misslyckades omkoda \"%s\" från %s till %s"
+msgstr "misslyckades omkoda ”%s” från %s till %s"
 
 #, c-format
 msgid "encoding '%s' from %s to %s and back is not the same"
-msgstr ""
-"omkodning av \"%s\" från %s till %s och tillbaka ger inte samma resultat"
+msgstr "omkodning av ”%s” från %s till %s och tillbaka ger inte samma resultat"
 
 #, c-format
 msgid "cannot fork to run external filter '%s'"
-msgstr "kan inte grena (fork) för att köra externt filter \"%s\""
+msgstr "kan inte grena (fork) för att köra externt filter ”%s”"
 
 #, c-format
 msgid "cannot feed the input to external filter '%s'"
-msgstr "kunde inte skicka indata till externt filter \"%s\""
+msgstr "kunde inte skicka indata till externt filter ”%s”"
 
 #, c-format
 msgid "external filter '%s' failed %d"
-msgstr "externt filter \"%s\" misslyckades %d"
+msgstr "externt filter ”%s” misslyckades %d"
 
 #, c-format
 msgid "read from external filter '%s' failed"
-msgstr "läsning från externt filter \"%s\" misslyckades"
+msgstr "läsning från externt filter ”%s” misslyckades"
 
 #, c-format
 msgid "external filter '%s' failed"
-msgstr "externt filter \"%s\" misslyckades"
+msgstr "externt filter ”%s” misslyckades"
 
 msgid "unexpected filter type"
 msgstr "oväntad filtertyp"
@@ -15186,19 +15349,19 @@ msgid ""
 "external filter '%s' is not available anymore although not all paths have "
 "been filtered"
 msgstr ""
-"externt filter \"%s\" är inte längre tillgängligt trots att alla sökvägar "
-"inte har filtrerats"
+"externt filter ”%s” är inte längre tillgängligt trots att alla sökvägar inte "
+"har filtrerats"
 
 msgid "true/false are no valid working-tree-encodings"
 msgstr "true/false är inte giltig teckenkodning för arbetskatalogen"
 
 #, c-format
 msgid "%s: clean filter '%s' failed"
-msgstr "%s: \"clean\"-filtret \"%s\" misslyckades"
+msgstr "%s: ”clean”-filtret ”%s” misslyckades"
 
 #, c-format
 msgid "%s: smudge filter %s failed"
-msgstr "%s: \"smudge\"-filtret \"%s\" misslyckades"
+msgstr "%s: ”smudge”-filtret ”%s” misslyckades"
 
 #, c-format
 msgid "skipping credential lookup for key: credential.%s"
@@ -15289,7 +15452,7 @@ msgstr "felaktigt trädobjektet %s"
 
 #, c-format
 msgid "failed to load island regex for '%s': %s"
-msgstr "kunde inte hämta ö-regex för \"%s\": %s"
+msgstr "kunde inte hämta ö-regex för ”%s”: %s"
 
 #, c-format
 msgid "island regex from config has too many capture groups (max=%d)"
@@ -15301,26 +15464,26 @@ msgstr "Markerade %d öar, klar.\n"
 
 #, c-format
 msgid "invalid --%s value '%s'"
-msgstr "ogiltigt värde för --%s: \"%s\""
+msgstr "ogiltigt värde för --%s: ”%s”"
 
 #, c-format
 msgid "could not archive missing directory '%s'"
-msgstr "kunde inte arkivera saknad katalog \"%s\""
+msgstr "kunde inte arkivera saknad katalog ”%s”"
 
 #, c-format
 msgid "could not open directory '%s'"
-msgstr "kunde inte öppna katalogen \"%s\""
+msgstr "kunde inte öppna katalogen ”%s”"
 
 #, c-format
 msgid "skipping '%s', which is neither file nor directory"
-msgstr "hoppar över \"%s\", som varken är en fil eller en katalog"
+msgstr "hoppar över ”%s”, som varken är en fil eller en katalog"
 
 msgid "could not duplicate stdout"
 msgstr "kunde inte duplicera standard ut"
 
 #, c-format
 msgid "could not add directory '%s' to archiver"
-msgstr "kunde inte lägga till katalogen \"%s\" till arkiveraren"
+msgstr "kunde inte lägga till katalogen ”%s” till arkiveraren"
 
 msgid "failed to write archive"
 msgstr "misslyckades skriva arkiv"
@@ -15328,9 +15491,6 @@ msgstr "misslyckades skriva arkiv"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base fungerar inte med intervall"
 
-msgid "--merge-base only works with commits"
-msgstr "--merge-base fungerar bara med incheckningar"
-
 msgid "unable to get HEAD"
 msgstr "kan inte hämta HEAD"
 
@@ -15358,27 +15518,26 @@ msgstr ""
 
 #, c-format
 msgid "  Failed to parse dirstat cut-off percentage '%s'\n"
-msgstr "  Misslyckades tolka dirstat-avskärningsprocentandel \"%s\"\n"
+msgstr "  Misslyckades tolka dirstat-avskärningsprocentandel ”%s”\n"
 
 #, c-format
 msgid "  Unknown dirstat parameter '%s'\n"
-msgstr "  Okänd dirstat-parameter \"%s\"\n"
+msgstr "  Okänd dirstat-parameter ”%s”\n"
 
 msgid ""
 "color moved setting must be one of 'no', 'default', 'blocks', 'zebra', "
 "'dimmed-zebra', 'plain'"
 msgstr ""
-"färginställningen för flyttade block måste vara en av \"no\", \"default\", "
-"\"blocks\", \"zebra\", \"dimmed-zebra\", \"plain\""
+"färginställningen för flyttade block måste vara en av ”no”, ”default”, "
+"”blocks”, ”zebra”, ”dimmed-zebra”, ”plain”"
 
 #, c-format
 msgid ""
 "unknown color-moved-ws mode '%s', possible values are 'ignore-space-change', "
 "'ignore-space-at-eol', 'ignore-all-space', 'allow-indentation-change'"
 msgstr ""
-"okänt läge \"%s\" för color-moved-ws, möjliga värden är \"ignore-space-change"
-"\", \"ignore-space-at-eol\", \"ignore-all-space\", \"allow-indentation-change"
-"\""
+"okänt läge ”%s” för color-moved-ws, möjliga värden är ”ignore-space-change”, "
+"”ignore-space-at-eol”, ”ignore-all-space”, ”allow-indentation-change”"
 
 msgid ""
 "color-moved-ws: allow-indentation-change cannot be combined with other "
@@ -15389,14 +15548,18 @@ msgstr ""
 
 #, c-format
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
-msgstr "Okänt värde för konfigurationsvariabeln \"diff.submodule\": \"%s\""
+msgstr "Okänt värde för konfigurationsvariabeln ”diff.submodule”: ”%s”"
+
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "okänt värde för inställningen ”%s”: %s"
 
 #, c-format
 msgid ""
 "Found errors in 'diff.dirstat' config variable:\n"
 "%s"
 msgstr ""
-"Hittade fel i konfigurationsvariabeln \"diff.dirstat\":\n"
+"Hittade fel i konfigurationsvariabeln ”diff.dirstat”:\n"
 "%s"
 
 #, c-format
@@ -15412,21 +15575,19 @@ msgstr "sökvägs-magi stöds inte av --follow: %s"
 
 #, c-format
 msgid "options '%s', '%s', '%s', and '%s' cannot be used together"
-msgstr ""
-"flaggorna \"%s\", \"%s\", \"%s\" och \"%s\" kan inte användas samtidigt"
+msgstr "flaggorna ”%s”, ”%s”, ”%s” och ”%s” kan inte användas samtidigt"
 
 #, c-format
 msgid "options '%s' and '%s' cannot be used together, use '%s' with '%s'"
 msgstr ""
-"flaggorna \"%s\" och \"%s\" kan inte användas samtidigt, använd \"%s\" med "
-"\"%s\""
+"flaggorna ”%s” och ”%s” kan inte användas samtidigt, använd ”%s” med ”%s”"
 
 #, c-format
 msgid ""
 "options '%s' and '%s' cannot be used together, use '%s' with '%s' and '%s'"
 msgstr ""
-"flaggorna \"%s\" och  \"%s\" kan inte användas samtidigt, använd \"%s\" med "
-"\"%s\" och \"%s\""
+"flaggorna ”%s” och  ”%s” kan inte användas samtidigt, använd ”%s” med ”%s” "
+"och ”%s”"
 
 #, c-format
 msgid "invalid --stat value: %s"
@@ -15446,7 +15607,7 @@ msgstr ""
 
 #, c-format
 msgid "unknown change class '%c' in --diff-filter=%s"
-msgstr "okänd ändringsklass \"%c\" i --diff-filter=%s"
+msgstr "okänd ändringsklass ”%c” i --diff-filter=%s"
 
 #, c-format
 msgid "unknown value after ws-error-highlight=%.*s"
@@ -15454,7 +15615,7 @@ msgstr "okänt värde efter ws-error-highlight=%.*s"
 
 #, c-format
 msgid "unable to resolve '%s'"
-msgstr "kunde inte slå upp \"%s\""
+msgstr "kunde inte slå upp ”%s”"
 
 #, c-format
 msgid "%s expects <n>/<m> form"
@@ -15462,7 +15623,7 @@ msgstr "%s förväntar formen <n>/<m>"
 
 #, c-format
 msgid "%s expects a character, got '%s'"
-msgstr "%s förväntar ett tecken, fick \"%s\""
+msgstr "%s förväntar ett tecken, fick ”%s”"
 
 #, c-format
 msgid "bad --color-moved argument: %s"
@@ -15470,14 +15631,7 @@ msgstr "felaktigt argument till --color-moved: %s"
 
 #, c-format
 msgid "invalid mode '%s' in --color-moved-ws"
-msgstr "ogiltigt läge %s\" i --color-moved-ws"
-
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"flaggan diff-algorithm godtar\"myers\", \"minimal\", \"patience\" och "
-"\"histogram\""
+msgstr "ogiltigt läge %s” i --color-moved-ws"
 
 #, c-format
 msgid "invalid argument to %s"
@@ -15485,11 +15639,11 @@ msgstr "ogiltigt argument för %s"
 
 #, c-format
 msgid "invalid regex given to -I: '%s'"
-msgstr "ogiltigt reguljärt uttryck angavs för -I: \"%s\""
+msgstr "ogiltigt reguljärt uttryck angavs för -I: ”%s”"
 
 #, c-format
 msgid "failed to parse --submodule option parameter: '%s'"
-msgstr "misslyckades tolka argument till flaggan --submodule: \"%s\""
+msgstr "misslyckades tolka argument till flaggan --submodule: ”%s”"
 
 #, c-format
 msgid "bad --word-diff argument: %s"
@@ -15511,10 +15665,10 @@ msgid "generate the diff in raw format"
 msgstr "generera diff i råformat"
 
 msgid "synonym for '-p --raw'"
-msgstr "synonym till \"-p --raw\""
+msgstr "synonym till ”-p --raw”"
 
 msgid "synonym for '-p --stat'"
-msgstr "synonym till \"-p --stat\""
+msgstr "synonym till ”-p --stat”"
 
 msgid "machine friendly --stat"
 msgstr "maskinläsbar --stat"
@@ -15522,8 +15676,8 @@ msgstr "maskinläsbar --stat"
 msgid "output only the last line of --stat"
 msgstr "skriv bara ut den sista raden för --stat"
 
-msgid "<param1,param2>..."
-msgstr "<param1,param2>..."
+msgid "<param1>,<param2>..."
+msgstr "<param1>,<param2>..."
 
 msgid ""
 "output the distribution of relative amount of changes for each sub-directory"
@@ -15533,8 +15687,8 @@ msgstr ""
 msgid "synonym for --dirstat=cumulative"
 msgstr "synonym för --dirstat=cumulative"
 
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "synonym för --dirstat=filer,param1,param2..."
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "synonym för --dirstat=filer,<param1>,<param2>..."
 
 msgid "warn if changes introduce conflict markers or whitespace errors"
 msgstr "varna om ändringar introducerar konfliktmarkörer eller blankstegsfel"
@@ -15580,7 +15734,7 @@ msgstr "skapa en binärdiff som kan appliceras"
 
 msgid "show full pre- and post-image object names on the \"index\" lines"
 msgstr ""
-"visa fullständiga objektnamn i \"index\"-rader för läget både före och efter"
+"visa fullständiga objektnamn i ”index”-rader för läget både före och efter"
 
 msgid "show colored diff"
 msgstr "visa färgad diff"
@@ -15592,8 +15746,8 @@ msgid ""
 "highlight whitespace errors in the 'context', 'old' or 'new' lines in the "
 "diff"
 msgstr ""
-"ljusmarkera blankstegsfel i \"context\" (sammanhang), \"old\" (gamla) eller "
-"\"new\" (nya) rader i diffen"
+"ljusmarkera blankstegsfel i ”context” (sammanhang), ”old” (gamla) eller "
+"”new” (nya) rader i diffen"
 
 msgid ""
 "do not munge pathnames and use NULs as output field terminators in --raw or "
@@ -15606,10 +15760,10 @@ msgid "<prefix>"
 msgstr "<prefix>"
 
 msgid "show the given source prefix instead of \"a/\""
-msgstr "visa givet källprefix istället för \"a/\""
+msgstr "visa givet källprefix istället för ”a/”"
 
 msgid "show the given destination prefix instead of \"b/\""
-msgstr "visa givet målprefix istället för \"b/\""
+msgstr "visa givet målprefix istället för ”b/”"
 
 msgid "prepend an additional prefix to every line of output"
 msgstr "lägg till ytterligare prefix på alla rader i utdata"
@@ -15627,13 +15781,13 @@ msgid "<char>"
 msgstr "<tecken>"
 
 msgid "specify the character to indicate a new line instead of '+'"
-msgstr "ange tecken för att ange ny rad istället för \"+\""
+msgstr "ange tecken för att ange ny rad istället för ”+”"
 
 msgid "specify the character to indicate an old line instead of '-'"
-msgstr "ange tecken för att ange gammal rad istället för \"-\""
+msgstr "ange tecken för att ange gammal rad istället för ”-”"
 
 msgid "specify the character to indicate a context instead of ' '"
-msgstr "ange tecken för att ange sammanhang istället för \" \""
+msgstr "ange tecken för att ange sammanhang istället för ” ”"
 
 msgid "Diff rename options"
 msgstr "Diff-namnbytesflaggor"
@@ -15703,22 +15857,16 @@ msgid "heuristic to shift diff hunk boundaries for easy reading"
 msgstr "heuristik för att flytta diff-gränser för lättare läsning"
 
 msgid "generate diff using the \"patience diff\" algorithm"
-msgstr "skapa diffar med algoritmen \"patience diff\""
+msgstr "skapa diffar med algoritmen ”patience diff”"
 
 msgid "generate diff using the \"histogram diff\" algorithm"
-msgstr "skapa diffar med algoritmen \"histogram diff\""
-
-msgid "<algorithm>"
-msgstr "<algoritm>"
-
-msgid "choose a diff algorithm"
-msgstr "välj en diff-algoritm"
+msgstr "skapa diffar med algoritmen ”histogram diff”"
 
 msgid "<text>"
 msgstr "<text>"
 
 msgid "generate diff using the \"anchored diff\" algorithm"
-msgstr "skapa diffar med algoritmen \"anchored diff\""
+msgstr "skapa diffar med algoritmen ”anchored diff”"
 
 msgid "<mode>"
 msgstr "<läge>"
@@ -15777,10 +15925,10 @@ msgid "specify how differences in submodules are shown"
 msgstr "ange hur ändringar i undermoduler visas"
 
 msgid "hide 'git add -N' entries from the index"
-msgstr "dölj \"git add -N\"-poster från indexet"
+msgstr "dölj ”git add -N”-poster från indexet"
 
 msgid "treat 'git add -N' entries as real in the index"
-msgstr "tolka \"git add -N\"-poster som äkta i indexet"
+msgstr "tolka ”git add -N”-poster som äkta i indexet"
 
 msgid "<string>"
 msgstr "<sträng>"
@@ -15850,18 +15998,18 @@ msgstr ""
 
 #, c-format
 msgid "failed to read orderfile '%s'"
-msgstr "kunde inte läsa orderfilen \"%s\""
+msgstr "kunde inte läsa orderfilen ”%s”"
 
 msgid "Performing inexact rename detection"
 msgstr "Utför onöjaktig namnbytesdetektering"
 
 #, c-format
 msgid "No such path '%s' in the diff"
-msgstr "Sökvägen \"%s\" finns inte i diffen"
+msgstr "Sökvägen ”%s” finns inte i diffen"
 
 #, c-format
 msgid "pathspec '%s' did not match any file(s) known to git"
-msgstr "sökvägsangivelsen \"%s\" motsvarade inte några av git kända filer"
+msgstr "sökvägsangivelsen ”%s” motsvarade inte några av git kända filer"
 
 #, c-format
 msgid "unrecognized pattern: '%s'"
@@ -15874,7 +16022,7 @@ msgstr "okänt negativt mönster: %s"
 #, c-format
 msgid "your sparse-checkout file may have issues: pattern '%s' is repeated"
 msgstr ""
-"din \"sparse-checkout\"-fil kan ha problem: mönstret \"%s\" förekommer flera "
+"din ”sparse-checkout”-fil kan ha problem: mönstret ”%s” förekommer flera "
 "gånger"
 
 msgid "disabling cone pattern matching"
@@ -15907,7 +16055,7 @@ msgstr "kunde inte skapa kataloger för %s"
 
 #, c-format
 msgid "could not migrate git directory from '%s' to '%s'"
-msgstr "kunde inte migrera git-katalog från \"%s\" till \"%s\""
+msgstr "kunde inte migrera git-katalog från ”%s” till ”%s”"
 
 #, c-format
 msgid "hint: Waiting for your editor to close the file...%c"
@@ -15915,22 +16063,22 @@ msgstr "tips: Väntar på att textredigeringsprogrammet ska stänga filen...%c"
 
 #, c-format
 msgid "could not write to '%s'"
-msgstr "kunde inte skriva till \"%s\""
+msgstr "kunde inte skriva till ”%s”"
 
 #, c-format
 msgid "could not edit '%s'"
-msgstr "kunde inte redigera \"%s\""
+msgstr "kunde inte redigera ”%s”"
 
 msgid "Filtering content"
 msgstr "Filtrerar innehåll"
 
 #, c-format
 msgid "could not stat file '%s'"
-msgstr "kunde inte ta status på filen \"%s\""
+msgstr "kunde inte ta status på filen ”%s”"
 
 #, c-format
 msgid "bad git namespace path \"%s\""
-msgstr "felaktig git-namnrymdssökväg \"%s\""
+msgstr "felaktig git-namnrymdssökväg ”%s”"
 
 #, c-format
 msgid "too many args to run %s"
@@ -15947,7 +16095,7 @@ msgstr "git fetch-pack: förväntade ACK/NAK, fick flush-paket"
 
 #, c-format
 msgid "git fetch-pack: expected ACK/NAK, got '%s'"
-msgstr "git fetch-pack: förväntade ACK/NAK, fick \"%s\""
+msgstr "git fetch-pack: förväntade ACK/NAK, fick ”%s”"
 
 msgid "unable to write to remote"
 msgstr "kunde inte skriva till fjärren"
@@ -15957,11 +16105,11 @@ msgstr "Servern stöder filter"
 
 #, c-format
 msgid "invalid shallow line: %s"
-msgstr "ogiltig \"shallow\"-rad: %s"
+msgstr "ogiltig ”shallow”-rad: %s"
 
 #, c-format
 msgid "invalid unshallow line: %s"
-msgstr "ogiltig \"unshallow\"-rad: %s"
+msgstr "ogiltig ”unshallow”-rad: %s"
 
 #, c-format
 msgid "object not found: %s"
@@ -15973,7 +16121,7 @@ msgstr "fel i objekt: %s"
 
 #, c-format
 msgid "no shallow found: %s"
-msgstr "ingen \"shallow\" hittades: %s"
+msgstr "ingen ”shallow” hittades: %s"
 
 #, c-format
 msgid "expected shallow/unshallow, got %s"
@@ -16060,7 +16208,7 @@ msgstr "omaka algoritmer: klient %s; server %s"
 
 #, c-format
 msgid "the server does not support algorithm '%s'"
-msgstr "servern stöder inte algoritmen \"%s\""
+msgstr "servern stöder inte algoritmen ”%s”"
 
 msgid "Server does not support shallow requests"
 msgstr "Servern stöder inte grunda förfrågningar"
@@ -16070,15 +16218,15 @@ msgstr "kunde inte skriva anrop till fjärren"
 
 #, c-format
 msgid "expected '%s', received '%s'"
-msgstr "förväntade \"%s\", tog emot \"%s\""
+msgstr "förväntade ”%s”, tog emot ”%s”"
 
 #, c-format
 msgid "expected '%s'"
-msgstr "förväntade \"%s\""
+msgstr "förväntade ”%s”"
 
 #, c-format
 msgid "unexpected acknowledgment line: '%s'"
-msgstr "oväntad bekräftelserad: \"%s\""
+msgstr "oväntad bekräftelserad: ”%s”"
 
 #, c-format
 msgid "error processing acks: %d"
@@ -16089,19 +16237,18 @@ msgstr "fel vid hantering av bekräftelser: %d"
 #.
 #, c-format
 msgid "expected packfile to be sent after '%s'"
-msgstr "väntade att paketfil skulle sändas efter \"%s\""
+msgstr "väntade att paketfil skulle sändas efter ”%s”"
 
 #. TRANSLATORS: The parameter will be 'ready', a protocol
 #. keyword.
 #.
 #, c-format
 msgid "expected no other sections to be sent after no '%s'"
-msgstr ""
-"väntade inte att några ytterligare sektioner skulle sändas efter \"%s\""
+msgstr "väntade inte att några ytterligare sektioner skulle sändas efter ”%s”"
 
 #, c-format
 msgid "error processing shallow info: %d"
-msgstr "fel vid hantering av grund (\"shallow\") info: %d"
+msgstr "fel vid hantering av grund (”shallow”) info: %d"
 
 #, c-format
 msgid "expected wanted-ref, got '%s'"
@@ -16109,7 +16256,7 @@ msgstr "förväntade wanted-ref, fick %s"
 
 #, c-format
 msgid "unexpected wanted-ref: '%s'"
-msgstr "oväntad wanted-ref: \"%s\""
+msgstr "oväntad wanted-ref: ”%s”"
 
 #, c-format
 msgid "error processing wanted refs: %d"
@@ -16122,7 +16269,7 @@ msgid "no matching remote head"
 msgstr "inget motsvarande fjärrhuvud"
 
 msgid "unexpected 'ready' from remote"
-msgstr "oväntat \"ready\" från fjärr"
+msgstr "oväntat ”ready” från fjärr"
 
 #, c-format
 msgid "no such remote ref %s"
@@ -16134,42 +16281,42 @@ msgstr "Servern tillåter inte förfrågan om ej tillkännagivet objekt %s"
 
 #, c-format
 msgid "fsmonitor_ipc__send_query: invalid path '%s'"
-msgstr "fsmonitor_ipc__send_query: ogilitg sökväg \"%s\""
+msgstr "fsmonitor_ipc__send_query: ogilitg sökväg ”%s”"
 
 #, c-format
 msgid "fsmonitor_ipc__send_query: unspecified error on '%s'"
-msgstr "fsmonitor_ipc__send_query: ospecificerat fel på \"%s\""
+msgstr "fsmonitor_ipc__send_query: ospecificerat fel på ”%s”"
 
 msgid "fsmonitor--daemon is not running"
 msgstr "fsmonitor--daemon kör inte"
 
 #, c-format
 msgid "could not send '%s' command to fsmonitor--daemon"
-msgstr "kunde inte sända kommandot \"%s\" till fsmonitor--daemon"
+msgstr "kunde inte sända kommandot ”%s” till fsmonitor--daemon"
 
 #, c-format
 msgid "bare repository '%s' is incompatible with fsmonitor"
-msgstr "naket arkiv \"%s\" är inkompatibelt med fsmonitor"
+msgstr "naket arkiv ”%s” är inkompatibelt med fsmonitor"
 
 #, c-format
 msgid "repository '%s' is incompatible with fsmonitor due to errors"
-msgstr "arkivet \"%s\" är inkompatibelt med fsmonitor på grund av fel"
+msgstr "arkivet ”%s” är inkompatibelt med fsmonitor på grund av fel"
 
 #, c-format
 msgid "remote repository '%s' is incompatible with fsmonitor"
-msgstr "fjärrarkivet \"%s\" är inkompatibelt med fsmonitor"
+msgstr "fjärrarkivet ”%s” är inkompatibelt med fsmonitor"
 
 #, c-format
 msgid "virtual repository '%s' is incompatible with fsmonitor"
-msgstr "det virtuella arkivet \"%s\" är inkompatibelt med fsmonitor"
+msgstr "det virtuella arkivet ”%s” är inkompatibelt med fsmonitor"
 
 #, c-format
 msgid ""
 "socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
 "sockets support"
 msgstr ""
-"uttagskatalogen \"%s\" är inkompatibelt med fsmonitor på grund av avsaknad "
-"av Unix-uttag"
+"uttagskatalogen ”%s” är inkompatibelt med fsmonitor på grund av avsaknad av "
+"Unix-uttag"
 
 msgid ""
 "git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
@@ -16193,18 +16340,18 @@ msgid ""
 "to read about a specific subcommand or concept.\n"
 "See 'git help git' for an overview of the system."
 msgstr ""
-"\"git help -a\" och \"git help -g\" visar tillgängliga underkommandon och\n"
-"några konceptvägledningar. Se \"git help <kommando>\" eller \"git help\n"
-"<koncept>\" för att läsa mer om specifika underkommandon och koncept.\n"
-"See \"git help git\" för en översikt över systemet."
+"”git help -a” och ”git help -g” visar tillgängliga underkommandon och\n"
+"några konceptvägledningar. Se ”git help <kommando>” eller ”git help\n"
+"<koncept> för att läsa mer om specifika underkommandon och koncept.\n"
+"See ”git help git” för en översikt över systemet."
 
 #, c-format
 msgid "unsupported command listing type '%s'"
-msgstr "okänd kommandolisttyp \"%s\""
+msgstr "okänd kommandolisttyp ”%s”"
 
 #, c-format
 msgid "no directory given for '%s' option\n"
-msgstr "ingen katalog angavs för flaggan \"%s\"\n"
+msgstr "ingen katalog angavs för flaggan ”%s”\n"
 
 #, c-format
 msgid "no namespace given for --namespace\n"
@@ -16228,15 +16375,15 @@ msgstr "okänd flagga: %s\n"
 
 #, c-format
 msgid "while expanding alias '%s': '%s'"
-msgstr "vid expandering av aliaset \"%s\": \"%s\""
+msgstr "vid expandering av aliaset ”%s”: ”%s”"
 
 #, c-format
 msgid ""
 "alias '%s' changes environment variables.\n"
 "You can use '!git' in the alias to do this"
 msgstr ""
-"aliaset \"%s\" ändrar miljövariabler.\n"
-"Du kan använda \"!git\" i aliaset för att göra det"
+"aliaset ”%s” ändrar miljövariabler.\n"
+"Du kan använda ”!git” i aliaset för att göra det"
 
 #, c-format
 msgid "empty alias for %s"
@@ -16257,7 +16404,7 @@ msgstr "stäng misslyckades på standard ut"
 
 #, c-format
 msgid "alias loop detected: expansion of '%s' does not terminate:%s"
-msgstr "alias-slinga detekterades: expansionen av \"%s\" avslutas aldrig:%s"
+msgstr "alias-slinga detekterades: expansionen av ”%s” avslutas aldrig:%s"
 
 #, c-format
 msgid "cannot handle %s as a builtin"
@@ -16274,18 +16421,18 @@ msgstr ""
 #, c-format
 msgid "expansion of alias '%s' failed; '%s' is not a git command\n"
 msgstr ""
-"expandering av alias \"%s\" misslyckades; \"%s\" är inte ett git-kommando\n"
+"expandering av alias ”%s” misslyckades; ”%s” är inte ett git-kommando\n"
 
 #, c-format
 msgid "failed to run command '%s': %s\n"
-msgstr "misslyckades köra kommandot \"%s\": %s\n"
+msgstr "misslyckades köra kommandot ”%s”: %s\n"
 
 msgid "could not create temporary file"
 msgstr "kunde inte skapa temporära fil"
 
 #, c-format
 msgid "failed writing detached signature to '%s'"
-msgstr "misslyckades skriva fristående signatur till \"%s\""
+msgstr "misslyckades skriva fristående signatur till ”%s”"
 
 msgid ""
 "gpg.ssh.allowedSignersFile needs to be configured and exist for ssh "
@@ -16298,7 +16445,7 @@ msgid ""
 "ssh-keygen -Y find-principals/verify is needed for ssh signature "
 "verification (available in openssh version 8.2p1+)"
 msgstr ""
-"\"ssh-keygen -Y find-principals/verify\" behövs för att bekräfta ssh-"
+"”ssh-keygen -Y find-principals/verify” behövs för att bekräfta ssh-"
 "signaturer (tillgängligt i openssh version 8.2p1+)"
 
 #, c-format
@@ -16307,11 +16454,11 @@ msgstr "återkallningsfilen för ssh-signering inställd men saknas: %s"
 
 #, c-format
 msgid "bad/incompatible signature '%s'"
-msgstr "felaktig/inkompatibel signatur \"%s\""
+msgstr "felaktig/inkompatibel signatur ”%s”"
 
 #, c-format
 msgid "failed to get the ssh fingerprint for key '%s'"
-msgstr "misslyckades hämta ssh-fingeravtrycket för nyckeln \"%s\""
+msgstr "misslyckades hämta ssh-fingeravtrycket för nyckeln ”%s”"
 
 msgid ""
 "either user.signingkey or gpg.ssh.defaultKeyCommand needs to be configured"
@@ -16339,26 +16486,26 @@ msgstr "user.signingKey måste anges för ssh-signering"
 
 #, c-format
 msgid "failed writing ssh signing key to '%s'"
-msgstr "misslyckades skriva ssh-signeringsnyckel till \"%s\""
+msgstr "misslyckades skriva ssh-signeringsnyckel till ”%s”"
 
 #, c-format
 msgid "failed writing ssh signing key buffer to '%s'"
-msgstr "misslyckades skriva ssh-signeringsnyckelbuffert till \"%s\""
+msgstr "misslyckades skriva ssh-signeringsnyckelbuffert till ”%s”"
 
 msgid ""
 "ssh-keygen -Y sign is needed for ssh signing (available in openssh version "
 "8.2p1+)"
 msgstr ""
-"\"ssh-keygen -Y sign\" behövs för ssh-signering (tillgängligt i openssh "
+"”ssh-keygen -Y sign” behövs för ssh-signering (tillgängligt i openssh "
 "version 8.2p1+)"
 
 #, c-format
 msgid "failed reading ssh signing data buffer from '%s'"
-msgstr "misslyckades läsa ssh-signeringsdatabuffert från \"%s\""
+msgstr "misslyckades läsa ssh-signeringsdatabuffert från ”%s”"
 
 #, c-format
 msgid "ignored invalid color '%.*s' in log.graphColors"
-msgstr "ignorerade felaktig färg \"%.*s\" i log.graphColors"
+msgstr "ignorerade felaktig färg ”%.*s” i log.graphColors"
 
 msgid ""
 "given pattern contains NULL byte (via -f <file>). This is only supported "
@@ -16369,11 +16516,11 @@ msgstr ""
 
 #, c-format
 msgid "'%s': unable to read %s"
-msgstr "\"%s\" kunde inte läsa %s"
+msgstr "”%s” kunde inte läsa %s"
 
 #, c-format
 msgid "'%s': short read"
-msgstr "\"%s\": kort läsning"
+msgstr "”%s”: kort läsning"
 
 msgid "start a working area (see also: git help tutorial)"
 msgstr "starta arbetskatalog (se också: git help tutorial)"
@@ -16422,7 +16569,7 @@ msgstr "Filformat, protokoll och andra gränssnitt tänkta för utvecklare"
 
 #, c-format
 msgid "available git commands in '%s'"
-msgstr "git-kommandon tillgängliga i \"%s\""
+msgstr "git-kommandon tillgängliga i ”%s”"
 
 msgid "git commands available from elsewhere on your $PATH"
 msgstr "git-kommandon från andra platser i din $PATH"
@@ -16446,39 +16593,39 @@ msgid "Command aliases"
 msgstr "Kommadoalias"
 
 msgid "See 'git help <command>' to read about a specific subcommand"
-msgstr "Se \"git help <kommando>\" för att läsa om ett specifikt underkommando"
+msgstr "Se ”git help <kommando>” för att läsa om ett specifikt underkommando"
 
 #, c-format
 msgid ""
 "'%s' appears to be a git command, but we were not\n"
 "able to execute it. Maybe git-%s is broken?"
 msgstr ""
-"\"%s\" verkar vara ett git-kommando, men vi kan inte\n"
+"”%s” verkar vara ett git-kommando, men vi kan inte\n"
 "köra det. Kanske git-%s är trasigt?"
 
 #, c-format
 msgid "git: '%s' is not a git command. See 'git --help'."
-msgstr "git: \"%s\" är inte ett git-kommando. Se \"git --help\"."
+msgstr "git: ”%s” är inte ett git-kommando. Se ”git --help”."
 
 msgid "Uh oh. Your system reports no Git commands at all."
 msgstr "Oj då. Ditt system rapporterar inga Git-kommandon alls."
 
 #, c-format
 msgid "WARNING: You called a Git command named '%s', which does not exist."
-msgstr "VARNING: Du anropade ett Git-kommando vid namn \"%s\", som inte finns."
+msgstr "VARNING: Du anropade ett Git-kommando vid namn ”%s”, som inte finns."
 
 #, c-format
 msgid "Continuing under the assumption that you meant '%s'."
-msgstr "Fortsätter under förutsättningen att du menade \"%s\"."
+msgstr "Fortsätter under förutsättningen att du menade ”%s”."
 
 #, c-format
 msgid "Run '%s' instead [y/N]? "
-msgstr "Köra \"%s\" istället (j/N)?"
+msgstr "Köra ”%s” istället (j/N)?"
 
 #, c-format
 msgid "Continuing in %0.1f seconds, assuming that you meant '%s'."
 msgstr ""
-"Fortsätter om %0.1f sekunder, under förutsättningen att du menade \"%s\"."
+"Fortsätter om %0.1f sekunder, under förutsättningen att du menade ”%s”."
 
 msgid ""
 "\n"
@@ -16518,8 +16665,8 @@ msgid ""
 "The '%s' hook was ignored because it's not set as executable.\n"
 "You can disable this warning with `git config advice.ignoredHook false`."
 msgstr ""
-"Kroken \"%s\" ignorerades eftersom den inte är markerad som körbar.\n"
-"Du kan inaktivera varningen med \"git config advice.ignoredHook false\"."
+"Kroken ”%s” ignorerades eftersom den inte är markerad som körbar.\n"
+"Du kan inaktivera varningen med ”git config advice.ignoredHook false”."
 
 #, c-format
 msgid "argument to --packfile must be a valid hash (got '%s')"
@@ -16544,15 +16691,15 @@ msgstr "CURLSSLOPT_NO_REVOKE stöds inte av cURL < 7.44.0"
 
 #, c-format
 msgid "Unsupported SSL backend '%s'. Supported SSL backends:"
-msgstr "SSL-bakändan \"%s\" stöds inte. Dessa SSL-bakändor stöds:"
+msgstr "SSL-bakändan ”%s” stöds inte. Dessa SSL-bakändor stöds:"
 
 #, c-format
 msgid "Could not set SSL backend to '%s': cURL was built without SSL backends"
-msgstr "Kan inte sätta SSL-bakända till \"%s\": cURL byggdes utan SSL-bakändor"
+msgstr "Kan inte sätta SSL-bakända till ”%s”: cURL byggdes utan SSL-bakändor"
 
 #, c-format
 msgid "Could not set SSL backend to '%s': already set"
-msgstr "Kunde inte sätta SSL-bakända till \"%s\": redan valt"
+msgstr "Kunde inte sätta SSL-bakända till ”%s”: redan valt"
 
 #, c-format
 msgid ""
@@ -16600,14 +16747,14 @@ msgstr "ingen e-post angavs och autodetektering är inaktiverad"
 
 #, c-format
 msgid "unable to auto-detect email address (got '%s')"
-msgstr "kunde inte autodetektera e-postadress (fick \"%s\")"
+msgstr "kunde inte autodetektera e-postadress (fick ”%s”)"
 
 msgid "no name was given and auto-detection is disabled"
 msgstr "inget namn angavs och autodetektering är inaktiverad"
 
 #, c-format
 msgid "unable to auto-detect name (got '%s')"
-msgstr "kunde inte autodetektera namn (fick \"%s\")"
+msgstr "kunde inte autodetektera namn (fick ”%s”)"
 
 #, c-format
 msgid "empty ident name (for <%s>) not allowed"
@@ -16618,22 +16765,22 @@ msgid "name consists only of disallowed characters: %s"
 msgstr "namnet består enbart av ej tillåtna tecken: %s"
 
 msgid "expected 'tree:<depth>'"
-msgstr "förväntade \"tree:<djup>\""
+msgstr "förväntade ”tree:<djup>”"
 
 msgid "sparse:path filters support has been dropped"
 msgstr "sparse:sökväg-filter stöds inte längre"
 
 #, c-format
 msgid "'%s' for 'object:type=<type>' is not a valid object type"
-msgstr "\"%s\" för \"object:type=<typ>\" är inte en giltig objekttyp"
+msgstr "”%s” för ”object:type=<typ>” är inte en giltig objekttyp"
 
 #, c-format
 msgid "invalid filter-spec '%s'"
-msgstr "felaktig filterspecifikation: \"%s\""
+msgstr "felaktig filterspecifikation: ”%s”"
 
 #, c-format
 msgid "must escape char in sub-filter-spec: '%c'"
-msgstr "måste använda specialsekvens i delfilter-spec: \"%c\""
+msgstr "måste använda specialsekvens i delfilter-spec: ”%c”"
 
 msgid "expected something after combine:"
 msgstr "förväntade någonting efter combine:"
@@ -16652,7 +16799,7 @@ msgstr "objektfiltrering"
 
 #, c-format
 msgid "unable to access sparse blob in '%s'"
-msgstr "kunde inte nå gles blob på \"%s\""
+msgstr "kunde inte nå gles blob på ”%s”"
 
 #, c-format
 msgid "unable to parse sparse filter data in %s"
@@ -16660,11 +16807,11 @@ msgstr "kunde inte tolka gles filterdata i %s"
 
 #, c-format
 msgid "entry '%s' in tree %s has tree mode, but is not a tree"
-msgstr "posten \"%s\" i trädet %s har träd-läge, men är inte ett träd"
+msgstr "posten ”%s” i trädet %s har träd-läge, men är inte ett träd"
 
 #, c-format
 msgid "entry '%s' in tree %s has blob mode, but is not a blob"
-msgstr "posten \"%s\" i trädet %s har blob-läge, men är inte en blob"
+msgstr "posten ”%s” i trädet %s har blob-läge, men är inte en blob"
 
 #, c-format
 msgid "unable to load root tree for commit %s"
@@ -16680,10 +16827,10 @@ msgid ""
 "may have crashed in this repository earlier:\n"
 "remove the file manually to continue."
 msgstr ""
-"Kunde inte skapa \"%s.lock\": %s.\n"
+"Kunde inte skapa ”%s.lock”: %s.\n"
 "\n"
 "Det verkar som en annan git-process kör i det här arkivet, t.ex.\n"
-"ett textredigeringsprogram startat av \"git commit\". Se till att\n"
+"ett textredigeringsprogram startat av ”git commit”. Se till att\n"
 "alla processer avslutats och försök sedan igen. Om det fortfarande\n"
 "misslyckas kanske en git-process har kraschat i det här arkivet\n"
 "tidigare:\n"
@@ -16691,14 +16838,14 @@ msgstr ""
 
 #, c-format
 msgid "Unable to create '%s.lock': %s"
-msgstr "Kunde inte skapa \"%s.lock\": %s"
+msgstr "Kunde inte skapa ”%s.lock”: %s"
 
 #, c-format
 msgid "unexpected line: '%s'"
-msgstr "oväntad rad: \"%s\""
+msgstr "oväntad rad: ”%s”"
 
 msgid "expected flush after ls-refs arguments"
-msgstr "förväntade \"flush\" efter ls-refs-argument"
+msgstr "förväntade ”flush” efter ls-refs-argument"
 
 msgid "quoted CRLF detected"
 msgstr "citerad CRLF upptäcktes"
@@ -16743,12 +16890,12 @@ msgstr ""
 "finns:\n"
 "%s"
 
-msgid "Failed to execute internal merge"
-msgstr "Misslyckades exekvera intern sammanslagning"
+msgid "failed to execute internal merge"
+msgstr "misslyckades exekvera intern sammanslagning"
 
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "Kunde inte lägga till %s till databasen"
+msgid "unable to add %s to database"
+msgstr "kunde inte lägga till %s till databasen"
 
 #, c-format
 msgid "Auto-merging %s"
@@ -16785,7 +16932,7 @@ msgid ""
 "WARNING: Avoiding applying %s -> %s rename to %s, because %s itself was "
 "renamed."
 msgstr ""
-"VARNING: Undviker att applicera namnändring %s -> %s på %s, då %s själv har "
+"VARNING: Undviker att applicera namnändring %s  %s på %s, då %s själv har "
 "bytt namn."
 
 #, c-format
@@ -16831,7 +16978,7 @@ msgid ""
 "conflicts AND collides with another path; this may result in nested conflict "
 "markers."
 msgstr ""
-"KONFLIKT (namnbyte involverad i krock): namnbyte av %s -> %s har "
+"KONFLIKT (namnbyte involverad i krock): namnbyte av %s  %s har "
 "innehållskonflikter OCH krockar med en annan sökväg; detta kan leda till "
 "nästlade konfliktmarkörer."
 
@@ -16946,17 +17093,17 @@ msgstr "(felaktig incheckning)\n"
 #, c-format
 msgid "add_cacheinfo failed for path '%s'; merge aborting."
 msgstr ""
-"add_cacheinfo misslyckades för sökvägen \"%s\"; avslutar sammanslagningen."
+"add_cacheinfo misslyckades för sökvägen ”%s”; avslutar sammanslagningen."
 
 #, c-format
 msgid "add_cacheinfo failed to refresh for path '%s'; merge aborting."
 msgstr ""
-"add_cacheinfo misslyckades uppdatera för sökvägen \"%s\"; avslutar "
+"add_cacheinfo misslyckades uppdatera för sökvägen ”%s”; avslutar "
 "sammanslagningen."
 
 #, c-format
 msgid "failed to create path '%s'%s"
-msgstr "misslyckades skapa sökvägen \"%s\"%s"
+msgstr "misslyckades skapa sökvägen ”%s”%s"
 
 #, c-format
 msgid "Removing %s to make room for subdirectory\n"
@@ -16967,23 +17114,23 @@ msgstr ": kanske en K/F-konflikt?"
 
 #, c-format
 msgid "refusing to lose untracked file at '%s'"
-msgstr "vägrar förlora ospårad fil vid \"%s\""
+msgstr "vägrar förlora ospårad fil vid ”%s”"
 
 #, c-format
 msgid "blob expected for %s '%s'"
-msgstr "blob förväntades för %s \"%s\""
+msgstr "blob förväntades för %s ”%s”"
 
 #, c-format
 msgid "failed to open '%s': %s"
-msgstr "misslyckades öppna \"%s\": %s"
+msgstr "misslyckades öppna ”%s”: %s"
 
 #, c-format
 msgid "failed to symlink '%s': %s"
-msgstr "misslyckades skapa symboliska länken \"%s\": %s"
+msgstr "misslyckades skapa symboliska länken ”%s”: %s"
 
 #, c-format
 msgid "do not know what to do with %06o %s '%s'"
-msgstr "vet inte hur %06o %s \"%s\" ska hanteras"
+msgstr "vet inte hur %06o %s ”%s” ska hanteras"
 
 #, c-format
 msgid "Fast-forwarding submodule %s to the following commit:"
@@ -17071,7 +17218,7 @@ msgstr "namnbytt"
 
 #, c-format
 msgid "Refusing to lose dirty file at %s"
-msgstr "Vägrar förlora lortig fil vid \"%s\""
+msgstr "Vägrar förlora lortig fil vid ”%s”"
 
 #, c-format
 msgid "Refusing to lose untracked file at %s, even though it's in the way."
@@ -17079,7 +17226,7 @@ msgstr "Vägrar förlora ospårad fil vid %s, trots att den är i vägen."
 
 #, c-format
 msgid "CONFLICT (rename/add): Rename %s->%s in %s.  Added %s in %s"
-msgstr "KONFLIKT (namnbyte/tillägg): Namnbyte %s->%s i %s. Lade till %s i %s"
+msgstr "KONFLIKT (namnbyte/tillägg): Namnbyte %s%s i %s. Lade till %s i %s"
 
 #, c-format
 msgid "%s is a directory in %s adding as %s instead"
@@ -17091,19 +17238,18 @@ msgstr "Vägrar förlora ospårad fil vid %s; lägger till som %s istället"
 
 #, c-format
 msgid ""
-"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename \"%s"
-"\"->\"%s\" in \"%s\"%s"
+"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename "
+"\"%s\"->\"%s\" in \"%s\"%s"
 msgstr ""
-"KONFLIKT (namnbyte/namnbyte): Namnbyte \"%s\"->\"%s\" på grenen \"%s\" "
-"namnbyte \"%s\"->\"%s\" i \"%s\"%s"
+"KONFLIKT (namnbyte/namnbyte): Namnbyte ”%s”→”%s” på grenen ”%s” namnbyte "
+"”%s”→”%s” i ”%s”%s"
 
 msgid " (left unresolved)"
 msgstr " (lämnad olöst)"
 
 #, c-format
 msgid "CONFLICT (rename/rename): Rename %s->%s in %s. Rename %s->%s in %s"
-msgstr ""
-"KONFLIKT (namnbyte/namnbyte): Namnbyte %s->%s i %s. Namnbyte %s->%s i %s"
+msgstr "KONFLIKT (namnbyte/namnbyte): Namnbyte %s→%s i %s. Namnbyte %s→%s i %s"
 
 #, c-format
 msgid ""
@@ -17120,8 +17266,8 @@ msgid ""
 "CONFLICT (rename/rename): Rename directory %s->%s in %s. Rename directory %s-"
 ">%s in %s"
 msgstr ""
-"KONFLIKT (namnbyte/namnbyte): Namnbytt katalog %s->%s i %s. Namnbytt katalog "
-"%s->%s i %s"
+"KONFLIKT (namnbyte/namnbyte): Namnbytt katalog %s%s i %s. Namnbytt katalog "
+"%s%s i %s"
 
 msgid "modify"
 msgstr "ändra"
@@ -17178,13 +17324,25 @@ msgstr "sammanslagningen returnerade ingen incheckning"
 
 #, c-format
 msgid "Could not parse object '%s'"
-msgstr "Kunde inte tolka objektet \"%s\""
+msgstr "Kunde inte tolka objektet ”%s”"
 
 msgid "failed to read the cache"
 msgstr "misslyckades läsa cachen"
 
 msgid "multi-pack-index OID fanout is of the wrong size"
-msgstr "multi-pack-indexets OID-utbredning har fel storlek"
+msgstr "OID-utbredning för multi-pack-index har fel storlek"
+
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"oid-utbredning i fel ordning: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "OID-uppslagningsstycket för multi-pack-index har fel storlek"
+
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr "objekt-offset-stycket för multi-pack-index har fel storlek"
 
 #, c-format
 msgid "multi-pack-index file %s is too small"
@@ -17202,36 +17360,54 @@ msgstr "multi-pack-indexversionen %d stöds inte"
 msgid "multi-pack-index hash version %u does not match version %u"
 msgstr "multi-pack-index-hashversionen %u stämmer inte med versionen %u"
 
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "multi-pack-index saknar krävd paketnamn-stycke"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr ""
+"nödvändigt paketnamn-stycke för multi-pack-index saknas eller är trasigt"
+
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr ""
+"nödvändigt OID-utbredningsstycke för multi-pack-index saknas eller är trasigt"
 
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "multi-pack-index saknar krävt OID-utbredningsstycke"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr ""
+"nödvändigt OID-uppslagningsstycke för multi-pack-index saknas eller är "
+"trasigt"
 
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "multi-pack-index saknar krävt OID-uppslagnignsstycke"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr ""
+"nödvändigt objekt-offsetstycke för multi-pack-index saknas eller är trasigt"
 
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "multi-pack-index saknar krävt objekt-offsetstycke"
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "paketnamnstycke för multi-pack-index är för kort"
 
 #, c-format
 msgid "multi-pack-index pack names out of order: '%s' before '%s'"
-msgstr "multi-pack-index-paketnamn i fel ordning: \"%s\" före \"%s\""
+msgstr "paketnamn för multi-pack-index i fel ordning: ”%s” före ”%s”"
 
 #, c-format
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "bad pack-int-id: %u (%u paket totalt)"
 
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "MIDX innehåller inte BTMP-stycket"
+
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "kunde inte läsa det bitmappade paketet %<PRIu32>"
+
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
-msgstr "multi-pack-index skriver 64-bitars offset, men off_t är för liten"
+msgstr "multi-pack-index innehåller 64-bitars offset, men off_t är för liten"
+
+msgid "multi-pack-index large offset out of bounds"
+msgstr "stort offset för mult-pack-index utanför gränsen"
 
 #, c-format
 msgid "failed to add packfile '%s'"
-msgstr "misslyckades läsa paketfilen \"%s\""
+msgstr "misslyckades läsa paketfilen ”%s”"
 
 #, c-format
 msgid "failed to open pack-index '%s'"
-msgstr "misslyckades öppna paketindexet \"%s\""
+msgstr "misslyckades öppna paketindexet ”%s”"
 
 #, c-format
 msgid "failed to locate object %d in packfile"
@@ -17275,7 +17451,7 @@ msgstr "såg inte paketfilen %s som skulle kastas"
 
 #, c-format
 msgid "preferred pack '%s' is expired"
-msgstr "föredraget paket \"%s\" har löpt ut"
+msgstr "föredraget paket ”%s” har löpt ut"
 
 msgid "no pack files to index."
 msgstr "inga paketfiler att indexera."
@@ -17302,12 +17478,6 @@ msgstr "felaktig kontrollsumma"
 msgid "Looking for referenced packfiles"
 msgstr "Ser efter refererade packfiler"
 
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr ""
-"oid-utbredning i fel ordning: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-
 msgid "the midx contains no oid"
 msgstr "midx saknar oid"
 
@@ -17367,9 +17537,9 @@ msgid ""
 "commit/abort the previous merge before you start a new notes merge."
 msgstr ""
 "Du har inte avslutat föregående antecknings-sammanslagning (%s finns).\n"
-"Använd \"git notes merge --commit\" eller \"git notes merge --abort\" för "
-"att checka in eller avbryta föregående sammanslagning innan du påbörjar en "
-"ny antecknings-sammanslagning."
+"Använd ”git notes merge --commit” eller ”git notes merge --abort” för att "
+"checka in eller avbryta föregående sammanslagning innan du påbörjar en ny "
+"antecknings-sammanslagning."
 
 #, c-format
 msgid "You have not concluded your notes merge (%s exists)."
@@ -17392,7 +17562,7 @@ msgstr "Vägrar skriva över anteckningar i %s (utanför refs/notes/)"
 #.
 #, c-format
 msgid "Bad %s value: '%s'"
-msgstr "Felaktigt värde på %s: \"%s\""
+msgstr "Felaktigt värde på %s: ”%s”"
 
 #, c-format
 msgid "object directory %s does not exist; check .git/objects/info/alternates"
@@ -17407,33 +17577,33 @@ msgid "%s: ignoring alternate object stores, nesting too deep"
 msgstr "%s: ignorerar supplerande objektlager, för djup nästling"
 
 msgid "unable to fdopen alternates lockfile"
-msgstr "kan inte utföra \"fdopen\" på suppleantlåsfil"
+msgstr "kan inte utföra ”fdopen” på suppleantlåsfil"
 
 msgid "unable to read alternates file"
-msgstr "kan inte läsa \"alternates\"-filen"
+msgstr "kan inte läsa ”alternates”-filen"
 
 msgid "unable to move new alternates file into place"
-msgstr "kan inte flytta ny \"alternates\"-fil på plats"
+msgstr "kan inte flytta ny ”alternates”-fil på plats"
 
 #, c-format
 msgid "path '%s' does not exist"
-msgstr "sökvägen \"%s\" finns inte"
+msgstr "sökvägen ”%s” finns inte"
 
 #, c-format
 msgid "reference repository '%s' as a linked checkout is not supported yet."
-msgstr "referensarkivet \"%s\" som en länkad utcheckning stöds inte ännu."
+msgstr "referensarkivet ”%s” som en länkad utcheckning stöds inte ännu."
 
 #, c-format
 msgid "reference repository '%s' is not a local repository."
-msgstr "referensarkivet \"%s\" är inte ett lokalt arkiv."
+msgstr "referensarkivet ”%s” är inte ett lokalt arkiv."
 
 #, c-format
 msgid "reference repository '%s' is shallow"
-msgstr "referensarkivet \"%s\" är grunt"
+msgstr "referensarkivet ”%s” är grunt"
 
 #, c-format
 msgid "reference repository '%s' is grafted"
-msgstr "referensarkivet \"%s\" är ympat"
+msgstr "referensarkivet ”%s” är ympat"
 
 #, c-format
 msgid "could not find object directory matching %s"
@@ -17445,7 +17615,7 @@ msgstr "felaktig rad vid tolkning av supplerande referenser: %s"
 
 #, c-format
 msgid "attempting to mmap %<PRIuMAX> over limit %<PRIuMAX>"
-msgstr "försök att utföra \"mmap\" på %<PRIuMAX> över gränsen %<PRIuMAX>"
+msgstr "försök att utföra ”mmap” på %<PRIuMAX> över gränsen %<PRIuMAX>"
 
 #, c-format
 msgid "mmap failed%s"
@@ -17457,11 +17627,11 @@ msgstr "objektfilen %s är tom"
 
 #, c-format
 msgid "corrupt loose object '%s'"
-msgstr "trasigt löst objekt \"%s\""
+msgstr "trasigt löst objekt ”%s”"
 
 #, c-format
 msgid "garbage at end of loose object '%s'"
-msgstr "skräp i slutet av löst objekt \"%s\""
+msgstr "skräp i slutet av löst objekt ”%s”"
 
 #, c-format
 msgid "unable to open loose object %s"
@@ -17500,7 +17670,7 @@ msgstr "kunde inte skriva filen %s"
 
 #, c-format
 msgid "unable to set permission to '%s'"
-msgstr "kan inte sätta behörigheten till \"%s\""
+msgstr "kan inte sätta behörigheten till ”%s”"
 
 msgid "error when closing loose object file"
 msgstr "fel vid stängning av fil för löst objekt"
@@ -17518,11 +17688,11 @@ msgstr "kunde inte skriva fil för löst objekt"
 
 #, c-format
 msgid "unable to deflate new object %s (%d)"
-msgstr "kan inte utföra \"deflate\" på nytt objekt %s (%d)"
+msgstr "kan inte utföra ”deflate” på nytt objekt %s (%d)"
 
 #, c-format
 msgid "deflateEnd on object %s failed (%d)"
-msgstr "\"deflateend\" på objektet %s misslyckades (%d)"
+msgstr "”deflateEnd” på objektet %s misslyckades (%d)"
 
 #, c-format
 msgid "confused by unstable object source data for %s"
@@ -17534,11 +17704,11 @@ msgstr "skriv strömobjektet %ld != %<PRIuMAX>"
 
 #, c-format
 msgid "unable to stream deflate new object (%d)"
-msgstr "kan inte utföra \"deflate\" på nytt strömobjekt (%d)"
+msgstr "kan inte utföra ”deflate” på nytt strömobjekt (%d)"
 
 #, c-format
 msgid "deflateEnd on stream object failed (%d)"
-msgstr "\"deflateend\" på strömobjektet misslyckades (%d)"
+msgstr "”deflatEend” på strömobjektet misslyckades (%d)"
 
 #, c-format
 msgid "unable to create directory %s"
@@ -17573,7 +17743,7 @@ msgstr "%s: filtypen stöds ej"
 
 #, c-format
 msgid "%s is not a valid '%s' object"
-msgstr "%s är inte ett giltigt \"%s\"-objekt"
+msgstr "%s är inte ett giltigt ”%s”-objekt"
 
 #, c-format
 msgid "unable to open %s"
@@ -17585,7 +17755,7 @@ msgstr "hash stämmer inte för %s (förväntade %s)"
 
 #, c-format
 msgid "unable to mmap %s"
-msgstr "kan inte utföra \"mmap\" för %s"
+msgstr "kan inte utföra ”mmap” för %s"
 
 #, c-format
 msgid "unable to unpack header of %s"
@@ -17688,72 +17858,72 @@ msgstr ""
 "\n"
 "  git switch -c $br $(git rev-parse ...)\n"
 "\n"
-"där \"$br\" på något sätt blivit tomt och en 40-hex-referens skapats.\n"
+"där ”$br” på något sätt blivit tomt och en 40-hex-referens skapats.\n"
 "Undersök referenserna och ta kanske bort dem. Stäng av meddelandet\n"
-"genom att köra \"git config advice.objectNameWarning false\""
+"genom att köra ”git config advice.objectNameWarning false”"
 
 #, c-format
 msgid "log for '%.*s' only goes back to %s"
-msgstr "loggen för \"%.*s\" räcker bara tillbaka till %s"
+msgstr "loggen för ”%.*s” räcker bara tillbaka till %s"
 
 #, c-format
 msgid "log for '%.*s' only has %d entries"
-msgstr "loggen för \"%.*s\" har bara %d poster"
+msgstr "loggen för ”%.*s” har bara %d poster"
 
 #, c-format
 msgid "path '%s' exists on disk, but not in '%.*s'"
-msgstr "Sökvägen \"%s\" finns på disken, men inte i \"%.*s\""
+msgstr "Sökvägen ”%s” finns på disken, men inte i ”%.*s”"
 
 #, c-format
 msgid ""
 "path '%s' exists, but not '%s'\n"
 "hint: Did you mean '%.*s:%s' aka '%.*s:./%s'?"
 msgstr ""
-"sökvägen \"%s\" finns, men inte i \"%s\"\n"
-"tips: Menade du \"%.*s:%s\", även känd som \"%.*s:./%s\"?"
+"sökvägen ”%s” finns, men inte i ”%s”\n"
+"tips: Menade du ”%.*s:%s”, även känd som ”%.*s:./%s”?"
 
 #, c-format
 msgid "path '%s' does not exist in '%.*s'"
-msgstr "sökvägen \"%s\" finns inte i \"%.*s\""
+msgstr "sökvägen ”%s” finns inte i ”%.*s”"
 
 #, c-format
 msgid ""
 "path '%s' is in the index, but not at stage %d\n"
 "hint: Did you mean ':%d:%s'?"
 msgstr ""
-"sökvägen \"%s\" finns i indexet men inte i etapp %d\n"
-"tips: Menade du \":%d:%s\"?"
+"sökvägen ”%s” finns i indexet men inte i etapp %d\n"
+"tips: Menade du ”:%d:%s”?"
 
 #, c-format
 msgid ""
 "path '%s' is in the index, but not '%s'\n"
 "hint: Did you mean ':%d:%s' aka ':%d:./%s'?"
 msgstr ""
-"sökvägen \"%s\" finns i indexet, men inte i \"%s\"\n"
-"tips: Menade du \":%d:%s\", även känd som \":%d:./%s\"?"
+"sökvägen ”%s” finns i indexet, men inte i ”%s”\n"
+"tips: Menade du ”:%d:%s”, även känd som ”:%d:./%s”?"
 
 #, c-format
 msgid "path '%s' exists on disk, but not in the index"
-msgstr "sökvägen \"%s\" finns på disk, men inte i indexet"
+msgstr "sökvägen ”%s” finns på disk, men inte i indexet"
 
 #, c-format
 msgid "path '%s' does not exist (neither on disk nor in the index)"
-msgstr "sökvägen \"%s\" finns inte (varken i disken eller i indexet)"
+msgstr "sökvägen ”%s” finns inte (varken i disken eller i indexet)"
 
 msgid "relative path syntax can't be used outside working tree"
 msgstr "relativ sökväg kan inte användas utanför arbetskatalogen"
 
 #, c-format
 msgid "<object>:<path> required, only <object> '%s' given"
-msgstr "<objekt>:<sökväg> krävs, endast <objekt> \"%s\" har angivits"
+msgstr "<objekt>:<sökväg> krävs, endast <objekt> ”%s” har angivits"
 
 #, c-format
 msgid "invalid object name '%.*s'."
-msgstr "felaktigt objektnamn \"%.*s\"."
+msgstr "felaktigt objektnamn ”%.*s”."
 
 #, c-format
 msgid "invalid object type \"%s\""
-msgstr "ogiltig objekttyp \"%s\""
+msgstr "ogiltig objekttyp ”%s”"
 
 #, c-format
 msgid "object %s is a %s, not a %s"
@@ -17785,7 +17955,7 @@ msgstr "trasigt bitkarteindex (felaktigt huvud)"
 
 #, c-format
 msgid "unsupported version '%d' for bitmap index file"
-msgstr "versionen \"%d\" i bitkarteindexfilen stöds inte"
+msgstr "versionen ”%d” i bitkarteindexfilen stöds inte"
 
 msgid "corrupted bitmap index file (too short to fit hash cache)"
 msgstr "trasigt bitkarteindex (för kort för att få plats för hash-cache)"
@@ -17795,7 +17965,7 @@ msgstr "trasigt bitkarteindex (för kort för att få plats för uppslagstabell)
 
 #, c-format
 msgid "duplicate entry in bitmap index: '%s'"
-msgstr "duplicerad post i bitkarteindex: \"%s\""
+msgstr "duplicerad post i bitkarteindex: ”%s”"
 
 #, c-format
 msgid "corrupt ewah bitmap: truncated header for entry %d"
@@ -17812,7 +17982,7 @@ msgid "invalid XOR offset in bitmap pack index"
 msgstr "ogiltigt XOR-offset i bitkarte-packindex"
 
 msgid "cannot fstat bitmap file"
-msgstr "kan inte utföra \"fstat\" på bitkartefil"
+msgstr "kan inte utföra ”fstat” på bitkartefil"
 
 msgid "checksum doesn't match in MIDX and bitmap"
 msgstr "checksumman stämmer inte i MIDX och bitkarta"
@@ -17824,6 +17994,9 @@ msgstr "flerpaketsbitkarta saknar nödvändigt omvänt index"
 msgid "could not open pack %s"
 msgstr "kunde inte öppna paketfilen %s"
 
+msgid "could not determine MIDX preferred pack"
+msgstr "kunde inte bestämma det föredragna MIDX-paketet"
+
 #, c-format
 msgid "preferred pack (%s) is invalid"
 msgstr "föredragen paketfil (%s) är ogiltig"
@@ -17841,20 +18014,23 @@ msgstr ""
 
 #, c-format
 msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
-msgstr ""
-"trasig ewah-bitkarta: avhugget huvud för bitkarta för incheckning \"%s\""
+msgstr "trasig ewah-bitkarta: avhugget huvud för bitkarta för incheckning ”%s”"
+
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr "kunde inte läsa paketet: ”%s”, inaktiverar återanvändning av paket"
 
 #, c-format
 msgid "object '%s' not found in type bitmaps"
-msgstr "objektet \"%s\" hittades inte i typbitkartor"
+msgstr "objektet ”%s” hittades inte i typbitkartor"
 
 #, c-format
 msgid "object '%s' does not have a unique type"
-msgstr "objektet \"%s\" har inte en unik typ"
+msgstr "objektet ”%s” har inte en unik typ"
 
 #, c-format
 msgid "object '%s': real type '%s', expected: '%s'"
-msgstr "objektet \"%s\": riktig typ \"%s\", förväntade \"%s\""
+msgstr "objektet ”%s”: riktig typ ”%s”, förväntade ”%s”"
 
 #, c-format
 msgid "object not in bitmap: '%s'"
@@ -17868,22 +18044,22 @@ msgstr "du måste ange exakt en incheckning att testa"
 
 #, c-format
 msgid "commit '%s' doesn't have an indexed bitmap"
-msgstr "incheckningen \"%s\" har inte en indexerad bitkarta"
+msgstr "incheckningen ”%s” har inte en indexerad bitkarta"
 
 msgid "mismatch in bitmap results"
 msgstr "bitkarteresultat stämmer inte överens"
 
 #, c-format
 msgid "could not find '%s' in pack '%s' at offset %<PRIuMAX>"
-msgstr "kunde inte hitta \"%s\" i paketet \"%s\" på offset %<PRIuMAX>"
+msgstr "kunde inte hitta ”%s” i paketet ”%s” på offset %<PRIuMAX>"
 
 #, c-format
 msgid "unable to get disk usage of '%s'"
-msgstr "kan inte hämta diskanvändning för \"%s\""
+msgstr "kan inte hämta diskanvändning för ”%s”"
 
 #, c-format
 msgid "bitmap file '%s' has invalid checksum"
-msgstr "bitkartefilen \"%s\" har ogiltig kontrollsumma"
+msgstr "bitkartefilen ”%s” har ogiltig kontrollsumma"
 
 #, c-format
 msgid "mtimes file %s is too small"
@@ -17932,6 +18108,12 @@ msgstr "ogiltig kontrollsumma"
 msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr "ogiltig rev-indexposition vid %<PRIu64>: %<PRIu32> != %<PRIu32>"
 
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr "baklängesindex-stycke för multi-pack-index har fel storlek"
+
+msgid "could not determine preferred pack"
+msgstr "kunde inte bestämma föredraget paket"
+
 msgid "cannot both write and verify reverse index"
 msgstr "kan inte både skriva och bekräfta reverse-index"
 
@@ -17945,7 +18127,7 @@ msgstr "kunde inte göra %s läsbar"
 
 #, c-format
 msgid "could not write '%s' promisor file"
-msgstr "kunde inte skriva kontraktsfilen \"%s\""
+msgstr "kunde inte skriva kontraktsfilen ”%s”"
 
 msgid "offset before end of packfile (broken .idx?)"
 msgstr "offset före slutet av packfilen (trasig .idx?)"
@@ -17964,33 +18146,24 @@ msgstr "offset borton slutet av packindex för %s (trunkerat index?)"
 
 #, c-format
 msgid "malformed expiration date '%s'"
-msgstr "trasigt utlöpsdatum: \"%s\""
+msgstr "trasigt utlöpsdatum: ”%s”"
 
 #, c-format
 msgid "option `%s' expects \"always\", \"auto\", or \"never\""
-msgstr ""
-"flaggan \"%s\" antar \"always\" (alltid), \"auto\" eller \"never\" (aldrig)"
+msgstr "flaggan ”%s” antar ”always” (alltid), ”auto” eller ”never” (aldrig)"
 
 #, c-format
 msgid "malformed object name '%s'"
-msgstr "felformat objektnamn \"%s\""
+msgstr "felformat objektnamn ”%s”"
 
 #, c-format
 msgid "option `%s' expects \"%s\" or \"%s\""
-msgstr "flaggan \"%s\" kräver \"%s\" eller \"%s\""
+msgstr "flaggan ”%s” kräver ”%s” eller ”%s”"
 
 #, c-format
 msgid "%s requires a value"
 msgstr "%s behöver ett värde"
 
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s är inkompatibel med %s"
-
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s: inkompatibelt med något annat"
-
 #, c-format
 msgid "%s takes no value"
 msgstr "%s tar inget värde"
@@ -18009,7 +18182,7 @@ msgstr "tvetydig flagga: %s (kan vara --%s%s eller --%s%s)"
 
 #, c-format
 msgid "did you mean `--%s` (with two dashes)?"
-msgstr "menade du \"--%s\" (med två bindestreck)?"
+msgstr "menade du ”--%s” (med två bindestreck)?"
 
 #, c-format
 msgid "alias of --%s"
@@ -18020,15 +18193,15 @@ msgstr "behöver ett underkommando"
 
 #, c-format
 msgid "unknown option `%s'"
-msgstr "okänd flagga \"%s\""
+msgstr "okänd flagga ”%s”"
 
 #, c-format
 msgid "unknown switch `%c'"
-msgstr "okänd flagga \"%c\""
+msgstr "okänd flagga ”%c”"
 
 #, c-format
 msgid "unknown non-ascii option in string: `%s'"
-msgstr "okänd icke-ascii-flagga i strängen: \"%s\""
+msgstr "okänd icke-ascii-flagga i strängen: ”%s”"
 
 msgid "..."
 msgstr "..."
@@ -18074,6 +18247,10 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-TAL"
 
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "motsatsen mot --no-%s"
+
 msgid "expiry-date"
 msgstr "giltig-till"
 
@@ -18102,15 +18279,23 @@ msgid ""
 "with --pathspec-from-file, pathspec elements are separated with NUL character"
 msgstr "med --pathspec-from-file, sökvägsangivelser avdelas med NUL-tecken"
 
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "felaktigt booleskt miljövariabelvärde ”%s” för ”%s”"
+
+#, c-format
+msgid "failed to parse %s"
+msgstr "kunde inte tolka %s"
+
 #, c-format
 msgid "Could not make %s writable by group"
 msgstr "Kunde inte göra %s skrivbar för gruppen"
 
 msgid "Escape character '\\' not allowed as last character in attr value"
-msgstr "Specialtecknet \"\\\" tillåts inte som sista tecken i attributvärde"
+msgstr "Specialtecknet ”\\” tillåts inte som sista tecken i attributvärde"
 
 msgid "Only one 'attr:' specification is allowed."
-msgstr "Endast en \"attr:\"-angivelse tillåten."
+msgstr "Endast en ”attr:”-angivelse tillåten."
 
 msgid "attr spec must not be empty"
 msgstr "attr-angivelse kan inte vara tom"
@@ -18120,42 +18305,45 @@ msgid "invalid attribute name %s"
 msgstr "ogiltigt attributnamn %s"
 
 msgid "global 'glob' and 'noglob' pathspec settings are incompatible"
-msgstr ""
-"de globala sökvägsinställningarna \"glob\" och \"noglob\" är inkompatibla"
+msgstr "de globala sökvägsinställningarna ”glob” och ”noglob” är inkompatibla"
 
 msgid ""
 "global 'literal' pathspec setting is incompatible with all other global "
 "pathspec settings"
 msgstr ""
-"den globala sökvägsinställningen \"literal\" är inkompatibel med alla andra "
+"den globala sökvägsinställningen ”literal” är inkompatibel med alla andra "
 "globala sökvägsinställningar"
 
 msgid "invalid parameter for pathspec magic 'prefix'"
-msgstr "ogiltig parameter för sökvägsuttrycket för \"prefix\""
+msgstr "ogiltig parameter för sökvägsuttrycket för ”prefix”"
 
 #, c-format
 msgid "Invalid pathspec magic '%.*s' in '%s'"
-msgstr "Felaktigt sökvägsuttryck \"%.*s\" i \"%s\""
+msgstr "Felaktigt sökvägsuttryck ”%.*s” i ”%s”"
 
 #, c-format
 msgid "Missing ')' at the end of pathspec magic in '%s'"
-msgstr "\")\" saknas i slutet av sökvägsuttrycket för \"%s\""
+msgstr "”)” saknas i slutet av sökvägsuttrycket för ”%s”"
 
 #, c-format
 msgid "Unimplemented pathspec magic '%c' in '%s'"
-msgstr "Ej implementerat sökvägsuttryckmagi \"%c\" i \"%s\""
+msgstr "Ej implementerat sökvägsuttryckmagi ”%c” i ”%s”"
 
 #, c-format
 msgid "%s: 'literal' and 'glob' are incompatible"
-msgstr "%s: \"literal\" och \"glob\" är inkompatibla"
+msgstr "%s: ”literal” och ”glob” är inkompatibla"
+
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "”%s” är utanför katalogträdet"
 
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
-msgstr "%s: \"%s\" är utanför arkivet på \"%s\""
+msgstr "%s: ”%s” är utanför arkivet på ”%s”"
 
 #, c-format
 msgid "'%s' (mnemonic: '%c')"
-msgstr "\"%s\" (minnesstöd: \"%c\")"
+msgstr "”%s” (minnesstöd: ”%c”)"
 
 #, c-format
 msgid "%s: pathspec magic not supported by this command: %s"
@@ -18163,7 +18351,7 @@ msgstr "%s: sökvägsuttrycket hanteras inte av det här kommandot: %s"
 
 #, c-format
 msgid "pathspec '%s' is beyond a symbolic link"
-msgstr "sökvägsangivelsen \"%s\" är på andra sidan av en symbolisk länk"
+msgstr "sökvägsangivelsen ”%s” är på andra sidan av en symbolisk länk"
 
 #, c-format
 msgid "line is badly quoted: %s"
@@ -18179,7 +18367,7 @@ msgid "unable to write response end packet"
 msgstr "kunde inte skriva svarsavslutningspaket"
 
 msgid "flush packet write failed"
-msgstr "fel vid skrivning av \"flush\"-paket"
+msgstr "fel vid skrivning av ”flush”-paket"
 
 msgid "protocol error: impossibly long line"
 msgstr "protokollfel: omöjligt lång rad"
@@ -18234,57 +18422,56 @@ msgstr ""
 
 #, c-format
 msgid "promisor remote name cannot begin with '/': %s"
-msgstr "kontraktsfjärr kan inte börja med \"/\": %s"
+msgstr "kontraktsfjärr kan inte börja med ”/”: %s"
 
 #, c-format
 msgid "could not fetch %s from promisor remote"
 msgstr "kunde inte hämta %s från kontraktsfjärr"
 
 msgid "object-info: expected flush after arguments"
-msgstr "object-info: förväntade \"flush\" efter argument"
+msgstr "object-info: förväntade ”flush” efter argument"
 
 msgid "Removing duplicate objects"
 msgstr "Tar bort duplicerade objekt"
 
 msgid "could not start `log`"
-msgstr "kunde inte starta \"log\""
+msgstr "kunde inte starta ”log”"
 
 msgid "could not read `log` output"
-msgstr "kunde inte läsa utdata från \"log\""
+msgstr "kunde inte läsa utdata från ”log”"
 
 #, c-format
 msgid "could not parse commit '%s'"
-msgstr "kunde inte tolka incheckningen \"%s\""
+msgstr "kunde inte tolka incheckningen ”%s”"
 
 #, c-format
 msgid ""
 "could not parse first line of `log` output: did not start with 'commit ': "
 "'%s'"
 msgstr ""
-"kunde inte tolka första raden i \"log\"-updata: börjar inte med \"commit \": "
-"\"%s\""
+"kunde inte tolka första raden i ”log”-updata: börjar inte med ”commit ”: ”%s”"
 
 #, c-format
 msgid "could not parse git header '%.*s'"
-msgstr "kunde inte tolka git-huvudet \"%.*s\""
+msgstr "kunde inte tolka git-huvudet ”%.*s”"
 
 msgid "failed to generate diff"
 msgstr "misslyckades skapa diff"
 
 #, c-format
 msgid "could not parse log for '%s'"
-msgstr "kunde inte tolka loggen för \"%s\""
+msgstr "kunde inte tolka loggen för ”%s”"
 
 #, c-format
 msgid "invalid extra cruft tip: '%s'"
-msgstr "ogiltig extra överbliven ände: \"%s\""
+msgstr "ogiltig extra överbliven ände: ”%s”"
 
 msgid "unable to enumerate additional recent objects"
 msgstr "kan inte räkna ytterligare nyliga objekt"
 
 #, c-format
 msgid "will not add file alias '%s' ('%s' already exists in index)"
-msgstr "lägger inte till filalias \"%s\" (\"%s\" finns redan i indexet)"
+msgstr "lägger inte till filalias ”%s” (”%s” finns redan i indexet)"
 
 msgid "cannot create an empty blob in the object database"
 msgstr "kan inte skapa tom blob i objektdatabasen"
@@ -18296,19 +18483,15 @@ msgstr ""
 
 #, c-format
 msgid "unable to index file '%s'"
-msgstr "kan inte indexera filen \"%s\""
+msgstr "kan inte indexera filen ”%s”"
 
 #, c-format
 msgid "unable to add '%s' to index"
-msgstr "kan inte lägga till \"%s\" till indexet"
-
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "kan inte ta status på \"%s\""
+msgstr "kan inte lägga till ”%s” till indexet"
 
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
-msgstr "\"%s\" finns både som en fil och en katalog"
+msgstr "”%s” finns både som en fil och en katalog"
 
 msgid "Refresh index"
 msgstr "Uppdatera indexet"
@@ -18354,18 +18537,18 @@ msgstr "okänt format 0x%08x på indexpost"
 
 #, c-format
 msgid "malformed name field in the index, near path '%s'"
-msgstr "felformat namnfält i indexet, nära sökvägen \"%s\""
+msgstr "felformat namnfält i indexet, nära sökvägen ”%s”"
 
 msgid "unordered stage entries in index"
 msgstr "osorterade köposter i index"
 
 #, c-format
 msgid "multiple stage entries for merged file '%s'"
-msgstr "flera köposter för den sammanslagna filen \"%s\""
+msgstr "flera köposter för den sammanslagna filen ”%s”"
 
 #, c-format
 msgid "unordered stage entries for '%s'"
-msgstr "osorterade köposter för \"%s\""
+msgstr "osorterade köposter för ”%s”"
 
 #, c-format
 msgid "unable to create load_cache_entries thread: %s"
@@ -18401,7 +18584,7 @@ msgstr "kunde inte utföra join på load_index_extensions-tråden: %s"
 
 #, c-format
 msgid "could not freshen shared index '%s'"
-msgstr "kunde inte uppdatera delat index \"%s\""
+msgstr "kunde inte uppdatera delat index ”%s”"
 
 #, c-format
 msgid "broken index, expect %s in %s, got %s"
@@ -18413,10 +18596,6 @@ msgstr "kan inte skriva delat index för ett glest index"
 msgid "failed to convert to a sparse-index"
 msgstr "misslyckades omvandla till glest index"
 
-#, c-format
-msgid "could not stat '%s'"
-msgstr "kunde inte ta status på \"%s\""
-
 #, c-format
 msgid "unable to open git dir: %s"
 msgstr "kunde inte öppna git-katalog: %s"
@@ -18427,7 +18606,7 @@ msgstr "misslyckades ta bort länken: %s"
 
 #, c-format
 msgid "cannot fix permission bits on '%s'"
-msgstr "kan inte rätta behörighetsbitar på \"%s\""
+msgstr "kan inte rätta behörighetsbitar på ”%s”"
 
 #, c-format
 msgid "%s: cannot drop to stage #0"
@@ -18439,16 +18618,16 @@ msgstr "diff-status %c förväntades inte"
 
 #, c-format
 msgid "remove '%s'\n"
-msgstr "ta bort \"%s\"\n"
+msgstr "ta bort ”%s”\n"
 
 msgid ""
 "You can fix this with 'git rebase --edit-todo' and then run 'git rebase --"
 "continue'.\n"
 "Or you can abort the rebase with 'git rebase --abort'.\n"
 msgstr ""
-"Du kan rätta detta med \"git rebase --edit-todo\" följt av \"git rebase --"
-"continue\".\n"
-"Avbryt ombaseringen med \"git rebase --abort\".\n"
+"Du kan rätta detta med ”git rebase --edit-todo” följt av ”git rebase --"
+"continue.\n"
+"Avbryt ombaseringen med ”git rebase --abort”.\n"
 
 #, c-format
 msgid ""
@@ -18490,18 +18669,17 @@ msgstr ""
 "e, edit <incheckning> = använd incheckning, men stanna för tillägg\n"
 "s, squash <incheckning> = använd incheckning, men infoga i föregående "
 "incheckning\n"
-"f, fixup [-C | -c] <incheckning> = som \"squash\" men behåll bara "
+"f, fixup [-C | -c] <incheckning> = som ”squash” men behåll bara "
 "loggmeddelandet\n"
 "                   från föregående incheckning, såvida inte -C används, då "
 "används\n"
 "                   istället bara den här incheckningens meddelande; -c är "
 "samma\n"
 "                   som -C, men öppnar redigeringsprogrammet\n"
-"f, fixup <incheckning> = som \"squash\", men förkasta "
-"incheckningsmeddelandet\n"
+"f, fixup <incheckning> = som ”squash”, men förkasta incheckningsmeddelandet\n"
 "x, exec <kommando> = kör kommando (resten av raden) i skalet\n"
-"b, break = stoppa här (fortsätt ombaseringen senare med \"git rebase --"
-"continue\")\n"
+"b, break = stoppa här (fortsätt ombaseringen senare med git rebase --"
+"continue)\n"
 "d, drop <incheckning> = ta bort incheckning\n"
 "l, label <etikett> = ge aktuellt HEAD ett namn\n"
 "t, reset <etikett> = återställ HEAD till en etikett\n"
@@ -18526,7 +18704,7 @@ msgid ""
 "Do not remove any line. Use 'drop' explicitly to remove a commit.\n"
 msgstr ""
 "\n"
-"Ta inte bort rader. Använd \"drop\" för att specifikt förkasta en "
+"Ta inte bort rader. Använd ”drop” för att specifikt förkasta en "
 "incheckning.\n"
 
 msgid ""
@@ -18544,7 +18722,7 @@ msgid ""
 "\n"
 msgstr ""
 "\n"
-"Du redigerar \"todo\"-filen för en pågående interaktiv ombasering.\n"
+"Du redigerar ”todo”-filen för en pågående interaktiv ombasering.\n"
 "För att forsätta ombasera efter redigeringen, kör:\n"
 "    git rebase --continue\n"
 "\n"
@@ -18560,7 +18738,7 @@ msgstr ""
 
 #, c-format
 msgid "could not write '%s'."
-msgstr "kunde inte skriva \"%s\"."
+msgstr "kunde inte skriva ”%s”."
 
 #, c-format
 msgid ""
@@ -18579,19 +18757,16 @@ msgid ""
 "The possible behaviours are: ignore, warn, error.\n"
 "\n"
 msgstr ""
-"För att undvika det här meddelandet kan du använda \"drop\" för att "
-"explicit\n"
+"För att undvika det här meddelandet kan du använda ”drop” för att explicit\n"
 "kasta en incheckning.\n"
 "\n"
-"Använd \"git config rebase.missingCommitsCheck\" för att ändra "
-"varningsnivån.\n"
-"Möjliga bettenden är: \"ignore\" (ignorera), \"warn\" (varna), \"error"
-"\" (fel).\n"
+"Använd ”git config rebase.missingCommitsCheck” för att ändra varningsnivån.\n"
+"Möjliga bettenden är: ”ignore” (ignorera), ”warn” (varna), ”error” (fel).\n"
 "\n"
 
 #, c-format
 msgid "%s: 'preserve' superseded by 'merges'"
-msgstr "%s: \"preserve\" har ersatts av \"merges\""
+msgstr "%s: ”preserve” har ersatts av ”merges”"
 
 msgid "gone"
 msgstr "försvunnen"
@@ -18662,7 +18837,7 @@ msgstr "vädre förväntades %s="
 
 #, c-format
 msgid "positive value expected '%s' in %%(%s)"
-msgstr "positivt värde förväntat \"%s\" i %%(%s)"
+msgstr "positivt värde förväntat ”%s” i %%(%s)"
 
 #, c-format
 msgid "expected format: %%(align:<width>,<position>)"
@@ -18699,8 +18874,7 @@ msgstr "okänt fältnamn: %.*s"
 #, c-format
 msgid ""
 "not a git repository, but the field '%.*s' requires access to object data"
-msgstr ""
-"inte ett git-arkiv, men fältet \"%.*s\" kräver tillgång till objektdata"
+msgstr "inte ett git-arkiv, men fältet ”%.*s” kräver tillgång till objektdata"
 
 #, c-format
 msgid "format: %%(%s) atom used without a %%(%s) atom"
@@ -18735,7 +18909,7 @@ msgid "--format=%.*s cannot be used with --python, --shell, --tcl"
 msgstr "--format=%.*s kan inte användas med --python, --shell, --tcl"
 
 msgid "failed to run 'describe'"
-msgstr "misslyckades att köra \"describe\""
+msgstr "misslyckades att köra ”describe”"
 
 #, c-format
 msgid "(no branch, rebasing %s)"
@@ -18747,7 +18921,7 @@ msgstr "(ingen gren, ombaserar frånkopplat HEAD %s)"
 
 #, c-format
 msgid "(no branch, bisect started on %s)"
-msgstr "(ingen gren, \"bisect\" startad på %s)"
+msgstr "(ingen gren, ”bisect” startad på %s)"
 
 #, c-format
 msgid "(HEAD detached at %s)"
@@ -18770,7 +18944,7 @@ msgstr "parse_object_buffer misslyckades på %s för %s"
 
 #, c-format
 msgid "malformed object at '%s'"
-msgstr "felformat objekt vid \"%s\""
+msgstr "felformat objekt vid ”%s”"
 
 #, c-format
 msgid "ignoring ref with broken name %s"
@@ -18790,7 +18964,7 @@ msgstr "felformat objektnamn %s"
 
 #, c-format
 msgid "option `%s' must point to a commit"
-msgstr "flaggan \"%s\" måste peka på en incheckning"
+msgstr "flaggan ”%s” måste peka på en incheckning"
 
 msgid "key"
 msgstr "nyckel"
@@ -18807,11 +18981,11 @@ msgstr "inte en referenslogg: %s"
 
 #, c-format
 msgid "no reflog for '%s'"
-msgstr "ingen referenslogg för \"%s\""
+msgstr "ingen referenslogg för ”%s”"
 
 #, c-format
 msgid "%s does not point to a valid object!"
-msgstr "\"%s\" pekar inte på ett giltigt objekt!"
+msgstr "”%s” pekar inte på ett giltigt objekt!"
 
 #, c-format
 msgid ""
@@ -18826,20 +19000,20 @@ msgid ""
 "\n"
 "\tgit branch -m <name>\n"
 msgstr ""
-"Använder \"%s\" som namn för den inledande grenen. Detta förvalda grennamn\n"
+"Använder ”%s” som namn för den inledande grenen. Detta förvalda grennamn\n"
 "kan ändras i framtiden. För att välja vilket namn som ska användas på\n"
 "den inledande grenen i alla nya arkiv, och dölja denna varning, kör du:\n"
 "\n"
 "\tgit config --global init.defaultBranch <namn>\n"
 "\n"
-"Namn som ofta används istället för \"master\" är \"main\", \"trunk\" och\n"
-"\"development\". Den nyskapade grenen kan ges nytt namn med kommandot:\n"
+"Namn som ofta används istället för ”master” är ”main”, ”trunk” och\n"
+"”development”. Den nyskapade grenen kan ges nytt namn med kommandot:\n"
 "\n"
 "\tgit branch -m <namn>\n"
 
 #, c-format
 msgid "could not retrieve `%s`"
-msgstr "kunde inte hämta \"%s\""
+msgstr "kunde inte hämta ”%s”"
 
 #, c-format
 msgid "invalid branch name: %s = %s"
@@ -18863,15 +19037,15 @@ msgstr "loggen för %s är tom"
 
 #, c-format
 msgid "refusing to update ref with bad name '%s'"
-msgstr "vägrar uppdatera referens med trasigt namn \"%s\""
+msgstr "vägrar uppdatera referens med trasigt namn ”%s”"
 
 #, c-format
 msgid "update_ref failed for ref '%s': %s"
-msgstr "update_ref misslyckades för referensen \"%s\": %s"
+msgstr "update_ref misslyckades för referensen ”%s”: %s"
 
 #, c-format
 msgid "multiple updates for ref '%s' not allowed"
-msgstr "flera uppdateringar för referensen \"%s\" tillåts inte"
+msgstr "flera uppdateringar för referensen ”%s” tillåts inte"
 
 msgid "ref updates forbidden inside quarantine environment"
 msgstr "referensuppdateringar förbjudna i karantänmiljö"
@@ -18881,15 +19055,11 @@ msgstr "referensuppdateringar avbrutna av krok"
 
 #, c-format
 msgid "'%s' exists; cannot create '%s'"
-msgstr "\"%s\" finns; kan inte skapa \"%s\""
+msgstr "”%s” finns; kan inte skapa ”%s”"
 
 #, c-format
 msgid "cannot process '%s' and '%s' at the same time"
-msgstr "kan inte hantera \"%s\" och \"%s\" samtidigt"
-
-#, c-format
-msgid "could not remove reference %s"
-msgstr "kunde inte ta bort referensen %s"
+msgstr "kan inte hantera ”%s” och ”%s” samtidigt"
 
 #, c-format
 msgid "could not delete reference %s: %s"
@@ -18901,11 +19071,11 @@ msgstr "kunde inte ta bort referenser: %s"
 
 #, c-format
 msgid "invalid refspec '%s'"
-msgstr "felaktig referensspecifikation: \"%s\""
+msgstr "felaktig referensspecifikation: ”%s”"
 
 #, c-format
 msgid "invalid quoting in push-option value: '%s'"
-msgstr "felaktig citering på värde för push-option: \"%s\""
+msgstr "felaktig citering på värde för push-option: ”%s”"
 
 #, c-format
 msgid "%sinfo/refs not valid: is this a git repository?"
@@ -18916,23 +19086,23 @@ msgstr "ogiltigt svar från servern; förväntade tjänst, fick flush-paket"
 
 #, c-format
 msgid "invalid server response; got '%s'"
-msgstr "ogiltigt svar från servern; fick \"%s\""
+msgstr "ogiltigt svar från servern; fick ”%s”"
 
 #, c-format
 msgid "repository '%s' not found"
-msgstr "arkivet \"%s\" hittades inte"
+msgstr "arkivet ”%s” hittades inte"
 
 #, c-format
 msgid "Authentication failed for '%s'"
-msgstr "Autentisering misslyckades \"%s\""
+msgstr "Autentisering misslyckades ”%s”"
 
 #, c-format
 msgid "unable to access '%s' with http.pinnedPubkey configuration: %s"
-msgstr "kan inte nå \"%s\" med http.pinnedPubkey inställt till: %s"
+msgstr "kan inte nå ”%s” med http.pinnedPubkey inställt till: %s"
 
 #, c-format
 msgid "unable to access '%s': %s"
-msgstr "kan inte komma åt \"%s\": %s"
+msgstr "kan inte komma åt ”%s”: %s"
 
 #, c-format
 msgid "redirecting to %s"
@@ -18988,18 +19158,18 @@ msgstr "kan inte hämta med sha1 över smart http"
 
 #, c-format
 msgid "protocol error: expected sha/ref, got '%s'"
-msgstr "protokollfel: förväntade sha/ref, fick \"%s\""
+msgstr "protokollfel: förväntade sha/ref, fick ”%s”"
 
 #, c-format
 msgid "http transport does not support %s"
 msgstr "http-transporten stöder inte %s"
 
 msgid "protocol error: expected '<url> <path>', missing space"
-msgstr "protokollfel: förväntade \"<url> <sökväg>\", saknar blanksteg"
+msgstr "protokollfel: förväntade ”<url> <sökväg>”, saknar blanksteg"
 
 #, c-format
 msgid "failed to download file at URL '%s'"
-msgstr "misslyckades hämta filen på URL \"%s\""
+msgstr "misslyckades hämta filen på URL ”%s”"
 
 msgid "git-http-push failed"
 msgstr "git-http-push misslyckades"
@@ -19015,11 +19185,11 @@ msgstr "remote-curl: försökte ta emot utan lokalt arkiv"
 
 #, c-format
 msgid "remote-curl: unknown command '%s' from git"
-msgstr "remote-curl: okänt kommando \"%s\" från git"
+msgstr "remote-curl: okänt kommando ”%s” från git"
 
 #, c-format
 msgid "config remote shorthand cannot begin with '/': %s"
-msgstr "konfigurerad kortform för fjärr kan inte börja med \"/\": %s"
+msgstr "konfigurerad kortform för fjärr kan inte börja med ”/”: %s"
 
 msgid "more than one receivepack given, using the first"
 msgstr "mer än en receivepack angavs, använder den första"
@@ -19029,11 +19199,11 @@ msgstr "mer än en uploadpack angavs, använder den första"
 
 #, c-format
 msgid "unrecognized value transfer.credentialsInUrl: '%s'"
-msgstr "okänt värde transfer.credentialsInUrl: \"%s\""
+msgstr "okänt värde transfer.credentialsInUrl: ”%s”"
 
 #, c-format
 msgid "URL '%s' uses plaintext credentials"
-msgstr "URL \"%s\" använder inloggningsuppgifter i klartext"
+msgstr "URL ”%s” använder inloggningsuppgifter i klartext"
 
 #, c-format
 msgid "Cannot fetch both %s and %s to %s"
@@ -19049,11 +19219,11 @@ msgstr "%s spårar både %s och %s"
 
 #, c-format
 msgid "key '%s' of pattern had no '*'"
-msgstr "nyckeln \"%s\" i mönstret innehåller ingen \"*\""
+msgstr "nyckeln ”%s” i mönstret innehåller ingen ”*”"
 
 #, c-format
 msgid "value '%s' of pattern has no '*'"
-msgstr "värdet \"%s\" i mönstret innehåller ingen \"*\""
+msgstr "värdet ”%s” i mönstret innehåller ingen ”*”"
 
 #, c-format
 msgid "src refspec %s does not match any"
@@ -19080,12 +19250,12 @@ msgid ""
 "Neither worked, so we gave up. You must fully qualify the ref."
 msgstr ""
 "Målet du angav är inte ett komplett referensamn (dvs.,\n"
-"startar med \"refs/\"). Vi försökte gissa vad du menade genom att:\n"
+"startar med ”refs/”). Vi försökte gissa vad du menade genom att:\n"
 "\n"
-"- Se efter en referens som motsvarar \"%s\" på fjärrsidan.\n"
-"- Se om <källan> som sänds (\"%s\")\n"
-"  är en referens i \"refs/{heads,tags}/\". Om så lägger vi till\n"
-"  motsvarande refs/{heads,tags}/-prefix på fjärrsidan.\n"
+"- Se efter en referens som motsvarar ”%s” på fjärrsidan.\n"
+"- Se om <källan> som sänds (”%s”)\n"
+"  är en referens i ”refs/{heads,tags}/”. Om så lägger vi till\n"
+"  motsvarande ”refs/{heads,tags}/”-prefix på fjärrsidan.\n"
 "\n"
 "Inget av dem fungerade, så vi gav upp. Ange fullständig referens."
 
@@ -19097,7 +19267,7 @@ msgid ""
 msgstr ""
 "<Källa>-delen av ref.spec-en är ett incheckningsobjekt.\n"
 "Var det meningen att skapa en ny gren genom att sända\n"
-"till \"%s:refs/heads/%s\"?"
+"till ”%s:refs/heads/%s”?"
 
 #, c-format
 msgid ""
@@ -19107,7 +19277,7 @@ msgid ""
 msgstr ""
 "<Källa>-delen av ref.spec-en är ett taggobjekt.\n"
 "Var det meningen att skapa en ny tagg genom att sända\n"
-"till \"%s:refs/tags/%s\"?"
+"till ”%s:refs/tags/%s”?"
 
 #, c-format
 msgid ""
@@ -19117,7 +19287,7 @@ msgid ""
 msgstr ""
 "<Källa>-delen av ref.spec-en är ett trädobjekt.\n"
 "Var det meningen att tagga ett nytt träd genom att sända\n"
-"till \"%s:refs/tags/%s\"?"
+"till ”%s:refs/tags/%s”?"
 
 #, c-format
 msgid ""
@@ -19127,7 +19297,7 @@ msgid ""
 msgstr ""
 "<Källa>-delen av ref.spec-en är ett blobobjekt.\n"
 "Var det meningen att tagga en ny blob genom att sända\n"
-"till \"%s:refs/tags/%s\"?"
+"till ”%s:refs/tags/%s”?"
 
 #, c-format
 msgid "%s cannot be resolved to branch"
@@ -19135,48 +19305,48 @@ msgstr "%s kan inte slås upp till en gren"
 
 #, c-format
 msgid "unable to delete '%s': remote ref does not exist"
-msgstr "kan inte ta bort \"%s\": fjärreferensen finns inte"
+msgstr "kan inte ta bort ”%s”: fjärreferensen finns inte"
 
 #, c-format
 msgid "dst refspec %s matches more than one"
-msgstr "fjärr-referensspecifikationen \"%s\" motsvarar mer än en"
+msgstr "fjärr-referensspecifikationen ”%s” motsvarar mer än en"
 
 #, c-format
 msgid "dst ref %s receives from more than one src"
-msgstr "fjärr-referensen \"%s\" hämtar från mer än en källa"
+msgstr "fjärr-referensen ”%s” hämtar från mer än en källa"
 
 msgid "HEAD does not point to a branch"
 msgstr "HEAD pekar inte på en gren"
 
 #, c-format
 msgid "no such branch: '%s'"
-msgstr "okänd gren: \"%s\""
+msgstr "okänd gren: ”%s”"
 
 #, c-format
 msgid "no upstream configured for branch '%s'"
-msgstr "ingen standarduppström angiven för grenen \"%s\""
+msgstr "ingen standarduppström angiven för grenen ”%s”"
 
 #, c-format
 msgid "upstream branch '%s' not stored as a remote-tracking branch"
-msgstr "uppströmsgrenen \"%s\" är inte lagrad som en fjärrspårande gren"
+msgstr "uppströmsgrenen ”%s” är inte lagrad som en fjärrspårande gren"
 
 #, c-format
 msgid "push destination '%s' on remote '%s' has no local tracking branch"
-msgstr "push-målet \"%s\" på fjärren \"%s\" har ingen lokalt spårande gren"
+msgstr "push-målet ”%s” på fjärren ”%s” har ingen lokalt spårande gren"
 
 #, c-format
 msgid "branch '%s' has no remote for pushing"
-msgstr "grenen \"%s\" har ingen fjärr för \"push\""
+msgstr "grenen ”%s” har ingen fjärr för ”push”"
 
 #, c-format
 msgid "push refspecs for '%s' do not include '%s'"
-msgstr "\"push\"-referensspecifikation för \"%s\" innehåller inte \"%s\""
+msgstr "”push”-referensspecifikation för ”%s” innehåller inte ”%s”"
 
 msgid "push has no destination (push.default is 'nothing')"
-msgstr "\"push\" har inget mål (push.default är \"ingenting\")"
+msgstr "”push” har inget mål (push.default är ”ingenting”)"
 
 msgid "cannot resolve 'simple' push to a single destination"
-msgstr "\"enkel push\" motsvarar flera olika mål"
+msgstr "”enkel push” motsvarar flera olika mål"
 
 #, c-format
 msgid "couldn't find remote ref %s"
@@ -19184,47 +19354,47 @@ msgstr "Kunde inte hitta fjärr-referensen %s"
 
 #, c-format
 msgid "* Ignoring funny ref '%s' locally"
-msgstr "* Ignorerar märklig referens \"%s\" lokalt"
+msgstr "* Ignorerar märklig referens ”%s” lokalt"
 
 #, c-format
 msgid "Your branch is based on '%s', but the upstream is gone.\n"
-msgstr "Din gren är baserad på \"%s\", men den har försvunnit uppströms.\n"
+msgstr "Din gren är baserad på ”%s”, men den har försvunnit uppströms.\n"
 
 msgid "  (use \"git branch --unset-upstream\" to fixup)\n"
-msgstr "  (använd \"git branch --unset-upstream\" för att rätta)\n"
+msgstr "  (använd ”git branch --unset-upstream” för att rätta)\n"
 
 #, c-format
 msgid "Your branch is up to date with '%s'.\n"
-msgstr "Din gren är à jour med \"%s\".\n"
+msgstr "Din gren är à jour med ”%s”.\n"
 
 #, c-format
 msgid "Your branch and '%s' refer to different commits.\n"
-msgstr "Din gren och \"%s\" pekar på olika incheckningar.\n"
+msgstr "Din gren och ”%s” pekar på olika incheckningar.\n"
 
 #, c-format
 msgid "  (use \"%s\" for details)\n"
-msgstr "  (använd \"%s\" för detaljer)\n"
+msgstr "  (använd ”%s” för detaljer)\n"
 
 #, c-format
 msgid "Your branch is ahead of '%s' by %d commit.\n"
 msgid_plural "Your branch is ahead of '%s' by %d commits.\n"
-msgstr[0] "Din gren ligger före \"%s\" med %d incheckning.\n"
-msgstr[1] "Din gren ligger före \"%s\" med %d incheckningar.\n"
+msgstr[0] "Din gren ligger före ”%s” med %d incheckning.\n"
+msgstr[1] "Din gren ligger före ”%s” med %d incheckningar.\n"
 
 msgid "  (use \"git push\" to publish your local commits)\n"
-msgstr "  (använd \"git push\" för att publicera dina lokala incheckningar)\n"
+msgstr "  (använd ”git push” för att publicera dina lokala incheckningar)\n"
 
 #, c-format
 msgid "Your branch is behind '%s' by %d commit, and can be fast-forwarded.\n"
 msgid_plural ""
 "Your branch is behind '%s' by %d commits, and can be fast-forwarded.\n"
 msgstr[0] ""
-"Din gren ligger efter \"%s\" med %d incheckning, och kan snabbspolas.\n"
+"Din gren ligger efter ”%s” med %d incheckning, och kan snabbspolas.\n"
 msgstr[1] ""
-"Din gren ligger efter \"%s\" med %d incheckningar, och kan snabbspolas.\n"
+"Din gren ligger efter ”%s” med %d incheckningar, och kan snabbspolas.\n"
 
 msgid "  (use \"git pull\" to update your local branch)\n"
-msgstr "  (använd \"git pull\" för att uppdatera din lokala gren)\n"
+msgstr "  (använd ”git pull” för att uppdatera din lokala gren)\n"
 
 #, c-format
 msgid ""
@@ -19234,24 +19404,23 @@ msgid_plural ""
 "Your branch and '%s' have diverged,\n"
 "and have %d and %d different commits each, respectively.\n"
 msgstr[0] ""
-"Din gren och \"%s\" har divergerat,\n"
+"Din gren och ”%s” har divergerat,\n"
 "och har %d respektive %d olika incheckning.\n"
 msgstr[1] ""
-"Din gren och \"%s\" har divergerat,\n"
+"Din gren och ”%s” har divergerat,\n"
 "och har %d respektive %d olika incheckningar.\n"
 
 msgid ""
 "  (use \"git pull\" if you want to integrate the remote branch with yours)\n"
-msgstr ""
-"  (använd \"git pull\" om du vill integrera fjärrgrenen med din egen)\n"
+msgstr "  (använd ”git pull” om du vill integrera fjärrgrenen med din egen)\n"
 
 #, c-format
 msgid "cannot parse expected object name '%s'"
-msgstr "kan inte tolka förväntat objektnamn \"%s\""
+msgstr "kan inte tolka förväntat objektnamn ”%s”"
 
 #, c-format
 msgid "cannot strip one component off url '%s'"
-msgstr "kan inte ta bort en komponent från url:en \"%s\""
+msgstr "kan inte ta bort en komponent från url:en ”%s”"
 
 #, c-format
 msgid "bad replace ref name: %s"
@@ -19273,55 +19442,55 @@ msgstr "kunde inte skriva rerere-post"
 
 #, c-format
 msgid "there were errors while writing '%s' (%s)"
-msgstr "fel vid skrivning av \"%s\" (%s)"
+msgstr "fel vid skrivning av ”%s” (%s)"
 
 #, c-format
 msgid "could not parse conflict hunks in '%s'"
-msgstr "kunde inte tolka konflikt-stycket i \"%s\""
+msgstr "kunde inte tolka konflikt-stycket i ”%s”"
 
 #, c-format
 msgid "failed utime() on '%s'"
-msgstr "\"utime()\" misslyckades på \"%s\""
+msgstr "”utime()” misslyckades på ”%s”"
 
 #, c-format
 msgid "writing '%s' failed"
-msgstr "misslyckades skriva \"%s\""
+msgstr "misslyckades skriva ”%s”"
 
 #, c-format
 msgid "Staged '%s' using previous resolution."
-msgstr "Köade \"%s\" med sparad lösning."
+msgstr "Köade ”%s” med sparad lösning."
 
 #, c-format
 msgid "Recorded resolution for '%s'."
-msgstr "Sparade lösning för \"%s\"."
+msgstr "Sparade lösning för ”%s”."
 
 #, c-format
 msgid "Resolved '%s' using previous resolution."
-msgstr "Löste \"%s\" med tidigare lösning."
+msgstr "Löste ”%s” med tidigare lösning."
 
 #, c-format
 msgid "cannot unlink stray '%s'"
-msgstr "kan inte ta bort lös länk \"%s\""
+msgstr "kan inte ta bort lös länk ”%s”"
 
 #, c-format
 msgid "Recorded preimage for '%s'"
-msgstr "Sparade förhandsbild för \"%s\""
+msgstr "Sparade förhandsbild för ”%s”"
 
 #, c-format
 msgid "failed to update conflicted state in '%s'"
-msgstr "misslyckades uppdatera tillstånd för sammanslagningsproblem i \"%s\""
+msgstr "misslyckades uppdatera tillstånd för sammanslagningsproblem i ”%s”"
 
 #, c-format
 msgid "no remembered resolution for '%s'"
-msgstr "inget sparat sammanslagningsresultat för \"%s\""
+msgstr "inget sparat sammanslagningsresultat för ”%s”"
 
 #, c-format
 msgid "Updated preimage for '%s'"
-msgstr "Uppdaterade förhandsbild för \"%s\""
+msgstr "Uppdaterade förhandsbild för ”%s”"
 
 #, c-format
 msgid "Forgot resolution for '%s'\n"
-msgstr "Glömde lösning för \"%s\"\n"
+msgstr "Glömde lösning för ”%s”\n"
 
 msgid "unable to open rr-cache directory"
 msgstr "kan inte uppdatera katalogen rr-cache"
@@ -19345,25 +19514,25 @@ msgstr "--exclude-hidden= angavs mer än en gång"
 
 #, c-format
 msgid "resolve-undo records `%s` which is missing"
-msgstr "resolve-undo registrerar \"%s\" som saknas"
+msgstr "resolve-undo registrerar ”%s” som saknas"
 
 #, c-format
 msgid "could not get commit for ancestry-path argument %s"
-msgstr "kunde inte hämta incheckning för \"ancestry-path\"-argumentet %s"
+msgstr "kunde inte hämta incheckning för ”ancestry-path”-argumentet %s"
 
 msgid "--unpacked=<packfile> no longer supported"
 msgstr "--unpacked=<paketfil> stöds inte längre"
 
 #, c-format
 msgid "invalid option '%s' in --stdin mode"
-msgstr "ogiltig flagga \"%s\" i --stdin-läge"
+msgstr "ogiltig flagga ”%s” i --stdin-läge"
 
 msgid "your current branch appears to be broken"
 msgstr "din nuvarande gren verkar vara trasig"
 
 #, c-format
 msgid "your current branch '%s' does not have any commits yet"
-msgstr "din nuvarande gren \"%s\" innehåller ännu inte några incheckningar"
+msgstr "din nuvarande gren ”%s” innehåller ännu inte några incheckningar"
 
 msgid "object filtering requires --objects"
 msgstr "objektfiltrering kräver --objects"
@@ -19377,11 +19546,11 @@ msgstr "kan inte skapa asynkron tråd: %s"
 
 #, c-format
 msgid "'%s' does not exist"
-msgstr "\"%s\" finns inte"
+msgstr "”%s” finns inte"
 
 #, c-format
 msgid "could not switch to '%s'"
-msgstr "kunde inte växla till \"%s\""
+msgstr "kunde inte växla till ”%s”"
 
 msgid "need a working directory"
 msgstr "behöver en arbetskatalog"
@@ -19416,7 +19585,7 @@ msgstr "kunde inte ta bort enrollering"
 
 #, c-format
 msgid "remote HEAD is not a branch: '%.*s'"
-msgstr "HEAD hos fjärren är inte en gren: \"%.*s\""
+msgstr "HEAD hos fjärren är inte en gren: ”%.*s”"
 
 msgid "failed to get default branch name from remote; using local default"
 msgstr ""
@@ -19443,28 +19612,35 @@ msgstr "skapa komplett arbetskatalog vid kloning"
 msgid "only download metadata for the branch that will be checked out"
 msgstr "hämta endast metadata för grenen som skall checkas ut"
 
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<flaggor>] [--] <arkiv> [<kat>]"
+msgid "create repository within 'src' directory"
+msgstr "skapa arkiv inuti katalogen ”src”"
+
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <huvudgren>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enrollering>]"
 
 #, c-format
 msgid "cannot deduce worktree name from '%s'"
-msgstr "Kan inte härleda arbetsträdsnamn från \"%s\""
+msgstr "Kan inte härleda arbetsträdsnamn från ”%s”"
 
 #, c-format
 msgid "directory '%s' exists already"
-msgstr "katalogen \"%s\" finns redan"
+msgstr "katalogen ”%s” finns redan"
 
 #, c-format
 msgid "failed to get default branch for '%s'"
-msgstr "misslyckades hämta standardgren för \"%s\""
+msgstr "misslyckades hämta standardgren för ”%s”"
 
 #, c-format
 msgid "could not configure remote in '%s'"
-msgstr "kunde inte ställa in fjärr i \"%s\""
+msgstr "kunde inte ställa in fjärr i ”%s”"
 
 #, c-format
 msgid "could not configure '%s'"
-msgstr "kunde inte ställa in \"%s\""
+msgstr "kunde inte ställa in ”%s”"
 
 msgid "partial clone failed; attempting full clone"
 msgstr "delvis klon misslyckades; försöker med fullständig klon"
@@ -19476,7 +19652,7 @@ msgid "scalar diagnose [<enlistment>]"
 msgstr "scalar diagnose [<enrollering>]"
 
 msgid "`scalar list` does not take arguments"
-msgstr "\"scalar list\" tar inte argument"
+msgstr "”scalar list” tar inte argument"
 
 msgid "scalar register [<enlistment>]"
 msgstr "scalar register [<enrollering>]"
@@ -19492,15 +19668,31 @@ msgstr "--all eller <enrollering>, men inte bägge"
 
 #, c-format
 msgid "could not remove stale scalar.repo '%s'"
-msgstr "kunde inte ta bort gammal scalar.repo \"%s\""
+msgstr "kunde inte ta bort gammal scalar.repo ”%s”"
+
+#, c-format
+msgid "removed stale scalar.repo '%s'"
+msgstr "tog bort gammal scalar.repo ”%s”"
+
+#, c-format
+msgid "repository at '%s' has different owner"
+msgstr "arkivet ”%s” har en annan ägare"
+
+#, c-format
+msgid "repository at '%s' has a format issue"
+msgstr "arkivet ”%s” har ett formatproblem"
 
 #, c-format
-msgid "removing stale scalar.repo '%s'"
-msgstr "tar bort gammal scalar.repo \"%s\""
+msgid "repository not found in '%s'"
+msgstr "arkivet hittades inte i ”%s”"
 
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "git-arkiv försvunnet i \"%s\""
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"för att avregistrera arkivet från Scalar, kör\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 msgid ""
 "scalar run <task> [<enlistment>]\n"
@@ -19511,7 +19703,7 @@ msgstr ""
 
 #, c-format
 msgid "no such task: '%s'"
-msgstr "okänd uppgift: \"%s\""
+msgstr "okänd uppgift: ”%s”"
 
 msgid "scalar unregister [<enlistment>]"
 msgstr "scalar unregister [<enrollering>]"
@@ -19536,7 +19728,7 @@ msgstr "-C kräver en <katalog>"
 
 #, c-format
 msgid "could not change to '%s'"
-msgstr "kunde inte byta till \"%s\""
+msgstr "kunde inte byta till ”%s”"
 
 msgid "-c requires a <key>=<value> argument"
 msgstr "-c kräver ett argument på formen <nyckel>=<värde>"
@@ -19591,11 +19783,11 @@ msgstr "mottagarsidan stöder inte push-flaggor"
 
 #, c-format
 msgid "invalid commit message cleanup mode '%s'"
-msgstr "felaktigt incheckningsmeddelandestädningsläge \"%s\""
+msgstr "felaktigt incheckningsmeddelandestädningsläge ”%s”"
 
 #, c-format
 msgid "could not delete '%s'"
-msgstr "kunde inte ta bort \"%s\""
+msgstr "kunde inte ta bort ”%s”"
 
 msgid "revert"
 msgstr "revert"
@@ -19615,7 +19807,7 @@ msgid ""
 "with 'git add <paths>' or 'git rm <paths>'"
 msgstr ""
 "efter att ha löst konflikterna, markera de rättade sökvägarna\n"
-"med \"git add <sökvägar>\" eller \"git rm <sökvägar>\""
+"med ”git add <sökvägar>” eller ”git rm <sökvägar>”"
 
 msgid ""
 "After resolving the conflicts, mark them with\n"
@@ -19626,11 +19818,11 @@ msgid ""
 "run \"git cherry-pick --abort\"."
 msgstr ""
 "Efter att ha löst konflikterna, märk dem med\n"
-"\"git add/rm <sökvägsangivelse>\" och kör sedan\n"
-"\"git cherry-pick --continue\".\n"
-"Du kan hoppa över incheckningen istället med \"git cherry-pick --skip\"\n"
-"För att avbryta och återgå till där du var före \"git cherry-pick\",\n"
-"kör \"git cherry-pick --abort\"."
+"”git add/rm <sökvägsangivelse>” och kör sedan\n"
+"”git cherry-pick --continue”.\n"
+"Du kan hoppa över incheckningen istället med ”git cherry-pick --skip”\n"
+"För att avbryta och återgå till där du var före ”git cherry-pick”,\n"
+"kör ”git cherry-pick --abort”."
 
 msgid ""
 "After resolving the conflicts, mark them with\n"
@@ -19641,30 +19833,30 @@ msgid ""
 "run \"git revert --abort\"."
 msgstr ""
 "Efter att ha löst konflikterna, märk dem med\n"
-"\"git add/rm <sökvägsangivelse>\" och kör sedan\n"
-"\"git revert --continue\".\n"
-"Du kan hoppa över incheckningen istället med \"git revert --skip\"\n"
-"För att avbryta och återgå till där du var före \"git revert\",\n"
-"kör \"git revert --abort\"."
+"”git add/rm <sökvägsangivelse>” och kör sedan\n"
+"”git revert --continue”.\n"
+"Du kan hoppa över incheckningen istället med ”git revert --skip”\n"
+"För att avbryta och återgå till där du var före ”git revert”,\n"
+"kör ”git revert --abort”."
 
 #, c-format
 msgid "could not lock '%s'"
-msgstr "kunde inte låsa \"%s\""
+msgstr "kunde inte låsa ”%s”"
 
 #, c-format
 msgid "could not write eol to '%s'"
-msgstr "kunde inte skriva radslut till \"%s\""
+msgstr "kunde inte skriva radslut till ”%s”"
 
 #, c-format
 msgid "failed to finalize '%s'"
-msgstr "misslyckades färdigställa \"%s\""
+msgstr "misslyckades färdigställa ”%s”"
 
 #, c-format
 msgid "your local changes would be overwritten by %s."
 msgstr "dina lokala ändringar skulle skrivas över av %s."
 
 msgid "commit your changes or stash them to proceed."
-msgstr "checka in dina ändringar eller använd \"stash\" för att fortsätta."
+msgstr "checka in dina ändringar eller använd ”stash” för att fortsätta."
 
 #. TRANSLATORS: %s will be "revert", "cherry-pick" or
 #. "rebase".
@@ -19681,33 +19873,33 @@ msgstr "kunde inte bestämma HEAD:s incheckning"
 
 #, c-format
 msgid "no key present in '%.*s'"
-msgstr "ingen nyckel i  \"%.*s\""
+msgstr "ingen nyckel i  ”%.*s”"
 
 #, c-format
 msgid "unable to dequote value of '%s'"
-msgstr "kan inte ta bort citering av värdet \"%s\""
+msgstr "kan inte ta bort citering av värdet ”%s”"
 
 msgid "'GIT_AUTHOR_NAME' already given"
-msgstr "\"GIT_AUTHOR_NAME\" har redan angivits"
+msgstr "”GIT_AUTHOR_NAME” har redan angivits"
 
 msgid "'GIT_AUTHOR_EMAIL' already given"
-msgstr "\"GIT_AUTHOR_EMAIL\" har redan angivits"
+msgstr "”GIT_AUTHOR_EMAIL” har redan angivits"
 
 msgid "'GIT_AUTHOR_DATE' already given"
-msgstr "\"GIT_AUTHOR_DATE\" har redan angivits"
+msgstr "”GIT_AUTHOR_DATE” har redan angivits"
 
 #, c-format
 msgid "unknown variable '%s'"
-msgstr "okänd variabel \"%s\""
+msgstr "okänd variabel ”%s”"
 
 msgid "missing 'GIT_AUTHOR_NAME'"
-msgstr "\"GIT_AUTHOR_NAME\" saknas"
+msgstr "”GIT_AUTHOR_NAME” saknas"
 
 msgid "missing 'GIT_AUTHOR_EMAIL'"
-msgstr "\"GIT_AUTHOR_EMAIL\" saknas"
+msgstr "”GIT_AUTHOR_EMAIL” saknas"
 
 msgid "missing 'GIT_AUTHOR_DATE'"
-msgstr "\"GIT_AUTHOR_DATE\" saknas"
+msgstr "”GIT_AUTHOR_DATE” saknas"
 
 #, c-format
 msgid ""
@@ -19738,7 +19930,7 @@ msgstr ""
 "  git rebase --continue\n"
 
 msgid "'prepare-commit-msg' hook failed"
-msgstr "kroken \"prepare-commit-msg\" misslyckades"
+msgstr "kroken ”prepare-commit-msg” misslyckades"
 
 msgid ""
 "Your name and email address were configured automatically based\n"
@@ -19817,11 +20009,11 @@ msgstr "kunde inte tolka incheckningens författare"
 
 #, c-format
 msgid "unable to read commit message from '%s'"
-msgstr "kunde inte läsa incheckningsmeddelande från \"%s\""
+msgstr "kunde inte läsa incheckningsmeddelande från ”%s”"
 
 #, c-format
 msgid "invalid author identity '%s'"
-msgstr "ogiltig författar-identitet \"%s\""
+msgstr "ogiltig författar-identitet ”%s”"
 
 msgid "corrupt author: missing date information"
 msgstr "trasig författare: saknar datuminformation"
@@ -19862,7 +20054,7 @@ msgstr "Det här är en kombination av %d incheckningar."
 
 #, c-format
 msgid "cannot write '%s'"
-msgstr "kan inte skriva \"%s\""
+msgstr "kan inte skriva ”%s”"
 
 msgid "need a HEAD to fixup"
 msgstr "behöver en HEAD-incheckning att rätta"
@@ -19881,7 +20073,7 @@ msgid "your index file is unmerged."
 msgstr "din indexfil har inte slagits ihop."
 
 msgid "cannot fixup root commit"
-msgstr "kan inte göra \"fixup\" på rotincheckning"
+msgstr "kan inte göra ”fixup” på rotincheckning"
 
 #, c-format
 msgid "commit %s is a merge but no -m option was given."
@@ -19901,10 +20093,6 @@ msgstr "kan inte hämta incheckningsmeddelande för %s"
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s: kan inte tolka föräldraincheckningen %s"
 
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "kunde inte byta namn på \"%s\" till \"%s\""
-
 #, c-format
 msgid "could not revert %s... %s"
 msgstr "kunde inte ångra %s... %s"
@@ -19927,11 +20115,11 @@ msgstr "git %s: misslyckades uppdatera indexet"
 
 #, c-format
 msgid "'%s' is not a valid label"
-msgstr "\"%s\" är inte en giltig etikett"
+msgstr "”%s” är inte en giltig etikett"
 
 #, c-format
 msgid "'%s' is not a valid refname"
-msgstr "\"%s\" är inte ett giltigt referensnamn"
+msgstr "”%s” är inte ett giltigt referensnamn"
 
 #, c-format
 msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
@@ -19939,11 +20127,11 @@ msgstr "update-ref kräver ett fullständigt referensnamn, t.ex refs/heads/%s"
 
 #, c-format
 msgid "invalid command '%.*s'"
-msgstr "ogiltigt kommando \"%.*s\""
+msgstr "ogiltigt kommando ”%.*s”"
 
 #, c-format
 msgid "%s does not accept arguments: '%s'"
-msgstr "%s tar inte argument: \"%s\""
+msgstr "%s tar inte argument: ”%s”"
 
 #, c-format
 msgid "missing arguments for %s"
@@ -19951,7 +20139,7 @@ msgstr "argument saknas för %s"
 
 #, c-format
 msgid "could not parse '%s'"
-msgstr "kunde inte tolka \"%s\""
+msgstr "kunde inte tolka ”%s”"
 
 #, c-format
 msgid "invalid line %d: %.*s"
@@ -19959,60 +20147,60 @@ msgstr "ogiltig rad %d: %.*s"
 
 #, c-format
 msgid "cannot '%s' without a previous commit"
-msgstr "kan inte utföra \"%s\" utan en föregående incheckning"
+msgstr "kan inte utföra ”%s” utan en föregående incheckning"
 
 msgid "cancelling a cherry picking in progress"
-msgstr "avbryter pågående \"cherry-pick\""
+msgstr "avbryter pågående ”cherry-pick”"
 
 msgid "cancelling a revert in progress"
-msgstr "avbryter pågående \"revert\""
+msgstr "avbryter pågående ”revert”"
 
 msgid "please fix this using 'git rebase --edit-todo'."
-msgstr "rätta det med \"git rebase --edit-todo\"."
+msgstr "rätta det med ”git rebase --edit-todo”."
 
 #, c-format
 msgid "unusable instruction sheet: '%s'"
-msgstr "oanvändbart manus: \"%s\""
+msgstr "oanvändbart manus: ”%s”"
 
 msgid "no commits parsed."
 msgstr "inga incheckningar lästes."
 
 msgid "cannot cherry-pick during a revert."
-msgstr "kan inte utföra \"cherry-pick\" under en \"revert\"."
+msgstr "kan inte utföra ”cherry-pick” under en ”revert”."
 
 msgid "cannot revert during a cherry-pick."
-msgstr "kan inte utföra \"revert\" under en \"cherry-pick\"."
+msgstr "kan inte utföra ”revert” under en ”cherry-pick”."
 
 msgid "unusable squash-onto"
 msgstr "oanvändbar squash-onto"
 
 #, c-format
 msgid "malformed options sheet: '%s'"
-msgstr "trasigt manus: \"%s\""
+msgstr "trasigt manus: ”%s”"
 
 msgid "empty commit set passed"
 msgstr "den angivna uppsättningen incheckningar är tom"
 
 msgid "revert is already in progress"
-msgstr "en \"revert\" pågår redan"
+msgstr "en ”revert” pågår redan"
 
 #, c-format
 msgid "try \"git revert (--continue | %s--abort | --quit)\""
-msgstr "testa \"git revert (--continue | %s--abort | --quit)\""
+msgstr "testa ”git revert (--continue | %s--abort | --quit)”"
 
 msgid "cherry-pick is already in progress"
-msgstr "en \"cherry-pick\" pågår redan"
+msgstr "en ”cherry-pick” pågår redan"
 
 #, c-format
 msgid "try \"git cherry-pick (--continue | %s--abort | --quit)\""
-msgstr "testa \"git cherry-pick (--continue | %s--abort | --quit)\""
+msgstr "testa ”git cherry-pick (--continue | %s--abort | --quit)”"
 
 #, c-format
 msgid "could not create sequencer directory '%s'"
-msgstr "kunde inte skapa \"sequencer\"-katalogen \"%s\""
+msgstr "kunde inte skapa ”sequencer”-katalogen ”%s”"
 
 msgid "no cherry-pick or revert in progress"
-msgstr "ingen \"cherry-pick\" eller \"revert\" pågår"
+msgstr "ingen ”cherry-pick” eller ”revert” pågår"
 
 msgid "cannot resolve HEAD"
 msgstr "kan inte bestämma HEAD"
@@ -20022,14 +20210,14 @@ msgstr "kan inte avbryta från en gren som ännu inte är född"
 
 #, c-format
 msgid "cannot read '%s': %s"
-msgstr "kan inte läsa \"%s\": %s"
+msgstr "kan inte läsa ”%s”: %s"
 
 msgid "unexpected end of file"
 msgstr "oväntat filslut"
 
 #, c-format
 msgid "stored pre-cherry-pick HEAD file '%s' is corrupt"
-msgstr "sparad HEAD-fil från före \"cherry-pick\", \"%s\", är trasig"
+msgstr "sparad HEAD-fil från före ”cherry-pick”, ”%s”, är trasig"
 
 msgid "You seem to have moved HEAD. Not rewinding, check your HEAD!"
 msgstr ""
@@ -20037,10 +20225,10 @@ msgstr ""
 "Spolar inte tillbaka, kontrollera HEAD!"
 
 msgid "no revert in progress"
-msgstr "ingen \"revers\" pågår"
+msgstr "ingen ”revert” pågår"
 
 msgid "no cherry-pick in progress"
-msgstr "ingen \"cherry-pick\" pågår"
+msgstr "ingen ”cherry-pick” pågår"
 
 msgid "failed to skip the commit"
 msgstr "kunde inte hoppa över incheckningen"
@@ -20054,14 +20242,14 @@ msgid ""
 "try \"git %s --continue\""
 msgstr ""
 "har du redan checkat in?\n"
-"testa \"git %s --continue\""
+"testa ”git %s --continue”"
 
 msgid "cannot read HEAD"
 msgstr "kan inte läsa HEAD"
 
 #, c-format
 msgid "unable to copy '%s' to '%s'"
-msgstr "kan inte kopiera in \"%s\" till \"%s\""
+msgstr "kan inte kopiera in ”%s” till ”%s”"
 
 #, c-format
 msgid ""
@@ -20121,18 +20309,18 @@ msgid ""
 msgstr ""
 "körningen lyckades: %s\n"
 "men lämnade kvar ändringar i indexet och/eller arbetskatalogen.\n"
-"Checka in eller utför \"stash\" på ändringarna och kör sedan\n"
+"Checka in eller utför ”stash” på ändringarna och kör sedan\n"
 "\n"
 "\tgit rebase --continue\n"
 "\n"
 
 #, c-format
 msgid "illegal label name: '%.*s'"
-msgstr "ogiltigt etikettnamn: \"%.*s\""
+msgstr "ogiltigt etikettnamn: ”%.*s”"
 
 #, c-format
 msgid "could not resolve '%s'"
-msgstr "kunde inte upplösa \"%s\""
+msgstr "kunde inte upplösa ”%s”"
 
 msgid "writing fake root commit"
 msgstr "skriver fejkad rotincheckning"
@@ -20145,22 +20333,22 @@ msgstr "kan inte slå ihop utan en aktuell incheckning"
 
 #, c-format
 msgid "unable to parse '%.*s'"
-msgstr "kan inte tolka \"%.*s\""
+msgstr "kan inte tolka ”%.*s”"
 
 #, c-format
 msgid "nothing to merge: '%.*s'"
-msgstr "inget att slå samman: \"%.*s\""
+msgstr "inget att slå samman: ”%.*s”"
 
 msgid "octopus merge cannot be executed on top of a [new root]"
-msgstr "\"octopus\"-sammanslagning kan inte köras ovanpå en [ny rot]"
+msgstr "”octopus”-sammanslagning kan inte köras ovanpå en [ny rot]"
 
 #, c-format
 msgid "could not get commit message of '%s'"
-msgstr "kunde inte läsa incheckningsmeddelande för \"%s\""
+msgstr "kunde inte läsa incheckningsmeddelande för ”%s”"
 
 #, c-format
 msgid "could not even attempt to merge '%.*s'"
-msgstr "kunde inte ens försöka slå ihop \"%.*s\""
+msgstr "kunde inte ens försöka slå ihop ”%.*s”"
 
 msgid "merge: Unable to write new index file"
 msgstr "sammanslagning: Kunde inte skriva ny indexfil"
@@ -20168,7 +20356,7 @@ msgstr "sammanslagning: Kunde inte skriva ny indexfil"
 #, c-format
 msgid ""
 "another 'rebase' process appears to be running; '%s.lock' already exists"
-msgstr "en annan \"rebase\"-process verkar vara aktiv; \"%s.lock\" finns redan"
+msgstr "en annan ”rebase”-process verkar vara aktiv; ”%s.lock” finns redan"
 
 #, c-format
 msgid ""
@@ -20187,22 +20375,22 @@ msgstr ""
 "%s"
 
 msgid "Cannot autostash"
-msgstr "Kan inte utföra \"autostash\""
+msgstr "Kan inte utföra ”autostash”"
 
 #, c-format
 msgid "Unexpected stash response: '%s'"
-msgstr "Oväntat svar från stash: \"%s\""
+msgstr "Oväntat svar från stash: ”%s”"
 
 #, c-format
 msgid "Could not create directory for '%s'"
-msgstr "Kunde inte skapa katalog för \"%s\""
+msgstr "Kunde inte skapa katalog för ”%s”"
 
 #, c-format
 msgid "Created autostash: %s\n"
 msgstr "Skapade autostash: %s\n"
 
 msgid "could not reset --hard"
-msgstr "kunde inte utföra \"reset --hard\""
+msgstr "kunde inte utföra ”reset --hard”"
 
 #, c-format
 msgid "Applied autostash.\n"
@@ -20220,7 +20408,7 @@ msgid ""
 msgstr ""
 "%s\n"
 "Dina ändringar är säkra i stashen.\n"
-"Du kan när som helst använda \"git stash pop\" eller \"git stash drop\".\n"
+"Du kan när som helst använda ”git stash pop” eller ”git stash drop”.\n"
 
 msgid "Applying autostash resulted in conflicts."
 msgstr "Tillämpning av autostash gav konflikter."
@@ -20228,6 +20416,9 @@ msgstr "Tillämpning av autostash gav konflikter."
 msgid "Autostash exists; creating a new stash entry."
 msgstr "Autostash finns; skapar ny stash-post."
 
+msgid "autostash reference is a symref"
+msgstr "autostash-referensen är en symbolisk referens"
+
 msgid "could not detach HEAD"
 msgstr "kunde inte koppla från HEAD"
 
@@ -20259,14 +20450,14 @@ msgstr ""
 "    git rebase --edit-todo\n"
 "    git rebase --continue\n"
 
-#, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "Ombaserar (%d/%d)%s"
-
 #, c-format
 msgid "Stopped at %s...  %.*s\n"
 msgstr "Stoppade på %s... %.*s\n"
 
+#, c-format
+msgid "Rebasing (%d/%d)%s"
+msgstr "Ombaserar (%d/%d)%s"
+
 #, c-format
 msgid "unknown command %d"
 msgstr "okänt kommando %d"
@@ -20275,7 +20466,7 @@ msgid "could not read orig-head"
 msgstr "kunde inte läsa orig-head"
 
 msgid "could not read 'onto'"
-msgstr "kunde inte läsa \"onto\""
+msgstr "kunde inte läsa ”onto”"
 
 #, c-format
 msgid "could not update HEAD to %s"
@@ -20293,11 +20484,11 @@ msgstr "kan inte lägga till incheckning som inte finns"
 
 #, c-format
 msgid "invalid file: '%s'"
-msgstr "ogiltig fil: \"%s\""
+msgstr "ogiltig fil: ”%s”"
 
 #, c-format
 msgid "invalid contents: '%s'"
-msgstr "ogiltigt innehåll: \"%s\""
+msgstr "ogiltigt innehåll: ”%s”"
 
 msgid ""
 "\n"
@@ -20306,11 +20497,11 @@ msgid ""
 msgstr ""
 "\n"
 "Du har ändringar i arbetskatalogen som inte checkats in. Checka in dem\n"
-"först och kör sedan \"git rebase --continue\" igen."
+"först och kör sedan ”git rebase --continue” igen."
 
 #, c-format
 msgid "could not write file: '%s'"
-msgstr "kunde inte skriva fil: \"%s\""
+msgstr "kunde inte skriva fil: ”%s”"
 
 msgid "could not remove CHERRY_PICK_HEAD"
 msgstr "kunde inte ta bort CHERRY_PICK_HEAD"
@@ -20320,7 +20511,7 @@ msgstr "kunde inte checka in köade ändringar."
 
 #, c-format
 msgid "%s: can't cherry-pick a %s"
-msgstr "%s: kan inte göra \"cherry-pick\" på typen \"%s\""
+msgstr "%s: kan inte göra ”cherry-pick” på typen ”%s”"
 
 #, c-format
 msgid "%s: bad revision"
@@ -20346,18 +20537,18 @@ msgid "nothing to do"
 msgstr "inget att göra"
 
 msgid "could not skip unnecessary pick commands"
-msgstr "kunde inte hoppa över onödiga \"pick\"-kommandon"
+msgstr "kunde inte hoppa över onödiga ”pick”-kommandon"
 
 msgid "the script was already rearranged."
 msgstr "skriptet har redan omordnats."
 
 #, c-format
 msgid "update-refs file at '%s' is invalid"
-msgstr "update-refs-filen vid \"%s\" är ogiltig"
+msgstr "update-refs-filen vid ”%s” är ogiltig"
 
 #, c-format
 msgid "'%s' is outside repository at '%s'"
-msgstr "\"%s\" är utanför arkivet på \"%s\""
+msgstr "”%s” är utanför arkivet på ”%s”"
 
 #, c-format
 msgid ""
@@ -20365,7 +20556,7 @@ msgid ""
 "Use 'git <command> -- <path>...' to specify paths that do not exist locally."
 msgstr ""
 "%s: sökvägen finns inte i arbetskatalogen.\n"
-"Använd \"git <kommando> -- <sökväg>..\" för att ange sökvägar som inte finns "
+"Använd ”git <kommando> -- <sökväg>..” för att ange sökvägar som inte finns "
 "lokalt."
 
 #, c-format
@@ -20374,14 +20565,14 @@ msgid ""
 "Use '--' to separate paths from revisions, like this:\n"
 "'git <command> [<revision>...] -- [<file>...]'"
 msgstr ""
-"tvetydigt argument \"%s\": okänd revision eller sökväg inte i "
+"tvetydigt argument ”%s”: okänd revision eller sökväg inte i "
 "arbetskatalogen.\n"
-"Använd \"--\" för att skilja sökvägar från revisioner, så här:\n"
-"\"git <kommando> [<revision>...] -- [<fil>...]\""
+"Använd ”--” för att skilja sökvägar från revisioner, så här:\n"
+"”git <kommando> [<revision>...] -- [<fil>...]”"
 
 #, c-format
 msgid "option '%s' must come before non-option arguments"
-msgstr "flaggan \"%s\" måste anges före argument som inte är flaggor"
+msgstr "flaggan ”%s” måste anges före argument som inte är flaggor"
 
 #, c-format
 msgid ""
@@ -20389,9 +20580,9 @@ msgid ""
 "Use '--' to separate paths from revisions, like this:\n"
 "'git <command> [<revision>...] -- [<file>...]'"
 msgstr ""
-"tvetydigt argument \"%s\": både revision och filnamn\n"
-"Använd \"--\" för att skilja sökvägar från revisioner, så här:\n"
-"\"git <kommando> [<revision>...] -- [<fil>...]\""
+"tvetydigt argument ”%s”: både revision och filnamn\n"
+"Använd ”--” för att skilja sökvägar från revisioner, så här:\n"
+"”git <kommando> [<revision>...] -- [<fil>...]”"
 
 msgid "unable to set up work tree using invalid config"
 msgstr "kan inte skapa arbetskatalog med felaktig konfiguration"
@@ -20412,11 +20603,11 @@ msgstr[1] "arkivversionen är 0, men utökningar som bara finns i v1 upptäcktes
 
 #, c-format
 msgid "error opening '%s'"
-msgstr "fel vid öppning av \"%s\""
+msgstr "fel vid öppning av ”%s”"
 
 #, c-format
 msgid "too large to be a .git file: '%s'"
-msgstr "för stor för att vara en .git-fil: \"%s\""
+msgstr "för stor för att vara en .git-fil: ”%s”"
 
 #, c-format
 msgid "error reading %s"
@@ -20436,29 +20627,29 @@ msgstr "inte ett git-arkiv: %s"
 
 #, c-format
 msgid "'$%s' too big"
-msgstr "\"$%s\" för stor"
+msgstr "”$%s” för stor"
 
 #, c-format
 msgid "not a git repository: '%s'"
-msgstr "inte ett git-arkiv: \"%s\""
+msgstr "inte ett git-arkiv: ”%s”"
 
 #, c-format
 msgid "cannot chdir to '%s'"
-msgstr "kan inte byta katalog (chdir) till \"%s\""
+msgstr "kan inte byta katalog (chdir) till ”%s”"
 
 msgid "cannot come back to cwd"
 msgstr "kan inte gå tillbaka till arbetskatalogen (cwd)"
 
 #, c-format
 msgid "failed to stat '%*s%s%s'"
-msgstr "misslyckades ta status på \"%*ss%s%s\""
+msgstr "misslyckades ta status på ”%*ss%s%s”"
 
 msgid "Unable to read current working directory"
 msgstr "Kan inte läsa aktuell arbetskatalog"
 
 #, c-format
 msgid "cannot change to '%s'"
-msgstr "kan inte byta till \"%s\""
+msgstr "kan inte byta till ”%s”"
 
 #, c-format
 msgid "not a git repository (or any of the parent directories): %s"
@@ -20480,14 +20671,14 @@ msgid ""
 "\n"
 "\tgit config --global --add safe.directory %s"
 msgstr ""
-"upptäckte tveksamt ägarskap i arkivet i \"%s\"\n"
+"upptäckte tveksamt ägarskap i arkivet i ”%s”\n"
 "%sFör att lägga till ett undantag för denna katalog, kör:\n"
 "\n"
 "\tgit config --global --add safe.directory %s"
 
 #, c-format
 msgid "cannot use bare repository '%s' (safe.bareRepository is '%s')"
-msgstr "kan inte använda naket arkiv \"%s\" (safe.bareRepository är \"%s\")"
+msgstr "kan inte använda naket arkiv ”%s” (safe.bareRepository är ”%s”)"
 
 #, c-format
 msgid ""
@@ -20498,30 +20689,30 @@ msgstr ""
 "Ägaren av filerna måste alltid ha läs- och skrivbehörighet."
 
 msgid "fork failed"
-msgstr "\"fork\" misslyckades"
+msgstr "”fork” misslyckades"
 
 msgid "setsid failed"
-msgstr "\"setsid\" misslyckades"
+msgstr "”setsid” misslyckades"
 
 #, c-format
 msgid "cannot stat template '%s'"
-msgstr "kan inte ta status på mallen \"%s\""
+msgstr "kan inte ta status på mallen ”%s”"
 
 #, c-format
 msgid "cannot opendir '%s'"
-msgstr "kan inte öppna katalogen (opendir) \"%s\""
+msgstr "kan inte öppna katalogen (opendir) ”%s”"
 
 #, c-format
 msgid "cannot readlink '%s'"
-msgstr "kan inte läsa länk (readlink) \"%s\""
+msgstr "kan inte läsa länk (readlink) ”%s”"
 
 #, c-format
 msgid "cannot symlink '%s' '%s'"
-msgstr "kan inte skapa symbolisk länk \"%s\" \"%s\""
+msgstr "kan inte skapa symbolisk länk ”%s” ”%s”"
 
 #, c-format
 msgid "cannot copy '%s' to '%s'"
-msgstr "kan inte kopiera \"%s\" till \"%s\""
+msgstr "kan inte kopiera ”%s” till ”%s”"
 
 #, c-format
 msgid "ignoring template %s"
@@ -20533,11 +20724,15 @@ msgstr "mallarna hittades inte i %s"
 
 #, c-format
 msgid "not copying templates from '%s': %s"
-msgstr "kopierade inte mallar från \"%s\": %s"
+msgstr "kopierade inte mallar från ”%s”: %s"
 
 #, c-format
 msgid "invalid initial branch name: '%s'"
-msgstr "ogiltigt namn på första gren: \"%s\""
+msgstr "ogiltigt namn på första gren: ”%s”"
+
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-init: ignorerade --initial-branch=%s"
 
 #, c-format
 msgid "unable to handle file type %d"
@@ -20550,14 +20745,14 @@ msgstr "kan inte flytta %s till %s"
 msgid "attempt to reinitialize repository with different hash"
 msgstr "försöker initiera arkivet på nytt med annan hash"
 
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr "försöker initiera arkivet på nytt med annat referenslagringsformat"
+
 #, c-format
 msgid "%s already exists"
 msgstr "%s finns redan"
 
-#, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-init: ignorerade --initial-branch=%s"
-
 #, c-format
 msgid "Reinitialized existing shared Git repository in %s%s\n"
 msgstr "Ominitierade befintligt delat Git-arkiv i %s%s\n"
@@ -20634,7 +20829,7 @@ msgstr "negativa värden är inte tillåtna för submodule.fetchJobs"
 
 #, c-format
 msgid "ignoring '%s' which may be interpreted as a command-line option: %s"
-msgstr "ignorerar \"%s\" som kan tolkas som en kommandoradsflagga: %s"
+msgstr "ignorerar ”%s” som kan tolkas som en kommandoradsflagga: %s"
 
 #, c-format
 msgid "Could not update .gitmodules entry %s"
@@ -20658,11 +20853,11 @@ msgstr "misslyckades köa uppdaterad .gitmodules"
 
 #, c-format
 msgid "in unpopulated submodule '%s'"
-msgstr "i ej utcheckad undermodul \"%s\""
+msgstr "i ej utcheckad undermodul ”%s”"
 
 #, c-format
 msgid "Pathspec '%s' is in submodule '%.*s'"
-msgstr "Sökvägsangivelsen \"%s\" är i undermodulen \"%.*s\""
+msgstr "Sökvägsangivelsen ”%s” är i undermodulen ”%.*s”"
 
 #, c-format
 msgid "bad --ignore-submodules argument: %s"
@@ -20673,32 +20868,32 @@ msgid ""
 "Submodule in commit %s at path: '%s' collides with a submodule named the "
 "same. Skipping it."
 msgstr ""
-"Undermodulen i incheckning %s på sökvägen: \"%s\" krockar med en undermodul "
+"Undermodulen i incheckning %s på sökvägen: ”%s” krockar med en undermodul "
 "med samma namn. Hoppar över den."
 
 #, c-format
 msgid "submodule entry '%s' (%s) is a %s, not a commit"
-msgstr "undermodulposten \"%s\" (%s) är en %s, inte en incheckning"
+msgstr "undermodulposten ”%s” (%s) är en %s, inte en incheckning"
 
 #, c-format
 msgid ""
 "Could not run 'git rev-list <commits> --not --remotes -n 1' command in "
 "submodule %s"
 msgstr ""
-"kunde inte köra \"git rev-list <incheckningar> --not --remotes -n 1\" i "
-"undermodulen \"%s\""
+"kunde inte köra ”git rev-list <incheckningar> --not --remotes -n 1” i "
+"undermodulen ”%s”"
 
 #, c-format
 msgid "process for submodule '%s' failed"
-msgstr "process för undermodulen \"%s\" misslyckades"
+msgstr "process för undermodulen ”%s” misslyckades"
 
 #, c-format
 msgid "Pushing submodule '%s'\n"
-msgstr "Sänder undermodulen \"%s\"\n"
+msgstr "Sänder undermodulen ”%s”\n"
 
 #, c-format
 msgid "Unable to push submodule '%s'\n"
-msgstr "Kunde inte sända undermodulen \"%s\"\n"
+msgstr "Kunde inte sända undermodulen ”%s”\n"
 
 #, c-format
 msgid "Fetching submodule %s%s\n"
@@ -20706,11 +20901,11 @@ msgstr "Hämtar undermodulen %s%s\n"
 
 #, c-format
 msgid "Could not access submodule '%s'\n"
-msgstr "Kunde inte komma åt undermodulen \"%s\"\n"
+msgstr "Kunde inte komma åt undermodulen ”%s”\n"
 
 #, c-format
 msgid "Could not access submodule '%s' at commit %s\n"
-msgstr "Kunde inte komma åt undermodulen \"%s\" vid incheckningen %s\n"
+msgstr "Kunde inte komma åt undermodulen ”%s” vid incheckningen %s\n"
 
 #, c-format
 msgid "Fetching submodule %s%s at commit %s\n"
@@ -20726,61 +20921,61 @@ msgstr ""
 
 #, c-format
 msgid "'%s' not recognized as a git repository"
-msgstr "\"%s\" känns inte igen som ett git-arkiv"
+msgstr "”%s” känns inte igen som ett git-arkiv"
 
 #, c-format
 msgid "Could not run 'git status --porcelain=2' in submodule %s"
-msgstr "Kunde inte köra \"git status --porcelain=2\" i undermodulen \"%s\""
+msgstr "Kunde inte köra ”git status --porcelain=2” i undermodulen ”%s”"
 
 #, c-format
 msgid "'git status --porcelain=2' failed in submodule %s"
-msgstr "\"git status --porcelain=2\" misslyckades i undermodulen \"%s\""
+msgstr "”git status --porcelain=2” misslyckades i undermodulen ”%s”"
 
 #, c-format
 msgid "could not start 'git status' in submodule '%s'"
-msgstr "kunde inte starta \"git status\" i undermodulen \"%s\""
+msgstr "kunde inte starta ”git status” i undermodulen ”%s”"
 
 #, c-format
 msgid "could not run 'git status' in submodule '%s'"
-msgstr "kunde inte köra \"git status\" i undermodulen \"%s\""
+msgstr "kunde inte köra ”git status” i undermodulen ”%s”"
 
 #, c-format
 msgid "Could not unset core.worktree setting in submodule '%s'"
-msgstr "Kunde inte ta bort inställningen core.worktree i undermodulen \"%s\""
+msgstr "Kunde inte ta bort inställningen core.worktree i undermodulen ”%s”"
 
 #, c-format
 msgid "could not recurse into submodule '%s'"
-msgstr "kunde inte rekursera in i undermodulen \"%s\""
+msgstr "kunde inte rekursera in i undermodulen ”%s”"
 
 msgid "could not reset submodule index"
 msgstr "kunde inte återställa indexet i undermodul"
 
 #, c-format
 msgid "submodule '%s' has dirty index"
-msgstr "undermodulen \"%s\" har ett smutsigt index"
+msgstr "undermodulen ”%s” har ett smutsigt index"
 
 #, c-format
 msgid "Submodule '%s' could not be updated."
-msgstr "Undermoduler \"%s\" kunde inte uppdateras."
+msgstr "Undermoduler ”%s” kunde inte uppdateras."
 
 #, c-format
 msgid "submodule git dir '%s' is inside git dir '%.*s'"
-msgstr "undermodul-gitkatalogen \"%s\" är inuti gitkatalogen \"%.*s\""
+msgstr "undermodul-gitkatalogen ”%s” är inuti gitkatalogen ”%.*s”"
 
 #, c-format
 msgid ""
 "relocate_gitdir for submodule '%s' with more than one worktree not supported"
 msgstr ""
-"relocate_gitdir för undermodulen \"%s\", som har mer än en arbetskatalog, "
+"relocate_gitdir för undermodulen ”%s”, som har mer än en arbetskatalog, "
 "stöds ej"
 
 #, c-format
 msgid "could not lookup name for submodule '%s'"
-msgstr "kunde inte slå upp namnet för undermodulen \"%s\""
+msgstr "kunde inte slå upp namnet för undermodulen ”%s”"
 
 #, c-format
 msgid "refusing to move '%s' into an existing git dir"
-msgstr "vägrar flytta \"%s\" till en befintlig gitkatalog"
+msgstr "vägrar flytta ”%s” till en befintlig gitkatalog"
 
 #, c-format
 msgid ""
@@ -20788,9 +20983,9 @@ msgid ""
 "'%s' to\n"
 "'%s'\n"
 msgstr ""
-"Migrerar git-katalogen för \"%s%s\" från\n"
-"\"%s\" till\n"
-"\"%s\"\n"
+"Migrerar git-katalogen för ”%s%s” från\n"
+"”%s” till\n"
+"”%s”\n"
 
 msgid "could not start ls-files in .."
 msgstr "kunde inte starta ls-files i .."
@@ -20801,14 +20996,14 @@ msgstr "ls-tree returnerade en oväntad returkod %d"
 
 #, c-format
 msgid "failed to lstat '%s'"
-msgstr "misslyckades ta status (lstat) på \"%s\""
+msgstr "misslyckades ta status (lstat) på ”%s”"
 
 msgid "no remote configured to get bundle URIs from"
 msgstr "ingen fjärr att hämta bunt-URI:er från inställd"
 
 #, c-format
 msgid "remote '%s' has no configured URL"
-msgstr "fjärren \"%s\" har ingen URL konfigurerad"
+msgstr "fjärren ”%s” har ingen URL konfigurerad"
 
 msgid "could not get the bundle-uri list"
 msgstr "kunde inte hämta bundle-uri-listan"
@@ -20822,12 +21017,6 @@ msgstr "töm cacheträdet före varje iteration"
 msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr "antal poster i cacheträdet att ogiltigförklara (förval är 0)"
 
-msgid "unhandled options"
-msgstr "flaggor som inte hanterats"
-
-msgid "error preparing revisions"
-msgstr "fel när revisioner skulle förberedas"
-
 #, c-format
 msgid "commit %s is not marked reachable"
 msgstr "incheckning %s är inte märkt nåbar"
@@ -20899,19 +21088,19 @@ msgstr "igenkänningstecken för kommando att sända till servern"
 
 #, c-format
 msgid "running trailer command '%s' failed"
-msgstr "misslyckades utföra släpradskommandot \"%s\""
+msgstr "misslyckades utföra släpradskommandot ”%s”"
 
 #, c-format
 msgid "unknown value '%s' for key '%s'"
-msgstr "okänt värde \"%s\" för nyckeln \"%s\""
+msgstr "okänt värde ”%s” för nyckeln ”%s”"
 
 #, c-format
 msgid "empty trailer token in trailer '%.*s'"
-msgstr "tom släpradssymbol i släpraden \"%.*s\""
+msgstr "tom släpradssymbol i släpraden ”%.*s”"
 
 #, c-format
 msgid "could not read input file '%s'"
-msgstr "kunde inte läsa indatafilen \"%s\""
+msgstr "kunde inte läsa indatafilen ”%s”"
 
 #, c-format
 msgid "could not stat %s"
@@ -20937,7 +21126,7 @@ msgstr "komplett skrivning till fjärrhjälpare misslyckades"
 
 #, c-format
 msgid "unable to find remote helper for '%s'"
-msgstr "kan inte hitta fjärrhjälpare för \"%s\""
+msgstr "kan inte hitta fjärrhjälpare för ”%s”"
 
 msgid "can't dup helper output fd"
 msgstr "kunde inte duplicera utdata-filhandtag"
@@ -20957,7 +21146,7 @@ msgstr ""
 
 #, c-format
 msgid "%s unexpectedly said: '%s'"
-msgstr "%s sade oväntat: \"%s\""
+msgstr "%s sade oväntat: ”%s”"
 
 #, c-format
 msgid "%s also locked %s"
@@ -20983,9 +21172,6 @@ msgstr "protkollet stöder inte att sätta sökväg till fjärrtjänst"
 msgid "invalid remote service path"
 msgstr "felaktig sökväg till fjärrtjänst"
 
-msgid "operation not supported by protocol"
-msgstr "funktionen stöds inte av protokollet"
-
 #, c-format
 msgid "can't connect to subservice %s"
 msgstr "kan inte ansluta till undertjänsten %s"
@@ -20994,11 +21180,11 @@ msgid "--negotiate-only requires protocol v2"
 msgstr "--negotiate-only kräver protokoll v2"
 
 msgid "'option' without a matching 'ok/error' directive"
-msgstr "\"option\" utan mostsvarande \"ok/error\"-direktiv"
+msgstr "”option” utan mostsvarande ”ok/error”-direktiv"
 
 #, c-format
 msgid "expected ok/error, helper said '%s'"
-msgstr "förväntade ok/error, hjälpprogrammet svarade \"%s\""
+msgstr "förväntade ok/error, hjälpprogrammet svarade ”%s”"
 
 #, c-format
 msgid "helper reported unexpected status of %s"
@@ -21026,14 +21212,14 @@ msgstr "hjälparen %s stöder inte --%s"
 
 #, c-format
 msgid "helper %s does not support 'push-option'"
-msgstr "hjälparen %s stöder inte \"push-option\""
+msgstr "hjälparen %s stöder inte ”push-option”"
 
 msgid "remote-helper doesn't support push; refspec needed"
 msgstr "fjärrhjälparen stöder inte push; referensspecifikation krävs"
 
 #, c-format
 msgid "helper %s does not support 'force'"
-msgstr "hjälparen %s stöder inte \"force\""
+msgstr "hjälparen %s stöder inte ”force”"
 
 msgid "couldn't run fast-export"
 msgstr "kunde inte köra fast-export"
@@ -21051,7 +21237,7 @@ msgstr ""
 
 #, c-format
 msgid "unsupported object format '%s'"
-msgstr "objektformatet \"%s\" stöds ej"
+msgstr "objektformatet ”%s” stöds ej"
 
 #, c-format
 msgid "malformed response in ref list: %s"
@@ -21090,18 +21276,18 @@ msgstr "kan inte skapa tråd för kopiering av data"
 
 #, c-format
 msgid "Would set upstream of '%s' to '%s' of '%s'\n"
-msgstr "Skulle sätta uppströms för \"%s\" till \"%s\" från \"%s\"\n"
+msgstr "Skulle sätta uppströms för ”%s” till ”%s” från ”%s”\n"
 
 #, c-format
 msgid "could not read bundle '%s'"
-msgstr "kunde inte läsa bunten \"%s\""
+msgstr "kunde inte läsa bunten ”%s”"
 
 #, c-format
 msgid "transport: invalid depth option '%s'"
-msgstr "transport: ogiltig flagga för depth: \"%s\""
+msgstr "transport: ogiltig flagga för depth: ”%s”"
 
 msgid "see protocol.version in 'git help config' for more details"
-msgstr "se protocol.version i \"git help config\" för mer information"
+msgstr "se protocol.version i ”git help config” för mer information"
 
 msgid "server options require protocol version 2 or later"
 msgstr "serverflaggor kräver protokollversion 2 eller senare"
@@ -21115,13 +21301,9 @@ msgstr "kunde inte tolka inställningen för transport.color.*"
 msgid "support for protocol v2 not implemented yet"
 msgstr "stöd för protokoll v2 ännu ej implementerat"
 
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "okänt värde för inställningen \"%s\": %s"
-
 #, c-format
 msgid "transport '%s' not allowed"
-msgstr "transporten \"%s\" tillåts inte"
+msgstr "transporten ”%s” tillåts inte"
 
 msgid "git-over-rsync is no longer supported"
 msgstr "git-over-rsync stöds inte längre"
@@ -21172,6 +21354,9 @@ msgstr "bundle-uri-funktionen stöds inte av protokollet"
 msgid "could not retrieve server-advertised bundle-uri list"
 msgstr "kunde inte hämta bundle-uri-listan som servern annonserade"
 
+msgid "operation not supported by protocol"
+msgstr "funktionen stöds inte av protokollet"
+
 msgid "too-short tree object"
 msgstr "trädobjekt för kort"
 
@@ -21190,7 +21375,7 @@ msgid ""
 "%%sPlease commit your changes or stash them before you switch branches."
 msgstr ""
 "Dina lokala ändringar av följande filer skulle skrivas över av utcheckning:\n"
-"%%sChecka in dina ändringar eller använd \"stash\" innan du byter gren."
+"%%sChecka in dina ändringar eller använd ”stash” innan du byter gren."
 
 #, c-format
 msgid ""
@@ -21207,7 +21392,7 @@ msgid ""
 msgstr ""
 "Dina lokala ändringar av följande filer skulle skrivas över av "
 "sammanslagning:\n"
-"%%sChecka in dina ändringar eller använd \"stash\" innan du byter gren."
+"%%sChecka in dina ändringar eller använd ”stash” innan du byter gren."
 
 #, c-format
 msgid ""
@@ -21223,15 +21408,15 @@ msgid ""
 "Your local changes to the following files would be overwritten by %s:\n"
 "%%sPlease commit your changes or stash them before you %s."
 msgstr ""
-"Dina lokala ändringar av följande filer skulle skrivas över av \"%s\":\n"
-"%%sChecka in dina ändringar eller använd \"stash\" innan du \"%s\"."
+"Dina lokala ändringar av följande filer skulle skrivas över av ”%s”:\n"
+"%%sChecka in dina ändringar eller använd ”stash” innan du ”%s”."
 
 #, c-format
 msgid ""
 "Your local changes to the following files would be overwritten by %s:\n"
 "%%s"
 msgstr ""
-"Dina lokala ändringar av följande filer skulle skrivas över av \"%s\":\n"
+"Dina lokala ändringar av följande filer skulle skrivas över av ”%s”:\n"
 "%%s"
 
 #, c-format
@@ -21290,15 +21475,15 @@ msgid ""
 "The following untracked working tree files would be removed by %s:\n"
 "%%sPlease move or remove them before you %s."
 msgstr ""
-"Följande ospårade filer i arbetskatalogen skulle tas bort av \"%s\":\n"
-"%%sFlytta eller ta bort dem innan du \"%s\"."
+"Följande ospårade filer i arbetskatalogen skulle tas bort av ”%s”:\n"
+"%%sFlytta eller ta bort dem innan du ”%s”."
 
 #, c-format
 msgid ""
 "The following untracked working tree files would be removed by %s:\n"
 "%%s"
 msgstr ""
-"Följande ospårade filer i arbetskatalogen skulle tas bort av \"%s\":\n"
+"Följande ospårade filer i arbetskatalogen skulle tas bort av ”%s”:\n"
 "%%s"
 
 #, c-format
@@ -21344,20 +21529,20 @@ msgid ""
 "The following untracked working tree files would be overwritten by %s:\n"
 "%%sPlease move or remove them before you %s."
 msgstr ""
-"Följande ospårade filer i arbetskatalogen skulle skrivas över av \"%s\":\n"
-"%%sFlytta eller ta bort dem innan du \"%s\"."
+"Följande ospårade filer i arbetskatalogen skulle skrivas över av ”%s”:\n"
+"%%sFlytta eller ta bort dem innan du ”%s”."
 
 #, c-format
 msgid ""
 "The following untracked working tree files would be overwritten by %s:\n"
 "%%s"
 msgstr ""
-"Följande ospårade filer i arbetskatalogen skulle skrivas över av \"%s\":\n"
+"Följande ospårade filer i arbetskatalogen skulle skrivas över av ”%s”:\n"
 "%%s"
 
 #, c-format
 msgid "Entry '%s' overlaps with '%s'.  Cannot bind."
-msgstr "Posten \"%s\" överlappar \"%s\". Kan inte binda."
+msgstr "Posten ”%s” överlappar ”%s”. Kan inte binda."
 
 #, c-format
 msgid ""
@@ -21404,7 +21589,7 @@ msgid ""
 "After fixing the above paths, you may want to run `git sparse-checkout "
 "reapply`.\n"
 msgstr ""
-"Du bör köra \"git sparse-checkout reapply\" efter att ha fixat sökvägarna "
+"Du bör köra ”git sparse-checkout reapply” efter att ha fixat sökvägarna "
 "ovan.\n"
 
 msgid "Updating files"
@@ -21427,20 +21612,20 @@ msgid "worktree and untracked commit have duplicate entries: %s"
 msgstr "arbetskatalog och ospårad incheckning har dublettposter: %s"
 
 msgid "expected flush after fetch arguments"
-msgstr "förväntade \"flush\" efter \"fetch\"-argument"
+msgstr "förväntade ”flush” efter ”fetch”-argument"
 
 msgid "invalid URL scheme name or missing '://' suffix"
-msgstr "ogiltig URL-schemanamn eller saknat \"://\"-suffix"
+msgstr "ogiltig URL-schemanamn eller saknat ”://”-suffix"
 
 #, c-format
 msgid "invalid %XX escape sequence"
 msgstr "ogiltig %XX-teckensekvens"
 
 msgid "missing host and scheme is not 'file:'"
-msgstr "värd saknas och schemat är inte \"file:\""
+msgstr "värd saknas och schemat är inte ”file:”"
 
 msgid "a 'file:' URL may not have a port number"
-msgstr "en \"file:\"-URL kan inte innehålla portnummer"
+msgstr "en ”file:”-URL kan inte innehålla portnummer"
 
 msgid "invalid characters in host name"
 msgstr "ogiltiga tecken i värdnamnet"
@@ -21449,7 +21634,7 @@ msgid "invalid port number"
 msgstr "felaktigt portnummer"
 
 msgid "invalid '..' path segment"
-msgstr "felaktigt \"..\"-sökvägssegment"
+msgstr "felaktigt ”..”-sökvägssegment"
 
 msgid "usage: "
 msgstr "användning: "
@@ -21468,19 +21653,19 @@ msgstr "Hämtar objekt"
 
 #, c-format
 msgid "'%s' at main working tree is not the repository directory"
-msgstr "\"%s\" i huvudarbetskatalogen är inte arkivkatalogen"
+msgstr "”%s” i huvudarbetskatalogen är inte arkivkatalogen"
 
 #, c-format
 msgid "'%s' file does not contain absolute path to the working tree location"
-msgstr "filen \"%s\" innehåller inte absolut sökväg till arbetskatalogen"
+msgstr "filen ”%s” innehåller inte absolut sökväg till arbetskatalogen"
 
 #, c-format
 msgid "'%s' is not a .git file, error code %d"
-msgstr "\"%s\" är inte en .git-fil, felkod %d"
+msgstr "”%s” är inte en .git-fil, felkod %d"
 
 #, c-format
 msgid "'%s' does not point back to '%s'"
-msgstr "\"%s\" pekar inte tillbaka till \"%s\""
+msgstr "”%s” pekar inte tillbaka till ”%s”"
 
 msgid "not a directory"
 msgstr "inte en katalog"
@@ -21534,57 +21719,60 @@ msgstr "gitdir-filen pekar på en ickeexisterande plats"
 
 #, c-format
 msgid "unable to set %s in '%s'"
-msgstr "kan inte sätta %s i \"%s\""
+msgstr "kan inte sätta %s i ”%s”"
 
 #, c-format
 msgid "unable to unset %s in '%s'"
-msgstr "kan inte slå av %s i \"%s\""
+msgstr "kan inte slå av %s i ”%s”"
 
 msgid "failed to set extensions.worktreeConfig setting"
 msgstr "misslyckades ändra inställningen extensions.worktreeConfig"
 
 #, c-format
 msgid "could not setenv '%s'"
-msgstr "kunde inte lagra miljövariabeln \"%s\""
+msgstr "kunde inte lagra miljövariabeln ”%s”"
 
 #, c-format
 msgid "unable to create '%s'"
-msgstr "kunde inte skapa \"%s\""
+msgstr "kunde inte skapa ”%s”"
 
 #, c-format
 msgid "could not open '%s' for reading and writing"
-msgstr "kunde inte öppna \"%s\" för läsning och skrivning"
+msgstr "kunde inte öppna ”%s” för läsning och skrivning"
 
 #, c-format
 msgid "unable to access '%s'"
-msgstr "kan inte komma åt \"%s\""
+msgstr "kan inte komma åt ”%s”"
 
 msgid "unable to get current working directory"
 msgstr "kan inte hämta aktuell arbetskatalog"
 
+msgid "unable to get random bytes"
+msgstr "kunde inte hämta slumpdata"
+
 msgid "Unmerged paths:"
 msgstr "Ej sammanslagna sökvägar:"
 
 msgid "  (use \"git restore --staged <file>...\" to unstage)"
-msgstr "  (använd \"git restore --staged <fil>...\" för att ta bort från kö)"
+msgstr "  (använd ”git restore --staged <fil>...” för att ta bort från kö)"
 
 #, c-format
 msgid "  (use \"git restore --source=%s --staged <file>...\" to unstage)"
 msgstr ""
-"  (använd \"git restore --source=%s --staged <fil>...\" för att ta bort från "
+"  (använd ”git restore --source=%s --staged <fil>...” för att ta bort från "
 "kö)"
 
 msgid "  (use \"git rm --cached <file>...\" to unstage)"
-msgstr "  (använd \"git rm --cached <fil>...\" för att ta bort från kö)"
+msgstr "  (använd ”git rm --cached <fil>...” för att ta bort från kö)"
 
 msgid "  (use \"git add <file>...\" to mark resolution)"
-msgstr "  (använd \"git add <fil>...\" för att ange lösning)"
+msgstr "  (använd ”git add <fil>...” för att ange lösning)"
 
 msgid "  (use \"git add/rm <file>...\" as appropriate to mark resolution)"
-msgstr "  (använd \"git add/rm <fil>...\" som lämpligt för att ange lösning)"
+msgstr "  (använd ”git add/rm <fil>...” som lämpligt för att ange lösning)"
 
 msgid "  (use \"git rm <file>...\" to mark resolution)"
-msgstr "  (använd \"git rm <fil>...\" för att ange lösning)"
+msgstr "  (använd ”git rm <fil>...” för att ange lösning)"
 
 msgid "Changes to be committed:"
 msgstr "Ändringar att checka in:"
@@ -21593,17 +21781,16 @@ msgid "Changes not staged for commit:"
 msgstr "Ändringar ej i incheckningskön:"
 
 msgid "  (use \"git add <file>...\" to update what will be committed)"
-msgstr ""
-"  (använd \"git add <fil>...\" för att uppdatera vad som ska checkas in)"
+msgstr "  (använd ”git add <fil>...” för att uppdatera vad som ska checkas in)"
 
 msgid "  (use \"git add/rm <file>...\" to update what will be committed)"
 msgstr ""
-"  (använd \"git add/rm <fil>...\" för att uppdatera vad som ska checkas in)"
+"  (använd ”git add/rm <fil>...” för att uppdatera vad som ska checkas in)"
 
 msgid ""
 "  (use \"git restore <file>...\" to discard changes in working directory)"
 msgstr ""
-"  (använd \"git restore <fil>...\" för att förkasta ändringar i "
+"  (använd ”git restore <fil>...” för att förkasta ändringar i "
 "arbetskatalogen)"
 
 msgid "  (commit or discard the untracked or modified content in submodules)"
@@ -21612,7 +21799,7 @@ msgstr ""
 
 #, c-format
 msgid "  (use \"git %s <file>...\" to include in what will be committed)"
-msgstr "  (använd \"git %s <fil>...\" för att ta med i det som ska checkas in)"
+msgstr "  (använd ”git %s <fil>...” för att ta med i det som ska checkas in)"
 
 msgid "both deleted:"
 msgstr "borttaget av bägge:"
@@ -21695,43 +21882,43 @@ msgid ""
 msgstr ""
 "\n"
 "Det tog %.2f sekunder att räkna före/bakom-värden.\n"
-"Du kan använda \"--no-ahead-behind\" för undvika detta.\n"
+"Du kan använda ”--no-ahead-behind” för undvika detta.\n"
 
 msgid "You have unmerged paths."
 msgstr "Du har ej sammanslagna sökvägar."
 
 msgid "  (fix conflicts and run \"git commit\")"
-msgstr "  (rätta konflikter och kör \"git commit\")"
+msgstr "  (rätta konflikter och kör ”git commit”)"
 
 msgid "  (use \"git merge --abort\" to abort the merge)"
-msgstr "  (använd \"git merge --abort\" för att avbryta sammanslagningen)"
+msgstr "  (använd ”git merge --abort” för att avbryta sammanslagningen)"
 
 msgid "All conflicts fixed but you are still merging."
 msgstr "Alla konflikter har rättats men du är fortfarande i en sammanslagning."
 
 msgid "  (use \"git commit\" to conclude merge)"
-msgstr "  (använd \"git commit\" för att slutföra sammanslagningen)"
+msgstr "  (använd ”git commit” för att slutföra sammanslagningen)"
 
 msgid "You are in the middle of an am session."
-msgstr "Du är i mitten av en körning av \"git am\"."
+msgstr "Du är i mitten av en körning av ”git am”."
 
 msgid "The current patch is empty."
 msgstr "Aktuell patch är tom."
 
 msgid "  (fix conflicts and then run \"git am --continue\")"
-msgstr "  (rätta konflikter och kör sedan \"git am --continue\")"
+msgstr "  (rätta konflikter och kör sedan ”git am --continue”)"
 
 msgid "  (use \"git am --skip\" to skip this patch)"
-msgstr "  (använd \"git am --skip\" för att hoppa över patchen)"
+msgstr "  (använd ”git am --skip” för att hoppa över patchen)"
 
 msgid ""
 "  (use \"git am --allow-empty\" to record this patch as an empty commit)"
 msgstr ""
-"  (använd \"git am --allow-empty\" för att registrera patchen som en tom "
+"  (använd ”git am --allow-empty” för att registrera patchen som en tom "
 "incheckning)"
 
 msgid "  (use \"git am --abort\" to restore the original branch)"
-msgstr "  (använd \"git am --abort\" för att återställa ursprungsgrenen)"
+msgstr "  (använd ”git am --abort” för att återställa ursprungsgrenen)"
 
 msgid "git-rebase-todo is missing."
 msgstr "git-rebase-todo saknas."
@@ -21759,79 +21946,79 @@ msgstr[0] "Nästa kommando att utföra (%<PRIuMAX> kommando återstår):"
 msgstr[1] "Följande kommandon att utföra (%<PRIuMAX> kommandon återstår):"
 
 msgid "  (use \"git rebase --edit-todo\" to view and edit)"
-msgstr "  (använd \"git rebase --edit-todo\" för att visa och redigera)"
+msgstr "  (använd ”git rebase --edit-todo” för att visa och redigera)"
 
 #, c-format
 msgid "You are currently rebasing branch '%s' on '%s'."
-msgstr "Du håller på att ombasera grenen \"%s\" ovanpå \"%s\"."
+msgstr "Du håller på att ombasera grenen ”%s” ovanpå ”%s”."
 
 msgid "You are currently rebasing."
 msgstr "Du håller på med en ombasering."
 
 msgid "  (fix conflicts and then run \"git rebase --continue\")"
-msgstr "  (rätta konflikter och kör sedan \"git rebase --continue\")"
+msgstr "  (rätta konflikter och kör sedan ”git rebase --continue”)"
 
 msgid "  (use \"git rebase --skip\" to skip this patch)"
-msgstr "  (använd \"git rebase --skip\" för att hoppa över patchen)"
+msgstr "  (använd ”git rebase --skip” för att hoppa över patchen)"
 
 msgid "  (use \"git rebase --abort\" to check out the original branch)"
-msgstr "  (använd \"git rebase --abort\" för att checka ut ursprungsgrenen)"
+msgstr "  (använd ”git rebase --abort” för att checka ut ursprungsgrenen)"
 
 msgid "  (all conflicts fixed: run \"git rebase --continue\")"
-msgstr "  (alla konflikter rättade: kör \"git rebase --continue\")"
+msgstr "  (alla konflikter rättade: kör ”git rebase --continue”)"
 
 #, c-format
 msgid ""
 "You are currently splitting a commit while rebasing branch '%s' on '%s'."
 msgstr ""
-"Du håller på att dela upp en incheckning medan du ombaserar grenen \"%s\" "
-"ovanpå \"%s\"."
+"Du håller på att dela upp en incheckning medan du ombaserar grenen ”%s” "
+"ovanpå ”%s”."
 
 msgid "You are currently splitting a commit during a rebase."
 msgstr "Du håller på att dela upp en incheckning i en ombasering."
 
 msgid "  (Once your working directory is clean, run \"git rebase --continue\")"
-msgstr "  (Så fort din arbetskatalog är ren, kör \"git rebase --continue\")"
+msgstr "  (Så fort din arbetskatalog är ren, kör ”git rebase --continue”)"
 
 #, c-format
 msgid "You are currently editing a commit while rebasing branch '%s' on '%s'."
 msgstr ""
-"Du håller på att redigera en incheckning medan du ombaserar grenen \"%s\" "
-"ovanpå \"%s\"."
+"Du håller på att redigera en incheckning medan du ombaserar grenen ”%s” "
+"ovanpå ”%s”."
 
 msgid "You are currently editing a commit during a rebase."
 msgstr "Du håller på att redigera en incheckning under en ombasering."
 
 msgid "  (use \"git commit --amend\" to amend the current commit)"
 msgstr ""
-"  (använd \"git commit --amend\" för att lägga till på aktuell incheckning)"
+"  (använd ”git commit --amend” för att lägga till på aktuell incheckning)"
 
 msgid ""
 "  (use \"git rebase --continue\" once you are satisfied with your changes)"
-msgstr "  (använd \"git rebase --continue\" när du är nöjd med dina ändringar)"
+msgstr "  (använd ”git rebase --continue” när du är nöjd med dina ändringar)"
 
 msgid "Cherry-pick currently in progress."
 msgstr "Cherry-pick pågår."
 
 #, c-format
 msgid "You are currently cherry-picking commit %s."
-msgstr "Du håller på med en \"cherry-pick\" av incheckningen %s."
+msgstr "Du håller på med en ”cherry-pick” av incheckningen %s."
 
 msgid "  (fix conflicts and run \"git cherry-pick --continue\")"
-msgstr "  (rätta konflikter och kör sedan \"git cherry-pick --continue\")"
+msgstr "  (rätta konflikter och kör sedan ”git cherry-pick --continue”)"
 
 msgid "  (run \"git cherry-pick --continue\" to continue)"
-msgstr "  (kör \"git cherry-pick --continue\" för att fortsätta)"
+msgstr "  (kör ”git cherry-pick --continue” för att fortsätta)"
 
 msgid "  (all conflicts fixed: run \"git cherry-pick --continue\")"
-msgstr "  (alla konflikter rättade: kör \"git cherry-pick --continue\")"
+msgstr "  (alla konflikter rättade: kör ”git cherry-pick --continue”)"
 
 msgid "  (use \"git cherry-pick --skip\" to skip this patch)"
-msgstr "  (använd \"git cherry-pick --skip\" för att hoppa över patchen)"
+msgstr "  (använd ”git cherry-pick --skip” för att hoppa över patchen)"
 
 msgid "  (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)"
 msgstr ""
-"  (använd \"git cherry-pick --abort\" för att avbryta \"cherry-pick\"-"
+"  (använd ”git cherry-pick --abort” för att avbryta ”cherry-pick”-"
 "operationen)"
 
 msgid "Revert currently in progress."
@@ -21842,30 +22029,30 @@ msgid "You are currently reverting commit %s."
 msgstr "Du håller på med att ångra incheckningen %s."
 
 msgid "  (fix conflicts and run \"git revert --continue\")"
-msgstr "  (rätta konflikter och kör sedan \"git revert --continue\")"
+msgstr "  (rätta konflikter och kör sedan ”git revert --continue”)"
 
 msgid "  (run \"git revert --continue\" to continue)"
-msgstr "  (kör \"git revert --continue\" för att fortsätta)"
+msgstr "  (kör ”git revert --continue” för att fortsätta)"
 
 msgid "  (all conflicts fixed: run \"git revert --continue\")"
-msgstr "  (alla konflikter rättade: kör \"git revert --continue\")"
+msgstr "  (alla konflikter rättade: kör ”git revert --continue”)"
 
 msgid "  (use \"git revert --skip\" to skip this patch)"
-msgstr "  (använd \"git revert --skip\" för att hoppa över patchen)"
+msgstr "  (använd ”git revert --skip” för att hoppa över patchen)"
 
 msgid "  (use \"git revert --abort\" to cancel the revert operation)"
-msgstr "  (använd \"git revert --abort\" för att avbryta ångrandet)"
+msgstr "  (använd ”git revert --abort” för att avbryta ångrandet)"
 
 #, c-format
 msgid "You are currently bisecting, started from branch '%s'."
-msgstr "Du håller på med en \"bisect\", startad från grenen \"%s\"."
+msgstr "Du håller på med en ”bisect”, startad från grenen ”%s”."
 
 msgid "You are currently bisecting."
-msgstr "Du håller på med en \"bisect\"."
+msgstr "Du håller på med en ”bisect”."
 
 msgid "  (use \"git bisect reset\" to get back to the original branch)"
 msgstr ""
-"  (använd \"git bisect reset\" för att komma tillbaka till ursprungsgrenen)"
+"  (använd ”git bisect reset” för att komma tillbaka till ursprungsgrenen)"
 
 msgid "You are in a sparse checkout."
 msgstr "Du är i en gles utcheckning."
@@ -21917,7 +22104,7 @@ msgid "It took %.2f seconds to enumerate untracked files."
 msgstr "Det tog %.2f sekunder att räkna upp ospårade filer."
 
 msgid "See 'git help status' for information on how to improve this."
-msgstr "Se \"git help status\" för information om hur du kan förbättra detta."
+msgstr "Se ”git help status” för information om hur du kan förbättra detta."
 
 # %s är nästa sträng eller tom.
 #, c-format
@@ -21933,8 +22120,7 @@ msgstr "Inga ändringar"
 #, c-format
 msgid "no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"
 msgstr ""
-"inga ändringar att checka in (använd \"git add\" och/eller \"git commit -a"
-"\")\n"
+"inga ändringar att checka in (använd ”git add” och/eller ”git commit -a”)\n"
 
 #, c-format
 msgid "no changes added to commit\n"
@@ -21945,8 +22131,7 @@ msgid ""
 "nothing added to commit but untracked files present (use \"git add\" to "
 "track)\n"
 msgstr ""
-"inget köat för incheckning, men ospårade filer finns (spåra med \"git add"
-"\")\n"
+"inget köat för incheckning, men ospårade filer finns (spåra med ”git add”)\n"
 
 #, c-format
 msgid "nothing added to commit but untracked files present\n"
@@ -21954,7 +22139,7 @@ msgstr "inget köat för incheckning, men ospårade filer finns\n"
 
 #, c-format
 msgid "nothing to commit (create/copy files and use \"git add\" to track)\n"
-msgstr "inget att checka in (skapa/kopiera filer och spåra med \"git add\")\n"
+msgstr "inget att checka in (skapa/kopiera filer och spåra med ”git add”)\n"
 
 #, c-format
 msgid "nothing to commit\n"
@@ -21995,6 +22180,10 @@ msgstr "dessutom innehåller dit index ändringar som inte har checkats in."
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "kan inte %s: Ditt index innehåller ändringar som inte checkats in."
 
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "okänd stil ”%s” angavs för ”%s”"
+
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
 "merge"
@@ -22068,7 +22257,7 @@ msgstr "lokal tidszonförskjutning större än eller lika med 24 timmar\n"
 
 #, perl-format
 msgid "fatal: command '%s' died with exit code %d"
-msgstr "ödesdigert: kommandot \"%s\" dog med slutkoden %d"
+msgstr "ödesdigert: kommandot ”%s” dog med slutkoden %d"
 
 msgid "the editor exited uncleanly, aborting everything"
 msgstr "textredigeringsprogrammet avslutades med fel, avbryter allting"
@@ -22076,12 +22265,11 @@ msgstr "textredigeringsprogrammet avslutades med fel, avbryter allting"
 #, perl-format
 msgid ""
 "'%s' contains an intermediate version of the email you were composing.\n"
-msgstr ""
-"\"%s\" innehåller en mellanliggande version av e-postbrevet du skrev.\n"
+msgstr "”%s” innehåller en mellanliggande version av e-postbrevet du skrev.\n"
 
 #, perl-format
 msgid "'%s.final' contains the composed email.\n"
-msgstr "\"%s.final\" innehåller det skrivna brevet.\n"
+msgstr "”%s.final” innehåller det skrivna brevet.\n"
 
 msgid "--dump-aliases incompatible with other options\n"
 msgstr "--dump-aliases är inkompatibelt med andra flaggor\n"
@@ -22091,9 +22279,9 @@ msgid ""
 "git-send-email is configured with the sendemail.* options - note the 'e'.\n"
 "Set sendemail.forbidSendmailVariables to false to disable this check.\n"
 msgstr ""
-"ödesdigert: hittade konfigurationsflaggor för \"sendmail\"\n"
-"git-send-email konfigureras med \"sendemail.*\"-flaggor - lägg märke till \"e"
-"\".\n"
+"ödesdigert: hittade konfigurationsflaggor för ”sendmail”\n"
+"git-send-email konfigureras med ”sendemail.*”-flaggor - lägg märke till "
+"”e”.\n"
 "Sätt sendemail.forbidSendmailVariables till false för att inaktivera denna "
 "kontroll.\n"
 
@@ -22104,16 +22292,16 @@ msgid ""
 "`batch-size` and `relogin` must be specified together (via command-line or "
 "configuration option)\n"
 msgstr ""
-"\"batch-size\" och \"relogin\" måste anges tillsammans (via kommandorad "
-"eller konfigurationsflagga)\n"
+"”batch-size” och ”relogin” måste anges tillsammans (via kommandorad eller "
+"konfigurationsflagga)\n"
 
 #, perl-format
 msgid "Unknown --suppress-cc field: '%s'\n"
-msgstr "Okänt fält i --suppress-cc: \"%s\"\n"
+msgstr "Okänt fält i --suppress-cc: ”%s”\n"
 
 #, perl-format
 msgid "Unknown --confirm setting: '%s'\n"
-msgstr "Okänd inställning i --confirm: \"%s\"\n"
+msgstr "Okänd inställning i --confirm: ”%s”\n"
 
 #, perl-format
 msgid "warning: sendmail alias with quotes is not supported: %s\n"
@@ -22121,11 +22309,11 @@ msgstr "varning: sendmail-alias med citationstecken stöds inte. %s\n"
 
 #, perl-format
 msgid "warning: `:include:` not supported: %s\n"
-msgstr "varning: \":include:\" stöds inte: %s\n"
+msgstr "varning: ”:include:” stöds inte: %s\n"
 
 #, perl-format
 msgid "warning: `/file` or `|pipe` redirection not supported: %s\n"
-msgstr "varning: omdirigering til \"/fil\" eller \"|rör\" stöds inte: %s\n"
+msgstr "varning: omdirigering til ”/fil” eller ”|rör” stöds inte: %s\n"
 
 #, perl-format
 msgid "warning: sendmail line is not recognized: %s\n"
@@ -22139,10 +22327,10 @@ msgid ""
 "    * Saying \"./%s\" if you mean a file; or\n"
 "    * Giving --format-patch option if you mean a range.\n"
 msgstr ""
-"Filen \"%s\" finns men kan också vara ett incheckningsintervall\n"
+"Filen ”%s” finns men kan också vara ett incheckningsintervall\n"
 "att skapa patchar för. Gör otvetydigt genom att...\n"
 "\n"
-"    * Säga \"./%s\" om du menar en fil; eller\n"
+"    * Säga ”./%s” om du menar en fil; eller\n"
 "    * Ange flaggan --format-patch om du menar ett intervall.\n"
 
 #, perl-format
@@ -22173,20 +22361,20 @@ msgid ""
 "\n"
 "Clear the body content if you don't wish to send a summary.\n"
 msgstr ""
-"Rader som börjar med \"GIT:\" kommer tas bort.\n"
+"Rader som börjar med ”GIT:” kommer tas bort.\n"
 "Överväg att ta med en övergripande diffstatus eller\n"
 "innehållsförteckning för patchen du skriver.\n"
 "\n"
 "Rensa brevkroppen om du inte vill sända någon sammanfattning.\n"
 
-#, perl-format
-msgid "Failed to open %s: %s"
-msgstr "Misslyckades öppna %s: %s"
-
 #, perl-format
 msgid "Failed to open %s.final: %s"
 msgstr "Misslyckades öppna %s.final: %s"
 
+#, perl-format
+msgid "Failed to open %s: %s"
+msgstr "Misslyckades öppna %s: %s"
+
 msgid "Summary email is empty, skipping it\n"
 msgstr "Sammanfattande brev tomt, hoppar över\n"
 
@@ -22213,15 +22401,15 @@ msgid ""
 msgstr ""
 "Vägrar sända eftersom patchen\n"
 "\t%s\n"
-"har mallärendet \"*** SUBJECT HERE ***\". Använd --force om du verkligen "
-"vill sända.\n"
+"har mallärendet ”*** SUBJECT HERE ***”. Använd --force om du verkligen vill "
+"sända.\n"
 
 msgid "To whom should the emails be sent (if anyone)?"
 msgstr "Till vem ska breven sändas (om någon)?"
 
 #, perl-format
 msgid "fatal: alias '%s' expands to itself\n"
-msgstr "ödesdigert: aliaset \"%s\" expanderar till sig själv\n"
+msgstr "ödesdigert: aliaset ”%s” expanderar till sig själv\n"
 
 msgid "Message-ID to be used as In-Reply-To for the first email (if any)? "
 msgstr ""
@@ -22239,7 +22427,7 @@ msgstr "Vad vill du göra med adressen? (q=avsluta, d=kasta, e=redigera): "
 
 #, perl-format
 msgid "CA path \"%s\" does not exist"
-msgstr "CA-sökvägen \"%s\" finns inte"
+msgstr "CA-sökvägen ”%s” finns inte"
 
 msgid ""
 "    The Cc list above has been expanded by additional\n"
@@ -22259,9 +22447,9 @@ msgstr ""
 "    Beteendet styrs av konfigurationsinställningen\n"
 "    sendemail.confirm\n"
 "\n"
-"    För ytterligare information, kör \"git send-email --help\".\n"
+"    För ytterligare information, kör ”git send-email --help”.\n"
 "    För att behålla nuvarande beteende, men dölja detta\n"
-"    meddelande, kör \"git config --global sendemail.confirm auto\".\n"
+"    meddelande, kör ”git config --global sendemail.confirm auto”.\n"
 "\n"
 
 #. TRANSLATORS: Make sure to include [y] [n] [e] [q] [a] in your
@@ -22271,7 +22459,7 @@ msgid "Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): "
 msgstr "Sända brevet? (y=ja, n=nej, e=redigera, q=avsluta, a=alla): "
 
 msgid "Send this email reply required"
-msgstr "Svar krävs på frågan \"Sända brevet?\""
+msgstr "Svar krävs på frågan ”Sända brevet?”"
 
 msgid "The required SMTP server is not properly defined."
 msgstr "Nödvändig SMTP-server har inte angivits korrekt."
@@ -22319,35 +22507,35 @@ msgstr "kan inte öppna filen %s"
 
 #, perl-format
 msgid "(mbox) Adding cc: %s from line '%s'\n"
-msgstr "(mbox) Lägger till cc: %s från raden \"%s\"\n"
+msgstr "(mbox) Lägger till cc: %s från raden ”%s”\n"
 
 #, perl-format
 msgid "(mbox) Adding to: %s from line '%s'\n"
-msgstr "(mbox) Lägger till to: %s från raden \"%s\"\n"
+msgstr "(mbox) Lägger till to: %s från raden ”%s”\n"
 
 #, perl-format
 msgid "(non-mbox) Adding cc: %s from line '%s'\n"
-msgstr "(icke-mbox) Lägger till cc: %s från raden \"%s\"\n"
+msgstr "(icke-mbox) Lägger till cc: %s från raden ”%s”\n"
 
 #, perl-format
 msgid "(body) Adding cc: %s from line '%s'\n"
-msgstr "(kropp) Lägger till cc: %s från raden \"%s\"\n"
+msgstr "(kropp) Lägger till cc: %s från raden ”%s”\n"
 
 #, perl-format
 msgid "(%s) Could not execute '%s'"
-msgstr "(%s) Kunde inte köra \"%s\""
+msgstr "(%s) Kunde inte köra ”%s”"
 
 #, perl-format
 msgid "(%s) Malformed output from '%s'"
-msgstr "(%s) Felformaterad utdata från \"%s\""
+msgstr "(%s) Felformaterad utdata från ”%s”"
 
 #, perl-format
 msgid "(%s) failed to close pipe to '%s'"
-msgstr "(%s) misslyckades stänga röret till \"%s\""
+msgstr "(%s) misslyckades stänga röret till ”%s”"
 
 #, perl-format
 msgid "(%s) Adding %s: %s from: '%s'\n"
-msgstr "(%s) Lägger till %s: %s från: \"%s\"\n"
+msgstr "(%s) Lägger till %s: %s från: ”%s”\n"
 
 msgid "cannot send message as 7bit"
 msgstr "kan inte sända brev som sjubitars"
@@ -22380,8 +22568,7 @@ msgstr ""
 #, perl-format
 msgid "Skipping %s with backup suffix '%s'.\n"
 msgstr ""
-"Hoppar över %s med filnamnstillägget \"%s\" som används för "
-"säkerhetskopior.\n"
+"Hoppar över %s med filnamnstillägget ”%s” som används för säkerhetskopior.\n"
 
 #. TRANSLATORS: please keep "[y|N]" as is.
 #, perl-format
index bc3acbcc8496d3216654d522f70349204ac06595..19d6661bbe6d237d608e997bd2c22fe84d1e8ad8 100644 (file)
--- a/po/tr.po
+++ b/po/tr.po
@@ -1,8 +1,8 @@
 # Turkish translations for Git
 # Git Türkçe çevirileri
-# Copyright (C) 2020-2023 Emir SARI <emir_sari@icloud.com>
+# Copyright (C) 2020-2024 Emir SARI <emir_sari@icloud.com>
 # This file is distributed under the same license as the Git package.
-# Emir SARI <emir_sari@icloud.com>, 2020-2023
+# Emir SARI <emir_sari@icloud.com>, 2020-2024
 #
 # ######################################################### #
 #     Git Türkçe kavramlar dizini / Git Turkish Glossary    #
@@ -27,6 +27,7 @@
 # detached HEAD               | ayrık HEAD                  #
 # dirty                       | kirli                       #
 # evil merge                  | uğursuz birleştirme         #
+# fanout                      | çıkış sayısı                #
 # fast-forward                | ileri sarım/sarmak          #
 # fetch                       | getirme(k)                  #
 # fixup                       | düzeltmek                   #
 # pathspec                    | yol belirteci               #
 # pattern                     | dizgi                       #
 # porcelain                   | okunabilir                  #
-# prune                       | budamak                     #
+# prune                       | buda(mak)                     #
 # pseudoref                   | yalancıktan başvuru         #
-# pull                        | çekme(k)                    #
-# push                        | itme(k)                     #
+# pull                        | çek(mek)                    #
+# push                        | it(mek)                     #
 # rebase                      | yeniden temellendirme(k)    #
 # record                      | kayıt yaz(mak)              #
 # ref                         | başvuru                     #
@@ -85,6 +86,7 @@
 # trailer                     | artbilgi                    #
 # tree                        | ağaç                        #
 # treeish                     | ağacımsı                    #
+# unborn                      | henüz doğmamış (dal)        #
 # unstage                     | hazırlıktan çıkar(mak)      #
 # upstream                    | üstkaynak                   #
 # worktree/working tree       | çalışma ağacı               #
@@ -94,8 +96,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Git Turkish Localization Project\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-16 14:34+0300\n"
-"PO-Revision-Date: 2023-08-16 15:00+0300\n"
+"POT-Creation-Date: 2024-02-16 22:04+0300\n"
+"PO-Revision-Date: 2024-02-16 22:00+0300\n"
 "Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
 "Language-Team: Turkish (https://github.com/bitigchi/git-po/)\n"
 "Language: tr\n"
@@ -1499,6 +1501,10 @@ msgstr "'%s' seçeneği '%s' gerektiriyor"
 msgid "Unexpected option --output"
 msgstr "Beklenmedik seçenek --output"
 
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "fazladan komut satırı parametresi '%s'"
+
 #, c-format
 msgid "Unknown archive format '%s'"
 msgstr "Bilinmeyen arşiv biçimi '%s'"
@@ -1544,6 +1550,14 @@ msgstr "pek büyük gitattributes ikili nesnesi '%s' yok sayılıyor"
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "hatalı --attr-source veya GIT_ATTR_SOURCE"
 
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "'%s' dosyasının bilgileri alınamıyor"
+
+#, c-format
+msgid "unable to read %s"
+msgstr "%s okunamıyor"
+
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
 msgstr "'%s' dosyasında hatalı tırnağa alınmış içerik: %s"
@@ -1830,8 +1844,8 @@ msgid "submodule '%s': cannot create branch '%s'"
 msgstr "'%s' altmodülü: '%s' dalı oluşturulamıyor"
 
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "'%s' çıkışı '%s' konumunda halihazırda yapılmış"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "'%s', '%s' konumunda halihazırda çalışma ağacı tarafından kullanılıyor"
 
 msgid "git add [<options>] [--] <pathspec>..."
 msgstr "git add [<seçenekler>] [--] <yol-blrtç>..."
@@ -1850,24 +1864,21 @@ msgstr ""
 "add.interactive.useBuiltin ayarı kaldırıldı!\n"
 "Ayrıntılar için onun 'git help config' içindeki girdisine bakın."
 
-msgid "Could not read the index"
-msgstr "İndeks okunamadı"
-
-msgid "Could not write patch"
-msgstr "Yama yazılamadı"
+msgid "could not read the index"
+msgstr "indeks okunamadı"
 
 msgid "editing patch failed"
 msgstr "yamayı düzenleme başarısız"
 
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "'%s' dosya bilgileri alınamadı"
+msgid "could not stat '%s'"
+msgstr "'%s' bilgileri alınamadı"
 
-msgid "Empty patch. Aborted."
-msgstr "Boş yama. İptal edildi."
+msgid "empty patch. aborted"
+msgstr "boş yama. iptal edildi."
 
 #, c-format
-msgid "Could not apply '%s'"
+msgid "could not apply '%s'"
 msgstr "'%s' uygulanamadı"
 
 msgid "The following paths are ignored by one of your .gitignore files:\n"
@@ -1998,6 +2009,9 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "indeks dosyası hasarlı"
 
+msgid "unable to write new index file"
+msgstr "yeni indeks dosyası yazılamıyor"
+
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "hatalı eylem '%s', '%s' için"
@@ -2206,9 +2220,6 @@ msgstr ""
 "Bir dosyanın \"onlar sildi\" olduğunu kabul etmek için dosya ile 'git rm' "
 "yapabilirsiniz."
 
-msgid "unable to write new index file"
-msgstr "yeni indeks dosyası yazılamıyor"
-
 #, c-format
 msgid "Could not parse object '%s'."
 msgstr "'%s' nesnesi ayrıştırılamadı."
@@ -2227,10 +2238,6 @@ msgstr ""
 msgid "failed to read '%s'"
 msgstr "'%s' okunamadı"
 
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "'%s=%s' ve '%s=%s' seçenekleri birlikte kullanılamaz"
-
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<seçenekler>] [(<mbox> | <posta-dizin>)...]"
 
@@ -2382,11 +2389,11 @@ msgid "git archive: expected a flush"
 msgstr "git archive: Floş bekleniyordu"
 
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<terim> --term-{old,good}=<terim>]    [--"
-"no-checkout] [--first-parent] [<kötü> [<iyi>...]] [--]    [<yol-blrtç>...]"
+"git bisect start [--term-(new|bad)=<uçbirim> --term-(old|good)=<uçbirim>]    "
+"[--no-checkout] [--first-parent] [<kötü> [<iyi>...]] [--]   [<yol-blrtç>...]"
 
 msgid "git bisect (good|bad) [<rev>...]"
 msgstr "git bisect (good|bad) [<rev>...]"
@@ -2400,8 +2407,8 @@ msgstr "git bisect reset [<işleme>]"
 msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <günlük-dosyası>"
 
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <komut>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <komut> [<argüman>...]"
 
 #, c-format
 msgid "cannot open file '%s' in mode '%s'"
@@ -2812,7 +2819,7 @@ msgstr "git branch [<seçenekler>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
 "'%s' dalı siliniyor: Bu dal '%s'\n"
 "         dalına birleştirilmiş; ancak HEAD'e henüz birleştirilmemiş."
@@ -2820,36 +2827,37 @@ msgstr ""
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
 "'%s' dalı silinmiyor: Bu dal HEAD'e birleştirilmiş olmasına rağmen\n"
 "         '%s' dalına birleştirilmemiş."
 
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
+msgid "couldn't look up commit object for '%s'"
 msgstr "'%s' için işleme nesnesi aranamadı"
 
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
-msgstr ""
-"'%s' dalı tümüyle birleştirilmemiş.\n"
-"Eğer silmek istediğinizden eminseniz 'git branch -D %s' çalıştırın."
+msgid "the branch '%s' is not fully merged"
+msgstr "'%s' dalı tümüyle birleştirilmedi"
 
-msgid "Update of config-file failed"
-msgstr "config-file güncellemesi başarısız"
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
+msgstr "Onu silmek istediğinizden eminseniz 'git branch -D %s' çalıştırın."
+
+msgid "update of config-file failed"
+msgstr "config-file güncellenemedi"
 
 msgid "cannot use -a with -d"
 msgstr "-a, -d ile kullanılamıyor"
 
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "'%s' dalı silinemiyor, şurada çıkış yapılmış: '%s'"
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr ""
+"'%s' konumundaki çalışma ağacı tarafından kullanılan '%s' dalı silinemiyor"
 
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "Uzak izleme dalı '%s' bulunamadı."
+msgid "remote-tracking branch '%s' not found"
+msgstr "uzak izleme dalı '%s' bulunamadı"
 
 #, c-format
 msgid ""
@@ -2860,8 +2868,8 @@ msgstr ""
 "--remote yazmayı mı unuttunuz?"
 
 #, c-format
-msgid "branch '%s' not found."
-msgstr "'%s' dalı bulunamadı."
+msgid "branch '%s' not found"
+msgstr "'%s' dalı bulunamadı"
 
 #, c-format
 msgid "Deleted remote-tracking branch %s (was %s).\n"
@@ -2882,11 +2890,11 @@ msgid "HEAD (%s) points outside of refs/heads/"
 msgstr "HEAD (%s), refs/heads/ dışına işaret ediyor"
 
 #, c-format
-msgid "Branch %s is being rebased at %s"
+msgid "branch %s is being rebased at %s"
 msgstr "%s dalı %s konumunda yeniden temellendiriliyor"
 
 #, c-format
-msgid "Branch %s is being bisected at %s"
+msgid "branch %s is being bisected at %s"
 msgstr "%s dalı %s konumunda ikili aranıyor"
 
 #, c-format
@@ -2894,40 +2902,40 @@ msgid "HEAD of working tree %s is not updated"
 msgstr "%s çalışma ağacının HEAD'i güncellenmemiş"
 
 #, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Geçersiz dal adı: '%s'"
+msgid "invalid branch name: '%s'"
+msgstr "geçersiz dal adı: '%s'"
 
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "'%s' dalında henüz bir işleme yok."
+msgid "no commit on branch '%s' yet"
+msgstr "'%s' dalında henüz bir işleme yok"
 
 #, c-format
-msgid "No branch named '%s'."
-msgstr "'%s' adında bir dal yok."
+msgid "no branch named '%s'"
+msgstr "'%s' adında bir dal yok"
 
-msgid "Branch rename failed"
-msgstr "Dal yeniden adlandırması başarısız"
+msgid "branch rename failed"
+msgstr "dal yeniden adlandırılamadı"
 
-msgid "Branch copy failed"
-msgstr "Dal kopyalaması başarısız"
+msgid "branch copy failed"
+msgstr "dal kopyalanamadı"
 
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "Yanlış adlandırılan '%s' dalının bir kopyası oluşturuldu"
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "yanlış adlandırılan '%s' dalının bir kopyası oluşturuldu"
 
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
-msgstr "Yanlış adlandırılan '%s' dalı yeniden adlandırıldı"
+msgid "renamed a misnamed branch '%s' away"
+msgstr "yanlış adlandırılan '%s' dalı yeniden adlandırıldı"
 
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "Dal %s olarak yeniden adlandırıldı; ancak HEAD güncellenmedi!"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "dal %s olarak yeniden adlandırıldı; ancak HEAD güncellenmedi!"
 
-msgid "Branch is renamed, but update of config-file failed"
-msgstr "Dal yeniden adlandırıldı; ancak config-file güncellemesi başarısız"
+msgid "branch is renamed, but update of config-file failed"
+msgstr "dal yeniden adlandırıldı; ancak config-file güncellenemedi"
 
-msgid "Branch is copied, but update of config-file failed"
-msgstr "Dal kopyalandı; ancak config-file güncellemesi başarısız"
+msgid "branch is copied, but update of config-file failed"
+msgstr "dal kopyalandı; ancak config-file güncellenemedi"
 
 #, c-format
 msgid ""
@@ -3041,8 +3049,8 @@ msgstr "altmodüller içinden özyinele"
 msgid "format to use for the output"
 msgstr "çıktı için kullanılacak biçim"
 
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "HEAD geçerli bir başvuru olarak çözülemedi."
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "HEAD geçerli bir başvuru olarak çözülemedi"
 
 msgid "HEAD not found below refs/heads!"
 msgstr "HEAD, refs/heads altında bulunamadı!"
@@ -3060,17 +3068,17 @@ msgstr "--recurse-submodules, yalnızca dal oluşturmada kullanılabilir"
 msgid "branch name required"
 msgstr "dal adı gerekli"
 
-msgid "Cannot give description to detached HEAD"
-msgstr "Ayrılmış HEAD'e açıklama verilemiyor"
+msgid "cannot give description to detached HEAD"
+msgstr "ayrık HEAD'e açıklama verilemiyor"
 
 msgid "cannot edit description of more than one branch"
 msgstr "birden çok dalın açıklaması düzenlenemiyor"
 
-msgid "cannot copy the current branch while not on any."
-msgstr "Bir dalın üzerinde değilken geçerli dal kopyalanamaz."
+msgid "cannot copy the current branch while not on any"
+msgstr "bir dalın üzerinde değilken geçerli dal kopyalanamaz"
 
-msgid "cannot rename the current branch while not on any."
-msgstr "Bir dalın üzerinde değilken geçerli dal yeniden adlandırılamaz."
+msgid "cannot rename the current branch while not on any"
+msgstr "bir dalın üzerinde değilken geçerli dal yeniden adlandırılamaz"
 
 msgid "too many branches for a copy operation"
 msgstr "bir kopyalama işlemi için pek fazla dal"
@@ -3083,10 +3091,10 @@ msgstr "yeni üstkaynak ayarlamak için pek fazla argüman"
 
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
 "HEAD'in üst kaynağı %s olarak ayarlanamadı; çünkü herhangi bir dala işaret "
-"etmiyor."
+"etmiyor"
 
 #, c-format
 msgid "no such branch '%s'"
@@ -3099,16 +3107,16 @@ msgstr "'%s' diye bir dal yok"
 msgid "too many arguments to unset upstream"
 msgstr "üst kaynağı kaldırmak için pek fazla argüman"
 
-msgid "could not unset upstream of HEAD when it does not point to any branch."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
 msgstr ""
-"HEAD'in üst kaynağı kaldırılamadı; çünkü herhangi bir dala işaret etmiyor."
+"HEAD'in üst kaynağı kaldırılamadı; çünkü herhangi bir dala işaret etmiyor"
 
 #, c-format
-msgid "Branch '%s' has no upstream information"
+msgid "branch '%s' has no upstream information"
 msgstr "'%s' dalının üstkaynak bilgisi yok"
 
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
 "'git branch'in -a ve -r seçenekleri bir dal adı almaz.\n"
@@ -3116,10 +3124,10 @@ msgstr ""
 
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
 "--set-upstream seçeneği artık desteklenmiyor. Lütfen --track veya --set-"
-"upstream-to kullanın."
+"upstream-to kullanın"
 
 msgid "git version:\n"
 msgstr "git sürümü:\n"
@@ -3191,6 +3199,10 @@ msgstr "hata raporu dosyaları için bir hedef konum belirtin"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "dosya adları için bir strftime biçim soneki belirtin"
 
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "bilinmeyen argüman '%s'"
+
 #, c-format
 msgid "could not create leading directories for '%s'"
 msgstr "'%s' için öncü dizinler oluşturulamadı"
@@ -3297,6 +3309,13 @@ msgstr "git cat-file (-e | -p) <nesne>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <nesne>"
 
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<başvuru>:<yol|ağacımsı> | --path=<yol|ağacımsı> <revizyon>]"
+
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
 "objects]\n"
@@ -3308,13 +3327,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<başvuru>:<yol|ağacımsı> | --path=<yol|ağacımsı> <revizyon>]"
-
 msgid "Check object existence or emit object contents"
 msgstr "Nesne varlığını denetle veya nesne içeriğini yay"
 
@@ -3610,6 +3622,10 @@ msgstr "'%s', '%s' ögesinin belirtilmediği durumlarda kullanılmalıdır"
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "'%s' veya '%s', %s ile birlikte kullanılamaz"
 
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr "'%s', '%s' veya '%s' bir ağaçtan çıkış yaparken kullanılamaz"
+
 #, c-format
 msgid "path '%s' is unmerged"
 msgstr "'%s' yolu birleştirilmemiş"
@@ -3861,8 +3877,8 @@ msgstr "zorla çıkış yap (yerel değişiklikleri çöpe at)"
 msgid "new-branch"
 msgstr "yeni dal"
 
-msgid "new unparented branch"
-msgstr "yeni üst ögesi olmayan dal"
+msgid "new unborn branch"
+msgstr "yeni henüz doğmamış dal"
 
 msgid "update ignored files (default)"
 msgstr "yok sayılan dosyaları güncelle (öntanımlı)"
@@ -4113,9 +4129,6 @@ msgstr ""
 "clean.requireForce öntanımlı olarak 'true' ve ne -i ne -n ne de -f verilmiş; "
 "temizleme reddediliyor"
 
-msgid "-x and -X cannot be used together"
-msgstr "-x ve -X birlikte kullanılamaz"
-
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<seçenekler>] [--] <depo> [<dizin>]"
 
@@ -4203,6 +4216,9 @@ msgstr "git dizini"
 msgid "separate git dir from working tree"
 msgstr "git dizinini çalışma ağacından ayır"
 
+msgid "specify the reference format to use"
+msgstr "kullanılacak başvuru biçimini belirt"
+
 msgid "key=value"
 msgstr "anahtar=değer"
 
@@ -4320,11 +4336,9 @@ msgstr "Çok fazla argüman."
 msgid "You must specify a repository to clone."
 msgstr "Klonlamak için bir depo belirtmelisiniz."
 
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"--bundle-uri; --depth, --shallow-since ve --shallow-exclude ile uyumsuz"
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "bilinmeyen başvuru depolama biçimi '%s'"
 
 #, c-format
 msgid "repository '%s' does not exist"
@@ -4452,11 +4466,11 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <dizin>] [--append]\n"
-"                       [--split[=<<strateji>]] [--reachable | --stdin-packs "
-"--stdin-commits]\n"
+"                       [--split[=<strateji>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
 "                       <bölme-seçenekleri>"
@@ -4474,6 +4488,10 @@ msgstr "commit-graph parçalara bölünmüşse yalnızca uç dosyayı doğrula"
 msgid "Could not open commit-graph '%s'"
 msgstr "commit-graph '%s' açılamadı"
 
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "commit-graph zinciri '%s' açılamadı"
+
 #, c-format
 msgid "unrecognized --split argument, %s"
 msgstr "tanımlanamayan --split argümanı, %s"
@@ -4675,9 +4693,6 @@ msgstr "geçici indeks güncellenemiyor"
 msgid "Failed to update main cache tree"
 msgstr "Ana önbellek ağacı güncellenemedi"
 
-msgid "unable to write new_index file"
-msgstr "new_index dosyası yazılamıyor"
-
 msgid "cannot do a partial commit during a merge."
 msgstr "Bir birleştirme sırasında kısmi işleme yapılamaz."
 
@@ -5083,10 +5098,10 @@ msgstr "İşleme iletisi gövdesinin boş bırakılmasından ötürü iptal edil
 
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
-"Depo güncellendi; ancak new_index dosyası yazılamıyor.\n"
+"Depo güncellendi; ancak yeni indeks dosyası yazılamıyor.\n"
 "Diskin dolu olup olmadığını ve kotanızı aşıp aşmadığınızı denetleyin,\n"
 "sonra kurtarmak için \"git restore --staged :/\" kullanın."
 
@@ -6531,6 +6546,9 @@ msgstr "başvurulmayan nesneleri buda"
 msgid "pack unreferenced objects separately"
 msgstr "başvurulmamış nesneleri ayrı olarak paketle"
 
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "--cruft ile yeni süprüntü paketlerinin boyutunu sınırla"
+
 msgid "be more thorough (increased runtime)"
 msgstr "biraz daha titiz ol (artırılmış işleyiş süresi)"
 
@@ -6701,12 +6719,6 @@ msgstr "'crontab' çalıştırılamadı; sisteminiz 'cron' desteklemiyor olabili
 msgid "'crontab' died"
 msgstr "'crontab' beklenmedik bir biçimde sonlandı"
 
-msgid "failed to start systemctl"
-msgstr "systemctl başlatılamadı"
-
-msgid "failed to run systemctl"
-msgstr "systemctl çalıştırılamadı"
-
 #, c-format
 msgid "failed to delete '%s'"
 msgstr "'%s' silinemedi"
@@ -6715,6 +6727,12 @@ msgstr "'%s' silinemedi"
 msgid "failed to flush '%s'"
 msgstr "'%s' floş yapılamadı"
 
+msgid "failed to start systemctl"
+msgstr "systemctl başlatılamadı"
+
+msgid "failed to run systemctl"
+msgstr "systemctl çalıştırılamadı"
+
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
 msgstr "tanımlanamayan --scheduler argümanı, '%s'"
@@ -6738,6 +6756,9 @@ msgstr "görev planlayıcı"
 msgid "scheduler to trigger git maintenance run"
 msgstr "git bakımını tetikleyecek görev planlayıcı"
 
+msgid "failed to set up maintenance schedule"
+msgstr "bakım programı ayarlanamadı"
+
 msgid "failed to add repo to global config"
 msgstr "depo, global yapılandırmaya eklenemedi"
 
@@ -6768,6 +6789,10 @@ msgstr "iş parçacığı desteği yok, %s yok sayılıyor"
 msgid "unable to read tree (%s)"
 msgstr "ağaç okunamıyor (%s)"
 
+#, c-format
+msgid "unable to read tree %s"
+msgstr "%s ağacı okunamıyor"
+
 #, c-format
 msgid "unable to grep from object of type %s"
 msgstr "%s türündeki bir nesneden grep yapılamıyor"
@@ -6812,8 +6837,8 @@ msgstr "ikili dosyaları textconv süzgeçleri ile işle"
 msgid "search in subdirectories (default)"
 msgstr "altdizinlerde ara (öntanımlı)"
 
-msgid "descend at most <depth> levels"
-msgstr "en çok <derinlik> düzey in"
+msgid "descend at most <n> levels"
+msgstr "en çok <n> düzey aşağı in"
 
 msgid "use extended POSIX regular expressions"
 msgstr "genişletilmiş POSIX düzenli ifadelerini kullan"
@@ -7180,10 +7205,6 @@ msgstr "ciddi şişirme programı tutarsızlığı"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "%s İLE SHA1 ÇARPIŞMASI BULUNDU!"
 
-#, c-format
-msgid "unable to read %s"
-msgstr "%s okunamıyor"
-
 #, c-format
 msgid "cannot read existing object info %s"
 msgstr "var olan nesne bilgisi %s okunamıyor"
@@ -7324,13 +7345,15 @@ msgstr "paket nesnelerinde fsck hatası"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<şablon-dizini>]\n"
 "         [--separate-git-dir <git-dizini>] [--object-format=<biçim>]\n"
+"         [--ref-format=<biçim>]\n"
 "         [-b <dal-adı> | --initial-branch=<dal-adı>]\n"
-"         [--shared[=<izinler>]] [<dizin>]"
+"         [--shared[=<izin>]] [<dizin>]"
 
 msgid "permissions"
 msgstr "izinler"
@@ -7372,11 +7395,12 @@ msgstr "--separate-git-dir, çıplak depo ile uyumsuz"
 
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <jeton>[(=|:)<değer>])...]\n"
+"                       [(--trailer (<anahtar>|<anArması>)"
+"[(=|:)<değer>])...]\n"
 "                       [--parse] [<dosya>...]"
 
 msgid "edit files in place"
@@ -7385,6 +7409,9 @@ msgstr "dosyaları yerinde düzenle"
 msgid "trim empty trailers"
 msgstr "boş artbilgileri kırp"
 
+msgid "placement"
+msgstr "yerleştirme"
+
 msgid "where to place the new trailer"
 msgstr "yeni artbilgiler nereye yerleştirilecek"
 
@@ -7397,17 +7424,17 @@ msgstr "artbilgi eksikse yapılacak eylem"
 msgid "output only the trailers"
 msgstr "yalnızca artbilgileri çıktı ver"
 
-msgid "do not apply config rules"
-msgstr "yapılandırma kurallarını uygulama"
+msgid "do not apply trailer.* configuration variables"
+msgstr "trailer.* yapılandırma değişkenlerini uygulama"
 
-msgid "join whitespace-continued values"
-msgstr "boşluk ile sürdürülen değerleri uç uca ekle"
+msgid "reformat multiline trailer values as single-line values"
+msgstr "çok satırlı artbilgileri tek satırlı değerler olarak biçimlendir"
 
-msgid "set parsing options"
-msgstr "ayrıştırma seçeneklerini ayarla"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "--only-trailers --only-input --unfold için arma"
 
-msgid "do not treat --- specially"
-msgstr "ayırma çizgilerine (---) özel davranma"
+msgid "do not treat \"---\" as the end of input"
+msgstr "\"---\" dizgisine satır sonu olarak davranma"
 
 msgid "trailer(s) to add"
 msgstr "eklenecek artbilgi(ler)"
@@ -7496,6 +7523,10 @@ msgstr "bir tam erim gerekiyor"
 msgid "not a range"
 msgstr "bir erim değil"
 
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "'%s' dal açıklama dosyası okunamıyor"
+
 msgid "cover letter needs email format"
 msgstr "ön yazı için e-posta biçimi gerekli"
 
@@ -7594,6 +7625,9 @@ msgstr "açıklama kipinden kapak sayfası kipi"
 msgid "generate parts of a cover letter based on a branch's description"
 msgstr "ön yazının bazı kısımlarını dalın açıklamasından oluştur"
 
+msgid "use branch description from file"
+msgstr "dal açıklamasını dosyadan oku"
+
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "[PATCH] yerine [<önek>] kullan"
 
@@ -8019,9 +8053,19 @@ msgstr ""
 "git merge-file [<seçenekler>] [-L <ad1> [-L <orij> [-L <ad2>]]] <dosya1> "
 "<orij-dosya> <dosya2>"
 
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"diff-algorithm seçeneği şunları kabul eder: \"myers\", \"minimal\", "
+"\"patience\" ve \"histogram\""
+
 msgid "send results to standard output"
 msgstr "sonuçları standart çıktıya gönder"
 
+msgid "use object IDs instead of filenames"
+msgstr "dosya adları yerine nesne kimlikleri kullan"
+
 msgid "use a diff3 based merge"
 msgstr "diff3 tabanlı birleştirme kullan"
 
@@ -8037,6 +8081,12 @@ msgstr "çakışmalarda onların sürümünü kullan"
 msgid "for conflicts, use a union version"
 msgstr "çakışmalarda birlik olmuş bir sürüm kullan"
 
+msgid "<algorithm>"
+msgstr "<algoritma>"
+
+msgid "choose a diff algorithm"
+msgstr "bir diff algoritması seç"
+
 msgid "for conflicts, use this marker size"
 msgstr "çakışmalarda bu imleyici boyutunu kullan"
 
@@ -8046,6 +8096,13 @@ msgstr "çakışmalar hakkında uyarma"
 msgid "set labels for file1/orig-file/file2"
 msgstr "file1/orig-file/file2 için etiketler yapıştır"
 
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "'%s' diye bir nesne yok"
+
+msgid "Could not write object file"
+msgstr "nesne dosyası yazılamadı"
+
 #, c-format
 msgid "unknown option %s"
 msgstr "bilinmeyen seçenek %s"
@@ -8107,11 +8164,18 @@ msgstr "girdi satırı başına bir adet çoklu birleştirmeler gerçekleştir"
 msgid "specify a merge-base for the merge"
 msgstr "birleştirme için bir birleştirme temeli belirtilmeli"
 
+msgid "option=value"
+msgstr "seçenek=değer"
+
+msgid "option for selected merge strategy"
+msgstr "seçili birleştirme stratejisi için seçenekler"
+
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge, tüm diğer seçeneklerle uyumsuz"
 
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base, --stdin ile uyumsuz"
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "bilinmeyen strateji seçeneği: -X%s"
 
 #, c-format
 msgid "malformed input line: '%s'."
@@ -8180,12 +8244,6 @@ msgstr "strateji"
 msgid "merge strategy to use"
 msgstr "kullanılacak birleştirme stratejisi"
 
-msgid "option=value"
-msgstr "seçenek=değer"
-
-msgid "option for selected merge strategy"
-msgstr "seçili birleştirme stratejisi için seçenekler"
-
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr ""
 "birleştirme işlemesi iletisi (ileri sarım olmayan bir birleştirme için)"
@@ -8246,10 +8304,6 @@ msgstr "İndeks yazılamıyor."
 msgid "Not handling anything other than two heads merge."
 msgstr "İki uç işlemenin birleştirilmesi dışında bir şey yapılmıyor."
 
-#, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "bilinmeyen strateji seçeneği: -X%s"
-
 #, c-format
 msgid "unable to write %s"
 msgstr "%s yazılamıyor"
@@ -8540,8 +8594,8 @@ msgstr "hedef konum var"
 msgid "can not move directory into itself"
 msgstr "dizin kendi içine taşınamıyor"
 
-msgid "cannot move directory over file"
-msgstr "dizin dosya üzerinden taşınamıyor"
+msgid "destination already exists"
+msgstr "hedef halihazırda var"
 
 msgid "source directory is empty"
 msgstr "kaynak dizin boş"
@@ -9047,6 +9101,10 @@ msgstr "Nesneler sıkıştırılıyor"
 msgid "inconsistency with delta count"
 msgstr "delta sayımında tutarsızlık"
 
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "geçersiz pack.allowPackReuse değeri: '%s'"
+
 #, c-format
 msgid ""
 "value of uploadpack.blobpackfileuri must be of the form '<object-hash> <pack-"
@@ -9284,9 +9342,6 @@ msgstr "olabilecek en küçük paket boyutu limiti 1 MiB'dır"
 msgid "--thin cannot be used to build an indexable pack"
 msgstr "--thin bir indekslenebilir paket yapımında kullanılamaz"
 
-msgid "cannot use --filter without --stdout"
-msgstr "--filter, --stdout olmadan kullanılamaz"
-
 msgid "cannot use --filter with --stdin-packs"
 msgstr "--filter, --stdin-packs ile birlikte kullanılamıyor"
 
@@ -9299,19 +9354,16 @@ msgstr "iç revizyon listeleri, --cruft ile birlikte kullanılamıyor"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "--stdin-packs, --cruft ile birlikte kullanılamıyor"
 
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "--max-pack-size, --cruft ile birlikte kullanılamıyor"
-
 msgid "Enumerating objects"
 msgstr "Nesneler ortaya dökülüyor"
 
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Toplam %<PRIu32> (delta %<PRIu32>), yeniden kullanılan %<PRIu32> (delta "
-"%<PRIu32>), yeniden kullanılan paket %<PRIu32>"
+"%<PRIu32>), yeniden kullanılan paket %<PRIu32> (%<PRIuMAX> konumundan)"
 
 msgid ""
 "'git pack-redundant' is nominated for removal.\n"
@@ -10274,16 +10326,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "'C' anahtarı sayısal bir değer bekliyor"
 
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy, --merge veya --interactive gerektiriyor"
-
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"seçenekleri uygula, rebase.autoSquash ile uyumlu değil. --no-autosquash "
-"eklemeyi düşünün"
-
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
 "no-rebase-merges"
@@ -10696,10 +10738,10 @@ msgid_plural ""
 "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
 "to delete them, use:"
 msgstr[0] ""
-"Not: refs/remotes hiyerarşisi dışındaki bir dal kaldırılmadı;\n"
+"Not: refs/remotes/ hiyerarşisi dışındaki bir dal kaldırılmadı;\n"
 "onu silmek için şunu kullanın:"
 msgstr[1] ""
-"Not: refs/remotes hiyerarşisi dışındaki bazı dallar kaldırılmadı;\n"
+"Not: refs/remotes/ hiyerarşisi dışındaki bazı dallar kaldırılmadı;\n"
 "onları silmek için şunu kullanın:"
 
 #, c-format
@@ -10985,6 +11027,10 @@ msgstr "başvurular anlık görüntü geçici dosyası kapatılamadı"
 msgid "could not remove stale bitmap: %s"
 msgstr "eskimiş biteşlem kaldırılamadı: %s"
 
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "paket öneki %s, nesne dizini %s ile başlamıyor"
+
 msgid "pack everything in a single pack"
 msgstr "her şeyi tek bir pakete sığdır"
 
@@ -10998,7 +11044,7 @@ msgid "approxidate"
 msgstr "yaklaşık tarih"
 
 msgid "with --cruft, expire objects older than this"
-msgstr "--cruft ile, bundan daha eski nesneleri yürürlükten kaldır"
+msgstr "--cruft ile bundan daha eski nesneleri yürürlükten kaldır"
 
 msgid "remove redundant packs, and run git-prune-packed"
 msgstr "gereksiz paketleri kaldır ve 'git-prune-packed' çalıştır"
@@ -11060,16 +11106,19 @@ msgstr "ortaya çıkan paketlerin bir çoklu paket indeksini yaz"
 msgid "pack prefix to store a pack containing pruned objects"
 msgstr "budanan nesneler içeren paketi depolamak için paket öneki"
 
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "süzülen nesneler içeren paketi depolamak için paket öneki"
+
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "bir precious-objects deposundaki paketler silinemiyor"
 
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "'%s' seçeneği, yalnızca '%s' ile birlikte kullanılabilir"
+
 msgid "Nothing new to pack."
 msgstr "Paketlenecek yeni bir şey yok."
 
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "paket öneki %s, nesne dizini %s ile başlamıyor"
-
 #, c-format
 msgid "renaming pack to '%s' failed"
 msgstr "paketi '%s' olarak yeniden adlandırma başarısız"
@@ -11270,6 +11319,76 @@ msgstr "--convert-graft-file argüman almaz"
 msgid "only one pattern can be given with -l"
 msgstr "-l ile yalnızca bir dizgi verilebilir"
 
+msgid "need some commits to replay"
+msgstr "yeniden oynatmak için birkaç işleme gerekli"
+
+msgid "--onto and --advance are incompatible"
+msgstr "--onto ve --advance birbiriyle uyumsuz"
+
+msgid "all positive revisions given must be references"
+msgstr "verilen tüm pozitif revizyonlar, başvuru olmalı"
+
+msgid "argument to --advance must be a reference"
+msgstr "--advance'a olan argüman bir başvuru olmalı"
+
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"birden çok kaynaklı hedef ilerletilemiyor; çünkü sıralama hatalı tanımlanmış "
+"olurdu"
+
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr ""
+"bunun --advance veya --onto işlemi olup olmadığı örtük olarak algılanamıyor"
+
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"birden çok kaynak dallı hedef ilerletilemiyor; çünkü sıralama hatalı "
+"tanımlanmış olurdu"
+
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "--onto için olan doğru temel örtük olarak algılanamıyor"
+
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(DENEYSEL!) git replay ([--contained] --onto <yeni-temel> | --advance <dal>) "
+"<revizyon-erimi>..."
+
+msgid "make replay advance given branch"
+msgstr "verilen dalı önceden yeniden oynat"
+
+msgid "replay onto given commit"
+msgstr "verilen işlemeye yeniden oynat"
+
+msgid "advance all branches contained in revision-range"
+msgstr "revizyon eriminde içerilen tüm dalları ilerlet"
+
+msgid "option --onto or --advance is mandatory"
+msgstr "--onto veya --advance seçeneğinin kullanımı zorunlu"
+
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"'struct rev_info' içindeki '%s' biti zorlanacağından kimi revizyon yürütme "
+"seçenekleri geçersiz kılınacak"
+
+msgid "error preparing revisions"
+msgstr "revizyonlar hazırlanırken hata"
+
+msgid "replaying down to root commit is not supported yet!"
+msgstr "kök işlemeye kadar yeniden oynatma henüz desteklenmiyor!"
+
+msgid "replaying merge commits is not supported yet!"
+msgstr "birleştirme işlemelerini yeniden oynatma henüz desteklenmiyor!"
+
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
 msgstr ""
@@ -11478,18 +11597,12 @@ msgstr "--prefix bir argüman gerektiriyor"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "--abbrev-ref için bilinmeyen kip: %s"
 
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden, --branches ile birlikte kullanılamıyor"
-
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden, --tags ile birlikte kullanılamıyor"
-
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden, --remotes ile birlikte kullanılamıyor"
-
 msgid "this operation must be run in a work tree"
 msgstr "bu işlem bir çalışma ağacı içinde çalıştırılmalı"
 
+msgid "Could not read the index"
+msgstr "İndeks okunamadı"
+
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
 msgstr "--show-object-format için bilinmeyen kip: %s"
@@ -11833,23 +11946,44 @@ msgid "Unknown hash algorithm"
 msgstr "bilinmeyen sağlama algoritması '%s'"
 
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<dizgi>...]"
 
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<başvuru>...]"
+
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<dizgi>]"
 
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <başvuru>"
+
+msgid "reference does not exist"
+msgstr "başvuru yok"
+
+msgid "failed to look up reference"
+msgstr "başvuru bakılamadı"
+
 msgid "only show tags (can be combined with heads)"
 msgstr "yalnızca etiketleri göster (dal uçlarıyla birlikte kullanılabilir)"
 
 msgid "only show heads (can be combined with tags)"
 msgstr "yalnızca dal uçlarını göster (etiketlerle birlikte kullanılabilir)"
 
+msgid "check for reference existence without resolving"
+msgstr "çözmeden başvuru varlığını denetle"
+
 msgid "stricter reference checking, requires exact ref path"
 msgstr "daha sıkı başvuru denetlemesi; kesin başvuru yolu gerektirir"
 
@@ -12661,6 +12795,9 @@ msgstr ""
 "shallow] [--reference <depo>] [--recursive] [--[no-]single-branch] [--] "
 "[<yol>...]"
 
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "HEAD geçerli bir başvuru olarak çözülemedi."
+
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<seçenekler>] [<yol>...]"
 
@@ -13119,6 +13256,9 @@ msgstr "(okunabilir veri için) kaydedilmiş çözülmeyen çakışmaları unut"
 msgid "write index in this format"
 msgstr "indeksi bu biçimle yaz"
 
+msgid "report on-disk index format version"
+msgstr "diskteki indeks biçimi sürümünü raporla"
+
 msgid "enable or disable split index"
 msgstr "bölünmüş indeksi etkinleştir veya devre dışı bırak"
 
@@ -13143,6 +13283,14 @@ msgstr "dosyaları dosya sistemi monitöründe geçerli olarak imle"
 msgid "clear fsmonitor valid bit"
 msgstr "dosya sistemi monitöründe geçerli kısmını temizle"
 
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "index-version: %d idi, %d olarak ayarlandı"
+
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
 "enable split index"
@@ -13297,29 +13445,29 @@ msgstr "Olası kaynak dal yok, '--orphan' anlamı çıkarılıyor"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
-"Bu depo için yeni bir yetim dal içeren (işlemesiz dal) bir\n"
-"çalışma ağacı oluşturmak istediyseniz bunu --orphan bayrağı\n"
-"ile yapabilirsiniz:\n"
+"Bu depo için henüz doğmamış bir dal (işleme içermeyen dal) içeren\n"
+"bir çalışma ağacı oluşturmak istediyseniz bunu --orphan bayrağını\n"
+"kullanarak yapabilirsiniz:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
-"Bu depo için yeni bir yetim dal içeren (işlemesiz dal) bir\n"
-"çalışma ağacı oluşturmak istediyseniz bunu --orphan bayrağı\n"
-"ile yapabilirsiniz:\n"
+"Bu depo için henüz doğmamış bir dal (işleme içermeyen dal) içeren\n"
+"bir çalışma ağacı oluşturmak istediyseniz bunu --orphan bayrağını\n"
+"kullanarak yapabilirsiniz:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 
@@ -13377,6 +13525,10 @@ msgstr "'%s' dizini oluşturulamadı"
 msgid "initializing"
 msgstr "ilklendiriliyor"
 
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "oluşturulan '%s' çalışma ağacı bulunamadı"
+
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
 msgstr "Çalışma ağacı hazırlanıyor (yeni dal '%s')"
@@ -13409,15 +13561,10 @@ msgstr ""
 
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
-"Bir uzak konum olmasına rağmen hiçbir yerel veya uzak başvuru\n"
-"yok, durduruluyor; geçersiz kılmak için 'add -f' kullanın veya\n"
-"önce bir uzak konum getirin"
-
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "'%s' ve '%s' birlikte kullanılamaz"
+"Bir uzak konum olmasına rağmen hiçbir yerel/uzak başvuru yok, durduruluyor;\n"
+"geçersiz kılmak veya önce bir uzak konum getirmek için 'add -f' kullanın"
 
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr "diğer çalışma ağacında çıkış yapılmış olsa bile <dal> çıkışını yap"
@@ -13428,8 +13575,8 @@ msgstr "yeni bir dal oluştur"
 msgid "create or reset a branch"
 msgstr "yeni bir dal oluştur veya sıfırla"
 
-msgid "create unborn/orphaned branch"
-msgstr "doğmamış/yetim bırakılmış dal oluştur"
+msgid "create unborn branch"
+msgstr "henüz doğmamış dal oluştur"
 
 msgid "populate the new working tree"
 msgstr "yeni çalışma ağacını doldur"
@@ -13451,11 +13598,8 @@ msgid "options '%s', '%s', and '%s' cannot be used together"
 msgstr "'%s', '%s' ve '%s' seçenekleri birlikte kullanılamaz"
 
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "'%s' ve '%s' seçenekleri birlikte kullanılamaz"
-
-msgid "<commit-ish>"
-msgstr "<işlememsi>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "'%s' seçeneği ve işlememsiler birlikte kullanılamaz"
 
 msgid "added with --lock"
 msgstr "--lock ile eklendi"
@@ -13726,6 +13870,10 @@ msgstr "index-pack sonlandı"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "iri parça numarası sonlandırması beklenenden önce ortaya çıkıyor"
 
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "iri parça kimliği %<PRIx32>, %d bayt hizalı değil"
+
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
 msgstr "düzgün olmayan iri parça ofseti %<PRIx64> ve %<PRIx64>"
@@ -13778,8 +13926,8 @@ msgstr "Hata raporu bildirimi için veri topla"
 msgid "Move objects and refs by archive"
 msgstr "Nesneleri ve başvuruları arşive göre taşı"
 
-msgid "Provide content or type and size information for repository objects"
-msgstr "Depo nesneleri için içerik veya tür/boyut bilgisi sağla"
+msgid "Provide contents or details of repository objects"
+msgstr "Depo nesnelerinin içeriğini veya ayrıntılarını sağla"
 
 msgid "Display gitattributes information"
 msgstr "gitattributes bilgisini görüntüle"
@@ -14063,6 +14211,10 @@ msgstr "Bir depodaki paketlenmemiş nesneleri paketle"
 msgid "Create, list, delete refs to replace objects"
 msgstr "Nesne değiştirmek için başvurular oluştur, sil, listele"
 
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"DENEYSEL: İşlemeleri yeni temelde yeniden oynat, çıplak depolarla da çalışır"
+
 msgid "Generates a summary of pending changes"
 msgstr "Bekleyen değişikliklerin bir özetini çıkart"
 
@@ -14184,8 +14336,8 @@ msgstr "Etiketlerin GPG imzasını doğrula"
 msgid "Display version information about Git"
 msgstr "Git sürüm bilgisini görüntüle"
 
-msgid "Show logs with difference each commit introduces"
-msgstr "Günlükleri her işlemenin sunduğu değişikliklerle göster"
+msgid "Show logs with differences each commit introduces"
+msgstr "Günlükleri her işlemenin değişiklikleriyle göster"
 
 msgid "Manage multiple working trees"
 msgstr "Birden çok çalışma ağacını yönet"
@@ -14301,6 +14453,32 @@ msgstr "Büyük Git depolarını yönetmek için bir araç"
 msgid "commit-graph file is too small"
 msgstr "commit-graph dosyası pek küçük"
 
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "commit-graph OID çıkış sayısı iri parçası boyutu yanlış"
+
+msgid "commit-graph fanout values out of order"
+msgstr "commit-graph çıkış sayısı değerleri sırasız: fanout[%d] = %u != %u"
+
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "commit-graph OID arama iri parçası boyutu yanlış"
+
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "commit-graph işleme verisi iri parçası boyutu yanlış"
+
+msgid "commit-graph generations chunk is wrong size"
+msgstr "commit-graph kuşaklar iri parçası boyutu yanlış"
+
+msgid "commit-graph changed-path index chunk is too small"
+msgstr "commit-graph changed-path indeksi iri parçası boyutu pek küçük"
+
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"commit-graph dosyasındaki pek küçük changed-path iri parçası (%<PRIuMAX> < "
+"%<PRIuMAX>) yok sayılıyor"
+
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
 msgstr "commit-graph imzası %X, %X ile eşleşmiyor"
@@ -14317,9 +14495,23 @@ msgstr "commit-graph sağlama sürümü %X, %X ile eşleşmiyor"
 msgid "commit-graph file is too small to hold %u chunks"
 msgstr "commit-graph dosyası %u iri parça tutmak için pek küçük"
 
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr ""
+"commit-graph'ten gerekli OID çıkış sayısı iri parçası eksik veya hasarlı"
+
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr "commit-graph'ten gerekli OID arama iri parçası eksik veya hasarlı"
+
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr ""
+"commit-graph'ten gerekli OID çıkış sayısı iri parçası eksik veya hasarlı"
+
 msgid "commit-graph has no base graphs chunk"
 msgstr "commit-graph temel grafiği iri parçasına iye değil"
 
+msgid "commit-graph base graphs chunk is too small"
+msgstr "commit-graph temel grafiği iri parçası pek küçük"
+
 msgid "commit-graph chain does not match"
 msgstr "commit-graph zinciri eşleşmiyor"
 
@@ -14327,6 +14519,9 @@ msgstr "commit-graph zinciri eşleşmiyor"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "temel grafikteki işleme sayısı pek yüksek: %<PRIuMAX>"
 
+msgid "commit-graph chain file too small"
+msgstr "commit-graph zincir dosyası pek küçük"
+
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
 msgstr "geçersiz commit-graph zinciri: '%s'. satır bir sağlama değil"
@@ -14344,6 +14539,12 @@ msgstr "%s işlemesi bulunamadı"
 msgid "commit-graph requires overflow generation data but has none"
 msgstr "commit-graph, taşım oluşturma verisi gerektiriyor; ancak hiç yok"
 
+msgid "commit-graph overflow generation data is too small"
+msgstr "commit-graph, taşım üretim verisi pek küçük"
+
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "commit-graph extra-edges işaretçisi sınırlar dışında"
+
 msgid "Loading known commits in commit graph"
 msgstr "İşleme grafiğindeki bilinen işlemeler yükleniyor"
 
@@ -14470,20 +14671,6 @@ msgstr "%s için olan commit-graph üst ögesi %s != %s"
 msgid "commit-graph parent list for commit %s terminates early"
 msgstr "%s işlemesi için olan commit-graph üst öge listesi erkenden sonlanıyor"
 
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"%s işlemesi için commit-graph kuşak sayısı sıfır; ancak başka yerlerde "
-"sıfırdan farklı"
-
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"%s işlemesi için commit-graph kuşak sayısı sıfırdan farklı; ancak başka "
-"yerlerde sıfır"
-
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
 msgstr "%s işlemesi için commit-graph kuşağı %<PRIuMAX> < %<PRIuMAX>"
@@ -14493,6 +14680,14 @@ msgid "commit date for commit %s in commit-graph is %<PRIuMAX> != %<PRIuMAX>"
 msgstr ""
 "%s işlemesi için commit-graph içindeki işleme tarihi %<PRIuMAX> != %<PRIuMAX>"
 
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"commit-graph'te hem sıfır hem de sıfır olmayan üretimler var (örneğin, "
+"'%s've '%s' işlemeleri)"
+
 msgid "Verifying commits in commit graph"
 msgstr "İşleme grafiğindeki işlemeler doğrulanıyor"
 
@@ -14519,6 +14714,10 @@ msgstr ""
 "\"git config advice.graftFileDeprecated false\"\n"
 "kullanarak bu iletiyi kapatabilirsiniz"
 
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr "%s işlemesi işleme grafiğinde var; ancak nesne veritabanında yok"
+
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
 msgstr ""
@@ -14960,10 +15159,6 @@ msgstr "'%s' başvurusu ikili bir nesneye işaret etmiyor"
 msgid "unable to resolve config blob '%s'"
 msgstr "'%s' yapılandırma ikili nesnesi çözülemiyor"
 
-#, c-format
-msgid "failed to parse %s"
-msgstr "%s ayrıştırılamadı"
-
 msgid "unable to parse command-line config"
 msgstr "komut satırı yapılandırması ayrıştırılamıyor"
 
@@ -15431,9 +15626,6 @@ msgstr "arşiv yazılamadı"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base erimlerle çalışmaz"
 
-msgid "--merge-base only works with commits"
-msgstr "--merge-base yalnızca işlemelerle çalışır"
-
 msgid "unable to get HEAD"
 msgstr "HEAD alınamıyor"
 
@@ -15493,6 +15685,10 @@ msgstr ""
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr "'diff.submodule' yapılandırma değişkeni için bilinmeyen değer: '%s'"
 
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "'%s' yapılandırması için bilinmeyen değer: %s"
+
 #, c-format
 msgid ""
 "Found errors in 'diff.dirstat' config variable:\n"
@@ -15573,13 +15769,6 @@ msgstr "hatalı --color-moved argümanı: %s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "--color-moved-ws içinde geçersiz kip '%s'"
 
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"diff-algorithm seçeneği şunları kabul eder: \"myers\", \"minimal\", "
-"\"patience\" ve \"histogram\""
-
 #, c-format
 msgid "invalid argument to %s"
 msgstr "%s için geçersiz argüman"
@@ -15623,8 +15812,8 @@ msgstr "makinede okunabilen --stat"
 msgid "output only the last line of --stat"
 msgstr "--stat'ın yalnızca son satırını çıktı ver"
 
-msgid "<param1,param2>..."
-msgstr "<param1,param2>..."
+msgid "<param1>,<param2>..."
+msgstr "<param1>,<param2>..."
 
 msgid ""
 "output the distribution of relative amount of changes for each sub-directory"
@@ -15634,8 +15823,8 @@ msgstr ""
 msgid "synonym for --dirstat=cumulative"
 msgstr "--dirstat=cumulative eşanlamlısı"
 
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "--dirstat=files,param1,param2... eşanlamlısı"
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "--dirstat=files,<param1>,<param2>... eşanlamlısı"
 
 msgid "warn if changes introduce conflict markers or whitespace errors"
 msgstr ""
@@ -15810,12 +15999,6 @@ msgstr "diff'i \"patience diff\" algoritmasını kullanarak oluştur"
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "diff'i \"histogram diff\" algoritmasını kullanarak oluştur"
 
-msgid "<algorithm>"
-msgstr "<algoritma>"
-
-msgid "choose a diff algorithm"
-msgstr "bir diff algoritması seç"
-
 msgid "<text>"
 msgstr "<metin>"
 
@@ -16849,12 +17032,12 @@ msgstr ""
 "%s altmodülü birleştirilemedi; ancak birden çok olası birleştirmeler var:\n"
 "%s"
 
-msgid "Failed to execute internal merge"
-msgstr "İç birleştirme yürütülemedi"
+msgid "failed to execute internal merge"
+msgstr "iç birleştirme yürütülemedi"
 
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "%s veritabanına eklenemedi"
+msgid "unable to add %s to database"
+msgstr "%s veritabanına eklenemiyor"
 
 #, c-format
 msgid "Auto-merging %s"
@@ -17298,7 +17481,19 @@ msgid "failed to read the cache"
 msgstr "önbellek okunamadı"
 
 msgid "multi-pack-index OID fanout is of the wrong size"
-msgstr "multi-pack-index OID ikiye bölümünün boyutu hatalı"
+msgstr "multi-pack-index OID çıkış sayısı boyutu yanlış"
+
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"oid çıkış sayısı sırasız: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "multi-pack-index OID arama iri parçası yanlış boyutlu"
+
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr "multi-pack-index OID nesne ofseti iri parçası yanlış boyutlu"
 
 #, c-format
 msgid "multi-pack-index file %s is too small"
@@ -17316,17 +17511,21 @@ msgstr "multi-pack-index sürümü %d tanımlanamıyor"
 msgid "multi-pack-index hash version %u does not match version %u"
 msgstr "multi-pack-index sağlama sürümü %u, %u sürümü ile eşleşmiyor"
 
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "multi-pack-index'ten gerekli pack-name iri parçası eksik"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr "multi-pack-index'ten gerekli pack-name iri parçası eksik veya hasarlı"
 
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "multi-pack-index'ten gerekli OID fanout iri parçası eksik"
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr "multi-pack-index'ten gerekli OID fanout iri parçası eksik veya hasarlı"
 
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "multi-pack-index'ten gerekli OID arama iri parçası eksik"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr "multi-pack-index'ten gerekli OID arama iri parçası eksik veya hasarlı"
 
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "multi-pack-index'ten gerekli nesne ofsetleri iri parçası eksik"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr ""
+"multi-pack-index'ten gerekli nesne ofsetleri iri parçası eksik veya hasarlı"
+
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "multi-pack-index pack-name iri parçası pek kısa"
 
 #, c-format
 msgid "multi-pack-index pack names out of order: '%s' before '%s'"
@@ -17336,9 +17535,19 @@ msgstr "multi-pack-index paket adlarının sırasız: '%s' şundan önce: '%s'"
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "hatalı pack-int-id: %u (%u toplam paket)"
 
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "MIDX, BTMP iri parçasını içermiyor"
+
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "biteşlemli %<PRIu32> paketi yüklenemedi"
+
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr "multi-pack-index bir 64 bit ofset depoluyor; ancak off_t pek küçük"
 
+msgid "multi-pack-index large offset out of bounds"
+msgstr "multi-pack-index geniş ofseti sınırlar dışında"
+
 #, c-format
 msgid "failed to add packfile '%s'"
 msgstr "paket dosyası '%s' eklenemedi"
@@ -17416,11 +17625,6 @@ msgstr "yanlış sağlama toplamı"
 msgid "Looking for referenced packfiles"
 msgstr "Başvurulmuş paket dosyaları aranıyor"
 
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr "oid fanout sırasız: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-
 msgid "the midx contains no oid"
 msgstr "midx bir oid içermiyor"
 
@@ -17940,9 +18144,12 @@ msgstr "çoklu paket biteşlemi gereken ters indeksi içermiyor"
 msgid "could not open pack %s"
 msgstr "%s paketi açılamadı"
 
+msgid "could not determine MIDX preferred pack"
+msgstr "MIDX yeğlenen paketi algılanamadı"
+
 #, c-format
 msgid "preferred pack (%s) is invalid"
-msgstr "tercih edilen (%s) paket geçersiz"
+msgstr "yeğlenen paket (%s) geçersiz"
 
 msgid "corrupt bitmap lookup table: triplet position out of index"
 msgstr "hasarlı biteşlem arama tablosu: üçlü konum indeks dışında"
@@ -17959,6 +18166,10 @@ msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
 msgstr ""
 "hasarlı ewah biteşlemi: \"%s\" işlemesinin biteşleminde kısaltılmış üstbilgi"
 
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr "paket yüklenemiyor: '%s', pack-reuse devre dışı bırakılıyor"
+
 #, c-format
 msgid "object '%s' not found in type bitmaps"
 msgstr "'%s' nesnesi, tür biteşlemlerinde bulunamadı"
@@ -18047,6 +18258,12 @@ msgstr "geçersiz sağlama toplamı"
 msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr "%<PRIu64> konumunda geçersiz rev-index konumu: %<PRIu32> != %<PRIu32>"
 
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr "multi-pack-index reverse-index iri parçası yanlış boyutlu"
+
+msgid "could not determine preferred pack"
+msgstr "yeğlenen paket algılanamadı"
+
 msgid "cannot both write and verify reverse index"
 msgstr "ters indeks dosyası hem yazılıp hem doğrulanamıyor"
 
@@ -18097,14 +18314,6 @@ msgstr "'%s' seçeneği \"%s\" veya \"%s\" bekliyor"
 msgid "%s requires a value"
 msgstr "%s bir değer gerektiriyor"
 
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s, %s ile uyumsuz"
-
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s: başka bir şeyle uyumsuz"
-
 #, c-format
 msgid "%s takes no value"
 msgstr "%s bir değer almıyor"
@@ -18188,6 +18397,10 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-SAYI"
 
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "--no-%s karşıtı"
+
 msgid "expiry-date"
 msgstr "son kullanım tarihi"
 
@@ -18215,7 +18428,15 @@ msgstr "yol belirtecini dosyadan oku"
 msgid ""
 "with --pathspec-from-file, pathspec elements are separated with NUL character"
 msgstr ""
-"--pathspec-from-file ile, yol belirteci ögeleri NUL karakteri ile ayrılır"
+"--pathspec-from-file ile yol belirteci ögeleri NUL karakteri ile ayrılır"
+
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "hatalı Boole çevre değeri '%s', '%s' için"
+
+#, c-format
+msgid "failed to parse %s"
+msgstr "%s ayrıştırılamadı"
 
 #, c-format
 msgid "Could not make %s writable by group"
@@ -18263,6 +18484,10 @@ msgstr "Yerine getirilmemiş yol belirteci sihri '%c' ('%s' içinde)"
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s: 'literal' ve 'glob' birbiriyle uyumsuz"
 
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "'%s', dizin ağacının dışında"
+
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
 msgstr "%s: '%s', '%s' konumunda depo dışında"
@@ -18414,10 +18639,6 @@ msgstr "'%s' dosyası indekslenemiyor"
 msgid "unable to add '%s' to index"
 msgstr "'%s' indekse eklenemiyor"
 
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "'%s' dosyasının bilgileri alınamıyor"
-
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
 msgstr "'%s' hem bir dosya hem de bir dizin olarak görünüyor"
@@ -18525,10 +18746,6 @@ msgstr "bir aralıklı indeks için bölünmüş indeks yazılamıyor"
 msgid "failed to convert to a sparse-index"
 msgstr "bir sparse-index'e dönüştürülemedi"
 
-#, c-format
-msgid "could not stat '%s'"
-msgstr "'%s' bilgileri alınamadı"
-
 #, c-format
 msgid "unable to open git dir: %s"
 msgstr "git dizini açılamıyor: %s"
@@ -18993,10 +19210,6 @@ msgstr "'%s' mevcut; '%s' oluşturulamıyor"
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "'%s' ve '%s' aynı anda işlenemiyor"
 
-#, c-format
-msgid "could not remove reference %s"
-msgstr "%s başvurusu kaldırılamadı"
-
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "%s başvurusu silinemedi: %s"
@@ -19551,8 +19764,15 @@ msgstr "klonlama sırasında tam çalışma dizini oluştur"
 msgid "only download metadata for the branch that will be checked out"
 msgstr "yalnızca çıkış yapılacak dalın üstverisini indir"
 
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<seçenekler>] [--] <depo> [<dizin>]"
+msgid "create repository within 'src' directory"
+msgstr "'src' dizininde depo oluştur"
+
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <ana-dal>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<yazılma>]"
 
 #, c-format
 msgid "cannot deduce worktree name from '%s'"
@@ -19603,12 +19823,28 @@ msgid "could not remove stale scalar.repo '%s'"
 msgstr "eskimiş scalar.repo '%s' kaldırılamadı"
 
 #, c-format
-msgid "removing stale scalar.repo '%s'"
-msgstr "eskimiş scalar.repo '%s' kaldırılıyor"
+msgid "removed stale scalar.repo '%s'"
+msgstr "eskimiş scalar.repo '%s' kaldırıl"
 
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "git deposu '%s' içinde gitti"
+msgid "repository at '%s' has different owner"
+msgstr "'%s' konumundaki deponun sahibi başkası"
+
+#, c-format
+msgid "repository at '%s' has a format issue"
+msgstr "'%s' konumundaki depoda bir biçim sorunu var"
+
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "'%s' konumunda depo bulunamadı"
+
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"bu deponun kaydını Scalar'dan kaldırmak için şu komutu çalıştırın:\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 msgid ""
 "scalar run <task> [<enlistment>]\n"
@@ -20008,10 +20244,6 @@ msgstr "%s işlemesinin iletisi alınamıyor"
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s: üst işleme %s ayrıştırılamıyor"
 
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "'%s', '%s' olarak yeniden adlandırılamadı"
-
 #, c-format
 msgid "could not revert %s... %s"
 msgstr "%s geri alınamadı... %s"
@@ -20334,6 +20566,9 @@ msgstr "Kendiliğinden zulalama çakışmalara neden oldu."
 msgid "Autostash exists; creating a new stash entry."
 msgstr "Kendiliğinden zulalama mevcut; yeni bir zula girdisi oluşturuluyor."
 
+msgid "autostash reference is a symref"
+msgstr "kendiliğinden zulalama başvurusu bir sembol başvurusu"
+
 msgid "could not detach HEAD"
 msgstr "HEAD ayrılamadı"
 
@@ -20365,14 +20600,14 @@ msgstr ""
 "\tgit rebase --edit-todo\n"
 "\tgit rebase --continue\n"
 
-#, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "Yeniden temellendiriliyor: (%d/%d)%s"
-
 #, c-format
 msgid "Stopped at %s...  %.*s\n"
 msgstr "%s konumunda durdu... %.*s\n"
 
+#, c-format
+msgid "Rebasing (%d/%d)%s"
+msgstr "Yeniden temellendiriliyor: (%d/%d)%s"
+
 #, c-format
 msgid "unknown command %d"
 msgstr "bilinmeyen komut %d"
@@ -20644,6 +20879,10 @@ msgstr "şablonlar '%s' konumundan kopyalanmıyor: %s"
 msgid "invalid initial branch name: '%s'"
 msgstr "geçersiz başlangıç dalı adı: '%s'"
 
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-init: --initial-branch=%s yok sayıldı"
+
 #, c-format
 msgid "unable to handle file type %d"
 msgstr "%d dosya türü ele alınamıyor"
@@ -20655,14 +20894,15 @@ msgstr "%s şuraya taşınamıyor: %s"
 msgid "attempt to reinitialize repository with different hash"
 msgstr "depoyu başka bir sağlama ile yeniden ilklendirme deneniyor"
 
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr ""
+"depo başka bir başvuru depolama biçimiyle yeniden ilklendirilmeye çalışılıyor"
+
 #, c-format
 msgid "%s already exists"
 msgstr "%s halihazırda var"
 
-#, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-init: --initial-branch=%s yok sayıldı"
-
 #, c-format
 msgid "Reinitialized existing shared Git repository in %s%s\n"
 msgstr "%s%s içindeki var olan paylaşılan Git deposu yeniden ilklendirildi\n"
@@ -20927,12 +21167,6 @@ msgstr "her bir yinelemeden önce önbellek ağacını temizle"
 msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr "önbellek ağacındaki geçersizleştirilecek girdi sayısı (öntanımlı 0)"
 
-msgid "unhandled options"
-msgstr "beklenmeyen seçenekler"
-
-msgid "error preparing revisions"
-msgstr "revizyonlar hazırlanırken hata"
-
 #, c-format
 msgid "commit %s is not marked reachable"
 msgstr "%s işlemesi ulaşılabilir olarak imlenmedi"
@@ -21086,9 +21320,6 @@ msgstr "uzak servis yolu ayarlama protokol tarafından desteklenmiyor"
 msgid "invalid remote service path"
 msgstr "geçersiz uzak konum servis yolu"
 
-msgid "operation not supported by protocol"
-msgstr "işlem protokol tarafından desteklenmiyor"
-
 #, c-format
 msgid "can't connect to subservice %s"
 msgstr "%s altservisine bağlanılamıyor"
@@ -21218,10 +21449,6 @@ msgstr "transport.color.* yapılandırması ayrıştırılamadı"
 msgid "support for protocol v2 not implemented yet"
 msgstr "protokol v2 desteği henüz yerine getirilmedi"
 
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "'%s' yapılandırması için bilinmeyen değer: %s"
-
 #, c-format
 msgid "transport '%s' not allowed"
 msgstr "'%s' taşıyıcısına izin verilmiyor"
@@ -21275,6 +21502,9 @@ msgstr "bundle-uri işlemi protokol tarafından desteklenmiyor"
 msgid "could not retrieve server-advertised bundle-uri list"
 msgstr "sunucu tarafından tanıtılan bundle-uri listesi alınamadı"
 
+msgid "operation not supported by protocol"
+msgstr "işlem protokol tarafından desteklenmiyor"
+
 msgid "too-short tree object"
 msgstr "ağaç nesnesi çok kısa"
 
@@ -21661,6 +21891,9 @@ msgstr "'%s' erişilemiyor"
 msgid "unable to get current working directory"
 msgstr "geçerli çalışma dizini alınamıyor"
 
+msgid "unable to get random bytes"
+msgstr "rastgele baytlar alınamıyor"
+
 msgid "Unmerged paths:"
 msgstr "Birleştirilmemiş yollar:"
 
@@ -22095,6 +22328,10 @@ msgstr "Ek olarak, indeksiniz işlenmemiş değişiklikler içeriyor."
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "%s yapılamıyor: İndeksiniz işlenmemiş değişiklikler içeriyor."
 
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "'%s' bilinmeyen biçemi şunun için verildi: '%s'"
+
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
 "merge"
@@ -22276,14 +22513,14 @@ msgstr ""
 "\n"
 "Bir özet göndermek istemiyorsanız gövde kısmını temizleyin.\n"
 
-#, perl-format
-msgid "Failed to open %s: %s"
-msgstr "%s açılamadı: %s"
-
 #, perl-format
 msgid "Failed to open %s.final: %s"
 msgstr "%s.final açılamadı: %s"
 
+#, perl-format
+msgid "Failed to open %s: %s"
+msgstr "%s açılamadı: %s"
+
 msgid "Summary email is empty, skipping it\n"
 msgstr "Özet e-postası boş, atlanıyor\n"
 
index 5a11cc661467245e81b056368e140840470f00e8..0507e387babbbd98578060270e3293ba84ccdda8 100644 (file)
--- a/po/uk.po
+++ b/po/uk.po
@@ -6,10 +6,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Git v2.42.0\n"
+"Project-Id-Version: Git v2.43\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-15 15:28-0700\n"
-"PO-Revision-Date: 2023-08-15 15:31-0700\n"
+"POT-Creation-Date: 2023-11-09 14:26-0800\n"
+"PO-Revision-Date: 2024-02-11 09:26-0800\n"
 "Last-Translator: Arkadii Yakovets <ark@cho.red>\n"
 "Language-Team: Ukrainian <https://github.com/arkid15r/git-uk-l10n/>\n"
 "Language: uk\n"
@@ -18,7 +18,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
-"X-Generator: Poedit 3.3.2\n"
+"X-Generator: Poedit 3.4.2\n"
 
 #, c-format
 msgid "Huh (%s)?"
@@ -525,7 +525,6 @@ msgstr "\"git apply --cached\" завершився невдало"
 #. (saying "n" for "no" discards!) if the translation
 #. of the word "no" does not start with n.
 #.
-
 msgid ""
 "Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
 msgstr ""
@@ -1444,6 +1443,10 @@ msgstr "опція \"%s\" потребує \"%s\""
 msgid "Unexpected option --output"
 msgstr "Неочікувана опція --output"
 
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "зайвий параметр командного рядка: \"%s\""
+
 #, c-format
 msgid "Unknown archive format '%s'"
 msgstr "Невідомий формат архіву \"%s\""
@@ -1489,6 +1492,14 @@ msgstr "ігнорування надто великих gitattributes blob \"%s
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "невірний --attr-source або GIT_ATTR_SOURCE"
 
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "не вдалося виконати stat для \"%s\""
+
+#, c-format
+msgid "unable to read %s"
+msgstr "не вдалося прочитати %s"
+
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
 msgstr "Невірно процитований вміст у файлі \"%s\": %s"
@@ -1587,7 +1598,6 @@ msgstr[2] "(приблизно %d кроків)"
 #. TRANSLATORS: the last %s will be replaced with "(roughly %d
 #. steps)" translation.
 #.
-
 #, c-format
 msgid "Bisecting: %d revision left to test after this %s\n"
 msgid_plural "Bisecting: %d revisions left to test after this %s\n"
@@ -1668,16 +1678,17 @@ msgstr ""
 msgid "not tracking: ambiguous information for ref '%s'"
 msgstr "не відстежується: неоднозначна інформація для посилання \"%s\""
 
+#. #-#-#-#-#  branch.c.po  #-#-#-#-#
 #. TRANSLATORS: This is a line listing a remote with duplicate
 #. refspecs in the advice message below. For RTL languages you'll
 #. probably want to swap the "%s" and leading "  " space around.
 #.
+#. #-#-#-#-#  object-name.c.po  #-#-#-#-#
 #. TRANSLATORS: This is line item of ambiguous object output
 #. from describe_ambiguous_object() above. For RTL languages
 #. you'll probably want to swap the "%s" and leading " " space
 #. around.
 #.
-
 #, c-format
 msgid "  %s\n"
 msgstr "  %s\n"
@@ -1685,7 +1696,6 @@ msgstr "  %s\n"
 #. TRANSLATORS: The second argument is a \n-delimited list of
 #. duplicate refspecs, composed above.
 #.
-
 #, c-format
 msgid ""
 "There are multiple remotes whose fetch refspecs map to the remote\n"
@@ -1781,8 +1791,8 @@ msgid "submodule '%s': cannot create branch '%s'"
 msgstr "підмодуль \"%s\": неможливо створити гілку \"%s\""
 
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "\"%s\" вже існує в \"%s\""
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "\"%s\" вже використовується робочим деревом в \"%s\""
 
 msgid "git add [<options>] [--] <pathspec>..."
 msgstr "git add [<опції>] [--] <визначник шляху>..."
@@ -1801,25 +1811,22 @@ msgstr ""
 "параметр add.interactive.useBuiltin було видалено!\n"
 "Дивіться запис у \"git help config\" для більш детальної інформації."
 
-msgid "Could not read the index"
-msgstr "Не вдалося прочитати індекс"
-
-msgid "Could not write patch"
-msgstr "Не вдалося записати латку"
+msgid "could not read the index"
+msgstr "не вдалося прочитати індекс"
 
 msgid "editing patch failed"
 msgstr "не вдалося відредагувати латку"
 
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "Ð\9dе вдалося виконати stat \"%s\""
+msgid "could not stat '%s'"
+msgstr "не вдалося виконати stat \"%s\""
 
-msgid "Empty patch. Aborted."
-msgstr "Ð\9fоÑ\80ожнÑ\8f Ð»Ð°Ñ\82ка. Ð\9fеÑ\80еÑ\80вано."
+msgid "empty patch. aborted"
+msgstr "поÑ\80ожнÑ\8f Ð»Ð°Ñ\82ка. Ð¿ÐµÑ\80еÑ\80вано"
 
 #, c-format
-msgid "Could not apply '%s'"
-msgstr "Ð\9dе вдалося застосувати \"%s\""
+msgid "could not apply '%s'"
+msgstr "не вдалося застосувати \"%s\""
 
 msgid "The following paths are ignored by one of your .gitignore files:\n"
 msgstr "Наступні шляхи ігноруються одним з ваших .gitignore файлів:\n"
@@ -1947,6 +1954,9 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "індексний файл пошкоджено"
 
+msgid "unable to write new index file"
+msgstr "не вдалося записати новий файл індексу"
+
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "невірна дія \"%s\" для \"%s\""
@@ -2094,7 +2104,6 @@ msgstr "Тіло коміту:"
 #. in your translation. The program will only accept English
 #. input at this point.
 #.
-
 #, c-format
 msgid "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all: "
 msgstr ""
@@ -2158,9 +2167,6 @@ msgstr ""
 "щоб позначити їх як такі.\n"
 "Ви можете виконати \"git rm\" для файлу, щоб прийняти \"видалено ними\"."
 
-msgid "unable to write new index file"
-msgstr "не вдалося записати новий файл індексу"
-
 #, c-format
 msgid "Could not parse object '%s'."
 msgstr "Не вдалося розібрати об'єкт '%s'."
@@ -2179,10 +2185,6 @@ msgstr ""
 msgid "failed to read '%s'"
 msgstr "не вдалося прочитати \"%s\""
 
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "опції \"%s=%s\" and \"%s=%s\" не можна використовувати разом"
-
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<опції>] [(<скринька> [<поштова директорія>)...]"
 
@@ -2334,10 +2336,10 @@ msgid "git archive: expected a flush"
 msgstr "git archive: очікувалось flush"
 
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<термін> --term-{old,good}=<термін>]    "
+"git bisect start [--term-(new,bad)=<термін> --term-(old,good)=<термін>]    "
 "[--no-checkout] [--first-parent] [<поганий> [<добрий>...]] [--]    "
 "[<визначник шляху>...]"
 
@@ -2353,8 +2355,8 @@ msgstr "git bisect reset [<коміт>]"
 msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <лог файл>"
 
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <команда>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <команда> [<аргумент>...]"
 
 #, c-format
 msgid "cannot open file '%s' in mode '%s'"
@@ -2442,7 +2444,6 @@ msgstr "бісекція лише з %s комітом"
 #. translation. The program will only accept English input
 #. at this point.
 #.
-
 msgid "Are you sure [Y/n]? "
 msgstr "Ви впевнені [Y/n]? "
 
@@ -2519,7 +2520,6 @@ msgstr "Вам потрібно почати з \"git bisect start\"\n"
 #. translation. The program will only accept English input
 #. at this point.
 #.
-
 msgid "Do you want me to do it for you [Y/n]? "
 msgstr "Ви хочете, щоб я зробив це для вас [Y/n]? "
 
@@ -2737,7 +2737,6 @@ msgstr ""
 #. your language may need more or fewer display
 #. columns.
 #.
-
 msgid "4 years, 11 months ago"
 msgstr "4 роки, 11 місяців тому"
 
@@ -2782,44 +2781,47 @@ msgstr "git branch [<опції>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
 "видалення гілки \"%s\", яка була злита з\n"
-"         \"%s\", але ще не злита з HEAD."
+"         \"%s\", але ще не злита з HEAD"
 
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
 "утримання гілки \"%s\", яка ще не була злита з\n"
-"         \"%s\", Ð½ÐµÐ·Ð²Ð°Ð¶Ð°Ñ\8eÑ\87и Ð½Ð° Ñ\82е, Ñ\89о Ð²Ð¶Ðµ Ð·Ð»Ð¸Ñ\82а Ð· HEAD."
+"         \"%s\", Ð½ÐµÐ·Ð²Ð°Ð¶Ð°Ñ\8eÑ\87и Ð½Ð° Ñ\82е, Ñ\89о Ð²Ð¶Ðµ Ð±Ñ\83ла Ð·Ð»Ð¸Ñ\82а Ð· HEAD"
 
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
-msgstr "Ð\9dе вдалося знайти об’єкт коміту для \"%s\""
+msgid "couldn't look up commit object for '%s'"
+msgstr "не вдалося знайти об’єкт коміту для \"%s\""
 
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
+msgid "the branch '%s' is not fully merged"
+msgstr "гілка \"%s\" злита не повністю"
+
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
 msgstr ""
-"Гілка \"%s\" злита не повністю.\n"
-"Якщо ви впевнені, що хочете її видалити, виконайте \"git branch -D %s\"."
+"Якщо ви впевнені, що хочете її видалити, виконайте \"git branch -D %s\""
 
-msgid "Update of config-file failed"
-msgstr "Ð\9dе вдалося оновити конфігураційний файл"
+msgid "update of config-file failed"
+msgstr "не вдалося оновити конфігураційний файл"
 
 msgid "cannot use -a with -d"
 msgstr "не можна використовувати -a з -d"
 
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "Неможливо видалити гілку \"%s\" за адресою \"%s\""
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr ""
+"неможливо видалити гілку \"%s\", яка використовується робочим деревом у "
+"\"%s\""
 
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "віддалено відстежувана гілка \"%s\" не знайдена."
+msgid "remote-tracking branch '%s' not found"
+msgstr "віддалено відстежувана гілка \"%s\" не знайдена"
 
 #, c-format
 msgid ""
@@ -2830,8 +2832,8 @@ msgstr ""
 "Ви забули --remote?"
 
 #, c-format
-msgid "branch '%s' not found."
-msgstr "гілка \"%s\" не знайдена."
+msgid "branch '%s' not found"
+msgstr "гілка \"%s\" не знайдена"
 
 #, c-format
 msgid "Deleted remote-tracking branch %s (was %s).\n"
@@ -2852,52 +2854,52 @@ msgid "HEAD (%s) points outside of refs/heads/"
 msgstr "HEAD (%s) пунктів за межами refs/heads/"
 
 #, c-format
-msgid "Branch %s is being rebased at %s"
-msgstr "Ð\93ілка %s перебазується на %s"
+msgid "branch %s is being rebased at %s"
+msgstr "гілка %s перебазується на %s"
 
 #, c-format
-msgid "Branch %s is being bisected at %s"
-msgstr "Ð\93Ñ\96лка %s Ð±Ñ\96Ñ\81екÑ\82Ñ\83Ñ\94Ñ\82Ñ\8cÑ\81Ñ\8f Ð² Ñ\82оÑ\87Ñ\86Ñ\96 %s"
+msgid "branch %s is being bisected at %s"
+msgstr "гÑ\96лка %s Ð±Ñ\96Ñ\81екÑ\82Ñ\83Ñ\94Ñ\82Ñ\8cÑ\81Ñ\8f Ð² %s"
 
 #, c-format
 msgid "HEAD of working tree %s is not updated"
 msgstr "HEAD робочого дерева %s не оновлено"
 
 #, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Ð\9dеприпустима назва гілки: \"%s\""
+msgid "invalid branch name: '%s'"
+msgstr "неприпустима назва гілки: \"%s\""
 
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Ð\9fоки Ñ\89о Ð½ÐµÐ¼Ð°Ñ\94 ÐºÐ¾Ð¼Ñ\96Ñ\82Ñ\96в Ð² Ð³Ñ\96лÑ\86Ñ\96 \"%s\"."
+msgid "no commit on branch '%s' yet"
+msgstr "поки Ñ\89о Ð½ÐµÐ¼Ð°Ñ\94 ÐºÐ¾Ð¼Ñ\96Ñ\82Ñ\96в Ñ\83 Ð³Ñ\96лÑ\86Ñ\96 \"%s\""
 
 #, c-format
-msgid "No branch named '%s'."
-msgstr "Ð\9dемаÑ\94 Ð³Ñ\96лки Ð· Ñ\96мâ\80\99Ñ\8fм \"%s\"."
+msgid "no branch named '%s'"
+msgstr "немаÑ\94 Ð³Ñ\96лки Ð· Ð½Ð°Ð·Ð²Ð¾Ñ\8e \"%s\""
 
-msgid "Branch rename failed"
-msgstr "Ð\9dе вдалося перейменувати гілку"
+msgid "branch rename failed"
+msgstr "не вдалося перейменувати гілку"
 
-msgid "Branch copy failed"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\81Ñ\82воÑ\80иÑ\82и ÐºÐ¾Ð¿Ñ\96Ñ\8e Ð³Ñ\96лки"
+msgid "branch copy failed"
+msgstr "не Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\81копÑ\96Ñ\8eваÑ\82и Ð³Ñ\96лкÑ\83"
 
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
-msgstr "Створено копію невірно названої гілки \"%s\""
+msgid "created a copy of a misnamed branch '%s'"
+msgstr "створено копію невірно названої гілки \"%s\""
 
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
-msgstr "Ð\9fерейменовано невірно названу гілку \"%s\""
+msgid "renamed a misnamed branch '%s' away"
+msgstr "перейменовано невірно названу гілку \"%s\""
 
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "Ð\93Ñ\96лкÑ\83 Ð¿ÐµÑ\80ейменовано Ð½Ð° %s, Ð°Ð»Ðµ HEAD Ð½Ðµ Ð¾Ð½Ð¾Ð²Ð»ÐµÐ½Ð¾!"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "гÑ\96лкÑ\83 Ð¿ÐµÑ\80ейменовано Ð½Ð° %s, Ð°Ð»Ðµ HEAD Ð½Ðµ Ð¾Ð½Ð¾Ð²Ð»ÐµÐ½Ð¾"
 
-msgid "Branch is renamed, but update of config-file failed"
-msgstr "Ð\93ілку перейменовано, але не вдалося оновити конфігураційний файл"
+msgid "branch is renamed, but update of config-file failed"
+msgstr "гілку перейменовано, але не вдалося оновити конфігураційний файл"
 
-msgid "Branch is copied, but update of config-file failed"
-msgstr "Ð\93ілку скопійовано, але не вдалося оновити конфігураційний файл"
+msgid "branch is copied, but update of config-file failed"
+msgstr "гілку скопійовано, але не вдалося оновити конфігураційний файл"
 
 #, c-format
 msgid ""
@@ -3012,8 +3014,8 @@ msgstr "рекурсивно через підмодулі"
 msgid "format to use for the output"
 msgstr "формат, що використовувати для виводу"
 
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\80озпÑ\96знаÑ\82и HEAD Ñ\8fк Ð´Ñ\96йÑ\81не Ð¿Ð¾Ñ\81иланнÑ\8f."
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "не Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\80озпÑ\96знаÑ\82и HEAD Ñ\8fк Ð´Ñ\96йÑ\81не Ð¿Ð¾Ñ\81иланнÑ\8f"
 
 msgid "HEAD not found below refs/heads!"
 msgstr "HEAD не знайдено під refs/heads!"
@@ -3031,17 +3033,17 @@ msgstr "--recurse-submodules можна використовувати лише
 msgid "branch name required"
 msgstr "назва гілки є обовʼязковою"
 
-msgid "Cannot give description to detached HEAD"
-msgstr "Ð\9dеможливо Ð²Ñ\81Ñ\82ановити опис відокремленому HEAD"
+msgid "cannot give description to detached HEAD"
+msgstr "неможливо Ð½Ð°Ð´Ð°ти опис відокремленому HEAD"
 
 msgid "cannot edit description of more than one branch"
 msgstr "неможливо редагувати опис більш ніж однієї гілки"
 
-msgid "cannot copy the current branch while not on any."
-msgstr "неможливо скопіювати поточну гілку, не перебуваючи на жодній з них."
+msgid "cannot copy the current branch while not on any"
+msgstr "неможливо скопіювати поточну гілку, не перебуваючи на жодній з них"
 
-msgid "cannot rename the current branch while not on any."
-msgstr "неможливо перейменувати поточну гілку, не перебуваючи на жодній з них."
+msgid "cannot rename the current branch while not on any"
+msgstr "неможливо перейменувати поточну гілку, не перебуваючи на жодній з них"
 
 msgid "too many branches for a copy operation"
 msgstr "забагато гілок для операції копіювання"
@@ -3054,10 +3056,10 @@ msgstr "забагато аргументів для встановлення н
 
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
+"could not set upstream of HEAD to %s when it does not point to any branch"
 msgstr ""
 "не вдалося встановити першождерельне сховище HEAD у %s, який не вказує на "
-"жодну гілку."
+"жодну гілку"
 
 #, c-format
 msgid "no such branch '%s'"
@@ -3070,28 +3072,28 @@ msgstr "гілка \"%s\" не існує"
 msgid "too many arguments to unset upstream"
 msgstr "забагато аргументів для скидання значення першоджерельного сховища"
 
-msgid "could not unset upstream of HEAD when it does not point to any branch."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
 msgstr ""
-"неможливво скинути значення першоджерельного сховища для HEAD, який не "
-"вказує на жодну гілку."
+"не вдалося скинути значення першоджерельного сховища для HEAD, який не "
+"вказує на жодну гілку"
 
 #, c-format
-msgid "Branch '%s' has no upstream information"
-msgstr "Ð\93ілка \"%s\" не має інформації щодо першоджерельного сховища"
+msgid "branch '%s' has no upstream information"
+msgstr "гілка \"%s\" не має інформації щодо першоджерельного сховища"
 
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
-"Ð\9eпції -a та -r для \"git branch\" не приймають назву гілки.\n"
+"опції -a та -r для \"git branch\" не приймають назву гілки.\n"
 "Ви хотіли використати -a|-r --list <шаблон>?"
 
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
+"'--set-upstream-to' instead"
 msgstr ""
 "опція \"--set-upstream\" більше не підтримується. Будь ласка, використовуйте "
-"\"--track\" або \"--set-upstream-to\"."
+"\"--track\" або \"--set-upstream-to\" замість неї"
 
 msgid "git version:\n"
 msgstr "версія git:\n"
@@ -3166,6 +3168,10 @@ msgstr "вказати місце призначення для файла(-ів
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "вказати суфікс формату strftime для назви файла(-ів)"
 
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "невідомий аргумент \"%s\""
+
 #, c-format
 msgid "could not create leading directories for '%s'"
 msgstr "не вдалося створити провідні каталоги для \"%s\""
@@ -3272,6 +3278,14 @@ msgstr "git cat-file (-e | -p) <об’єкт>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <об’єкт>"
 
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<ревізія>:<шлях|деревоподібне-джерело> | --path=<шлях|"
+"деревоподібне-джерело> <ревізія>]"
+
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
 "objects]\n"
@@ -3283,14 +3297,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<ревізія>:<шлях|деревоподібне-джерело> | --path=<шлях|"
-"деревоподібне-джерело> <ревізія>]"
-
 msgid "Check object existence or emit object contents"
 msgstr "Перевірити існування об’єкта або видати вміст об’єкта"
 
@@ -3588,6 +3594,11 @@ msgstr "\"%s\" повинен використовуватися, якщо не
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "\"%s\" або \"%s\" не можна використовувати з %s"
 
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr ""
+"\"%s\", \"%s\" або \"%s\" не можна використовувати при переключенні стану"
+
 #, c-format
 msgid "path '%s' is unmerged"
 msgstr "шлях '%s' не злитий"
@@ -3852,8 +3863,8 @@ msgstr "переключити примусово (викинути локаль
 msgid "new-branch"
 msgstr "нова-гілка"
 
-msgid "new unparented branch"
-msgstr "нова Ð³Ñ\96лка Ð±ÐµÐ· Ð´Ð¶ÐµÑ\80ела"
+msgid "new unborn branch"
+msgstr "нова Ð½ÐµÐ½Ð°Ñ\80оджена Ð³Ñ\96лка"
 
 msgid "update ignored files (default)"
 msgstr "оновити ігноровані файли (за замовчуванням)"
@@ -4036,7 +4047,6 @@ msgid "Select items to delete"
 msgstr "Виберіть елементи для видалення"
 
 #. TRANSLATORS: Make sure to keep [y/N] as is
-
 #, c-format
 msgid "Remove %s [y/N]? "
 msgstr "Видалити %s [y/N]? "
@@ -4105,9 +4115,6 @@ msgstr ""
 "clean.requireForce встановлено у true за замовчуванням і не задано ні -i, ні "
 "-n, ні -f; відмовлено в прибиранні"
 
-msgid "-x and -X cannot be used together"
-msgstr "-x та -X не можна використовувати разом"
-
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<опції>] [--] <сховище> [<директорія>]"
 
@@ -4198,6 +4205,9 @@ msgstr "git директорія"
 msgid "separate git dir from working tree"
 msgstr "відокремити git-директорію від робочого дерева"
 
+msgid "specify the reference format to use"
+msgstr "вкажіть формат посилання, який потрібно використовувати"
+
 msgid "key=value"
 msgstr "ключ=значення"
 
@@ -4316,11 +4326,9 @@ msgstr "Забагато аргументів."
 msgid "You must specify a repository to clone."
 msgstr "Треба вказати сховище для клонування."
 
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr ""
-"--bundle-uri несумісний з --depth, --shallow-since та --shallow-exclude"
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "невідомий формат зберігання посилань \"%s\""
 
 #, c-format
 msgid "repository '%s' does not exist"
@@ -4455,7 +4463,7 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <директорія>] [--append] [--object-dir "
 "<директорія>] [--append] [--object-dir <директорія>] [--append\n"
@@ -4463,7 +4471,7 @@ msgstr ""
 "| --stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <число>] [--"
 "[no-]progress]\n"
-"                       <опції розділення>"
+"                       <опції-розділення>"
 
 msgid "dir"
 msgstr "директорія"
@@ -4478,6 +4486,10 @@ msgstr "якщо коміт-граф розщеплено, перевіряти
 msgid "Could not open commit-graph '%s'"
 msgstr "Не вдалося відкрити коміт-граф \"%s\""
 
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "не вдалося відкрити ланцюжок коміт-графа \"%s\""
+
 #, c-format
 msgid "unrecognized --split argument, %s"
 msgstr "нерозпізнаний --split аргумент, %s"
@@ -4677,9 +4689,6 @@ msgstr "не вдалося оновити тимчасовий індекс"
 msgid "Failed to update main cache tree"
 msgstr "Не вдалося оновити головне дерево кешу"
 
-msgid "unable to write new_index file"
-msgstr "не вдалося записати new_index файл"
-
 msgid "cannot do a partial commit during a merge."
 msgstr "неможливо зробити частковий коміт під час злиття."
 
@@ -4982,7 +4991,6 @@ msgstr "повторно використати допис зі вказаног
 #. TRANSLATORS: Leave "[(amend|reword):]" as-is,
 #. and only translate <commit>.
 #.
-
 msgid "[(amend|reword):]commit"
 msgstr "[(amend|reword):]коміт"
 
@@ -5081,11 +5089,11 @@ msgstr "Переривання коміту через порожнє тіло 
 
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
 "сховище було оновлено, але не вдалося записати\n"
-"файл new_index. Переконайтеся, що диск не переповнений і квота\n"
+"новий файл індексу. Переконайтеся, що диск не переповнений і квота\n"
 "не перевищена, а потім виконайте \"git restore --staged :/\" для відновлення."
 
 msgid "git config [<options>]"
@@ -6194,13 +6202,11 @@ msgid "unknown"
 msgstr "невідомо"
 
 #. TRANSLATORS: e.g. error in tree 01bfda: <more explanation>
-
 #, c-format
 msgid "error in %s %s: %s"
 msgstr "помилка в %s %s: %s"
 
 #. TRANSLATORS: e.g. warning in tree 01bfda: <more explanation>
-
 #, c-format
 msgid "warning in %s %s: %s"
 msgstr "попередження в %s %s: %s"
@@ -6545,6 +6551,9 @@ msgstr "видалити об’єкти, на які немає посилан
 msgid "pack unreferenced objects separately"
 msgstr "пакувати об’єкти, на які немає посилань, окремо"
 
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "з --cruft, обмежити розмір нових марних пакунків"
+
 msgid "be more thorough (increased runtime)"
 msgstr "працювати ретельніше (збільшує час виконання)"
 
@@ -6723,12 +6732,6 @@ msgstr ""
 msgid "'crontab' died"
 msgstr "\"crontab\" завершився невдало"
 
-msgid "failed to start systemctl"
-msgstr "не вдалося стартувати systemctl"
-
-msgid "failed to run systemctl"
-msgstr "не вдалося запустити systemctl"
-
 #, c-format
 msgid "failed to delete '%s'"
 msgstr "не вдалося видалити \"%s\""
@@ -6737,6 +6740,12 @@ msgstr "не вдалося видалити \"%s\""
 msgid "failed to flush '%s'"
 msgstr "не вдалося очистити \"%s\""
 
+msgid "failed to start systemctl"
+msgstr "не вдалося стартувати systemctl"
+
+msgid "failed to run systemctl"
+msgstr "не вдалося запустити systemctl"
+
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
 msgstr "нерозпізнаний --scheduler аргумент \"%s\""
@@ -6760,6 +6769,9 @@ msgstr "планувальник"
 msgid "scheduler to trigger git maintenance run"
 msgstr "планувальник для запуску обслуговування git"
 
+msgid "failed to set up maintenance schedule"
+msgstr "не вдалося встановити розклад обслуговування"
+
 msgid "failed to add repo to global config"
 msgstr "не вдалося додати сховище до глобальної конфігурації"
 
@@ -6777,11 +6789,11 @@ msgstr "grep: не вдалося створити потік: %s"
 msgid "invalid number of threads specified (%d) for %s"
 msgstr "невірно вказана кількість потоків (%d) для %s"
 
+#. #-#-#-#-#  grep.c.po  #-#-#-#-#
 #. TRANSLATORS: %s is the configuration
 #. variable for tweaking threads, currently
 #. grep.threads
 #.
-
 #, c-format
 msgid "no threads support, ignoring %s"
 msgstr "немає підтримки потоків, ігнорування %s"
@@ -6790,6 +6802,10 @@ msgstr "немає підтримки потоків, ігнорування %s"
 msgid "unable to read tree (%s)"
 msgstr "не вдалося прочитати дерево (%s)"
 
+#, c-format
+msgid "unable to read tree %s"
+msgstr "не вдалося прочитати дерево %s"
+
 #, c-format
 msgid "unable to grep from object of type %s"
 msgstr "не вдалося виконати grep для об’єкта типу %s"
@@ -6834,8 +6850,8 @@ msgstr "обробляти бінарні файли за допомогою tex
 msgid "search in subdirectories (default)"
 msgstr "шукати в піддиректоріях (за замовчуванням)"
 
-msgid "descend at most <depth> levels"
-msgstr "Ñ\81пÑ\83Ñ\81каÑ\82иÑ\81Ñ\8f Ð½Ðµ Ð±Ñ\96лÑ\8cÑ\88е Ð½Ñ\96ж Ð½Ð° <глибина> рівнів"
+msgid "descend at most <n> levels"
+msgstr "Ñ\81пÑ\83Ñ\81каÑ\82иÑ\81Ñ\8f Ð½Ðµ Ð±Ñ\96лÑ\8cÑ\88е Ð½Ñ\96ж Ð½Ð° <н> рівнів"
 
 msgid "use extended POSIX regular expressions"
 msgstr "використовувати розширені POSIX регулярні вирази"
@@ -7202,10 +7218,6 @@ msgstr "серйозне неспівпадіння під час розпаку
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "ВИЯВЛЕНО SHA1 КОЛІЗІЮ З %s!"
 
-#, c-format
-msgid "unable to read %s"
-msgstr "не вдалося прочитати %s"
-
 #, c-format
 msgid "cannot read existing object info %s"
 msgstr "неможливо прочитати інформацію про існуючий об’єкт %s"
@@ -7350,11 +7362,13 @@ msgstr "помилка fsck в об’єктах пакунка"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<шаблон-директорія>]\n"
 "         [--separate-git-dir <git-директорія>] [--object-format=<формат>]\n"
+"         [--ref-format=<формат>]\n"
 "         [-b <назва-гілки> | --initial-branch=<назва-гілки>]\n"
 "         [--shared[=<дозволи>]] [<директорія>]"
 
@@ -7398,11 +7412,12 @@ msgstr "--separate-git-dir несумісна з порожнім сховище
 
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <токен>[(=|:)<значення>])...]\n"
+"                       [(--trailer <ключ>|"
+"<аліасКлюча>[(=|:)<значення>])...]\n"
 "                       [--parse] [<файл>...]"
 
 msgid "edit files in place"
@@ -7411,6 +7426,9 @@ msgstr "редагувати файли на місцях"
 msgid "trim empty trailers"
 msgstr "обрізати порожні причепи"
 
+msgid "placement"
+msgstr "розміщення"
+
 msgid "where to place the new trailer"
 msgstr "де розмістити новий причіп"
 
@@ -7423,17 +7441,17 @@ msgstr "що робити, якщо причіп відсутній"
 msgid "output only the trailers"
 msgstr "виводити лише причепи"
 
-msgid "do not apply config rules"
-msgstr "не Ð·Ð°Ñ\81Ñ\82оÑ\81овÑ\83ваÑ\82и Ð¿Ñ\80авила ÐºÐ¾Ð½Ñ\84Ñ\96гÑ\83Ñ\80аÑ\86Ñ\96Ñ\97"
+msgid "do not apply trailer.* configuration variables"
+msgstr "не Ð·Ð°Ñ\81Ñ\82оÑ\81овÑ\83ваÑ\82и ÐºÐ¾Ð½Ñ\84Ñ\96гÑ\83Ñ\80аÑ\86Ñ\96йнÑ\96 Ð·Ð¼Ñ\96ннÑ\96 trailer.*"
 
-msgid "join whitespace-continued values"
-msgstr "обâ\80\99Ñ\94днаÑ\82и Ð·Ð½Ð°Ñ\87еннÑ\8f, Ñ\89о Ð¿Ñ\80одовжÑ\83Ñ\8eÑ\82Ñ\8cÑ\81Ñ\8f Ñ\87еÑ\80ез Ð¿Ñ\80обÑ\96л"
+msgid "reformat multiline trailer values as single-line values"
+msgstr "пеÑ\80еÑ\84оÑ\80маÑ\82Ñ\83ваÑ\82и Ð±Ð°Ð³Ð°Ñ\82оÑ\80Ñ\8fдковÑ\96 Ð·Ð½Ð°Ñ\87еннÑ\8f Ð¿Ñ\80иÑ\87епÑ\96в Ð² Ð¾Ð´Ð½Ð¾Ñ\80Ñ\8fдковÑ\96"
 
-msgid "set parsing options"
-msgstr "вÑ\81Ñ\82ановиÑ\82и Ð¿Ð°Ñ\80амеÑ\82Ñ\80и Ñ\80озбоÑ\80Ñ\83"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "алÑ\96аÑ\81 Ð´Ð»Ñ\8f --only-trailers --only-input --unfold"
 
-msgid "do not treat --- specially"
-msgstr "не обробляти --- особливим чином"
+msgid "do not treat \"---\" as the end of input"
+msgstr "не обробляти \"---\" як кінець вводу"
 
 msgid "trailer(s) to add"
 msgstr "причіп(и) для додавання"
@@ -7522,6 +7540,10 @@ msgstr "потрібен лишень один діапазон"
 msgid "not a range"
 msgstr "не діапазон"
 
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "не вдалося прочитати файл опису гілки \"%s\""
+
 msgid "cover letter needs email format"
 msgstr "супровідний лист має бути у форматі електронної пошти"
 
@@ -7622,6 +7644,9 @@ msgstr "cover-from-description-mode"
 msgid "generate parts of a cover letter based on a branch's description"
 msgstr "скласти частини супровідного листа на основі опису гілки"
 
+msgid "use branch description from file"
+msgstr "використовувати опис гілки з файлу"
+
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "використати [<префікс>] замість [PATCH]"
 
@@ -7976,7 +8001,6 @@ msgid "--format can't be combined with other format-altering options"
 msgstr "--format не можна комбінувати з іншими опціями зміни формату"
 
 #. TRANSLATORS: keep <> in "<" mail ">" info.
-
 msgid "git mailinfo [<options>] <msg> <patch> < mail >info"
 msgstr "git mailinfo [<опції>] <допис> <латка> < mail >info"
 
@@ -8057,9 +8081,19 @@ msgstr ""
 "git merge-file [<опції>] [-L <назва1> [-L <оріг> [-L <назва2>]]] <файл1> "
 "<оріг-файл> <файл2>"
 
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"опція diff-algorithm приймає значення \"myers\", \"minimal\", \"patience\" "
+"та \"histogram\""
+
 msgid "send results to standard output"
 msgstr "надсилати результати до стандартного виводу"
 
+msgid "use object IDs instead of filenames"
+msgstr "використовувати ідентифікатори обʼєктів замість назв файлів"
+
 msgid "use a diff3 based merge"
 msgstr "використовувати злиття на основі diff3"
 
@@ -8075,6 +8109,12 @@ msgstr "у разі конфліктів використовувати їхню
 msgid "for conflicts, use a union version"
 msgstr "у разі конфліктів використовувати об’єднану версію"
 
+msgid "<algorithm>"
+msgstr "<алгоритм>"
+
+msgid "choose a diff algorithm"
+msgstr "вибрати алгоритм різниці"
+
 msgid "for conflicts, use this marker size"
 msgstr "у разі конфліктів використовувати цей розмір маркера"
 
@@ -8084,6 +8124,13 @@ msgstr "не попереджати про конфлікти"
 msgid "set labels for file1/orig-file/file2"
 msgstr "встановити мітки для файл1/оріг-файл/файл2"
 
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "об’єкт \"%s\" не існує"
+
+msgid "Could not write object file"
+msgstr "Не вдалося записати файл обʼєкта"
+
 #, c-format
 msgid "unknown option %s"
 msgstr "невідома опція %s"
@@ -8146,11 +8193,18 @@ msgstr "виконати кілька злиттів, по одному на к
 msgid "specify a merge-base for the merge"
 msgstr "вказати базу для злиття"
 
+msgid "option=value"
+msgstr "опція=значення"
+
+msgid "option for selected merge strategy"
+msgstr "опція для обраної стратегії злиття"
+
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge несумісна з усіма іншими опціями"
 
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base несумісна з --stdin"
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "невідомий варіант стратегії: -X%s"
 
 #, c-format
 msgid "malformed input line: '%s'."
@@ -8219,12 +8273,6 @@ msgstr "стратегія"
 msgid "merge strategy to use"
 msgstr "яку стратегію злиття використовувати"
 
-msgid "option=value"
-msgstr "опція=значення"
-
-msgid "option for selected merge strategy"
-msgstr "опція для обраної стратегії злиття"
-
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr "допис до коміту злиття (для злиття без перемотування вперед)"
 
@@ -8284,10 +8332,6 @@ msgstr "Не вдалося записати індекс."
 msgid "Not handling anything other than two heads merge."
 msgstr "Не оброблюється нічого, окрім злиття двох верхівок."
 
-#, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "невідомий варіант стратегії: -X%s"
-
 #, c-format
 msgid "unable to write %s"
 msgstr "не вдалося записати %s"
@@ -8584,8 +8628,8 @@ msgstr "призначення існує"
 msgid "can not move directory into itself"
 msgstr "неможливо перемістити директорію в саму себе"
 
-msgid "cannot move directory over file"
-msgstr "неможливо Ð¿ÐµÑ\80емÑ\96Ñ\81Ñ\82иÑ\82и Ð´Ð¸Ñ\80екÑ\82оÑ\80Ñ\96Ñ\8e Ð¿Ð¾Ð²ÐµÑ\80Ñ\85 Ñ\84айлÑ\83"
+msgid "destination already exists"
+msgstr "пÑ\80изнаÑ\87еннÑ\8f Ð²Ð¶Ðµ Ñ\96Ñ\81нÑ\83Ñ\94"
 
 msgid "source directory is empty"
 msgstr "директорія джерела порожня"
@@ -8789,7 +8833,6 @@ msgstr "не вдалося скопіювати нотатки з \"%s\" в \"%
 #. TRANSLATORS: the first %s will be replaced by a git
 #. notes command: 'add', 'merge', 'remove', etc.
 #.
-
 #, c-format
 msgid "refusing to %s notes in %s (outside of refs/notes/)"
 msgstr "відмовлено в %s нотаток у %s (за межами refs/notes/)"
@@ -9095,6 +9138,10 @@ msgstr "Компресія обʼєктів"
 msgid "inconsistency with delta count"
 msgstr "неспівпадіння з підрахунком дельти"
 
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "неприпустиме значення pack.allowPackReuse: \"%s\""
+
 #, c-format
 msgid ""
 "value of uploadpack.blobpackfileuri must be of the form '<object-hash> <pack-"
@@ -9333,9 +9380,6 @@ msgstr "мінімальний розмір пакунка - 1 МіБ"
 msgid "--thin cannot be used to build an indexable pack"
 msgstr "--thin не можна використовувати для створення індексованого пакунка"
 
-msgid "cannot use --filter without --stdout"
-msgstr "неможливо використовувати --filter без --stdout"
-
 msgid "cannot use --filter with --stdin-packs"
 msgstr "неможливо використовувати --filter з --stdin-packs"
 
@@ -9348,19 +9392,16 @@ msgstr "неможливо використовувати внутрішній 
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "неможливо використовувати --stdin-packs з --cruft"
 
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "неможливо використовувати --max-pack-size з --cruft"
-
 msgid "Enumerating objects"
 msgstr "Перерахування обʼєктів"
 
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "Всього %<PRIu32> (дельта %<PRIu32>), повторно використано %<PRIu32> (дельта "
-"%<PRIu32>), повторно використано пакунків %<PRIu32>"
+"%<PRIu32>), повторно використано пакунків %<PRIu32> (з %<PRIuMAX>)"
 
 msgid ""
 "'git pack-redundant' is nominated for removal.\n"
@@ -10349,16 +10390,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "перемикач \"C\" очікує числове значення"
 
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy потребує --merge або --interactive"
-
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr ""
-"apply опції несумісні з rebase.autoSquash.  Розгляньте можливість додавання "
-"--no-autosquash"
-
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
 "no-rebase-merges"
@@ -10879,7 +10910,6 @@ msgstr "(без URL-адреси)"
 #. with the one in " Fetch URL: %s"
 #. translation.
 #.
-
 #, c-format
 msgid "  Push  URL: %s"
 msgstr "  URL-адреса надсилання: %s"
@@ -11071,6 +11101,10 @@ msgstr "не вдалося закрити тимчасовий файл зні
 msgid "could not remove stale bitmap: %s"
 msgstr "не вдалося видалити застарілий bitmap: %s"
 
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "префікс пакунку %s не починається з objdir %s"
+
 msgid "pack everything in a single pack"
 msgstr "запакувати все в один пакунок"
 
@@ -11145,18 +11179,21 @@ msgid "write a multi-pack index of the resulting packs"
 msgstr "записати multi-pack-index результуючих пакунків"
 
 msgid "pack prefix to store a pack containing pruned objects"
-msgstr "префікс пакунка для зберігання пакунка з обрізаними обʼєктами"
+msgstr "префікс для зберігання пакунка з обрізаними обʼєктами"
+
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "префікс для зберігання пакунка з відфільтрованими  обʼєктами"
 
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "неможливо видалити пакунки в precious-objects сховищі"
 
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "опція \"%s\" може бути використана тільки разом з \"%s\""
+
 msgid "Nothing new to pack."
 msgstr "Немає нічого нового для пакування."
 
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "префікс пакунку %s не починається з objdir %s"
-
 #, c-format
 msgid "renaming pack to '%s' failed"
 msgstr "перейменування пакунка на \"%s\" завершилося невдало"
@@ -11357,6 +11394,75 @@ msgstr "--convert-graft-file не потребує аргументів"
 msgid "only one pattern can be given with -l"
 msgstr "тільки один шаблон може бути заданий з -l"
 
+msgid "need some commits to replay"
+msgstr "потрібні деякі комміти для відтворення"
+
+msgid "--onto and --advance are incompatible"
+msgstr "--onto та --advance несумісні"
+
+msgid "all positive revisions given must be references"
+msgstr "всі надані позитивні ревізії мають бути посиланнями"
+
+msgid "argument to --advance must be a reference"
+msgstr "аргумент до --advance має бути посиланням"
+
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr ""
+"неможливо просунути посилання з декількома джерелами, тому що впорядкування "
+"буде нечітко визначеним"
+
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr "неможливо неявно визначити, чи це операція --advance або --onto"
+
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr ""
+"неможливо просунути посилання з декількома джерельними гілками, тому що "
+"впорядкування буде нечітко визначеним"
+
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "неможливо неявно визначити вірну базу для --onto"
+
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(ЕКСПЕРИМЕНТАЛЬНО!) git replay ([--contained] --onto <нова-база> | --advance "
+"<гілка>) <діапазон-ревізій>..."
+
+msgid "make replay advance given branch"
+msgstr "зробити відтворення з просуванням даної гілки"
+
+msgid "replay onto given commit"
+msgstr "відтворити на заданий коміт"
+
+msgid "advance all branches contained in revision-range"
+msgstr "просунути всі гілки, що містяться в діапазоні ревізій"
+
+msgid "option --onto or --advance is mandatory"
+msgstr "опція --onto або --advance є обовʼязковою"
+
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr ""
+"деякі опції проходження по ревізіям будуть перевизначені, оскільки біт "
+"\"%s\" у \"struct rev_info\" буде примусово використано"
+
+msgid "error preparing revisions"
+msgstr "помилка при підготовці ревізій"
+
+msgid "replaying down to root commit is not supported yet!"
+msgstr "відтворення до кореневого коміту поки що не підтримується!"
+
+msgid "replaying merge commits is not supported yet!"
+msgstr "відтворення коммітів злиття поки що не підтримується!"
+
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
 msgstr ""
@@ -11569,18 +11675,12 @@ msgstr "--prefix потребує аргументу"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "невідомий режим для --abbrev-ref: %s"
 
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden не можна використовувати разом з --branches"
-
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden неможливо використовувати разом з --tags"
-
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden неможливо використовувати разом з --remotes"
-
 msgid "this operation must be run in a work tree"
 msgstr "цю операцію треба виконувати в робочому дереві"
 
+msgid "Could not read the index"
+msgstr "Не вдалося прочитати індекс"
+
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
 msgstr "невідомий режим для --show-object-format: %s"
@@ -11932,24 +12032,44 @@ msgid "Unknown hash algorithm"
 msgstr "Невідомий хеш-алгоритм"
 
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-d | --"
-"dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<н>]] [--abbrev[=<н>]] [--tags]\n"
 "             [--heads] [--] [<шаблон>...]"
 
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<н>]] [--abbrev[=<н>]]\n"
+"             [--] [<посилання>...]"
+
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<шаблон>]"
 
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <посилання>"
+
+msgid "reference does not exist"
+msgstr "посилання не існує"
+
+msgid "failed to look up reference"
+msgstr "не вдалося знайти посилання"
+
 msgid "only show tags (can be combined with heads)"
 msgstr "показати тільки теги (можна комбінувати з верхівками)"
 
 msgid "only show heads (can be combined with tags)"
 msgstr "показати тільки верхівки (можна комбінувати з тегами)"
 
+msgid "check for reference existence without resolving"
+msgstr "перевіряти наявність посилання без розвʼязання"
+
 msgid "stricter reference checking, requires exact ref path"
 msgstr "більш сувора перевірка посилань, потребує точного шляху до посилання"
 
@@ -12778,6 +12898,9 @@ msgstr ""
 "[no-]recommend-shallow] [--reference <сховище>] [--recursive] [--[no-]single-"
 "branch] [--] [<шлях>...]"
 
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "Не вдалося розвʼязати HEAD в дійсне посилання."
+
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<опції>] [<шлях>...]"
 
@@ -13248,8 +13371,11 @@ msgstr "(для високорівневих команд) забути збер
 msgid "write index in this format"
 msgstr "записати індекс у цьому форматі"
 
+msgid "report on-disk index format version"
+msgstr "звітувати про версію формату індексу на диску"
+
 msgid "enable or disable split index"
-msgstr "увімкнути або вимкнути розщеплений індекс"
+msgstr "увімкнути або вимкнути розділений індекс"
 
 msgid "enable/disable untracked cache"
 msgstr "увімкнути/вимкнути невідстежуваний кеш"
@@ -13272,19 +13398,27 @@ msgstr "позначити файли придатними для fsmonitor"
 msgid "clear fsmonitor valid bit"
 msgstr "очистити біт придатності для fsmonitor"
 
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "версія індексу: була %d, стала %d"
+
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
 "enable split index"
 msgstr ""
 "core.splitIndex встановлено в false; видаліть або змініть його, якщо ви "
-"дійсно хочете увімкнути розщеплений індекс"
+"дійсно хочете увімкнути розділений індекс"
 
 msgid ""
 "core.splitIndex is set to true; remove or change it, if you really want to "
 "disable split index"
 msgstr ""
 "core.splitIndex встановлено в true; видаліть або змініть його, якщо ви "
-"дійсно хочете вимкнути розщеплений індекс"
+"дійсно хочете вимкнути розділений індекс"
 
 msgid ""
 "core.untrackedCache is set to true; remove or change it, if you really want "
@@ -13427,13 +13561,13 @@ msgstr "Немає можливої джерельної гілки, що озн
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
-"Якщо ви хочете створити робоче дерево, що містить нову сирітську гілку\n"
+"Якщо ви хочете створити робоче дерево, що містить нову ненароджену гілку\n"
 "(гілку без комітів) для цього сховища, ви можете зробити це\n"
 "за допомогою прапорця --orphan:\n"
 "\n"
@@ -13441,13 +13575,13 @@ msgstr ""
 
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
-"Якщо ви хочете створити робоче дерево, що містить нову сирітську гілку\n"
+"Якщо ви хочете створити робоче дерево, що містить нову ненароджену гілку\n"
 "(гілку без комітів) для цього сховища, ви можете зробити це\n"
 "за допомогою прапорця --orphan:\n"
 "\n"
@@ -13510,6 +13644,10 @@ msgstr "не вдалося створити директорію \"%s\""
 msgid "initializing"
 msgstr "ініціалізація"
 
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "не вдалося знайти створене робоче дерево \"%s\""
+
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
 msgstr "Підготовка робочого дерева (нова гілка \"%s\")"
@@ -13542,16 +13680,12 @@ msgstr ""
 
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
 "Не існує локальних або віддалених посилань, незважаючи на наявність "
 "принаймні одного віддаленого\n"
-"призначення, зупинка; скористайтесь \"add -f\", щоб перевизначити або "
-"спочатку отримати віддалене посилання"
-
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "\"%s\" і \"%s\" не можна використовувати разом"
+"призначення, зупинка; скористайтесь \"add -f\", щоб перевизначити, або "
+"спочатку виконайте отримання з віддаленного сховища"
 
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr ""
@@ -13563,8 +13697,8 @@ msgstr "створити нову гілку"
 msgid "create or reset a branch"
 msgstr "створити або скинути гілку"
 
-msgid "create unborn/orphaned branch"
-msgstr "створити ненароджену/сирітську гілку"
+msgid "create unborn branch"
+msgstr "створити ненароджену гілку"
 
 msgid "populate the new working tree"
 msgstr "заповнити нове робоче дерево"
@@ -13587,11 +13721,8 @@ msgid "options '%s', '%s', and '%s' cannot be used together"
 msgstr "опції \"%s\", \"%s\" та \"%s\" не можна використовувати разом"
 
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "опції \"%s\" і \"%s\" не можна використовувати разом"
-
-msgid "<commit-ish>"
-msgstr "<комітоподібне>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "опцію \"%s\" не можна використовувати разом з комітоподібними"
 
 msgid "added with --lock"
 msgstr "додано з --lock"
@@ -13869,6 +14000,10 @@ msgstr "index-pack завершився невдало"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "ідентифікатор завершення фрагмента зʼявився раніше, ніж очікувалось"
 
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "шматок id %<PRIx32> не є %d-byte впорядкованим"
+
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
 msgstr "невірне зміщення шматка(ів) %<PRIx64> та %<PRIx64>"
@@ -13921,8 +14056,8 @@ msgstr "Зібрати інформацію, щоб користувач міг
 msgid "Move objects and refs by archive"
 msgstr "Перенести архів обʼєктів та посилань"
 
-msgid "Provide content or type and size information for repository objects"
-msgstr "Ð\9fоказаÑ\82и Ð²Ð¼Ñ\96Ñ\81Ñ\82 Ð°Ð±Ð¾ Ñ\96нÑ\84оÑ\80маÑ\86Ñ\96Ñ\8e Ð¿Ñ\80о Ñ\82ип Ñ\96 Ñ\80озмÑ\96Ñ\80 обʼєктів сховища"
+msgid "Provide contents or details of repository objects"
+msgstr "Ð\9dадаваÑ\82и Ð²Ð¼Ñ\96Ñ\81Ñ\82 Ð°Ð±Ð¾ Ð´ÐµÑ\82алÑ\96 обʼєктів сховища"
 
 msgid "Display gitattributes information"
 msgstr "Відобразити інформацію про gitattributes"
@@ -14210,6 +14345,11 @@ msgstr "Запакувати розпаковані обʼєкти у схови
 msgid "Create, list, delete refs to replace objects"
 msgstr "Створити, показати, видалити посилання для об’єктів заміни"
 
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr ""
+"ЕКСПЕРИМЕНТАЛЬНО: Відтворення коммітів на новій базі також працює з "
+"порожніми сховищами"
+
 msgid "Generates a summary of pending changes"
 msgstr "Створює підсумок змін для розгляду"
 
@@ -14331,8 +14471,8 @@ msgstr "Перевірити GPG-підпис тегів"
 msgid "Display version information about Git"
 msgstr "Показати інформацію про версію Git"
 
-msgid "Show logs with difference each commit introduces"
-msgstr "Показати журнал з різницею, яку вносить кожен коміт"
+msgid "Show logs with differences each commit introduces"
+msgstr "Показати журнал з різницями, які вносить кожен коміт"
 
 msgid "Manage multiple working trees"
 msgstr "Керувати кількома робочими деревами"
@@ -14448,6 +14588,32 @@ msgstr "Інструмент для керування великими схов
 msgid "commit-graph file is too small"
 msgstr "файл коміт-графа занадто малий"
 
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "шматок oid fanout коміт-графа має невірний розмір"
+
+msgid "commit-graph fanout values out of order"
+msgstr "значення fanout коміт-графа впорядковані невірно"
+
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "шматок OID lookup коміт-графа має невірний розмір"
+
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "шматок commit data коміт-графа має невірний розмір"
+
+msgid "commit-graph generations chunk is wrong size"
+msgstr "шматок generations коміт-графа має невірний розмір"
+
+msgid "commit-graph changed-path index chunk is too small"
+msgstr "шматок changed-path index коміт-графа має невірний розмір"
+
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr ""
+"ігнорування занадто малого шматка changed-path (%<PRIuMAX> < %<PRIuMAX>) "
+"файла коміт-графа"
+
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
 msgstr "підпис коміт-графа %X не збігається з підписом %X"
@@ -14464,9 +14630,21 @@ msgstr "хеш версія коміт-графа %X не збігається 
 msgid "commit-graph file is too small to hold %u chunks"
 msgstr "файл коміт-графа занадто малий, щоб вмістити %u шматків"
 
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr "необхідний шматок OID fanout коміт-графа відсутній або пошкоджений"
+
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr "необхідний шматок OID lookup коміт-графа відсутній або пошкоджений"
+
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr "необхідний шматок commit data коміт-графа відсутній або пошкоджений"
+
 msgid "commit-graph has no base graphs chunk"
 msgstr "коміт-граф не має шматка базових графів"
 
+msgid "commit-graph base graphs chunk is too small"
+msgstr "шматок base graphs коміт-графа занадто малий"
+
 msgid "commit-graph chain does not match"
 msgstr "ланцюжок коміт-графа не співпадає"
 
@@ -14474,6 +14652,9 @@ msgstr "ланцюжок коміт-графа не співпадає"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "кількість комітів у базовому графі занадто велика: %<PRIuMAX>"
 
+msgid "commit-graph chain file too small"
+msgstr "файл ланцюжка коміт-графа занадто малий"
+
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
 msgstr "неприпустимий ланцюжок коміт-графа: рядок \"%s\" не є хешем"
@@ -14489,7 +14670,13 @@ msgid "could not find commit %s"
 msgstr "не вдалося знайти коміт %s"
 
 msgid "commit-graph requires overflow generation data but has none"
-msgstr "коміт-граф потребує даних генерації переповнення, але їх немаєданих"
+msgstr "коміт-граф потребує даних генерації переповнення, але не має їх"
+
+msgid "commit-graph overflow generation data is too small"
+msgstr "занадто мало даних генерації переповнення коміт-графа"
+
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "extra-edges pointer коміт-графа виходить за межі"
 
 msgid "Loading known commits in commit graph"
 msgstr "Завантаження відомих комітів у коміт-графі"
@@ -14614,18 +14801,6 @@ msgstr "батько для %s коміт-графа є %s != %s"
 msgid "commit-graph parent list for commit %s terminates early"
 msgstr "список батьків коміт-графа для коміту %s завершився передчасно"
 
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr ""
-"коміт-граф має нульовий номер генерації для коміту %s, але ненульовий деінде"
-
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr ""
-"коміт-граф має ненульовий номер генерації для коміту %s, але нульовий деінде"
-
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
 msgstr "генерація коміт-графа для коміту %s є %<PRIuMAX> < %<PRIuMAX>"
@@ -14634,6 +14809,14 @@ msgstr "генерація коміт-графа для коміту %s є %<PRI
 msgid "commit date for commit %s in commit-graph is %<PRIuMAX> != %<PRIuMAX>"
 msgstr "дата коміту для коміту %s у коміт-графі є %<PRIuMAX> != %<PRIuMAX>"
 
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr ""
+"коміт-граф має як нульові, так і ненульові генерації (наприклад, коміти "
+"\"%s\" і \"%s\")"
+
 msgid "Verifying commits in commit graph"
 msgstr "Перевірка комітів у коміт-графі"
 
@@ -14660,6 +14843,10 @@ msgstr ""
 "Щоб вимкнути це повідомлення, виконайте\n"
 "\"git config advice.graftFileDeprecated false\""
 
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr "коміт %s існує в коміт-графі, але не в базі даних обʼєктів"
+
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
 msgstr "Коміт %s має недостовірний GPG-підпис, нібито від %s."
@@ -15101,10 +15288,6 @@ msgstr "посилання \"%s\" не вказує на blob"
 msgid "unable to resolve config blob '%s'"
 msgstr "не вдалося розпізнати config blob \"%s\""
 
-#, c-format
-msgid "failed to parse %s"
-msgstr "не вдалося розібрати %s"
-
 msgid "unable to parse command-line config"
 msgstr "не вдалося розібрати конфігурацію командного рядка"
 
@@ -15268,7 +15451,6 @@ msgid "unable to look up %s (port %s) (%s)"
 msgstr "не вдалося знайти %s (порт %s) (%s)"
 
 #. TRANSLATORS: this is the end of "Looking up %s ... "
-
 #, c-format
 msgid ""
 "done.\n"
@@ -15286,7 +15468,6 @@ msgstr ""
 "%s"
 
 #. TRANSLATORS: this is the end of "Connecting to %s (port %s) ... "
-
 msgid "done."
 msgstr "готово."
 
@@ -15522,7 +15703,6 @@ msgstr[1] "%<PRIuMAX> роки"
 msgstr[2] "%<PRIuMAX> років"
 
 #. TRANSLATORS: "%s" is "<n> years"
-
 #, c-format
 msgid "%s, %<PRIuMAX> month ago"
 msgid_plural "%s, %<PRIuMAX> months ago"
@@ -15585,9 +15765,6 @@ msgstr "не вдалося записати архів"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base не працює з діапазонами"
 
-msgid "--merge-base only works with commits"
-msgstr "--merge-base працює лише з комітами"
-
 msgid "unable to get HEAD"
 msgstr "не вдалося отримати HEAD"
 
@@ -15648,6 +15825,10 @@ msgstr ""
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr "Невідоме значення конфігураційної змінної \"diff.submodule\": \"%s\""
 
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "невідоме значення для конфігурації \"%s\": %s"
+
 #, c-format
 msgid ""
 "Found errors in 'diff.dirstat' config variable:\n"
@@ -15728,13 +15909,6 @@ msgstr "невірний --color-moved аргумент: %s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "неприпустимий режим \"%s\" у --color-moved-ws"
 
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"опція diff-algorithm приймає значення \"myers\", \"minimal\", \"patience\" "
-"та \"histogram\""
-
 #, c-format
 msgid "invalid argument to %s"
 msgstr "неприпустимий аргумент до %s"
@@ -15778,8 +15952,8 @@ msgstr "машинний вивід --stat"
 msgid "output only the last line of --stat"
 msgstr "вивести лише останній рядок --stat"
 
-msgid "<param1,param2>..."
-msgstr "<параметр1,параметр2>..."
+msgid "<param1>,<param2>..."
+msgstr "<параметр1>,<параметр2>..."
 
 msgid ""
 "output the distribution of relative amount of changes for each sub-directory"
@@ -15788,8 +15962,8 @@ msgstr "вивести розподіл відносної кількості з
 msgid "synonym for --dirstat=cumulative"
 msgstr "синонім для --dirstat=cumulative"
 
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "синонім для --dirstat=files,параметр1,параметр2..."
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "синонім для --dirstat=files,<параметр1>,<параметр2>..."
 
 msgid "warn if changes introduce conflict markers or whitespace errors"
 msgstr ""
@@ -15965,12 +16139,6 @@ msgstr "згенерувати різницю за алгоритмом \"patien
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "згенерувати різницю за алгоритмом \"histogram diff\""
 
-msgid "<algorithm>"
-msgstr "<алгоритм>"
-
-msgid "choose a diff algorithm"
-msgstr "вибрати алгоритм різниці"
-
 msgid "<text>"
 msgstr "<текст>"
 
@@ -16351,7 +16519,6 @@ msgstr "помилка при обробці підтверджень: %d"
 #. TRANSLATORS: The parameter will be 'ready', a protocol
 #. keyword.
 #.
-
 #, c-format
 msgid "expected packfile to be sent after '%s'"
 msgstr "очікувалось надсилання файла пакунка після \"%s\""
@@ -16359,7 +16526,6 @@ msgstr "очікувалось надсилання файла пакунка п
 #. TRANSLATORS: The parameter will be 'ready', a protocol
 #. keyword.
 #.
-
 #, c-format
 msgid "expected no other sections to be sent after no '%s'"
 msgstr "не очікувалось надсилання жодної секції для статусу не \"%s\""
@@ -17014,12 +17180,12 @@ msgstr ""
 "Не вдалося злити підмодуль %s, але існує кілька можливих варіантів злиття:\n"
 "%s"
 
-msgid "Failed to execute internal merge"
-msgstr "Ð\9dе вдалося виконати внутрішнє злиття"
+msgid "failed to execute internal merge"
+msgstr "не вдалося виконати внутрішнє злиття"
 
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "Ð\9dе вдалося додати %s до бази даних"
+msgid "unable to add %s to database"
+msgstr "не вдалося додати %s до бази даних"
 
 #, c-format
 msgid "Auto-merging %s"
@@ -17172,9 +17338,8 @@ msgstr ""
 #. conflict in a submodule. The first argument is the submodule
 #. name, and the second argument is the abbreviated id of the
 #. commit that needs to be merged.  For example:
-#. - go to submodule (mysubmodule), and either merge commit abc1234"
+#.  - go to submodule (mysubmodule), and either merge commit abc1234"
 #.
-
 #, c-format
 msgid ""
 " - go to submodule (%s), and either merge commit %s\n"
@@ -17210,7 +17375,6 @@ msgstr ""
 #. TRANSLATORS: The %s arguments are: 1) tree hash of a merge
 #. base, and 2-3) the trees for the two trees we're merging.
 #.
-
 #, c-format
 msgid "collecting merge info failed for trees %s, %s, %s"
 msgstr "збирання інформації про злиття не вдалося для дерев %s, %s, %s"
@@ -17461,7 +17625,20 @@ msgid "failed to read the cache"
 msgstr "не вдалося прочитати кеш"
 
 msgid "multi-pack-index OID fanout is of the wrong size"
-msgstr "multi-pack-index OID fanout має невірний розмір"
+msgstr "multi-pack-index OID розсіювання має невірний розмір"
+
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr ""
+"невірна послідовність oid fanout: fanout[%d] = %<PRIx32> > %<PRIx32> = "
+"fanout[%d]"
+
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "multi-pack-index OID lookup шматок має невірний розмір"
+
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr "multi-pack-index object offset шматок має невірний розмір"
 
 #, c-format
 msgid "multi-pack-index file %s is too small"
@@ -17479,17 +17656,23 @@ msgstr "multi-pack-index версія %d не розпізнана"
 msgid "multi-pack-index hash version %u does not match version %u"
 msgstr "версія хешу multi-pack-index %u не збігається з версією %u"
 
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "multi-pack-index недостає необхідного фрагмента імені пакунка"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr "необхідний шматок pack-name multi-pack-index відсутній або пошкоджений"
 
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "multi-pack-index недостає необхідного OID fanout фрагмента"
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr ""
+"необхідний шматок OID fanout multi-pack-index відсутній або пошкоджений"
 
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "multi-pack-index недостає необхідного OID lookup фрагмента"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr ""
+"необхідний шматок OID lookup multi-pack-index відсутній або пошкоджений"
+
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr ""
+"необхідний шматок object offsets multi-pack-index відсутній або пошкоджений"
 
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "multi-pack-index недостає необхідного фрагмента зміщення обʼєктів"
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "шматок pack-name multi-pack-index занадто малий"
 
 #, c-format
 msgid "multi-pack-index pack names out of order: '%s' before '%s'"
@@ -17501,10 +17684,20 @@ msgstr ""
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "невірний pack-int-id: %u (%u всього пакунків)"
 
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "MIDX не містить шматок BTMP"
+
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "не вдалося завантажити бітмаповий пакунок %<PRIu32>"
+
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr ""
 "multi-pack-index зберігає 64-бітне зміщення, але значення off_t занадто мале"
 
+msgid "multi-pack-index large offset out of bounds"
+msgstr "large offset multi-pack-index виходить за межі"
+
 #, c-format
 msgid "failed to add packfile '%s'"
 msgstr "не вдалося додати packfile \"%s\""
@@ -17583,13 +17776,6 @@ msgstr "невірна контрольна сума"
 msgid "Looking for referenced packfiles"
 msgstr "Пошук файлів пакунків, на які є посилання"
 
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr ""
-"невірна послідовность oid fanout: fanout[%d] = %<PRIx32> > %<PRIx32> = "
-"fanout[%d]"
-
 msgid "the midx contains no oid"
 msgstr "midx не містить oid"
 
@@ -17672,7 +17858,6 @@ msgstr "Відмовлено в перезаписі нотаток у %s (за
 #. the environment variable, the second %s is
 #. its value.
 #.
-
 #, c-format
 msgid "Bad %s value: '%s'"
 msgstr "Невірне %s значення: \"%s\""
@@ -17887,7 +18072,6 @@ msgstr "не вдалося розпакувати вміст %s"
 #. output shown when we cannot look up or parse the
 #. object in question. E.g. "deadbeef [bad object]".
 #.
-
 #, c-format
 msgid "%s [bad object]"
 msgstr "%s [невірний обʼект]"
@@ -17895,9 +18079,8 @@ msgstr "%s [невірний обʼект]"
 #. TRANSLATORS: This is a line of ambiguous commit
 #. object output. E.g.:
 #. *
-#. "deadbeef commit 2021-01-01 - Some Commit Message"
+#.    "deadbeef commit 2021-01-01 - Some Commit Message"
 #.
-
 #, c-format
 msgid "%s commit %s - %s"
 msgstr "%s коміт %s - %s"
@@ -17905,7 +18088,7 @@ msgstr "%s коміт %s - %s"
 #. TRANSLATORS: This is a line of ambiguous
 #. tag object output. E.g.:
 #. *
-#. "deadbeef tag 2022-01-01 - Some Tag Message"
+#.    "deadbeef tag 2022-01-01 - Some Tag Message"
 #. *
 #. The second argument is the YYYY-MM-DD found
 #. in the tag.
@@ -17913,7 +18096,6 @@ msgstr "%s коміт %s - %s"
 #. The third argument is the "tag" string
 #. from object.c.
 #.
-
 #, c-format
 msgid "%s tag %s - %s"
 msgstr "%s тег %s - %s"
@@ -17922,9 +18104,8 @@ msgstr "%s тег %s - %s"
 #. tag object output where we couldn't parse
 #. the tag itself. E.g.:
 #. *
-#. "deadbeef [bad tag, could not parse it]"
+#.    "deadbeef [bad tag, could not parse it]"
 #.
-
 #, c-format
 msgid "%s [bad tag, could not parse it]"
 msgstr "%s [невірний тег, не вдалося розібрати]"
@@ -17932,7 +18113,6 @@ msgstr "%s [невірний тег, не вдалося розібрати]"
 #. TRANSLATORS: This is a line of ambiguous <type>
 #. object output. E.g. "deadbeef tree".
 #.
-
 #, c-format
 msgid "%s tree"
 msgstr "%s дерево"
@@ -17940,7 +18120,6 @@ msgstr "%s дерево"
 #. TRANSLATORS: This is a line of ambiguous <type>
 #. object output. E.g. "deadbeef blob".
 #.
-
 #, c-format
 msgid "%s blob"
 msgstr "%s blob"
@@ -17953,7 +18132,6 @@ msgstr "короткий ідентифікатор обʼєкта %s неодн
 #. objects composed in show_ambiguous_object(). See
 #. its "TRANSLATORS" comments for details.
 #.
-
 #, c-format
 msgid ""
 "The candidates are:\n"
@@ -18122,6 +18300,9 @@ msgstr "у мультіпакунковому bitmap відсутній необ
 msgid "could not open pack %s"
 msgstr "не вдалося відкрити пакунок %s"
 
+msgid "could not determine MIDX preferred pack"
+msgstr "не вдалося визначити бажаний пакунок MIDX"
+
 #, c-format
 msgid "preferred pack (%s) is invalid"
 msgstr "бажаний пакунок (%s) є неприпустимим"
@@ -18142,6 +18323,12 @@ msgstr ""
 msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
 msgstr "пошкоджений ewah bitmap: урізаний заголовок для bitmap коміту \"%s\""
 
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr ""
+"не вдалося завантажити пакунок: \"%s\", вимкнення повторного використання "
+"пакунків"
+
 #, c-format
 msgid "object '%s' not found in type bitmaps"
 msgstr "обʼєкт \"%s\" не знайдено в типах bitmap"
@@ -18233,6 +18420,12 @@ msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr ""
 "невірна позиція зворортного індексу у %<PRIu64>: %<PRIu32> != %<PRIu32>"
 
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr "multi-pack-index reverse-index шматок має невірний розмір"
+
+msgid "could not determine preferred pack"
+msgstr "не вдалося визначити бажаний пакунок"
+
 msgid "cannot both write and verify reverse index"
 msgstr "неможливо одночасно записувати та звіряти зворотний індекс"
 
@@ -18283,14 +18476,6 @@ msgstr "опція \"%s\" очікує \"%s\" або \"%s\""
 msgid "%s requires a value"
 msgstr "%s потребує значення"
 
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s несумісний з %s"
-
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s : несумісний з чимось іншим"
-
 #, c-format
 msgid "%s takes no value"
 msgstr "%s не приймає значення"
@@ -18340,7 +18525,6 @@ msgstr "використання: %s"
 #. TRANSLATORS: the colon here should align with the
 #. one in "usage: %s" translation.
 #.
-
 #, c-format
 msgid "   or: %s"
 msgstr "         або: %s"
@@ -18364,7 +18548,6 @@ msgstr "         або: %s"
 #. translated) N_() usage string, which contained embedded
 #. newlines before we split it up.
 #.
-
 #, c-format
 msgid "%*s%s"
 msgstr "%*s%s"
@@ -18376,6 +18559,10 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-NUM"
 
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "протилежне --no-%s"
+
 msgid "expiry-date"
 msgstr "закінчення строку дії"
 
@@ -18406,6 +18593,14 @@ msgstr ""
 "за допомогою --pathspec-from-file елементи визначника шляху відокремлюються "
 "символом NUL"
 
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "невірне булеве значення оточення \"%s\" для \"%s\""
+
+#, c-format
+msgid "failed to parse %s"
+msgstr "не вдалося розібрати %s"
+
 #, c-format
 msgid "Could not make %s writable by group"
 msgstr "Не вдалося зробити %s доступним для запису групою"
@@ -18456,6 +18651,10 @@ msgstr "Нереалізоване магічне значення \"%c\" для
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s: \"literal\" та \"glob\" несумісні"
 
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "\"%s\" знаходиться поза деревом директорій"
+
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
 msgstr "%s: \"%s\" знаходиться за межами сховища за адресою \"%s\""
@@ -18610,10 +18809,6 @@ msgstr "не вдалося проіндексувати файл \"%s\""
 msgid "unable to add '%s' to index"
 msgstr "не вдалося додати \"%s\" до індексу"
 
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "не вдалося виконати stat для \"%s\""
-
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
 msgstr "\"%s\" відображається як файл і як каталог"
@@ -18716,15 +18911,11 @@ msgid "broken index, expect %s in %s, got %s"
 msgstr "пошкоджений індекс, очікувався %s у %s, отримано %s"
 
 msgid "cannot write split index for a sparse index"
-msgstr "неможливо записати розщеплений індекс для розрідженого індексу"
+msgstr "неможливо записати розділений індекс для розрідженого індексу"
 
 msgid "failed to convert to a sparse-index"
 msgstr "не вдалося перетворити в sparse-index"
 
-#, c-format
-msgid "could not stat '%s'"
-msgstr "не вдалося виконати stat '%s'"
-
 #, c-format
 msgid "unable to open git dir: %s"
 msgstr "не вдалося відкрити git-директорію: %s"
@@ -18964,7 +19155,7 @@ msgstr "очікувалось значення %s="
 
 #, c-format
 msgid "positive value expected '%s' in %%(%s)"
-msgstr "очікувалось додатне значення \"%s\" у %%(%s)"
+msgstr "очікувалось додатне значення \"%s\" в %%(%s)"
 
 #, c-format
 msgid "expected format: %%(align:<width>,<position>)"
@@ -19191,10 +19382,6 @@ msgstr "\"%s\" існує; неможливо створити \"%s\""
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "неможливо обробити \"%s\" і \"%s\" одночасно"
 
-#, c-format
-msgid "could not remove reference %s"
-msgstr "не вдалося видалити посилання %s"
-
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "не вдалося видалити посилання %s: %s"
@@ -19376,7 +19563,6 @@ msgstr "визначник посилання джерела %s збігаєть
 #. <remote> <src>:<dst>" push, and "being pushed ('%s')" is
 #. the <src>.
 #.
-
 #, c-format
 msgid ""
 "The destination you provided is not a full refname (i.e.,\n"
@@ -19682,7 +19868,7 @@ msgstr "--unpacked=<файл пакунка> більше не підтриму
 
 #, c-format
 msgid "invalid option '%s' in --stdin mode"
-msgstr "неприпустима опція \"%s\" у режимі --stdin"
+msgstr "неприпустима опція \"%s\" у --stdin режимі"
 
 msgid "your current branch appears to be broken"
 msgstr "ваша поточна гілка виглядає пошкодженою"
@@ -19771,8 +19957,15 @@ msgid "only download metadata for the branch that will be checked out"
 msgstr ""
 "завантажити метадані тільки для гілки, на яку буде здійснюватися перехід"
 
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "скалярний клон [<опції>] [--] <сховище> [<директорія>]"
+msgid "create repository within 'src' directory"
+msgstr "створити сховище в директорії \"src\""
+
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <головна-гілка>] [--full-clone]\n"
+"\t[--[no-]src] <URL-адреса> [<коренева-директорія>]"
 
 #, c-format
 msgid "cannot deduce worktree name from '%s'"
@@ -19823,12 +20016,28 @@ msgid "could not remove stale scalar.repo '%s'"
 msgstr "неможливо видалити застаріле scalar.repo \"%s\""
 
 #, c-format
-msgid "removing stale scalar.repo '%s'"
-msgstr "видаленнÑ\8f Ð·Ð°Ñ\81Ñ\82аÑ\80Ñ\96лого scalar.repo \"%s\""
+msgid "removed stale scalar.repo '%s'"
+msgstr "видалено Ð·Ð°Ñ\81Ñ\82аÑ\80Ñ\96ле scalar.repo \"%s\""
 
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "git сховище зникло у \"%s\""
+msgid "repository at '%s' has different owner"
+msgstr "у сховища \"%s\" інший власник"
+
+#, c-format
+msgid "repository at '%s' has a format issue"
+msgstr "невірній формат сховища \"%s\""
+
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "сховище \"%s\" не знайдено"
+
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"щоб скасувати реєстрацію цього репозиторію в Scalar, виконайте\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 msgid ""
 "scalar run <task> [<enlistment>]\n"
@@ -20000,7 +20209,6 @@ msgstr "зробіть коміт або додайте ваші зміни до
 #. TRANSLATORS: %s will be "revert", "cherry-pick" or
 #. "rebase".
 #.
-
 #, c-format
 msgid "%s: Unable to write new index file"
 msgstr "%s: Не вдалося записати новий індексний файл"
@@ -20234,15 +20442,10 @@ msgstr "неможливо отримати допис до коміту для
 
 #. TRANSLATORS: The first %s will be a "todo" command like
 #. "revert" or "pick", the second %s a SHA1.
-
 #, c-format
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s: не вдалося розібрати джерельний коміт %s"
 
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "не вдалося перейменувати \"%s\" на \"%s\""
-
 #, c-format
 msgid "could not revert %s... %s"
 msgstr "не вдалося зробити вивертання %s... %s"
@@ -20566,6 +20769,9 @@ msgstr "Застосування автосхову призвело до кон
 msgid "Autostash exists; creating a new stash entry."
 msgstr "Автосхов існує; створення нового запису схову."
 
+msgid "autostash reference is a symref"
+msgstr "посилання автосхову є символьним посиланням"
+
 msgid "could not detach HEAD"
 msgstr "не вдалося відʼєднати HEAD"
 
@@ -20598,14 +20804,14 @@ msgstr ""
 "    git rebase --edit-todo\n"
 "    git rebase --continue\n"
 
-#, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "Перебазування (%d/%d)%s"
-
 #, c-format
 msgid "Stopped at %s...  %.*s\n"
 msgstr "Зупинено на %s... %.*s\n"
 
+#, c-format
+msgid "Rebasing (%d/%d)%s"
+msgstr "Перебазування (%d/%d)%s"
+
 #, c-format
 msgid "unknown command %d"
 msgstr "невідома команда %d"
@@ -20886,6 +21092,10 @@ msgstr "не копіюються шаблони з \"%s\": %s"
 msgid "invalid initial branch name: '%s'"
 msgstr "неприпустиме початкове ім’я гілки: \"%s\""
 
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-init: ігноровано --initial-branch=%s"
+
 #, c-format
 msgid "unable to handle file type %d"
 msgstr "не вдалося обробити тип файлу %d"
@@ -20897,14 +21107,14 @@ msgstr "не вдалося перемістити %s на %s"
 msgid "attempt to reinitialize repository with different hash"
 msgstr "спроба переініціалізувати репозиторій з іншим хеш-алгоритмом"
 
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr "спроба переініціалізувати сховище з іншим форматом зберігання"
+
 #, c-format
 msgid "%s already exists"
 msgstr "%s вже існує"
 
-#, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-init: ігноровано --initial-branch=%s"
-
 #, c-format
 msgid "Reinitialized existing shared Git repository in %s%s\n"
 msgstr "Переініціалізовано існуюче спільне Git сховище в %s%s\n"
@@ -20923,35 +21133,42 @@ msgstr "Ініціалізовано порожнє Git сховище в %s%s\n
 
 #, c-format
 msgid "index entry is a directory, but not sparse (%08x)"
-msgstr "індексний запис є директорією, але не є розрідженим (%08x)"
+msgstr "запис індексу є директорією, але не розрідженою (%08x)"
 
 msgid "cannot use split index with a sparse index"
-msgstr "не можна використовувати розщеплений індекс з розрідженим індексом"
+msgstr "неможливо використовувати розділений індекс з розрідженим індексом"
 
+#. TRANSLATORS: IEC 80000-13:2008 gibibyte
 #, c-format
 msgid "%u.%2.2u GiB"
 msgstr "%u.%2.2u ГіБ"
 
+#. TRANSLATORS: IEC 80000-13:2008 gibibyte/second
 #, c-format
 msgid "%u.%2.2u GiB/s"
 msgstr "%u.%2.2u ГіБ/с"
 
+#. TRANSLATORS: IEC 80000-13:2008 mebibyte
 #, c-format
 msgid "%u.%2.2u MiB"
 msgstr "%u.%2.2u МіБ"
 
+#. TRANSLATORS: IEC 80000-13:2008 mebibyte/second
 #, c-format
 msgid "%u.%2.2u MiB/s"
 msgstr "%u.%2.2u МіБ/с"
 
+#. TRANSLATORS: IEC 80000-13:2008 kibibyte
 #, c-format
 msgid "%u.%2.2u KiB"
 msgstr "%u.%2.2u КіБ"
 
+#. TRANSLATORS: IEC 80000-13:2008 kibibyte/second
 #, c-format
 msgid "%u.%2.2u KiB/s"
 msgstr "%u.%2.2u КіБ/с"
 
+#. TRANSLATORS: IEC 80000-13:2008 byte
 #, c-format
 msgid "%u byte"
 msgid_plural "%u bytes"
@@ -20959,6 +21176,7 @@ msgstr[0] "%u байт"
 msgstr[1] "%u байти"
 msgstr[2] "%u байтів"
 
+#. TRANSLATORS: IEC 80000-13:2008 byte/second
 #, c-format
 msgid "%u byte/s"
 msgid_plural "%u bytes/s"
@@ -21168,12 +21386,6 @@ msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr ""
 "кількість записів у дереві кешу, які потрібно анулювати (за замовчуванням 0)"
 
-msgid "unhandled options"
-msgstr "необроблені опції"
-
-msgid "error preparing revisions"
-msgstr "помилка при підготовці ревізій"
-
 #, c-format
 msgid "commit %s is not marked reachable"
 msgstr "коміт %s не позначений як досяжний"
@@ -21330,9 +21542,6 @@ msgstr "встановлення шляху до віддаленого серв
 msgid "invalid remote service path"
 msgstr "неприпустимий шлях до віддаленої служби"
 
-msgid "operation not supported by protocol"
-msgstr "операція не підтримується протоколом"
-
 #, c-format
 msgid "can't connect to subservice %s"
 msgstr "неможливо підключитися до підсервісу %s"
@@ -21464,10 +21673,6 @@ msgstr "не вдалося розібрати конфігурацію transpor
 msgid "support for protocol v2 not implemented yet"
 msgstr "підтримка протоколу v2 ще не запроваджена"
 
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "невідоме значення для конфігурації \"%s\": %s"
-
 #, c-format
 msgid "transport '%s' not allowed"
 msgstr "засіб передачі \"%s\" не дозволений"
@@ -21520,6 +21725,9 @@ msgstr "bundle-uri операція не підтримується проток
 msgid "could not retrieve server-advertised bundle-uri list"
 msgstr "не вдалося отримати список адрес пакетів, оголошений сервером"
 
+msgid "operation not supported by protocol"
+msgstr "операція не підтримується протоколом"
+
 msgid "too-short tree object"
 msgstr "занадто короткий обʼєкт дерева"
 
@@ -21917,8 +22125,11 @@ msgstr "не вдалося отримати доступ до \"%s\""
 msgid "unable to get current working directory"
 msgstr "не вдалося завантажити поточну робочу директорію"
 
+msgid "unable to get random bytes"
+msgstr "не вдалося отримати випадкові байти"
+
 msgid "Unmerged paths:"
-msgstr "не злиті шляхи:"
+msgstr "Ð\9dе злиті шляхи:"
 
 msgid "  (use \"git restore --staged <file>...\" to unstage)"
 msgstr ""
@@ -22059,7 +22270,7 @@ msgstr ""
 "Ви можете використати параметр '--no-ahead-behind', щоб уникнути цього.\n"
 
 msgid "You have unmerged paths."
-msgstr "У вас є не злиті шляхи."
+msgstr "У вас є незлиті шляхи."
 
 msgid "  (fix conflicts and run \"git commit\")"
 msgstr "  (виправте конфлікти та виконайте \"git commit\")"
@@ -22359,7 +22570,6 @@ msgid "ahead "
 msgstr "попереду "
 
 #. TRANSLATORS: the action is e.g. "pull with rebase"
-
 #, c-format
 msgid "cannot %s: You have unstaged changes."
 msgstr "неможливо %s: У вас є неіндексовані зміни."
@@ -22371,6 +22581,10 @@ msgstr "крім того, ваш індекс містить незакоміч
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "неможливо виконати %s: Ваш індекс містить незакомічені зміни."
 
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "невідомий стиль \"%s\" наданий для \"%s\""
+
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
 "merge"
@@ -22554,19 +22768,18 @@ msgstr ""
 "\n"
 "Очистіть вміст тіла, якщо ви не бажаєте надсилати підсумок.\n"
 
-#, perl-format
-msgid "Failed to open %s: %s"
-msgstr "Не вдалося відкрити %s: %s"
-
 #, perl-format
 msgid "Failed to open %s.final: %s"
 msgstr "Не вдалося відкрити %s.final: %s"
 
+#, perl-format
+msgid "Failed to open %s: %s"
+msgstr "Не вдалося відкрити %s: %s"
+
 msgid "Summary email is empty, skipping it\n"
 msgstr "Підсумковий лист порожній, пропущено\n"
 
 #. TRANSLATORS: please keep [y/N] as is.
-
 #, perl-format
 msgid "Are you sure you want to use <%s> [y/N]? "
 msgstr "Ви впевнені, що хочете використати <%s> [y/N]? "
@@ -22611,7 +22824,6 @@ msgstr "помилка: не вдалося витягти дійсну адре
 #. TRANSLATORS: Make sure to include [q] [d] [e] in your
 #. translation. The program will only accept English input
 #. at this point.
-
 msgid "What to do with this address? ([q]uit|[d]rop|[e]dit): "
 msgstr "Що робити з цією адресою? ([q]uit|[d]rop|[e]dit): "
 
@@ -22646,7 +22858,6 @@ msgstr ""
 #. TRANSLATORS: Make sure to include [y] [n] [e] [q] [a] in your
 #. translation. The program will only accept English input
 #. at this point.
-
 msgid "Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): "
 msgstr "Надіслати цей лист? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): "
 
@@ -22762,7 +22973,6 @@ msgid "Skipping %s with backup suffix '%s'.\n"
 msgstr "Пропуск %s з суфіксом резервної копії \"%s\".\n"
 
 #. TRANSLATORS: please keep "[y|N]" as is.
-
 #, perl-format
 msgid "Do you really want to send %s? [y|N]: "
 msgstr "Ви дійсно хочете відправити %s? [y|N]: "
index b70ae3866b26691c11992d4ffa606ac3aea7b35e..39efaf1012a436a567112c7ea346d30456700e0b 100644 (file)
@@ -46,6 +46,7 @@
 #   commit                           |  提交
 #   commit message                   |  提交说明
 #   commit object                    |  提交对象
+#   commit-graph                     |  提交图
 #   commit-ish (also committish)     |  提交号
 #   cone                             |  锥形(稀疏检出模型);锥(稀疏检出)
 #   conflict                         |  冲突
 #   plumbing                         |  管件(Git 底层核心命令的别称)
 #   porcelain                        |  瓷件(Git 上层封装命令的别称)
 #   precious-objects repo            |  珍品仓库
+#   preferred pack                   |  首选包(多包索引中引入的首选包概念)
 #   promisor                         |  承诺者
 #   prune                            |  清除
 #   pull                             |  拉,拉取
@@ -151,8 +153,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-18 10:21+0800\n"
-"PO-Revision-Date: 2023-08-18 19:29+0800\n"
+"POT-Creation-Date: 2024-02-16 14:27+0800\n"
+"PO-Revision-Date: 2024-02-18 11:47+0800\n"
 "Last-Translator: Teng Long <dyroneteng@gmail.com>\n"
 "Language-Team: GitHub <https://github.com/dyrone/git/>\n"
 "Language: zh_CN\n"
@@ -1031,7 +1033,7 @@ msgid "unclosed quote"
 msgstr "未关闭的引号"
 
 #: alias.c builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
-#: builtin/receive-pack.c builtin/tag.c
+#: builtin/receive-pack.c builtin/tag.c t/helper/test-pkt-line.c
 msgid "too many arguments"
 msgstr "太多参数"
 
@@ -1045,14 +1047,16 @@ msgstr "未能识别的空白字符选项 '%s'"
 msgid "unrecognized whitespace ignore option '%s'"
 msgstr "未能识别的空白字符忽略选项 '%s'"
 
-#: apply.c archive.c builtin/add.c builtin/branch.c builtin/checkout.c
-#: builtin/clone.c builtin/commit.c builtin/describe.c builtin/diff-tree.c
-#: builtin/difftool.c builtin/fast-export.c builtin/fetch.c builtin/help.c
-#: builtin/index-pack.c builtin/init-db.c builtin/log.c builtin/ls-files.c
-#: builtin/merge-base.c builtin/merge.c builtin/pack-objects.c builtin/push.c
-#: builtin/rebase.c builtin/repack.c builtin/reset.c builtin/rev-list.c
-#: builtin/show-branch.c builtin/stash.c builtin/submodule--helper.c
-#: builtin/tag.c builtin/worktree.c parse-options.c range-diff.c revision.c
+#: apply.c archive.c builtin/add.c builtin/branch.c builtin/checkout-index.c
+#: builtin/checkout.c builtin/clean.c builtin/clone.c builtin/commit.c
+#: builtin/describe.c builtin/diff-tree.c builtin/difftool.c
+#: builtin/fast-export.c builtin/fetch.c builtin/help.c builtin/index-pack.c
+#: builtin/init-db.c builtin/log.c builtin/ls-files.c builtin/merge-base.c
+#: builtin/merge-tree.c builtin/merge.c builtin/pack-objects.c builtin/rebase.c
+#: builtin/repack.c builtin/replay.c builtin/reset.c builtin/rev-list.c
+#: builtin/rev-parse.c builtin/show-branch.c builtin/stash.c
+#: builtin/submodule--helper.c builtin/tag.c builtin/worktree.c parse-options.c
+#: range-diff.c revision.c
 #, c-format
 msgid "options '%s' and '%s' cannot be used together"
 msgstr "选项 '%s' 和 '%s' 不能同时使用"
@@ -1529,7 +1533,7 @@ msgid_plural "%d lines applied after fixing whitespace errors."
 msgstr[0] "修复空白错误后,应用了 %d 行。"
 msgstr[1] "修复空白错误后,应用了 %d 行。"
 
-#: apply.c builtin/add.c builtin/mv.c builtin/rm.c
+#: apply.c builtin/mv.c builtin/rm.c
 msgid "Unable to write new index file"
 msgstr "无法写入新索引文件"
 
@@ -1858,6 +1862,11 @@ msgstr "选项 '%s' 需要 '%s'"
 msgid "Unexpected option --output"
 msgstr "未知参数 --output"
 
+#: archive.c
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "额外的命令行参数:'%s'"
+
 #: archive.c
 #, c-format
 msgid "Unknown archive format '%s'"
@@ -1914,6 +1923,17 @@ msgstr "忽略过大的 gitattributes 数据对象 '%s'"
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "错误的 --attr-source 或 GIT_ATTR_SOURCE"
 
+#: attr.c read-cache.c
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "无法对 %s 执行 stat"
+
+#: bisect.c builtin/cat-file.c builtin/index-pack.c builtin/notes.c
+#: builtin/pack-objects.c combine-diff.c rerere.c
+#, c-format
+msgid "unable to read %s"
+msgstr "不能读 %s"
+
 #: bisect.c
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
@@ -2234,8 +2254,8 @@ msgstr "子模组 '%s':不能创建分支 '%s'"
 
 #: branch.c
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "'%s' 已经检出到 '%s'"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "'%s' 已经被工作区 '%s' 使用"
 
 #: builtin/add.c
 msgid "git add [<options>] [--] <pathspec>..."
@@ -2258,30 +2278,26 @@ msgstr ""
 "设置 add.interactive.useBuiltin 已经被移除!\n"
 "查看 'git help config' 中的相关条目以获取更多信息。"
 
-#: builtin/add.c builtin/rev-parse.c
-msgid "Could not read the index"
-msgstr "不能读取索引"
-
 #: builtin/add.c
-msgid "Could not write patch"
-msgstr "不能生成补丁"
+msgid "could not read the index"
+msgstr "不能读取索引"
 
 #: builtin/add.c
 msgid "editing patch failed"
 msgstr "编辑补丁失败"
 
-#: builtin/add.c
+#: builtin/add.c read-cache.c
 #, c-format
-msgid "Could not stat '%s'"
+msgid "could not stat '%s'"
 msgstr "不能对 '%s' 调用 stat"
 
 #: builtin/add.c
-msgid "Empty patch. Aborted."
-msgstr "空补丁。异常终止"
+msgid "empty patch. aborted"
+msgstr "空补丁。异常终止"
 
 #: builtin/add.c
 #, c-format
-msgid "Could not apply '%s'"
+msgid "could not apply '%s'"
 msgstr "不能应用 '%s'"
 
 #: builtin/add.c
@@ -2440,14 +2456,19 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "索引文件损坏"
 
+#: builtin/add.c builtin/am.c builtin/checkout.c builtin/clone.c
+#: builtin/commit.c builtin/stash.c merge.c rerere.c
+msgid "unable to write new index file"
+msgstr "无法写新的索引文件"
+
 #: builtin/am.c builtin/mailinfo.c mailinfo.c
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "'%2$s' 的错误动作 '%1$s'"
 
 #: builtin/am.c builtin/blame.c builtin/fetch.c builtin/pack-objects.c
-#: builtin/pull.c diff-merges.c gpg-interface.c ls-refs.c parallel-checkout.c
-#: sequencer.c setup.c
+#: builtin/pull.c config.c diff-merges.c gpg-interface.c ls-refs.c
+#: parallel-checkout.c sequencer.c setup.c
 #, c-format
 msgid "invalid value for '%s': '%s'"
 msgstr "'%s' 的值无效:'%s'"
@@ -2600,8 +2621,7 @@ msgstr "git write-tree 无法写入树对象"
 msgid "applying to an empty history"
 msgstr "正应用到一个空历史上"
 
-#: builtin/am.c builtin/commit.c builtin/merge.c sequencer.c
-#: t/helper/test-fast-rebase.c
+#: builtin/am.c builtin/commit.c builtin/merge.c builtin/replay.c sequencer.c
 msgid "failed to write commit object"
 msgstr "无法写提交对象"
 
@@ -2689,11 +2709,6 @@ msgstr ""
 "您应该对已经冲突解决的每一个文件执行 'git add' 来标记已经完成。 \n"
 "您可以对 \"由他们删除\" 的文件执行 `git rm` 命令。"
 
-#: builtin/am.c builtin/checkout.c builtin/clone.c builtin/stash.c merge.c
-#: rerere.c
-msgid "unable to write new index file"
-msgstr "无法写新的索引文件"
-
 #: builtin/am.c builtin/reset.c
 #, c-format
 msgid "Could not parse object '%s'."
@@ -2714,11 +2729,6 @@ msgstr "您好像在上一次 'am' 失败后移动了 HEAD。未回退至 ORIG_H
 msgid "failed to read '%s'"
 msgstr "无法读取 '%s'"
 
-#: builtin/am.c
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "选项 '%s=%s' 和 '%s=%s' 不能同时使用"
-
 #: builtin/am.c
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<选项>] [(<mbox> | <Maildir>)...]"
@@ -2791,8 +2801,9 @@ msgid "n"
 msgstr "n"
 
 #: builtin/am.c builtin/branch.c builtin/bugreport.c builtin/cat-file.c
-#: builtin/diagnose.c builtin/for-each-ref.c builtin/ls-files.c
-#: builtin/ls-tree.c builtin/replace.c builtin/tag.c builtin/verify-tag.c
+#: builtin/clone.c builtin/diagnose.c builtin/for-each-ref.c builtin/init-db.c
+#: builtin/ls-files.c builtin/ls-tree.c builtin/replace.c builtin/tag.c
+#: builtin/verify-tag.c
 msgid "format"
 msgstr "格式"
 
@@ -2922,10 +2933,10 @@ msgstr "git archive:应有一个 flush 包"
 
 #: builtin/bisect.c
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<术语> --term-{old,good}=<术语>]    [--no-"
+"git bisect start [--term-{new|bad}=<术语> --term-{old|good}=<术语>]    [--no-"
 "checkout] [--first-parent] [<坏> [<好>...]] [--]    [<路径规格>...]"
 
 #: builtin/bisect.c
@@ -2945,8 +2956,8 @@ msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <日志文件>"
 
 #: builtin/bisect.c
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <命令>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <命令> [<参数>...]"
 
 #: builtin/bisect.c
 #, c-format
@@ -3461,37 +3472,38 @@ msgstr "git branch [<选项>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
 "将要删除的分支 '%s' 已经被合并到\n"
-"         '%s',但未合并到 HEAD"
+"         '%s',但未合并到 HEAD"
 
 #  译者:保持原换行格式,在输出时 %s 的替代内容会让字符串变长
 #: builtin/branch.c
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
-"并未删除分支 '%s', 虽然它已经合并到 HEAD,\n"
-"         然而却尚未被合并到分支 '%s' 。"
+"并未删除分支 '%s',虽然它已经合并到 HEAD,\n"
+"         然而却尚未被合并到分支 '%s'"
 
 #: builtin/branch.c
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
+msgid "couldn't look up commit object for '%s'"
 msgstr "无法查询 '%s' 指向的提交对象"
 
 #: builtin/branch.c
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
-msgstr ""
-"分支 '%s' 没有完全合并。\n"
-"如果您确认要删除它,执行 'git branch -D %s'。"
+msgid "the branch '%s' is not fully merged"
+msgstr "分支 '%s' 没有完全合并"
 
 #: builtin/branch.c
-msgid "Update of config-file failed"
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
+msgstr "如果您确认要删除它,执行 'git branch -D %s'"
+
+#: builtin/branch.c
+msgid "update of config-file failed"
 msgstr "更新配置文件失败"
 
 #: builtin/branch.c
@@ -3500,13 +3512,13 @@ msgstr "不能将 -a 和 -d 同时使用"
 
 #: builtin/branch.c
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "æ\97 æ³\95å\88 é\99¤æ£\80å\87ºäº\8e '%2$s' ç\9a\84å\88\86æ\94¯ '%1$s'ã\80\82"
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr "æ\97 æ³\95强å\88¶æ\9b´æ\96°è¢«å·¥ä½\9cå\8cº '%2$s' æ\89\80使ç\94¨ç\9a\84å\88\86æ\94¯ '%1$s'"
 
 #: builtin/branch.c
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "未能找到远程跟踪分支 '%s'"
+msgid "remote-tracking branch '%s' not found"
+msgstr "未能找到远程跟踪分支 '%s'"
 
 #: builtin/branch.c
 #, c-format
@@ -3519,8 +3531,8 @@ msgstr ""
 
 #: builtin/branch.c
 #, c-format
-msgid "branch '%s' not found."
-msgstr "分支 '%s' 未发现"
+msgid "branch '%s' not found"
+msgstr "分支 '%s' 未发现"
 
 #: builtin/branch.c
 #, c-format
@@ -3547,12 +3559,12 @@ msgstr "HEAD (%s) 指向 refs/heads/ 之外"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch %s is being rebased at %s"
+msgid "branch %s is being rebased at %s"
 msgstr "分支 %s 正被变基到 %s"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch %s is being bisected at %s"
+msgid "branch %s is being bisected at %s"
 msgstr "分支 %s 正被二分查找于 %s"
 
 #: builtin/branch.c
@@ -3562,48 +3574,48 @@ msgstr "工作区 %s 的 HEAD 指向没有被更新"
 
 #: builtin/branch.c
 #, c-format
-msgid "Invalid branch name: '%s'"
+msgid "invalid branch name: '%s'"
 msgstr "无效的分支名:'%s'"
 
 #: builtin/branch.c
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "分支 '%s' 尚无提交"
+msgid "no commit on branch '%s' yet"
+msgstr "分支 '%s' 尚无提交"
 
 #: builtin/branch.c
 #, c-format
-msgid "No branch named '%s'."
-msgstr "没有分支 '%s'"
+msgid "no branch named '%s'"
+msgstr "没有分支 '%s'"
 
 #: builtin/branch.c
-msgid "Branch rename failed"
+msgid "branch rename failed"
 msgstr "分支重命名失败"
 
 #: builtin/branch.c
-msgid "Branch copy failed"
+msgid "branch copy failed"
 msgstr "分支拷贝失败"
 
 #: builtin/branch.c
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
+msgid "created a copy of a misnamed branch '%s'"
 msgstr "已为错误命名的分支 '%s' 创建了一个副本"
 
 #: builtin/branch.c
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
+msgid "renamed a misnamed branch '%s' away"
 msgstr "已将错误命名的分支 '%s' 重命名"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "分支重命名为 %s,但 HEAD 没有更新"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "分支重命名为 %s,但 HEAD 没有更新"
 
 #: builtin/branch.c
-msgid "Branch is renamed, but update of config-file failed"
+msgid "branch is renamed, but update of config-file failed"
 msgstr "分支被重命名,但更新配置文件失败"
 
 #: builtin/branch.c
-msgid "Branch is copied, but update of config-file failed"
+msgid "branch is copied, but update of config-file failed"
 msgstr "分支已拷贝,但更新配置文件失败"
 
 #: builtin/branch.c
@@ -3754,9 +3766,9 @@ msgstr "在子模组中递归"
 msgid "format to use for the output"
 msgstr "输出格式"
 
-#: builtin/branch.c builtin/submodule--helper.c submodule.c
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "无法将 HEAD 解析为有效引用"
+#: builtin/branch.c
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "无法将 HEAD 解析为有效引用"
 
 #: builtin/branch.c builtin/clone.c
 msgid "HEAD not found below refs/heads!"
@@ -3778,7 +3790,7 @@ msgid "branch name required"
 msgstr "必须提供分支名"
 
 #: builtin/branch.c
-msgid "Cannot give description to detached HEAD"
+msgid "cannot give description to detached HEAD"
 msgstr "不能向分离头指针提供描述"
 
 #: builtin/branch.c
@@ -3786,12 +3798,12 @@ msgid "cannot edit description of more than one branch"
 msgstr "不能为一个以上的分支编辑描述"
 
 #: builtin/branch.c
-msgid "cannot copy the current branch while not on any."
-msgstr "不处于任何分支上,无法拷贝当前分支"
+msgid "cannot copy the current branch while not on any"
+msgstr "不处于任何分支上,无法拷贝当前分支"
 
 #: builtin/branch.c
-msgid "cannot rename the current branch while not on any."
-msgstr "不处于任何分支上,无法重命名当前分支"
+msgid "cannot rename the current branch while not on any"
+msgstr "不处于任何分支上,无法重命名当前分支"
 
 #: builtin/branch.c
 msgid "too many branches for a copy operation"
@@ -3808,8 +3820,8 @@ msgstr "为设置新上游提供了太多的参数"
 #: builtin/branch.c
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
-msgstr "无法设置 HEAD 的上游为 %s,因为 HEAD 没有指向任何分支"
+"could not set upstream of HEAD to %s when it does not point to any branch"
+msgstr "无法设置 HEAD 的上游为 %s,因为 HEAD 没有指向任何分支"
 
 #: builtin/branch.c
 #, c-format
@@ -3826,17 +3838,17 @@ msgid "too many arguments to unset upstream"
 msgstr "为取消上游设置操作提供了太多的参数"
 
 #: builtin/branch.c
-msgid "could not unset upstream of HEAD when it does not point to any branch."
+msgid "could not unset upstream of HEAD when it does not point to any branch"
 msgstr "无法取消 HEAD 的上游设置因为它没有指向一个分支"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch '%s' has no upstream information"
+msgid "branch '%s' has no upstream information"
 msgstr "分支 '%s' 没有上游信息"
 
 #: builtin/branch.c
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
 "'git branch' 的 -a 和 -r 选项不带一个分支名。\n"
@@ -3845,9 +3857,8 @@ msgstr ""
 #: builtin/branch.c
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
-msgstr ""
-"不再支持选项 '--set-upstream'。请使用 '--track' 或 '--set-upstream-to'。"
+"'--set-upstream-to' instead"
+msgstr "不再支持选项 '--set-upstream'。请使用 '--track' 或 '--set-upstream-to'"
 
 #: builtin/bugreport.c
 msgid "git version:\n"
@@ -3930,6 +3941,11 @@ msgstr "指定错误报告文件的目标位置"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "指定文件的 strftime 格式后缀"
 
+#: builtin/bugreport.c
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "未知参数 `%s'"
+
 #: builtin/bugreport.c builtin/diagnose.c
 #, c-format
 msgid "could not create leading directories for '%s'"
@@ -4067,6 +4083,14 @@ msgstr "git cat-file (-e | -p) <对象>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <对象>"
 
+#: builtin/cat-file.c
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<版本>:<路径|树对象> | --path=<路径|树对象> <版本>]"
+
 #: builtin/cat-file.c
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
@@ -4079,14 +4103,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-#: builtin/cat-file.c
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<版本>:<路径|树对象> | --path=<路径|树对象> <版本>]"
-
 #: builtin/cat-file.c
 msgid "Check object existence or emit object contents"
 msgstr "检查对象存在或输出对象内容"
@@ -4462,6 +4478,11 @@ msgstr "未指定 '%2$s' 时,必须使用 '%1$s'"
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "'%s' 或 '%s' 不能和 %s 一起使用"
 
+#: builtin/checkout.c
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr "'%s'、'%s' 或 '%s' 不能在检出一个树时使用"
+
 #: builtin/checkout.c
 #, c-format
 msgid "path '%s' is unmerged"
@@ -4489,7 +4510,7 @@ msgstr "不能对 '%s' 执行 reflog 操作:%s\n"
 msgid "HEAD is now at"
 msgstr "HEAD 目前位于"
 
-#: builtin/checkout.c builtin/clone.c t/helper/test-fast-rebase.c
+#: builtin/checkout.c builtin/clone.c
 msgid "unable to update HEAD"
 msgstr "不能更新 HEAD"
 
@@ -4758,8 +4779,8 @@ msgid "new-branch"
 msgstr "新分支"
 
 #: builtin/checkout.c
-msgid "new unparented branch"
-msgstr "æ\96°ç\9a\84没æ\9c\89ç\88¶æ\8f\90交的分支"
+msgid "new unborn branch"
+msgstr "æ\96°ç\9a\84æ\9cªè¯\9eç\94\9f的分支"
 
 #: builtin/checkout.c builtin/merge.c
 msgid "update ignored files (default)"
@@ -4825,7 +4846,7 @@ msgstr ""
 msgid "you must specify path(s) to restore"
 msgstr "您必须指定要恢复的路径"
 
-#: builtin/checkout.c builtin/clone.c builtin/remote.c
+#: builtin/checkout.c builtin/clone.c builtin/remote.c builtin/replay.c
 #: builtin/submodule--helper.c builtin/worktree.c
 msgid "branch"
 msgstr "分支"
@@ -5066,10 +5087,6 @@ msgid ""
 msgstr ""
 "clean.requireForce 默认为 true 且未提供 -i、-n 或 -f 选项,拒绝执行清理动作"
 
-#: builtin/clean.c
-msgid "-x and -X cannot be used together"
-msgstr "-x 和 -X 不能同时使用"
-
 #: builtin/clone.c
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<选项>] [--] <仓库> [<路径>]"
@@ -5148,7 +5165,7 @@ msgstr "检出 <分支> 而不是远程 HEAD"
 msgid "path to git-upload-pack on the remote"
 msgstr "远程 git-upload-pack 路径"
 
-#: builtin/clone.c builtin/fetch.c builtin/grep.c builtin/pull.c
+#: builtin/clone.c builtin/fetch.c builtin/pull.c
 msgid "depth"
 msgstr "深度"
 
@@ -5161,6 +5178,7 @@ msgid "create a shallow clone since a specific time"
 msgstr "从一个特定时间创建一个浅克隆"
 
 #: builtin/clone.c builtin/fetch.c builtin/pull.c builtin/rebase.c
+#: builtin/replay.c
 msgid "revision"
 msgstr "版本"
 
@@ -5188,6 +5206,10 @@ msgstr "git目录"
 msgid "separate git dir from working tree"
 msgstr "git目录和工作区分离"
 
+#: builtin/clone.c builtin/init-db.c
+msgid "specify the reference format to use"
+msgstr "指定要使用的引用格式"
+
 #: builtin/clone.c
 msgid "key=value"
 msgstr "key=value"
@@ -5337,11 +5359,10 @@ msgstr "太多参数。"
 msgid "You must specify a repository to clone."
 msgstr "您必须指定一个仓库来克隆。"
 
-#: builtin/clone.c
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr "--bundle-uri 与 --depth、--shallow-since 和 --shallow-exclude 不兼容"
+#: builtin/clone.c builtin/init-db.c setup.c
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "未知的引用存储格式 '%s'"
 
 #: builtin/clone.c
 #, c-format
@@ -5502,7 +5523,7 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <目录>] [--append]\n"
 "                       [--split[=<策略>]] [--reachable | --stdin-packs | --"
@@ -5521,12 +5542,17 @@ msgstr "保存图形的对象目录"
 
 #: builtin/commit-graph.c
 msgid "if the commit-graph is split, only verify the tip file"
-msgstr "如果提交图被拆分,只验证头一个文件"
+msgstr "如果提交图被拆分,只验证头一个文件"
 
 #: builtin/commit-graph.c
 #, c-format
 msgid "Could not open commit-graph '%s'"
-msgstr "无法打开提交图形 '%s'"
+msgstr "无法打开提交图 '%s'"
+
+#: builtin/commit-graph.c
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "无法打开提交图链 '%s'"
 
 #: builtin/commit-graph.c
 #, c-format
@@ -5570,15 +5596,15 @@ msgstr "启用变更路径的计算"
 
 #: builtin/commit-graph.c
 msgid "allow writing an incremental commit-graph file"
-msgstr "允许写一个增量提交图文件"
+msgstr "允许写一个增量提交图文件"
 
 #: builtin/commit-graph.c
 msgid "maximum number of commits in a non-base split commit-graph"
-msgstr "在非基本拆分提交图中的最大提交数"
+msgstr "在非基本拆分提交图中的最大提交数"
 
 #: builtin/commit-graph.c
 msgid "maximum ratio between two levels of a split commit-graph"
-msgstr "一个拆分提交图的两个级别之间的最大比率"
+msgstr "一个拆分提交图的两个级别之间的最大比率"
 
 #: builtin/commit-graph.c
 msgid "only expire files older than a given date-time"
@@ -5768,10 +5794,6 @@ msgstr "无法更新临时索引"
 msgid "Failed to update main cache tree"
 msgstr "不能更新树的主缓存"
 
-#: builtin/commit.c
-msgid "unable to write new_index file"
-msgstr "无法写 new_index 文件"
-
 #: builtin/commit.c
 msgid "cannot do a partial commit during a merge."
 msgstr "在合并过程中不能做部分提交。"
@@ -6260,10 +6282,10 @@ msgstr "因提交说明的正文为空而终止提交。\n"
 #: builtin/commit.c
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
-"仓库已更新,但无法写 new_index 文件。检查是否磁盘已满或\n"
+"仓库已更新,但无法写入索引文件。检查是否磁盘已满或\n"
 "磁盘配额已耗尽,然后执行 \"git restore --staged :/\" 恢复。"
 
 #: builtin/config.c
@@ -8070,6 +8092,10 @@ msgstr "清除未引用的对象"
 msgid "pack unreferenced objects separately"
 msgstr "分开打包未引用的对象"
 
+#: builtin/gc.c builtin/repack.c
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "使用 --cruft,限制新 cruft 包的总大小"
+
 #: builtin/gc.c
 msgid "be more thorough (increased runtime)"
 msgstr "更彻底(增加运行时间)"
@@ -8285,14 +8311,6 @@ msgstr "无法运行 'crontab',您的系统可能不支持 'cron'"
 msgid "'crontab' died"
 msgstr "'crontab' 终止"
 
-#: builtin/gc.c
-msgid "failed to start systemctl"
-msgstr "无法启动 systemctl"
-
-#: builtin/gc.c
-msgid "failed to run systemctl"
-msgstr "无法运行 systemctl"
-
 #: builtin/gc.c builtin/worktree.c
 #, c-format
 msgid "failed to delete '%s'"
@@ -8303,6 +8321,14 @@ msgstr "无法删除 '%s'"
 msgid "failed to flush '%s'"
 msgstr "无法刷新 '%s'"
 
+#: builtin/gc.c
+msgid "failed to start systemctl"
+msgstr "无法启动 systemctl"
+
+#: builtin/gc.c
+msgid "failed to run systemctl"
+msgstr "无法运行 systemctl"
+
 #: builtin/gc.c
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
@@ -8333,6 +8359,10 @@ msgstr "调度器"
 msgid "scheduler to trigger git maintenance run"
 msgstr "触发 git maintenance 执行的调度器"
 
+#: builtin/gc.c
+msgid "failed to set up maintenance schedule"
+msgstr "无法设置维护计划"
+
 #: builtin/gc.c
 msgid "failed to add repo to global config"
 msgstr "无法将仓库添加到全局配置"
@@ -8370,6 +8400,11 @@ msgstr "没有线程支持,忽略 %s"
 msgid "unable to read tree (%s)"
 msgstr "无法读取树(%s)"
 
+#: builtin/grep.c
+#, c-format
+msgid "unable to read tree %s"
+msgstr "无法读取树 %s"
+
 #: builtin/grep.c
 #, c-format
 msgid "unable to grep from object of type %s"
@@ -8429,8 +8464,8 @@ msgid "search in subdirectories (default)"
 msgstr "在子目录中寻找(默认)"
 
 #: builtin/grep.c
-msgid "descend at most <depth> levels"
-msgstr "最多以指定的深度向下寻找"
+msgid "descend at most <n> levels"
+msgstr "最多向下寻找 <n> 层"
 
 #: builtin/grep.c
 msgid "use extended POSIX regular expressions"
@@ -8893,11 +8928,6 @@ msgstr "解压缩严重的不一致"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "发现 %s 出现 SHA1 冲突!"
 
-#: builtin/index-pack.c builtin/pack-objects.c
-#, c-format
-msgid "unable to read %s"
-msgstr "不能读 %s"
-
 #: builtin/index-pack.c
 #, c-format
 msgid "cannot read existing object info %s"
@@ -9075,11 +9105,13 @@ msgstr "在打包对象中 fsck 检查出错"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<模板目录>]\n"
 "         [--separate-git-dir <git 目录>] [--object-format=<格式>]\n"
+"         [--ref-format=<格式>]\n"
 "         [-b <分支名> | --initial-branch=<分支名>]\n"
 "         [--shared[=<权限>]] [<目录>]"
 
@@ -9132,11 +9164,11 @@ msgstr "--separate-git-dir 不能用于纯仓库"
 #: builtin/interpret-trailers.c
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <键>[(=|:)<值>])...]\n"
+"                       [(--trailer (<键|键别名>)[(=|:)<值>])...]\n"
 "                       [--parse] [<文件>...]"
 
 #: builtin/interpret-trailers.c
@@ -9147,6 +9179,10 @@ msgstr "在原位编辑文件"
 msgid "trim empty trailers"
 msgstr "删除空的尾注"
 
+#: builtin/interpret-trailers.c
+msgid "placement"
+msgstr "安置"
+
 #: builtin/interpret-trailers.c
 msgid "where to place the new trailer"
 msgstr "在哪里放置新的尾注"
@@ -9164,20 +9200,20 @@ msgid "output only the trailers"
 msgstr "只输出尾注"
 
 #: builtin/interpret-trailers.c
-msgid "do not apply config rules"
-msgstr "不要应用配置规则"
+msgid "do not apply trailer.* configuration variables"
+msgstr "不应用 trailer.* 配置变量"
 
 #: builtin/interpret-trailers.c
-msgid "join whitespace-continued values"
-msgstr "连接空白折行的值"
+msgid "reformat multiline trailer values as single-line values"
+msgstr "将多行尾注值重新格式化为单行值"
 
 #: builtin/interpret-trailers.c
-msgid "set parsing options"
-msgstr "设置解析选项"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "--only-trailers --only-input --unfold 的别名"
 
 #: builtin/interpret-trailers.c
-msgid "do not treat --- specially"
-msgstr "ä¸\8dè¦\81对 --- ç\89¹æ®\8aå¤\84ç\90\86"
+msgid "do not treat \"---\" as the end of input"
+msgstr "ä¸\8dè¦\81å°\86 \"---\" è§\86为è¾\93å\85¥ç\9a\84ç»\93æ\9d\9f"
 
 #: builtin/interpret-trailers.c
 msgid "trailer(s) to add"
@@ -9234,7 +9270,7 @@ msgid ""
 "<file>"
 msgstr "跟踪 <文件> 中 <开始>,<结束> 范围内的行或函数 :<函数名> 的演变"
 
-#: builtin/log.c builtin/shortlog.c bundle.c
+#: builtin/log.c builtin/replay.c builtin/shortlog.c bundle.c
 #, c-format
 msgid "unrecognized argument: %s"
 msgstr "未能识别的参数:%s"
@@ -9289,6 +9325,11 @@ msgstr "只需要一个范围"
 msgid "not a range"
 msgstr "不是一个范围"
 
+#: builtin/log.c
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "无法读取分支描述文件 '%s'"
+
 #: builtin/log.c
 msgid "cover letter needs email format"
 msgstr "附函需要邮件地址格式"
@@ -9415,6 +9456,10 @@ msgstr "从分支描述获取附函的模式"
 msgid "generate parts of a cover letter based on a branch's description"
 msgstr "基于一个分支描述生成部分附函"
 
+#: builtin/log.c
+msgid "use branch description from file"
+msgstr "使用来自文件的分支描述"
+
 #: builtin/log.c
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "使用 [<前缀>] 代替 [PATCH]"
@@ -9969,10 +10014,20 @@ msgstr ""
 "git merge-file [<选项>] [-L <名字1> [-L <初始名字> [-L <名字2>]]] <文件1> <初"
 "始文件> <文件2>"
 
+#: builtin/merge-file.c diff.c
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr "选项 diff-algorithm 接受参数 \"myers\"、\"minimal\"、\"patience\" 和 \"histogram\""
+
 #: builtin/merge-file.c
 msgid "send results to standard output"
 msgstr "将结果发送到标准输出"
 
+#: builtin/merge-file.c
+msgid "use object IDs instead of filenames"
+msgstr "使用对象 ID 替换文件名"
+
 #: builtin/merge-file.c
 msgid "use a diff3 based merge"
 msgstr "使用基于 diff3 的合并"
@@ -9993,6 +10048,14 @@ msgstr "如果冲突,使用他们的版本"
 msgid "for conflicts, use a union version"
 msgstr "如果冲突,使用联合版本"
 
+#: builtin/merge-file.c diff.c
+msgid "<algorithm>"
+msgstr "<算法>"
+
+#: builtin/merge-file.c diff.c
+msgid "choose a diff algorithm"
+msgstr "选择一个差异算法"
+
 #: builtin/merge-file.c
 msgid "for conflicts, use this marker size"
 msgstr "如果冲突,使用指定长度的标记"
@@ -10005,6 +10068,15 @@ msgstr "不要警告冲突"
 msgid "set labels for file1/orig-file/file2"
 msgstr "为 文件1/初始文件/文件2 设置标签"
 
+#: builtin/merge-file.c
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "对象 '%s' 不存在"
+
+#: builtin/merge-file.c
+msgid "Could not write object file"
+msgstr "不能写入对象文件"
+
 #: builtin/merge-recursive.c
 #, c-format
 msgid "unknown option %s"
@@ -10084,13 +10156,22 @@ msgstr "实施多个合并,每输入行一个"
 msgid "specify a merge-base for the merge"
 msgstr "指定用于合并的合并基线"
 
+#: builtin/merge-tree.c builtin/merge.c builtin/pull.c
+msgid "option=value"
+msgstr "option=value"
+
+#: builtin/merge-tree.c builtin/merge.c builtin/pull.c
+msgid "option for selected merge strategy"
+msgstr "所选的合并策略的选项"
+
 #: builtin/merge-tree.c
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge 与其他所有选项不兼容"
 
-#: builtin/merge-tree.c
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base 与 --stdin 不兼容"
+#: builtin/merge-tree.c builtin/merge.c
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "未知的策略选项:-X%s"
 
 #: builtin/merge-tree.c builtin/notes.c
 #, c-format
@@ -10179,14 +10260,6 @@ msgstr "策略"
 msgid "merge strategy to use"
 msgstr "要使用的合并策略"
 
-#: builtin/merge.c builtin/pull.c
-msgid "option=value"
-msgstr "option=value"
-
-#: builtin/merge.c builtin/pull.c
-msgid "option for selected merge strategy"
-msgstr "所选的合并策略的选项"
-
 #: builtin/merge.c
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr "合并的提交说明(针对非快进式合并)"
@@ -10257,7 +10330,7 @@ msgstr "'%s' 没有指向一个提交"
 msgid "Bad branch.%s.mergeoptions string: %s"
 msgstr "坏的 branch.%s.mergeoptions 字符串:%s"
 
-#: builtin/merge.c builtin/stash.c merge-recursive.c
+#: builtin/merge.c merge-recursive.c
 msgid "Unable to write index."
 msgstr "不能写入索引。"
 
@@ -10267,11 +10340,6 @@ msgstr "未处理两个头合并之外的任何操作。"
 
 #: builtin/merge.c
 #, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "未知的策略选项:-X%s"
-
-#: builtin/merge.c t/helper/test-fast-rebase.c
-#, c-format
 msgid "unable to write %s"
 msgstr "不能写 %s"
 
@@ -10628,8 +10696,8 @@ msgid "can not move directory into itself"
 msgstr "不能将目录移动到自身"
 
 #: builtin/mv.c
-msgid "cannot move directory over file"
-msgstr "不能将目录移动到文件"
+msgid "destination already exists"
+msgstr "目标已存在"
 
 #: builtin/mv.c
 msgid "source directory is empty"
@@ -11256,6 +11324,11 @@ msgstr "压缩对象中"
 msgid "inconsistency with delta count"
 msgstr "不一致的差异计数"
 
+#: builtin/pack-objects.c
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "无效的 pack.allowPackReuse 值:'%s'"
+
 #: builtin/pack-objects.c
 #, c-format
 msgid ""
@@ -11556,10 +11629,6 @@ msgstr "最小的包文件大小是 1 MiB"
 msgid "--thin cannot be used to build an indexable pack"
 msgstr "--thin 不能用于创建一个可索引包"
 
-#: builtin/pack-objects.c
-msgid "cannot use --filter without --stdout"
-msgstr "不能在没有 --stdout 的情况下使用 --filter"
-
 #: builtin/pack-objects.c
 msgid "cannot use --filter with --stdin-packs"
 msgstr "不能同时使用 --filter 和 --stdin-packs"
@@ -11576,10 +11645,6 @@ msgstr "不能同时使用内部版本列表和 --cruft"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "不能将 --stdin-packs 和 --cruft 同时使用"
 
-#: builtin/pack-objects.c
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "不能将 --max-pack-size 和 --cruft 同时使用"
-
 #: builtin/pack-objects.c
 msgid "Enumerating objects"
 msgstr "枚举对象中"
@@ -11588,10 +11653,10 @@ msgstr "枚举对象中"
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "总共 %<PRIu32>(差异 %<PRIu32>),复用 %<PRIu32>(差异 %<PRIu32>),包复用 "
-"%<PRIu32>"
+"%<PRIu32>(来自  %<PRIuMAX> 个包)"
 
 #: builtin/pack-redundant.c
 msgid ""
@@ -12665,7 +12730,7 @@ msgstr "没有正在进行的变基?"
 msgid "The --edit-todo action can only be used during interactive rebase."
 msgstr "动作 --edit-todo 只能用在交互式变基过程中。"
 
-#: builtin/rebase.c t/helper/test-fast-rebase.c
+#: builtin/rebase.c
 msgid "Cannot read HEAD"
 msgstr "不能读取 HEAD"
 
@@ -12709,16 +12774,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "开关 `C' 期望一个数字值"
 
-#: builtin/rebase.c
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy 需要 --merge 或 --interactive"
-
-#: builtin/rebase.c
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr "应用的选项与 rebase.autoSquash 不兼容。考虑加上 --no-autosquash"
-
 #: builtin/rebase.c
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
@@ -13202,8 +13257,8 @@ msgid ""
 msgid_plural ""
 "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
 "to delete them, use:"
-msgstr[0] "注意:ref/remotes 层级之外的一个分支未被移除。要删除它,使用:"
-msgstr[1] "注意:ref/remotes 层级之外的一些分支未被移除。要删除它们,使用:"
+msgstr[0] "注意:refs/remotes/ 层级之外的一个分支未被移除。要删除它,使用:"
+msgstr[1] "注意:refs/remotes/ 层级之外的一些分支未被移除。要删除它们,使用:"
 
 #: builtin/remote.c
 #, c-format
@@ -13561,6 +13616,11 @@ msgstr "不能关闭引用快照临时文件"
 msgid "could not remove stale bitmap: %s"
 msgstr "无法删除过期的位图: %s"
 
+#: builtin/repack.c
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "包前缀 %s 没有以对象目录 %s 开始"
+
 #: builtin/repack.c
 msgid "pack everything in a single pack"
 msgstr "所有内容打包到一个包文件中"
@@ -13661,18 +13721,22 @@ msgstr "写入结果包的多包索引"
 msgid "pack prefix to store a pack containing pruned objects"
 msgstr "储存被清除的对象的包的前缀"
 
+#: builtin/repack.c
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "储存被过滤的对象的包的前缀"
+
 #: builtin/repack.c
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "不能删除珍品仓库中的打包文件"
 
 #: builtin/repack.c
-msgid "Nothing new to pack."
-msgstr "没有新的要打包。"
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "选项 '%s' 只能和 '%s' 搭配使用"
 
 #: builtin/repack.c
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "包前缀 %s 没有以对象目录 .%s 开始"
+msgid "Nothing new to pack."
+msgstr "没有新的要打包。"
 
 #: builtin/repack.c
 #, c-format
@@ -13925,6 +13989,84 @@ msgstr "--convert-graft-file 不带参数"
 msgid "only one pattern can be given with -l"
 msgstr "只能为 -l 提供一个模式"
 
+#: builtin/replay.c
+msgid "need some commits to replay"
+msgstr "需要一些提交来重放"
+
+#: builtin/replay.c
+msgid "--onto and --advance are incompatible"
+msgstr "--onto 和 --advance 不兼容"
+
+#: builtin/replay.c
+msgid "all positive revisions given must be references"
+msgstr "提供的所有正向版本必须为引用"
+
+#: builtin/replay.c
+msgid "argument to --advance must be a reference"
+msgstr "--advance 的参数必须是引用"
+
+#: builtin/replay.c
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr "不能使用多个源推进目标,因为无法明确如何排序"
+
+#: builtin/replay.c
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr "不能隐式地确定这是 --advance 还是 --onto 的操作"
+
+#: builtin/replay.c
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr "不能使用多个源分支推进目标,因为无法明确如何排序"
+
+#: builtin/replay.c
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "不能隐式地确定 --onto 正确的基线"
+
+#: builtin/replay.c
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr "(试验中!)git replay ([--contained] --onto <新基线> | --advance <分支>) <版本范围>..."
+
+#: builtin/replay.c
+msgid "make replay advance given branch"
+msgstr "重放时演进给定的分支"
+
+#: builtin/replay.c
+msgid "replay onto given commit"
+msgstr "重放到给定提交"
+
+#: builtin/replay.c
+msgid "advance all branches contained in revision-range"
+msgstr "演进版本范围中包含的所有分支"
+
+#: builtin/replay.c
+msgid "option --onto or --advance is mandatory"
+msgstr "选项 --onto 或 --advance 必须指定其一"
+
+#: builtin/replay.c
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr "一些版本遍历选项将被覆盖,如 'struct rev_info' 中的 '%s' 位将被强制设定"
+
+#: builtin/replay.c
+msgid "error preparing revisions"
+msgstr "准备版本时错误"
+
+#: builtin/replay.c
+msgid "replaying down to root commit is not supported yet!"
+msgstr "目前还不支持重放到根提交!"
+
+#: builtin/replay.c
+msgid "replaying merge commits is not supported yet!"
+msgstr "目前还不支持重放到合并提交!"
+
 #: builtin/rerere.c
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
@@ -14184,22 +14326,14 @@ msgstr "--prefix 需要一个参数"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "未知的 --abbrev-ref 模式:%s"
 
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden 不能与 --branches 一起使用"
-
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden 不能与 --tags 一起使用"
-
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden 不能与 --remotes 一起使用"
-
 #: builtin/rev-parse.c setup.c
 msgid "this operation must be run in a work tree"
 msgstr "该操作必须在一个工作区中运行"
 
+#: builtin/rev-parse.c
+msgid "Could not read the index"
+msgstr "不能读取索引"
+
 #: builtin/rev-parse.c
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
@@ -14625,18 +14759,40 @@ msgstr "未知的哈希算法"
 
 #: builtin/show-ref.c
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<模式>...]"
 
+#: builtin/show-ref.c
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<引用>...]"
+
 #: builtin/show-ref.c
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<模式>]"
 
+#: builtin/show-ref.c
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <引用>"
+
+#: builtin/show-ref.c
+msgid "reference does not exist"
+msgstr "引用不存在"
+
+#: builtin/show-ref.c
+msgid "failed to look up reference"
+msgstr "无法找到引用"
+
 #: builtin/show-ref.c
 msgid "only show tags (can be combined with heads)"
 msgstr "只显示标签(可以和头共用)"
@@ -14645,6 +14801,10 @@ msgstr "只显示标签(可以和头共用)"
 msgid "only show heads (can be combined with tags)"
 msgstr "只显示头(可以和标签共用)"
 
+#: builtin/show-ref.c
+msgid "check for reference existence without resolving"
+msgstr "检查引用是否存在但不解析"
+
 #: builtin/show-ref.c
 msgid "stricter reference checking, requires exact ref path"
 msgstr "更严格的引用检测,需要精确的引用路径"
@@ -15631,6 +15791,10 @@ msgstr ""
 "shallow] [--reference <仓库>] [--recursive] [--[no-]single-branch] [--] [<路"
 "径>...]"
 
+#: builtin/submodule--helper.c submodule.c
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "无法将 HEAD 解析为有效引用。"
+
 #: builtin/submodule--helper.c
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<选项>] [<路径>...]"
@@ -16206,6 +16370,10 @@ msgstr "(for porcelains) 忘记保存的未解决的冲突"
 msgid "write index in this format"
 msgstr "以这种格式写入索引区"
 
+#: builtin/update-index.c
+msgid "report on-disk index format version"
+msgstr "报告磁盘索引格式的版本"
+
 #: builtin/update-index.c
 msgid "enable or disable split index"
 msgstr "启用或禁用索引拆分"
@@ -16238,6 +16406,16 @@ msgstr "标记文件为 fsmonitor 有效"
 msgid "clear fsmonitor valid bit"
 msgstr "清除 fsmonitor 有效位"
 
+#: builtin/update-index.c
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#: builtin/update-index.c
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "索引版本:从 %d 设置为 %d"
+
 #: builtin/update-index.c
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
@@ -16425,30 +16603,30 @@ msgstr "没有可用的源分支,将基于 '--orphan' 选项进行推断"
 #: builtin/worktree.c
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
-"如果你打算为此仓库创建一个包含新的孤立分支\n"
-"(没有提交的分支)的工作区,你可以使用选项\n"
-"--orphan 来执行此操作:\n"
+"如果你打算为此仓库创建一个包含新的未诞生的\n"
+"分支(没有提交的分支)的工作区,你可以使用\n"
+"选项 --orphan 来执行此操作:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 
 #: builtin/worktree.c
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
-"如果你打算为此仓库创建一个包含新的孤立分支\n"
-"(没有提交的分支)的工作区,你可以使用选项\n"
-"--orphan 来执行此操作:\n"
+"如果你打算为此仓库创建一个包含新的未诞生的\n"
+"分支(没有提交的分支)的工作区,你可以使用\n"
+"选项 --orphan 来执行此操作:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 
@@ -16517,6 +16695,11 @@ msgstr "不能创建目录 '%s'"
 msgid "initializing"
 msgstr "初始化"
 
+#: builtin/worktree.c
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "无法找到已创建的工作树 '%s'"
+
 #: builtin/worktree.c
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
@@ -16556,15 +16739,10 @@ msgstr ""
 #: builtin/worktree.c
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
-"尽管已配置远程仓库,但不存在任何本地的或远程的引用,操作终止;\n"
-"请使用 'add -f' 来覆盖或拉取一个远程仓库"
-
-#: builtin/worktree.c
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "'%s' 和 '%s' 不能同时使用"
+"尽管已配置远程仓库,但不存在任何本地的或远程的引用,操作终止。\n"
+"请先使用 'add -f' 来覆盖或拉取一个远程仓库"
 
 #: builtin/worktree.c
 msgid "checkout <branch> even if already checked out in other worktree"
@@ -16579,8 +16757,8 @@ msgid "create or reset a branch"
 msgstr "创建或重置一个分支"
 
 #: builtin/worktree.c
-msgid "create unborn/orphaned branch"
-msgstr "创建一个尚未诞生的/孤立的分支"
+msgid "create unborn branch"
+msgstr "创建一个尚未诞生的分支"
 
 #: builtin/worktree.c
 msgid "populate the new working tree"
@@ -16609,12 +16787,8 @@ msgstr "选项 '%s'、'%s' 和 '%s' 不能同时使用"
 
 #: builtin/worktree.c
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "选项 '%s',与 '%s' 不能同时使用"
-
-#: builtin/worktree.c
-msgid "<commit-ish>"
-msgstr "<提交号>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "选项 '%s' 和提交号不能同时使用"
 
 #: builtin/worktree.c
 msgid "added with --lock"
@@ -16950,6 +17124,11 @@ msgstr "index-pack 终止"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "终止块 ID 比预期更早出现"
 
+#: chunk-format.c
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "块 id %<PRIx32> 未 %d 字节对齐"
+
 #: chunk-format.c
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
@@ -17019,8 +17198,8 @@ msgid "Move objects and refs by archive"
 msgstr "通过归档移动对象和引用"
 
 #: command-list.h
-msgid "Provide content or type and size information for repository objects"
-msgstr "提供仓库对象的内容、类型或大小"
+msgid "Provide contents or details of repository objects"
+msgstr "提供仓库对象的内容或详情"
 
 #: command-list.h
 msgid "Display gitattributes information"
@@ -17399,6 +17578,10 @@ msgstr "打包仓库中未打包对象"
 msgid "Create, list, delete refs to replace objects"
 msgstr "创建、列出、删除对象替换引用"
 
+#: command-list.h
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr "试验中:基于一个新基线重放提交,同样适用于纯仓库"
+
 #: command-list.h
 msgid "Generates a summary of pending changes"
 msgstr "生成待定更改的摘要"
@@ -17561,7 +17744,7 @@ msgid "Display version information about Git"
 msgstr "显示关于 Git 的版本信息"
 
 #: command-list.h
-msgid "Show logs with difference each commit introduces"
+msgid "Show logs with differences each commit introduces"
 msgstr "显示每一个提交引入的差异日志"
 
 #: command-list.h
@@ -17714,53 +17897,104 @@ msgstr "一个管理大型 Git 仓库的工具"
 
 #: commit-graph.c
 msgid "commit-graph file is too small"
-msgstr "提交图形文件太小"
+msgstr "提交图文件太小"
+
+#: commit-graph.c
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "提交图中对象 ID 的扇出块大小错误"
+
+#: commit-graph.c
+msgid "commit-graph fanout values out of order"
+msgstr "提交图的扇出值失序"
+
+#: commit-graph.c
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "提交图的对象 ID 查询块大小错误"
+
+#: commit-graph.c
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "提交图的提交数据块大小错误"
+
+#: commit-graph.c
+msgid "commit-graph generations chunk is wrong size"
+msgstr "提交图的世代块大小错误"
+
+#: commit-graph.c
+msgid "commit-graph changed-path index chunk is too small"
+msgstr "提交图的变更路径的索引块太小"
+
+#: commit-graph.c
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr "忽略提交图文件中过小的更改路径块(%<PRIuMAX> < %<PRIuMAX>)"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph signature %X does not match signature %X"
-msgstr "提交图签名 %X 和签名 %X 不匹配"
+msgstr "提交图签名 %X 和签名 %X 不匹配"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph version %X does not match version %X"
-msgstr "提交图版本 %X 和版本 %X 不匹配"
+msgstr "提交图版本 %X 和版本 %X 不匹配"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph hash version %X does not match version %X"
-msgstr "æ\8f\90交å\9b¾å½¢å\93\88å¸\8cç\89\88æ\9c¬ %X å\92\8cç\89\88æ\9c¬ %X ä¸\8då\8c¹é\85\8d"
+msgstr "提交图哈希版本 %X 和版本 %X 不匹配"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph file is too small to hold %u chunks"
-msgstr "提交图形文件太小,容不下 %u 个块"
+msgstr "提交图文件太小,容不下 %u 个块"
+
+#: commit-graph.c
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr "提交图所需的对象 ID 扇出块缺失或损坏"
+
+#: commit-graph.c
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr "提交图所需的对象 ID 查询块缺失或损坏"
+
+#: commit-graph.c
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr "提交图所需的提交数据块缺失或损坏"
 
 #: commit-graph.c
 msgid "commit-graph has no base graphs chunk"
-msgstr "提交图形没有基础图形块"
+msgstr "提交图没有基础图形块"
+
+#: commit-graph.c
+msgid "commit-graph base graphs chunk is too small"
+msgstr "提交图的基础图形块过小"
 
 #: commit-graph.c
 msgid "commit-graph chain does not match"
-msgstr "提交图链不匹配"
+msgstr "提交图链不匹配"
 
 #: commit-graph.c
 #, c-format
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "基础图形中的提交数量过高:%<PRIuMAX>"
 
+#: commit-graph.c
+msgid "commit-graph chain file too small"
+msgstr "提交图链文件太小"
+
 #: commit-graph.c
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
-msgstr "无效的提交图链:行 '%s' 不是一个哈希值"
+msgstr "无效的提交图链:行 '%s' 不是一个哈希值"
 
 #: commit-graph.c
 msgid "unable to find all commit-graph files"
-msgstr "无法找到所有提交图文件"
+msgstr "无法找到所有提交图文件"
 
 #: commit-graph.c
 msgid "invalid commit position. commit-graph is likely corrupt"
-msgstr "æ\97 æ\95\88ç\9a\84æ\8f\90交ä½\8dç½®ã\80\82æ\8f\90交å\9b¾å½¢å\8f¯è\83½å·²æ\8d\9få\9d\8f"
+msgstr "无效的提交位置。提交图可能已损坏"
 
 #: commit-graph.c
 #, c-format
@@ -17771,6 +18005,14 @@ msgstr "无法找到提交 %s"
 msgid "commit-graph requires overflow generation data but has none"
 msgstr "提交图需要溢出世代数据,但是没有"
 
+#: commit-graph.c
+msgid "commit-graph overflow generation data is too small"
+msgstr "提交图溢出世代数据过小"
+
+#: commit-graph.c
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "提交图额外边的指针越界"
+
 #: commit-graph.c
 msgid "Loading known commits in commit graph"
 msgstr "正在加载提交图中的已知提交"
@@ -17846,26 +18088,25 @@ msgstr[1] "正在用 %d 步写出提交图"
 
 #: commit-graph.c
 msgid "unable to open commit-graph chain file"
-msgstr "无法打开提交图链文件"
+msgstr "无法打开提交图链文件"
 
 #: commit-graph.c
 msgid "failed to rename base commit-graph file"
-msgstr "无法重命名基础提交图文件"
+msgstr "无法重命名基础提交图文件"
 
 #: commit-graph.c
 msgid "failed to rename temporary commit-graph file"
-msgstr "无法重命名临时提交图文件"
+msgstr "无法重命名临时提交图文件"
 
 #: commit-graph.c
 #, c-format
 msgid "cannot merge graphs with %<PRIuMAX>, %<PRIuMAX> commits"
-msgstr ""
-"无法合并提交图形,总共已累加提交数:%<PRIuMAX>,当前待累加提交数:%<PRIuMAX>"
+msgstr "无法合并提交图,总共已累加提交数:%<PRIuMAX>,当前待累加提交数:%<PRIuMAX>"
 
 #: commit-graph.c
 #, c-format
 msgid "cannot merge graph %s, too many commits: %<PRIuMAX>"
-msgstr "无法合并提交图 %s, 提交过多:%<PRIuMAX>"
+msgstr "无法合并提交图 %s, 提交过多:%<PRIuMAX>"
 
 #: commit-graph.c
 msgid "Scanning merged commits"
@@ -17873,7 +18114,7 @@ msgstr "正在扫描合并提交"
 
 #: commit-graph.c
 msgid "Merging commit-graph"
-msgstr "正在合并提交图"
+msgstr "正在合并提交图"
 
 #: commit-graph.c
 msgid "attempting to write a commit-graph, but 'core.commitGraph' is disabled"
@@ -17890,64 +18131,59 @@ msgstr "提交图文件的校验码错误,可能已经损坏"
 #: commit-graph.c
 #, c-format
 msgid "commit-graph has incorrect OID order: %s then %s"
-msgstr "提交图的对象 ID 顺序不正确:%s 然后 %s"
+msgstr "提交图的对象 ID 顺序不正确:%s 然后 %s"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph has incorrect fanout value: fanout[%d] = %u != %u"
-msgstr "提交图有不正确的扇出值:fanout[%d] = %u != %u"
+msgstr "提交图有不正确的扇出值:fanout[%d] = %u != %u"
 
 #: commit-graph.c
 #, c-format
 msgid "failed to parse commit %s from commit-graph"
-msgstr "无法从提交图中解析提交 %s"
+msgstr "无法从提交图中解析提交 %s"
 
 #: commit-graph.c
 #, c-format
 msgid "failed to parse commit %s from object database for commit-graph"
-msgstr "无法从提交图的对象库中解析提交 %s"
+msgstr "无法从提交图的对象库中解析提交 %s"
 
 #: commit-graph.c
 #, c-format
 msgid "root tree OID for commit %s in commit-graph is %s != %s"
-msgstr "提交图中的提交 %s 的根树对象 ID 是 %s != %s"
+msgstr "提交图中的提交 %s 的根树对象 ID 是 %s != %s"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph parent list for commit %s is too long"
-msgstr "提交 %s 的提交图父提交列表太长了"
+msgstr "提交 %s 的提交图父提交列表太长了"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph parent for %s is %s != %s"
-msgstr "%s 的提交图父提交是 %s != %s"
+msgstr "%s 的提交图父提交是 %s != %s"
 
 #: commit-graph.c
 #, c-format
 msgid "commit-graph parent list for commit %s terminates early"
-msgstr "提交 %s 的提交图形父提交列表过早终止"
-
-#: commit-graph.c
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr "提交图形中提交 %s 的世代号是零,但其它地方非零"
+msgstr "提交 %s 的提交图父提交列表过早终止"
 
 #: commit-graph.c
 #, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr "提交图形中提交 %s 的世代号非零,但其它地方是零"
+msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
+msgstr "提交图中的提交 %s 的世代号是 %<PRIuMAX> < %<PRIuMAX>"
 
 #: commit-graph.c
 #, c-format
-msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
-msgstr "提交图形中的提交 %s 的世代号是 %<PRIuMAX> < %<PRIuMAX>"
+msgid "commit date for commit %s in commit-graph is %<PRIuMAX> != %<PRIuMAX>"
+msgstr "提交图中提交 %s 的提交日期是 %<PRIuMAX> != %<PRIuMAX>"
 
 #: commit-graph.c
 #, c-format
-msgid "commit date for commit %s in commit-graph is %<PRIuMAX> != %<PRIuMAX>"
-msgstr "提交图形中提交 %s 的提交日期是 %<PRIuMAX> != %<PRIuMAX>"
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr "提交图具有零和非零的世代(例如:提交 '%s' 和 '%s')"
 
 #: commit-graph.c
 msgid "Verifying commits in commit graph"
@@ -17978,6 +18214,11 @@ msgstr ""
 "设置 \"git config advice.graftFileDeprecated false\"\n"
 "可关闭本消息"
 
+#: commit.c
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr "提交 %s 存在于提交图中,但不存在于对象数据库中"
+
 #: commit.c
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
@@ -18521,11 +18762,6 @@ msgstr "引用 '%s' 没有指向一个数据对象"
 msgid "unable to resolve config blob '%s'"
 msgstr "不能解析配置对象 '%s'"
 
-#: config.c
-#, c-format
-msgid "failed to parse %s"
-msgstr "无法解析 %s"
-
 #: config.c
 msgid "unable to parse command-line config"
 msgstr "无法解析命令行中的配置"
@@ -19093,10 +19329,6 @@ msgstr "无法写入归档"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base 不适用于范围"
 
-#: diff-lib.c
-msgid "--merge-base only works with commits"
-msgstr "--merge-base 仅适用于提交"
-
 #: diff-lib.c
 msgid "unable to get HEAD"
 msgstr "不能解析 HEAD"
@@ -19167,6 +19399,11 @@ msgstr "color-moved-ws:allow-indentation-change 不能与其它空白字符模
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr "配置变量 'diff.submodule' 未知的取值:'%s'"
 
+#: diff.c transport.c
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "配置 '%s' 未知的取值:%s"
+
 #: diff.c
 #, c-format
 msgid ""
@@ -19260,13 +19497,6 @@ msgstr "坏的 --color-moved 参数:%s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "--color-moved-ws 中的无效模式 '%s' "
 
-#: diff.c
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"diff-algorithm 选项有 \"myers\"、\"minimal\"、\"patience\" 和 \"histogram\""
-
 #: diff.c
 #, c-format
 msgid "invalid argument to %s"
@@ -19324,8 +19554,8 @@ msgid "output only the last line of --stat"
 msgstr "只输出 --stat 的最后一行"
 
 #: diff.c
-msgid "<param1,param2>..."
-msgstr "<参数1,参数2>..."
+msgid "<param1>,<param2>..."
+msgstr "<参数1>,<参数2>..."
 
 #: diff.c
 msgid ""
@@ -19337,8 +19567,8 @@ msgid "synonym for --dirstat=cumulative"
 msgstr "和 --dirstat=cumulative 同义"
 
 #: diff.c
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "是 --dirstat=files,param1,param2... 的同义词"
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "是 --dirstat=files,<参数1>,<参数2>... 的同义词"
 
 #: diff.c
 msgid "warn if changes introduce conflict markers or whitespace errors"
@@ -19560,14 +19790,6 @@ msgstr "使用 \"patience diff\" 算法生成差异"
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "使用 \"histogram diff\" 算法生成差异"
 
-#: diff.c
-msgid "<algorithm>"
-msgstr "<算法>"
-
-#: diff.c
-msgid "choose a diff algorithm"
-msgstr "选择一个差异算法"
-
 #: diff.c
 msgid "<text>"
 msgstr "<文本>"
@@ -20820,12 +21042,12 @@ msgstr ""
 "%s"
 
 #: merge-ort.c merge-recursive.c
-msgid "Failed to execute internal merge"
+msgid "failed to execute internal merge"
 msgstr "无法执行内部合并"
 
 #: merge-ort.c merge-recursive.c
 #, c-format
-msgid "Unable to add %s to database"
+msgid "unable to add %s to database"
 msgstr "不能添加 %s 至对象库"
 
 #: merge-ort.c merge-recursive.c
@@ -21321,7 +21543,21 @@ msgstr "无法读取缓存"
 
 #: midx.c
 msgid "multi-pack-index OID fanout is of the wrong size"
-msgstr "多包索引的对象ID扇出表大小错误"
+msgstr "多包索引的对象 ID 扇出表大小错误"
+
+#: midx.c
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr "对象 ID 扇出失序:fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+
+#: midx.c
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "多包索引的对象 ID 查询块大小错误"
+
+#: midx.c
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr "多包索引的对象 ID 偏移块大小错误"
 
 #: midx.c
 #, c-format
@@ -21344,20 +21580,24 @@ msgid "multi-pack-index hash version %u does not match version %u"
 msgstr "多包索引哈希版本 %u 和版本 %u 不匹配"
 
 #: midx.c
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "多包索引缺少必需的包名块"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr "多包索引必需的包名块缺失或损坏"
+
+#: midx.c
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr "多包索引必需的对象 ID 扇出块缺失或损坏"
 
 #: midx.c
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "多包索引缺少必需的对象 ID 扇出块"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr "多包索引必需的对象 ID 查询块缺失或损坏"
 
 #: midx.c
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "多包索引缺少必需的对象 ID 查询块"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr "多包索引必需的对象偏移块缺少或损坏"
 
 #: midx.c
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "多包索引缺少必需的对象偏移块"
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "多包索引包名块过短"
 
 #: midx.c
 #, c-format
@@ -21369,10 +21609,23 @@ msgstr "多包索引包名无序:'%s' 在 '%s' 之前"
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "错的 pack-int-id:%u(共有 %u 个包)"
 
+#: midx.c
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "多包索引中未包含 BTMP 块"
+
+#: midx.c
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "不能打开已被位图索引的包 %<PRIu32>"
+
 #: midx.c
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr "多包索引存储一个64位偏移,但是 off_t 太小"
 
+#: midx.c
+msgid "multi-pack-index large offset out of bounds"
+msgstr "多包索引大偏移区越界"
+
 #: midx.c
 #, c-format
 msgid "failed to add packfile '%s'"
@@ -21472,12 +21725,6 @@ msgstr "不正确的校验码"
 msgid "Looking for referenced packfiles"
 msgstr "正在查找引用的包文件"
 
-#: midx.c
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr "对象 ID 扇出无序:fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-
 #: midx.c
 msgid "the midx contains no oid"
 msgstr "midx 不包含 oid"
@@ -22107,6 +22354,10 @@ msgstr "多包位图缺少必需的反向索引"
 msgid "could not open pack %s"
 msgstr "不能打开包 %s"
 
+#: pack-bitmap.c t/helper/test-read-midx.c
+msgid "could not determine MIDX preferred pack"
+msgstr "不能确定多包索引的首选包"
+
 #: pack-bitmap.c
 #, c-format
 msgid "preferred pack (%s) is invalid"
@@ -22130,6 +22381,11 @@ msgstr "损坏的位图查询表:提交索引 %u 超出范围"
 msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
 msgstr "损坏的 EWAH 位图:提交 \"%s\" 位图的文件头被截断"
 
+#: pack-bitmap.c
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr "无法打开包:'%s',禁用包重用"
+
 #: pack-bitmap.c
 #, c-format
 msgid "object '%s' not found in type bitmaps"
@@ -22241,6 +22497,14 @@ msgstr "无效的校验码 %s"
 msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr "位于 %<PRIu64> 的无效的反向索引:%<PRIu32> != %<PRIu32>"
 
+#: pack-revindex.c
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr "多包索引的反向索引块大小错误"
+
+#: pack-revindex.c
+msgid "could not determine preferred pack"
+msgstr "无法确定首选包"
+
 #: pack-write.c
 msgid "cannot both write and verify reverse index"
 msgstr "无法同时写入和校验反向索引"
@@ -22304,16 +22568,6 @@ msgstr "选项 `%s' 期望 \"%s\" 或 \"%s\""
 msgid "%s requires a value"
 msgstr "%s 需要一个值"
 
-#: parse-options.c
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s 与 %s 不兼容"
-
-#: parse-options.c
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s:和其它的不兼容"
-
 #: parse-options.c
 #, c-format
 msgid "%s takes no value"
@@ -22414,6 +22668,11 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-数字"
 
+#: parse-options.c
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "与 --no-%s 相反"
+
 #: parse-options.h
 msgid "expiry-date"
 msgstr "到期时间"
@@ -22451,6 +22710,16 @@ msgid ""
 "with --pathspec-from-file, pathspec elements are separated with NUL character"
 msgstr "使用 --pathspec-from-file,路径表达式用空字符分隔"
 
+#: parse.c
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "对于 '%2$s' 的错误的布尔环境取值 '%1$s'"
+
+#: parse.c
+#, c-format
+msgid "failed to parse %s"
+msgstr "无法解析 %s"
+
 #: path.c
 #, c-format
 msgid "Could not make %s writable by group"
@@ -22507,6 +22776,11 @@ msgstr "路径规格 '%2$s' 中包含未实现的神奇前缀 '%1$c'"
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s:'literal' 和 'glob' 不兼容"
 
+#: pathspec.c
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "'%s' 位于目录树之外"
+
 #: pathspec.c
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
@@ -22698,11 +22972,6 @@ msgstr "无法索引文件 '%s'"
 msgid "unable to add '%s' to index"
 msgstr "无法在索引中添加 '%s'"
 
-#: read-cache.c
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "无法对 %s 执行 stat"
-
 #: read-cache.c
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
@@ -22836,11 +23105,6 @@ msgstr "无法为稀疏索引写入拆分索引"
 msgid "failed to convert to a sparse-index"
 msgstr "无法转换为稀疏索引"
 
-#: read-cache.c
-#, c-format
-msgid "could not stat '%s'"
-msgstr "不能对 '%s' 调用 stat"
-
 #: read-cache.c
 #, c-format
 msgid "unable to open git dir: %s"
@@ -23382,17 +23646,12 @@ msgstr "'%s' 已存在,无法创建 '%s'"
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "无法同时处理 '%s' 和 '%s'"
 
-#: refs/files-backend.c
-#, c-format
-msgid "could not remove reference %s"
-msgstr "无法删除引用 %s"
-
-#: refs/files-backend.c refs/packed-backend.c
+#: refs.c
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "无法删除引用 %s:%s"
 
-#: refs/files-backend.c refs/packed-backend.c
+#: refs.c
 #, c-format
 msgid "could not delete references: %s"
 msgstr "无法删除引用:%s"
@@ -24067,8 +24326,16 @@ msgid "only download metadata for the branch that will be checked out"
 msgstr "只下载要检出的分支的元信息"
 
 #: scalar.c
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<选项>] [--] <仓库> [<目录>]"
+msgid "create repository within 'src' directory"
+msgstr "在 'src' 目录中创建仓库"
+
+#: scalar.c
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<登记>]"
 
 #: scalar.c
 #, c-format
@@ -24134,13 +24401,32 @@ msgstr "无法删除过期的 scalar.repo '%s'"
 
 #: scalar.c
 #, c-format
-msgid "removing stale scalar.repo '%s'"
-msgstr "正在删除过期的 scalar.repo '%s'"
+msgid "removed stale scalar.repo '%s'"
+msgstr "已删除过期的 scalar.repo '%s'"
+
+#: scalar.c
+#, c-format
+msgid "repository at '%s' has different owner"
+msgstr "位于 '%s' 处的仓库有不同的所有者"
 
 #: scalar.c
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "在 '%s' 的 git 仓库已消失"
+msgid "repository at '%s' has a format issue"
+msgstr "位于 '%s' 处的仓库存在格式问题"
+
+#: scalar.c
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "在 '%s' 中找不到仓库"
+
+#: scalar.c
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"若希望从 Scalar 注销该仓库,执行\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 #: scalar.c
 msgid ""
@@ -24520,7 +24806,7 @@ msgstr "无效的作者身份 '%s'"
 msgid "corrupt author: missing date information"
 msgstr "损坏的作者:缺失日期信息"
 
-#: sequencer.c t/helper/test-fast-rebase.c
+#: sequencer.c
 #, c-format
 msgid "could not update %s"
 msgstr "不能更新 %s"
@@ -24615,11 +24901,6 @@ msgstr "不能得到 %s 的提交说明"
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s:不能解析父提交 %s"
 
-#: sequencer.c
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "不能将 '%s' 重命名为 '%s'"
-
 #: sequencer.c
 #, c-format
 msgid "could not revert %s... %s"
@@ -25015,6 +25296,10 @@ msgstr "应用自动贮藏导致冲突。"
 msgid "Autostash exists; creating a new stash entry."
 msgstr "自动贮藏已经存在;正在创建一个新的贮藏条目。"
 
+#: sequencer.c
+msgid "autostash reference is a symref"
+msgstr "自动贮藏的引用是一个符号引用"
+
 #: sequencer.c
 msgid "could not detach HEAD"
 msgstr "不能分离头指针"
@@ -25051,13 +25336,13 @@ msgstr ""
 
 #: sequencer.c
 #, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "正在变基(%d/%d)%s"
+msgid "Stopped at %s...  %.*s\n"
+msgstr "停止在 %s... %.*s\n"
 
 #: sequencer.c
 #, c-format
-msgid "Stopped at %s...  %.*s\n"
-msgstr "停止在 %s... %.*s\n"
+msgid "Rebasing (%d/%d)%s"
+msgstr "正在变基(%d/%d)%s"
 
 #: sequencer.c
 #, c-format
@@ -25389,6 +25674,11 @@ msgstr "没有从 '%s' 复制模版:%s"
 msgid "invalid initial branch name: '%s'"
 msgstr "无效的初始分支名:'%s'"
 
+#: setup.c
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-init:已忽略 --initial-branch=%s"
+
 #: setup.c
 #, c-format
 msgid "unable to handle file type %d"
@@ -25404,14 +25694,14 @@ msgid "attempt to reinitialize repository with different hash"
 msgstr "尝试用不同的哈希算法重新初始化仓库"
 
 #: setup.c
-#, c-format
-msgid "%s already exists"
-msgstr "%s 已经存在"
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr "尝试使用不同的引用存储格式重新初始化仓库"
 
 #: setup.c
 #, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-init:已忽略 --initial-branch=%s"
+msgid "%s already exists"
+msgstr "%s 已经存在"
 
 #: setup.c
 #, c-format
@@ -25729,14 +26019,6 @@ msgstr "在每次迭代前清除缓存树"
 msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr "缓存树中无效化的条目数量(默认 0)"
 
-#: t/helper/test-fast-rebase.c
-msgid "unhandled options"
-msgstr "未处理的选项"
-
-#: t/helper/test-fast-rebase.c
-msgid "error preparing revisions"
-msgstr "准备版本时错误"
-
 #: t/helper/test-reach.c
 #, c-format
 msgid "commit %s is not marked reachable"
@@ -25930,10 +26212,6 @@ msgstr "协议不支持设置远程服务路径"
 msgid "invalid remote service path"
 msgstr "无效的远程服务路径"
 
-#: transport-helper.c transport.c
-msgid "operation not supported by protocol"
-msgstr "协议不支持该操作"
-
 #: transport-helper.c
 #, c-format
 msgid "can't connect to subservice %s"
@@ -26097,11 +26375,6 @@ msgstr "不能解析 transport.color.* 配置"
 msgid "support for protocol v2 not implemented yet"
 msgstr "协议 v2 的支持尚未实现"
 
-#: transport.c
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "配置 '%s' 的取值未知:%s"
-
 #: transport.c
 #, c-format
 msgid "transport '%s' not allowed"
@@ -26161,6 +26434,10 @@ msgstr "协议不支持 bundle-uri 操作"
 msgid "could not retrieve server-advertised bundle-uri list"
 msgstr "无法获取服务器公布的 bundle-uri 列表"
 
+#: transport.c
+msgid "operation not supported by protocol"
+msgstr "协议不支持该操作"
+
 #: tree-walk.c
 msgid "too-short tree object"
 msgstr "太短的树对象"
@@ -26613,6 +26890,10 @@ msgstr "不能访问 '%s'"
 msgid "unable to get current working directory"
 msgstr "不能获取当前工作目录"
 
+#: wrapper.c
+msgid "unable to get random bytes"
+msgstr "无法获取随机字节"
+
 #: wt-status.c
 msgid "Unmerged paths:"
 msgstr "未合并的路径:"
@@ -27185,6 +27466,11 @@ msgstr "另外,您的索引中包含未提交的变更。"
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "不能%s:您的索引中包含未提交的变更。"
 
+#: xdiff-interface.c
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "'%2$s' 的未知风格取值 '%1$s'"
+
 #: git-merge-octopus.sh git-merge-resolve.sh
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
@@ -27401,13 +27687,13 @@ msgstr ""
 
 #: git-send-email.perl
 #, perl-format
-msgid "Failed to open %s: %s"
-msgstr "无法打开 %s: %s"
+msgid "Failed to open %s.final: %s"
+msgstr "无法打开 %s.final: %s"
 
 #: git-send-email.perl
 #, perl-format
-msgid "Failed to open %s.final: %s"
-msgstr "无法打开 %s.final: %s"
+msgid "Failed to open %s: %s"
+msgstr "无法打开 %s: %s"
 
 #: git-send-email.perl
 msgid "Summary email is empty, skipping it\n"
index 6ae75e7e19f7db0fd7e2bec03619f616efb2734b..312dd128a41163e63869696369138c93aefa43d9 100644 (file)
@@ -1,7 +1,7 @@
 # Chinese (traditional) translations for Git package
 # Git 套裝軟體的繁體中文翻譯。
 # Copyright (C) 2012-2021 Jiang Xin <worldhello.net AT gmail.com>
-# Copyright (C) 2019-2022 Yi-Jyun Pan <pan93412@gmail.com>
+# Copyright (C) 2019-2023 Yi-Jyun Pan <pan93412@gmail.com>
 # This file is distributed under the same license as the Git package.
 #
 # The glossary can be found on https://github.com/l10n-tw/git-glossary
 # - Yichao Yu <yyc1992 AT gmail.com>
 # - Zhuang Ya <zhuangya AT me.com>
 #
-# Yi-Jyun Pan <pan93412@gmail.com>, 2021, 2022, 2023.
+# Yi-Jyun Pan <pan93412@gmail.com>, 2021, 2022, 2023, 2024.
 # Kaiyang Wu <self@origincode.me>, 2022.
-# lumynou5 <lumynou5.tw@gmail.com>, 2023.
+# lumynou5 <lumynou5.tw@gmail.com>, 2023, 2024.
 msgid ""
 msgstr ""
 "Project-Id-Version: Git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2023-08-20 21:51+0800\n"
-"PO-Revision-Date: 2023-08-20 21:58+0800\n"
+"POT-Creation-Date: 2024-02-18 20:48+0800\n"
+"PO-Revision-Date: 2024-02-18 20:50+0800\n"
 "Last-Translator: Yi-Jyun Pan <pan93412@gmail.com>\n"
 "Language-Team: Chinese (Traditional) <http://weblate.slat.org/projects/git-"
 "po/git-cli/zh_Hant/>\n"
@@ -36,7 +36,7 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Poedit 3.3.2\n"
+"X-Generator: Poedit 3.4.2\n"
 "X-ZhConverter: 繁化姬 dict-f4bc617e-r910 @ 2019/11/16 20:23:12 | https://"
 "zhconvert.org\n"
 
@@ -910,7 +910,7 @@ msgid "unclosed quote"
 msgstr "未閉合的引號"
 
 #: alias.c builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
-#: builtin/receive-pack.c builtin/tag.c
+#: builtin/receive-pack.c builtin/tag.c t/helper/test-pkt-line.c
 msgid "too many arguments"
 msgstr "引數過多"
 
@@ -924,14 +924,16 @@ msgstr "空白字元選項 “%s” 無法識別"
 msgid "unrecognized whitespace ignore option '%s'"
 msgstr "空白字元忽略選項 “%s” 無法識別"
 
-#: apply.c archive.c builtin/add.c builtin/branch.c builtin/checkout.c
-#: builtin/clone.c builtin/commit.c builtin/describe.c builtin/diff-tree.c
-#: builtin/difftool.c builtin/fast-export.c builtin/fetch.c builtin/help.c
-#: builtin/index-pack.c builtin/init-db.c builtin/log.c builtin/ls-files.c
-#: builtin/merge-base.c builtin/merge.c builtin/pack-objects.c builtin/push.c
-#: builtin/rebase.c builtin/repack.c builtin/reset.c builtin/rev-list.c
-#: builtin/show-branch.c builtin/stash.c builtin/submodule--helper.c
-#: builtin/tag.c builtin/worktree.c parse-options.c range-diff.c revision.c
+#: apply.c archive.c builtin/add.c builtin/branch.c builtin/checkout-index.c
+#: builtin/checkout.c builtin/clean.c builtin/clone.c builtin/commit.c
+#: builtin/describe.c builtin/diff-tree.c builtin/difftool.c
+#: builtin/fast-export.c builtin/fetch.c builtin/help.c builtin/index-pack.c
+#: builtin/init-db.c builtin/log.c builtin/ls-files.c builtin/merge-base.c
+#: builtin/merge-tree.c builtin/merge.c builtin/pack-objects.c builtin/rebase.c
+#: builtin/repack.c builtin/replay.c builtin/reset.c builtin/rev-list.c
+#: builtin/rev-parse.c builtin/show-branch.c builtin/stash.c
+#: builtin/submodule--helper.c builtin/tag.c builtin/worktree.c parse-options.c
+#: range-diff.c revision.c
 #, c-format
 msgid "options '%s' and '%s' cannot be used together"
 msgstr "無法同時使用 “%s” 和 “%s” 選項"
@@ -1239,12 +1241,12 @@ msgstr "%s:已存在於工作區中"
 #: apply.c
 #, c-format
 msgid "new mode (%o) of %s does not match old mode (%o)"
-msgstr "%2$s 的新模式 (%1$o) 和舊模式 (%3$o) 不符"
+msgstr "%2$s 的新模式(%1$o)和舊模式(%3$o)不符"
 
 #: apply.c
 #, c-format
 msgid "new mode (%o) of %s does not match old mode (%o) of %s"
-msgstr "%2$s 的新模式 (%1$o) 和 %4$s 的舊模式 (%3$o) 不符"
+msgstr "%2$s 的新模式(%1$o)和 %4$s 的舊模式(%3$o)不符"
 
 #: apply.c
 #, c-format
@@ -1402,7 +1404,7 @@ msgid "%d line applied after fixing whitespace errors."
 msgid_plural "%d lines applied after fixing whitespace errors."
 msgstr[0] "修正空白誤用後,套用了 %d 列。"
 
-#: apply.c builtin/add.c builtin/mv.c builtin/rm.c
+#: apply.c builtin/mv.c builtin/rm.c
 msgid "Unable to write new index file"
 msgstr "無法寫入新索引檔案"
 
@@ -1731,6 +1733,11 @@ msgstr "“%s” 選項需要 “%s”"
 msgid "Unexpected option --output"
 msgstr "非預期選項 --output"
 
+#: archive.c
+#, c-format
+msgid "extra command line parameter '%s'"
+msgstr "多出命令列參數 “%s”"
+
 #: archive.c
 #, c-format
 msgid "Unknown archive format '%s'"
@@ -1787,6 +1794,17 @@ msgstr "忽略過大的 gitattributes 資料物件 “%s”"
 msgid "bad --attr-source or GIT_ATTR_SOURCE"
 msgstr "無效的 --attr-source 或 GIT_ATTR_SOURCE"
 
+#: attr.c read-cache.c
+#, c-format
+msgid "unable to stat '%s'"
+msgstr "無法對 %s 執行 stat"
+
+#: bisect.c builtin/cat-file.c builtin/index-pack.c builtin/notes.c
+#: builtin/pack-objects.c combine-diff.c rerere.c
+#, c-format
+msgid "unable to read %s"
+msgstr "不能讀 %s"
+
 #: bisect.c
 #, c-format
 msgid "Badly quoted content in file '%s': %s"
@@ -2106,8 +2124,8 @@ msgstr "“%s” 子模組:無法建立 “%s” 分支"
 
 #: branch.c
 #, c-format
-msgid "'%s' is already checked out at '%s'"
-msgstr "“%s” 已在 “%s” 點簽出"
+msgid "'%s' is already used by worktree at '%s'"
+msgstr "“%s” 已被位於 “%s” 的工作區使用"
 
 #: builtin/add.c
 msgid "git add [<options>] [--] <pathspec>..."
@@ -2130,30 +2148,26 @@ msgstr ""
 "add.interactive.useBuiltin 設定已被移除!\n"
 "深入了解請參閱 “git help config” 中的對應條目。"
 
-#: builtin/add.c builtin/rev-parse.c
-msgid "Could not read the index"
-msgstr "無法讀取索引"
-
 #: builtin/add.c
-msgid "Could not write patch"
-msgstr "無法寫入修補檔"
+msgid "could not read the index"
+msgstr "無法讀取索引"
 
 #: builtin/add.c
 msgid "editing patch failed"
 msgstr "編輯修補檔失敗"
 
-#: builtin/add.c
+#: builtin/add.c read-cache.c
 #, c-format
-msgid "Could not stat '%s'"
-msgstr "不能對 “%s” 執行 stat"
+msgid "could not stat '%s'"
+msgstr "不能對 '%s' 呼叫 stat"
 
 #: builtin/add.c
-msgid "Empty patch. Aborted."
-msgstr "修補檔空白。中止"
+msgid "empty patch. aborted"
+msgstr "修補檔空白。中止"
 
 #: builtin/add.c
 #, c-format
-msgid "Could not apply '%s'"
+msgid "could not apply '%s'"
 msgstr "無法套用 “%s”"
 
 #: builtin/add.c
@@ -2315,14 +2329,19 @@ msgstr ""
 msgid "index file corrupt"
 msgstr "索引檔案損壞"
 
+#: builtin/add.c builtin/am.c builtin/checkout.c builtin/clone.c
+#: builtin/commit.c builtin/stash.c merge.c rerere.c
+msgid "unable to write new index file"
+msgstr "無法寫入新的索引檔案"
+
 #: builtin/am.c builtin/mailinfo.c mailinfo.c
 #, c-format
 msgid "bad action '%s' for '%s'"
 msgstr "“%s” 動作對 “%s” 無效"
 
 #: builtin/am.c builtin/blame.c builtin/fetch.c builtin/pack-objects.c
-#: builtin/pull.c diff-merges.c gpg-interface.c ls-refs.c parallel-checkout.c
-#: sequencer.c setup.c
+#: builtin/pull.c config.c diff-merges.c gpg-interface.c ls-refs.c
+#: parallel-checkout.c sequencer.c setup.c
 #, c-format
 msgid "invalid value for '%s': '%s'"
 msgstr "“%s” 的值無效:“%s”"
@@ -2475,8 +2494,7 @@ msgstr "git write-tree 無法寫入樹狀物件"
 msgid "applying to an empty history"
 msgstr "正在套用至空白歷史記錄上"
 
-#: builtin/am.c builtin/commit.c builtin/merge.c sequencer.c
-#: t/helper/test-fast-rebase.c
+#: builtin/am.c builtin/commit.c builtin/merge.c builtin/replay.c sequencer.c
 msgid "failed to write commit object"
 msgstr "無法寫入提交物件"
 
@@ -2565,11 +2583,6 @@ msgstr ""
 "您應該對已經解決衝突的每一個檔案執行 `git add`,標記為已經完成。\n"
 "你可以對「由他們刪除」的檔案,執行 `git rm` 指令。"
 
-#: builtin/am.c builtin/checkout.c builtin/clone.c builtin/stash.c merge.c
-#: rerere.c
-msgid "unable to write new index file"
-msgstr "無法寫入新的索引檔案"
-
 #: builtin/am.c builtin/reset.c
 #, c-format
 msgid "Could not parse object '%s'."
@@ -2592,11 +2605,6 @@ msgstr ""
 msgid "failed to read '%s'"
 msgstr "無法讀取 “%s”"
 
-#: builtin/am.c
-#, c-format
-msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "“%s=%s” 和 “%s=%s” 選項不得同時使用"
-
 #: builtin/am.c
 msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
 msgstr "git am [<options>] [(<mbox> | <Maildir>)...]"
@@ -2669,8 +2677,9 @@ msgid "n"
 msgstr "n"
 
 #: builtin/am.c builtin/branch.c builtin/bugreport.c builtin/cat-file.c
-#: builtin/diagnose.c builtin/for-each-ref.c builtin/ls-files.c
-#: builtin/ls-tree.c builtin/replace.c builtin/tag.c builtin/verify-tag.c
+#: builtin/clone.c builtin/diagnose.c builtin/for-each-ref.c builtin/init-db.c
+#: builtin/ls-files.c builtin/ls-tree.c builtin/replace.c builtin/tag.c
+#: builtin/verify-tag.c
 msgid "format"
 msgstr "format"
 
@@ -2800,10 +2809,10 @@ msgstr "git archive:預期收到 flush 封包"
 
 #: builtin/bisect.c
 msgid ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 msgstr ""
-"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]    [--no-"
+"git bisect start [--term-(new|bad)=<term> --term-(old|good)=<term>]    [--no-"
 "checkout] [--first-parent] [<bad> [<good>...]] [--]    [<pathspec>...]"
 
 #: builtin/bisect.c
@@ -2823,8 +2832,8 @@ msgid "git bisect replay <logfile>"
 msgstr "git bisect replay <logfile>"
 
 #: builtin/bisect.c
-msgid "git bisect run <cmd>..."
-msgstr "git bisect run <cmd>..."
+msgid "git bisect run <cmd> [<arg>...]"
+msgstr "git bisect run <cmd> [<arg>...]"
 
 #: builtin/bisect.c
 #, c-format
@@ -3343,37 +3352,38 @@ msgstr "git branch [<options>] [-r | -a] [--format]"
 #, c-format
 msgid ""
 "deleting branch '%s' that has been merged to\n"
-"         '%s', but not yet merged to HEAD."
+"         '%s', but not yet merged to HEAD"
 msgstr ""
 "將要刪除的 “%s” 分支已經被合併到\n"
-"         “%s”,但尚未合併到 HEAD"
+"         “%s”,但尚未合併到 HEAD"
 
 #  譯者:保持原換行格式,在輸出時 %s 的替代內容會讓字串變長
 #: builtin/branch.c
 #, c-format
 msgid ""
 "not deleting branch '%s' that is not yet merged to\n"
-"         '%s', even though it is merged to HEAD."
+"         '%s', even though it is merged to HEAD"
 msgstr ""
 "並未刪除分支 “%s”, 雖然已經合併到 HEAD,\n"
-"         卻尚未被合併至 “%s” 分支"
+"         卻尚未被合併至 “%s” 分支"
 
 #: builtin/branch.c
 #, c-format
-msgid "Couldn't look up commit object for '%s'"
+msgid "couldn't look up commit object for '%s'"
 msgstr "無法查詢 “%s” 指向的提交物件"
 
 #: builtin/branch.c
 #, c-format
-msgid ""
-"The branch '%s' is not fully merged.\n"
-"If you are sure you want to delete it, run 'git branch -D %s'."
-msgstr ""
-"分支 “%s” 沒有完全合併。\n"
-"如果確定要刪除它,請執行 “git branch -D %s”。"
+msgid "the branch '%s' is not fully merged"
+msgstr "分支 “%s” 沒有完全合併"
 
 #: builtin/branch.c
-msgid "Update of config-file failed"
+#, c-format
+msgid "If you are sure you want to delete it, run 'git branch -D %s'"
+msgstr "如果確定要刪除它,請執行 “git branch -D %s”"
+
+#: builtin/branch.c
+msgid "update of config-file failed"
 msgstr "更新組態檔案失敗"
 
 #: builtin/branch.c
@@ -3382,13 +3392,13 @@ msgstr "不能將 -a 和 -d 同時使用"
 
 #: builtin/branch.c
 #, c-format
-msgid "Cannot delete branch '%s' checked out at '%s'"
-msgstr "無法刪除在 “%2$s” 簽出的 “%1$s” 分支"
+msgid "cannot delete branch '%s' used by worktree at '%s'"
+msgstr "無法刪除被位於 “%2$s” 的工作區使用的 “%1$s” 分支"
 
 #: builtin/branch.c
 #, c-format
-msgid "remote-tracking branch '%s' not found."
-msgstr "找不到 “%s” 遠端追蹤分支"
+msgid "remote-tracking branch '%s' not found"
+msgstr "找不到 “%s” 遠端追蹤分支"
 
 #: builtin/branch.c
 #, c-format
@@ -3401,8 +3411,8 @@ msgstr ""
 
 #: builtin/branch.c
 #, c-format
-msgid "branch '%s' not found."
-msgstr "找不到 “%s” 分支"
+msgid "branch '%s' not found"
+msgstr "找不到 “%s” 分支"
 
 #: builtin/branch.c
 #, c-format
@@ -3429,12 +3439,12 @@ msgstr "HEAD 指針 (%s) 指向 refs/heads/ 之外"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch %s is being rebased at %s"
+msgid "branch %s is being rebased at %s"
 msgstr "%s 分支正在重定基底至 %s"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch %s is being bisected at %s"
+msgid "branch %s is being bisected at %s"
 msgstr "%s 分支正於 %s 進行二分搜尋"
 
 #: builtin/branch.c
@@ -3444,48 +3454,48 @@ msgstr "%s 工作區的 HEAD 指針未被更新"
 
 #: builtin/branch.c
 #, c-format
-msgid "Invalid branch name: '%s'"
+msgid "invalid branch name: '%s'"
 msgstr "分支名稱無效:“%s”"
 
 #: builtin/branch.c
 #, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "分支 “%s” 尚無提交"
+msgid "no commit on branch '%s' yet"
+msgstr "分支 “%s” 尚無提交"
 
 #: builtin/branch.c
 #, c-format
-msgid "No branch named '%s'."
-msgstr "沒有名為 “%s” 的分支"
+msgid "no branch named '%s'"
+msgstr "沒有名為 “%s” 的分支"
 
 #: builtin/branch.c
-msgid "Branch rename failed"
+msgid "branch rename failed"
 msgstr "分支重新命名失敗"
 
 #: builtin/branch.c
-msgid "Branch copy failed"
+msgid "branch copy failed"
 msgstr "分支拷貝失敗"
 
 #: builtin/branch.c
 #, c-format
-msgid "Created a copy of a misnamed branch '%s'"
+msgid "created a copy of a misnamed branch '%s'"
 msgstr "已為誤命名的 “%s” 分支建立拷貝"
 
 #: builtin/branch.c
 #, c-format
-msgid "Renamed a misnamed branch '%s' away"
+msgid "renamed a misnamed branch '%s' away"
 msgstr "已更改誤命名的 “%s” 分支的名稱"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch renamed to %s, but HEAD is not updated!"
-msgstr "分支已重新命名為 %s,但 HEAD 指針尚未更新"
+msgid "branch renamed to %s, but HEAD is not updated"
+msgstr "分支已重新命名為 %s,但 HEAD 指針尚未更新"
 
 #: builtin/branch.c
-msgid "Branch is renamed, but update of config-file failed"
+msgid "branch is renamed, but update of config-file failed"
 msgstr "分支已重新命名,但無法更新組態檔案"
 
 #: builtin/branch.c
-msgid "Branch is copied, but update of config-file failed"
+msgid "branch is copied, but update of config-file failed"
 msgstr "分支已拷貝,但無法更新組態檔案"
 
 #: builtin/branch.c
@@ -3636,9 +3646,9 @@ msgstr "在子模組中遞迴"
 msgid "format to use for the output"
 msgstr "輸出格式"
 
-#: builtin/branch.c builtin/submodule--helper.c submodule.c
-msgid "Failed to resolve HEAD as a valid ref."
-msgstr "無法將 HEAD 解析為有效引用"
+#: builtin/branch.c
+msgid "failed to resolve HEAD as a valid ref"
+msgstr "無法將 HEAD 解析為有效引用"
 
 #: builtin/branch.c builtin/clone.c
 msgid "HEAD not found below refs/heads!"
@@ -3660,7 +3670,7 @@ msgid "branch name required"
 msgstr "必須提供分支名稱"
 
 #: builtin/branch.c
-msgid "Cannot give description to detached HEAD"
+msgid "cannot give description to detached HEAD"
 msgstr "無法向分離 HEAD 指針提供描述"
 
 #: builtin/branch.c
@@ -3668,12 +3678,12 @@ msgid "cannot edit description of more than one branch"
 msgstr "無法編輯超過一個分支的描述"
 
 #: builtin/branch.c
-msgid "cannot copy the current branch while not on any."
-msgstr "不在任何分支上,無法拷貝目前分支"
+msgid "cannot copy the current branch while not on any"
+msgstr "不在任何分支上,無法拷貝目前分支"
 
 #: builtin/branch.c
-msgid "cannot rename the current branch while not on any."
-msgstr "不在任何分支上,無法重新命名目前分支"
+msgid "cannot rename the current branch while not on any"
+msgstr "不在任何分支上,無法重新命名目前分支"
 
 #: builtin/branch.c
 msgid "too many branches for a copy operation"
@@ -3690,8 +3700,8 @@ msgstr "要設定新上游的引數太多"
 #: builtin/branch.c
 #, c-format
 msgid ""
-"could not set upstream of HEAD to %s when it does not point to any branch."
-msgstr "無法將 HEAD 的上游設為 %s:其未指向任何分支"
+"could not set upstream of HEAD to %s when it does not point to any branch"
+msgstr "無法將 HEAD 的上游設為 %s:其未指向任何分支"
 
 #: builtin/branch.c
 #, c-format
@@ -3708,17 +3718,17 @@ msgid "too many arguments to unset upstream"
 msgstr "要取消設定上游的引數太多"
 
 #: builtin/branch.c
-msgid "could not unset upstream of HEAD when it does not point to any branch."
-msgstr "無法取消設定 HEAD 的上游:其未指向任何分支"
+msgid "could not unset upstream of HEAD when it does not point to any branch"
+msgstr "無法取消設定 HEAD 的上游:其未指向任何分支"
 
 #: builtin/branch.c
 #, c-format
-msgid "Branch '%s' has no upstream information"
+msgid "branch '%s' has no upstream information"
 msgstr "分支 “%s” 沒有上游資訊"
 
 #: builtin/branch.c
 msgid ""
-"The -a, and -r, options to 'git branch' do not take a branch name.\n"
+"the -a, and -r, options to 'git branch' do not take a branch name.\n"
 "Did you mean to use: -a|-r --list <pattern>?"
 msgstr ""
 "“git branch” 的 -a 和 -r 選項不取分支名稱。\n"
@@ -3727,9 +3737,8 @@ msgstr ""
 #: builtin/branch.c
 msgid ""
 "the '--set-upstream' option is no longer supported. Please use '--track' or "
-"'--set-upstream-to' instead."
-msgstr ""
-"不再支援選項 “--set-upstream”。請改用 “--track” 或 “--set-upstream-to”。"
+"'--set-upstream-to' instead"
+msgstr "不再支援選項 “--set-upstream”。請改用 “--track” 或 “--set-upstream-to”"
 
 #: builtin/bugreport.c
 msgid "git version:\n"
@@ -3812,6 +3821,11 @@ msgstr "指定臭蟲報告檔案的目的地"
 msgid "specify a strftime format suffix for the filename(s)"
 msgstr "指定用於檔名的 strftime 格式後綴"
 
+#: builtin/bugreport.c
+#, c-format
+msgid "unknown argument `%s'"
+msgstr "未知引數 “%s”"
+
 #: builtin/bugreport.c builtin/diagnose.c
 #, c-format
 msgid "could not create leading directories for '%s'"
@@ -3949,6 +3963,14 @@ msgstr "git cat-file (-e | -p) <object>"
 msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 msgstr "git cat-file (-t | -s) [--allow-unknown-type] <object>"
 
+#: builtin/cat-file.c
+msgid ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+msgstr ""
+"git cat-file (--textconv | --filters)\n"
+"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
+
 #: builtin/cat-file.c
 msgid ""
 "git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
@@ -3961,14 +3983,6 @@ msgstr ""
 "             [--buffer] [--follow-symlinks] [--unordered]\n"
 "             [--textconv | --filters] [-Z]"
 
-#: builtin/cat-file.c
-msgid ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-msgstr ""
-"git cat-file (--textconv | --filters)\n"
-"             [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"
-
 #: builtin/cat-file.c
 msgid "Check object existence or emit object contents"
 msgstr "檢查物件的存在狀態,或輸出物件內容"
@@ -4342,6 +4356,11 @@ msgstr "未指定 “%2$s” 時,必須使用 “%1$s”"
 msgid "'%s' or '%s' cannot be used with %s"
 msgstr "“%s” 或 “%s” 無法與 %s 一起使用"
 
+#: builtin/checkout.c
+#, c-format
+msgid "'%s', '%s', or '%s' cannot be used when checking out of a tree"
+msgstr "“%s”、“%s” 或 “%s” 無法在簽出樹狀物件時使用"
+
 #: builtin/checkout.c
 #, c-format
 msgid "path '%s' is unmerged"
@@ -4369,7 +4388,7 @@ msgstr "無法對 “%s” 執行 reflog 動作:%s\n"
 msgid "HEAD is now at"
 msgstr "HEAD 目前位於"
 
-#: builtin/checkout.c builtin/clone.c t/helper/test-fast-rebase.c
+#: builtin/checkout.c builtin/clone.c
 msgid "unable to update HEAD"
 msgstr "無法更新 HEAD"
 
@@ -4630,8 +4649,8 @@ msgid "new-branch"
 msgstr "new-branch"
 
 #: builtin/checkout.c
-msgid "new unparented branch"
-msgstr "新的,沒有父提交的分支"
+msgid "new unborn branch"
+msgstr "新的未誕生分支"
 
 #: builtin/checkout.c builtin/merge.c
 msgid "update ignored files (default)"
@@ -4698,7 +4717,7 @@ msgstr ""
 msgid "you must specify path(s) to restore"
 msgstr "您必須指定要還原的路徑"
 
-#: builtin/checkout.c builtin/clone.c builtin/remote.c
+#: builtin/checkout.c builtin/clone.c builtin/remote.c builtin/replay.c
 #: builtin/submodule--helper.c builtin/worktree.c
 msgid "branch"
 msgstr "branch"
@@ -4939,10 +4958,6 @@ msgid ""
 msgstr ""
 "clean.requireForce 預設為 true 且未提供 -i、-n 或 -f 選項,拒絕執行清理動作"
 
-#: builtin/clean.c
-msgid "-x and -X cannot be used together"
-msgstr "-x 和 -X 不能同時使用"
-
 #: builtin/clone.c
 msgid "git clone [<options>] [--] <repo> [<dir>]"
 msgstr "git clone [<options>] [--] <repo> [<dir>]"
@@ -5021,7 +5036,7 @@ msgstr "簽出 <branch> 而不是遠端 HEAD"
 msgid "path to git-upload-pack on the remote"
 msgstr "遠端 git-upload-pack 路徑"
 
-#: builtin/clone.c builtin/fetch.c builtin/grep.c builtin/pull.c
+#: builtin/clone.c builtin/fetch.c builtin/pull.c
 msgid "depth"
 msgstr "depth"
 
@@ -5034,6 +5049,7 @@ msgid "create a shallow clone since a specific time"
 msgstr "建立從指定時間到現在的淺層複製"
 
 #: builtin/clone.c builtin/fetch.c builtin/pull.c builtin/rebase.c
+#: builtin/replay.c
 msgid "revision"
 msgstr "revision"
 
@@ -5061,6 +5077,10 @@ msgstr "gitdir"
 msgid "separate git dir from working tree"
 msgstr "git 目錄和工作區分離"
 
+#: builtin/clone.c builtin/init-db.c
+msgid "specify the reference format to use"
+msgstr "指定要使用的引用格式"
+
 #: builtin/clone.c
 msgid "key=value"
 msgstr "key=value"
@@ -5210,11 +5230,10 @@ msgstr "太多參數。"
 msgid "You must specify a repository to clone."
 msgstr "您必須指定要複製的版本庫。"
 
-#: builtin/clone.c
-msgid ""
-"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
-"exclude"
-msgstr "--bundle-uri 與 --depth、--shallow-since 和 --shallow-exclude 不相容"
+#: builtin/clone.c builtin/init-db.c setup.c
+#, c-format
+msgid "unknown ref storage format '%s'"
+msgstr "未知的引用儲存格式 “%s”"
 
 #: builtin/clone.c
 #, c-format
@@ -5375,14 +5394,14 @@ msgid ""
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 msgstr ""
 "git commit-graph write [--object-dir <dir>] [--append]\n"
 "                       [--split[=<strategy>]] [--reachable | --stdin-packs | "
 "--stdin-commits]\n"
 "                       [--changed-paths] [--[no-]max-new-filters <n>] [--"
 "[no-]progress]\n"
-"                       <split options>"
+"                       <split-options>"
 
 #: builtin/commit-graph.c builtin/fetch.c builtin/log.c builtin/repack.c
 msgid "dir"
@@ -5401,6 +5420,11 @@ msgstr "如果提交圖形被分割,只驗證頭一個檔案"
 msgid "Could not open commit-graph '%s'"
 msgstr "無法開啟提交圖形 '%s'"
 
+#: builtin/commit-graph.c
+#, c-format
+msgid "could not open commit-graph chain '%s'"
+msgstr "無法開啟提交圖鏈 “%s”"
+
 #: builtin/commit-graph.c
 #, c-format
 msgid "unrecognized --split argument, %s"
@@ -5641,10 +5665,6 @@ msgstr "無法更新暫時索引"
 msgid "Failed to update main cache tree"
 msgstr "不能更新樹的主快取"
 
-#: builtin/commit.c
-msgid "unable to write new_index file"
-msgstr "無法寫 new_index 檔案"
-
 #: builtin/commit.c
 msgid "cannot do a partial commit during a merge."
 msgstr "在合併過程中不能做部分提交。"
@@ -6139,11 +6159,11 @@ msgstr "提交說明內文空白,中止提交作業。\n"
 #: builtin/commit.c
 msgid ""
 "repository has been updated, but unable to write\n"
-"new_index file. Check that disk is not full and quota is\n"
+"new index file. Check that disk is not full and quota is\n"
 "not exceeded, and then \"git restore --staged :/\" to recover."
 msgstr ""
-"版本庫已更新,但無法寫 new_index 檔案。檢查是否磁碟已滿或\n"
-"磁碟配額已耗盡,然後執行 \"git restore --staged :/\" 復原。"
+"版本庫已更新,但無法寫入新的索引檔案。請檢查磁碟是否\n"
+"已滿或磁碟配額已耗盡,然後執行 “git restore --staged :/” 復原。"
 
 #: builtin/config.c
 msgid "git config [<options>]"
@@ -7954,6 +7974,10 @@ msgstr "清除未引用的物件"
 msgid "pack unreferenced objects separately"
 msgstr "獨立封裝無引用物件"
 
+#: builtin/gc.c builtin/repack.c
+msgid "with --cruft, limit the size of new cruft packs"
+msgstr "搭配 --cruft,限制新廢棄封裝的大小"
+
 #: builtin/gc.c
 msgid "be more thorough (increased runtime)"
 msgstr "更徹底(增加執行時間)"
@@ -8168,14 +8192,6 @@ msgstr "無法執行 “crontab”;您的系統可能不支援 “cron”"
 msgid "'crontab' died"
 msgstr "“crontab” 結束運作"
 
-#: builtin/gc.c
-msgid "failed to start systemctl"
-msgstr "無法啟動 systemctl"
-
-#: builtin/gc.c
-msgid "failed to run systemctl"
-msgstr "無法執行 systemctl"
-
 #: builtin/gc.c builtin/worktree.c
 #, c-format
 msgid "failed to delete '%s'"
@@ -8186,6 +8202,14 @@ msgstr "刪除 '%s' 失敗"
 msgid "failed to flush '%s'"
 msgstr "排清 '%s' 失敗"
 
+#: builtin/gc.c
+msgid "failed to start systemctl"
+msgstr "無法啟動 systemctl"
+
+#: builtin/gc.c
+msgid "failed to run systemctl"
+msgstr "無法執行 systemctl"
+
 #: builtin/gc.c
 #, c-format
 msgid "unrecognized --scheduler argument '%s'"
@@ -8216,6 +8240,10 @@ msgstr "scheduler"
 msgid "scheduler to trigger git maintenance run"
 msgstr "要觸發 git maintenance run 的排程器"
 
+#: builtin/gc.c
+msgid "failed to set up maintenance schedule"
+msgstr "無法設定維護排程"
+
 #: builtin/gc.c
 msgid "failed to add repo to global config"
 msgstr "無法將版本庫加至全域設定"
@@ -8252,6 +8280,11 @@ msgstr "沒有執行緒支援,忽略 %s"
 msgid "unable to read tree (%s)"
 msgstr "無法讀取樹(%s)"
 
+#: builtin/grep.c
+#, c-format
+msgid "unable to read tree %s"
+msgstr "無法讀取 %s 樹狀物件"
+
 #: builtin/grep.c
 #, c-format
 msgid "unable to grep from object of type %s"
@@ -8312,8 +8345,8 @@ msgid "search in subdirectories (default)"
 msgstr "在子目錄中尋找(預設值)"
 
 #: builtin/grep.c
-msgid "descend at most <depth> levels"
-msgstr "最多以指定的深度向下尋找"
+msgid "descend at most <n> levels"
+msgstr "最多向下尋找 <n> 層"
 
 #: builtin/grep.c
 msgid "use extended POSIX regular expressions"
@@ -8774,11 +8807,6 @@ msgstr "解壓縮嚴重的不一致"
 msgid "SHA1 COLLISION FOUND WITH %s !"
 msgstr "發現 %s 出現 SHA1 衝突!"
 
-#: builtin/index-pack.c builtin/pack-objects.c
-#, c-format
-msgid "unable to read %s"
-msgstr "不能讀 %s"
-
 #: builtin/index-pack.c
 #, c-format
 msgid "cannot read existing object info %s"
@@ -8952,11 +8980,13 @@ msgstr "在打包物件中 fsck 檢查發生錯誤"
 msgid ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 msgstr ""
 "git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
 "         [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+"         [--ref-format=<format>]\n"
 "         [-b <branch-name> | --initial-branch=<branch-name>]\n"
 "         [--shared[=<permissions>]] [<directory>]"
 
@@ -9009,11 +9039,11 @@ msgstr "--separate-git-dir 與純版本庫不相容"
 #: builtin/interpret-trailers.c
 msgid ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 msgstr ""
 "git interpret-trailers [--in-place] [--trim-empty]\n"
-"                       [(--trailer <token>[(=|:)<value>])...]\n"
+"                       [(--trailer (<key>|<keyAlias>)[(=|:)<value>])...]\n"
 "                       [--parse] [<file>...]"
 
 #: builtin/interpret-trailers.c
@@ -9024,6 +9054,10 @@ msgstr "在原位編輯檔案"
 msgid "trim empty trailers"
 msgstr "刪除空的尾部署名"
 
+#: builtin/interpret-trailers.c
+msgid "placement"
+msgstr "placement"
+
 #: builtin/interpret-trailers.c
 msgid "where to place the new trailer"
 msgstr "在哪裡放置新的尾部署名"
@@ -9041,20 +9075,20 @@ msgid "output only the trailers"
 msgstr "只輸出尾部署名"
 
 #: builtin/interpret-trailers.c
-msgid "do not apply config rules"
-msgstr "不要套用組態設定規則"
+msgid "do not apply trailer.* configuration variables"
+msgstr "不套用 trailer.* 組態變數"
 
 #: builtin/interpret-trailers.c
-msgid "join whitespace-continued values"
-msgstr "連線空白折行的值"
+msgid "reformat multiline trailer values as single-line values"
+msgstr "將多列尾注值 (trailer values) 重新格式化為單列值"
 
 #: builtin/interpret-trailers.c
-msgid "set parsing options"
-msgstr "設定解析選項"
+msgid "alias for --only-trailers --only-input --unfold"
+msgstr "--only-trailers --only-input --unfold 的別名"
 
 #: builtin/interpret-trailers.c
-msgid "do not treat --- specially"
-msgstr "不要對 --- 特殊處理"
+msgid "do not treat \"---\" as the end of input"
+msgstr "不要把 “---” 當作輸入結尾"
 
 #: builtin/interpret-trailers.c
 msgid "trailer(s) to add"
@@ -9111,7 +9145,7 @@ msgid ""
 "<file>"
 msgstr "追蹤 <開始>,<結束> 範圍中橫列或 <檔案> 中> :<函數名稱> 的變化史"
 
-#: builtin/log.c builtin/shortlog.c bundle.c
+#: builtin/log.c builtin/replay.c builtin/shortlog.c bundle.c
 #, c-format
 msgid "unrecognized argument: %s"
 msgstr "無法識別的參數:%s"
@@ -9166,6 +9200,11 @@ msgstr "只需要一個範圍"
 msgid "not a range"
 msgstr "不是一個範圍"
 
+#: builtin/log.c
+#, c-format
+msgid "unable to read branch description file '%s'"
+msgstr "無法讀取分支描述檔 “%s”"
+
 #: builtin/log.c
 msgid "cover letter needs email format"
 msgstr "附函需要信件位址格式"
@@ -9292,6 +9331,10 @@ msgstr "從描述產生附函的模式"
 msgid "generate parts of a cover letter based on a branch's description"
 msgstr "基於分支描述產生部分附函"
 
+#: builtin/log.c
+msgid "use branch description from file"
+msgstr "從檔案讀取分支描述並使用"
+
 #: builtin/log.c
 msgid "use [<prefix>] instead of [PATCH]"
 msgstr "使用 [<前綴>] 代替 [PATCH]"
@@ -9845,10 +9888,21 @@ msgstr ""
 "git merge-file [<選項>] [-L <檔案1> [-L <初始> [-L <名字2>]]] <檔案1> <初始文"
 "件> <檔案2>"
 
+#: builtin/merge-file.c diff.c
+msgid ""
+"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
+"\"histogram\""
+msgstr ""
+"diff-algorithm 選項有 \"myers\"、\"minimal\"、\"patience\" 和 \"histogram\""
+
 #: builtin/merge-file.c
 msgid "send results to standard output"
 msgstr "將結果傳送到標準輸出"
 
+#: builtin/merge-file.c
+msgid "use object IDs instead of filenames"
+msgstr "使用物件 ID 取代檔名"
+
 #: builtin/merge-file.c
 msgid "use a diff3 based merge"
 msgstr "使用基於 diff3 的合併"
@@ -9869,6 +9923,14 @@ msgstr "如果衝突,使用他們的版本"
 msgid "for conflicts, use a union version"
 msgstr "如果衝突,使用聯合版本"
 
+#: builtin/merge-file.c diff.c
+msgid "<algorithm>"
+msgstr "<演算法>"
+
+#: builtin/merge-file.c diff.c
+msgid "choose a diff algorithm"
+msgstr "選擇一個差異演算法"
+
 #: builtin/merge-file.c
 msgid "for conflicts, use this marker size"
 msgstr "如果衝突,使用指定長度的標記"
@@ -9881,6 +9943,15 @@ msgstr "不要警告衝突"
 msgid "set labels for file1/orig-file/file2"
 msgstr "為 檔案1/初始檔案/檔案2 設定標籤"
 
+#: builtin/merge-file.c
+#, c-format
+msgid "object '%s' does not exist"
+msgstr "物件 “%s” 不存在"
+
+#: builtin/merge-file.c
+msgid "Could not write object file"
+msgstr "無法寫入物件檔案"
+
 #: builtin/merge-recursive.c
 #, c-format
 msgid "unknown option %s"
@@ -9959,13 +10030,22 @@ msgstr "執行多次合併,一次執行輸入一列"
 msgid "specify a merge-base for the merge"
 msgstr "指定用來合併的合併基底"
 
+#: builtin/merge-tree.c builtin/merge.c builtin/pull.c
+msgid "option=value"
+msgstr "option=value"
+
+#: builtin/merge-tree.c builtin/merge.c builtin/pull.c
+msgid "option for selected merge strategy"
+msgstr "所選的合併策略的選項"
+
 #: builtin/merge-tree.c
 msgid "--trivial-merge is incompatible with all other options"
 msgstr "--trivial-merge 和其他所有選項都不相容"
 
-#: builtin/merge-tree.c
-msgid "--merge-base is incompatible with --stdin"
-msgstr "--merge-base 與 --stdin 不相容"
+#: builtin/merge-tree.c builtin/merge.c
+#, c-format
+msgid "unknown strategy option: -X%s"
+msgstr "未知的策略選項:-X%s"
 
 #: builtin/merge-tree.c builtin/notes.c
 #, c-format
@@ -10054,14 +10134,6 @@ msgstr "策略"
 msgid "merge strategy to use"
 msgstr "要使用的合併策略"
 
-#: builtin/merge.c builtin/pull.c
-msgid "option=value"
-msgstr "option=value"
-
-#: builtin/merge.c builtin/pull.c
-msgid "option for selected merge strategy"
-msgstr "所選的合併策略的選項"
-
 #: builtin/merge.c
 msgid "merge commit message (for a non-fast-forward merge)"
 msgstr "合併的提交說明(針對非快轉式合併)"
@@ -10133,7 +10205,7 @@ msgstr "'%s' 沒有指向一個提交"
 msgid "Bad branch.%s.mergeoptions string: %s"
 msgstr "壞的 branch.%s.mergeoptions 字串:%s"
 
-#: builtin/merge.c builtin/stash.c merge-recursive.c
+#: builtin/merge.c merge-recursive.c
 msgid "Unable to write index."
 msgstr "不能寫入索引。"
 
@@ -10143,11 +10215,6 @@ msgstr "未處理兩個頭合併之外的任何動作。"
 
 #: builtin/merge.c
 #, c-format
-msgid "unknown strategy option: -X%s"
-msgstr "未知的策略選項:-X%s"
-
-#: builtin/merge.c t/helper/test-fast-rebase.c
-#, c-format
 msgid "unable to write %s"
 msgstr "不能寫 %s"
 
@@ -10504,8 +10571,8 @@ msgid "can not move directory into itself"
 msgstr "不能將目錄移動到自身"
 
 #: builtin/mv.c
-msgid "cannot move directory over file"
-msgstr "不能將目錄移動到檔案"
+msgid "destination already exists"
+msgstr "目的地已存在"
 
 #: builtin/mv.c
 msgid "source directory is empty"
@@ -11132,6 +11199,11 @@ msgstr "壓縮物件中"
 msgid "inconsistency with delta count"
 msgstr "不一致的差異計數"
 
+#: builtin/pack-objects.c
+#, c-format
+msgid "invalid pack.allowPackReuse value: '%s'"
+msgstr "無效的 pack.allowPackReuse 值:“%s”"
+
 #: builtin/pack-objects.c
 #, c-format
 msgid ""
@@ -11432,10 +11504,6 @@ msgstr "最小的包檔案大小是 1 MiB"
 msgid "--thin cannot be used to build an indexable pack"
 msgstr "--thin 不能用於建立一個可索引包"
 
-#: builtin/pack-objects.c
-msgid "cannot use --filter without --stdout"
-msgstr "不能在沒有 --stdout 的情況下使用 --filter"
-
 #: builtin/pack-objects.c
 msgid "cannot use --filter with --stdin-packs"
 msgstr "無法將 --filter 及 --stdin-packs 結合使用"
@@ -11452,10 +11520,6 @@ msgstr "無法透過 --cruft 使用內部修訂清單"
 msgid "cannot use --stdin-packs with --cruft"
 msgstr "無法將 --stdin-packs 與 --cruft 組合使用"
 
-#: builtin/pack-objects.c
-msgid "cannot use --max-pack-size with --cruft"
-msgstr "無法將 --max-pack-size 與 --cruft 組合使用"
-
 #: builtin/pack-objects.c
 msgid "Enumerating objects"
 msgstr "枚舉物件"
@@ -11464,10 +11528,10 @@ msgstr "枚舉物件"
 #, c-format
 msgid ""
 "Total %<PRIu32> (delta %<PRIu32>), reused %<PRIu32> (delta %<PRIu32>), pack-"
-"reused %<PRIu32>"
+"reused %<PRIu32> (from %<PRIuMAX>)"
 msgstr ""
 "總共 %<PRIu32> (差異 %<PRIu32>),復用 %<PRIu32> (差異 %<PRIu32>),重用包 "
-"%<PRIu32>"
+"%<PRIu32> (總共 %<PRIuMAX>)"
 
 #: builtin/pack-redundant.c
 msgid ""
@@ -12546,7 +12610,7 @@ msgstr "沒有正在進行的重定基底?"
 msgid "The --edit-todo action can only be used during interactive rebase."
 msgstr "動作 --edit-todo 只能用在互動式重定基底過程中。"
 
-#: builtin/rebase.c t/helper/test-fast-rebase.c
+#: builtin/rebase.c
 msgid "Cannot read HEAD"
 msgstr "不能讀取 HEAD"
 
@@ -12590,16 +12654,6 @@ msgstr ""
 msgid "switch `C' expects a numerical value"
 msgstr "開關 `C' 期望一個數字值"
 
-#: builtin/rebase.c
-msgid "--strategy requires --merge or --interactive"
-msgstr "--strategy 需要 --merge 或 --interactive"
-
-#: builtin/rebase.c
-msgid ""
-"apply options are incompatible with rebase.autoSquash.  Consider adding --no-"
-"autosquash"
-msgstr "apply 選項與 rebase.autoSquash 不相容。請考慮加上 --no-autosquash"
-
 #: builtin/rebase.c
 msgid ""
 "apply options are incompatible with rebase.rebaseMerges.  Consider adding --"
@@ -13085,7 +13139,7 @@ msgid ""
 msgid_plural ""
 "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
 "to delete them, use:"
-msgstr[0] "注意:ref/remotes 層級之外的一個分支未被移除。要刪除它,使用:"
+msgstr[0] "注意:refs/remotes/ 層級之外的一個分支未被移除。要刪除它,使用:"
 
 #: builtin/remote.c
 #, c-format
@@ -13441,6 +13495,11 @@ msgstr "無法關閉 refs 的快照暫存檔"
 msgid "could not remove stale bitmap: %s"
 msgstr "無法移除過時位圖:%s"
 
+#: builtin/repack.c
+#, c-format
+msgid "pack prefix %s does not begin with objdir %s"
+msgstr "封包前綴 %s 不以 objdir %s 開頭"
+
 #: builtin/repack.c
 msgid "pack everything in a single pack"
 msgstr "所有內容打包到一個包檔案中"
@@ -13541,18 +13600,22 @@ msgstr "寫入結果包的多包索引"
 msgid "pack prefix to store a pack containing pruned objects"
 msgstr "封裝前綴,儲存為包含過時物件的套件包"
 
+#: builtin/repack.c
+msgid "pack prefix to store a pack containing filtered out objects"
+msgstr "將前綴進行包裝,儲存為包含已過濾物件的封裝"
+
 #: builtin/repack.c
 msgid "cannot delete packs in a precious-objects repo"
 msgstr "不能刪除珍品版本庫中的封包"
 
 #: builtin/repack.c
-msgid "Nothing new to pack."
-msgstr "沒有新的要打包。"
+#, c-format
+msgid "option '%s' can only be used along with '%s'"
+msgstr "“%s” 選項只能與 “%s” 一起使用"
 
 #: builtin/repack.c
-#, c-format
-msgid "pack prefix %s does not begin with objdir %s"
-msgstr "封包前綴 %s 不以 objdir %s 開頭"
+msgid "Nothing new to pack."
+msgstr "沒有新的要打包。"
 
 #: builtin/repack.c
 #, c-format
@@ -13805,6 +13868,86 @@ msgstr "--convert-graft-file 不帶參數"
 msgid "only one pattern can be given with -l"
 msgstr "只能為 -l 提供一個模式"
 
+#: builtin/replay.c
+msgid "need some commits to replay"
+msgstr "需要一些提交才能重放"
+
+#: builtin/replay.c
+msgid "--onto and --advance are incompatible"
+msgstr "--onto 和 --advance 不相容"
+
+#: builtin/replay.c
+msgid "all positive revisions given must be references"
+msgstr "提供的所有正向修訂集必須為引用"
+
+#: builtin/replay.c
+msgid "argument to --advance must be a reference"
+msgstr "傳入 --advance 的引數必須為引用"
+
+#: builtin/replay.c
+msgid ""
+"cannot advance target with multiple sources because ordering would be ill-"
+"defined"
+msgstr "無法用多個來源演進目的地,以免無法確定排序"
+
+#: builtin/replay.c
+msgid ""
+"cannot implicitly determine whether this is an --advance or --onto operation"
+msgstr "無法假設這是 --advance 還是 --onto 動作"
+
+#: builtin/replay.c
+msgid ""
+"cannot advance target with multiple source branches because ordering would "
+"be ill-defined"
+msgstr "無法由多個來源分支演進目的地,以免無法確定排序"
+
+#: builtin/replay.c
+msgid "cannot implicitly determine correct base for --onto"
+msgstr "無法假設 --onto 的正確基底"
+
+#: builtin/replay.c
+msgid ""
+"(EXPERIMENTAL!) git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+msgstr ""
+"(實驗性功能!)git replay ([--contained] --onto <newbase> | --advance "
+"<branch>) <revision-range>..."
+
+#: builtin/replay.c
+msgid "make replay advance given branch"
+msgstr "在指定分支上進行重放演進"
+
+#: builtin/replay.c
+msgid "replay onto given commit"
+msgstr "重放到指定提交"
+
+#: builtin/replay.c
+msgid "advance all branches contained in revision-range"
+msgstr "演進所有包含在 revision-range 中的分支"
+
+#: builtin/replay.c
+msgid "option --onto or --advance is mandatory"
+msgstr "必須傳入 --onto 或 --advance 選項"
+
+#: builtin/replay.c
+#, c-format
+msgid ""
+"some rev walking options will be overridden as '%s' bit in 'struct rev_info' "
+"will be forced"
+msgstr "將覆寫部分修訂版遍歷選項,強制使用 “struct rev_info” 的 “%s” 位元"
+
+#: builtin/replay.c
+msgid "error preparing revisions"
+msgstr "無法準備修訂集"
+
+#: builtin/replay.c
+msgid "replaying down to root commit is not supported yet!"
+msgstr "尚不支援重放到根提交!"
+
+#: builtin/replay.c
+msgid "replaying merge commits is not supported yet!"
+msgstr "尚不支援重放合併提交!"
+
 #: builtin/rerere.c
 msgid ""
 "git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
@@ -14067,22 +14210,14 @@ msgstr "--prefix 需要 1 個引數"
 msgid "unknown mode for --abbrev-ref: %s"
 msgstr "--abbrev-ref 的模式未知:%s"
 
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --branches"
-msgstr "--exclude-hidden 無法與 --branches 同時使用"
-
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --tags"
-msgstr "--exclude-hidden 無法與 --tags 同時使用"
-
-#: builtin/rev-parse.c revision.c
-msgid "--exclude-hidden cannot be used together with --remotes"
-msgstr "--exclude-hidden 無法與 --remotes 同時使用"
-
 #: builtin/rev-parse.c setup.c
 msgid "this operation must be run in a work tree"
 msgstr "該動作必須在一個工作區中執行"
 
+#: builtin/rev-parse.c
+msgid "Could not read the index"
+msgstr "無法讀取索引"
+
 #: builtin/rev-parse.c
 #, c-format
 msgid "unknown mode for --show-object-format: %s"
@@ -14503,18 +14638,40 @@ msgstr "未知的雜湊算法"
 
 #: builtin/show-ref.c
 msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+"git show-ref [--head] [-d | --dereference]\n"
 "             [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
 "             [--heads] [--] [<pattern>...]"
 
+#: builtin/show-ref.c
+msgid ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+msgstr ""
+"git show-ref --verify [-q | --quiet] [-d | --dereference]\n"
+"             [-s | --hash[=<n>]] [--abbrev[=<n>]]\n"
+"             [--] [<ref>...]"
+
 #: builtin/show-ref.c
 msgid "git show-ref --exclude-existing[=<pattern>]"
 msgstr "git show-ref --exclude-existing[=<模式>]"
 
+#: builtin/show-ref.c
+msgid "git show-ref --exists <ref>"
+msgstr "git show-ref --exists <ref>"
+
+#: builtin/show-ref.c
+msgid "reference does not exist"
+msgstr "引用不存在"
+
+#: builtin/show-ref.c
+msgid "failed to look up reference"
+msgstr "無法查詢引用"
+
 #: builtin/show-ref.c
 msgid "only show tags (can be combined with heads)"
 msgstr "只顯示標籤(可以和頭共用)"
@@ -14523,6 +14680,10 @@ msgstr "只顯示標籤(可以和頭共用)"
 msgid "only show heads (can be combined with tags)"
 msgstr "只顯示頭(可以和標籤共用)"
 
+#: builtin/show-ref.c
+msgid "check for reference existence without resolving"
+msgstr "檢查引用是否存在但不解析"
+
 #: builtin/show-ref.c
 msgid "stricter reference checking, requires exact ref path"
 msgstr "更嚴格的引用檢測,需要精確的引用路徑"
@@ -15511,6 +15672,10 @@ msgstr ""
 "shallow] [--reference <repository>] [--recursive] [--[no-]single-branch] "
 "[--] [<path>...]"
 
+#: builtin/submodule--helper.c submodule.c
+msgid "Failed to resolve HEAD as a valid ref."
+msgstr "無法將 HEAD 解析為有效引用。"
+
 #: builtin/submodule--helper.c
 msgid "git submodule absorbgitdirs [<options>] [<path>...]"
 msgstr "git submodule absorbgitdirs [<options>] [<path>...]"
@@ -16086,6 +16251,10 @@ msgstr "(for porcelains) 忘記儲存的未解決的衝突"
 msgid "write index in this format"
 msgstr "以這種格式寫入索引區"
 
+#: builtin/update-index.c
+msgid "report on-disk index format version"
+msgstr "回報磁碟上索引格式的版本"
+
 #: builtin/update-index.c
 msgid "enable or disable split index"
 msgstr "啟用或停用索引分割"
@@ -16118,6 +16287,16 @@ msgstr "標記檔案為 fsmonitor 有效"
 msgid "clear fsmonitor valid bit"
 msgstr "清除 fsmonitor 有效位"
 
+#: builtin/update-index.c
+#, c-format
+msgid "%d\n"
+msgstr "%d\n"
+
+#: builtin/update-index.c
+#, c-format
+msgid "index-version: was %d, set to %d"
+msgstr "index-version:曾是 %d,已設為 %d"
+
 #: builtin/update-index.c
 msgid ""
 "core.splitIndex is set to false; remove or change it, if you really want to "
@@ -16303,14 +16482,14 @@ msgstr "沒有可能的來源分支,推測為 “--orphan”"
 #: builtin/worktree.c
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
 msgstr ""
 "如果您是想要在這個版本庫建立一個工作區,裡面包含一個\n"
-"孤立分支(即沒有提交的分支),可以使用 --orphan 達到\n"
+"未誕生分支(即沒有提交的分支),可以使用 --orphan 達到\n"
 "這個效果:\n"
 "\n"
 "    git worktree add --orphan -b %s %s\n"
@@ -16318,14 +16497,14 @@ msgstr ""
 #: builtin/worktree.c
 #, c-format
 msgid ""
-"If you meant to create a worktree containing a new orphan branch\n"
+"If you meant to create a worktree containing a new unborn branch\n"
 "(branch with no commits) for this repository, you can do so\n"
 "using the --orphan flag:\n"
 "\n"
 "    git worktree add --orphan %s\n"
 msgstr ""
 "如果您是想要在這個版本庫建立一個工作區,裡面包含一個\n"
-"孤立分支(即沒有提交的分支),可以使用 --orphan 達到\n"
+"未誕生分支(即沒有提交的分支),可以使用 --orphan 達到\n"
 "這個效果:\n"
 "\n"
 "    git worktree add --orphan %s\n"
@@ -16395,6 +16574,11 @@ msgstr "不能建立目錄 '%s'"
 msgid "initializing"
 msgstr "正在初始化"
 
+#: builtin/worktree.c
+#, c-format
+msgid "could not find created worktree '%s'"
+msgstr "找不到建立的工作區「%s」"
+
 #: builtin/worktree.c
 #, c-format
 msgid "Preparing worktree (new branch '%s')"
@@ -16434,16 +16618,11 @@ msgstr ""
 #: builtin/worktree.c
 msgid ""
 "No local or remote refs exist despite at least one remote\n"
-"present, stopping; use 'add -f' to overide or fetch a remote first"
+"present, stopping; use 'add -f' to override or fetch a remote first"
 msgstr ""
 "即使有提供一個遠端,卻不存在本機或遠端引用,\n"
 "故停止。使用 “add -f” 先覆蓋或抓取遠端"
 
-#: builtin/worktree.c
-#, c-format
-msgid "'%s' and '%s' cannot be used together"
-msgstr "無法同時使用 “%s” 和 “%s”"
-
 #: builtin/worktree.c
 msgid "checkout <branch> even if already checked out in other worktree"
 msgstr "簽出 <分支>,即使已經被簽出到其它工作區"
@@ -16457,8 +16636,8 @@ msgid "create or reset a branch"
 msgstr "建立或重設一個分支"
 
 #: builtin/worktree.c
-msgid "create unborn/orphaned branch"
-msgstr "建立尚無內容(孤立)的分支"
+msgid "create unborn branch"
+msgstr "建立未誕生分支"
 
 #: builtin/worktree.c
 msgid "populate the new working tree"
@@ -16487,12 +16666,8 @@ msgstr "「%s」、「%s」和「%s」選項不得同時使用"
 
 #: builtin/worktree.c
 #, c-format
-msgid "options '%s', and '%s' cannot be used together"
-msgstr "無法同時使用 “%s” 和 “%s” 選項"
-
-#: builtin/worktree.c
-msgid "<commit-ish>"
-msgstr "<提交指示元>"
+msgid "option '%s' and commit-ish cannot be used together"
+msgstr "“%s” 選項和提交號不得同時使用"
 
 #: builtin/worktree.c
 msgid "added with --lock"
@@ -16826,6 +17001,11 @@ msgstr "index-pack 終止"
 msgid "terminating chunk id appears earlier than expected"
 msgstr "終止區塊 id 出現的時間早於預期"
 
+#: chunk-format.c
+#, c-format
+msgid "chunk id %<PRIx32> not %d-byte aligned"
+msgstr "區塊 ID %<PRIx32> 沒有以 %d 位元組為單位對齊"
+
 #: chunk-format.c
 #, c-format
 msgid "improper chunk offset(s) %<PRIx64> and %<PRIx64>"
@@ -16895,8 +17075,8 @@ msgid "Move objects and refs by archive"
 msgstr "透過歸檔移動物件和引用"
 
 #: command-list.h
-msgid "Provide content or type and size information for repository objects"
-msgstr "提供版本庫物件的內容、類型或大小"
+msgid "Provide contents or details of repository objects"
+msgstr "提供版本庫物件的內容或詳細資訊"
 
 #: command-list.h
 msgid "Display gitattributes information"
@@ -17275,6 +17455,10 @@ msgstr "打包版本庫中未打包物件"
 msgid "Create, list, delete refs to replace objects"
 msgstr "建立、列出、刪除物件取代引用"
 
+#: command-list.h
+msgid "EXPERIMENTAL: Replay commits on a new base, works with bare repos too"
+msgstr "實驗性功能:在新的基底重放提交,亦支援裸版本庫"
+
 #: command-list.h
 msgid "Generates a summary of pending changes"
 msgstr "生成待定更改的摘要"
@@ -17437,7 +17621,7 @@ msgid "Display version information about Git"
 msgstr "顯示 Git 的版本資訊"
 
 #: command-list.h
-msgid "Show logs with difference each commit introduces"
+msgid "Show logs with differences each commit introduces"
 msgstr "顯示每一個提交引入的差異日誌"
 
 #: command-list.h
@@ -17593,14 +17777,45 @@ msgid "commit-graph file is too small"
 msgstr "提交圖形檔案太小"
 
 #: commit-graph.c
-#, c-format
-msgid "commit-graph signature %X does not match signature %X"
-msgstr "提交圖形簽名 %X 和簽名 %X 不符合"
+msgid "commit-graph oid fanout chunk is wrong size"
+msgstr "提交圖形 OID 扇出區塊大小有誤"
 
 #: commit-graph.c
-#, c-format
-msgid "commit-graph version %X does not match version %X"
-msgstr "提交圖形版本 %X 和版本 %X 不符合"
+msgid "commit-graph fanout values out of order"
+msgstr "提交圖形扇出的數值失序"
+
+#: commit-graph.c
+msgid "commit-graph OID lookup chunk is the wrong size"
+msgstr "提交圖形 OID 查詢區塊的大小有誤"
+
+#: commit-graph.c
+msgid "commit-graph commit data chunk is wrong size"
+msgstr "提交圖形的提交資料區塊大小有誤"
+
+#: commit-graph.c
+msgid "commit-graph generations chunk is wrong size"
+msgstr "提交圖形的世代區塊大小有誤"
+
+#: commit-graph.c
+msgid "commit-graph changed-path index chunk is too small"
+msgstr "提交圖形的更動路徑索引區塊過小"
+
+#: commit-graph.c
+#, c-format
+msgid ""
+"ignoring too-small changed-path chunk (%<PRIuMAX> < %<PRIuMAX>) in commit-"
+"graph file"
+msgstr "忽略提交圖形檔案中過小的更動路徑區塊 (%<PRIuMAX> < %<PRIuMAX>)"
+
+#: commit-graph.c
+#, c-format
+msgid "commit-graph signature %X does not match signature %X"
+msgstr "提交圖形簽名 %X 和簽名 %X 不符合"
+
+#: commit-graph.c
+#, c-format
+msgid "commit-graph version %X does not match version %X"
+msgstr "提交圖形版本 %X 和版本 %X 不符合"
 
 #: commit-graph.c
 #, c-format
@@ -17610,12 +17825,28 @@ msgstr "提交圖形雜湊版本 %X 和版本 %X 不符合"
 #: commit-graph.c
 #, c-format
 msgid "commit-graph file is too small to hold %u chunks"
-msgstr "commit-graph 檔案不夠放置 %u 個區塊"
+msgstr "提交圖形檔案不夠放置 %u 個區塊"
+
+#: commit-graph.c
+msgid "commit-graph required OID fanout chunk missing or corrupted"
+msgstr "提交圖形需要的 OID 扇出區塊遺失或損壞"
+
+#: commit-graph.c
+msgid "commit-graph required OID lookup chunk missing or corrupted"
+msgstr "提交圖形需要的 OID 查詢區塊遺失或損壞"
+
+#: commit-graph.c
+msgid "commit-graph required commit data chunk missing or corrupted"
+msgstr "提交圖形需要的提交資料區塊遺失或損壞"
 
 #: commit-graph.c
 msgid "commit-graph has no base graphs chunk"
 msgstr "提交圖形沒有基礎圖形區塊"
 
+#: commit-graph.c
+msgid "commit-graph base graphs chunk is too small"
+msgstr "提交圖形的基礎圖形區塊過小"
+
 #: commit-graph.c
 msgid "commit-graph chain does not match"
 msgstr "提交圖形鏈不符合"
@@ -17625,10 +17856,14 @@ msgstr "提交圖形鏈不符合"
 msgid "commit count in base graph too high: %<PRIuMAX>"
 msgstr "基礎圖 (base graph) 中的提交數過多:%<PRIuMAX>"
 
+#: commit-graph.c
+msgid "commit-graph chain file too small"
+msgstr "提交圖形鏈檔案過小"
+
 #: commit-graph.c
 #, c-format
 msgid "invalid commit-graph chain: line '%s' not a hash"
-msgstr "無效的提交圖形鏈:行 '%s' 不是一個雜湊值"
+msgstr "無效的提交圖形鏈:「%s」列不是雜湊值"
 
 #: commit-graph.c
 msgid "unable to find all commit-graph files"
@@ -17647,6 +17882,14 @@ msgstr "無法找到提交 %s"
 msgid "commit-graph requires overflow generation data but has none"
 msgstr "提交圖需要比目前更多的世代資料,但沒有相關資料"
 
+#: commit-graph.c
+msgid "commit-graph overflow generation data is too small"
+msgstr "提交圖形的溢出世代資料過小"
+
+#: commit-graph.c
+msgid "commit-graph extra-edges pointer out of bounds"
+msgstr "提交圖形的延伸邊界指針超出範圍"
+
 #: commit-graph.c
 msgid "Loading known commits in commit graph"
 msgstr "正在載入提交圖中的已知提交"
@@ -17800,18 +18043,6 @@ msgstr "%s 的提交圖形父提交是 %s != %s"
 msgid "commit-graph parent list for commit %s terminates early"
 msgstr "提交 %s 的提交圖形父提交列表過早終止"
 
-#: commit-graph.c
-#, c-format
-msgid ""
-"commit-graph has generation number zero for commit %s, but non-zero elsewhere"
-msgstr "提交圖形中提交 %s 的世代號是零,但其它地方非零"
-
-#: commit-graph.c
-#, c-format
-msgid ""
-"commit-graph has non-zero generation number for commit %s, but zero elsewhere"
-msgstr "提交圖形中提交 %s 的世代號非零,但其它地方是零"
-
 #: commit-graph.c
 #, c-format
 msgid "commit-graph generation for commit %s is %<PRIuMAX> < %<PRIuMAX>"
@@ -17822,6 +18053,13 @@ msgstr "提交 %s 的提交圖形處於 %<PRIuMAX> < %<PRIuMAX> 世代"
 msgid "commit date for commit %s in commit-graph is %<PRIuMAX> != %<PRIuMAX>"
 msgstr "提交圖形中提交 %s 的提交日期是 %<PRIuMAX> != %<PRIuMAX>"
 
+#: commit-graph.c
+#, c-format
+msgid ""
+"commit-graph has both zero and non-zero generations (e.g., commits '%s' and "
+"'%s')"
+msgstr "提交圖形中包含 0 和非 0 兩個世代號(例如 “%s” 和 “%s” 提交)"
+
 #: commit-graph.c
 msgid "Verifying commits in commit graph"
 msgstr "正在驗證提交圖中的提交"
@@ -17851,6 +18089,11 @@ msgstr ""
 "設定 \"git config advice.graftFileDeprecated false\"\n"
 "可關閉本消息"
 
+#: commit.c
+#, c-format
+msgid "commit %s exists in commit-graph but not in the object database"
+msgstr "%s 提交在提交圖形中,但不在物件資料庫中"
+
 #: commit.c
 #, c-format
 msgid "Commit %s has an untrusted GPG signature, allegedly by %s."
@@ -18394,11 +18637,6 @@ msgstr "引用 '%s' 沒有指向一個資料物件"
 msgid "unable to resolve config blob '%s'"
 msgstr "不能解析設定物件 '%s'"
 
-#: config.c
-#, c-format
-msgid "failed to parse %s"
-msgstr "解析 %s 失敗"
-
 #: config.c
 msgid "unable to parse command-line config"
 msgstr "無法解析命令列中的設定"
@@ -18956,10 +19194,6 @@ msgstr "無法寫入封存"
 msgid "--merge-base does not work with ranges"
 msgstr "--merge-base 跟範圍無法搭配運作"
 
-#: diff-lib.c
-msgid "--merge-base only works with commits"
-msgstr "--merge-base 只能跟提交搭配才能運作"
-
 #: diff-lib.c
 msgid "unable to get HEAD"
 msgstr "不能取得 HEAD"
@@ -19030,6 +19264,11 @@ msgstr "color-moved-ws:allow-indentation-change 不能與其它空白字元模
 msgid "Unknown value for 'diff.submodule' config variable: '%s'"
 msgstr "設定變數 'diff.submodule' 未知的取值:'%s'"
 
+#: diff.c transport.c
+#, c-format
+msgid "unknown value for config '%s': %s"
+msgstr "設定 '%s' 的取值未知:%s"
+
 #: diff.c
 #, c-format
 msgid ""
@@ -19123,13 +19362,6 @@ msgstr "壞的 --color-moved 參數:%s"
 msgid "invalid mode '%s' in --color-moved-ws"
 msgstr "--color-moved-ws 中的無效模式 '%s'"
 
-#: diff.c
-msgid ""
-"option diff-algorithm accepts \"myers\", \"minimal\", \"patience\" and "
-"\"histogram\""
-msgstr ""
-"diff-algorithm 選項有 \"myers\"、\"minimal\"、\"patience\" 和 \"histogram\""
-
 #: diff.c
 #, c-format
 msgid "invalid argument to %s"
@@ -19187,8 +19419,9 @@ msgid "output only the last line of --stat"
 msgstr "只輸出 --stat 的最後一行"
 
 #: diff.c
-msgid "<param1,param2>..."
-msgstr "<參數1,參數2>..."
+#| msgid "<param1,param2>..."
+msgid "<param1>,<param2>..."
+msgstr "<param1>,<param2>..."
 
 #: diff.c
 msgid ""
@@ -19200,8 +19433,8 @@ msgid "synonym for --dirstat=cumulative"
 msgstr "和 --dirstat=cumulative 同義"
 
 #: diff.c
-msgid "synonym for --dirstat=files,param1,param2..."
-msgstr "是 --dirstat=files,param1,param2... 的同義詞"
+msgid "synonym for --dirstat=files,<param1>,<param2>..."
+msgstr "是 --dirstat=files,<param1>,<param2>... 的同義詞"
 
 #: diff.c
 msgid "warn if changes introduce conflict markers or whitespace errors"
@@ -19423,14 +19656,6 @@ msgstr "使用 \"patience diff\" 演算法生成差異"
 msgid "generate diff using the \"histogram diff\" algorithm"
 msgstr "使用 \"histogram diff\" 演算法生成差異"
 
-#: diff.c
-msgid "<algorithm>"
-msgstr "<演算法>"
-
-#: diff.c
-msgid "choose a diff algorithm"
-msgstr "選擇一個差異演算法"
-
 #: diff.c
 msgid "<text>"
 msgstr "<文字>"
@@ -20679,13 +20904,13 @@ msgstr ""
 "%s"
 
 #: merge-ort.c merge-recursive.c
-msgid "Failed to execute internal merge"
+msgid "failed to execute internal merge"
 msgstr "無法執行內部合併"
 
 #: merge-ort.c merge-recursive.c
 #, c-format
-msgid "Unable to add %s to database"
-msgstr "不能新增 %s 至物件庫"
+msgid "unable to add %s to database"
+msgstr "無法將 %s 加進資料庫"
 
 #: merge-ort.c merge-recursive.c
 #, c-format
@@ -20850,7 +21075,7 @@ msgstr ""
 #. conflict in a submodule. The first argument is the submodule
 #. name, and the second argument is the abbreviated id of the
 #. commit that needs to be merged.  For example:
-#. - go to submodule (mysubmodule), and either merge commit abc1234"
+#.  - go to submodule (mysubmodule), and either merge commit abc1234"
 #.
 #: merge-ort.c
 #, c-format
@@ -21184,6 +21409,20 @@ msgstr "讀取快取失敗"
 msgid "multi-pack-index OID fanout is of the wrong size"
 msgstr "多包索引的物件 ID fanout 大小錯誤"
 
+#: midx.c
+#, c-format
+msgid ""
+"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+msgstr "物件 ID 扇出無序:fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
+
+#: midx.c
+msgid "multi-pack-index OID lookup chunk is the wrong size"
+msgstr "多包索引 OID 查詢區塊的大小有誤"
+
+#: midx.c
+msgid "multi-pack-index object offset chunk is the wrong size"
+msgstr "多包索引的物件偏移區塊大小有誤"
+
 #: midx.c
 #, c-format
 msgid "multi-pack-index file %s is too small"
@@ -21205,20 +21444,24 @@ msgid "multi-pack-index hash version %u does not match version %u"
 msgstr "multi-pack-index 雜湊版本 %u 與版本 %u 不符合"
 
 #: midx.c
-msgid "multi-pack-index missing required pack-name chunk"
-msgstr "多包索引缺少必需的包名區塊"
+msgid "multi-pack-index required pack-name chunk missing or corrupted"
+msgstr "多包索引所需的封裝名稱區塊不存在或損壞"
 
 #: midx.c
-msgid "multi-pack-index missing required OID fanout chunk"
-msgstr "多包索引缺少必需的物件 ID fanout 區塊"
+msgid "multi-pack-index required OID fanout chunk missing or corrupted"
+msgstr "多包索引所需的 OID fanout 區塊不存在或損壞"
 
 #: midx.c
-msgid "multi-pack-index missing required OID lookup chunk"
-msgstr "多包索引缺少必需的物件 ID 查詢區塊"
+msgid "multi-pack-index required OID lookup chunk missing or corrupted"
+msgstr "多包索引所需的 OID 查詢區塊不存在或損壞"
 
 #: midx.c
-msgid "multi-pack-index missing required object offsets chunk"
-msgstr "多包索引缺少必需的物件位移區塊"
+msgid "multi-pack-index required object offsets chunk missing or corrupted"
+msgstr "多包索引所需的物件偏移區塊不存在或損壞"
+
+#: midx.c
+msgid "multi-pack-index pack-name chunk is too short"
+msgstr "多包索引的封裝名稱區塊過短"
 
 #: midx.c
 #, c-format
@@ -21230,10 +21473,23 @@ msgstr "多包索引包名無序:'%s' 在 '%s' 之前"
 msgid "bad pack-int-id: %u (%u total packs)"
 msgstr "錯的 pack-int-id:%u(共有 %u 個包)"
 
+#: midx.c
+msgid "MIDX does not contain the BTMP chunk"
+msgstr "MIDX 未包含 BTMP 區塊"
+
+#: midx.c
+#, c-format
+msgid "could not load bitmapped pack %<PRIu32>"
+msgstr "無法載入位圖化 (bitmapped) 的封裝 %<PRIu32>"
+
 #: midx.c
 msgid "multi-pack-index stores a 64-bit offset, but off_t is too small"
 msgstr "多包索引儲存一個64位位移,但是 off_t 太小"
 
+#: midx.c
+msgid "multi-pack-index large offset out of bounds"
+msgstr "多包索引的最大偏移超出邊界"
+
 #: midx.c
 #, c-format
 msgid "failed to add packfile '%s'"
@@ -21333,12 +21589,6 @@ msgstr "總和檢查碼不正確"
 msgid "Looking for referenced packfiles"
 msgstr "正在尋找引用的 packfile"
 
-#: midx.c
-#, c-format
-msgid ""
-"oid fanout out of order: fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-msgstr "物件 ID 扇出無序:fanout[%d] = %<PRIx32> > %<PRIx32> = fanout[%d]"
-
 #: midx.c
 msgid "the midx contains no oid"
 msgstr "midx 沒有 oid"
@@ -21714,7 +21964,7 @@ msgstr "%s [無效物件]"
 #. TRANSLATORS: This is a line of ambiguous commit
 #. object output. E.g.:
 #. *
-#. "deadbeef commit 2021-01-01 - Some Commit Message"
+#.    "deadbeef commit 2021-01-01 - Some Commit Message"
 #.
 #: object-name.c
 #, c-format
@@ -21724,7 +21974,7 @@ msgstr "%s 提交 %s - %s"
 #. TRANSLATORS: This is a line of ambiguous
 #. tag object output. E.g.:
 #. *
-#. "deadbeef tag 2022-01-01 - Some Tag Message"
+#.    "deadbeef tag 2022-01-01 - Some Tag Message"
 #. *
 #. The second argument is the YYYY-MM-DD found
 #. in the tag.
@@ -21741,7 +21991,7 @@ msgstr "%s 標籤 %s - %s"
 #. tag object output where we couldn't parse
 #. the tag itself. E.g.:
 #. *
-#. "deadbeef [bad tag, could not parse it]"
+#.    "deadbeef [bad tag, could not parse it]"
 #.
 #: object-name.c
 #, c-format
@@ -21969,6 +22219,10 @@ msgstr "多包位圖缺少需要的反向索引"
 msgid "could not open pack %s"
 msgstr "無法開啟封包 %s"
 
+#: pack-bitmap.c t/helper/test-read-midx.c
+msgid "could not determine MIDX preferred pack"
+msgstr "無法確定 MIDX 偏好的封裝"
+
 #: pack-bitmap.c
 #, c-format
 msgid "preferred pack (%s) is invalid"
@@ -21992,6 +22246,11 @@ msgstr "位圖查詢表損壞:提交索引 %u 超出範圍"
 msgid "corrupt ewah bitmap: truncated header for bitmap of commit \"%s\""
 msgstr "ewah 位圖損壞:提交 “%s” 之位圖的標頭遭截斷"
 
+#: pack-bitmap.c
+#, c-format
+msgid "unable to load pack: '%s', disabling pack-reuse"
+msgstr "無法載入「%s」封裝,停用 pack-reuse"
+
 #: pack-bitmap.c
 #, c-format
 msgid "object '%s' not found in type bitmaps"
@@ -22103,6 +22362,14 @@ msgstr "無效的總和檢查碼"
 msgid "invalid rev-index position at %<PRIu64>: %<PRIu32> != %<PRIu32>"
 msgstr "%<PRIu64> 位置的修訂版索引 (rev-index) 無效:%<PRIu32> != %<PRIu32>"
 
+#: pack-revindex.c
+msgid "multi-pack-index reverse-index chunk is the wrong size"
+msgstr "多包索引的反向索引區塊大小有誤"
+
+#: pack-revindex.c
+msgid "could not determine preferred pack"
+msgstr "無法確定偏好封裝"
+
 #: pack-write.c
 msgid "cannot both write and verify reverse index"
 msgstr "無法同時寫入和驗證倒排索引"
@@ -22166,16 +22433,6 @@ msgstr "選項「%s」期望「%s」或「%s」"
 msgid "%s requires a value"
 msgstr "%s 需要一個值"
 
-#: parse-options.c
-#, c-format
-msgid "%s is incompatible with %s"
-msgstr "%s 與 %s 不相容"
-
-#: parse-options.c
-#, c-format
-msgid "%s : incompatible with something else"
-msgstr "%s:和其它的不相容"
-
 #: parse-options.c
 #, c-format
 msgid "%s takes no value"
@@ -22276,6 +22533,11 @@ msgstr "    %s"
 msgid "-NUM"
 msgstr "-數字"
 
+#: parse-options.c
+#, c-format
+msgid "opposite of --no-%s"
+msgstr "--no-%s 的相反行為"
+
 #: parse-options.h
 msgid "expiry-date"
 msgstr "到期時間"
@@ -22313,6 +22575,16 @@ msgid ""
 "with --pathspec-from-file, pathspec elements are separated with NUL character"
 msgstr "如使用 --pathspec-from-file,則 <路徑規格> 元件會使用 NUL 字元分隔"
 
+#: parse.c
+#, c-format
+msgid "bad boolean environment value '%s' for '%s'"
+msgstr "「%2$s」的「%1$s」布林環境值無效"
+
+#: parse.c
+#, c-format
+msgid "failed to parse %s"
+msgstr "解析 %s 失敗"
+
 #: path.c
 #, c-format
 msgid "Could not make %s writable by group"
@@ -22369,6 +22641,11 @@ msgstr "路徑規格 '%2$s' 中包含未實現的神奇前綴 '%1$c'"
 msgid "%s: 'literal' and 'glob' are incompatible"
 msgstr "%s:'literal' 和 'glob' 不相容"
 
+#: pathspec.c
+#, c-format
+msgid "'%s' is outside the directory tree"
+msgstr "“%s” 在目錄樹之外"
+
 #: pathspec.c
 #, c-format
 msgid "%s: '%s' is outside repository at '%s'"
@@ -22560,11 +22837,6 @@ msgstr "無法索引檔案 '%s'"
 msgid "unable to add '%s' to index"
 msgstr "無法在索引中新增 '%s'"
 
-#: read-cache.c
-#, c-format
-msgid "unable to stat '%s'"
-msgstr "無法對 %s 執行 stat"
-
 #: read-cache.c
 #, c-format
 msgid "'%s' appears as both a file and as a directory"
@@ -22699,11 +22971,6 @@ msgstr "無法寫入稀疏索引的索引分割"
 msgid "failed to convert to a sparse-index"
 msgstr "無法轉換成稀疏索引"
 
-#: read-cache.c
-#, c-format
-msgid "could not stat '%s'"
-msgstr "不能對 '%s' 呼叫 stat"
-
 #: read-cache.c
 #, c-format
 msgid "unable to open git dir: %s"
@@ -23244,17 +23511,12 @@ msgstr "'%s' 已存在,無法建立 '%s'"
 msgid "cannot process '%s' and '%s' at the same time"
 msgstr "無法同時處理 '%s' 和 '%s'"
 
-#: refs/files-backend.c
-#, c-format
-msgid "could not remove reference %s"
-msgstr "無法刪除引用 %s"
-
-#: refs/files-backend.c refs/packed-backend.c
+#: refs.c
 #, c-format
 msgid "could not delete reference %s: %s"
 msgstr "無法刪除引用 %s:%s"
 
-#: refs/files-backend.c refs/packed-backend.c
+#: refs.c
 #, c-format
 msgid "could not delete references: %s"
 msgstr "無法刪除引用:%s"
@@ -23928,8 +24190,16 @@ msgid "only download metadata for the branch that will be checked out"
 msgstr "只下載會簽出的分支中介資料"
 
 #: scalar.c
-msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<options>] [--] <repo> [<dir>]"
+msgid "create repository within 'src' directory"
+msgstr "在 “src” 目錄建立版本庫"
+
+#: scalar.c
+msgid ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
+msgstr ""
+"scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+"\t[--[no-]src] <url> [<enlistment>]"
 
 #: scalar.c
 #, c-format
@@ -23995,13 +24265,32 @@ msgstr "無法移除過時的 scalar.repo “%s”"
 
 #: scalar.c
 #, c-format
-msgid "removing stale scalar.repo '%s'"
-msgstr "正在移除過時的 scalar.repo “%s”"
+msgid "removed stale scalar.repo '%s'"
+msgstr "已移除過時的 scalar.repo “%s”"
+
+#: scalar.c
+#, c-format
+msgid "repository at '%s' has different owner"
+msgstr "位於 “%s” 的版本庫有不同的擁有者"
 
 #: scalar.c
 #, c-format
-msgid "git repository gone in '%s'"
-msgstr "git 版本庫在「%s」遺失"
+msgid "repository at '%s' has a format issue"
+msgstr "位於 “%s” 的版本庫有格式問題"
+
+#: scalar.c
+#, c-format
+msgid "repository not found in '%s'"
+msgstr "版本庫不在 “%s”"
+
+#: scalar.c
+#, c-format
+msgid ""
+"to unregister this repository from Scalar, run\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
+msgstr ""
+"如果要從 Scalar 解除這個版本庫的註冊,請執行\n"
+"\tgit config --global --unset --fixed-value scalar.repo \"%s\""
 
 #: scalar.c
 msgid ""
@@ -24385,7 +24674,7 @@ msgstr "無效的作者身分 '%s'"
 msgid "corrupt author: missing date information"
 msgstr "作者資訊損壞:缺少日期資訊"
 
-#: sequencer.c t/helper/test-fast-rebase.c
+#: sequencer.c
 #, c-format
 msgid "could not update %s"
 msgstr "不能更新 %s"
@@ -24480,11 +24769,6 @@ msgstr "不能得到 %s 的提交說明"
 msgid "%s: cannot parse parent commit %s"
 msgstr "%s:不能解析父提交 %s"
 
-#: sequencer.c
-#, c-format
-msgid "could not rename '%s' to '%s'"
-msgstr "不能將 '%s' 重新命名為 '%s'"
-
 #: sequencer.c
 #, c-format
 msgid "could not revert %s... %s"
@@ -24881,6 +25165,10 @@ msgstr "因套用自動貯存而導致衝突。"
 msgid "Autostash exists; creating a new stash entry."
 msgstr "已有自動貯存;建立新貯存項目。"
 
+#: sequencer.c
+msgid "autostash reference is a symref"
+msgstr "autostash 引用是符號引用"
+
 #: sequencer.c
 msgid "could not detach HEAD"
 msgstr "不能分離開頭指標"
@@ -24917,13 +25205,13 @@ msgstr ""
 
 #: sequencer.c
 #, c-format
-msgid "Rebasing (%d/%d)%s"
-msgstr "正在重定基底 (%d/%d)%s"
+msgid "Stopped at %s...  %.*s\n"
+msgstr "停止在 %s... %.*s\n"
 
 #: sequencer.c
 #, c-format
-msgid "Stopped at %s...  %.*s\n"
-msgstr "停止在 %s... %.*s\n"
+msgid "Rebasing (%d/%d)%s"
+msgstr "正在重定基底 (%d/%d)%s"
 
 #: sequencer.c
 #, c-format
@@ -25253,6 +25541,11 @@ msgstr "沒有從 '%s' 複製範本:%s"
 msgid "invalid initial branch name: '%s'"
 msgstr "無效的初始分支名稱:'%s'"
 
+#: setup.c
+#, c-format
+msgid "re-init: ignored --initial-branch=%s"
+msgstr "re-init: 忽略 --initial-branch=%s"
+
 #: setup.c
 #, c-format
 msgid "unable to handle file type %d"
@@ -25268,14 +25561,14 @@ msgid "attempt to reinitialize repository with different hash"
 msgstr "嘗試以不同的雜湊值重新初始化版本庫"
 
 #: setup.c
-#, c-format
-msgid "%s already exists"
-msgstr "%s 已經存在"
+msgid ""
+"attempt to reinitialize repository with different reference storage format"
+msgstr "嘗試以不同的引用儲存格式重新初始化版本庫"
 
 #: setup.c
 #, c-format
-msgid "re-init: ignored --initial-branch=%s"
-msgstr "re-init: 忽略 --initial-branch=%s"
+msgid "%s already exists"
+msgstr "%s 已經存在"
 
 #: setup.c
 #, c-format
@@ -25591,14 +25884,6 @@ msgstr "每次迭代前清除快取樹狀物件"
 msgid "number of entries in the cache tree to invalidate (default 0)"
 msgstr "在快取樹狀物件中,要使失效的項目數量(預設值為 0)"
 
-#: t/helper/test-fast-rebase.c
-msgid "unhandled options"
-msgstr "未處理選項"
-
-#: t/helper/test-fast-rebase.c
-msgid "error preparing revisions"
-msgstr "準備修訂版本時發生錯誤"
-
 #: t/helper/test-reach.c
 #, c-format
 msgid "commit %s is not marked reachable"
@@ -25792,10 +26077,6 @@ msgstr "協定不支援設定遠端服務路徑"
 msgid "invalid remote service path"
 msgstr "無效的遠端服務路徑"
 
-#: transport-helper.c transport.c
-msgid "operation not supported by protocol"
-msgstr "協定不支援該動作"
-
 #: transport-helper.c
 #, c-format
 msgid "can't connect to subservice %s"
@@ -25959,11 +26240,6 @@ msgstr "不能解析 transport.color.* 設定"
 msgid "support for protocol v2 not implemented yet"
 msgstr "協定 v2 的支援尚未實現"
 
-#: transport.c
-#, c-format
-msgid "unknown value for config '%s': %s"
-msgstr "設定 '%s' 的取值未知:%s"
-
 #: transport.c
 #, c-format
 msgid "transport '%s' not allowed"
@@ -26023,6 +26299,10 @@ msgstr "通訊協定不支援 bundle-uri 動作"
 msgid "could not retrieve server-advertised bundle-uri list"
 msgstr "無法取得伺服器公佈的 bundle-uri 清單"
 
+#: transport.c
+msgid "operation not supported by protocol"
+msgstr "協定不支援該動作"
+
 #: tree-walk.c
 msgid "too-short tree object"
 msgstr "太短的樹狀物件"
@@ -26475,6 +26755,10 @@ msgstr "不能存取 '%s'"
 msgid "unable to get current working directory"
 msgstr "不能取得目前工作目錄"
 
+#: wrapper.c
+msgid "unable to get random bytes"
+msgstr "無法取得隨機位元組"
+
 #: wt-status.c
 msgid "Unmerged paths:"
 msgstr "未合併的路徑:"
@@ -27047,6 +27331,11 @@ msgstr "另外,您的索引中包含未提交的變更。"
 msgid "cannot %s: Your index contains uncommitted changes."
 msgstr "不能%s:您的索引中包含未提交的變更。"
 
+#: xdiff-interface.c
+#, c-format
+msgid "unknown style '%s' given for '%s'"
+msgstr "給予「%2$s」的「%1$s」樣式未知"
+
 #: git-merge-octopus.sh git-merge-resolve.sh
 msgid ""
 "Error: Your local changes to the following files would be overwritten by "
@@ -27263,13 +27552,13 @@ msgstr ""
 
 #: git-send-email.perl
 #, perl-format
-msgid "Failed to open %s: %s"
-msgstr "無法開啟 %s: %s"
+msgid "Failed to open %s.final: %s"
+msgstr "無法開啟 %s.final: %s"
 
 #: git-send-email.perl
 #, perl-format
-msgid "Failed to open %s.final: %s"
-msgstr "無法開啟 %s.final: %s"
+msgid "Failed to open %s: %s"
+msgstr "無法開啟 %s: %s"
 
 #: git-send-email.perl
 msgid "Summary email is empty, skipping it\n"
@@ -27504,516 +27793,54 @@ msgstr "略過 %s 含備份後綴 '%s'。\n"
 msgid "Do you really want to send %s? [y|N]: "
 msgstr "您真的要傳送 %s?[y|N]: "
 
-#, c-format
-#~ msgid "It is not possible to %s because you have unmerged files."
-#~ msgstr "無法 %s,有未合併的檔案。"
-
-#~ msgid "do not pass --keep-cr flag to git-mailsplit independent of am.keepcr"
-#~ msgstr "不向 git-mailsplit 傳入 --keep-cr 標記,無視 am.keepcr 的設定"
-
-#~ msgid ""
-#~ "Updates were rejected because the tip of the remote-tracking\n"
-#~ "branch has been updated since the last checkout. You may want\n"
-#~ "to integrate those changes locally (e.g., 'git pull ...')\n"
-#~ "before forcing an update.\n"
-#~ msgstr ""
-#~ "更新被拒,因為遠端追蹤分支的最新指針繼上次簽出後有更新。\n"
-#~ "您可能會希望先將這些變更整合至本地(例如:‘git pull …’)\n"
-#~ "最後才強制更新。\n"
-
-#~ msgid "or do not fetch any tag at all (--no-tags)"
-#~ msgstr "或不抓取任何標籤(--no-tags)"
-
-#~ msgid "current working directory is untracked"
-#~ msgstr "尚未追蹤目前的工作目錄"
-
-#~ msgid "cannot use --contents with final commit object name"
-#~ msgstr "無法將 --contents 與最終的提交物件名稱共用"
-
-#~ msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-#~ msgstr "git bisect--helper --bisect-state (bad|new) [<rev>]"
-
-#~ msgid "won't bisect on cg-seek'ed tree"
-#~ msgstr "不會在做了 cg-seek 的樹狀物件上進行二分搜尋"
-
-#~ msgid "--bisect-terms requires 0 or 1 argument"
-#~ msgstr "--bisect-terms 需要 0 或 1 個引數"
-
-#~ msgid "--bisect-next requires 0 arguments"
-#~ msgstr "--bisect-next 需要 0 個引數"
-
-#~ msgid "--bisect-log requires 0 arguments"
-#~ msgstr "--bisect-log 需要 0 個引數"
-
-#~ msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-#~ msgstr "git env--helper --type=[bool|ulong] <選項> <環境變數>"
-
-#~ msgid "default for git_env_*(...) to fall back on"
-#~ msgstr "git_env_*(...) 的預設值"
-
-#~ msgid "be quiet only use git_env_*() value as exit code"
-#~ msgstr "安靜模式,只使用 git_env_*() 的值作為離開碼"
-
-#, c-format
-#~ msgid ""
-#~ "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-#~ msgstr "選項「--default」預期收到「--type=bool」的布林值,而非「%s」"
-
-#, c-format
-#~ msgid ""
-#~ "option `--default' expects an unsigned long value with `--type=ulong`, "
-#~ "not `%s`"
-#~ msgstr ""
-#~ "選項「--default」預期收到「--type=ulong」的無號 long 數值,而非「%s」"
-
-#~ msgid "please commit or stash them."
-#~ msgstr "請提交或貯存它們。"
-
-#, c-format
-#~ msgid "Unknown mode: %s"
-#~ msgstr "未知模式:%s"
-
-#, c-format
-#~ msgid "%s doesn't support --super-prefix"
-#~ msgstr "%s 不支援 --super-prefix"
-
-#, c-format
-#~ msgid "no prefix given for --super-prefix\n"
-#~ msgstr "沒有為 --super-prefix 提供前綴\n"
-
-#, c-format
-#~ msgid "failed to read object %s"
-#~ msgstr "讀取物件 %s 失敗"
-
-#~ msgid "file write error"
-#~ msgstr "檔案寫錯誤"
-
-#~ msgid "corrupt commit"
-#~ msgstr "損壞的提交"
-
-#~ msgid "corrupt tag"
-#~ msgstr "損壞的標籤"
-
-#, c-format
-#~ msgid "%%(objecttype) does not take arguments"
-#~ msgstr "%%(objecttype) 不帶參數"
-
-#, c-format
-#~ msgid "%%(deltabase) does not take arguments"
-#~ msgstr "%%(deltabase) 不帶參數"
-
-#, c-format
-#~ msgid "%%(body) does not take arguments"
-#~ msgstr "%%(body) 不帶參數"
-
-#, c-format
-#~ msgid "unrecognized email option: %s"
-#~ msgstr "無法識別的 email 選項:%s"
-
-#~ msgid "could not lock HEAD"
-#~ msgstr "不能鎖定 HEAD"
-
-#, c-format
-#~ msgid ""
-#~ "It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-#~ "may speed it up, but you have to be careful not to forget to add\n"
-#~ "new files yourself (see 'git help status')."
-#~ msgstr ""
-#~ "耗費了 %.2f 秒以枚舉未追蹤的檔案。'status -uno' 也許能提高速度,\n"
-#~ "但您需要小心不要忘了新增新檔案(參見 'git help status')。"
-
-#, perl-format
-#~ msgid "%12s %12s %s"
-#~ msgstr "%12s %12s %s"
-
-#, perl-format
-#~ msgid "touched %d path\n"
-#~ msgid_plural "touched %d paths\n"
-#~ msgstr[0] "建立了 %d 個路徑\n"
-
-#~ msgid ""
-#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
-#~ "marked for staging."
-#~ msgstr "如果修補檔能完全套用,編輯區塊將立即標記為暫存。"
-
-#~ msgid ""
-#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
-#~ "marked for stashing."
-#~ msgstr "如果修補檔能完全套用,編輯區塊將立即標記為貯存。"
-
-#~ msgid ""
-#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
-#~ "marked for unstaging."
-#~ msgstr "如果修補檔能完全套用,編輯區塊將立即標記為未暫存。"
-
-#~ msgid ""
-#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
-#~ "marked for applying."
-#~ msgstr "如果修補檔能完全套用,編輯區塊將立即標記為套用。"
-
-#~ msgid ""
-#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
-#~ "marked for discarding."
-#~ msgstr "如果修補檔能完全套用,編輯塊將立即標記為捨棄。"
-
-#, perl-format
-#~ msgid "failed to open hunk edit file for writing: %s"
-#~ msgstr "為寫入開啟區塊編輯檔案失敗:%s"
-
-#, perl-format
-#~ msgid ""
-#~ "---\n"
-#~ "To remove '%s' lines, make them ' ' lines (context).\n"
-#~ "To remove '%s' lines, delete them.\n"
-#~ "Lines starting with %s will be removed.\n"
-#~ msgstr ""
-#~ "---\n"
-#~ "要刪除 '%s' 開始的行,使其成為 ' ' 開始的行(上下文)。\n"
-#~ "要刪除 '%s' 開始的行,刪除它們。\n"
-#~ "以 %s 開始的行將被刪除。\n"
-
-#, perl-format
-#~ msgid "failed to open hunk edit file for reading: %s"
-#~ msgstr "無法讀取區塊編輯檔案:%s"
-
-#~ msgid ""
-#~ "y - stage this hunk\n"
-#~ "n - do not stage this hunk\n"
-#~ "q - quit; do not stage this hunk or any of the remaining ones\n"
-#~ "a - stage this hunk and all later hunks in the file\n"
-#~ "d - do not stage this hunk or any of the later hunks in the file"
-#~ msgstr ""
-#~ "y - 暫存此區塊\n"
-#~ "n - 不要暫存此區塊\n"
-#~ "q - 離開。不暫存此區塊及後面的全部區塊\n"
-#~ "a - 暫存此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不暫存此區塊和本檔案中後面的全部區塊"
-
-#~ msgid ""
-#~ "y - stash this hunk\n"
-#~ "n - do not stash this hunk\n"
-#~ "q - quit; do not stash this hunk or any of the remaining ones\n"
-#~ "a - stash this hunk and all later hunks in the file\n"
-#~ "d - do not stash this hunk or any of the later hunks in the file"
-#~ msgstr ""
-#~ "y - 貯存此區塊\n"
-#~ "n - 不要貯存此區塊\n"
-#~ "q - 離開。不貯存此區塊及後面的全部區塊\n"
-#~ "a - 貯存此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不貯存此區塊和本檔案中後面的全部區塊"
-
-#~ msgid ""
-#~ "y - unstage this hunk\n"
-#~ "n - do not unstage this hunk\n"
-#~ "q - quit; do not unstage this hunk or any of the remaining ones\n"
-#~ "a - unstage this hunk and all later hunks in the file\n"
-#~ "d - do not unstage this hunk or any of the later hunks in the file"
-#~ msgstr ""
-#~ "y - 不暫存此區塊\n"
-#~ "n - 不要不暫存此區塊\n"
-#~ "q - 離開。不要不暫存此區塊及後面的全部區塊\n"
-#~ "a - 不暫存此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不要不暫存此區塊和本檔案中後面的全部區塊"
-
-#~ msgid ""
-#~ "y - apply this hunk to index\n"
-#~ "n - do not apply this hunk to index\n"
-#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
-#~ "a - apply this hunk and all later hunks in the file\n"
-#~ "d - do not apply this hunk or any of the later hunks in the file"
-#~ msgstr ""
-#~ "y - 在索引中套用此區塊\n"
-#~ "n - 不要在索引中套用此區塊\n"
-#~ "q - 離開。不要套用此區塊及後面的全部區塊\n"
-#~ "a - 套用此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不要套用此區塊和本檔案中後面的全部區塊"
-
-#~ msgid ""
-#~ "y - discard this hunk from worktree\n"
-#~ "n - do not discard this hunk from worktree\n"
-#~ "q - quit; do not discard this hunk or any of the remaining ones\n"
-#~ "a - discard this hunk and all later hunks in the file\n"
-#~ "d - do not discard this hunk or any of the later hunks in the file"
-#~ msgstr ""
-#~ "y - 在工作區中捨棄此區塊\n"
-#~ "n - 不要在工作區中捨棄此區塊\n"
-#~ "q - 離開。不要捨棄此區塊及後面的全部區塊\n"
-#~ "a - 捨棄此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不要捨棄此區塊和本檔案中後面的全部區塊"
-
-#~ msgid ""
-#~ "y - discard this hunk from index and worktree\n"
-#~ "n - do not discard this hunk from index and worktree\n"
-#~ "q - quit; do not discard this hunk or any of the remaining ones\n"
-#~ "a - discard this hunk and all later hunks in the file\n"
-#~ "d - do not discard this hunk or any of the later hunks in the file"
-#~ msgstr ""
-#~ "y - 在索引和工作區中捨棄此區塊\n"
-#~ "n - 不要在索引和工作區中捨棄此區塊\n"
-#~ "q - 離開。不要捨棄此區塊及後面的全部區塊\n"
-#~ "a - 捨棄此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不要捨棄此區塊和本檔案中後面的全部區塊"
+#~ msgid "-x and -X cannot be used together"
+#~ msgstr "-x 和 -X 不能同時使用"
 
 #~ msgid ""
-#~ "y - apply this hunk to index and worktree\n"
-#~ "n - do not apply this hunk to index and worktree\n"
-#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
-#~ "a - apply this hunk and all later hunks in the file\n"
-#~ "d - do not apply this hunk or any of the later hunks in the file"
+#~ "--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
+#~ "exclude"
 #~ msgstr ""
-#~ "y - 在索引和工作區中套用此區塊\n"
-#~ "n - 不要在索引和工作區中套用此區塊\n"
-#~ "q - 離開。不要套用此區塊及後面的全部區塊\n"
-#~ "a - 套用此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不要套用此區塊和本檔案中後面的全部區塊"
+#~ "--bundle-uri 與 --depth、--shallow-since 和 --shallow-exclude 不相容"
 
-#~ msgid ""
-#~ "y - apply this hunk to worktree\n"
-#~ "n - do not apply this hunk to worktree\n"
-#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
-#~ "a - apply this hunk and all later hunks in the file\n"
-#~ "d - do not apply this hunk or any of the later hunks in the file"
-#~ msgstr ""
-#~ "y - 在工作區中套用此區塊\n"
-#~ "n - 不要在工作區中套用此區塊\n"
-#~ "q - 離開。不要套用此區塊及後面的全部區塊\n"
-#~ "a - 套用此區塊和本檔案中後面的全部區塊\n"
-#~ "d - 不要套用此區塊和本檔案中後面的全部區塊"
+#~ msgid "--merge-base is incompatible with --stdin"
+#~ msgstr "--merge-base 與 --stdin 不相容"
 
 #~ msgid ""
-#~ "g - select a hunk to go to\n"
-#~ "/ - search for a hunk matching the given regex\n"
-#~ "j - leave this hunk undecided, see next undecided hunk\n"
-#~ "J - leave this hunk undecided, see next hunk\n"
-#~ "k - leave this hunk undecided, see previous undecided hunk\n"
-#~ "K - leave this hunk undecided, see previous hunk\n"
-#~ "s - split the current hunk into smaller hunks\n"
-#~ "e - manually edit the current hunk\n"
-#~ "? - print help\n"
-#~ msgstr ""
-#~ "g - 選擇跳轉到一個區塊\n"
-#~ "/ - 尋找和提供常規表示式符合的區塊\n"
-#~ "j - 維持此區塊未決狀態,檢視下一個未決定區塊\n"
-#~ "J - 維持此區塊未決狀態,檢視下一個區塊\n"
-#~ "k - 維持此區塊未決狀態,檢視上一個未決定區塊\n"
-#~ "K - 維持此區塊未決狀態,檢視上一個區塊\n"
-#~ "s - 分割目前區塊為更小的區塊\n"
-#~ "e - 手動編輯目前區塊\n"
-#~ "? - 顯示說明\n"
-
-#~ msgid "The selected hunks do not apply to the index!\n"
-#~ msgstr "選取區塊不能套用到索引!\n"
+#~ "apply options are incompatible with rebase.autoSquash.  Consider adding --"
+#~ "no-autosquash"
+#~ msgstr "apply 選項與 rebase.autoSquash 不相容。請考慮加上 --no-autosquash"
 
-#, perl-format
-#~ msgid "ignoring unmerged: %s\n"
-#~ msgstr "忽略未套用的:%s\n"
-
-#~ msgid "No other hunks to goto\n"
-#~ msgstr "沒有其它可供跳轉的區塊\n"
-
-#, perl-format
-#~ msgid "Invalid number: '%s'\n"
-#~ msgstr "無效數字:'%s'\n"
-
-#, perl-format
-#~ msgid "Sorry, only %d hunk available.\n"
-#~ msgid_plural "Sorry, only %d hunks available.\n"
-#~ msgstr[0] "對不起,只有 %d 個可用區塊。\n"
+#~ msgid "--exclude-hidden cannot be used together with --branches"
+#~ msgstr "--exclude-hidden 無法與 --branches 同時使用"
 
-#~ msgid "No other hunks to search\n"
-#~ msgstr "沒有其它可供尋找的區塊\n"
+#~ msgid "--exclude-hidden cannot be used together with --tags"
+#~ msgstr "--exclude-hidden 無法與 --tags 同時使用"
 
-#, perl-format
-#~ msgid "Malformed search regexp %s: %s\n"
-#~ msgstr "錯誤的常規表示式 %s:%s\n"
-
-#~ msgid "No hunk matches the given pattern\n"
-#~ msgstr "沒有和提供模式相符合的區塊\n"
-
-#~ msgid "No previous hunk\n"
-#~ msgstr "沒有上一個區塊\n"
-
-#~ msgid "No next hunk\n"
-#~ msgstr "沒有下一個區塊\n"
-
-#~ msgid "Sorry, cannot split this hunk\n"
-#~ msgstr "對不起,不能分割這個區塊\n"
-
-#, perl-format
-#~ msgid "Split into %d hunk.\n"
-#~ msgid_plural "Split into %d hunks.\n"
-#~ msgstr[0] "分割為 %d 塊。\n"
-
-#~ msgid "Sorry, cannot edit this hunk\n"
-#~ msgstr "對不起,不能編輯這個區塊\n"
-
-#~ msgid ""
-#~ "status        - show paths with changes\n"
-#~ "update        - add working tree state to the staged set of changes\n"
-#~ "revert        - revert staged set of changes back to the HEAD version\n"
-#~ "patch         - pick hunks and update selectively\n"
-#~ "diff          - view diff between HEAD and index\n"
-#~ "add untracked - add contents of untracked files to the staged set of "
-#~ "changes\n"
-#~ msgstr ""
-#~ "status        - 顯示含變更的路徑\n"
-#~ "update        - 新增工作區狀態至暫存列表\n"
-#~ "revert        - 還原修改的暫存集至 HEAD 版本\n"
-#~ "patch         - 挑選區塊並且有選擇地更新\n"
-#~ "diff          - 顯示 HEAD 和索引間差異\n"
-#~ "add untracked - 新增未追蹤檔案的內容至暫存列表\n"
-
-#~ msgid "missing --"
-#~ msgstr "缺少 --"
-
-#, perl-format
-#~ msgid "unknown --patch mode: %s"
-#~ msgstr "未知的 --patch 模式:%s"
-
-#, perl-format
-#~ msgid "invalid argument %s, expecting --"
-#~ msgstr "無效的參數 %s,期望是 --"
+#~ msgid "--exclude-hidden cannot be used together with --remotes"
+#~ msgstr "--exclude-hidden 無法與 --remotes 同時使用"
 
 #, c-format
-#~ msgid "unable to normalize object directory: %s"
-#~ msgstr "無法規範化物件目錄: %s"
-
-#~ msgid "reset the bisection state"
-#~ msgstr "清除二分搜尋狀態"
-
-#~ msgid "check whether bad or good terms exist"
-#~ msgstr "檢查壞的或好的術語是否存在"
-
-#~ msgid "print out the bisect terms"
-#~ msgstr "列印二分搜尋術語"
-
-#~ msgid "start the bisect session"
-#~ msgstr "啟動二分搜尋過程"
-
-#~ msgid "find the next bisection commit"
-#~ msgstr "尋找下一個二分搜尋提交"
-
-#~ msgid "mark the state of ref (or refs)"
-#~ msgstr "標記 ref (或 refs) 的狀態"
-
-#~ msgid "list the bisection steps so far"
-#~ msgstr "列出迄今的二分搜尋步驟"
-
-#~ msgid "replay the bisection process from the given file"
-#~ msgstr "從指定檔案重放二分搜尋過程"
-
-#~ msgid "skip some commits for checkout"
-#~ msgstr "略過要簽出的部分提交"
-
-#~ msgid "visualize the bisection"
-#~ msgstr "視覺化二分搜尋過程"
-
-#~ msgid "use <cmd>... to automatically bisect"
-#~ msgstr "使用 <cmd>... 自動進行二分搜尋"
-
-#~ msgid "no log for BISECT_WRITE"
-#~ msgstr "BISECT_WRITE 無日誌"
-
-#~ msgid "Couldn't look up commit object for HEAD"
-#~ msgstr "無法查詢 HEAD 指向的提交物件"
-
-#~ msgid "git bundle create [<options>] <file> <git-rev-list args>"
-#~ msgstr "git bundle create [<選項>] <檔案> <git-rev-list 參數>"
+#~ msgid "only one of '%s', '%s' or '%s' can be given"
+#~ msgstr "只能傳入 “%s”、“%s” 或 “%s”"
 
 #, c-format
-#~ msgid "options '%s' and '%s %s' cannot be used together"
-#~ msgstr "「%s」和「%s %s」選項不得同時使用"
-
-#~ msgid "git commit [<options>] [--] <pathspec>..."
-#~ msgstr "git commit [<選項>] [--] <路徑規格>..."
-
-#~ msgid "git fsck [<options>] [<object>...]"
-#~ msgstr "git fsck [<選項>] [<物件>...]"
-
-#~ msgid "git fsmonitor--daemon stop"
-#~ msgstr "git fsmonitor--daemon stop"
-
-#~ msgid "git fsmonitor--daemon status"
-#~ msgstr "git fsmonitor--daemon status"
-
-#~ msgid "failed to run 'git config'"
-#~ msgstr "無法執行 ‘git config’"
+#~ msgid "'%s' and '%s' cannot be used together"
+#~ msgstr "無法同時使用 “%s” 和 “%s”"
 
 #, c-format
-#~ msgid "could not get 'onto': '%s'"
-#~ msgstr "ç\84¡æ³\95å\8f\96å¾\97 'onto'ï¼\9a'%s'"
+#~ msgid "options '%s', and '%s' cannot be used together"
+#~ msgstr "ç\84¡æ³\95å\90\8cæ\99\82使ç\94¨ â\80\9c%sâ\80\9d å\92\8c â\80\9c%sâ\80\9d é\81¸é \85"
 
-#~ msgid "Could not resolve HEAD to a revision"
-#~ msgstr "無法將 HEAD 解析為一個版本"
+#~ msgid "<commit-ish>"
+#~ msgstr "<提交指示元>"
 
 #, c-format
-#~ msgid "missing required file: %s"
-#~ msgstr "缺少必要檔案:%s"
-
-#~ msgid "git revert [<options>] <commit-ish>..."
-#~ msgstr "git revert [<選項>] <提交號>..."
-
-#~ msgid "git revert <subcommand>"
-#~ msgstr "git revert <子指令>"
-
-#~ msgid "git cherry-pick [<options>] <commit-ish>..."
-#~ msgstr "git cherry-pick [<選項>] <提交號>..."
-
-#~ msgid "git cherry-pick <subcommand>"
-#~ msgstr "git cherry-pick <子指令>"
-
-#~ msgid "git rm [<options>] [--] <file>..."
-#~ msgstr "git rm [<選項>] [--] <檔案>..."
-
-#~ msgid "using --group=trailer with stdin is not supported"
-#~ msgstr "不支援在標準輸入使用 --group=trailer"
-
-#~ msgid "git stash show [<options>] [<stash>]"
-#~ msgstr "git stash show [<選項>] [<stash>]"
-
-#~ msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-#~ msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-
-#~ msgid ""
-#~ "git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-#~ "          [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-#~ "          [--] [<pathspec>...]]"
-#~ msgstr ""
-#~ "git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-#~ "          [-u|--include-untracked] [-a|--all] [-m|--message <消息>]\n"
-#~ "          [--] [<路徑規格>...]]"
-
-#~ msgid ""
-#~ "git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-#~ "               [-u|--include-untracked] [-a|--all] [<message>]"
-#~ msgstr ""
-#~ "git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-#~ "               [-u|--include-untracked] [-a|--all] [<消息>]"
-
-#~ msgid "path into the working tree"
-#~ msgstr "到工作區的路徑"
-
-#~ msgid "recurse into submodules"
-#~ msgstr "在子模組中遞迴"
-
-#~ msgid "check if it is safe to write to the .gitmodules file"
-#~ msgstr "檢查寫入 .gitmodules 檔案是否安全"
-
-#~ msgid "unset the config in the .gitmodules file"
-#~ msgstr "取消 .gitmodules 檔案中的設定"
-
-#~ msgid "git submodule--helper config --unset <name>"
-#~ msgstr "git submodule--helper config --unset <名稱>"
+#~ msgid "%s is incompatible with %s"
+#~ msgstr "%s 與 %s 不相容"
 
 #, c-format
-#~ msgid "'%s' is not a valid submodule--helper subcommand"
-#~ msgstr "'%s' 不是一個有效的 submodule--helper 子指令"
-
-#~ msgid "git upload-pack [<options>] <dir>"
-#~ msgstr "git upload-pack [<選項>] <目錄>"
-
-#~ msgid "git worktree add [<options>] <path> [<commit-ish>]"
-#~ msgstr "git worktree add [<選項>] <路徑> [<提交>]"
+#~ msgid "could not remove reference %s"
+#~ msgstr "無法刪除引用 %s"
 
-#~ msgid "git worktree lock [<options>] <path>"
-#~ msgstr "git worktree lock [<選項>] <路徑>"
+#~ msgid "unhandled options"
+#~ msgstr "未處理選項"
index e44530c80cf51edfdff846ed476a16c9bae0047a..63fd35d64b141f6f1488c40c4fb34b1fe1e53ae0 100644 (file)
@@ -7,7 +7,7 @@
 #include "environment.h"
 #include "fsmonitor.h"
 #include "gettext.h"
-#include "config.h"
+#include "parse.h"
 #include "preload-index.h"
 #include "progress.h"
 #include "read-cache.h"
index 718530bbab5204b88972849abb95eabd0d3bedaf..bdbed4295aab2f0309eb872170251e2e9b185bbf 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -1252,8 +1252,8 @@ static int format_trailer_match_cb(const struct strbuf *key, void *ud)
        return 0;
 }
 
-static struct strbuf *expand_separator(struct strbuf *sb,
-                                      const char *argval, size_t arglen)
+static struct strbuf *expand_string_arg(struct strbuf *sb,
+                                       const char *argval, size_t arglen)
 {
        char *fmt = xstrndup(argval, arglen);
        const char *format = fmt;
@@ -1301,9 +1301,9 @@ int format_set_trailers_options(struct process_trailer_options *opts,
                        opts->filter_data = filter_list;
                        opts->only_trailers = 1;
                } else if (match_placeholder_arg_value(*arg, "separator", arg, &argval, &arglen)) {
-                       opts->separator = expand_separator(sepbuf, argval, arglen);
+                       opts->separator = expand_string_arg(sepbuf, argval, arglen);
                } else if (match_placeholder_arg_value(*arg, "key_value_separator", arg, &argval, &arglen)) {
-                       opts->key_value_separator = expand_separator(kvsepbuf, argval, arglen);
+                       opts->key_value_separator = expand_string_arg(kvsepbuf, argval, arglen);
                } else if (!match_placeholder_bool_arg(*arg, "only", arg, &opts->only_trailers) &&
                           !match_placeholder_bool_arg(*arg, "unfold", arg, &opts->unfold) &&
                           !match_placeholder_bool_arg(*arg, "keyonly", arg, &opts->key_only) &&
@@ -1384,6 +1384,44 @@ static size_t parse_describe_args(const char *start, struct strvec *args)
        return arg - start;
 }
 
+
+static int parse_decoration_option(const char **arg,
+                                  const char *name,
+                                  char **opt)
+{
+       const char *argval;
+       size_t arglen;
+
+       if (match_placeholder_arg_value(*arg, name, arg, &argval, &arglen)) {
+               struct strbuf sb = STRBUF_INIT;
+
+               expand_string_arg(&sb, argval, arglen);
+               *opt = strbuf_detach(&sb, NULL);
+               return 1;
+       }
+       return 0;
+}
+
+static void parse_decoration_options(const char **arg,
+                                    struct decoration_options *opts)
+{
+       while (parse_decoration_option(arg, "prefix", &opts->prefix) ||
+              parse_decoration_option(arg, "suffix", &opts->suffix) ||
+              parse_decoration_option(arg, "separator", &opts->separator) ||
+              parse_decoration_option(arg, "pointer", &opts->pointer) ||
+              parse_decoration_option(arg, "tag", &opts->tag))
+               ;
+}
+
+static void free_decoration_options(const struct decoration_options *opts)
+{
+       free(opts->prefix);
+       free(opts->suffix);
+       free(opts->separator);
+       free(opts->pointer);
+       free(opts->tag);
+}
+
 static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
                                const char *placeholder,
                                void *context)
@@ -1537,11 +1575,18 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
                strbuf_addstr(sb, get_revision_mark(NULL, commit));
                return 1;
        case 'd':
-               format_decorations(sb, commit, c->auto_color);
+               format_decorations(sb, commit, c->auto_color, NULL);
                return 1;
        case 'D':
-               format_decorations_extended(sb, commit, c->auto_color, "", ", ", "");
-               return 1;
+               {
+                       const struct decoration_options opts = {
+                               .prefix = "",
+                               .suffix = ""
+                       };
+
+                       format_decorations(sb, commit, c->auto_color, &opts);
+                       return 1;
+               }
        case 'S':               /* tag/branch like --source */
                if (!(c->pretty_ctx->rev && c->pretty_ctx->rev->sources))
                        return 0;
@@ -1638,6 +1683,23 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
                return 2;
        }
 
+       if (skip_prefix(placeholder, "(decorate", &arg)) {
+               struct decoration_options opts = { NULL };
+               size_t ret = 0;
+
+               if (*arg == ':') {
+                       arg++;
+                       parse_decoration_options(&arg, &opts);
+               }
+               if (*arg == ')') {
+                       format_decorations(sb, commit, c->auto_color, &opts);
+                       ret = arg - placeholder + 1;
+               }
+
+               free_decoration_options(&opts);
+               return ret;
+       }
+
        /* For the rest we have to parse the commit header. */
        if (!c->commit_header_parsed) {
                msg = c->message =
@@ -1697,7 +1759,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
                                goto trailer_out;
                }
                if (*arg == ')') {
-                       format_trailers_from_commit(sb, msg + c->subject_off, &opts);
+                       format_trailers_from_commit(&opts, msg + c->subject_off, sb);
                        ret = arg - placeholder + 1;
                }
        trailer_out:
@@ -1899,6 +1961,10 @@ void userformat_find_requirements(const char *fmt, struct userformat_want *w)
                case 'D':
                        w->decorate = 1;
                        break;
+               case '(':
+                       if (starts_with(fmt + 1, "decorate"))
+                               w->decorate = 1;
+                       break;
                }
        }
 }
index f695798acac72bd703dfacc59f83054fd761b619..c83cb60bf17eb490ccc3abc97a1b6f6679196e07 100644 (file)
@@ -17,7 +17,7 @@
 #include "trace.h"
 #include "trace2.h"
 #include "utf8.h"
-#include "config.h"
+#include "parse.h"
 
 #define TP_IDX_MAX      8
 
index 3baa33f63d87a675947bafcdfe3a798b02410de2..8935fe4dfb9414f101bf603aaf866ac6a1f6e027 100644 (file)
--- a/prompt.c
+++ b/prompt.c
@@ -1,5 +1,5 @@
 #include "git-compat-util.h"
-#include "config.h"
+#include "parse.h"
 #include "environment.h"
 #include "run-command.h"
 #include "strbuf.h"
index 808a68c974ab7715513657c62d238aae8d3af07f..75f4cbb0a70951a85c8e5a4dba853f027ee7cf4b 100644 (file)
@@ -3,7 +3,6 @@
 #include "gettext.h"
 #include "hex.h"
 #include "pkt-line.h"
-#include "strvec.h"
 #include "hash-ll.h"
 #include "hex.h"
 #include "object.h"
index de66bf80f8409370069fed46ce97dadb25519d7d..1e574bbd80be1bf9d9366dfefd24e3016ec87cf0 100644 (file)
@@ -18,7 +18,7 @@
  * with Linus Torvalds <torvalds@osdl.org> as the point of
  * contact. September 2005.
  *
- * See http://www.iana.org/assignments/port-numbers
+ * See https://www.iana.org/assignments/port-numbers
  */
 #define DEFAULT_GIT_PORT 9418
 
index 2e86063491e11fcf9162da016be8471f603e07a2..c45b6d849cbf4f97ec3d6eb893259837d25d9052 100644 (file)
@@ -60,7 +60,7 @@ static int read_patches(const char *range, struct string_list *list,
                     "--output-indicator-context=#",
                     "--no-abbrev-commit",
                     "--pretty=medium",
-                    "--notes",
+                    "--show-notes-by-default",
                     NULL);
        strvec_push(&cp.args, range);
        if (other_arg)
@@ -230,16 +230,19 @@ cleanup:
 }
 
 static int patch_util_cmp(const void *cmp_data UNUSED,
-                         const struct patch_util *a,
-                         const struct patch_util *b,
-                         const char *keydata)
+                         const struct hashmap_entry *ha,
+                         const struct hashmap_entry *hb,
+                         const void *keydata)
 {
+       const struct patch_util
+               *a = container_of(ha, const struct patch_util, e),
+               *b = container_of(hb, const struct patch_util, e);
        return strcmp(a->diff, keydata ? keydata : b->diff);
 }
 
 static void find_exact_matches(struct string_list *a, struct string_list *b)
 {
-       struct hashmap map = HASHMAP_INIT((hashmap_cmp_fn)patch_util_cmp, NULL);
+       struct hashmap map = HASHMAP_INIT(patch_util_cmp, NULL);
        int i;
 
        /* First, add the patches of a to a hash map */
index 0ce8f83e56a9b42400b8ec792b19deb3a69ddb6e..3b85add243ba79a4ccc90c9faacbb9fee2742303 100644 (file)
@@ -2,7 +2,6 @@
 #include "gettext.h"
 #include "hex.h"
 #include "refs.h"
-#include "tag.h"
 #include "commit.h"
 #include "blob.h"
 #include "diff.h"
@@ -18,6 +17,7 @@
 #include "pack-mtimes.h"
 #include "config.h"
 #include "run-command.h"
+#include "sequencer.h"
 
 struct connectivity_progress {
        struct progress *progress;
@@ -31,6 +31,52 @@ static void update_progress(struct connectivity_progress *cp)
                display_progress(cp->progress, cp->count);
 }
 
+static void add_one_file(const char *path, struct rev_info *revs)
+{
+       struct strbuf buf = STRBUF_INIT;
+       struct object_id oid;
+       struct object *object;
+
+       if (!read_oneliner(&buf, path, READ_ONELINER_SKIP_IF_EMPTY)) {
+               strbuf_release(&buf);
+               return;
+       }
+       strbuf_trim(&buf);
+       if (!get_oid_hex(buf.buf, &oid)) {
+               object = parse_object_or_die(&oid, buf.buf);
+               add_pending_object(revs, object, "");
+       }
+       strbuf_release(&buf);
+}
+
+/* Mark objects recorded in rebase state files as reachable. */
+static void add_rebase_files(struct rev_info *revs)
+{
+       struct strbuf buf = STRBUF_INIT;
+       size_t len;
+       const char *path[] = {
+               "rebase-apply/autostash",
+               "rebase-apply/orig-head",
+               "rebase-merge/autostash",
+               "rebase-merge/orig-head",
+       };
+       struct worktree **worktrees = get_worktrees();
+
+       for (struct worktree **wt = worktrees; *wt; wt++) {
+               strbuf_reset(&buf);
+               strbuf_addstr(&buf, get_worktree_git_dir(*wt));
+               strbuf_complete(&buf, '/');
+               len = buf.len;
+               for (size_t i = 0; i < ARRAY_SIZE(path); i++) {
+                       strbuf_setlen(&buf, len);
+                       strbuf_addstr(&buf, path[i]);
+                       add_one_file(buf.buf, revs);
+               }
+       }
+       strbuf_release(&buf);
+       free_worktrees(worktrees);
+}
+
 static int add_one_ref(const char *path, const struct object_id *oid,
                       int flag, void *cb_data)
 {
@@ -323,6 +369,9 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
        head_ref(add_one_ref, revs);
        other_head_refs(add_one_ref, revs);
 
+       /* rebase autostash and orig-head */
+       add_rebase_files(revs);
+
        /* Add all reflog info */
        if (mark_reflog)
                add_reflogs_to_pending(revs, 0);
index 9a1a7edc5a22cf0b0d91f7edd03225ea19607156..2a50a784f0ec6ae4da94fed41345e625c5bbce1c 100644 (file)
@@ -436,6 +436,14 @@ int match_stat_data_racy(const struct index_state *istate,
 
 void fill_stat_cache_info(struct index_state *istate, struct cache_entry *ce, struct stat *st);
 
+/*
+ * Fill members of st by members of sd enough to convince match_stat()
+ * to consider that they match.  It should be usable as a replacement
+ * for lstat() for a tracked path that is known to be up-to-date via
+ * some out-of-line means (like fsmonitor).
+ */
+int fake_lstat(const struct cache_entry *ce, struct stat *st);
+
 #define REFRESH_REALLY                   (1 << 0) /* ignore_valid */
 #define REFRESH_UNMERGED                 (1 << 1) /* allow unmerged */
 #define REFRESH_QUIET                    (1 << 2) /* be quiet about it */
index 080bd39713bc1782434b7212954e6bc590fa4d6d..f546cf7875cbfefddbec2449e8303786e485a8dd 100644 (file)
@@ -20,7 +20,6 @@
 #include "oid-array.h"
 #include "tree.h"
 #include "commit.h"
-#include "blob.h"
 #include "environment.h"
 #include "gettext.h"
 #include "mem-pool.h"
@@ -31,7 +30,6 @@
 #include "read-cache.h"
 #include "resolve-undo.h"
 #include "revision.h"
-#include "run-command.h"
 #include "strbuf.h"
 #include "trace2.h"
 #include "varint.h"
@@ -197,6 +195,33 @@ void fill_stat_cache_info(struct index_state *istate, struct cache_entry *ce, st
        }
 }
 
+static unsigned int st_mode_from_ce(const struct cache_entry *ce)
+{
+       extern int trust_executable_bit, has_symlinks;
+
+       switch (ce->ce_mode & S_IFMT) {
+       case S_IFLNK:
+               return has_symlinks ? S_IFLNK : (S_IFREG | 0644);
+       case S_IFREG:
+               return (ce->ce_mode & (trust_executable_bit ? 0755 : 0644)) | S_IFREG;
+       case S_IFGITLINK:
+               return S_IFDIR | 0755;
+       case S_IFDIR:
+               return ce->ce_mode;
+       default:
+               BUG("unsupported ce_mode: %o", ce->ce_mode);
+       }
+}
+
+int fake_lstat(const struct cache_entry *ce, struct stat *st)
+{
+       fake_lstat_data(&ce->ce_stat_data, st);
+       st->st_mode = st_mode_from_ce(ce);
+
+       /* always succeed as lstat() replacement */
+       return 0;
+}
+
 static int ce_compare_data(struct index_state *istate,
                           const struct cache_entry *ce,
                           struct stat *st)
index 17a570f1ff97fab8e789d2960ae54894b1c42a80..69a1822da34ce7b5877c7aace0a770ef51c655fd 100644 (file)
--- a/rebase.c
+++ b/rebase.c
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "rebase.h"
-#include "config.h"
+#include "parse.h"
 #include "gettext.h"
 
 /*
index 1bfaf20fbff664b09d1c902be499040c8396e363..03542d023686f8b9d7089dddef0d17caf6c1ae44 100644 (file)
@@ -13,6 +13,8 @@
 #include "oid-array.h"
 #include "repository.h"
 #include "commit.h"
+#include "mailmap.h"
+#include "ident.h"
 #include "remote.h"
 #include "color.h"
 #include "tag.h"
 #include "ref-filter.h"
 #include "revision.h"
 #include "utf8.h"
-#include "version.h"
 #include "versioncmp.h"
 #include "trailer.h"
 #include "wt-status.h"
 #include "commit-slab.h"
-#include "commit-graph.h"
 #include "commit-reach.h"
 #include "worktree.h"
 #include "hashmap.h"
-#include "strvec.h"
 
 static struct ref_msg {
        const char *gone;
@@ -215,8 +214,16 @@ static struct used_atom {
                struct {
                        enum { O_SIZE, O_SIZE_DISK } option;
                } objectsize;
-               struct email_option {
-                       enum { EO_RAW, EO_TRIM, EO_LOCALPART } option;
+               struct {
+                       enum { N_RAW, N_MAILMAP } option;
+               } name_option;
+               struct {
+                       enum {
+                               EO_RAW = 0,
+                               EO_TRIM = 1<<0,
+                               EO_LOCALPART = 1<<1,
+                               EO_MAILMAP = 1<<2,
+                       } option;
                } email_option;
                struct {
                        enum { S_BARE, S_GRADE, S_SIGNER, S_KEY,
@@ -549,7 +556,8 @@ static int signature_atom_parser(struct ref_format *format UNUSED,
        return 0;
 }
 
-static int trailers_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int trailers_atom_parser(struct ref_format *format UNUSED,
+                               struct used_atom *atom,
                                const char *arg, struct strbuf *err)
 {
        atom->u.contents.trailer_opts.no_divider = 1;
@@ -582,9 +590,10 @@ static int contents_atom_parser(struct ref_format *format, struct used_atom *ato
                atom->u.contents.option = C_BARE;
        else if (!strcmp(arg, "body"))
                atom->u.contents.option = C_BODY;
-       else if (!strcmp(arg, "size"))
+       else if (!strcmp(arg, "size")) {
+               atom->type = FIELD_ULONG;
                atom->u.contents.option = C_LENGTH;
-       else if (!strcmp(arg, "signature"))
+       else if (!strcmp(arg, "signature"))
                atom->u.contents.option = C_SIG;
        else if (!strcmp(arg, "subject"))
                atom->u.contents.option = C_SUB;
@@ -690,9 +699,10 @@ static int raw_atom_parser(struct ref_format *format UNUSED,
 {
        if (!arg)
                atom->u.raw_data.option = RAW_BARE;
-       else if (!strcmp(arg, "size"))
+       else if (!strcmp(arg, "size")) {
+               atom->type = FIELD_ULONG;
                atom->u.raw_data.option = RAW_LENGTH;
-       else
+       else
                return err_bad_arg(err, "raw", arg);
        return 0;
 }
@@ -717,21 +727,55 @@ static int oid_atom_parser(struct ref_format *format UNUSED,
        return 0;
 }
 
-static int person_email_atom_parser(struct ref_format *format UNUSED,
-                                   struct used_atom *atom,
-                                   const char *arg, struct strbuf *err)
+static int person_name_atom_parser(struct ref_format *format UNUSED,
+                                  struct used_atom *atom,
+                                  const char *arg, struct strbuf *err)
 {
        if (!arg)
-               atom->u.email_option.option = EO_RAW;
-       else if (!strcmp(arg, "trim"))
-               atom->u.email_option.option = EO_TRIM;
-       else if (!strcmp(arg, "localpart"))
-               atom->u.email_option.option = EO_LOCALPART;
+               atom->u.name_option.option = N_RAW;
+       else if (!strcmp(arg, "mailmap"))
+               atom->u.name_option.option = N_MAILMAP;
        else
                return err_bad_arg(err, atom->name, arg);
        return 0;
 }
 
+static int email_atom_option_parser(struct used_atom *atom,
+                                   const char **arg, struct strbuf *err)
+{
+       if (!*arg)
+               return EO_RAW;
+       if (skip_prefix(*arg, "trim", arg))
+               return EO_TRIM;
+       if (skip_prefix(*arg, "localpart", arg))
+               return EO_LOCALPART;
+       if (skip_prefix(*arg, "mailmap", arg))
+               return EO_MAILMAP;
+       return -1;
+}
+
+static int person_email_atom_parser(struct ref_format *format UNUSED,
+                                   struct used_atom *atom,
+                                   const char *arg, struct strbuf *err)
+{
+       for (;;) {
+               int opt = email_atom_option_parser(atom, &arg, err);
+               const char *bad_arg = arg;
+
+               if (opt < 0)
+                       return err_bad_arg(err, atom->name, bad_arg);
+               atom->u.email_option.option |= opt;
+
+               if (!arg || !*arg)
+                       break;
+               if (*arg == ',')
+                       arg++;
+               else
+                       return err_bad_arg(err, atom->name, bad_arg);
+       }
+       return 0;
+}
+
 static int refname_atom_parser(struct ref_format *format UNUSED,
                               struct used_atom *atom,
                               const char *arg, struct strbuf *err)
@@ -819,7 +863,7 @@ static int if_atom_parser(struct ref_format *format UNUSED,
        return 0;
 }
 
-static int rest_atom_parser(struct ref_format *format,
+static int rest_atom_parser(struct ref_format *format UNUSED,
                            struct used_atom *atom UNUSED,
                            const char *arg, struct strbuf *err)
 {
@@ -828,7 +872,8 @@ static int rest_atom_parser(struct ref_format *format,
        return 0;
 }
 
-static int ahead_behind_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int ahead_behind_atom_parser(struct ref_format *format,
+                                   struct used_atom *atom UNUSED,
                                    const char *arg, struct strbuf *err)
 {
        struct string_list_item *item;
@@ -873,15 +918,15 @@ static struct {
        [ATOM_TYPE] = { "type", SOURCE_OBJ },
        [ATOM_TAG] = { "tag", SOURCE_OBJ },
        [ATOM_AUTHOR] = { "author", SOURCE_OBJ },
-       [ATOM_AUTHORNAME] = { "authorname", SOURCE_OBJ },
+       [ATOM_AUTHORNAME] = { "authorname", SOURCE_OBJ, FIELD_STR, person_name_atom_parser },
        [ATOM_AUTHOREMAIL] = { "authoremail", SOURCE_OBJ, FIELD_STR, person_email_atom_parser },
        [ATOM_AUTHORDATE] = { "authordate", SOURCE_OBJ, FIELD_TIME },
        [ATOM_COMMITTER] = { "committer", SOURCE_OBJ },
-       [ATOM_COMMITTERNAME] = { "committername", SOURCE_OBJ },
+       [ATOM_COMMITTERNAME] = { "committername", SOURCE_OBJ, FIELD_STR, person_name_atom_parser },
        [ATOM_COMMITTEREMAIL] = { "committeremail", SOURCE_OBJ, FIELD_STR, person_email_atom_parser },
        [ATOM_COMMITTERDATE] = { "committerdate", SOURCE_OBJ, FIELD_TIME },
        [ATOM_TAGGER] = { "tagger", SOURCE_OBJ },
-       [ATOM_TAGGERNAME] = { "taggername", SOURCE_OBJ },
+       [ATOM_TAGGERNAME] = { "taggername", SOURCE_OBJ, FIELD_STR, person_name_atom_parser },
        [ATOM_TAGGEREMAIL] = { "taggeremail", SOURCE_OBJ, FIELD_STR, person_email_atom_parser },
        [ATOM_TAGGERDATE] = { "taggerdate", SOURCE_OBJ, FIELD_TIME },
        [ATOM_CREATOR] = { "creator", SOURCE_OBJ },
@@ -1482,32 +1527,49 @@ static const char *copy_name(const char *buf)
        return xstrdup("");
 }
 
+static const char *find_end_of_email(const char *email, int opt)
+{
+       const char *eoemail;
+
+       if (opt & EO_LOCALPART) {
+               eoemail = strchr(email, '@');
+               if (eoemail)
+                       return eoemail;
+               return strchr(email, '>');
+       }
+
+       if (opt & EO_TRIM)
+               return strchr(email, '>');
+
+       /*
+        * The option here is either the raw email option or the raw
+        * mailmap option (that is EO_RAW or EO_MAILMAP). In such cases,
+        * we directly grab the whole email including the closing
+        * angle brackets.
+        *
+        * If EO_MAILMAP was set with any other option (that is either
+        * EO_TRIM or EO_LOCALPART), we already grab the end of email
+        * above.
+        */
+       eoemail = strchr(email, '>');
+       if (eoemail)
+               eoemail++;
+       return eoemail;
+}
+
 static const char *copy_email(const char *buf, struct used_atom *atom)
 {
        const char *email = strchr(buf, '<');
        const char *eoemail;
+       int opt = atom->u.email_option.option;
+
        if (!email)
                return xstrdup("");
-       switch (atom->u.email_option.option) {
-       case EO_RAW:
-               eoemail = strchr(email, '>');
-               if (eoemail)
-                       eoemail++;
-               break;
-       case EO_TRIM:
-               email++;
-               eoemail = strchr(email, '>');
-               break;
-       case EO_LOCALPART:
+
+       if (opt & (EO_LOCALPART | EO_TRIM))
                email++;
-               eoemail = strchr(email, '@');
-               if (!eoemail)
-                       eoemail = strchr(email, '>');
-               break;
-       default:
-               BUG("unknown email option");
-       }
 
+       eoemail = find_end_of_email(email, opt);
        if (!eoemail)
                return xstrdup("");
        return xmemdupz(email, eoemail - email);
@@ -1549,6 +1611,12 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
        if (formatp) {
                formatp++;
                parse_date_format(formatp, &date_mode);
+
+               /*
+                * If this is a sort field and a format was specified, we'll
+                * want to compare formatted date by string value.
+                */
+               v->atom->type = FIELD_STR;
        }
 
        if (!eoemail)
@@ -1568,16 +1636,23 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
        v->value = 0;
 }
 
+static struct string_list mailmap = STRING_LIST_INIT_NODUP;
+
 /* See grab_values */
 static void grab_person(const char *who, struct atom_value *val, int deref, void *buf)
 {
        int i;
        int wholen = strlen(who);
        const char *wholine = NULL;
+       const char *headers[] = { "author ", "committer ",
+                                 "tagger ", NULL };
 
        for (i = 0; i < used_atom_cnt; i++) {
-               const char *name = used_atom[i].name;
+               struct used_atom *atom = &used_atom[i];
+               const char *name = atom->name;
                struct atom_value *v = &val[i];
+               struct strbuf mailmap_buf = STRBUF_INIT;
+
                if (!!deref != (*name == '*'))
                        continue;
                if (deref)
@@ -1585,22 +1660,36 @@ static void grab_person(const char *who, struct atom_value *val, int deref, void
                if (strncmp(who, name, wholen))
                        continue;
                if (name[wholen] != 0 &&
-                   strcmp(name + wholen, "name") &&
+                   !starts_with(name + wholen, "name") &&
                    !starts_with(name + wholen, "email") &&
                    !starts_with(name + wholen, "date"))
                        continue;
-               if (!wholine)
+
+               if ((starts_with(name + wholen, "name") &&
+                   (atom->u.name_option.option == N_MAILMAP)) ||
+                   (starts_with(name + wholen, "email") &&
+                   (atom->u.email_option.option & EO_MAILMAP))) {
+                       if (!mailmap.items)
+                               read_mailmap(&mailmap);
+                       strbuf_addstr(&mailmap_buf, buf);
+                       apply_mailmap_to_header(&mailmap_buf, headers, &mailmap);
+                       wholine = find_wholine(who, wholen, mailmap_buf.buf);
+               } else {
                        wholine = find_wholine(who, wholen, buf);
+               }
+
                if (!wholine)
                        return; /* no point looking for it */
                if (name[wholen] == 0)
                        v->s = copy_line(wholine);
-               else if (!strcmp(name + wholen, "name"))
+               else if (starts_with(name + wholen, "name"))
                        v->s = copy_name(wholine);
                else if (starts_with(name + wholen, "email"))
                        v->s = copy_email(wholine, &used_atom[i]);
                else if (starts_with(name + wholen, "date"))
                        grab_date(wholine, v, name);
+
+               strbuf_release(&mailmap_buf);
        }
 
        /*
@@ -1857,7 +1946,8 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
                                v->s = xmemdupz(buf, buf_size);
                                v->s_size = buf_size;
                        } else if (atom->u.raw_data.option == RAW_LENGTH) {
-                               v->s = xstrfmt("%"PRIuMAX, (uintmax_t)buf_size);
+                               v->value = buf_size;
+                               v->s = xstrfmt("%"PRIuMAX, v->value);
                        }
                        continue;
                }
@@ -1883,9 +1973,10 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
                        v->s = strbuf_detach(&sb, NULL);
                } else if (atom->u.contents.option == C_BODY_DEP)
                        v->s = xmemdupz(bodypos, bodylen);
-               else if (atom->u.contents.option == C_LENGTH)
-                       v->s = xstrfmt("%"PRIuMAX, (uintmax_t)strlen(subpos));
-               else if (atom->u.contents.option == C_BODY)
+               else if (atom->u.contents.option == C_LENGTH) {
+                       v->value = strlen(subpos);
+                       v->s = xstrfmt("%"PRIuMAX, v->value);
+               } else if (atom->u.contents.option == C_BODY)
                        v->s = xmemdupz(bodypos, nonsiglen);
                else if (atom->u.contents.option == C_SIG)
                        v->s = xmemdupz(sigpos, siglen);
@@ -1900,7 +1991,7 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
                        struct strbuf s = STRBUF_INIT;
 
                        /* Format the trailer info according to the trailer_opts given */
-                       format_trailers_from_commit(&s, subpos, &atom->u.contents.trailer_opts);
+                       format_trailers_from_commit(&atom->u.contents.trailer_opts, subpos, &s);
 
                        v->s = strbuf_detach(&s, NULL);
                } else if (atom->u.contents.option == C_BARE)
@@ -2124,7 +2215,7 @@ char *get_head_description(void)
                                    state.detached_from);
        } else if (state.bisect_in_progress)
                strbuf_addf(&desc, _("(no branch, bisect started on %s)"),
-                           state.branch);
+                           state.bisecting_from);
        else if (state.detached_from) {
                if (state.detached_at)
                        strbuf_addf(&desc, _("(HEAD detached at %s)"),
@@ -2265,6 +2356,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
 
                v->s_size = ATOM_SIZE_UNSPECIFIED;
                v->handler = append_atom;
+               v->value = 0;
                v->atom = atom;
 
                if (*name == '*') {
@@ -2419,17 +2511,12 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
                return 0;
 
        /*
-        * If it is a tag object, see if we use a value that derefs
-        * the object, and if we do grab the object it refers to.
+        * If it is a tag object, see if we use the peeled value. If we do,
+        * grab the peeled OID.
         */
-       oi_deref.oid = *get_tagged_oid((struct tag *)obj);
+       if (need_tagged && peel_iterated_oid(&obj->oid, &oi_deref.oid))
+               die("bad tag");
 
-       /*
-        * NEEDSWORK: This derefs tag only once, which
-        * is good to deal with chains of trust, but
-        * is not consistent with what deref_tag() does
-        * which peels the onion to the core.
-        */
        return get_object(ref, 1, &obj, &oi_deref, err);
 }
 
@@ -2541,6 +2628,12 @@ static int for_each_fullref_in_pattern(struct ref_filter *filter,
                                       each_ref_fn cb,
                                       void *cb_data)
 {
+       if (filter->kind == FILTER_REFS_KIND_MASK) {
+               /* In this case, we want to print all refs including root refs. */
+               return refs_for_each_include_root_refs(get_main_ref_store(the_repository),
+                                                      cb, cb_data);
+       }
+
        if (!filter->match_as_path) {
                /*
                 * in this case, the patterns are applied after
@@ -2627,15 +2720,18 @@ static struct ref_array_item *new_ref_array_item(const char *refname,
        return ref;
 }
 
+static void ref_array_append(struct ref_array *array, struct ref_array_item *ref)
+{
+       ALLOC_GROW(array->items, array->nr + 1, array->alloc);
+       array->items[array->nr++] = ref;
+}
+
 struct ref_array_item *ref_array_push(struct ref_array *array,
                                      const char *refname,
                                      const struct object_id *oid)
 {
        struct ref_array_item *ref = new_ref_array_item(refname, oid);
-
-       ALLOC_GROW(array->items, array->nr + 1, array->alloc);
-       array->items[array->nr++] = ref;
-
+       ref_array_append(array, ref);
        return ref;
 }
 
@@ -2660,6 +2756,9 @@ static int ref_kind_from_refname(const char *refname)
                        return ref_kind[i].kind;
        }
 
+       if (is_pseudoref(get_main_ref_store(the_repository), refname))
+               return FILTER_REFS_PSEUDOREFS;
+
        return FILTER_REFS_OTHERS;
 }
 
@@ -2672,48 +2771,45 @@ static int filter_ref_kind(struct ref_filter *filter, const char *refname)
        return ref_kind_from_refname(refname);
 }
 
-struct ref_filter_cbdata {
-       struct ref_array *array;
-       struct ref_filter *filter;
-       struct contains_cache contains_cache;
-       struct contains_cache no_contains_cache;
-};
-
-/*
- * A call-back given to for_each_ref().  Filter refs and keep them for
- * later object processing.
- */
-static int ref_filter_handler(const char *refname, const struct object_id *oid, int flag, void *cb_data)
+static struct ref_array_item *apply_ref_filter(const char *refname, const struct object_id *oid,
+                           int flag, struct ref_filter *filter)
 {
-       struct ref_filter_cbdata *ref_cbdata = cb_data;
-       struct ref_filter *filter = ref_cbdata->filter;
        struct ref_array_item *ref;
        struct commit *commit = NULL;
        unsigned int kind;
 
        if (flag & REF_BAD_NAME) {
                warning(_("ignoring ref with broken name %s"), refname);
-               return 0;
+               return NULL;
        }
 
        if (flag & REF_ISBROKEN) {
                warning(_("ignoring broken ref %s"), refname);
-               return 0;
+               return NULL;
        }
 
        /* Obtain the current ref kind from filter_ref_kind() and ignore unwanted refs. */
        kind = filter_ref_kind(filter, refname);
-       if (!(kind & filter->kind))
-               return 0;
+
+       /*
+        * Generally HEAD refs are printed with special description denoting a rebase,
+        * detached state and so forth. This is useful when only printing the HEAD ref
+        * But when it is being printed along with other pseudorefs, it makes sense to
+        * keep the formatting consistent. So we mask the type to act like a pseudoref.
+        */
+       if (filter->kind == FILTER_REFS_KIND_MASK && kind == FILTER_REFS_DETACHED_HEAD)
+               kind = FILTER_REFS_PSEUDOREFS;
+       else if (!(kind & filter->kind))
+               return NULL;
 
        if (!filter_pattern_match(filter, refname))
-               return 0;
+               return NULL;
 
        if (filter_exclude_match(filter, refname))
-               return 0;
+               return NULL;
 
        if (filter->points_at.nr && !match_points_at(&filter->points_at, oid, refname))
-               return 0;
+               return NULL;
 
        /*
         * A merge filter is applied on refs pointing to commits. Hence
@@ -2724,15 +2820,15 @@ static int ref_filter_handler(const char *refname, const struct object_id *oid,
            filter->with_commit || filter->no_commit || filter->verbose) {
                commit = lookup_commit_reference_gently(the_repository, oid, 1);
                if (!commit)
-                       return 0;
+                       return NULL;
                /* We perform the filtering for the '--contains' option... */
                if (filter->with_commit &&
-                   !commit_contains(filter, commit, filter->with_commit, &ref_cbdata->contains_cache))
-                       return 0;
+                   !commit_contains(filter, commit, filter->with_commit, &filter->internal.contains_cache))
+                       return NULL;
                /* ...or for the `--no-contains' option */
                if (filter->no_commit &&
-                   commit_contains(filter, commit, filter->no_commit, &ref_cbdata->no_contains_cache))
-                       return 0;
+                   commit_contains(filter, commit, filter->no_commit, &filter->internal.no_contains_cache))
+                       return NULL;
        }
 
        /*
@@ -2740,11 +2836,32 @@ static int ref_filter_handler(const char *refname, const struct object_id *oid,
         * to do its job and the resulting list may yet to be pruned
         * by maxcount logic.
         */
-       ref = ref_array_push(ref_cbdata->array, refname, oid);
+       ref = new_ref_array_item(refname, oid);
        ref->commit = commit;
        ref->flag = flag;
        ref->kind = kind;
 
+       return ref;
+}
+
+struct ref_filter_cbdata {
+       struct ref_array *array;
+       struct ref_filter *filter;
+};
+
+/*
+ * A call-back given to for_each_ref().  Filter refs and keep them for
+ * later object processing.
+ */
+static int filter_one(const char *refname, const struct object_id *oid, int flag, void *cb_data)
+{
+       struct ref_filter_cbdata *ref_cbdata = cb_data;
+       struct ref_array_item *ref;
+
+       ref = apply_ref_filter(refname, oid, flag, ref_cbdata->filter);
+       if (ref)
+               ref_array_append(ref_cbdata->array, ref);
+
        return 0;
 }
 
@@ -2762,6 +2879,49 @@ static void free_array_item(struct ref_array_item *item)
        free(item);
 }
 
+struct ref_filter_and_format_cbdata {
+       struct ref_filter *filter;
+       struct ref_format *format;
+
+       struct ref_filter_and_format_internal {
+               int count;
+       } internal;
+};
+
+static int filter_and_format_one(const char *refname, const struct object_id *oid, int flag, void *cb_data)
+{
+       struct ref_filter_and_format_cbdata *ref_cbdata = cb_data;
+       struct ref_array_item *ref;
+       struct strbuf output = STRBUF_INIT, err = STRBUF_INIT;
+
+       ref = apply_ref_filter(refname, oid, flag, ref_cbdata->filter);
+       if (!ref)
+               return 0;
+
+       if (format_ref_array_item(ref, ref_cbdata->format, &output, &err))
+               die("%s", err.buf);
+
+       if (output.len || !ref_cbdata->format->array_opts.omit_empty) {
+               fwrite(output.buf, 1, output.len, stdout);
+               putchar('\n');
+       }
+
+       strbuf_release(&output);
+       strbuf_release(&err);
+       free_array_item(ref);
+
+       /*
+        * Increment the running count of refs that match the filter. If
+        * max_count is set and we've reached the max, stop the ref
+        * iteration by returning a nonzero value.
+        */
+       if (ref_cbdata->format->array_opts.max_count &&
+           ++ref_cbdata->internal.count >= ref_cbdata->format->array_opts.max_count)
+               return 1;
+
+       return 0;
+}
+
 /* Free all memory allocated for ref_array */
 void ref_array_clear(struct ref_array *array)
 {
@@ -2880,28 +3040,14 @@ void filter_ahead_behind(struct repository *r,
        free(commits);
 }
 
-/*
- * API for filtering a set of refs. Based on the type of refs the user
- * has requested, we iterate through those refs and apply filters
- * as per the given ref_filter structure and finally store the
- * filtered refs in the ref_array structure.
- */
-int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int type)
+static int do_filter_refs(struct ref_filter *filter, unsigned int type, each_ref_fn fn, void *cb_data)
 {
-       struct ref_filter_cbdata ref_cbdata;
-       int save_commit_buffer_orig;
        int ret = 0;
 
-       ref_cbdata.array = array;
-       ref_cbdata.filter = filter;
-
        filter->kind = type & FILTER_REFS_KIND_MASK;
 
-       save_commit_buffer_orig = save_commit_buffer;
-       save_commit_buffer = 0;
-
-       init_contains_cache(&ref_cbdata.contains_cache);
-       init_contains_cache(&ref_cbdata.no_contains_cache);
+       init_contains_cache(&filter->internal.contains_cache);
+       init_contains_cache(&filter->internal.no_contains_cache);
 
        /*  Simple per-ref filtering */
        if (!filter->kind)
@@ -2914,19 +3060,48 @@ int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int
                 * of filter_ref_kind().
                 */
                if (filter->kind == FILTER_REFS_BRANCHES)
-                       ret = for_each_fullref_in("refs/heads/", ref_filter_handler, &ref_cbdata);
+                       ret = for_each_fullref_in("refs/heads/", fn, cb_data);
                else if (filter->kind == FILTER_REFS_REMOTES)
-                       ret = for_each_fullref_in("refs/remotes/", ref_filter_handler, &ref_cbdata);
+                       ret = for_each_fullref_in("refs/remotes/", fn, cb_data);
                else if (filter->kind == FILTER_REFS_TAGS)
-                       ret = for_each_fullref_in("refs/tags/", ref_filter_handler, &ref_cbdata);
-               else if (filter->kind & FILTER_REFS_ALL)
-                       ret = for_each_fullref_in_pattern(filter, ref_filter_handler, &ref_cbdata);
-               if (!ret && (filter->kind & FILTER_REFS_DETACHED_HEAD))
-                       head_ref(ref_filter_handler, &ref_cbdata);
+                       ret = for_each_fullref_in("refs/tags/", fn, cb_data);
+               else if (filter->kind & FILTER_REFS_REGULAR)
+                       ret = for_each_fullref_in_pattern(filter, fn, cb_data);
+
+               /*
+                * When printing all ref types, HEAD is already included,
+                * so we don't want to print HEAD again.
+                */
+               if (!ret && (filter->kind != FILTER_REFS_KIND_MASK) &&
+                   (filter->kind & FILTER_REFS_DETACHED_HEAD))
+                       head_ref(fn, cb_data);
        }
 
-       clear_contains_cache(&ref_cbdata.contains_cache);
-       clear_contains_cache(&ref_cbdata.no_contains_cache);
+       clear_contains_cache(&filter->internal.contains_cache);
+       clear_contains_cache(&filter->internal.no_contains_cache);
+
+       return ret;
+}
+
+/*
+ * API for filtering a set of refs. Based on the type of refs the user
+ * has requested, we iterate through those refs and apply filters
+ * as per the given ref_filter structure and finally store the
+ * filtered refs in the ref_array structure.
+ */
+int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int type)
+{
+       struct ref_filter_cbdata ref_cbdata;
+       int save_commit_buffer_orig;
+       int ret = 0;
+
+       ref_cbdata.array = array;
+       ref_cbdata.filter = filter;
+
+       save_commit_buffer_orig = save_commit_buffer;
+       save_commit_buffer = 0;
+
+       ret = do_filter_refs(filter, type, filter_one, &ref_cbdata);
 
        /*  Filters that need revision walking */
        reach_filter(array, &filter->reachable_from, INCLUDE_REACHED);
@@ -2936,6 +3111,51 @@ int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int
        return ret;
 }
 
+static inline int can_do_iterative_format(struct ref_filter *filter,
+                                         struct ref_sorting *sorting,
+                                         struct ref_format *format)
+{
+       /*
+        * Filtering & formatting results within a single ref iteration
+        * callback is not compatible with options that require
+        * post-processing a filtered ref_array. These include:
+        * - filtering on reachability
+        * - sorting the filtered results
+        * - including ahead-behind information in the formatted output
+        */
+       return !(filter->reachable_from ||
+                filter->unreachable_from ||
+                sorting ||
+                format->bases.nr);
+}
+
+void filter_and_format_refs(struct ref_filter *filter, unsigned int type,
+                           struct ref_sorting *sorting,
+                           struct ref_format *format)
+{
+       if (can_do_iterative_format(filter, sorting, format)) {
+               int save_commit_buffer_orig;
+               struct ref_filter_and_format_cbdata ref_cbdata = {
+                       .filter = filter,
+                       .format = format,
+               };
+
+               save_commit_buffer_orig = save_commit_buffer;
+               save_commit_buffer = 0;
+
+               do_filter_refs(filter, type, filter_and_format_one, &ref_cbdata);
+
+               save_commit_buffer = save_commit_buffer_orig;
+       } else {
+               struct ref_array array = { 0 };
+               filter_refs(&array, filter, type);
+               filter_ahead_behind(the_repository, format, &array);
+               ref_array_sort(sorting, &array);
+               print_formatted_ref_array(&array, format);
+               ref_array_clear(&array);
+       }
+}
+
 static int compare_detached_head(struct ref_array_item *a, struct ref_array_item *b)
 {
        if (!(a->kind ^ b->kind))
@@ -3053,7 +3273,8 @@ void ref_sorting_set_sort_flags_all(struct ref_sorting *sorting,
 
 void ref_array_sort(struct ref_sorting *sorting, struct ref_array *array)
 {
-       QSORT_S(array->items, array->nr, compare_refs, sorting);
+       if (sorting)
+               QSORT_S(array->items, array->nr, compare_refs, sorting);
 }
 
 static void append_literal(const char *cp, const char *ep, struct ref_formatting_state *state)
@@ -3124,6 +3345,29 @@ int format_ref_array_item(struct ref_array_item *info,
        return 0;
 }
 
+void print_formatted_ref_array(struct ref_array *array, struct ref_format *format)
+{
+       int total;
+       struct strbuf output = STRBUF_INIT, err = STRBUF_INIT;
+
+       total = format->array_opts.max_count;
+       if (!total || array->nr < total)
+               total = array->nr;
+       for (int i = 0; i < total; i++) {
+               strbuf_reset(&err);
+               strbuf_reset(&output);
+               if (format_ref_array_item(array->items[i], format, &output, &err))
+                       die("%s", err.buf);
+               if (output.len || !format->array_opts.omit_empty) {
+                       fwrite(output.buf, 1, output.len, stdout);
+                       putchar('\n');
+               }
+       }
+
+       strbuf_release(&err);
+       strbuf_release(&output);
+}
+
 void pretty_print_ref(const char *name, const struct object_id *oid,
                      struct ref_format *format)
 {
@@ -3159,18 +3403,6 @@ static int parse_sorting_atom(const char *atom)
        return res;
 }
 
-/*  If no sorting option is given, use refname to sort as default */
-static struct ref_sorting *ref_default_sorting(void)
-{
-       static const char cstr_name[] = "refname";
-
-       struct ref_sorting *sorting = xcalloc(1, sizeof(*sorting));
-
-       sorting->next = NULL;
-       sorting->atom = parse_sorting_atom(cstr_name);
-       return sorting;
-}
-
 static void parse_ref_sorting(struct ref_sorting **sorting_tail, const char *arg)
 {
        struct ref_sorting *s;
@@ -3194,9 +3426,7 @@ struct ref_sorting *ref_sorting_options(struct string_list *options)
        struct string_list_item *item;
        struct ref_sorting *sorting = NULL, **tail = &sorting;
 
-       if (!options->nr) {
-               sorting = ref_default_sorting();
-       } else {
+       if (options->nr) {
                for_each_string_list_item(item, options)
                        parse_ref_sorting(tail, item->string);
        }
index 1524bc463a5701d475cb68e50caa884a6daf890a..0ca28d2bba6f2aed4b8d084972739f3a88f44caa 100644 (file)
@@ -3,10 +3,10 @@
 
 #include "gettext.h"
 #include "oid-array.h"
-#include "refs.h"
 #include "commit.h"
 #include "string-list.h"
 #include "strvec.h"
+#include "commit-reach.h"
 
 /* Quoting styles */
 #define QUOTE_NONE 0
 #define FILTER_REFS_BRANCHES       0x0004
 #define FILTER_REFS_REMOTES        0x0008
 #define FILTER_REFS_OTHERS         0x0010
-#define FILTER_REFS_ALL            (FILTER_REFS_TAGS | FILTER_REFS_BRANCHES | \
+#define FILTER_REFS_REGULAR        (FILTER_REFS_TAGS | FILTER_REFS_BRANCHES | \
                                    FILTER_REFS_REMOTES | FILTER_REFS_OTHERS)
 #define FILTER_REFS_DETACHED_HEAD  0x0020
-#define FILTER_REFS_KIND_MASK      (FILTER_REFS_ALL | FILTER_REFS_DETACHED_HEAD)
+#define FILTER_REFS_PSEUDOREFS     0x0040
+#define FILTER_REFS_ROOT_REFS      (FILTER_REFS_DETACHED_HEAD | FILTER_REFS_PSEUDOREFS)
+#define FILTER_REFS_KIND_MASK      (FILTER_REFS_REGULAR | FILTER_REFS_DETACHED_HEAD | \
+                                   FILTER_REFS_PSEUDOREFS)
 
 struct atom_value;
 struct ref_sorting;
@@ -75,6 +78,11 @@ struct ref_filter {
                lines;
        int abbrev,
                verbose;
+
+       struct {
+               struct contains_cache contains_cache;
+               struct contains_cache no_contains_cache;
+       } internal;
 };
 
 struct ref_format {
@@ -92,6 +100,11 @@ struct ref_format {
 
        /* List of bases for ahead-behind counts. */
        struct string_list bases;
+
+       struct {
+               int max_count;
+               int omit_empty;
+       } array_opts;
 };
 
 #define REF_FILTER_INIT { \
@@ -126,6 +139,14 @@ struct ref_format {
  * filtered refs in the ref_array structure.
  */
 int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int type);
+/*
+ * Filter refs using the given ref_filter and type, sort the contents
+ * according to the given ref_sorting, format the filtered refs with the
+ * given ref_format, and print them to stdout.
+ */
+void filter_and_format_refs(struct ref_filter *filter, unsigned int type,
+                           struct ref_sorting *sorting,
+                           struct ref_format *format);
 /*  Clear all memory allocated to ref_array */
 void ref_array_clear(struct ref_array *array);
 /*  Used to verify if the given format is correct and to parse out the used atoms */
@@ -150,6 +171,12 @@ char *get_head_description(void);
 /*  Set up translated strings in the output. */
 void setup_ref_filter_porcelain_msg(void);
 
+/*
+ * Print up to maxcount ref_array elements to stdout using the given
+ * ref_format.
+ */
+void print_formatted_ref_array(struct ref_array *array, struct ref_format *format);
+
 /*
  * Print a single ref, outside of any ref-filter. Note that the
  * name must be a fully qualified refname.
index c6992a19268f323e4d11af22ed597e450b393834..647f3ca398a32711eb940281fc05bad43cb303a6 100644 (file)
--- a/reflog.c
+++ b/reflog.c
@@ -6,7 +6,6 @@
 #include "revision.h"
 #include "tree.h"
 #include "tree-walk.h"
-#include "worktree.h"
 
 /* Remember to update object flag allocation in object.h */
 #define INCOMPLETE     (1u<<10)
diff --git a/refs.c b/refs.c
index fcae5dddc6050627668048e966384b7f9fa70171..55d2e0b2cb9e959443e98eb329fdf97eff9073a9 100644 (file)
--- a/refs.c
+++ b/refs.c
 /*
  * List of all available backends
  */
-static struct ref_storage_be *refs_backends = &refs_be_files;
+static const struct ref_storage_be *refs_backends[] = {
+       [REF_STORAGE_FORMAT_FILES] = &refs_be_files,
+       [REF_STORAGE_FORMAT_REFTABLE] = &refs_be_reftable,
+};
 
-static struct ref_storage_be *find_ref_storage_backend(const char *name)
+static const struct ref_storage_be *find_ref_storage_backend(unsigned int ref_storage_format)
 {
-       struct ref_storage_be *be;
-       for (be = refs_backends; be; be = be->next)
-               if (!strcmp(be->name, name))
-                       return be;
+       if (ref_storage_format < ARRAY_SIZE(refs_backends))
+               return refs_backends[ref_storage_format];
        return NULL;
 }
 
+unsigned int ref_storage_format_by_name(const char *name)
+{
+       for (unsigned int i = 0; i < ARRAY_SIZE(refs_backends); i++)
+               if (refs_backends[i] && !strcmp(refs_backends[i]->name, name))
+                       return i;
+       return REF_STORAGE_FORMAT_UNKNOWN;
+}
+
+const char *ref_storage_format_to_name(unsigned int ref_storage_format)
+{
+       const struct ref_storage_be *be = find_ref_storage_backend(ref_storage_format);
+       if (!be)
+               return "unknown";
+       return be->name;
+}
+
 /*
  * How to handle various characters in refnames:
  * 0: An acceptable character for refs
@@ -843,6 +860,47 @@ static int is_pseudoref_syntax(const char *refname)
        return 1;
 }
 
+int is_pseudoref(struct ref_store *refs, const char *refname)
+{
+       static const char *const irregular_pseudorefs[] = {
+               "AUTO_MERGE",
+               "BISECT_EXPECTED_REV",
+               "NOTES_MERGE_PARTIAL",
+               "NOTES_MERGE_REF",
+               "MERGE_AUTOSTASH",
+       };
+       struct object_id oid;
+       size_t i;
+
+       if (!is_pseudoref_syntax(refname))
+               return 0;
+
+       if (ends_with(refname, "_HEAD")) {
+               refs_resolve_ref_unsafe(refs, refname,
+                                       RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
+                                       &oid, NULL);
+               return !is_null_oid(&oid);
+       }
+
+       for (i = 0; i < ARRAY_SIZE(irregular_pseudorefs); i++)
+               if (!strcmp(refname, irregular_pseudorefs[i])) {
+                       refs_resolve_ref_unsafe(refs, refname,
+                                               RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
+                                               &oid, NULL);
+                       return !is_null_oid(&oid);
+               }
+
+       return 0;
+}
+
+int is_headref(struct ref_store *refs, const char *refname)
+{
+       if (!strcmp(refname, "HEAD"))
+               return refs_ref_exists(refs, refname);
+
+       return 0;
+}
+
 static int is_current_worktree_ref(const char *ref) {
        return is_pseudoref_syntax(ref) || is_per_worktree_ref(ref);
 }
@@ -1022,55 +1080,40 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
                           const char *message, void *cb_data)
 {
        struct read_ref_at_cb *cb = cb_data;
-       int reached_count;
 
        cb->tz = tz;
        cb->date = timestamp;
 
-       /*
-        * It is not possible for cb->cnt == 0 on the first iteration because
-        * that special case is handled in read_ref_at().
-        */
-       if (cb->cnt > 0)
-               cb->cnt--;
-       reached_count = cb->cnt == 0 && !is_null_oid(ooid);
-       if (timestamp <= cb->at_time || reached_count) {
+       if (timestamp <= cb->at_time || cb->cnt == 0) {
                set_read_ref_cutoffs(cb, timestamp, tz, message);
                /*
                 * we have not yet updated cb->[n|o]oid so they still
                 * hold the values for the previous record.
                 */
-               if (!is_null_oid(&cb->ooid) && !oideq(&cb->ooid, noid))
-                       warning(_("log for ref %s has gap after %s"),
+               if (!is_null_oid(&cb->ooid)) {
+                       oidcpy(cb->oid, noid);
+                       if (!oideq(&cb->ooid, noid))
+                               warning(_("log for ref %s has gap after %s"),
                                        cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822)));
-               if (reached_count)
-                       oidcpy(cb->oid, ooid);
-               else if (!is_null_oid(&cb->ooid) || cb->date == cb->at_time)
+               }
+               else if (cb->date == cb->at_time)
                        oidcpy(cb->oid, noid);
                else if (!oideq(noid, cb->oid))
                        warning(_("log for ref %s unexpectedly ended on %s"),
                                cb->refname, show_date(cb->date, cb->tz,
                                                       DATE_MODE(RFC2822)));
+               cb->reccnt++;
+               oidcpy(&cb->ooid, ooid);
+               oidcpy(&cb->noid, noid);
                cb->found_it = 1;
+               return 1;
        }
        cb->reccnt++;
        oidcpy(&cb->ooid, ooid);
        oidcpy(&cb->noid, noid);
-       return cb->found_it;
-}
-
-static int read_ref_at_ent_newest(struct object_id *ooid UNUSED,
-                                 struct object_id *noid,
-                                 const char *email UNUSED,
-                                 timestamp_t timestamp, int tz,
-                                 const char *message, void *cb_data)
-{
-       struct read_ref_at_cb *cb = cb_data;
-
-       set_read_ref_cutoffs(cb, timestamp, tz, message);
-       oidcpy(cb->oid, noid);
-       /* We just want the first entry */
-       return 1;
+       if (cb->cnt > 0)
+               cb->cnt--;
+       return 0;
 }
 
 static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid,
@@ -1082,7 +1125,7 @@ static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid
 
        set_read_ref_cutoffs(cb, timestamp, tz, message);
        oidcpy(cb->oid, ooid);
-       if (is_null_oid(cb->oid))
+       if (cb->at_time && is_null_oid(cb->oid))
                oidcpy(cb->oid, noid);
        /* We just want the first entry */
        return 1;
@@ -1105,14 +1148,24 @@ int read_ref_at(struct ref_store *refs, const char *refname,
        cb.cutoff_cnt = cutoff_cnt;
        cb.oid = oid;
 
-       if (cb.cnt == 0) {
-               refs_for_each_reflog_ent_reverse(refs, refname, read_ref_at_ent_newest, &cb);
-               return 0;
-       }
-
        refs_for_each_reflog_ent_reverse(refs, refname, read_ref_at_ent, &cb);
 
        if (!cb.reccnt) {
+               if (cnt == 0) {
+                       /*
+                        * The caller asked for ref@{0}, and we had no entries.
+                        * It's a bit subtle, but in practice all callers have
+                        * prepped the "oid" field with the current value of
+                        * the ref, which is the most reasonable fallback.
+                        *
+                        * We'll put dummy values into the out-parameters (so
+                        * they're not just uninitialized garbage), and the
+                        * caller can take our return value as a hint that
+                        * we did not find any such reflog.
+                        */
+                       set_read_ref_cutoffs(&cb, 0, 0, "empty reflog");
+                       return 1;
+               }
                if (flags & GET_OID_QUIETLY)
                        exit(128);
                else
@@ -1577,10 +1630,6 @@ struct ref_iterator *refs_ref_iterator_begin(
        if (trim)
                iter = prefix_ref_iterator_begin(iter, "", trim);
 
-       /* Sanity check for subclasses: */
-       if (!iter->ordered)
-               BUG("reference iterator is not ordered");
-
        return iter;
 }
 
@@ -1707,6 +1756,13 @@ int for_each_rawref(each_ref_fn fn, void *cb_data)
        return refs_for_each_rawref(get_main_ref_store(the_repository), fn, cb_data);
 }
 
+int refs_for_each_include_root_refs(struct ref_store *refs, each_ref_fn fn,
+                                   void *cb_data)
+{
+       return do_for_each_ref(refs, "", NULL, fn, 0,
+                              DO_FOR_EACH_INCLUDE_ROOT_REFS, cb_data);
+}
+
 static int qsort_strcmp(const void *va, const void *vb)
 {
        const char *a = *(const char **)va;
@@ -1806,8 +1862,10 @@ static int refs_read_special_head(struct ref_store *ref_store,
        int result = -1;
        strbuf_addf(&full_path, "%s/%s", ref_store->gitdir, refname);
 
-       if (strbuf_read_file(&content, full_path.buf, 0) < 0)
+       if (strbuf_read_file(&content, full_path.buf, 0) < 0) {
+               *failure_errno = errno;
                goto done;
+       }
 
        result = parse_loose_ref_contents(content.buf, oid, referent, type,
                                          failure_errno);
@@ -1818,15 +1876,45 @@ done:
        return result;
 }
 
+static int is_special_ref(const char *refname)
+{
+       /*
+        * Special references are refs that have different semantics compared
+        * to "normal" refs. These refs can thus not be stored in the ref
+        * backend, but must always be accessed via the filesystem. The
+        * following refs are special:
+        *
+        * - FETCH_HEAD may contain multiple object IDs, and each one of them
+        *   carries additional metadata like where it came from.
+        *
+        * - MERGE_HEAD may contain multiple object IDs when merging multiple
+        *   heads.
+        *
+        * Reading, writing or deleting references must consistently go either
+        * through the filesystem (special refs) or through the reference
+        * backend (normal ones).
+        */
+       static const char * const special_refs[] = {
+               "FETCH_HEAD",
+               "MERGE_HEAD",
+       };
+       size_t i;
+
+       for (i = 0; i < ARRAY_SIZE(special_refs); i++)
+               if (!strcmp(refname, special_refs[i]))
+                       return 1;
+
+       return 0;
+}
+
 int refs_read_raw_ref(struct ref_store *ref_store, const char *refname,
                      struct object_id *oid, struct strbuf *referent,
                      unsigned int *type, int *failure_errno)
 {
        assert(failure_errno);
-       if (!strcmp(refname, "FETCH_HEAD") || !strcmp(refname, "MERGE_HEAD")) {
+       if (is_special_ref(refname))
                return refs_read_special_head(ref_store, refname, oid, referent,
                                              type, failure_errno);
-       }
 
        return ref_store->be->read_raw_ref(ref_store, refname, oid, referent,
                                           type, failure_errno);
@@ -1928,11 +2016,9 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
 }
 
 /* backend functions */
-int refs_init_db(struct strbuf *err)
+int refs_init_db(struct ref_store *refs, int flags, struct strbuf *err)
 {
-       struct ref_store *refs = get_main_ref_store(the_repository);
-
-       return refs->be->init_db(refs, err);
+       return refs->be->init_db(refs, flags, err);
 }
 
 const char *resolve_ref_unsafe(const char *refname, int resolve_flags,
@@ -2029,12 +2115,12 @@ static struct ref_store *ref_store_init(struct repository *repo,
                                        const char *gitdir,
                                        unsigned int flags)
 {
-       const char *be_name = "files";
-       struct ref_storage_be *be = find_ref_storage_backend(be_name);
+       const struct ref_storage_be *be;
        struct ref_store *refs;
 
+       be = find_ref_storage_backend(repo->ref_storage_format);
        if (!be)
-               BUG("reference backend %s is unknown", be_name);
+               BUG("reference backend is unknown");
 
        refs = be->init(repo, gitdir, flags);
        return refs;
@@ -2469,18 +2555,33 @@ cleanup:
        return ret;
 }
 
-int refs_for_each_reflog(struct ref_store *refs, each_ref_fn fn, void *cb_data)
+struct do_for_each_reflog_help {
+       each_reflog_fn *fn;
+       void *cb_data;
+};
+
+static int do_for_each_reflog_helper(struct repository *r UNUSED,
+                                    const char *refname,
+                                    const struct object_id *oid UNUSED,
+                                    int flags,
+                                    void *cb_data)
+{
+       struct do_for_each_reflog_help *hp = cb_data;
+       return hp->fn(refname, hp->cb_data);
+}
+
+int refs_for_each_reflog(struct ref_store *refs, each_reflog_fn fn, void *cb_data)
 {
        struct ref_iterator *iter;
-       struct do_for_each_ref_help hp = { fn, cb_data };
+       struct do_for_each_reflog_help hp = { fn, cb_data };
 
        iter = refs->be->reflog_iterator_begin(refs);
 
        return do_for_each_repo_ref_iterator(the_repository, iter,
-                                            do_for_each_ref_helper, &hp);
+                                            do_for_each_reflog_helper, &hp);
 }
 
-int for_each_reflog(each_ref_fn fn, void *cb_data)
+int for_each_reflog(each_reflog_fn fn, void *cb_data)
 {
        return refs_for_each_reflog(get_main_ref_store(the_repository), fn, cb_data);
 }
@@ -2599,13 +2700,55 @@ void ref_transaction_for_each_queued_update(struct ref_transaction *transaction,
 int refs_delete_refs(struct ref_store *refs, const char *logmsg,
                     struct string_list *refnames, unsigned int flags)
 {
+       struct ref_transaction *transaction;
+       struct strbuf err = STRBUF_INIT;
+       struct string_list_item *item;
+       int ret = 0, failures = 0;
        char *msg;
-       int retval;
+
+       if (!refnames->nr)
+               return 0;
 
        msg = normalize_reflog_message(logmsg);
-       retval = refs->be->delete_refs(refs, msg, refnames, flags);
+
+       /*
+        * Since we don't check the references' old_oids, the
+        * individual updates can't fail, so we can pack all of the
+        * updates into a single transaction.
+        */
+       transaction = ref_store_transaction_begin(refs, &err);
+       if (!transaction) {
+               ret = error("%s", err.buf);
+               goto out;
+       }
+
+       for_each_string_list_item(item, refnames) {
+               ret = ref_transaction_delete(transaction, item->string,
+                                            NULL, flags, msg, &err);
+               if (ret) {
+                       warning(_("could not delete reference %s: %s"),
+                               item->string, err.buf);
+                       strbuf_reset(&err);
+                       failures = 1;
+               }
+       }
+
+       ret = ref_transaction_commit(transaction, &err);
+       if (ret) {
+               if (refnames->nr == 1)
+                       error(_("could not delete reference %s: %s"),
+                             refnames->items[0].string, err.buf);
+               else
+                       error(_("could not delete references: %s"), err.buf);
+       }
+
+out:
+       if (!ret && failures)
+               ret = -1;
+       ref_transaction_free(transaction);
+       strbuf_release(&err);
        free(msg);
-       return retval;
+       return ret;
 }
 
 int delete_refs(const char *msg, struct string_list *refnames,
diff --git a/refs.h b/refs.h
index 23211a5ea1cabbb0a35d091bf2b5dbbd87e28252..298caf6c6184cc3a23acf78d1a0e3dc8c7d8614c 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -11,6 +11,9 @@ struct string_list;
 struct string_list_item;
 struct worktree;
 
+unsigned int ref_storage_format_by_name(const char *name);
+const char *ref_storage_format_to_name(unsigned int ref_storage_format);
+
 /*
  * Resolve a reference, recursively following symbolic refererences.
  *
@@ -56,7 +59,7 @@ struct worktree;
  * Even with RESOLVE_REF_ALLOW_BAD_NAME, names that escape the refs/
  * directory and do not consist of all caps and underscores cannot be
  * resolved. The function returns NULL for such ref names.
- * Caps and underscores refers to the special refs, such as HEAD,
+ * Caps and underscores refers to the pseudorefs, such as HEAD,
  * FETCH_HEAD and friends, that all live outside of the refs/ directory.
  */
 #define RESOLVE_REF_READING 0x01
@@ -123,7 +126,9 @@ int should_autocreate_reflog(const char *refname);
 
 int is_branch(const char *refname);
 
-int refs_init_db(struct strbuf *err);
+#define REFS_INIT_DB_IS_WORKTREE (1 << 0)
+
+int refs_init_db(struct ref_store *refs, int flags, struct strbuf *err);
 
 /*
  * Return the peeled value of the oid currently being iterated via
@@ -393,6 +398,12 @@ int for_each_namespaced_ref(const char **exclude_patterns,
 int refs_for_each_rawref(struct ref_store *refs, each_ref_fn fn, void *cb_data);
 int for_each_rawref(each_ref_fn fn, void *cb_data);
 
+/*
+ * Iterates over all refs including root refs, i.e. pseudorefs and HEAD.
+ */
+int refs_for_each_include_root_refs(struct ref_store *refs, each_ref_fn fn,
+                                   void *cb_data);
+
 /*
  * Normalizes partial refs to their fully qualified form.
  * Will prepend <prefix> to the <pattern> if it doesn't start with 'refs/'.
@@ -435,7 +446,20 @@ int refs_create_reflog(struct ref_store *refs, const char *refname,
                       struct strbuf *err);
 int safe_create_reflog(const char *refname, struct strbuf *err);
 
-/** Reads log for the value of ref during at_time. **/
+/**
+ * Reads log for the value of ref during at_time (in which case "cnt" should be
+ * negative) or the reflog "cnt" entries from the top (in which case "at_time"
+ * should be 0).
+ *
+ * If we found the reflog entry in question, returns 0 (and details of the
+ * entry can be found in the out-parameters).
+ *
+ * If we ran out of reflog entries, the out-parameters are filled with the
+ * details of the oldest entry we did find, and the function returns 1. Note
+ * that there is one important special case here! If the reflog was empty
+ * and the caller asked for the 0-th cnt, we will return "1" but leave the
+ * "oid" field untouched.
+ **/
 int read_ref_at(struct ref_store *refs,
                const char *refname, unsigned int flags,
                timestamp_t at_time, int cnt,
@@ -529,12 +553,19 @@ int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn, void *cb_dat
 /* youngest entry first */
 int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn, void *cb_data);
 
+/*
+ * The signature for the callback function for the {refs_,}for_each_reflog()
+ * functions below. The memory pointed to by the refname argument is only
+ * guaranteed to be valid for the duration of a single callback invocation.
+ */
+typedef int each_reflog_fn(const char *refname, void *cb_data);
+
 /*
  * Calls the specified function for each reflog file until it returns nonzero,
  * and returns the value. Reflog file order is unspecified.
  */
-int refs_for_each_reflog(struct ref_store *refs, each_ref_fn fn, void *cb_data);
-int for_each_reflog(each_ref_fn fn, void *cb_data);
+int refs_for_each_reflog(struct ref_store *refs, each_reflog_fn fn, void *cb_data);
+int for_each_reflog(each_reflog_fn fn, void *cb_data);
 
 #define REFNAME_ALLOW_ONELEVEL 1
 #define REFNAME_REFSPEC_PATTERN 2
@@ -1018,4 +1049,7 @@ extern struct ref_namespace_info ref_namespace[NAMESPACE__COUNT];
  */
 void update_ref_namespace(enum ref_namespace namespace, char *ref);
 
+int is_pseudoref(struct ref_store *refs, const char *refname);
+int is_headref(struct ref_store *refs, const char *refname);
+
 #endif /* REFS_H */
index b7ffc4ce67e333321036592b7e53efa30f8871d8..c7531b17f096c329353caf1fd456c726cded5ab8 100644 (file)
@@ -33,10 +33,10 @@ struct ref_store *maybe_debug_wrap_ref_store(const char *gitdir, struct ref_stor
        return (struct ref_store *)res;
 }
 
-static int debug_init_db(struct ref_store *refs, struct strbuf *err)
+static int debug_init_db(struct ref_store *refs, int flags, struct strbuf *err)
 {
        struct debug_ref_store *drefs = (struct debug_ref_store *)refs;
-       int res = drefs->refs->be->init_db(drefs->refs, err);
+       int res = drefs->refs->be->init_db(drefs->refs, flags, err);
        trace_printf_key(&trace_refs, "init_db: %d\n", res);
        return res;
 }
@@ -143,20 +143,6 @@ static int debug_create_symref(struct ref_store *ref_store,
        return res;
 }
 
-static int debug_delete_refs(struct ref_store *ref_store, const char *msg,
-                            struct string_list *refnames, unsigned int flags)
-{
-       struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
-       int res =
-               drefs->refs->be->delete_refs(drefs->refs, msg, refnames, flags);
-       int i;
-       trace_printf_key(&trace_refs, "delete_refs {\n");
-       for (i = 0; i < refnames->nr; i++)
-               trace_printf_key(&trace_refs, "%s\n", refnames->items[i].string);
-       trace_printf_key(&trace_refs, "}: %d\n", res);
-       return res;
-}
-
 static int debug_rename_ref(struct ref_store *ref_store, const char *oldref,
                            const char *newref, const char *logmsg)
 {
@@ -195,7 +181,6 @@ static int debug_ref_iterator_advance(struct ref_iterator *ref_iterator)
                trace_printf_key(&trace_refs, "iterator_advance: %s (0)\n",
                        diter->iter->refname);
 
-       diter->base.ordered = diter->iter->ordered;
        diter->base.refname = diter->iter->refname;
        diter->base.oid = diter->iter->oid;
        diter->base.flags = diter->iter->flags;
@@ -236,7 +221,7 @@ debug_ref_iterator_begin(struct ref_store *ref_store, const char *prefix,
                drefs->refs->be->iterator_begin(drefs->refs, prefix,
                                                exclude_patterns, flags);
        struct debug_ref_iterator *diter = xcalloc(1, sizeof(*diter));
-       base_ref_iterator_init(&diter->base, &debug_ref_iterator_vtable, 1);
+       base_ref_iterator_init(&diter->base, &debug_ref_iterator_vtable);
        diter->iter = res;
        trace_printf_key(&trace_refs, "ref_iterator_begin: \"%s\" (0x%x)\n",
                         prefix, flags);
@@ -440,7 +425,6 @@ static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
 }
 
 struct ref_storage_be refs_be_debug = {
-       .next = NULL,
        .name = "debug",
        .init = NULL,
        .init_db = debug_init_db,
@@ -458,7 +442,6 @@ struct ref_storage_be refs_be_debug = {
 
        .pack_refs = debug_pack_refs,
        .create_symref = debug_create_symref,
-       .delete_refs = debug_delete_refs,
        .rename_ref = debug_rename_ref,
        .copy_ref = debug_copy_ref,
 
index 341354182bbf10937dffc9de2c56645027f5cfcd..a098d14ea00ed6db449e5d3cc8dff28594228977 100644 (file)
@@ -1,5 +1,4 @@
 #include "../git-compat-util.h"
-#include "../config.h"
 #include "../copy.h"
 #include "../environment.h"
 #include "../gettext.h"
@@ -19,7 +18,6 @@
 #include "../dir.h"
 #include "../chdir-notify.h"
 #include "../setup.h"
-#include "../worktree.h"
 #include "../wrapper.h"
 #include "../write-or-die.h"
 #include "../revision.h"
@@ -231,6 +229,38 @@ static void add_per_worktree_entries_to_dir(struct ref_dir *dir, const char *dir
        }
 }
 
+static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs,
+                                           const char *refname,
+                                           struct ref_dir *dir)
+{
+       struct object_id oid;
+       int flag;
+
+       if (!refs_resolve_ref_unsafe(&refs->base, refname, RESOLVE_REF_READING,
+                                    &oid, &flag)) {
+               oidclr(&oid);
+               flag |= REF_ISBROKEN;
+       } else if (is_null_oid(&oid)) {
+               /*
+                * It is so astronomically unlikely
+                * that null_oid is the OID of an
+                * actual object that we consider its
+                * appearance in a loose reference
+                * file to be repo corruption
+                * (probably due to a software bug).
+                */
+               flag |= REF_ISBROKEN;
+       }
+
+       if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) {
+               if (!refname_is_safe(refname))
+                       die("loose refname is dangerous: %s", refname);
+               oidclr(&oid);
+               flag |= REF_BAD_NAME | REF_ISBROKEN;
+       }
+       add_entry_to_dir(dir, create_ref_entry(refname, &oid, flag));
+}
+
 /*
  * Read the loose references from the namespace dirname into dir
  * (without recursing).  dirname must end with '/'.  dir must be the
@@ -246,10 +276,8 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
        int dirnamelen = strlen(dirname);
        struct strbuf refname;
        struct strbuf path = STRBUF_INIT;
-       size_t path_baselen;
 
        files_ref_path(refs, &path, dirname);
-       path_baselen = path.len;
 
        d = opendir(path.buf);
        if (!d) {
@@ -261,54 +289,24 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
        strbuf_add(&refname, dirname, dirnamelen);
 
        while ((de = readdir(d)) != NULL) {
-               struct object_id oid;
-               struct stat st;
-               int flag;
+               unsigned char dtype;
 
                if (de->d_name[0] == '.')
                        continue;
                if (ends_with(de->d_name, ".lock"))
                        continue;
                strbuf_addstr(&refname, de->d_name);
-               strbuf_addstr(&path, de->d_name);
-               if (stat(path.buf, &st) < 0) {
-                       ; /* silently ignore */
-               } else if (S_ISDIR(st.st_mode)) {
+
+               dtype = get_dtype(de, &path, 1);
+               if (dtype == DT_DIR) {
                        strbuf_addch(&refname, '/');
                        add_entry_to_dir(dir,
                                         create_dir_entry(dir->cache, refname.buf,
                                                          refname.len));
-               } else {
-                       if (!refs_resolve_ref_unsafe(&refs->base,
-                                                    refname.buf,
-                                                    RESOLVE_REF_READING,
-                                                    &oid, &flag)) {
-                               oidclr(&oid);
-                               flag |= REF_ISBROKEN;
-                       } else if (is_null_oid(&oid)) {
-                               /*
-                                * It is so astronomically unlikely
-                                * that null_oid is the OID of an
-                                * actual object that we consider its
-                                * appearance in a loose reference
-                                * file to be repo corruption
-                                * (probably due to a software bug).
-                                */
-                               flag |= REF_ISBROKEN;
-                       }
-
-                       if (check_refname_format(refname.buf,
-                                                REFNAME_ALLOW_ONELEVEL)) {
-                               if (!refname_is_safe(refname.buf))
-                                       die("loose refname is dangerous: %s", refname.buf);
-                               oidclr(&oid);
-                               flag |= REF_BAD_NAME | REF_ISBROKEN;
-                       }
-                       add_entry_to_dir(dir,
-                                        create_ref_entry(refname.buf, &oid, flag));
+               } else if (dtype == DT_REG) {
+                       loose_fill_ref_dir_regular_file(refs, refname.buf, dir);
                }
                strbuf_setlen(&refname, dirnamelen);
-               strbuf_setlen(&path, path_baselen);
        }
        strbuf_release(&refname);
        strbuf_release(&path);
@@ -317,9 +315,59 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
        add_per_worktree_entries_to_dir(dir, dirname);
 }
 
-static struct ref_cache *get_loose_ref_cache(struct files_ref_store *refs)
+/*
+ * Add pseudorefs to the ref dir by parsing the directory for any files
+ * which follow the pseudoref syntax.
+ */
+static void add_pseudoref_and_head_entries(struct ref_store *ref_store,
+                                        struct ref_dir *dir,
+                                        const char *dirname)
+{
+       struct files_ref_store *refs =
+               files_downcast(ref_store, REF_STORE_READ, "fill_ref_dir");
+       struct strbuf path = STRBUF_INIT, refname = STRBUF_INIT;
+       struct dirent *de;
+       size_t dirnamelen;
+       DIR *d;
+
+       files_ref_path(refs, &path, dirname);
+
+       d = opendir(path.buf);
+       if (!d) {
+               strbuf_release(&path);
+               return;
+       }
+
+       strbuf_addstr(&refname, dirname);
+       dirnamelen = refname.len;
+
+       while ((de = readdir(d)) != NULL) {
+               unsigned char dtype;
+
+               if (de->d_name[0] == '.')
+                       continue;
+               if (ends_with(de->d_name, ".lock"))
+                       continue;
+               strbuf_addstr(&refname, de->d_name);
+
+               dtype = get_dtype(de, &path, 1);
+               if (dtype == DT_REG && (is_pseudoref(ref_store, de->d_name) ||
+                                                               is_headref(ref_store, de->d_name)))
+                       loose_fill_ref_dir_regular_file(refs, refname.buf, dir);
+
+               strbuf_setlen(&refname, dirnamelen);
+       }
+       strbuf_release(&refname);
+       strbuf_release(&path);
+       closedir(d);
+}
+
+static struct ref_cache *get_loose_ref_cache(struct files_ref_store *refs,
+                                            unsigned int flags)
 {
        if (!refs->loose) {
+               struct ref_dir *dir;
+
                /*
                 * Mark the top-level directory complete because we
                 * are about to read the only subdirectory that can
@@ -330,12 +378,17 @@ static struct ref_cache *get_loose_ref_cache(struct files_ref_store *refs)
                /* We're going to fill the top level ourselves: */
                refs->loose->root->flag &= ~REF_INCOMPLETE;
 
+               dir = get_ref_dir(refs->loose->root);
+
+               if (flags & DO_FOR_EACH_INCLUDE_ROOT_REFS)
+                       add_pseudoref_and_head_entries(dir->cache->ref_store, dir,
+                                                      refs->loose->root->name);
+
                /*
                 * Add an incomplete entry for "refs/" (to be filled
                 * lazily):
                 */
-               add_entry_to_dir(get_ref_dir(refs->loose->root),
-                                create_dir_entry(refs->loose, "refs/", 5));
+               add_entry_to_dir(dir, create_dir_entry(refs->loose, "refs/", 5));
        }
        return refs->loose;
 }
@@ -863,7 +916,7 @@ static struct ref_iterator *files_ref_iterator_begin(
         * disk, and re-reads it if not.
         */
 
-       loose_iter = cache_ref_iterator_begin(get_loose_ref_cache(refs),
+       loose_iter = cache_ref_iterator_begin(get_loose_ref_cache(refs, flags),
                                              prefix, ref_store->repo, 1);
 
        /*
@@ -885,8 +938,7 @@ static struct ref_iterator *files_ref_iterator_begin(
 
        CALLOC_ARRAY(iter, 1);
        ref_iterator = &iter->base;
-       base_ref_iterator_init(ref_iterator, &files_ref_iterator_vtable,
-                              overlay_iter->ordered);
+       base_ref_iterator_init(ref_iterator, &files_ref_iterator_vtable);
        iter->iter0 = overlay_iter;
        iter->repo = ref_store->repo;
        iter->flags = flags;
@@ -1224,7 +1276,7 @@ static int files_pack_refs(struct ref_store *ref_store,
 
        packed_refs_lock(refs->packed_ref_store, LOCK_DIE_ON_ERROR, &err);
 
-       iter = cache_ref_iterator_begin(get_loose_ref_cache(refs), NULL,
+       iter = cache_ref_iterator_begin(get_loose_ref_cache(refs, 0), NULL,
                                        the_repository, 0);
        while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
                /*
@@ -1269,54 +1321,6 @@ static int files_pack_refs(struct ref_store *ref_store,
        return 0;
 }
 
-static int files_delete_refs(struct ref_store *ref_store, const char *msg,
-                            struct string_list *refnames, unsigned int flags)
-{
-       struct files_ref_store *refs =
-               files_downcast(ref_store, REF_STORE_WRITE, "delete_refs");
-       struct strbuf err = STRBUF_INIT;
-       int i, result = 0;
-
-       if (!refnames->nr)
-               return 0;
-
-       if (packed_refs_lock(refs->packed_ref_store, 0, &err))
-               goto error;
-
-       if (refs_delete_refs(refs->packed_ref_store, msg, refnames, flags)) {
-               packed_refs_unlock(refs->packed_ref_store);
-               goto error;
-       }
-
-       packed_refs_unlock(refs->packed_ref_store);
-
-       for (i = 0; i < refnames->nr; i++) {
-               const char *refname = refnames->items[i].string;
-
-               if (refs_delete_ref(&refs->base, msg, refname, NULL, flags))
-                       result |= error(_("could not remove reference %s"), refname);
-       }
-
-       strbuf_release(&err);
-       return result;
-
-error:
-       /*
-        * If we failed to rewrite the packed-refs file, then it is
-        * unsafe to try to remove loose refs, because doing so might
-        * expose an obsolete packed value for a reference that might
-        * even point at an object that has been garbage collected.
-        */
-       if (refnames->nr == 1)
-               error(_("could not delete reference %s: %s"),
-                     refnames->items[0].string, err.buf);
-       else
-               error(_("could not delete references: %s"), err.buf);
-
-       strbuf_release(&err);
-       return -1;
-}
-
 /*
  * People using contrib's git-new-workdir have .git/logs/refs ->
  * /some/other/path/.git/logs/refs, and that may live on another device.
@@ -2170,10 +2174,8 @@ static int files_for_each_reflog_ent(struct ref_store *ref_store,
 
 struct files_reflog_iterator {
        struct ref_iterator base;
-
        struct ref_store *ref_store;
        struct dir_iterator *dir_iterator;
-       struct object_id oid;
 };
 
 static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
@@ -2184,25 +2186,13 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
        int ok;
 
        while ((ok = dir_iterator_advance(diter)) == ITER_OK) {
-               int flags;
-
                if (!S_ISREG(diter->st.st_mode))
                        continue;
-               if (diter->basename[0] == '.')
-                       continue;
-               if (ends_with(diter->basename, ".lock"))
+               if (check_refname_format(diter->basename,
+                                        REFNAME_ALLOW_ONELEVEL))
                        continue;
 
-               if (!refs_resolve_ref_unsafe(iter->ref_store,
-                                            diter->relative_path, 0,
-                                            &iter->oid, &flags)) {
-                       error("bad ref for %s", diter->path.buf);
-                       continue;
-               }
-
                iter->base.refname = diter->relative_path;
-               iter->base.oid = &iter->oid;
-               iter->base.flags = flags;
                return ITER_OK;
        }
 
@@ -2247,7 +2237,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
 
        strbuf_addf(&sb, "%s/logs", gitdir);
 
-       diter = dir_iterator_begin(sb.buf, 0);
+       diter = dir_iterator_begin(sb.buf, DIR_ITERATOR_SORTED);
        if (!diter) {
                strbuf_release(&sb);
                return empty_ref_iterator_begin();
@@ -2256,7 +2246,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
        CALLOC_ARRAY(iter, 1);
        ref_iterator = &iter->base;
 
-       base_ref_iterator_init(ref_iterator, &files_reflog_iterator_vtable, 0);
+       base_ref_iterator_init(ref_iterator, &files_reflog_iterator_vtable);
        iter->dir_iterator = diter;
        iter->ref_store = ref_store;
        strbuf_release(&sb);
@@ -2264,32 +2254,6 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
        return ref_iterator;
 }
 
-static enum iterator_selection reflog_iterator_select(
-       struct ref_iterator *iter_worktree,
-       struct ref_iterator *iter_common,
-       void *cb_data UNUSED)
-{
-       if (iter_worktree) {
-               /*
-                * We're a bit loose here. We probably should ignore
-                * common refs if they are accidentally added as
-                * per-worktree refs.
-                */
-               return ITER_SELECT_0;
-       } else if (iter_common) {
-               if (parse_worktree_ref(iter_common->refname, NULL, NULL,
-                                      NULL) == REF_WORKTREE_SHARED)
-                       return ITER_SELECT_1;
-
-               /*
-                * The main ref store may contain main worktree's
-                * per-worktree refs, which should be ignored
-                */
-               return ITER_SKIP_1;
-       } else
-               return ITER_DONE;
-}
-
 static struct ref_iterator *files_reflog_iterator_begin(struct ref_store *ref_store)
 {
        struct files_ref_store *refs =
@@ -2300,9 +2264,9 @@ static struct ref_iterator *files_reflog_iterator_begin(struct ref_store *ref_st
                return reflog_iterator_begin(ref_store, refs->gitcommondir);
        } else {
                return merge_ref_iterator_begin(
-                       0, reflog_iterator_begin(ref_store, refs->base.gitdir),
+                       reflog_iterator_begin(ref_store, refs->base.gitdir),
                        reflog_iterator_begin(ref_store, refs->gitcommondir),
-                       reflog_iterator_select, refs);
+                       ref_iterator_select, refs);
        }
 }
 
@@ -3272,28 +3236,52 @@ static int files_reflog_expire(struct ref_store *ref_store,
        return -1;
 }
 
-static int files_init_db(struct ref_store *ref_store, struct strbuf *err UNUSED)
+static int files_init_db(struct ref_store *ref_store,
+                        int flags,
+                        struct strbuf *err UNUSED)
 {
        struct files_ref_store *refs =
                files_downcast(ref_store, REF_STORE_WRITE, "init_db");
        struct strbuf sb = STRBUF_INIT;
 
        /*
-        * Create .git/refs/{heads,tags}
+        * We need to create a "refs" dir in any case so that older versions of
+        * Git can tell that this is a repository. This serves two main purposes:
+        *
+        * - Clients will know to stop walking the parent-directory chain when
+        *   detecting the Git repository. Otherwise they may end up detecting
+        *   a Git repository in a parent directory instead.
+        *
+        * - Instead of failing to detect a repository with unknown reference
+        *   format altogether, old clients will print an error saying that
+        *   they do not understand the reference format extension.
         */
-       files_ref_path(refs, &sb, "refs/heads");
+       strbuf_addf(&sb, "%s/refs", ref_store->gitdir);
        safe_create_dir(sb.buf, 1);
+       adjust_shared_perm(sb.buf);
 
-       strbuf_reset(&sb);
-       files_ref_path(refs, &sb, "refs/tags");
-       safe_create_dir(sb.buf, 1);
+       /*
+        * There is no need to create directories for common refs when creating
+        * a worktree ref store.
+        */
+       if (!(flags & REFS_INIT_DB_IS_WORKTREE)) {
+               /*
+                * Create .git/refs/{heads,tags}
+                */
+               strbuf_reset(&sb);
+               files_ref_path(refs, &sb, "refs/heads");
+               safe_create_dir(sb.buf, 1);
+
+               strbuf_reset(&sb);
+               files_ref_path(refs, &sb, "refs/tags");
+               safe_create_dir(sb.buf, 1);
+       }
 
        strbuf_release(&sb);
        return 0;
 }
 
 struct ref_storage_be refs_be_files = {
-       .next = NULL,
        .name = "files",
        .init = files_ref_store_create,
        .init_db = files_init_db,
@@ -3304,7 +3292,6 @@ struct ref_storage_be refs_be_files = {
 
        .pack_refs = files_pack_refs,
        .create_symref = files_create_symref,
-       .delete_refs = files_delete_refs,
        .rename_ref = files_rename_ref,
        .copy_ref = files_copy_ref,
 
index 6b680f610efbee4e144cfa41763f45834b39d210..9db8b056d56d190fe9ea2087bc327f0154b6ecd2 100644 (file)
@@ -25,11 +25,9 @@ int ref_iterator_abort(struct ref_iterator *ref_iterator)
 }
 
 void base_ref_iterator_init(struct ref_iterator *iter,
-                           struct ref_iterator_vtable *vtable,
-                           int ordered)
+                           struct ref_iterator_vtable *vtable)
 {
        iter->vtable = vtable;
-       iter->ordered = !!ordered;
        iter->refname = NULL;
        iter->oid = NULL;
        iter->flags = 0;
@@ -74,7 +72,7 @@ struct ref_iterator *empty_ref_iterator_begin(void)
        struct empty_ref_iterator *iter = xcalloc(1, sizeof(*iter));
        struct ref_iterator *ref_iterator = &iter->base;
 
-       base_ref_iterator_init(ref_iterator, &empty_ref_iterator_vtable, 1);
+       base_ref_iterator_init(ref_iterator, &empty_ref_iterator_vtable);
        return ref_iterator;
 }
 
@@ -98,6 +96,49 @@ struct merge_ref_iterator {
        struct ref_iterator **current;
 };
 
+enum iterator_selection ref_iterator_select(struct ref_iterator *iter_worktree,
+                                           struct ref_iterator *iter_common,
+                                           void *cb_data UNUSED)
+{
+       if (iter_worktree && !iter_common) {
+               /*
+                * Return the worktree ref if there are no more common refs.
+                */
+               return ITER_SELECT_0;
+       } else if (iter_common) {
+               /*
+                * In case we have pending worktree and common refs we need to
+                * yield them based on their lexicographical order. Worktree
+                * refs that have the same name as common refs shadow the
+                * latter.
+                */
+               if (iter_worktree) {
+                       int cmp = strcmp(iter_worktree->refname,
+                                        iter_common->refname);
+                       if (cmp < 0)
+                               return ITER_SELECT_0;
+                       else if (!cmp)
+                               return ITER_SELECT_0_SKIP_1;
+               }
+
+                /*
+                 * We now know that the lexicographically-next ref is a common
+                 * ref. When the common ref is a shared one we return it.
+                 */
+               if (parse_worktree_ref(iter_common->refname, NULL, NULL,
+                                      NULL) == REF_WORKTREE_SHARED)
+                       return ITER_SELECT_1;
+
+               /*
+                * Otherwise, if the common ref is a per-worktree ref we skip
+                * it because it would belong to the main worktree, not ours.
+                */
+               return ITER_SKIP_1;
+       } else {
+               return ITER_DONE;
+       }
+}
+
 static int merge_ref_iterator_advance(struct ref_iterator *ref_iterator)
 {
        struct merge_ref_iterator *iter =
@@ -207,7 +248,6 @@ static struct ref_iterator_vtable merge_ref_iterator_vtable = {
 };
 
 struct ref_iterator *merge_ref_iterator_begin(
-               int ordered,
                struct ref_iterator *iter0, struct ref_iterator *iter1,
                ref_iterator_select_fn *select, void *cb_data)
 {
@@ -222,7 +262,7 @@ struct ref_iterator *merge_ref_iterator_begin(
         * references through only if they exist in both iterators.
         */
 
-       base_ref_iterator_init(ref_iterator, &merge_ref_iterator_vtable, ordered);
+       base_ref_iterator_init(ref_iterator, &merge_ref_iterator_vtable);
        iter->iter0 = iter0;
        iter->iter1 = iter1;
        iter->select = select;
@@ -271,12 +311,9 @@ struct ref_iterator *overlay_ref_iterator_begin(
        } else if (is_empty_ref_iterator(back)) {
                ref_iterator_abort(back);
                return front;
-       } else if (!front->ordered || !back->ordered) {
-               BUG("overlay_ref_iterator requires ordered inputs");
        }
 
-       return merge_ref_iterator_begin(1, front, back,
-                                       overlay_iterator_select, NULL);
+       return merge_ref_iterator_begin(front, back, overlay_iterator_select, NULL);
 }
 
 struct prefix_ref_iterator {
@@ -315,16 +352,12 @@ static int prefix_ref_iterator_advance(struct ref_iterator *ref_iterator)
 
                if (cmp > 0) {
                        /*
-                        * If the source iterator is ordered, then we
+                        * As the source iterator is ordered, we
                         * can stop the iteration as soon as we see a
                         * refname that comes after the prefix:
                         */
-                       if (iter->iter0->ordered) {
-                               ok = ref_iterator_abort(iter->iter0);
-                               break;
-                       } else {
-                               continue;
-                       }
+                       ok = ref_iterator_abort(iter->iter0);
+                       break;
                }
 
                if (iter->trim) {
@@ -396,7 +429,7 @@ struct ref_iterator *prefix_ref_iterator_begin(struct ref_iterator *iter0,
        CALLOC_ARRAY(iter, 1);
        ref_iterator = &iter->base;
 
-       base_ref_iterator_init(ref_iterator, &prefix_ref_iterator_vtable, iter0->ordered);
+       base_ref_iterator_init(ref_iterator, &prefix_ref_iterator_vtable);
 
        iter->iter0 = iter0;
        iter->prefix = xstrdup(prefix);
index 59c78d7941f8d5e05fec6c895aafeb41803b919d..4e826c05ff2b34986a5844cd40734b10b0298204 100644 (file)
@@ -1,5 +1,4 @@
 #include "../git-compat-util.h"
-#include "../alloc.h"
 #include "../config.h"
 #include "../gettext.h"
 #include "../hash.h"
@@ -1112,7 +1111,7 @@ static struct ref_iterator *packed_ref_iterator_begin(
 
        CALLOC_ARRAY(iter, 1);
        ref_iterator = &iter->base;
-       base_ref_iterator_init(ref_iterator, &packed_ref_iterator_vtable, 1);
+       base_ref_iterator_init(ref_iterator, &packed_ref_iterator_vtable);
 
        if (exclude_patterns)
                populate_excluded_jump_list(iter, snapshot, exclude_patterns);
@@ -1246,6 +1245,7 @@ static const char PACKED_REFS_HEADER[] =
        "# pack-refs with: peeled fully-peeled sorted \n";
 
 static int packed_init_db(struct ref_store *ref_store UNUSED,
+                         int flags UNUSED,
                          struct strbuf *err UNUSED)
 {
        /* Nothing to do. */
@@ -1688,55 +1688,6 @@ static int packed_initial_transaction_commit(struct ref_store *ref_store UNUSED,
        return ref_transaction_commit(transaction, err);
 }
 
-static int packed_delete_refs(struct ref_store *ref_store, const char *msg,
-                            struct string_list *refnames, unsigned int flags)
-{
-       struct packed_ref_store *refs =
-               packed_downcast(ref_store, REF_STORE_WRITE, "delete_refs");
-       struct strbuf err = STRBUF_INIT;
-       struct ref_transaction *transaction;
-       struct string_list_item *item;
-       int ret;
-
-       (void)refs; /* We need the check above, but don't use the variable */
-
-       if (!refnames->nr)
-               return 0;
-
-       /*
-        * Since we don't check the references' old_oids, the
-        * individual updates can't fail, so we can pack all of the
-        * updates into a single transaction.
-        */
-
-       transaction = ref_store_transaction_begin(ref_store, &err);
-       if (!transaction)
-               return -1;
-
-       for_each_string_list_item(item, refnames) {
-               if (ref_transaction_delete(transaction, item->string, NULL,
-                                          flags, msg, &err)) {
-                       warning(_("could not delete reference %s: %s"),
-                               item->string, err.buf);
-                       strbuf_reset(&err);
-               }
-       }
-
-       ret = ref_transaction_commit(transaction, &err);
-
-       if (ret) {
-               if (refnames->nr == 1)
-                       error(_("could not delete reference %s: %s"),
-                             refnames->items[0].string, err.buf);
-               else
-                       error(_("could not delete references: %s"), err.buf);
-       }
-
-       ref_transaction_free(transaction);
-       strbuf_release(&err);
-       return ret;
-}
-
 static int packed_pack_refs(struct ref_store *ref_store UNUSED,
                            struct pack_refs_opts *pack_opts UNUSED)
 {
@@ -1754,7 +1705,6 @@ static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_s
 }
 
 struct ref_storage_be refs_be_packed = {
-       .next = NULL,
        .name = "packed",
        .init = packed_ref_store_create,
        .init_db = packed_init_db,
@@ -1765,7 +1715,6 @@ struct ref_storage_be refs_be_packed = {
 
        .pack_refs = packed_pack_refs,
        .create_symref = NULL,
-       .delete_refs = packed_delete_refs,
        .rename_ref = NULL,
        .copy_ref = NULL,
 
index 2294c4564fba3e171334314a5623928c5f27c14a..9f9797209a4545576f3ce5c9a9327c47e3319df1 100644 (file)
@@ -1,5 +1,4 @@
 #include "../git-compat-util.h"
-#include "../alloc.h"
 #include "../hash.h"
 #include "../refs.h"
 #include "../repository.h"
@@ -412,7 +411,8 @@ static int cache_ref_iterator_advance(struct ref_iterator *ref_iterator)
 
                if (level->prefix_state == PREFIX_WITHIN_DIR) {
                        entry_prefix_state = overlaps_prefix(entry->name, iter->prefix);
-                       if (entry_prefix_state == PREFIX_EXCLUDES_DIR)
+                       if (entry_prefix_state == PREFIX_EXCLUDES_DIR ||
+                           (entry_prefix_state == PREFIX_WITHIN_DIR && !(entry->flag & REF_DIR)))
                                continue;
                } else {
                        entry_prefix_state = level->prefix_state;
@@ -486,7 +486,7 @@ struct ref_iterator *cache_ref_iterator_begin(struct ref_cache *cache,
 
        CALLOC_ARRAY(iter, 1);
        ref_iterator = &iter->base;
-       base_ref_iterator_init(ref_iterator, &cache_ref_iterator_vtable, 1);
+       base_ref_iterator_init(ref_iterator, &cache_ref_iterator_vtable);
        ALLOC_GROW(iter->levels, 10, iter->levels_alloc);
 
        iter->levels_nr = 1;
index 9db8aec4da8eef6fb9542a9db5d1cbae01c129e6..56641aa57a138da17037307d37e1ca28baa2a1ee 100644 (file)
@@ -260,6 +260,12 @@ enum do_for_each_ref_flags {
         * INCLUDE_BROKEN, since they are otherwise not included at all.
         */
        DO_FOR_EACH_OMIT_DANGLING_SYMREFS = (1 << 2),
+
+       /*
+        * Include root refs i.e. HEAD and pseudorefs along with the regular
+        * refs.
+        */
+       DO_FOR_EACH_INCLUDE_ROOT_REFS = (1 << 3),
 };
 
 /*
@@ -312,13 +318,6 @@ enum do_for_each_ref_flags {
  */
 struct ref_iterator {
        struct ref_iterator_vtable *vtable;
-
-       /*
-        * Does this `ref_iterator` iterate over references in order
-        * by refname?
-        */
-       unsigned int ordered : 1;
-
        const char *refname;
        const struct object_id *oid;
        unsigned int flags;
@@ -386,15 +385,22 @@ typedef enum iterator_selection ref_iterator_select_fn(
                struct ref_iterator *iter0, struct ref_iterator *iter1,
                void *cb_data);
 
+/*
+ * An implementation of ref_iterator_select_fn that merges worktree and common
+ * refs. Per-worktree refs from the common iterator are ignored, worktree refs
+ * override common refs. Refs are selected lexicographically.
+ */
+enum iterator_selection ref_iterator_select(struct ref_iterator *iter_worktree,
+                                           struct ref_iterator *iter_common,
+                                           void *cb_data);
+
 /*
  * Iterate over the entries from iter0 and iter1, with the values
  * interleaved as directed by the select function. The iterator takes
  * ownership of iter0 and iter1 and frees them when the iteration is
- * over. A derived class should set `ordered` to 1 or 0 based on
- * whether it generates its output in order by reference name.
+ * over.
  */
 struct ref_iterator *merge_ref_iterator_begin(
-               int ordered,
                struct ref_iterator *iter0, struct ref_iterator *iter1,
                ref_iterator_select_fn *select, void *cb_data);
 
@@ -423,8 +429,6 @@ struct ref_iterator *overlay_ref_iterator_begin(
  * As an convenience to callers, if prefix is the empty string and
  * trim is zero, this function returns iter0 directly, without
  * wrapping it.
- *
- * The resulting ref_iterator is ordered if iter0 is.
  */
 struct ref_iterator *prefix_ref_iterator_begin(struct ref_iterator *iter0,
                                               const char *prefix,
@@ -435,14 +439,11 @@ struct ref_iterator *prefix_ref_iterator_begin(struct ref_iterator *iter0,
 /*
  * Base class constructor for ref_iterators. Initialize the
  * ref_iterator part of iter, setting its vtable pointer as specified.
- * `ordered` should be set to 1 if the iterator will iterate over
- * references in order by refname; otherwise it should be set to 0.
  * This is meant to be called only by the initializers of derived
  * classes.
  */
 void base_ref_iterator_init(struct ref_iterator *iter,
-                           struct ref_iterator_vtable *vtable,
-                           int ordered);
+                           struct ref_iterator_vtable *vtable);
 
 /*
  * Base class destructor for ref_iterators. Destroy the ref_iterator
@@ -529,7 +530,9 @@ typedef struct ref_store *ref_store_init_fn(struct repository *repo,
                                            const char *gitdir,
                                            unsigned int flags);
 
-typedef int ref_init_db_fn(struct ref_store *refs, struct strbuf *err);
+typedef int ref_init_db_fn(struct ref_store *refs,
+                          int flags,
+                          struct strbuf *err);
 
 typedef int ref_transaction_prepare_fn(struct ref_store *refs,
                                       struct ref_transaction *transaction,
@@ -553,8 +556,6 @@ typedef int create_symref_fn(struct ref_store *ref_store,
                             const char *ref_target,
                             const char *refs_heads_master,
                             const char *logmsg);
-typedef int delete_refs_fn(struct ref_store *ref_store, const char *msg,
-                          struct string_list *refnames, unsigned int flags);
 typedef int rename_ref_fn(struct ref_store *ref_store,
                          const char *oldref, const char *newref,
                          const char *logmsg);
@@ -665,7 +666,6 @@ typedef int read_symbolic_ref_fn(struct ref_store *ref_store, const char *refnam
                                 struct strbuf *referent);
 
 struct ref_storage_be {
-       struct ref_storage_be *next;
        const char *name;
        ref_store_init_fn *init;
        ref_init_db_fn *init_db;
@@ -677,7 +677,6 @@ struct ref_storage_be {
 
        pack_refs_fn *pack_refs;
        create_symref_fn *create_symref;
-       delete_refs_fn *delete_refs;
        rename_ref_fn *rename_ref;
        copy_ref_fn *copy_ref;
 
@@ -695,6 +694,7 @@ struct ref_storage_be {
 };
 
 extern struct ref_storage_be refs_be_files;
+extern struct ref_storage_be refs_be_reftable;
 extern struct ref_storage_be refs_be_packed;
 
 /*
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
new file mode 100644 (file)
index 0000000..e206d5a
--- /dev/null
@@ -0,0 +1,2232 @@
+#include "../git-compat-util.h"
+#include "../abspath.h"
+#include "../chdir-notify.h"
+#include "../environment.h"
+#include "../gettext.h"
+#include "../hash.h"
+#include "../hex.h"
+#include "../iterator.h"
+#include "../ident.h"
+#include "../lockfile.h"
+#include "../object.h"
+#include "../path.h"
+#include "../refs.h"
+#include "../reftable/reftable-stack.h"
+#include "../reftable/reftable-record.h"
+#include "../reftable/reftable-error.h"
+#include "../reftable/reftable-iterator.h"
+#include "../reftable/reftable-merged.h"
+#include "../setup.h"
+#include "../strmap.h"
+#include "refs-internal.h"
+
+/*
+ * Used as a flag in ref_update::flags when the ref_update was via an
+ * update to HEAD.
+ */
+#define REF_UPDATE_VIA_HEAD (1 << 8)
+
+struct reftable_ref_store {
+       struct ref_store base;
+
+       /*
+        * The main stack refers to the common dir and thus contains common
+        * refs as well as refs of the main repository.
+        */
+       struct reftable_stack *main_stack;
+       /*
+        * The worktree stack refers to the gitdir in case the refdb is opened
+        * via a worktree. It thus contains the per-worktree refs.
+        */
+       struct reftable_stack *worktree_stack;
+       /*
+        * Map of worktree stacks by their respective worktree names. The map
+        * is populated lazily when we try to resolve `worktrees/$worktree` refs.
+        */
+       struct strmap worktree_stacks;
+       struct reftable_write_options write_options;
+
+       unsigned int store_flags;
+       int err;
+};
+
+/*
+ * Downcast ref_store to reftable_ref_store. Die if ref_store is not a
+ * reftable_ref_store. required_flags is compared with ref_store's store_flags
+ * to ensure the ref_store has all required capabilities. "caller" is used in
+ * any necessary error messages.
+ */
+static struct reftable_ref_store *reftable_be_downcast(struct ref_store *ref_store,
+                                                      unsigned int required_flags,
+                                                      const char *caller)
+{
+       struct reftable_ref_store *refs;
+
+       if (ref_store->be != &refs_be_reftable)
+               BUG("ref_store is type \"%s\" not \"reftables\" in %s",
+                   ref_store->be->name, caller);
+
+       refs = (struct reftable_ref_store *)ref_store;
+
+       if ((refs->store_flags & required_flags) != required_flags)
+               BUG("operation %s requires abilities 0x%x, but only have 0x%x",
+                   caller, required_flags, refs->store_flags);
+
+       return refs;
+}
+
+/*
+ * Some refs are global to the repository (refs/heads/{*}), while others are
+ * local to the worktree (eg. HEAD, refs/bisect/{*}). We solve this by having
+ * multiple separate databases (ie. multiple reftable/ directories), one for
+ * the shared refs, one for the current worktree refs, and one for each
+ * additional worktree. For reading, we merge the view of both the shared and
+ * the current worktree's refs, when necessary.
+ *
+ * This function also optionally assigns the rewritten reference name that is
+ * local to the stack. This translation is required when using worktree refs
+ * like `worktrees/$worktree/refs/heads/foo` as worktree stacks will store
+ * those references in their normalized form.
+ */
+static struct reftable_stack *stack_for(struct reftable_ref_store *store,
+                                       const char *refname,
+                                       const char **rewritten_ref)
+{
+       const char *wtname;
+       int wtname_len;
+
+       if (!refname)
+               return store->main_stack;
+
+       switch (parse_worktree_ref(refname, &wtname, &wtname_len, rewritten_ref)) {
+       case REF_WORKTREE_OTHER: {
+               static struct strbuf wtname_buf = STRBUF_INIT;
+               struct strbuf wt_dir = STRBUF_INIT;
+               struct reftable_stack *stack;
+
+               /*
+                * We're using a static buffer here so that we don't need to
+                * allocate the worktree name whenever we look up a reference.
+                * This could be avoided if the strmap interface knew how to
+                * handle keys with a length.
+                */
+               strbuf_reset(&wtname_buf);
+               strbuf_add(&wtname_buf, wtname, wtname_len);
+
+               /*
+                * There is an edge case here: when the worktree references the
+                * current worktree, then we set up the stack once via
+                * `worktree_stacks` and once via `worktree_stack`. This is
+                * wasteful, but in the reading case it shouldn't matter. And
+                * in the writing case we would notice that the stack is locked
+                * already and error out when trying to write a reference via
+                * both stacks.
+                */
+               stack = strmap_get(&store->worktree_stacks, wtname_buf.buf);
+               if (!stack) {
+                       strbuf_addf(&wt_dir, "%s/worktrees/%s/reftable",
+                                   store->base.repo->commondir, wtname_buf.buf);
+
+                       store->err = reftable_new_stack(&stack, wt_dir.buf,
+                                                       store->write_options);
+                       assert(store->err != REFTABLE_API_ERROR);
+                       strmap_put(&store->worktree_stacks, wtname_buf.buf, stack);
+               }
+
+               strbuf_release(&wt_dir);
+               return stack;
+       }
+       case REF_WORKTREE_CURRENT:
+               /*
+                * If there is no worktree stack then we're currently in the
+                * main worktree. We thus return the main stack in that case.
+                */
+               if (!store->worktree_stack)
+                       return store->main_stack;
+               return store->worktree_stack;
+       case REF_WORKTREE_MAIN:
+       case REF_WORKTREE_SHARED:
+               return store->main_stack;
+       default:
+               BUG("unhandled worktree reference type");
+       }
+}
+
+static int should_write_log(struct ref_store *refs, const char *refname)
+{
+       if (log_all_ref_updates == LOG_REFS_UNSET)
+               log_all_ref_updates = is_bare_repository() ? LOG_REFS_NONE : LOG_REFS_NORMAL;
+
+       switch (log_all_ref_updates) {
+       case LOG_REFS_NONE:
+               return refs_reflog_exists(refs, refname);
+       case LOG_REFS_ALWAYS:
+               return 1;
+       case LOG_REFS_NORMAL:
+               if (should_autocreate_reflog(refname))
+                       return 1;
+               return refs_reflog_exists(refs, refname);
+       default:
+               BUG("unhandled core.logAllRefUpdates value %d", log_all_ref_updates);
+       }
+}
+
+static void fill_reftable_log_record(struct reftable_log_record *log)
+{
+       const char *info = git_committer_info(0);
+       struct ident_split split = {0};
+       int sign = 1;
+
+       if (split_ident_line(&split, info, strlen(info)))
+               BUG("failed splitting committer info");
+
+       reftable_log_record_release(log);
+       log->value_type = REFTABLE_LOG_UPDATE;
+       log->value.update.name =
+               xstrndup(split.name_begin, split.name_end - split.name_begin);
+       log->value.update.email =
+               xstrndup(split.mail_begin, split.mail_end - split.mail_begin);
+       log->value.update.time = atol(split.date_begin);
+       if (*split.tz_begin == '-') {
+               sign = -1;
+               split.tz_begin++;
+       }
+       if (*split.tz_begin == '+') {
+               sign = 1;
+               split.tz_begin++;
+       }
+
+       log->value.update.tz_offset = sign * atoi(split.tz_begin);
+}
+
+static int read_ref_without_reload(struct reftable_stack *stack,
+                                  const char *refname,
+                                  struct object_id *oid,
+                                  struct strbuf *referent,
+                                  unsigned int *type)
+{
+       struct reftable_ref_record ref = {0};
+       int ret;
+
+       ret = reftable_stack_read_ref(stack, refname, &ref);
+       if (ret)
+               goto done;
+
+       if (ref.value_type == REFTABLE_REF_SYMREF) {
+               strbuf_reset(referent);
+               strbuf_addstr(referent, ref.value.symref);
+               *type |= REF_ISSYMREF;
+       } else if (reftable_ref_record_val1(&ref)) {
+               oidread(oid, reftable_ref_record_val1(&ref));
+       } else {
+               /* We got a tombstone, which should not happen. */
+               BUG("unhandled reference value type %d", ref.value_type);
+       }
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       reftable_ref_record_release(&ref);
+       return ret;
+}
+
+static struct ref_store *reftable_be_init(struct repository *repo,
+                                         const char *gitdir,
+                                         unsigned int store_flags)
+{
+       struct reftable_ref_store *refs = xcalloc(1, sizeof(*refs));
+       struct strbuf path = STRBUF_INIT;
+       int is_worktree;
+       mode_t mask;
+
+       mask = umask(0);
+       umask(mask);
+
+       base_ref_store_init(&refs->base, repo, gitdir, &refs_be_reftable);
+       strmap_init(&refs->worktree_stacks);
+       refs->store_flags = store_flags;
+       refs->write_options.block_size = 4096;
+       refs->write_options.hash_id = repo->hash_algo->format_id;
+       refs->write_options.default_permissions = calc_shared_perm(0666 & ~mask);
+
+       /*
+        * Set up the main reftable stack that is hosted in GIT_COMMON_DIR.
+        * This stack contains both the shared and the main worktree refs.
+        *
+        * Note that we don't try to resolve the path in case we have a
+        * worktree because `get_common_dir_noenv()` already does it for us.
+        */
+       is_worktree = get_common_dir_noenv(&path, gitdir);
+       if (!is_worktree) {
+               strbuf_reset(&path);
+               strbuf_realpath(&path, gitdir, 0);
+       }
+       strbuf_addstr(&path, "/reftable");
+       refs->err = reftable_new_stack(&refs->main_stack, path.buf,
+                                      refs->write_options);
+       if (refs->err)
+               goto done;
+
+       /*
+        * If we're in a worktree we also need to set up the worktree reftable
+        * stack that is contained in the per-worktree GIT_DIR.
+        *
+        * Ideally, we would also add the stack to our worktree stack map. But
+        * we have no way to figure out the worktree name here and thus can't
+        * do it efficiently.
+        */
+       if (is_worktree) {
+               strbuf_reset(&path);
+               strbuf_addf(&path, "%s/reftable", gitdir);
+
+               refs->err = reftable_new_stack(&refs->worktree_stack, path.buf,
+                                              refs->write_options);
+               if (refs->err)
+                       goto done;
+       }
+
+       chdir_notify_reparent("reftables-backend $GIT_DIR", &refs->base.gitdir);
+
+done:
+       assert(refs->err != REFTABLE_API_ERROR);
+       strbuf_release(&path);
+       return &refs->base;
+}
+
+static int reftable_be_init_db(struct ref_store *ref_store,
+                              int flags UNUSED,
+                              struct strbuf *err UNUSED)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE, "init_db");
+       struct strbuf sb = STRBUF_INIT;
+
+       strbuf_addf(&sb, "%s/reftable", refs->base.gitdir);
+       safe_create_dir(sb.buf, 1);
+       strbuf_reset(&sb);
+
+       strbuf_addf(&sb, "%s/HEAD", refs->base.gitdir);
+       write_file(sb.buf, "ref: refs/heads/.invalid");
+       adjust_shared_perm(sb.buf);
+       strbuf_reset(&sb);
+
+       strbuf_addf(&sb, "%s/refs", refs->base.gitdir);
+       safe_create_dir(sb.buf, 1);
+       strbuf_reset(&sb);
+
+       strbuf_addf(&sb, "%s/refs/heads", refs->base.gitdir);
+       write_file(sb.buf, "this repository uses the reftable format");
+       adjust_shared_perm(sb.buf);
+
+       strbuf_release(&sb);
+       return 0;
+}
+
+struct reftable_ref_iterator {
+       struct ref_iterator base;
+       struct reftable_ref_store *refs;
+       struct reftable_iterator iter;
+       struct reftable_ref_record ref;
+       struct object_id oid;
+
+       const char *prefix;
+       size_t prefix_len;
+       unsigned int flags;
+       int err;
+};
+
+static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
+{
+       struct reftable_ref_iterator *iter =
+               (struct reftable_ref_iterator *)ref_iterator;
+       struct reftable_ref_store *refs = iter->refs;
+
+       while (!iter->err) {
+               int flags = 0;
+
+               iter->err = reftable_iterator_next_ref(&iter->iter, &iter->ref);
+               if (iter->err)
+                       break;
+
+               /*
+                * The files backend only lists references contained in "refs/" unless
+                * the root refs are to be included. We emulate the same behaviour here.
+                */
+               if (!starts_with(iter->ref.refname, "refs/") &&
+                   !(iter->flags & DO_FOR_EACH_INCLUDE_ROOT_REFS &&
+                    (is_pseudoref(&iter->refs->base, iter->ref.refname) ||
+                     is_headref(&iter->refs->base, iter->ref.refname)))) {
+                       continue;
+               }
+
+               if (iter->prefix_len &&
+                   strncmp(iter->prefix, iter->ref.refname, iter->prefix_len)) {
+                       iter->err = 1;
+                       break;
+               }
+
+               if (iter->flags & DO_FOR_EACH_PER_WORKTREE_ONLY &&
+                   parse_worktree_ref(iter->ref.refname, NULL, NULL, NULL) !=
+                           REF_WORKTREE_CURRENT)
+                       continue;
+
+               switch (iter->ref.value_type) {
+               case REFTABLE_REF_VAL1:
+                       oidread(&iter->oid, iter->ref.value.val1);
+                       break;
+               case REFTABLE_REF_VAL2:
+                       oidread(&iter->oid, iter->ref.value.val2.value);
+                       break;
+               case REFTABLE_REF_SYMREF:
+                       if (!refs_resolve_ref_unsafe(&iter->refs->base, iter->ref.refname,
+                                                    RESOLVE_REF_READING, &iter->oid, &flags))
+                               oidclr(&iter->oid);
+                       break;
+               default:
+                       BUG("unhandled reference value type %d", iter->ref.value_type);
+               }
+
+               if (is_null_oid(&iter->oid))
+                       flags |= REF_ISBROKEN;
+
+               if (check_refname_format(iter->ref.refname, REFNAME_ALLOW_ONELEVEL)) {
+                       if (!refname_is_safe(iter->ref.refname))
+                               die(_("refname is dangerous: %s"), iter->ref.refname);
+                       oidclr(&iter->oid);
+                       flags |= REF_BAD_NAME | REF_ISBROKEN;
+               }
+
+               if (iter->flags & DO_FOR_EACH_OMIT_DANGLING_SYMREFS &&
+                   flags & REF_ISSYMREF &&
+                   flags & REF_ISBROKEN)
+                       continue;
+
+               if (!(iter->flags & DO_FOR_EACH_INCLUDE_BROKEN) &&
+                   !ref_resolves_to_object(iter->ref.refname, refs->base.repo,
+                                           &iter->oid, flags))
+                               continue;
+
+               iter->base.refname = iter->ref.refname;
+               iter->base.oid = &iter->oid;
+               iter->base.flags = flags;
+
+               break;
+       }
+
+       if (iter->err > 0) {
+               if (ref_iterator_abort(ref_iterator) != ITER_DONE)
+                       return ITER_ERROR;
+               return ITER_DONE;
+       }
+
+       if (iter->err < 0) {
+               ref_iterator_abort(ref_iterator);
+               return ITER_ERROR;
+       }
+
+       return ITER_OK;
+}
+
+static int reftable_ref_iterator_peel(struct ref_iterator *ref_iterator,
+                                     struct object_id *peeled)
+{
+       struct reftable_ref_iterator *iter =
+               (struct reftable_ref_iterator *)ref_iterator;
+
+       if (iter->ref.value_type == REFTABLE_REF_VAL2) {
+               oidread(peeled, iter->ref.value.val2.target_value);
+               return 0;
+       }
+
+       return -1;
+}
+
+static int reftable_ref_iterator_abort(struct ref_iterator *ref_iterator)
+{
+       struct reftable_ref_iterator *iter =
+               (struct reftable_ref_iterator *)ref_iterator;
+       reftable_ref_record_release(&iter->ref);
+       reftable_iterator_destroy(&iter->iter);
+       free(iter);
+       return ITER_DONE;
+}
+
+static struct ref_iterator_vtable reftable_ref_iterator_vtable = {
+       .advance = reftable_ref_iterator_advance,
+       .peel = reftable_ref_iterator_peel,
+       .abort = reftable_ref_iterator_abort
+};
+
+static struct reftable_ref_iterator *ref_iterator_for_stack(struct reftable_ref_store *refs,
+                                                           struct reftable_stack *stack,
+                                                           const char *prefix,
+                                                           int flags)
+{
+       struct reftable_merged_table *merged_table;
+       struct reftable_ref_iterator *iter;
+       int ret;
+
+       iter = xcalloc(1, sizeof(*iter));
+       base_ref_iterator_init(&iter->base, &reftable_ref_iterator_vtable);
+       iter->prefix = prefix;
+       iter->prefix_len = prefix ? strlen(prefix) : 0;
+       iter->base.oid = &iter->oid;
+       iter->flags = flags;
+       iter->refs = refs;
+
+       ret = refs->err;
+       if (ret)
+               goto done;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               goto done;
+
+       merged_table = reftable_stack_merged_table(stack);
+
+       ret = reftable_merged_table_seek_ref(merged_table, &iter->iter, prefix);
+       if (ret)
+               goto done;
+
+done:
+       iter->err = ret;
+       return iter;
+}
+
+static struct ref_iterator *reftable_be_iterator_begin(struct ref_store *ref_store,
+                                                      const char *prefix,
+                                                      const char **exclude_patterns,
+                                                      unsigned int flags)
+{
+       struct reftable_ref_iterator *main_iter, *worktree_iter;
+       struct reftable_ref_store *refs;
+       unsigned int required_flags = REF_STORE_READ;
+
+       if (!(flags & DO_FOR_EACH_INCLUDE_BROKEN))
+               required_flags |= REF_STORE_ODB;
+       refs = reftable_be_downcast(ref_store, required_flags, "ref_iterator_begin");
+
+       main_iter = ref_iterator_for_stack(refs, refs->main_stack, prefix, flags);
+
+       /*
+        * The worktree stack is only set when we're in an actual worktree
+        * right now. If we aren't, then we return the common reftable
+        * iterator, only.
+        */
+        if (!refs->worktree_stack)
+               return &main_iter->base;
+
+       /*
+        * Otherwise we merge both the common and the per-worktree refs into a
+        * single iterator.
+        */
+       worktree_iter = ref_iterator_for_stack(refs, refs->worktree_stack, prefix, flags);
+       return merge_ref_iterator_begin(&worktree_iter->base, &main_iter->base,
+                                       ref_iterator_select, NULL);
+}
+
+static int reftable_be_read_raw_ref(struct ref_store *ref_store,
+                                   const char *refname,
+                                   struct object_id *oid,
+                                   struct strbuf *referent,
+                                   unsigned int *type,
+                                   int *failure_errno)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_READ, "read_raw_ref");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       int ret;
+
+       if (refs->err < 0)
+               return refs->err;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               return ret;
+
+       ret = read_ref_without_reload(stack, refname, oid, referent, type);
+       if (ret < 0)
+               return ret;
+       if (ret > 0) {
+               *failure_errno = ENOENT;
+               return -1;
+       }
+
+       return 0;
+}
+
+static int reftable_be_read_symbolic_ref(struct ref_store *ref_store,
+                                        const char *refname,
+                                        struct strbuf *referent)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_READ, "read_symbolic_ref");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct reftable_ref_record ref = {0};
+       int ret;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               return ret;
+
+       ret = reftable_stack_read_ref(stack, refname, &ref);
+       if (ret == 0 && ref.value_type == REFTABLE_REF_SYMREF)
+               strbuf_addstr(referent, ref.value.symref);
+       else
+               ret = -1;
+
+       reftable_ref_record_release(&ref);
+       return ret;
+}
+
+/*
+ * Return the refname under which update was originally requested.
+ */
+static const char *original_update_refname(struct ref_update *update)
+{
+       while (update->parent_update)
+               update = update->parent_update;
+       return update->refname;
+}
+
+struct reftable_transaction_update {
+       struct ref_update *update;
+       struct object_id current_oid;
+};
+
+struct write_transaction_table_arg {
+       struct reftable_ref_store *refs;
+       struct reftable_stack *stack;
+       struct reftable_addition *addition;
+       struct reftable_transaction_update *updates;
+       size_t updates_nr;
+       size_t updates_alloc;
+       size_t updates_expected;
+};
+
+struct reftable_transaction_data {
+       struct write_transaction_table_arg *args;
+       size_t args_nr, args_alloc;
+};
+
+static void free_transaction_data(struct reftable_transaction_data *tx_data)
+{
+       if (!tx_data)
+               return;
+       for (size_t i = 0; i < tx_data->args_nr; i++) {
+               reftable_addition_destroy(tx_data->args[i].addition);
+               free(tx_data->args[i].updates);
+       }
+       free(tx_data->args);
+       free(tx_data);
+}
+
+/*
+ * Prepare transaction update for the given reference update. This will cause
+ * us to lock the corresponding reftable stack for concurrent modification.
+ */
+static int prepare_transaction_update(struct write_transaction_table_arg **out,
+                                     struct reftable_ref_store *refs,
+                                     struct reftable_transaction_data *tx_data,
+                                     struct ref_update *update,
+                                     struct strbuf *err)
+{
+       struct reftable_stack *stack = stack_for(refs, update->refname, NULL);
+       struct write_transaction_table_arg *arg = NULL;
+       size_t i;
+       int ret;
+
+       /*
+        * Search for a preexisting stack update. If there is one then we add
+        * the update to it, otherwise we set up a new stack update.
+        */
+       for (i = 0; !arg && i < tx_data->args_nr; i++)
+               if (tx_data->args[i].stack == stack)
+                       arg = &tx_data->args[i];
+
+       if (!arg) {
+               struct reftable_addition *addition;
+
+               ret = reftable_stack_reload(stack);
+               if (ret)
+                       return ret;
+
+               ret = reftable_stack_new_addition(&addition, stack);
+               if (ret) {
+                       if (ret == REFTABLE_LOCK_ERROR)
+                               strbuf_addstr(err, "cannot lock references");
+                       return ret;
+               }
+
+               ALLOC_GROW(tx_data->args, tx_data->args_nr + 1,
+                          tx_data->args_alloc);
+               arg = &tx_data->args[tx_data->args_nr++];
+               arg->refs = refs;
+               arg->stack = stack;
+               arg->addition = addition;
+               arg->updates = NULL;
+               arg->updates_nr = 0;
+               arg->updates_alloc = 0;
+               arg->updates_expected = 0;
+       }
+
+       arg->updates_expected++;
+
+       if (out)
+               *out = arg;
+
+       return 0;
+}
+
+/*
+ * Queue a reference update for the correct stack. We potentially need to
+ * handle multiple stack updates in a single transaction when it spans across
+ * multiple worktrees.
+ */
+static int queue_transaction_update(struct reftable_ref_store *refs,
+                                   struct reftable_transaction_data *tx_data,
+                                   struct ref_update *update,
+                                   struct object_id *current_oid,
+                                   struct strbuf *err)
+{
+       struct write_transaction_table_arg *arg = NULL;
+       int ret;
+
+       if (update->backend_data)
+               BUG("reference update queued more than once");
+
+       ret = prepare_transaction_update(&arg, refs, tx_data, update, err);
+       if (ret < 0)
+               return ret;
+
+       ALLOC_GROW(arg->updates, arg->updates_nr + 1,
+                  arg->updates_alloc);
+       arg->updates[arg->updates_nr].update = update;
+       oidcpy(&arg->updates[arg->updates_nr].current_oid, current_oid);
+       update->backend_data = &arg->updates[arg->updates_nr++];
+
+       return 0;
+}
+
+static int reftable_be_transaction_prepare(struct ref_store *ref_store,
+                                          struct ref_transaction *transaction,
+                                          struct strbuf *err)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE|REF_STORE_MAIN, "ref_transaction_prepare");
+       struct strbuf referent = STRBUF_INIT, head_referent = STRBUF_INIT;
+       struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
+       struct reftable_transaction_data *tx_data = NULL;
+       struct object_id head_oid;
+       unsigned int head_type = 0;
+       size_t i;
+       int ret;
+
+       ret = refs->err;
+       if (ret < 0)
+               goto done;
+
+       tx_data = xcalloc(1, sizeof(*tx_data));
+
+       /*
+        * Preprocess all updates. For one we check that there are no duplicate
+        * reference updates in this transaction. Second, we lock all stacks
+        * that will be modified during the transaction.
+        */
+       for (i = 0; i < transaction->nr; i++) {
+               ret = prepare_transaction_update(NULL, refs, tx_data,
+                                                transaction->updates[i], err);
+               if (ret)
+                       goto done;
+
+               string_list_append(&affected_refnames,
+                                  transaction->updates[i]->refname);
+       }
+
+       /*
+        * Now that we have counted updates per stack we can preallocate their
+        * arrays. This avoids having to reallocate many times.
+        */
+       for (i = 0; i < tx_data->args_nr; i++) {
+               CALLOC_ARRAY(tx_data->args[i].updates, tx_data->args[i].updates_expected);
+               tx_data->args[i].updates_alloc = tx_data->args[i].updates_expected;
+       }
+
+       /*
+        * Fail if a refname appears more than once in the transaction.
+        * This code is taken from the files backend and is a good candidate to
+        * be moved into the generic layer.
+        */
+       string_list_sort(&affected_refnames);
+       if (ref_update_reject_duplicates(&affected_refnames, err)) {
+               ret = TRANSACTION_GENERIC_ERROR;
+               goto done;
+       }
+
+       ret = read_ref_without_reload(stack_for(refs, "HEAD", NULL), "HEAD", &head_oid,
+                                     &head_referent, &head_type);
+       if (ret < 0)
+               goto done;
+       ret = 0;
+
+       for (i = 0; i < transaction->nr; i++) {
+               struct ref_update *u = transaction->updates[i];
+               struct object_id current_oid = {0};
+               struct reftable_stack *stack;
+               const char *rewritten_ref;
+
+               stack = stack_for(refs, u->refname, &rewritten_ref);
+
+               /* Verify that the new object ID is valid. */
+               if ((u->flags & REF_HAVE_NEW) && !is_null_oid(&u->new_oid) &&
+                   !(u->flags & REF_SKIP_OID_VERIFICATION) &&
+                   !(u->flags & REF_LOG_ONLY)) {
+                       struct object *o = parse_object(refs->base.repo, &u->new_oid);
+                       if (!o) {
+                               strbuf_addf(err,
+                                           _("trying to write ref '%s' with nonexistent object %s"),
+                                           u->refname, oid_to_hex(&u->new_oid));
+                               ret = -1;
+                               goto done;
+                       }
+
+                       if (o->type != OBJ_COMMIT && is_branch(u->refname)) {
+                               strbuf_addf(err, _("trying to write non-commit object %s to branch '%s'"),
+                                           oid_to_hex(&u->new_oid), u->refname);
+                               ret = -1;
+                               goto done;
+                       }
+               }
+
+               /*
+                * When we update the reference that HEAD points to we enqueue
+                * a second log-only update for HEAD so that its reflog is
+                * updated accordingly.
+                */
+               if (head_type == REF_ISSYMREF &&
+                   !(u->flags & REF_LOG_ONLY) &&
+                   !(u->flags & REF_UPDATE_VIA_HEAD) &&
+                   !strcmp(rewritten_ref, head_referent.buf)) {
+                       struct ref_update *new_update;
+
+                       /*
+                        * First make sure that HEAD is not already in the
+                        * transaction. This check is O(lg N) in the transaction
+                        * size, but it happens at most once per transaction.
+                        */
+                       if (string_list_has_string(&affected_refnames, "HEAD")) {
+                               /* An entry already existed */
+                               strbuf_addf(err,
+                                           _("multiple updates for 'HEAD' (including one "
+                                           "via its referent '%s') are not allowed"),
+                                           u->refname);
+                               ret = TRANSACTION_NAME_CONFLICT;
+                               goto done;
+                       }
+
+                       new_update = ref_transaction_add_update(
+                                       transaction, "HEAD",
+                                       u->flags | REF_LOG_ONLY | REF_NO_DEREF,
+                                       &u->new_oid, &u->old_oid, u->msg);
+                       string_list_insert(&affected_refnames, new_update->refname);
+               }
+
+               ret = read_ref_without_reload(stack, rewritten_ref,
+                                             &current_oid, &referent, &u->type);
+               if (ret < 0)
+                       goto done;
+               if (ret > 0 && (!(u->flags & REF_HAVE_OLD) || is_null_oid(&u->old_oid))) {
+                       /*
+                        * The reference does not exist, and we either have no
+                        * old object ID or expect the reference to not exist.
+                        * We can thus skip below safety checks as well as the
+                        * symref splitting. But we do want to verify that
+                        * there is no conflicting reference here so that we
+                        * can output a proper error message instead of failing
+                        * at a later point.
+                        */
+                       ret = refs_verify_refname_available(ref_store, u->refname,
+                                                           &affected_refnames, NULL, err);
+                       if (ret < 0)
+                               goto done;
+
+                       /*
+                        * There is no need to write the reference deletion
+                        * when the reference in question doesn't exist.
+                        */
+                        if (u->flags & REF_HAVE_NEW && !is_null_oid(&u->new_oid)) {
+                                ret = queue_transaction_update(refs, tx_data, u,
+                                                               &current_oid, err);
+                                if (ret)
+                                        goto done;
+                        }
+
+                       continue;
+               }
+               if (ret > 0) {
+                       /* The reference does not exist, but we expected it to. */
+                       strbuf_addf(err, _("cannot lock ref '%s': "
+                                   "unable to resolve reference '%s'"),
+                                   original_update_refname(u), u->refname);
+                       ret = -1;
+                       goto done;
+               }
+
+               if (u->type & REF_ISSYMREF) {
+                       /*
+                        * The reftable stack is locked at this point already,
+                        * so it is safe to call `refs_resolve_ref_unsafe()`
+                        * here without causing races.
+                        */
+                       const char *resolved = refs_resolve_ref_unsafe(&refs->base, u->refname, 0,
+                                                                      &current_oid, NULL);
+
+                       if (u->flags & REF_NO_DEREF) {
+                               if (u->flags & REF_HAVE_OLD && !resolved) {
+                                       strbuf_addf(err, _("cannot lock ref '%s': "
+                                                   "error reading reference"), u->refname);
+                                       ret = -1;
+                                       goto done;
+                               }
+                       } else {
+                               struct ref_update *new_update;
+                               int new_flags;
+
+                               new_flags = u->flags;
+                               if (!strcmp(rewritten_ref, "HEAD"))
+                                       new_flags |= REF_UPDATE_VIA_HEAD;
+
+                               /*
+                                * If we are updating a symref (eg. HEAD), we should also
+                                * update the branch that the symref points to.
+                                *
+                                * This is generic functionality, and would be better
+                                * done in refs.c, but the current implementation is
+                                * intertwined with the locking in files-backend.c.
+                                */
+                               new_update = ref_transaction_add_update(
+                                               transaction, referent.buf, new_flags,
+                                               &u->new_oid, &u->old_oid, u->msg);
+                               new_update->parent_update = u;
+
+                               /*
+                                * Change the symbolic ref update to log only. Also, it
+                                * doesn't need to check its old OID value, as that will be
+                                * done when new_update is processed.
+                                */
+                               u->flags |= REF_LOG_ONLY | REF_NO_DEREF;
+                               u->flags &= ~REF_HAVE_OLD;
+
+                               if (string_list_has_string(&affected_refnames, new_update->refname)) {
+                                       strbuf_addf(err,
+                                                   _("multiple updates for '%s' (including one "
+                                                   "via symref '%s') are not allowed"),
+                                                   referent.buf, u->refname);
+                                       ret = TRANSACTION_NAME_CONFLICT;
+                                       goto done;
+                               }
+                               string_list_insert(&affected_refnames, new_update->refname);
+                       }
+               }
+
+               /*
+                * Verify that the old object matches our expectations. Note
+                * that the error messages here do not make a lot of sense in
+                * the context of the reftable backend as we never lock
+                * individual refs. But the error messages match what the files
+                * backend returns, which keeps our tests happy.
+                */
+               if (u->flags & REF_HAVE_OLD && !oideq(&current_oid, &u->old_oid)) {
+                       if (is_null_oid(&u->old_oid))
+                               strbuf_addf(err, _("cannot lock ref '%s': "
+                                           "reference already exists"),
+                                           original_update_refname(u));
+                       else if (is_null_oid(&current_oid))
+                               strbuf_addf(err, _("cannot lock ref '%s': "
+                                           "reference is missing but expected %s"),
+                                           original_update_refname(u),
+                                           oid_to_hex(&u->old_oid));
+                       else
+                               strbuf_addf(err, _("cannot lock ref '%s': "
+                                           "is at %s but expected %s"),
+                                           original_update_refname(u),
+                                           oid_to_hex(&current_oid),
+                                           oid_to_hex(&u->old_oid));
+                       ret = -1;
+                       goto done;
+               }
+
+               /*
+                * If all of the following conditions are true:
+                *
+                *   - We're not about to write a symref.
+                *   - We're not about to write a log-only entry.
+                *   - Old and new object ID are different.
+                *
+                * Then we're essentially doing a no-op update that can be
+                * skipped. This is not only for the sake of efficiency, but
+                * also skips writing unneeded reflog entries.
+                */
+               if ((u->type & REF_ISSYMREF) ||
+                   (u->flags & REF_LOG_ONLY) ||
+                   (u->flags & REF_HAVE_NEW && !oideq(&current_oid, &u->new_oid))) {
+                       ret = queue_transaction_update(refs, tx_data, u,
+                                                      &current_oid, err);
+                       if (ret)
+                               goto done;
+               }
+       }
+
+       transaction->backend_data = tx_data;
+       transaction->state = REF_TRANSACTION_PREPARED;
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       if (ret < 0) {
+               free_transaction_data(tx_data);
+               transaction->state = REF_TRANSACTION_CLOSED;
+               if (!err->len)
+                       strbuf_addf(err, _("reftable: transaction prepare: %s"),
+                                   reftable_error_str(ret));
+       }
+       string_list_clear(&affected_refnames, 0);
+       strbuf_release(&referent);
+       strbuf_release(&head_referent);
+
+       return ret;
+}
+
+static int reftable_be_transaction_abort(struct ref_store *ref_store,
+                                        struct ref_transaction *transaction,
+                                        struct strbuf *err)
+{
+       struct reftable_transaction_data *tx_data = transaction->backend_data;
+       free_transaction_data(tx_data);
+       transaction->state = REF_TRANSACTION_CLOSED;
+       return 0;
+}
+
+static int transaction_update_cmp(const void *a, const void *b)
+{
+       return strcmp(((struct reftable_transaction_update *)a)->update->refname,
+                     ((struct reftable_transaction_update *)b)->update->refname);
+}
+
+static int write_transaction_table(struct reftable_writer *writer, void *cb_data)
+{
+       struct write_transaction_table_arg *arg = cb_data;
+       struct reftable_merged_table *mt =
+               reftable_stack_merged_table(arg->stack);
+       uint64_t ts = reftable_stack_next_update_index(arg->stack);
+       struct reftable_log_record *logs = NULL;
+       size_t logs_nr = 0, logs_alloc = 0, i;
+       int ret = 0;
+
+       QSORT(arg->updates, arg->updates_nr, transaction_update_cmp);
+
+       reftable_writer_set_limits(writer, ts, ts);
+
+       for (i = 0; i < arg->updates_nr; i++) {
+               struct reftable_transaction_update *tx_update = &arg->updates[i];
+               struct ref_update *u = tx_update->update;
+
+               /*
+                * Write a reflog entry when updating a ref to point to
+                * something new in either of the following cases:
+                *
+                * - The reference is about to be deleted. We always want to
+                *   delete the reflog in that case.
+                * - REF_FORCE_CREATE_REFLOG is set, asking us to always create
+                *   the reflog entry.
+                * - `core.logAllRefUpdates` tells us to create the reflog for
+                *   the given ref.
+                */
+               if (u->flags & REF_HAVE_NEW && !(u->type & REF_ISSYMREF) && is_null_oid(&u->new_oid)) {
+                       struct reftable_log_record log = {0};
+                       struct reftable_iterator it = {0};
+
+                       /*
+                        * When deleting refs we also delete all reflog entries
+                        * with them. While it is not strictly required to
+                        * delete reflogs together with their refs, this
+                        * matches the behaviour of the files backend.
+                        *
+                        * Unfortunately, we have no better way than to delete
+                        * all reflog entries one by one.
+                        */
+                       ret = reftable_merged_table_seek_log(mt, &it, u->refname);
+                       while (ret == 0) {
+                               struct reftable_log_record *tombstone;
+
+                               ret = reftable_iterator_next_log(&it, &log);
+                               if (ret < 0)
+                                       break;
+                               if (ret > 0 || strcmp(log.refname, u->refname)) {
+                                       ret = 0;
+                                       break;
+                               }
+
+                               ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+                               tombstone = &logs[logs_nr++];
+                               tombstone->refname = xstrdup(u->refname);
+                               tombstone->value_type = REFTABLE_LOG_DELETION;
+                               tombstone->update_index = log.update_index;
+                       }
+
+                       reftable_log_record_release(&log);
+                       reftable_iterator_destroy(&it);
+
+                       if (ret)
+                               goto done;
+               } else if (u->flags & REF_HAVE_NEW &&
+                          (u->flags & REF_FORCE_CREATE_REFLOG ||
+                           should_write_log(&arg->refs->base, u->refname))) {
+                       struct reftable_log_record *log;
+
+                       ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+                       log = &logs[logs_nr++];
+                       memset(log, 0, sizeof(*log));
+
+                       fill_reftable_log_record(log);
+                       log->update_index = ts;
+                       log->refname = xstrdup(u->refname);
+                       memcpy(log->value.update.new_hash, u->new_oid.hash, GIT_MAX_RAWSZ);
+                       memcpy(log->value.update.old_hash, tx_update->current_oid.hash, GIT_MAX_RAWSZ);
+                       log->value.update.message =
+                               xstrndup(u->msg, arg->refs->write_options.block_size / 2);
+               }
+
+               if (u->flags & REF_LOG_ONLY)
+                       continue;
+
+               if (u->flags & REF_HAVE_NEW && is_null_oid(&u->new_oid)) {
+                       struct reftable_ref_record ref = {
+                               .refname = (char *)u->refname,
+                               .update_index = ts,
+                               .value_type = REFTABLE_REF_DELETION,
+                       };
+
+                       ret = reftable_writer_add_ref(writer, &ref);
+                       if (ret < 0)
+                               goto done;
+               } else if (u->flags & REF_HAVE_NEW) {
+                       struct reftable_ref_record ref = {0};
+                       struct object_id peeled;
+                       int peel_error;
+
+                       ref.refname = (char *)u->refname;
+                       ref.update_index = ts;
+
+                       peel_error = peel_object(&u->new_oid, &peeled);
+                       if (!peel_error) {
+                               ref.value_type = REFTABLE_REF_VAL2;
+                               memcpy(ref.value.val2.target_value, peeled.hash, GIT_MAX_RAWSZ);
+                               memcpy(ref.value.val2.value, u->new_oid.hash, GIT_MAX_RAWSZ);
+                       } else if (!is_null_oid(&u->new_oid)) {
+                               ref.value_type = REFTABLE_REF_VAL1;
+                               memcpy(ref.value.val1, u->new_oid.hash, GIT_MAX_RAWSZ);
+                       }
+
+                       ret = reftable_writer_add_ref(writer, &ref);
+                       if (ret < 0)
+                               goto done;
+               }
+       }
+
+       /*
+        * Logs are written at the end so that we do not have intermixed ref
+        * and log blocks.
+        */
+       if (logs) {
+               ret = reftable_writer_add_logs(writer, logs, logs_nr);
+               if (ret < 0)
+                       goto done;
+       }
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       for (i = 0; i < logs_nr; i++)
+               reftable_log_record_release(&logs[i]);
+       free(logs);
+       return ret;
+}
+
+static int reftable_be_transaction_finish(struct ref_store *ref_store,
+                                         struct ref_transaction *transaction,
+                                         struct strbuf *err)
+{
+       struct reftable_transaction_data *tx_data = transaction->backend_data;
+       int ret = 0;
+
+       for (size_t i = 0; i < tx_data->args_nr; i++) {
+               ret = reftable_addition_add(tx_data->args[i].addition,
+                                           write_transaction_table, &tx_data->args[i]);
+               if (ret < 0)
+                       goto done;
+
+               ret = reftable_addition_commit(tx_data->args[i].addition);
+               if (ret < 0)
+                       goto done;
+       }
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       free_transaction_data(tx_data);
+       transaction->state = REF_TRANSACTION_CLOSED;
+
+       if (ret) {
+               strbuf_addf(err, _("reftable: transaction failure: %s"),
+                           reftable_error_str(ret));
+               return -1;
+       }
+       return ret;
+}
+
+static int reftable_be_initial_transaction_commit(struct ref_store *ref_store UNUSED,
+                                                 struct ref_transaction *transaction,
+                                                 struct strbuf *err)
+{
+       return ref_transaction_commit(transaction, err);
+}
+
+static int reftable_be_pack_refs(struct ref_store *ref_store,
+                                struct pack_refs_opts *opts)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE | REF_STORE_ODB, "pack_refs");
+       struct reftable_stack *stack;
+       int ret;
+
+       if (refs->err)
+               return refs->err;
+
+       stack = refs->worktree_stack;
+       if (!stack)
+               stack = refs->main_stack;
+
+       ret = reftable_stack_compact_all(stack, NULL);
+       if (ret)
+               goto out;
+       ret = reftable_stack_clean(stack);
+       if (ret)
+               goto out;
+
+out:
+       return ret;
+}
+
+struct write_create_symref_arg {
+       struct reftable_ref_store *refs;
+       struct reftable_stack *stack;
+       const char *refname;
+       const char *target;
+       const char *logmsg;
+};
+
+static int write_create_symref_table(struct reftable_writer *writer, void *cb_data)
+{
+       struct write_create_symref_arg *create = cb_data;
+       uint64_t ts = reftable_stack_next_update_index(create->stack);
+       struct reftable_ref_record ref = {
+               .refname = (char *)create->refname,
+               .value_type = REFTABLE_REF_SYMREF,
+               .value.symref = (char *)create->target,
+               .update_index = ts,
+       };
+       struct reftable_log_record log = {0};
+       struct object_id new_oid;
+       struct object_id old_oid;
+       int ret;
+
+       reftable_writer_set_limits(writer, ts, ts);
+
+       ret = reftable_writer_add_ref(writer, &ref);
+       if (ret)
+               return ret;
+
+       /*
+        * Note that it is important to try and resolve the reference before we
+        * write the log entry. This is because `should_write_log()` will munge
+        * `core.logAllRefUpdates`, which is undesirable when we create a new
+        * repository because it would be written into the config. As HEAD will
+        * not resolve for new repositories this ordering will ensure that this
+        * never happens.
+        */
+       if (!create->logmsg ||
+           !refs_resolve_ref_unsafe(&create->refs->base, create->target,
+                                    RESOLVE_REF_READING, &new_oid, NULL) ||
+           !should_write_log(&create->refs->base, create->refname))
+               return 0;
+
+       fill_reftable_log_record(&log);
+       log.refname = xstrdup(create->refname);
+       log.update_index = ts;
+       log.value.update.message = xstrndup(create->logmsg,
+                                           create->refs->write_options.block_size / 2);
+       memcpy(log.value.update.new_hash, new_oid.hash, GIT_MAX_RAWSZ);
+       if (refs_resolve_ref_unsafe(&create->refs->base, create->refname,
+                                   RESOLVE_REF_READING, &old_oid, NULL))
+               memcpy(log.value.update.old_hash, old_oid.hash, GIT_MAX_RAWSZ);
+
+       ret = reftable_writer_add_log(writer, &log);
+       reftable_log_record_release(&log);
+       return ret;
+}
+
+static int reftable_be_create_symref(struct ref_store *ref_store,
+                                    const char *refname,
+                                    const char *target,
+                                    const char *logmsg)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE, "create_symref");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct write_create_symref_arg arg = {
+               .refs = refs,
+               .stack = stack,
+               .refname = refname,
+               .target = target,
+               .logmsg = logmsg,
+       };
+       int ret;
+
+       ret = refs->err;
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               goto done;
+
+       ret = reftable_stack_add(stack, &write_create_symref_table, &arg);
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       if (ret)
+               error("unable to write symref for %s: %s", refname,
+                     reftable_error_str(ret));
+       return ret;
+}
+
+struct write_copy_arg {
+       struct reftable_ref_store *refs;
+       struct reftable_stack *stack;
+       const char *oldname;
+       const char *newname;
+       const char *logmsg;
+       int delete_old;
+};
+
+static int write_copy_table(struct reftable_writer *writer, void *cb_data)
+{
+       struct write_copy_arg *arg = cb_data;
+       uint64_t deletion_ts, creation_ts;
+       struct reftable_merged_table *mt = reftable_stack_merged_table(arg->stack);
+       struct reftable_ref_record old_ref = {0}, refs[2] = {0};
+       struct reftable_log_record old_log = {0}, *logs = NULL;
+       struct reftable_iterator it = {0};
+       struct string_list skip = STRING_LIST_INIT_NODUP;
+       struct strbuf errbuf = STRBUF_INIT;
+       size_t logs_nr = 0, logs_alloc = 0, i;
+       int ret;
+
+       if (reftable_stack_read_ref(arg->stack, arg->oldname, &old_ref)) {
+               ret = error(_("refname %s not found"), arg->oldname);
+               goto done;
+       }
+       if (old_ref.value_type == REFTABLE_REF_SYMREF) {
+               ret = error(_("refname %s is a symbolic ref, copying it is not supported"),
+                           arg->oldname);
+               goto done;
+       }
+
+       /*
+        * There's nothing to do in case the old and new name are the same, so
+        * we exit early in that case.
+        */
+       if (!strcmp(arg->oldname, arg->newname)) {
+               ret = 0;
+               goto done;
+       }
+
+       /*
+        * Verify that the new refname is available.
+        */
+       string_list_insert(&skip, arg->oldname);
+       ret = refs_verify_refname_available(&arg->refs->base, arg->newname,
+                                           NULL, &skip, &errbuf);
+       if (ret < 0) {
+               error("%s", errbuf.buf);
+               goto done;
+       }
+
+       /*
+        * When deleting the old reference we have to use two update indices:
+        * once to delete the old ref and its reflog, and once to create the
+        * new ref and its reflog. They need to be staged with two separate
+        * indices because the new reflog needs to encode both the deletion of
+        * the old branch and the creation of the new branch, and we cannot do
+        * two changes to a reflog in a single update.
+        */
+       deletion_ts = creation_ts = reftable_stack_next_update_index(arg->stack);
+       if (arg->delete_old)
+               creation_ts++;
+       reftable_writer_set_limits(writer, deletion_ts, creation_ts);
+
+       /*
+        * Add the new reference. If this is a rename then we also delete the
+        * old reference.
+        */
+       refs[0] = old_ref;
+       refs[0].refname = (char *)arg->newname;
+       refs[0].update_index = creation_ts;
+       if (arg->delete_old) {
+               refs[1].refname = (char *)arg->oldname;
+               refs[1].value_type = REFTABLE_REF_DELETION;
+               refs[1].update_index = deletion_ts;
+       }
+       ret = reftable_writer_add_refs(writer, refs, arg->delete_old ? 2 : 1);
+       if (ret < 0)
+               goto done;
+
+       /*
+        * When deleting the old branch we need to create a reflog entry on the
+        * new branch name that indicates that the old branch has been deleted
+        * and then recreated. This is a tad weird, but matches what the files
+        * backend does.
+        */
+       if (arg->delete_old) {
+               struct strbuf head_referent = STRBUF_INIT;
+               struct object_id head_oid;
+               int append_head_reflog;
+               unsigned head_type = 0;
+
+               ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+               memset(&logs[logs_nr], 0, sizeof(logs[logs_nr]));
+               fill_reftable_log_record(&logs[logs_nr]);
+               logs[logs_nr].refname = (char *)arg->newname;
+               logs[logs_nr].update_index = deletion_ts;
+               logs[logs_nr].value.update.message =
+                       xstrndup(arg->logmsg, arg->refs->write_options.block_size / 2);
+               memcpy(logs[logs_nr].value.update.old_hash, old_ref.value.val1, GIT_MAX_RAWSZ);
+               logs_nr++;
+
+               ret = read_ref_without_reload(arg->stack, "HEAD", &head_oid, &head_referent, &head_type);
+               if (ret < 0)
+                       goto done;
+               append_head_reflog = (head_type & REF_ISSYMREF) && !strcmp(head_referent.buf, arg->oldname);
+               strbuf_release(&head_referent);
+
+               /*
+                * The files backend uses `refs_delete_ref()` to delete the old
+                * branch name, which will append a reflog entry for HEAD in
+                * case it points to the old branch.
+                */
+               if (append_head_reflog) {
+                       ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+                       logs[logs_nr] = logs[logs_nr - 1];
+                       logs[logs_nr].refname = "HEAD";
+                       logs_nr++;
+               }
+       }
+
+       /*
+        * Create the reflog entry for the newly created branch.
+        */
+       ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+       memset(&logs[logs_nr], 0, sizeof(logs[logs_nr]));
+       fill_reftable_log_record(&logs[logs_nr]);
+       logs[logs_nr].refname = (char *)arg->newname;
+       logs[logs_nr].update_index = creation_ts;
+       logs[logs_nr].value.update.message =
+               xstrndup(arg->logmsg, arg->refs->write_options.block_size / 2);
+       memcpy(logs[logs_nr].value.update.new_hash, old_ref.value.val1, GIT_MAX_RAWSZ);
+       logs_nr++;
+
+       /*
+        * In addition to writing the reflog entry for the new branch, we also
+        * copy over all log entries from the old reflog. Last but not least,
+        * when renaming we also have to delete all the old reflog entries.
+        */
+       ret = reftable_merged_table_seek_log(mt, &it, arg->oldname);
+       if (ret < 0)
+               goto done;
+
+       while (1) {
+               ret = reftable_iterator_next_log(&it, &old_log);
+               if (ret < 0)
+                       goto done;
+               if (ret > 0 || strcmp(old_log.refname, arg->oldname)) {
+                       ret = 0;
+                       break;
+               }
+
+               free(old_log.refname);
+
+               /*
+                * Copy over the old reflog entry with the new refname.
+                */
+               ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+               logs[logs_nr] = old_log;
+               logs[logs_nr].refname = (char *)arg->newname;
+               logs_nr++;
+
+               /*
+                * Delete the old reflog entry in case we are renaming.
+                */
+               if (arg->delete_old) {
+                       ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+                       memset(&logs[logs_nr], 0, sizeof(logs[logs_nr]));
+                       logs[logs_nr].refname = (char *)arg->oldname;
+                       logs[logs_nr].value_type = REFTABLE_LOG_DELETION;
+                       logs[logs_nr].update_index = old_log.update_index;
+                       logs_nr++;
+               }
+
+               /*
+                * Transfer ownership of the log record we're iterating over to
+                * the array of log records. Otherwise, the pointers would get
+                * free'd or reallocated by the iterator.
+                */
+               memset(&old_log, 0, sizeof(old_log));
+       }
+
+       ret = reftable_writer_add_logs(writer, logs, logs_nr);
+       if (ret < 0)
+               goto done;
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       reftable_iterator_destroy(&it);
+       string_list_clear(&skip, 0);
+       strbuf_release(&errbuf);
+       for (i = 0; i < logs_nr; i++) {
+               if (!strcmp(logs[i].refname, "HEAD"))
+                       continue;
+               logs[i].refname = NULL;
+               reftable_log_record_release(&logs[i]);
+       }
+       free(logs);
+       reftable_ref_record_release(&old_ref);
+       reftable_log_record_release(&old_log);
+       return ret;
+}
+
+static int reftable_be_rename_ref(struct ref_store *ref_store,
+                                 const char *oldrefname,
+                                 const char *newrefname,
+                                 const char *logmsg)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE, "rename_ref");
+       struct reftable_stack *stack = stack_for(refs, newrefname, &newrefname);
+       struct write_copy_arg arg = {
+               .refs = refs,
+               .stack = stack,
+               .oldname = oldrefname,
+               .newname = newrefname,
+               .logmsg = logmsg,
+               .delete_old = 1,
+       };
+       int ret;
+
+       ret = refs->err;
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               goto done;
+       ret = reftable_stack_add(stack, &write_copy_table, &arg);
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       return ret;
+}
+
+static int reftable_be_copy_ref(struct ref_store *ref_store,
+                               const char *oldrefname,
+                               const char *newrefname,
+                               const char *logmsg)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE, "copy_ref");
+       struct reftable_stack *stack = stack_for(refs, newrefname, &newrefname);
+       struct write_copy_arg arg = {
+               .refs = refs,
+               .stack = stack,
+               .oldname = oldrefname,
+               .newname = newrefname,
+               .logmsg = logmsg,
+       };
+       int ret;
+
+       ret = refs->err;
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               goto done;
+       ret = reftable_stack_add(stack, &write_copy_table, &arg);
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       return ret;
+}
+
+struct reftable_reflog_iterator {
+       struct ref_iterator base;
+       struct reftable_ref_store *refs;
+       struct reftable_iterator iter;
+       struct reftable_log_record log;
+       struct strbuf last_name;
+       int err;
+};
+
+static int reftable_reflog_iterator_advance(struct ref_iterator *ref_iterator)
+{
+       struct reftable_reflog_iterator *iter =
+               (struct reftable_reflog_iterator *)ref_iterator;
+
+       while (!iter->err) {
+               iter->err = reftable_iterator_next_log(&iter->iter, &iter->log);
+               if (iter->err)
+                       break;
+
+               /*
+                * We want the refnames that we have reflogs for, so we skip if
+                * we've already produced this name. This could be faster by
+                * seeking directly to reflog@update_index==0.
+                */
+               if (!strcmp(iter->log.refname, iter->last_name.buf))
+                       continue;
+
+               if (check_refname_format(iter->log.refname,
+                                        REFNAME_ALLOW_ONELEVEL))
+                       continue;
+
+               strbuf_reset(&iter->last_name);
+               strbuf_addstr(&iter->last_name, iter->log.refname);
+               iter->base.refname = iter->log.refname;
+
+               break;
+       }
+
+       if (iter->err > 0) {
+               if (ref_iterator_abort(ref_iterator) != ITER_DONE)
+                       return ITER_ERROR;
+               return ITER_DONE;
+       }
+
+       if (iter->err < 0) {
+               ref_iterator_abort(ref_iterator);
+               return ITER_ERROR;
+       }
+
+       return ITER_OK;
+}
+
+static int reftable_reflog_iterator_peel(struct ref_iterator *ref_iterator,
+                                                struct object_id *peeled)
+{
+       BUG("reftable reflog iterator cannot be peeled");
+       return -1;
+}
+
+static int reftable_reflog_iterator_abort(struct ref_iterator *ref_iterator)
+{
+       struct reftable_reflog_iterator *iter =
+               (struct reftable_reflog_iterator *)ref_iterator;
+       reftable_log_record_release(&iter->log);
+       reftable_iterator_destroy(&iter->iter);
+       strbuf_release(&iter->last_name);
+       free(iter);
+       return ITER_DONE;
+}
+
+static struct ref_iterator_vtable reftable_reflog_iterator_vtable = {
+       .advance = reftable_reflog_iterator_advance,
+       .peel = reftable_reflog_iterator_peel,
+       .abort = reftable_reflog_iterator_abort
+};
+
+static struct reftable_reflog_iterator *reflog_iterator_for_stack(struct reftable_ref_store *refs,
+                                                                 struct reftable_stack *stack)
+{
+       struct reftable_merged_table *merged_table;
+       struct reftable_reflog_iterator *iter;
+       int ret;
+
+       iter = xcalloc(1, sizeof(*iter));
+       base_ref_iterator_init(&iter->base, &reftable_reflog_iterator_vtable);
+       strbuf_init(&iter->last_name, 0);
+       iter->refs = refs;
+
+       ret = refs->err;
+       if (ret)
+               goto done;
+
+       ret = reftable_stack_reload(stack);
+       if (ret < 0)
+               goto done;
+
+       merged_table = reftable_stack_merged_table(stack);
+
+       ret = reftable_merged_table_seek_log(merged_table, &iter->iter, "");
+       if (ret < 0)
+               goto done;
+
+done:
+       iter->err = ret;
+       return iter;
+}
+
+static struct ref_iterator *reftable_be_reflog_iterator_begin(struct ref_store *ref_store)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_READ, "reflog_iterator_begin");
+       struct reftable_reflog_iterator *main_iter, *worktree_iter;
+
+       main_iter = reflog_iterator_for_stack(refs, refs->main_stack);
+       if (!refs->worktree_stack)
+               return &main_iter->base;
+
+       worktree_iter = reflog_iterator_for_stack(refs, refs->worktree_stack);
+
+       return merge_ref_iterator_begin(&worktree_iter->base, &main_iter->base,
+                                       ref_iterator_select, NULL);
+}
+
+static int yield_log_record(struct reftable_log_record *log,
+                           each_reflog_ent_fn fn,
+                           void *cb_data)
+{
+       struct object_id old_oid, new_oid;
+       const char *full_committer;
+
+       oidread(&old_oid, log->value.update.old_hash);
+       oidread(&new_oid, log->value.update.new_hash);
+
+       /*
+        * When both the old object ID and the new object ID are null
+        * then this is the reflog existence marker. The caller must
+        * not be aware of it.
+        */
+       if (is_null_oid(&old_oid) && is_null_oid(&new_oid))
+               return 0;
+
+       full_committer = fmt_ident(log->value.update.name, log->value.update.email,
+                                  WANT_COMMITTER_IDENT, NULL, IDENT_NO_DATE);
+       return fn(&old_oid, &new_oid, full_committer,
+                 log->value.update.time, log->value.update.tz_offset,
+                 log->value.update.message, cb_data);
+}
+
+static int reftable_be_for_each_reflog_ent_reverse(struct ref_store *ref_store,
+                                                  const char *refname,
+                                                  each_reflog_ent_fn fn,
+                                                  void *cb_data)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_READ, "for_each_reflog_ent_reverse");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct reftable_merged_table *mt = NULL;
+       struct reftable_log_record log = {0};
+       struct reftable_iterator it = {0};
+       int ret;
+
+       if (refs->err < 0)
+               return refs->err;
+
+       mt = reftable_stack_merged_table(stack);
+       ret = reftable_merged_table_seek_log(mt, &it, refname);
+       while (!ret) {
+               ret = reftable_iterator_next_log(&it, &log);
+               if (ret < 0)
+                       break;
+               if (ret > 0 || strcmp(log.refname, refname)) {
+                       ret = 0;
+                       break;
+               }
+
+               ret = yield_log_record(&log, fn, cb_data);
+               if (ret)
+                       break;
+       }
+
+       reftable_log_record_release(&log);
+       reftable_iterator_destroy(&it);
+       return ret;
+}
+
+static int reftable_be_for_each_reflog_ent(struct ref_store *ref_store,
+                                          const char *refname,
+                                          each_reflog_ent_fn fn,
+                                          void *cb_data)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_READ, "for_each_reflog_ent");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct reftable_merged_table *mt = NULL;
+       struct reftable_log_record *logs = NULL;
+       struct reftable_iterator it = {0};
+       size_t logs_alloc = 0, logs_nr = 0, i;
+       int ret;
+
+       if (refs->err < 0)
+               return refs->err;
+
+       mt = reftable_stack_merged_table(stack);
+       ret = reftable_merged_table_seek_log(mt, &it, refname);
+       while (!ret) {
+               struct reftable_log_record log = {0};
+
+               ret = reftable_iterator_next_log(&it, &log);
+               if (ret < 0)
+                       goto done;
+               if (ret > 0 || strcmp(log.refname, refname)) {
+                       reftable_log_record_release(&log);
+                       ret = 0;
+                       break;
+               }
+
+               ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+               logs[logs_nr++] = log;
+       }
+
+       for (i = logs_nr; i--;) {
+               ret = yield_log_record(&logs[i], fn, cb_data);
+               if (ret)
+                       goto done;
+       }
+
+done:
+       reftable_iterator_destroy(&it);
+       for (i = 0; i < logs_nr; i++)
+               reftable_log_record_release(&logs[i]);
+       free(logs);
+       return ret;
+}
+
+static int reftable_be_reflog_exists(struct ref_store *ref_store,
+                                    const char *refname)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_READ, "reflog_exists");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct reftable_merged_table *mt = reftable_stack_merged_table(stack);
+       struct reftable_log_record log = {0};
+       struct reftable_iterator it = {0};
+       int ret;
+
+       ret = refs->err;
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_stack_reload(stack);
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_merged_table_seek_log(mt, &it, refname);
+       if (ret < 0)
+               goto done;
+
+       /*
+        * Check whether we get at least one log record for the given ref name.
+        * If so, the reflog exists, otherwise it doesn't.
+        */
+       ret = reftable_iterator_next_log(&it, &log);
+       if (ret < 0)
+               goto done;
+       if (ret > 0) {
+               ret = 0;
+               goto done;
+       }
+
+       ret = strcmp(log.refname, refname) == 0;
+
+done:
+       reftable_iterator_destroy(&it);
+       reftable_log_record_release(&log);
+       if (ret < 0)
+               ret = 0;
+       return ret;
+}
+
+struct write_reflog_existence_arg {
+       struct reftable_ref_store *refs;
+       const char *refname;
+       struct reftable_stack *stack;
+};
+
+static int write_reflog_existence_table(struct reftable_writer *writer,
+                                       void *cb_data)
+{
+       struct write_reflog_existence_arg *arg = cb_data;
+       uint64_t ts = reftable_stack_next_update_index(arg->stack);
+       struct reftable_log_record log = {0};
+       int ret;
+
+       ret = reftable_stack_read_log(arg->stack, arg->refname, &log);
+       if (ret <= 0)
+               goto done;
+
+       reftable_writer_set_limits(writer, ts, ts);
+
+       /*
+        * The existence entry has both old and new object ID set to the the
+        * null object ID. Our iterators are aware of this and will not present
+        * them to their callers.
+        */
+       log.refname = xstrdup(arg->refname);
+       log.update_index = ts;
+       log.value_type = REFTABLE_LOG_UPDATE;
+       ret = reftable_writer_add_log(writer, &log);
+
+done:
+       assert(ret != REFTABLE_API_ERROR);
+       reftable_log_record_release(&log);
+       return ret;
+}
+
+static int reftable_be_create_reflog(struct ref_store *ref_store,
+                                    const char *refname,
+                                    struct strbuf *errmsg)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE, "create_reflog");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct write_reflog_existence_arg arg = {
+               .refs = refs,
+               .stack = stack,
+               .refname = refname,
+       };
+       int ret;
+
+       ret = refs->err;
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               goto done;
+
+       ret = reftable_stack_add(stack, &write_reflog_existence_table, &arg);
+
+done:
+       return ret;
+}
+
+struct write_reflog_delete_arg {
+       struct reftable_stack *stack;
+       const char *refname;
+};
+
+static int write_reflog_delete_table(struct reftable_writer *writer, void *cb_data)
+{
+       struct write_reflog_delete_arg *arg = cb_data;
+       struct reftable_merged_table *mt =
+               reftable_stack_merged_table(arg->stack);
+       struct reftable_log_record log = {0}, tombstone = {0};
+       struct reftable_iterator it = {0};
+       uint64_t ts = reftable_stack_next_update_index(arg->stack);
+       int ret;
+
+       reftable_writer_set_limits(writer, ts, ts);
+
+       /*
+        * In order to delete a table we need to delete all reflog entries one
+        * by one. This is inefficient, but the reftable format does not have a
+        * better marker right now.
+        */
+       ret = reftable_merged_table_seek_log(mt, &it, arg->refname);
+       while (ret == 0) {
+               ret = reftable_iterator_next_log(&it, &log);
+               if (ret < 0)
+                       break;
+               if (ret > 0 || strcmp(log.refname, arg->refname)) {
+                       ret = 0;
+                       break;
+               }
+
+               tombstone.refname = (char *)arg->refname;
+               tombstone.value_type = REFTABLE_LOG_DELETION;
+               tombstone.update_index = log.update_index;
+
+               ret = reftable_writer_add_log(writer, &tombstone);
+       }
+
+       reftable_log_record_release(&log);
+       reftable_iterator_destroy(&it);
+       return ret;
+}
+
+static int reftable_be_delete_reflog(struct ref_store *ref_store,
+                                    const char *refname)
+{
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE, "delete_reflog");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct write_reflog_delete_arg arg = {
+               .stack = stack,
+               .refname = refname,
+       };
+       int ret;
+
+       ret = reftable_stack_reload(stack);
+       if (ret)
+               return ret;
+       ret = reftable_stack_add(stack, &write_reflog_delete_table, &arg);
+
+       assert(ret != REFTABLE_API_ERROR);
+       return ret;
+}
+
+struct reflog_expiry_arg {
+       struct reftable_stack *stack;
+       struct reftable_log_record *records;
+       struct object_id update_oid;
+       const char *refname;
+       size_t len;
+};
+
+static int write_reflog_expiry_table(struct reftable_writer *writer, void *cb_data)
+{
+       struct reflog_expiry_arg *arg = cb_data;
+       uint64_t ts = reftable_stack_next_update_index(arg->stack);
+       uint64_t live_records = 0;
+       size_t i;
+       int ret;
+
+       for (i = 0; i < arg->len; i++)
+               if (arg->records[i].value_type == REFTABLE_LOG_UPDATE)
+                       live_records++;
+
+       reftable_writer_set_limits(writer, ts, ts);
+
+       if (!is_null_oid(&arg->update_oid)) {
+               struct reftable_ref_record ref = {0};
+               struct object_id peeled;
+
+               ref.refname = (char *)arg->refname;
+               ref.update_index = ts;
+
+               if (!peel_object(&arg->update_oid, &peeled)) {
+                       ref.value_type = REFTABLE_REF_VAL2;
+                       memcpy(ref.value.val2.target_value, peeled.hash, GIT_MAX_RAWSZ);
+                       memcpy(ref.value.val2.value, arg->update_oid.hash, GIT_MAX_RAWSZ);
+               } else {
+                       ref.value_type = REFTABLE_REF_VAL1;
+                       memcpy(ref.value.val1, arg->update_oid.hash, GIT_MAX_RAWSZ);
+               }
+
+               ret = reftable_writer_add_ref(writer, &ref);
+               if (ret < 0)
+                       return ret;
+       }
+
+       /*
+        * When there are no more entries left in the reflog we empty it
+        * completely, but write a placeholder reflog entry that indicates that
+        * the reflog still exists.
+        */
+       if (!live_records) {
+               struct reftable_log_record log = {
+                       .refname = (char *)arg->refname,
+                       .value_type = REFTABLE_LOG_UPDATE,
+                       .update_index = ts,
+               };
+
+               ret = reftable_writer_add_log(writer, &log);
+               if (ret)
+                       return ret;
+       }
+
+       for (i = 0; i < arg->len; i++) {
+               ret = reftable_writer_add_log(writer, &arg->records[i]);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
+static int reftable_be_reflog_expire(struct ref_store *ref_store,
+                                    const char *refname,
+                                    unsigned int flags,
+                                    reflog_expiry_prepare_fn prepare_fn,
+                                    reflog_expiry_should_prune_fn should_prune_fn,
+                                    reflog_expiry_cleanup_fn cleanup_fn,
+                                    void *policy_cb_data)
+{
+       /*
+        * For log expiry, we write tombstones for every single reflog entry
+        * that is to be expired. This means that the entries are still
+        * retrievable by delving into the stack, and expiring entries
+        * paradoxically takes extra memory. This memory is only reclaimed when
+        * compacting the reftable stack.
+        *
+        * It would be better if the refs backend supported an API that sets a
+        * criterion for all refs, passing the criterion to pack_refs().
+        *
+        * On the plus side, because we do the expiration per ref, we can easily
+        * insert the reflog existence dummies.
+        */
+       struct reftable_ref_store *refs =
+               reftable_be_downcast(ref_store, REF_STORE_WRITE, "reflog_expire");
+       struct reftable_stack *stack = stack_for(refs, refname, &refname);
+       struct reftable_merged_table *mt = reftable_stack_merged_table(stack);
+       struct reftable_log_record *logs = NULL;
+       struct reftable_log_record *rewritten = NULL;
+       struct reftable_ref_record ref_record = {0};
+       struct reftable_iterator it = {0};
+       struct reftable_addition *add = NULL;
+       struct reflog_expiry_arg arg = {0};
+       struct object_id oid = {0};
+       uint8_t *last_hash = NULL;
+       size_t logs_nr = 0, logs_alloc = 0, i;
+       int ret;
+
+       if (refs->err < 0)
+               return refs->err;
+
+       ret = reftable_stack_reload(stack);
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_merged_table_seek_log(mt, &it, refname);
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_stack_new_addition(&add, stack);
+       if (ret < 0)
+               goto done;
+
+       ret = reftable_stack_read_ref(stack, refname, &ref_record);
+       if (ret < 0)
+               goto done;
+       if (reftable_ref_record_val1(&ref_record))
+               oidread(&oid, reftable_ref_record_val1(&ref_record));
+       prepare_fn(refname, &oid, policy_cb_data);
+
+       while (1) {
+               struct reftable_log_record log = {0};
+               struct object_id old_oid, new_oid;
+
+               ret = reftable_iterator_next_log(&it, &log);
+               if (ret < 0)
+                       goto done;
+               if (ret > 0 || strcmp(log.refname, refname)) {
+                       reftable_log_record_release(&log);
+                       break;
+               }
+
+               oidread(&old_oid, log.value.update.old_hash);
+               oidread(&new_oid, log.value.update.new_hash);
+
+               /*
+                * Skip over the reflog existence marker. We will add it back
+                * in when there are no live reflog records.
+                */
+               if (is_null_oid(&old_oid) && is_null_oid(&new_oid)) {
+                       reftable_log_record_release(&log);
+                       continue;
+               }
+
+               ALLOC_GROW(logs, logs_nr + 1, logs_alloc);
+               logs[logs_nr++] = log;
+       }
+
+       /*
+        * We need to rewrite all reflog entries according to the pruning
+        * callback function:
+        *
+        *   - If a reflog entry shall be pruned we mark the record for
+        *     deletion.
+        *
+        *   - Otherwise we may have to rewrite the chain of reflog entries so
+        *     that gaps created by just-deleted records get backfilled.
+        */
+       CALLOC_ARRAY(rewritten, logs_nr);
+       for (i = logs_nr; i--;) {
+               struct reftable_log_record *dest = &rewritten[i];
+               struct object_id old_oid, new_oid;
+
+               *dest = logs[i];
+               oidread(&old_oid, logs[i].value.update.old_hash);
+               oidread(&new_oid, logs[i].value.update.new_hash);
+
+               if (should_prune_fn(&old_oid, &new_oid, logs[i].value.update.email,
+                                   (timestamp_t)logs[i].value.update.time,
+                                   logs[i].value.update.tz_offset,
+                                   logs[i].value.update.message,
+                                   policy_cb_data)) {
+                       dest->value_type = REFTABLE_LOG_DELETION;
+               } else {
+                       if ((flags & EXPIRE_REFLOGS_REWRITE) && last_hash)
+                               memcpy(dest->value.update.old_hash, last_hash, GIT_MAX_RAWSZ);
+                       last_hash = logs[i].value.update.new_hash;
+               }
+       }
+
+       if (flags & EXPIRE_REFLOGS_UPDATE_REF && last_hash &&
+           reftable_ref_record_val1(&ref_record))
+               oidread(&arg.update_oid, last_hash);
+
+       arg.records = rewritten;
+       arg.len = logs_nr;
+       arg.stack = stack,
+       arg.refname = refname,
+
+       ret = reftable_addition_add(add, &write_reflog_expiry_table, &arg);
+       if (ret < 0)
+               goto done;
+
+       /*
+        * Future improvement: we could skip writing records that were
+        * not changed.
+        */
+       if (!(flags & EXPIRE_REFLOGS_DRY_RUN))
+               ret = reftable_addition_commit(add);
+
+done:
+       if (add)
+               cleanup_fn(policy_cb_data);
+       assert(ret != REFTABLE_API_ERROR);
+
+       reftable_ref_record_release(&ref_record);
+       reftable_iterator_destroy(&it);
+       reftable_addition_destroy(add);
+       for (i = 0; i < logs_nr; i++)
+               reftable_log_record_release(&logs[i]);
+       free(logs);
+       free(rewritten);
+       return ret;
+}
+
+struct ref_storage_be refs_be_reftable = {
+       .name = "reftable",
+       .init = reftable_be_init,
+       .init_db = reftable_be_init_db,
+       .transaction_prepare = reftable_be_transaction_prepare,
+       .transaction_finish = reftable_be_transaction_finish,
+       .transaction_abort = reftable_be_transaction_abort,
+       .initial_transaction_commit = reftable_be_initial_transaction_commit,
+
+       .pack_refs = reftable_be_pack_refs,
+       .create_symref = reftable_be_create_symref,
+       .rename_ref = reftable_be_rename_ref,
+       .copy_ref = reftable_be_copy_ref,
+
+       .iterator_begin = reftable_be_iterator_begin,
+       .read_raw_ref = reftable_be_read_raw_ref,
+       .read_symbolic_ref = reftable_be_read_symbolic_ref,
+
+       .reflog_iterator_begin = reftable_be_reflog_iterator_begin,
+       .for_each_reflog_ent = reftable_be_for_each_reflog_ent,
+       .for_each_reflog_ent_reverse = reftable_be_for_each_reflog_ent_reverse,
+       .reflog_exists = reftable_be_reflog_exists,
+       .create_reflog = reftable_be_create_reflog,
+       .delete_reflog = reftable_be_delete_reflog,
+       .reflog_expire = reftable_be_reflog_expire,
+};
index f761e48028c4490e40728fd2879a7520297a0e41..0785aff941bdc2d84181651a48f35cfaaefaede9 100644 (file)
@@ -64,12 +64,11 @@ void free_names(char **a)
        reftable_free(a);
 }
 
-int names_length(char **names)
+size_t names_length(char **names)
 {
        char **p = names;
-       for (; *p; p++) {
-               /* empty */
-       }
+       while (*p)
+               p++;
        return p - names;
 }
 
@@ -89,17 +88,13 @@ void parse_names(char *buf, int size, char ***namesp)
                        next = end;
                }
                if (p < next) {
-                       if (names_len == names_cap) {
-                               names_cap = 2 * names_cap + 1;
-                               names = reftable_realloc(
-                                       names, names_cap * sizeof(*names));
-                       }
+                       REFTABLE_ALLOC_GROW(names, names_len + 1, names_cap);
                        names[names_len++] = xstrdup(p);
                }
                p = next + 1;
        }
 
-       names = reftable_realloc(names, (names_len + 1) * sizeof(*names));
+       REFTABLE_REALLOC_ARRAY(names, names_len + 1);
        names[names_len] = NULL;
        *namesp = names;
 }
index 096b36862b9f4ebf14be7c3074d6f86d5e92c22c..91f3533efee501faf3e461f7206dbc7a964da98e 100644 (file)
@@ -44,14 +44,27 @@ void parse_names(char *buf, int size, char ***namesp);
 int names_equal(char **a, char **b);
 
 /* returns the array size of a NULL-terminated array of strings. */
-int names_length(char **names);
+size_t names_length(char **names);
 
 /* Allocation routines; they invoke the functions set through
  * reftable_set_alloc() */
 void *reftable_malloc(size_t sz);
 void *reftable_realloc(void *p, size_t sz);
 void reftable_free(void *p);
-void *reftable_calloc(size_t sz);
+void *reftable_calloc(size_t nelem, size_t elsize);
+
+#define REFTABLE_ALLOC_ARRAY(x, alloc) (x) = reftable_malloc(st_mult(sizeof(*(x)), (alloc)))
+#define REFTABLE_CALLOC_ARRAY(x, alloc) (x) = reftable_calloc((alloc), sizeof(*(x)))
+#define REFTABLE_REALLOC_ARRAY(x, alloc) (x) = reftable_realloc((x), st_mult(sizeof(*(x)), (alloc)))
+#define REFTABLE_ALLOC_GROW(x, nr, alloc) \
+       do { \
+               if ((nr) > alloc) { \
+                       alloc = 2 * (alloc) + 1; \
+                       if (alloc < (nr)) \
+                               alloc = (nr); \
+                       REFTABLE_REALLOC_ARRAY(x, alloc); \
+               } \
+       } while (0)
 
 /* Find the longest shared prefix size of `a` and `b` */
 struct strbuf;
index 34d4d073692f9e913d84715d987c8e1c35a7fe8a..e2a2cee58d2a35c6183e7083d3320d2520a397f4 100644 (file)
@@ -51,12 +51,7 @@ static int block_writer_register_restart(struct block_writer *w, int n,
        if (2 + 3 * rlen + n > w->block_size - w->next)
                return -1;
        if (is_restart) {
-               if (w->restart_len == w->restart_cap) {
-                       w->restart_cap = w->restart_cap * 2 + 1;
-                       w->restarts = reftable_realloc(
-                               w->restarts, sizeof(uint32_t) * w->restart_cap);
-               }
-
+               REFTABLE_ALLOC_GROW(w->restarts, w->restart_len + 1, w->restart_cap);
                w->restarts[w->restart_len++] = w->next;
        }
 
@@ -148,8 +143,10 @@ int block_writer_finish(struct block_writer *w)
                int block_header_skip = 4 + w->header_off;
                uLongf src_len = w->next - block_header_skip;
                uLongf dest_cap = src_len * 1.001 + 12;
+               uint8_t *compressed;
+
+               REFTABLE_ALLOC_ARRAY(compressed, dest_cap);
 
-               uint8_t *compressed = reftable_malloc(dest_cap);
                while (1) {
                        uLongf out_dest_len = dest_cap;
                        int zresult = compress2(compressed, &out_dest_len,
@@ -206,9 +203,9 @@ int block_reader_init(struct block_reader *br, struct reftable_block *block,
                uLongf dst_len = sz - block_header_skip; /* total size of dest
                                                            buffer. */
                uLongf src_len = block->len - block_header_skip;
-               /* Log blocks specify the *uncompressed* size in their header.
-                */
-               uncompressed = reftable_malloc(sz);
+
+               /* Log blocks specify the *uncompressed* size in their header. */
+               REFTABLE_ALLOC_ARRAY(uncompressed, sz);
 
                /* Copy over the block header verbatim. It's not compressed. */
                memcpy(uncompressed, block->data, block_header_skip);
@@ -294,9 +291,8 @@ static int restart_key_less(size_t idx, void *args)
        /* the restart key is verbatim in the block, so this could avoid the
           alloc for decoding the key */
        struct strbuf rkey = STRBUF_INIT;
-       struct strbuf last_key = STRBUF_INIT;
        uint8_t unused_extra;
-       int n = reftable_decode_key(&rkey, &unused_extra, last_key, in);
+       int n = reftable_decode_key(&rkey, &unused_extra, in);
        int result;
        if (n < 0) {
                a->error = 1;
@@ -305,7 +301,7 @@ static int restart_key_less(size_t idx, void *args)
 
        result = strbuf_cmp(&a->key, &rkey);
        strbuf_release(&rkey);
-       return result;
+       return result < 0;
 }
 
 void block_iter_copy_from(struct block_iter *dest, struct block_iter *src)
@@ -323,44 +319,41 @@ int block_iter_next(struct block_iter *it, struct reftable_record *rec)
                .len = it->br->block_len - it->next_off,
        };
        struct string_view start = in;
-       struct strbuf key = STRBUF_INIT;
        uint8_t extra = 0;
        int n = 0;
 
        if (it->next_off >= it->br->block_len)
                return 1;
 
-       n = reftable_decode_key(&key, &extra, it->last_key, in);
+       n = reftable_decode_key(&it->last_key, &extra, in);
        if (n < 0)
                return -1;
-
-       if (!key.len)
+       if (!it->last_key.len)
                return REFTABLE_FORMAT_ERROR;
 
        string_view_consume(&in, n);
-       n = reftable_record_decode(rec, key, extra, in, it->br->hash_size);
+       n = reftable_record_decode(rec, it->last_key, extra, in, it->br->hash_size,
+                                  &it->scratch);
        if (n < 0)
                return -1;
        string_view_consume(&in, n);
 
-       strbuf_reset(&it->last_key);
-       strbuf_addbuf(&it->last_key, &key);
        it->next_off += start.len - in.len;
-       strbuf_release(&key);
        return 0;
 }
 
 int block_reader_first_key(struct block_reader *br, struct strbuf *key)
 {
-       struct strbuf empty = STRBUF_INIT;
-       int off = br->header_off + 4;
+       int off = br->header_off + 4, n;
        struct string_view in = {
                .buf = br->block.data + off,
                .len = br->block_len - off,
        };
-
        uint8_t extra = 0;
-       int n = reftable_decode_key(key, &extra, empty, in);
+
+       strbuf_reset(key);
+
+       n = reftable_decode_key(key, &extra, in);
        if (n < 0)
                return n;
        if (!key->len)
@@ -377,6 +370,7 @@ int block_iter_seek(struct block_iter *it, struct strbuf *want)
 void block_iter_close(struct block_iter *it)
 {
        strbuf_release(&it->last_key);
+       strbuf_release(&it->scratch);
 }
 
 int block_reader_seek(struct block_reader *br, struct block_iter *it,
@@ -386,26 +380,23 @@ int block_reader_seek(struct block_reader *br, struct block_iter *it,
                .key = *want,
                .r = br,
        };
-       struct reftable_record rec = reftable_new_record(block_reader_type(br));
-       struct strbuf key = STRBUF_INIT;
-       int err = 0;
-       struct block_iter next = {
-               .last_key = STRBUF_INIT,
-       };
+       struct block_iter next = BLOCK_ITER_INIT;
+       struct reftable_record rec;
+       int err = 0, i;
 
-       int i = binsearch(br->restart_count, &restart_key_less, &args);
        if (args.error) {
                err = REFTABLE_FORMAT_ERROR;
                goto done;
        }
 
-       it->br = br;
-       if (i > 0) {
-               i--;
-               it->next_off = block_reader_restart_offset(br, i);
-       } else {
+       i = binsearch(br->restart_count, &restart_key_less, &args);
+       if (i > 0)
+               it->next_off = block_reader_restart_offset(br, i - 1);
+       else
                it->next_off = br->header_off + 4;
-       }
+       it->br = br;
+
+       reftable_record_init(&rec, block_reader_type(br));
 
        /* We're looking for the last entry less/equal than the wanted key, so
           we have to go one entry too far and then back up.
@@ -416,8 +407,8 @@ int block_reader_seek(struct block_reader *br, struct block_iter *it,
                if (err < 0)
                        goto done;
 
-               reftable_record_key(&rec, &key);
-               if (err > 0 || strbuf_cmp(&key, want) >= 0) {
+               reftable_record_key(&rec, &it->last_key);
+               if (err > 0 || strbuf_cmp(&it->last_key, want) >= 0) {
                        err = 0;
                        goto done;
                }
@@ -426,8 +417,7 @@ int block_reader_seek(struct block_reader *br, struct block_iter *it,
        }
 
 done:
-       strbuf_release(&key);
-       strbuf_release(&next.last_key);
+       block_iter_close(&next);
        reftable_record_release(&rec);
 
        return err;
index 87c77539b5bd6ab0b9909c51801719258507b424..47acc62c0ab8cdd6816d49152312b1e61dfe3d6d 100644 (file)
@@ -84,8 +84,14 @@ struct block_iter {
 
        /* key for last entry we read. */
        struct strbuf last_key;
+       struct strbuf scratch;
 };
 
+#define BLOCK_ITER_INIT { \
+       .last_key = STRBUF_INIT, \
+       .scratch = STRBUF_INIT, \
+}
+
 /* initializes a block reader. */
 int block_reader_init(struct block_reader *br, struct reftable_block *bl,
                      uint32_t header_off, uint32_t table_block_size,
index cb88af4a5639258945f569ede758e31809b62ead..e162c6e33fa00af4e2b3b653c0d6210aea57c803 100644 (file)
@@ -32,11 +32,11 @@ static void test_block_read_write(void)
        int i = 0;
        int n;
        struct block_reader br = { 0 };
-       struct block_iter it = { .last_key = STRBUF_INIT };
+       struct block_iter it = BLOCK_ITER_INIT;
        int j = 0;
        struct strbuf want = STRBUF_INIT;
 
-       block.data = reftable_calloc(block_size);
+       REFTABLE_CALLOC_ARRAY(block.data, block_size);
        block.len = block_size;
        block.source = malloc_block_source();
        block_writer_init(&bw, BLOCK_TYPE_REF, block.data, block_size,
@@ -49,13 +49,11 @@ static void test_block_read_write(void)
 
        for (i = 0; i < N; i++) {
                char name[100];
-               uint8_t hash[GIT_SHA1_RAWSZ];
                snprintf(name, sizeof(name), "branch%02d", i);
-               memset(hash, i, sizeof(hash));
 
                rec.u.ref.refname = name;
                rec.u.ref.value_type = REFTABLE_REF_VAL1;
-               rec.u.ref.value.val1 = hash;
+               memset(rec.u.ref.value.val1, i, GIT_SHA1_RAWSZ);
 
                names[i] = xstrdup(name);
                n = block_writer_add(&bw, &rec);
@@ -87,7 +85,7 @@ static void test_block_read_write(void)
        block_iter_close(&it);
 
        for (i = 0; i < N; i++) {
-               struct block_iter it = { .last_key = STRBUF_INIT };
+               struct block_iter it = BLOCK_ITER_INIT;
                strbuf_reset(&want);
                strbuf_addstr(&want, names[i]);
 
index 8331b34e82300630b68c574e4f68071f3ebf261a..eeed254ba9c2da51177eb7ed81fbf16d17ba183b 100644 (file)
@@ -29,7 +29,7 @@ static int strbuf_read_block(void *v, struct reftable_block *dest, uint64_t off,
 {
        struct strbuf *b = v;
        assert(off + size <= b->len);
-       dest->data = reftable_calloc(size);
+       REFTABLE_CALLOC_ARRAY(dest->data, size);
        memcpy(dest->data, b->buf + off, size);
        dest->len = size;
        return size;
@@ -76,8 +76,8 @@ struct reftable_block_source malloc_block_source(void)
 }
 
 struct file_block_source {
-       int fd;
        uint64_t size;
+       unsigned char *data;
 };
 
 static uint64_t file_size(void *b)
@@ -87,19 +87,12 @@ static uint64_t file_size(void *b)
 
 static void file_return_block(void *b, struct reftable_block *dest)
 {
-       if (dest->len)
-               memset(dest->data, 0xff, dest->len);
-       reftable_free(dest->data);
 }
 
-static void file_close(void *b)
+static void file_close(void *v)
 {
-       int fd = ((struct file_block_source *)b)->fd;
-       if (fd > 0) {
-               close(fd);
-               ((struct file_block_source *)b)->fd = 0;
-       }
-
+       struct file_block_source *b = v;
+       munmap(b->data, b->size);
        reftable_free(b);
 }
 
@@ -108,9 +101,7 @@ static int file_read_block(void *v, struct reftable_block *dest, uint64_t off,
 {
        struct file_block_source *b = v;
        assert(off + size <= b->size);
-       dest->data = reftable_malloc(size);
-       if (pread(b->fd, dest->data, size, off) != size)
-               return -1;
+       dest->data = b->data + off;
        dest->len = size;
        return size;
 }
@@ -125,26 +116,26 @@ static struct reftable_block_source_vtable file_vtable = {
 int reftable_block_source_from_file(struct reftable_block_source *bs,
                                    const char *name)
 {
-       struct stat st = { 0 };
-       int err = 0;
-       int fd = open(name, O_RDONLY);
-       struct file_block_source *p = NULL;
+       struct file_block_source *p;
+       struct stat st;
+       int fd;
+
+       fd = open(name, O_RDONLY);
        if (fd < 0) {
-               if (errno == ENOENT) {
+               if (errno == ENOENT)
                        return REFTABLE_NOT_EXIST_ERROR;
-               }
                return -1;
        }
 
-       err = fstat(fd, &st);
-       if (err < 0) {
+       if (fstat(fd, &st) < 0) {
                close(fd);
                return REFTABLE_IO_ERROR;
        }
 
-       p = reftable_calloc(sizeof(struct file_block_source));
+       REFTABLE_CALLOC_ARRAY(p, 1);
        p->size = st.st_size;
-       p->fd = fd;
+       p->data = xmmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+       close(fd);
 
        assert(!bs->ops);
        bs->ops = &file_vtable;
index ce936b4e1887ca982c9d814a014b469cbb49e52e..26e0393c7db7a4b6677bb3c5a73ce08559956dd7 100644 (file)
@@ -11,14 +11,12 @@ https://developers.google.com/open-source/licenses/bsd
 
 #include "reftable-blocksource.h"
 #include "reftable-error.h"
-#include "reftable-merged.h"
 #include "reftable-record.h"
 #include "reftable-tests.h"
 #include "reftable-writer.h"
 #include "reftable-iterator.h"
 #include "reftable-reader.h"
 #include "reftable-stack.h"
-#include "reftable-generic.h"
 
 #include <stddef.h>
 #include <stdio.h>
index 57f8032db941ca77f5c61d0e6d38268c56958be9..b9f1c7c18a2efc48e91c2526a42bb9433783f8dd 100644 (file)
@@ -6,7 +6,6 @@ license that can be found in the LICENSE file or at
 https://developers.google.com/open-source/licenses/bsd
 */
 
-#include "basics.h"
 #include "constants.h"
 #include "record.h"
 #include "generic.h"
index a8d174c040658edda3d2c45a9df2f692aef41c9d..7aa30c4a51e54ec5442b9d8a3bf90b8119c5a4f0 100644 (file)
@@ -16,11 +16,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "reader.h"
 #include "reftable-error.h"
 
-int iterator_is_null(struct reftable_iterator *it)
-{
-       return !it->ops;
-}
-
 static void filtering_ref_iterator_close(void *iter_arg)
 {
        struct filtering_ref_iterator *fri = iter_arg;
@@ -160,8 +155,7 @@ int new_indexed_table_ref_iter(struct indexed_table_ref_iter **dest,
                               int oid_len, uint64_t *offsets, int offset_len)
 {
        struct indexed_table_ref_iter empty = INDEXED_TABLE_REF_ITER_INIT;
-       struct indexed_table_ref_iter *itr =
-               reftable_calloc(sizeof(struct indexed_table_ref_iter));
+       struct indexed_table_ref_iter *itr = reftable_calloc(1, sizeof(*itr));
        int err = 0;
 
        *itr = empty;
index 09eb0cbfa5997e0eca4f378a8d45025c4af8732d..537431baba075ad72614b1c68eff1fd28fa51288 100644 (file)
@@ -16,10 +16,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "reftable-iterator.h"
 #include "reftable-generic.h"
 
-/* Returns true for a zeroed out iterator, such as the one returned from
- * iterator_destroy. */
-int iterator_is_null(struct reftable_iterator *it);
-
 /* iterator that produces only ref records that point to `oid` */
 struct filtering_ref_iterator {
        int double_check;
@@ -53,10 +49,10 @@ struct indexed_table_ref_iter {
        int is_finished;
 };
 
-#define INDEXED_TABLE_REF_ITER_INIT                                     \
-       {                                                               \
-               .cur = { .last_key = STRBUF_INIT }, .oid = STRBUF_INIT, \
-       }
+#define INDEXED_TABLE_REF_ITER_INIT { \
+       .cur = BLOCK_ITER_INIT, \
+       .oid = STRBUF_INIT, \
+}
 
 void iterator_from_indexed_table_ref_iter(struct reftable_iterator *it,
                                          struct indexed_table_ref_iter *itr);
index 5ded470c086c92760083dc16c08e7bdff821e9bf..f85a24c6786c6fb8e102ffc9ceb35f23706c8c9b 100644 (file)
@@ -11,33 +11,45 @@ https://developers.google.com/open-source/licenses/bsd
 #include "constants.h"
 #include "iter.h"
 #include "pq.h"
-#include "reader.h"
 #include "record.h"
 #include "generic.h"
 #include "reftable-merged.h"
 #include "reftable-error.h"
 #include "system.h"
 
+struct merged_subiter {
+       struct reftable_iterator iter;
+       struct reftable_record rec;
+};
+
+struct merged_iter {
+       struct merged_subiter *subiters;
+       struct merged_iter_pqueue pq;
+       uint32_t hash_id;
+       size_t stack_len;
+       uint8_t typ;
+       int suppress_deletions;
+       ssize_t advance_index;
+};
+
 static int merged_iter_init(struct merged_iter *mi)
 {
-       int i = 0;
-       for (i = 0; i < mi->stack_len; i++) {
-               struct reftable_record rec = reftable_new_record(mi->typ);
-               int err = iterator_next(&mi->stack[i], &rec);
-               if (err < 0) {
+       for (size_t i = 0; i < mi->stack_len; i++) {
+               struct pq_entry e = {
+                       .index = i,
+                       .rec = &mi->subiters[i].rec,
+               };
+               int err;
+
+               reftable_record_init(&mi->subiters[i].rec, mi->typ);
+               err = iterator_next(&mi->subiters[i].iter,
+                                   &mi->subiters[i].rec);
+               if (err < 0)
                        return err;
-               }
+               if (err > 0)
+                       continue;
 
-               if (err > 0) {
-                       reftable_iterator_destroy(&mi->stack[i]);
-                       reftable_record_release(&rec);
-               } else {
-                       struct pq_entry e = {
-                               .rec = rec,
-                               .index = i,
-                       };
-                       merged_iter_pqueue_add(&mi->pq, &e);
-               }
+               merged_iter_pqueue_add(&mi->pq, &e);
        }
 
        return 0;
@@ -46,56 +58,68 @@ static int merged_iter_init(struct merged_iter *mi)
 static void merged_iter_close(void *p)
 {
        struct merged_iter *mi = p;
-       int i = 0;
+
        merged_iter_pqueue_release(&mi->pq);
-       for (i = 0; i < mi->stack_len; i++) {
-               reftable_iterator_destroy(&mi->stack[i]);
+       for (size_t i = 0; i < mi->stack_len; i++) {
+               reftable_iterator_destroy(&mi->subiters[i].iter);
+               reftable_record_release(&mi->subiters[i].rec);
        }
-       reftable_free(mi->stack);
+       reftable_free(mi->subiters);
 }
 
-static int merged_iter_advance_nonnull_subiter(struct merged_iter *mi,
-                                              size_t idx)
+static int merged_iter_advance_subiter(struct merged_iter *mi, size_t idx)
 {
        struct pq_entry e = {
-               .rec = reftable_new_record(mi->typ),
                .index = idx,
+               .rec = &mi->subiters[idx].rec,
        };
-       int err = iterator_next(&mi->stack[idx], &e.rec);
-       if (err < 0)
-               return err;
+       int err;
 
-       if (err > 0) {
-               reftable_iterator_destroy(&mi->stack[idx]);
-               reftable_record_release(&e.rec);
-               return 0;
-       }
+       err = iterator_next(&mi->subiters[idx].iter, &mi->subiters[idx].rec);
+       if (err)
+               return err;
 
        merged_iter_pqueue_add(&mi->pq, &e);
        return 0;
 }
 
-static int merged_iter_advance_subiter(struct merged_iter *mi, size_t idx)
-{
-       if (iterator_is_null(&mi->stack[idx]))
-               return 0;
-       return merged_iter_advance_nonnull_subiter(mi, idx);
-}
-
 static int merged_iter_next_entry(struct merged_iter *mi,
                                  struct reftable_record *rec)
 {
-       struct strbuf entry_key = STRBUF_INIT;
        struct pq_entry entry = { 0 };
-       int err = 0;
+       int err = 0, empty;
+
+       empty = merged_iter_pqueue_is_empty(mi->pq);
+
+       if (mi->advance_index >= 0) {
+               /*
+                * When there are no pqueue entries then we only have a single
+                * subiter left. There is no need to use the pqueue in that
+                * case anymore as we know that the subiter will return entries
+                * in the correct order already.
+                *
+                * While this may sound like a very specific edge case, it may
+                * happen more frequently than you think. Most repositories
+                * will end up having a single large base table that contains
+                * most of the refs. It's thus likely that we exhaust all
+                * subiters but the one from that base ref.
+                */
+               if (empty)
+                       return iterator_next(&mi->subiters[mi->advance_index].iter,
+                                            rec);
+
+               err = merged_iter_advance_subiter(mi, mi->advance_index);
+               if (err < 0)
+                       return err;
+               if (!err)
+                       empty = 0;
+               mi->advance_index = -1;
+       }
 
-       if (merged_iter_pqueue_is_empty(mi->pq))
+       if (empty)
                return 1;
 
        entry = merged_iter_pqueue_remove(&mi->pq);
-       err = merged_iter_advance_subiter(mi, entry.index);
-       if (err < 0)
-               return err;
 
        /*
          One can also use reftable as datacenter-local storage, where the ref
@@ -105,57 +129,38 @@ static int merged_iter_next_entry(struct merged_iter *mi,
          such a deployment, the loop below must be changed to collect all
          entries for the same key, and return new the newest one.
        */
-       reftable_record_key(&entry.rec, &entry_key);
        while (!merged_iter_pqueue_is_empty(mi->pq)) {
                struct pq_entry top = merged_iter_pqueue_top(mi->pq);
-               struct strbuf k = STRBUF_INIT;
-               int err = 0, cmp = 0;
-
-               reftable_record_key(&top.rec, &k);
+               int cmp;
 
-               cmp = strbuf_cmp(&k, &entry_key);
-               strbuf_release(&k);
-
-               if (cmp > 0) {
+               cmp = reftable_record_cmp(top.rec, entry.rec);
+               if (cmp > 0)
                        break;
-               }
 
                merged_iter_pqueue_remove(&mi->pq);
                err = merged_iter_advance_subiter(mi, top.index);
-               if (err < 0) {
+               if (err < 0)
                        return err;
-               }
-               reftable_record_release(&top.rec);
        }
 
-       reftable_record_copy_from(rec, &entry.rec, hash_size(mi->hash_id));
-       reftable_record_release(&entry.rec);
-       strbuf_release(&entry_key);
+       mi->advance_index = entry.index;
+       SWAP(*rec, *entry.rec);
        return 0;
 }
 
-static int merged_iter_next(struct merged_iter *mi, struct reftable_record *rec)
+static int merged_iter_next_void(void *p, struct reftable_record *rec)
 {
+       struct merged_iter *mi = p;
        while (1) {
                int err = merged_iter_next_entry(mi, rec);
-               if (err == 0 && mi->suppress_deletions &&
-                   reftable_record_is_deletion(rec)) {
+               if (err)
+                       return err;
+               if (mi->suppress_deletions && reftable_record_is_deletion(rec))
                        continue;
-               }
-
-               return err;
+               return 0;
        }
 }
 
-static int merged_iter_next_void(void *p, struct reftable_record *rec)
-{
-       struct merged_iter *mi = p;
-       if (merged_iter_pqueue_is_empty(mi->pq))
-               return 1;
-
-       return merged_iter_next(mi, rec);
-}
-
 static struct reftable_iterator_vtable merged_iter_vtable = {
        .next = &merged_iter_next_void,
        .close = &merged_iter_close,
@@ -170,14 +175,14 @@ static void iterator_from_merged_iter(struct reftable_iterator *it,
 }
 
 int reftable_new_merged_table(struct reftable_merged_table **dest,
-                             struct reftable_table *stack, int n,
+                             struct reftable_table *stack, size_t n,
                              uint32_t hash_id)
 {
        struct reftable_merged_table *m = NULL;
        uint64_t last_max = 0;
        uint64_t first_min = 0;
-       int i = 0;
-       for (i = 0; i < n; i++) {
+
+       for (size_t i = 0; i < n; i++) {
                uint64_t min = reftable_table_min_update_index(&stack[i]);
                uint64_t max = reftable_table_max_update_index(&stack[i]);
 
@@ -192,7 +197,7 @@ int reftable_new_merged_table(struct reftable_merged_table **dest,
                }
        }
 
-       m = reftable_calloc(sizeof(struct reftable_merged_table));
+       REFTABLE_CALLOC_ARRAY(m, 1);
        m->stack = stack;
        m->stack_len = n;
        m->min = first_min;
@@ -241,48 +246,37 @@ static int merged_table_seek_record(struct reftable_merged_table *mt,
                                    struct reftable_iterator *it,
                                    struct reftable_record *rec)
 {
-       struct reftable_iterator *iters = reftable_calloc(
-               sizeof(struct reftable_iterator) * mt->stack_len);
        struct merged_iter merged = {
-               .stack = iters,
                .typ = reftable_record_type(rec),
                .hash_id = mt->hash_id,
                .suppress_deletions = mt->suppress_deletions,
+               .advance_index = -1,
        };
-       int n = 0;
-       int err = 0;
-       int i = 0;
-       for (i = 0; i < mt->stack_len && err == 0; i++) {
-               int e = reftable_table_seek_record(&mt->stack[i], &iters[n],
-                                                  rec);
-               if (e < 0) {
-                       err = e;
-               }
-               if (e == 0) {
-                       n++;
-               }
-       }
-       if (err < 0) {
-               int i = 0;
-               for (i = 0; i < n; i++) {
-                       reftable_iterator_destroy(&iters[i]);
-               }
-               reftable_free(iters);
-               return err;
+       struct merged_iter *p;
+       int err;
+
+       REFTABLE_CALLOC_ARRAY(merged.subiters, mt->stack_len);
+       for (size_t i = 0; i < mt->stack_len; i++) {
+               err = reftable_table_seek_record(&mt->stack[i],
+                                                &merged.subiters[merged.stack_len].iter, rec);
+               if (err < 0)
+                       goto out;
+               if (!err)
+                       merged.stack_len++;
        }
 
-       merged.stack_len = n;
        err = merged_iter_init(&merged);
-       if (err < 0) {
+       if (err < 0)
+               goto out;
+
+       p = reftable_malloc(sizeof(struct merged_iter));
+       *p = merged;
+       iterator_from_merged_iter(it, p);
+
+out:
+       if (err < 0)
                merged_iter_close(&merged);
-               return err;
-       } else {
-               struct merged_iter *p =
-                       reftable_malloc(sizeof(struct merged_iter));
-               *p = merged;
-               iterator_from_merged_iter(it, p);
-       }
-       return 0;
+       return err;
 }
 
 int reftable_merged_table_seek_ref(struct reftable_merged_table *mt,
index 7d9f95d27ed0a44c4208e743b6b83ba4cdc5536c..a2571dbc99d68c9954e9d07372bae984cf5ccccc 100644 (file)
@@ -9,7 +9,7 @@ https://developers.google.com/open-source/licenses/bsd
 #ifndef MERGED_H
 #define MERGED_H
 
-#include "pq.h"
+#include "system.h"
 
 struct reftable_merged_table {
        struct reftable_table *stack;
@@ -24,15 +24,6 @@ struct reftable_merged_table {
        uint64_t max;
 };
 
-struct merged_iter {
-       struct reftable_iterator *stack;
-       uint32_t hash_id;
-       size_t stack_len;
-       uint8_t typ;
-       int suppress_deletions;
-       struct merged_iter_pqueue pq;
-};
-
 void merged_table_release(struct reftable_merged_table *mt);
 
 #endif
index d08c16abefbc3d8562c29cf1703d1a6908f71dcd..530fc82d1c2458d57826281d4865bc0aa4127adf 100644 (file)
@@ -12,7 +12,6 @@ https://developers.google.com/open-source/licenses/bsd
 
 #include "basics.h"
 #include "blocksource.h"
-#include "constants.h"
 #include "reader.h"
 #include "record.h"
 #include "test_framework.h"
@@ -43,7 +42,7 @@ static void write_test_table(struct strbuf *buf,
                }
        }
 
-       w = reftable_new_writer(&strbuf_add_void, buf, &opts);
+       w = reftable_new_writer(&strbuf_add_void, &noop_flush, buf, &opts);
        reftable_writer_set_limits(w, min, max);
 
        for (i = 0; i < n; i++) {
@@ -71,7 +70,7 @@ static void write_test_log_table(struct strbuf *buf,
                .exact_log_message = 1,
        };
        struct reftable_writer *w = NULL;
-       w = reftable_new_writer(&strbuf_add_void, buf, &opts);
+       w = reftable_new_writer(&strbuf_add_void, &noop_flush, buf, &opts);
        reftable_writer_set_limits(w, update_index, update_index);
 
        for (i = 0; i < n; i++) {
@@ -89,16 +88,17 @@ static struct reftable_merged_table *
 merged_table_from_records(struct reftable_ref_record **refs,
                          struct reftable_block_source **source,
                          struct reftable_reader ***readers, int *sizes,
-                         struct strbuf *buf, int n)
+                         struct strbuf *buf, size_t n)
 {
-       int i = 0;
        struct reftable_merged_table *mt = NULL;
+       struct reftable_table *tabs;
        int err;
-       struct reftable_table *tabs =
-               reftable_calloc(n * sizeof(struct reftable_table));
-       *readers = reftable_calloc(n * sizeof(struct reftable_reader *));
-       *source = reftable_calloc(n * sizeof(**source));
-       for (i = 0; i < n; i++) {
+
+       REFTABLE_CALLOC_ARRAY(tabs, n);
+       REFTABLE_CALLOC_ARRAY(*readers, n);
+       REFTABLE_CALLOC_ARRAY(*source, n);
+
+       for (size_t i = 0; i < n; i++) {
                write_test_table(&buf[i], refs[i], sizes[i]);
                block_source_from_strbuf(&(*source)[i], &buf[i]);
 
@@ -123,13 +123,11 @@ static void readers_destroy(struct reftable_reader **readers, size_t n)
 
 static void test_merged_between(void)
 {
-       uint8_t hash1[GIT_SHA1_RAWSZ] = { 1, 2, 3, 0 };
-
        struct reftable_ref_record r1[] = { {
                .refname = "b",
                .update_index = 1,
                .value_type = REFTABLE_REF_VAL1,
-               .value.val1 = hash1,
+               .value.val1 = { 1, 2, 3, 0 },
        } };
        struct reftable_ref_record r2[] = { {
                .refname = "a",
@@ -165,26 +163,24 @@ static void test_merged_between(void)
 
 static void test_merged(void)
 {
-       uint8_t hash1[GIT_SHA1_RAWSZ] = { 1 };
-       uint8_t hash2[GIT_SHA1_RAWSZ] = { 2 };
        struct reftable_ref_record r1[] = {
                {
                        .refname = "a",
                        .update_index = 1,
                        .value_type = REFTABLE_REF_VAL1,
-                       .value.val1 = hash1,
+                       .value.val1 = { 1 },
                },
                {
                        .refname = "b",
                        .update_index = 1,
                        .value_type = REFTABLE_REF_VAL1,
-                       .value.val1 = hash1,
+                       .value.val1 = { 1 },
                },
                {
                        .refname = "c",
                        .update_index = 1,
                        .value_type = REFTABLE_REF_VAL1,
-                       .value.val1 = hash1,
+                       .value.val1 = { 1 },
                }
        };
        struct reftable_ref_record r2[] = { {
@@ -197,13 +193,13 @@ static void test_merged(void)
                        .refname = "c",
                        .update_index = 3,
                        .value_type = REFTABLE_REF_VAL1,
-                       .value.val1 = hash2,
+                       .value.val1 = { 2 },
                },
                {
                        .refname = "d",
                        .update_index = 3,
                        .value_type = REFTABLE_REF_VAL1,
-                       .value.val1 = hash1,
+                       .value.val1 = { 1 },
                },
        };
 
@@ -236,14 +232,10 @@ static void test_merged(void)
        while (len < 100) { /* cap loops/recursion. */
                struct reftable_ref_record ref = { NULL };
                int err = reftable_iterator_next_ref(&it, &ref);
-               if (err > 0) {
+               if (err > 0)
                        break;
-               }
-               if (len == cap) {
-                       cap = 2 * cap + 1;
-                       out = reftable_realloc(
-                               out, sizeof(struct reftable_ref_record) * cap);
-               }
+
+               REFTABLE_ALLOC_GROW(out, len + 1, cap);
                out[len++] = ref;
        }
        reftable_iterator_destroy(&it);
@@ -270,16 +262,17 @@ static struct reftable_merged_table *
 merged_table_from_log_records(struct reftable_log_record **logs,
                              struct reftable_block_source **source,
                              struct reftable_reader ***readers, int *sizes,
-                             struct strbuf *buf, int n)
+                             struct strbuf *buf, size_t n)
 {
-       int i = 0;
        struct reftable_merged_table *mt = NULL;
+       struct reftable_table *tabs;
        int err;
-       struct reftable_table *tabs =
-               reftable_calloc(n * sizeof(struct reftable_table));
-       *readers = reftable_calloc(n * sizeof(struct reftable_reader *));
-       *source = reftable_calloc(n * sizeof(**source));
-       for (i = 0; i < n; i++) {
+
+       REFTABLE_CALLOC_ARRAY(tabs, n);
+       REFTABLE_CALLOC_ARRAY(*readers, n);
+       REFTABLE_CALLOC_ARRAY(*source, n);
+
+       for (size_t i = 0; i < n; i++) {
                write_test_log_table(&buf[i], logs[i], sizes[i], i + 1);
                block_source_from_strbuf(&(*source)[i], &buf[i]);
 
@@ -296,16 +289,13 @@ merged_table_from_log_records(struct reftable_log_record **logs,
 
 static void test_merged_logs(void)
 {
-       uint8_t hash1[GIT_SHA1_RAWSZ] = { 1 };
-       uint8_t hash2[GIT_SHA1_RAWSZ] = { 2 };
-       uint8_t hash3[GIT_SHA1_RAWSZ] = { 3 };
        struct reftable_log_record r1[] = {
                {
                        .refname = "a",
                        .update_index = 2,
                        .value_type = REFTABLE_LOG_UPDATE,
                        .value.update = {
-                               .old_hash = hash2,
+                               .old_hash = { 2 },
                                /* deletion */
                                .name = "jane doe",
                                .email = "jane@invalid",
@@ -317,8 +307,8 @@ static void test_merged_logs(void)
                        .update_index = 1,
                        .value_type = REFTABLE_LOG_UPDATE,
                        .value.update = {
-                               .old_hash = hash1,
-                               .new_hash = hash2,
+                               .old_hash = { 1 },
+                               .new_hash = { 2 },
                                .name = "jane doe",
                                .email = "jane@invalid",
                                .message = "message1",
@@ -331,7 +321,7 @@ static void test_merged_logs(void)
                        .update_index = 3,
                        .value_type = REFTABLE_LOG_UPDATE,
                        .value.update = {
-                               .new_hash = hash3,
+                               .new_hash = { 3 },
                                .name = "jane doe",
                                .email = "jane@invalid",
                                .message = "message3",
@@ -373,14 +363,10 @@ static void test_merged_logs(void)
        while (len < 100) { /* cap loops/recursion. */
                struct reftable_log_record log = { NULL };
                int err = reftable_iterator_next_log(&it, &log);
-               if (err > 0) {
+               if (err > 0)
                        break;
-               }
-               if (len == cap) {
-                       cap = 2 * cap + 1;
-                       out = reftable_realloc(
-                               out, sizeof(struct reftable_log_record) * cap);
-               }
+
+               REFTABLE_ALLOC_GROW(out, len + 1, cap);
                out[len++] = log;
        }
        reftable_iterator_destroy(&it);
@@ -417,7 +403,7 @@ static void test_default_write_opts(void)
        struct reftable_write_options opts = { 0 };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
 
        struct reftable_ref_record rec = {
                .refname = "master",
@@ -425,7 +411,7 @@ static void test_default_write_opts(void)
        };
        int err;
        struct reftable_block_source source = { NULL };
-       struct reftable_table *tab = reftable_calloc(sizeof(*tab) * 1);
+       struct reftable_table *tab = reftable_calloc(1, sizeof(*tab));
        uint32_t hash_id;
        struct reftable_reader *rd = NULL;
        struct reftable_merged_table *merged = NULL;
index dcefeb793a9051b75a276732a32d88809bb86d94..7fb45d8c60dbca6106c51732005ce15c59d2c7e0 100644 (file)
@@ -14,33 +14,12 @@ https://developers.google.com/open-source/licenses/bsd
 
 int pq_less(struct pq_entry *a, struct pq_entry *b)
 {
-       struct strbuf ak = STRBUF_INIT;
-       struct strbuf bk = STRBUF_INIT;
-       int cmp = 0;
-       reftable_record_key(&a->rec, &ak);
-       reftable_record_key(&b->rec, &bk);
-
-       cmp = strbuf_cmp(&ak, &bk);
-
-       strbuf_release(&ak);
-       strbuf_release(&bk);
-
+       int cmp = reftable_record_cmp(a->rec, b->rec);
        if (cmp == 0)
                return a->index > b->index;
-
        return cmp < 0;
 }
 
-struct pq_entry merged_iter_pqueue_top(struct merged_iter_pqueue pq)
-{
-       return pq.heap[0];
-}
-
-int merged_iter_pqueue_is_empty(struct merged_iter_pqueue pq)
-{
-       return pq.len == 0;
-}
-
 struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq)
 {
        int i = 0;
@@ -75,13 +54,9 @@ void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry
 {
        int i = 0;
 
-       if (pq->len == pq->cap) {
-               pq->cap = 2 * pq->cap + 1;
-               pq->heap = reftable_realloc(pq->heap,
-                                           pq->cap * sizeof(struct pq_entry));
-       }
-
+       REFTABLE_ALLOC_GROW(pq->heap, pq->len + 1, pq->cap);
        pq->heap[pq->len++] = *e;
+
        i = pq->len - 1;
        while (i > 0) {
                int j = (i - 1) / 2;
@@ -97,10 +72,6 @@ void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry
 
 void merged_iter_pqueue_release(struct merged_iter_pqueue *pq)
 {
-       int i = 0;
-       for (i = 0; i < pq->len; i++) {
-               reftable_record_release(&pq->heap[i].rec);
-       }
        FREE_AND_NULL(pq->heap);
-       pq->len = pq->cap = 0;
+       memset(pq, 0, sizeof(*pq));
 }
index e85bac9b52e0039bd378cb1073215af4d48196c7..f796c2317948be2c82aaa15c29b5e9aba1730168 100644 (file)
@@ -12,8 +12,8 @@ https://developers.google.com/open-source/licenses/bsd
 #include "record.h"
 
 struct pq_entry {
-       int index;
-       struct reftable_record rec;
+       size_t index;
+       struct reftable_record *rec;
 };
 
 struct merged_iter_pqueue {
@@ -22,12 +22,20 @@ struct merged_iter_pqueue {
        size_t cap;
 };
 
-struct pq_entry merged_iter_pqueue_top(struct merged_iter_pqueue pq);
-int merged_iter_pqueue_is_empty(struct merged_iter_pqueue pq);
 void merged_iter_pqueue_check(struct merged_iter_pqueue pq);
 struct pq_entry merged_iter_pqueue_remove(struct merged_iter_pqueue *pq);
 void merged_iter_pqueue_add(struct merged_iter_pqueue *pq, const struct pq_entry *e);
 void merged_iter_pqueue_release(struct merged_iter_pqueue *pq);
 int pq_less(struct pq_entry *a, struct pq_entry *b);
 
+static inline struct pq_entry merged_iter_pqueue_top(struct merged_iter_pqueue pq)
+{
+       return pq.heap[0];
+}
+
+static inline int merged_iter_pqueue_is_empty(struct merged_iter_pqueue pq)
+{
+       return pq.len == 0;
+}
+
 #endif
index 011b5c75028a9d8dbad15f23ddb99d39e09ca9cb..b7d3c80cc7260298749800696e4a8bcc5be3284c 100644 (file)
@@ -27,48 +27,43 @@ void merged_iter_pqueue_check(struct merged_iter_pqueue pq)
 
 static void test_pq(void)
 {
-       char *names[54] = { NULL };
-       int N = ARRAY_SIZE(names) - 1;
-
        struct merged_iter_pqueue pq = { NULL };
+       struct reftable_record recs[54];
+       int N = ARRAY_SIZE(recs) - 1, i;
        char *last = NULL;
 
-       int i = 0;
        for (i = 0; i < N; i++) {
-               char name[100];
-               snprintf(name, sizeof(name), "%02d", i);
-               names[i] = xstrdup(name);
+               struct strbuf refname = STRBUF_INIT;
+               strbuf_addf(&refname, "%02d", i);
+
+               reftable_record_init(&recs[i], BLOCK_TYPE_REF);
+               recs[i].u.ref.refname = strbuf_detach(&refname, NULL);
        }
 
        i = 1;
        do {
-               struct pq_entry e = { .rec = { .type = BLOCK_TYPE_REF,
-                                              .u.ref = {
-                                                      .refname = names[i],
-                                              } } };
+               struct pq_entry e = {
+                       .rec = &recs[i],
+               };
+
                merged_iter_pqueue_add(&pq, &e);
                merged_iter_pqueue_check(pq);
+
                i = (i * 7) % N;
        } while (i != 1);
 
        while (!merged_iter_pqueue_is_empty(pq)) {
                struct pq_entry e = merged_iter_pqueue_remove(&pq);
-               struct reftable_record *rec = &e.rec;
                merged_iter_pqueue_check(pq);
 
-               EXPECT(reftable_record_type(rec) == BLOCK_TYPE_REF);
-               if (last) {
-                       EXPECT(strcmp(last, rec->u.ref.refname) < 0);
-               }
-               // this is names[i], so don't dealloc.
-               last = rec->u.ref.refname;
-               rec->u.ref.refname = NULL;
-               reftable_record_release(rec);
-       }
-       for (i = 0; i < N; i++) {
-               reftable_free(names[i]);
+               EXPECT(reftable_record_type(e.rec) == BLOCK_TYPE_REF);
+               if (last)
+                       EXPECT(strcmp(last, e.rec->u.ref.refname) < 0);
+               last = e.rec->u.ref.refname;
        }
 
+       for (i = 0; i < N; i++)
+               reftable_record_release(&recs[i]);
        merged_iter_pqueue_release(&pq);
 }
 
index bcb82530d6ce35e8a0a582d9718090067b238899..44b84a125e43b3f0de9460b019854e22835d39e6 100644 (file)
@@ -37,8 +37,9 @@ void reftable_free(void *p)
                free(p);
 }
 
-void *reftable_calloc(size_t sz)
+void *reftable_calloc(size_t nelem, size_t elsize)
 {
+       size_t sz = st_mult(nelem, elsize);
        void *p = reftable_malloc(sz);
        memset(p, 0, sz);
        return p;
index b4db23ce1880794a937b841e28ffa27e8869d2c7..b113daab77336c240d10f64ce9890ff04f5f366a 100644 (file)
@@ -16,7 +16,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "record.h"
 #include "reftable-error.h"
 #include "reftable-generic.h"
-#include "tree.h"
 
 uint64_t block_source_size(struct reftable_block_source *source)
 {
@@ -224,10 +223,9 @@ struct table_iter {
        struct block_iter bi;
        int is_finished;
 };
-#define TABLE_ITER_INIT                          \
-       {                                        \
-               .bi = {.last_key = STRBUF_INIT } \
-       }
+#define TABLE_ITER_INIT { \
+       .bi = BLOCK_ITER_INIT \
+}
 
 static void table_iter_copy_from(struct table_iter *dest,
                                 struct table_iter *src)
@@ -359,24 +357,32 @@ static int table_iter_next(struct table_iter *ti, struct reftable_record *rec)
 
        while (1) {
                struct table_iter next = TABLE_ITER_INIT;
-               int err = 0;
-               if (ti->is_finished) {
+               int err;
+
+               if (ti->is_finished)
                        return 1;
-               }
 
+               /*
+                * Check whether the current block still has more records. If
+                * so, return it. If the iterator returns positive then the
+                * current block has been exhausted.
+                */
                err = table_iter_next_in_block(ti, rec);
-               if (err <= 0) {
+               if (err <= 0)
                        return err;
-               }
 
+               /*
+                * Otherwise, we need to continue to the next block in the
+                * table and retry. If there are no more blocks then the
+                * iterator is drained.
+                */
                err = table_iter_next_block(&next, ti);
-               if (err != 0) {
-                       ti->is_finished = 1;
-               }
                table_iter_block_done(ti);
-               if (err != 0) {
+               if (err) {
+                       ti->is_finished = 1;
                        return err;
                }
+
                table_iter_copy_from(ti, &next);
                block_iter_close(&next.bi);
        }
@@ -446,13 +452,13 @@ static int reader_start(struct reftable_reader *r, struct table_iter *ti,
 static int reader_seek_linear(struct table_iter *ti,
                              struct reftable_record *want)
 {
-       struct reftable_record rec =
-               reftable_new_record(reftable_record_type(want));
        struct strbuf want_key = STRBUF_INIT;
        struct strbuf got_key = STRBUF_INIT;
        struct table_iter next = TABLE_ITER_INIT;
+       struct reftable_record rec;
        int err = -1;
 
+       reftable_record_init(&rec, reftable_record_type(want));
        reftable_record_key(want, &want_key);
 
        while (1) {
@@ -510,8 +516,38 @@ static int reader_seek_indexed(struct reftable_reader *r,
        if (err < 0)
                goto done;
 
+       /*
+        * The index may consist of multiple levels, where each level may have
+        * multiple index blocks. We start by doing a linear search in the
+        * highest layer that identifies the relevant index block as well as
+        * the record inside that block that corresponds to our wanted key.
+        */
        err = reader_seek_linear(&index_iter, &want_index);
+       if (err < 0)
+               goto done;
+
+       /*
+        * Traverse down the levels until we find a non-index entry.
+        */
        while (1) {
+               /*
+                * In case we seek a record that does not exist the index iter
+                * will tell us that the iterator is over. This works because
+                * the last index entry of the current level will contain the
+                * last key it knows about. So in case our seeked key is larger
+                * than the last indexed key we know that it won't exist.
+                *
+                * There is one subtlety in the layout of the index section
+                * that makes this work as expected: the highest-level index is
+                * at end of the section and will point backwards and thus we
+                * start reading from the end of the index section, not the
+                * beginning.
+                *
+                * If that wasn't the case and the order was reversed then the
+                * linear seek would seek into the lower levels and traverse
+                * all levels of the index only to find out that the key does
+                * not exist.
+                */
                err = table_iter_next(&index_iter, &index_result);
                table_iter_block_done(&index_iter);
                if (err != 0)
@@ -541,8 +577,7 @@ static int reader_seek_indexed(struct reftable_reader *r,
 
        if (err == 0) {
                struct table_iter empty = TABLE_ITER_INIT;
-               struct table_iter *malloced =
-                       reftable_calloc(sizeof(struct table_iter));
+               struct table_iter *malloced = reftable_calloc(1, sizeof(*malloced));
                *malloced = empty;
                table_iter_copy_from(malloced, &next);
                iterator_from_table_iter(it, malloced);
@@ -637,8 +672,7 @@ void reader_close(struct reftable_reader *r)
 int reftable_new_reader(struct reftable_reader **p,
                        struct reftable_block_source *src, char const *name)
 {
-       struct reftable_reader *rd =
-               reftable_calloc(sizeof(struct reftable_reader));
+       struct reftable_reader *rd = reftable_calloc(1, sizeof(*rd));
        int err = init_reader(rd, src, name);
        if (err == 0) {
                *p = rd;
@@ -713,7 +747,7 @@ static int reftable_reader_refs_for_unindexed(struct reftable_reader *r,
                                              uint8_t *oid)
 {
        struct table_iter ti_empty = TABLE_ITER_INIT;
-       struct table_iter *ti = reftable_calloc(sizeof(struct table_iter));
+       struct table_iter *ti = reftable_calloc(1, sizeof(*ti));
        struct filtering_ref_iterator *filter = NULL;
        struct filtering_ref_iterator empty = FILTERING_REF_ITERATOR_INIT;
        int oid_len = hash_size(r->hash_id);
index 469ab79a5adf3dfaba0160e523bdcece5b9875e0..a6dbd214c5d2f8c9a82632776691fe1c292533bd 100644 (file)
@@ -11,7 +11,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "basics.h"
 #include "block.h"
 #include "blocksource.h"
-#include "constants.h"
 #include "reader.h"
 #include "record.h"
 #include "test_framework.h"
@@ -52,26 +51,25 @@ static void write_table(char ***names, struct strbuf *buf, int N,
                .hash_id = hash_id,
        };
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, buf, &opts);
        struct reftable_ref_record ref = { NULL };
        int i = 0, n;
        struct reftable_log_record log = { NULL };
        const struct reftable_stats *stats = NULL;
-       *names = reftable_calloc(sizeof(char *) * (N + 1));
+
+       REFTABLE_CALLOC_ARRAY(*names, N + 1);
+
        reftable_writer_set_limits(w, update_index, update_index);
        for (i = 0; i < N; i++) {
-               uint8_t hash[GIT_SHA256_RAWSZ] = { 0 };
                char name[100];
                int n;
 
-               set_test_hash(hash, i);
-
                snprintf(name, sizeof(name), "refs/heads/branch%02d", i);
 
                ref.refname = name;
                ref.update_index = update_index;
                ref.value_type = REFTABLE_REF_VAL1;
-               ref.value.val1 = hash;
+               set_test_hash(ref.value.val1, i);
                (*names)[i] = xstrdup(name);
 
                n = reftable_writer_add_ref(w, &ref);
@@ -79,18 +77,15 @@ static void write_table(char ***names, struct strbuf *buf, int N,
        }
 
        for (i = 0; i < N; i++) {
-               uint8_t hash[GIT_SHA256_RAWSZ] = { 0 };
                char name[100];
                int n;
 
-               set_test_hash(hash, i);
-
                snprintf(name, sizeof(name), "refs/heads/branch%02d", i);
 
                log.refname = name;
                log.update_index = update_index;
                log.value_type = REFTABLE_LOG_UPDATE;
-               log.value.update.new_hash = hash;
+               set_test_hash(log.value.update.new_hash, i);
                log.value.update.message = "message";
 
                n = reftable_writer_add_log(w, &log);
@@ -134,18 +129,15 @@ static void test_log_buffer_size(void)
                                           .message = "commit: 9\n",
                                   } } };
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
 
        /* This tests buffer extension for log compression. Must use a random
           hash, to ensure that the compressed part is larger than the original.
        */
-       uint8_t hash1[GIT_SHA1_RAWSZ], hash2[GIT_SHA1_RAWSZ];
        for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
-               hash1[i] = (uint8_t)(rand() % 256);
-               hash2[i] = (uint8_t)(rand() % 256);
+               log.value.update.old_hash[i] = (uint8_t)(git_rand() % 256);
+               log.value.update.new_hash[i] = (uint8_t)(git_rand() % 256);
        }
-       log.value.update.old_hash = hash1;
-       log.value.update.new_hash = hash2;
        reftable_writer_set_limits(w, update_index, update_index);
        err = reftable_writer_add_log(w, &log);
        EXPECT_ERR(err);
@@ -163,25 +155,26 @@ static void test_log_overflow(void)
                .block_size = ARRAY_SIZE(msg),
        };
        int err;
-       struct reftable_log_record
-               log = { .refname = "refs/heads/master",
-                       .update_index = 0xa,
-                       .value_type = REFTABLE_LOG_UPDATE,
-                       .value = { .update = {
-                                          .name = "Han-Wen Nienhuys",
-                                          .email = "hanwen@google.com",
-                                          .tz_offset = 100,
-                                          .time = 0x5e430672,
-                                          .message = msg,
-                                  } } };
+       struct reftable_log_record log = {
+               .refname = "refs/heads/master",
+               .update_index = 0xa,
+               .value_type = REFTABLE_LOG_UPDATE,
+               .value = {
+                       .update = {
+                               .old_hash = { 1 },
+                               .new_hash = { 2 },
+                               .name = "Han-Wen Nienhuys",
+                               .email = "hanwen@google.com",
+                               .tz_offset = 100,
+                               .time = 0x5e430672,
+                               .message = msg,
+                       },
+               },
+       };
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
-
-       uint8_t hash1[GIT_SHA1_RAWSZ]  = {1}, hash2[GIT_SHA1_RAWSZ] = { 2 };
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
 
        memset(msg, 'x', sizeof(msg) - 1);
-       log.value.update.old_hash = hash1;
-       log.value.update.new_hash = hash2;
        reftable_writer_set_limits(w, update_index, update_index);
        err = reftable_writer_add_log(w, &log);
        EXPECT(err == REFTABLE_ENTRY_TOO_BIG_ERROR);
@@ -192,7 +185,7 @@ static void test_log_overflow(void)
 static void test_log_write_read(void)
 {
        int N = 2;
-       char **names = reftable_calloc(sizeof(char *) * (N + 1));
+       char **names = reftable_calloc(N + 1, sizeof(*names));
        int err;
        struct reftable_write_options opts = {
                .block_size = 256,
@@ -206,7 +199,7 @@ static void test_log_write_read(void)
        struct reftable_block_source source = { NULL };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        const struct reftable_stats *stats = NULL;
        reftable_writer_set_limits(w, 0, N);
        for (i = 0; i < N; i++) {
@@ -221,16 +214,13 @@ static void test_log_write_read(void)
                EXPECT_ERR(err);
        }
        for (i = 0; i < N; i++) {
-               uint8_t hash1[GIT_SHA1_RAWSZ], hash2[GIT_SHA1_RAWSZ];
                struct reftable_log_record log = { NULL };
-               set_test_hash(hash1, i);
-               set_test_hash(hash2, i + 1);
 
                log.refname = names[i];
                log.update_index = i;
                log.value_type = REFTABLE_LOG_UPDATE;
-               log.value.update.old_hash = hash1;
-               log.value.update.new_hash = hash2;
+               set_test_hash(log.value.update.old_hash, i);
+               set_test_hash(log.value.update.new_hash, i + 1);
 
                err = reftable_writer_add_log(w, &log);
                EXPECT_ERR(err);
@@ -298,20 +288,17 @@ static void test_log_zlib_corruption(void)
        struct reftable_block_source source = { 0 };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        const struct reftable_stats *stats = NULL;
-       uint8_t hash1[GIT_SHA1_RAWSZ] = { 1 };
-       uint8_t hash2[GIT_SHA1_RAWSZ] = { 2 };
        char message[100] = { 0 };
        int err, i, n;
-
        struct reftable_log_record log = {
                .refname = "refname",
                .value_type = REFTABLE_LOG_UPDATE,
                .value = {
                        .update = {
-                               .new_hash = hash1,
-                               .old_hash = hash2,
+                               .new_hash = { 1 },
+                               .old_hash = { 2 },
                                .name = "My Name",
                                .email = "myname@invalid",
                                .message = message,
@@ -320,7 +307,7 @@ static void test_log_zlib_corruption(void)
        };
 
        for (i = 0; i < sizeof(message) - 1; i++)
-               message[i] = (uint8_t)(rand() % 64 + ' ');
+               message[i] = (uint8_t)(git_rand() % 64 + ' ');
 
        reftable_writer_set_limits(w, 1, 1);
 
@@ -523,7 +510,7 @@ static void test_table_read_write_seek_index(void)
 static void test_table_refs_for(int indexed)
 {
        int N = 50;
-       char **want_names = reftable_calloc(sizeof(char *) * (N + 1));
+       char **want_names = reftable_calloc(N + 1, sizeof(*want_names));
        int want_names_len = 0;
        uint8_t want_hash[GIT_SHA1_RAWSZ];
 
@@ -539,7 +526,7 @@ static void test_table_refs_for(int indexed)
 
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
 
        struct reftable_iterator it = { NULL };
        int j;
@@ -550,8 +537,6 @@ static void test_table_refs_for(int indexed)
                uint8_t hash[GIT_SHA1_RAWSZ];
                char fill[51] = { 0 };
                char name[100];
-               uint8_t hash1[GIT_SHA1_RAWSZ];
-               uint8_t hash2[GIT_SHA1_RAWSZ];
                struct reftable_ref_record ref = { NULL };
 
                memset(hash, i, sizeof(hash));
@@ -561,11 +546,9 @@ static void test_table_refs_for(int indexed)
                name[40] = 0;
                ref.refname = name;
 
-               set_test_hash(hash1, i / 4);
-               set_test_hash(hash2, 3 + i / 4);
                ref.value_type = REFTABLE_REF_VAL2;
-               ref.value.val2.value = hash1;
-               ref.value.val2.target_value = hash2;
+               set_test_hash(ref.value.val2.value, i / 4);
+               set_test_hash(ref.value.val2.target_value, 3 + i / 4);
 
                /* 80 bytes / entry, so 3 entries per block. Yields 17
                 */
@@ -573,8 +556,8 @@ static void test_table_refs_for(int indexed)
                n = reftable_writer_add_ref(w, &ref);
                EXPECT(n == 0);
 
-               if (!memcmp(hash1, want_hash, GIT_SHA1_RAWSZ) ||
-                   !memcmp(hash2, want_hash, GIT_SHA1_RAWSZ)) {
+               if (!memcmp(ref.value.val2.value, want_hash, GIT_SHA1_RAWSZ) ||
+                   !memcmp(ref.value.val2.target_value, want_hash, GIT_SHA1_RAWSZ)) {
                        want_names[want_names_len++] = xstrdup(name);
                }
        }
@@ -636,7 +619,7 @@ static void test_write_empty_table(void)
        struct reftable_write_options opts = { 0 };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        struct reftable_block_source source = { NULL };
        struct reftable_reader *rd = NULL;
        struct reftable_ref_record rec = { NULL };
@@ -674,12 +657,11 @@ static void test_write_object_id_min_length(void)
        };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
-       uint8_t hash[GIT_SHA1_RAWSZ] = {42};
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        struct reftable_ref_record ref = {
                .update_index = 1,
                .value_type = REFTABLE_REF_VAL1,
-               .value.val1 = hash,
+               .value.val1 = {42},
        };
        int err;
        int i;
@@ -710,12 +692,11 @@ static void test_write_object_id_length(void)
        };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
-       uint8_t hash[GIT_SHA1_RAWSZ] = {42};
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        struct reftable_ref_record ref = {
                .update_index = 1,
                .value_type = REFTABLE_REF_VAL1,
-               .value.val1 = hash,
+               .value.val1 = {42},
        };
        int err;
        int i;
@@ -745,7 +726,7 @@ static void test_write_empty_key(void)
        struct reftable_write_options opts = { 0 };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        struct reftable_ref_record ref = {
                .refname = "",
                .update_index = 1,
@@ -768,7 +749,7 @@ static void test_write_key_order(void)
        struct reftable_write_options opts = { 0 };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        struct reftable_ref_record refs[2] = {
                {
                        .refname = "b",
@@ -798,6 +779,138 @@ static void test_write_key_order(void)
        strbuf_release(&buf);
 }
 
+static void test_write_multiple_indices(void)
+{
+       struct reftable_write_options opts = {
+               .block_size = 100,
+       };
+       struct strbuf writer_buf = STRBUF_INIT, buf = STRBUF_INIT;
+       struct reftable_block_source source = { 0 };
+       struct reftable_iterator it = { 0 };
+       const struct reftable_stats *stats;
+       struct reftable_writer *writer;
+       struct reftable_reader *reader;
+       int err, i;
+
+       writer = reftable_new_writer(&strbuf_add_void, &noop_flush, &writer_buf, &opts);
+       reftable_writer_set_limits(writer, 1, 1);
+       for (i = 0; i < 100; i++) {
+               struct reftable_ref_record ref = {
+                       .update_index = 1,
+                       .value_type = REFTABLE_REF_VAL1,
+                       .value.val1 = {i},
+               };
+
+               strbuf_reset(&buf);
+               strbuf_addf(&buf, "refs/heads/%04d", i);
+               ref.refname = buf.buf,
+
+               err = reftable_writer_add_ref(writer, &ref);
+               EXPECT_ERR(err);
+       }
+
+       for (i = 0; i < 100; i++) {
+               struct reftable_log_record log = {
+                       .update_index = 1,
+                       .value_type = REFTABLE_LOG_UPDATE,
+                       .value.update = {
+                               .old_hash = { i },
+                               .new_hash = { i },
+                       },
+               };
+
+               strbuf_reset(&buf);
+               strbuf_addf(&buf, "refs/heads/%04d", i);
+               log.refname = buf.buf,
+
+               err = reftable_writer_add_log(writer, &log);
+               EXPECT_ERR(err);
+       }
+
+       reftable_writer_close(writer);
+
+       /*
+        * The written data should be sufficiently large to result in indices
+        * for each of the block types.
+        */
+       stats = reftable_writer_stats(writer);
+       EXPECT(stats->ref_stats.index_offset > 0);
+       EXPECT(stats->obj_stats.index_offset > 0);
+       EXPECT(stats->log_stats.index_offset > 0);
+
+       block_source_from_strbuf(&source, &writer_buf);
+       err = reftable_new_reader(&reader, &source, "filename");
+       EXPECT_ERR(err);
+
+       /*
+        * Seeking the log uses the log index now. In case there is any
+        * confusion regarding indices we would notice here.
+        */
+       err = reftable_reader_seek_log(reader, &it, "");
+       EXPECT_ERR(err);
+
+       reftable_iterator_destroy(&it);
+       reftable_writer_free(writer);
+       reftable_reader_free(reader);
+       strbuf_release(&writer_buf);
+       strbuf_release(&buf);
+}
+
+static void test_write_multi_level_index(void)
+{
+       struct reftable_write_options opts = {
+               .block_size = 100,
+       };
+       struct strbuf writer_buf = STRBUF_INIT, buf = STRBUF_INIT;
+       struct reftable_block_source source = { 0 };
+       struct reftable_iterator it = { 0 };
+       const struct reftable_stats *stats;
+       struct reftable_writer *writer;
+       struct reftable_reader *reader;
+       int err;
+
+       writer = reftable_new_writer(&strbuf_add_void, &noop_flush, &writer_buf, &opts);
+       reftable_writer_set_limits(writer, 1, 1);
+       for (size_t i = 0; i < 200; i++) {
+               struct reftable_ref_record ref = {
+                       .update_index = 1,
+                       .value_type = REFTABLE_REF_VAL1,
+                       .value.val1 = {i},
+               };
+
+               strbuf_reset(&buf);
+               strbuf_addf(&buf, "refs/heads/%03" PRIuMAX, (uintmax_t)i);
+               ref.refname = buf.buf,
+
+               err = reftable_writer_add_ref(writer, &ref);
+               EXPECT_ERR(err);
+       }
+       reftable_writer_close(writer);
+
+       /*
+        * The written refs should be sufficiently large to result in a
+        * multi-level index.
+        */
+       stats = reftable_writer_stats(writer);
+       EXPECT(stats->ref_stats.max_index_level == 2);
+
+       block_source_from_strbuf(&source, &writer_buf);
+       err = reftable_new_reader(&reader, &source, "filename");
+       EXPECT_ERR(err);
+
+       /*
+        * Seeking the last ref should work as expected.
+        */
+       err = reftable_reader_seek_ref(reader, &it, "refs/heads/199");
+       EXPECT_ERR(err);
+
+       reftable_iterator_destroy(&it);
+       reftable_writer_free(writer);
+       reftable_reader_free(reader);
+       strbuf_release(&writer_buf);
+       strbuf_release(&buf);
+}
+
 static void test_corrupt_table_empty(void)
 {
        struct strbuf buf = STRBUF_INIT;
@@ -847,5 +960,7 @@ int readwrite_test_main(int argc, const char *argv[])
        RUN_TEST(test_log_overflow);
        RUN_TEST(test_write_object_id_length);
        RUN_TEST(test_write_object_id_min_length);
+       RUN_TEST(test_write_multiple_indices);
+       RUN_TEST(test_write_multi_level_index);
        return 0;
 }
index fbaa1fbef56c52fed8391c7bcef2efd035eb588b..23b497adab8b3478026959a802bddb58fb1c6002 100644 (file)
@@ -76,7 +76,7 @@ int reftable_is_block_type(uint8_t typ)
        return 0;
 }
 
-uint8_t *reftable_ref_record_val1(const struct reftable_ref_record *rec)
+const unsigned char *reftable_ref_record_val1(const struct reftable_ref_record *rec)
 {
        switch (rec->value_type) {
        case REFTABLE_REF_VAL1:
@@ -88,7 +88,7 @@ uint8_t *reftable_ref_record_val1(const struct reftable_ref_record *rec)
        }
 }
 
-uint8_t *reftable_ref_record_val2(const struct reftable_ref_record *rec)
+const unsigned char *reftable_ref_record_val2(const struct reftable_ref_record *rec)
 {
        switch (rec->value_type) {
        case REFTABLE_REF_VAL2:
@@ -159,20 +159,19 @@ int reftable_encode_key(int *restart, struct string_view dest,
        return start.len - dest.len;
 }
 
-int reftable_decode_key(struct strbuf *key, uint8_t *extra,
-                       struct strbuf last_key, struct string_view in)
+int reftable_decode_key(struct strbuf *last_key, uint8_t *extra,
+                       struct string_view in)
 {
        int start_len = in.len;
        uint64_t prefix_len = 0;
        uint64_t suffix_len = 0;
-       int n = get_var_int(&prefix_len, &in);
+       int n;
+
+       n = get_var_int(&prefix_len, &in);
        if (n < 0)
                return -1;
        string_view_consume(&in, n);
 
-       if (prefix_len > last_key.len)
-               return -1;
-
        n = get_var_int(&suffix_len, &in);
        if (n <= 0)
                return -1;
@@ -181,12 +180,12 @@ int reftable_decode_key(struct strbuf *key, uint8_t *extra,
        *extra = (uint8_t)(suffix_len & 0x7);
        suffix_len >>= 3;
 
-       if (in.len < suffix_len)
+       if (in.len < suffix_len ||
+           prefix_len > last_key->len)
                return -1;
 
-       strbuf_reset(key);
-       strbuf_add(key, last_key.buf, prefix_len);
-       strbuf_add(key, in.buf, suffix_len);
+       strbuf_setlen(last_key, prefix_len);
+       strbuf_add(last_key, in.buf, suffix_len);
        string_view_consume(&in, suffix_len);
 
        return start_len - in.len;
@@ -205,27 +204,36 @@ static void reftable_ref_record_copy_from(void *rec, const void *src_rec,
 {
        struct reftable_ref_record *ref = rec;
        const struct reftable_ref_record *src = src_rec;
+       char *refname = NULL;
+       size_t refname_cap = 0;
+
        assert(hash_size > 0);
 
-       /* This is simple and correct, but we could probably reuse the hash
-        * fields. */
+       SWAP(refname, ref->refname);
+       SWAP(refname_cap, ref->refname_cap);
        reftable_ref_record_release(ref);
+       SWAP(ref->refname, refname);
+       SWAP(ref->refname_cap, refname_cap);
+
        if (src->refname) {
-               ref->refname = xstrdup(src->refname);
+               size_t refname_len = strlen(src->refname);
+
+               REFTABLE_ALLOC_GROW(ref->refname, refname_len + 1,
+                                   ref->refname_cap);
+               memcpy(ref->refname, src->refname, refname_len);
+               ref->refname[refname_len] = 0;
        }
+
        ref->update_index = src->update_index;
        ref->value_type = src->value_type;
        switch (src->value_type) {
        case REFTABLE_REF_DELETION:
                break;
        case REFTABLE_REF_VAL1:
-               ref->value.val1 = reftable_malloc(hash_size);
                memcpy(ref->value.val1, src->value.val1, hash_size);
                break;
        case REFTABLE_REF_VAL2:
-               ref->value.val2.value = reftable_malloc(hash_size);
                memcpy(ref->value.val2.value, src->value.val2.value, hash_size);
-               ref->value.val2.target_value = reftable_malloc(hash_size);
                memcpy(ref->value.val2.target_value,
                       src->value.val2.target_value, hash_size);
                break;
@@ -242,7 +250,7 @@ static char hexdigit(int c)
        return 'a' + (c - 10);
 }
 
-static void hex_format(char *dest, uint8_t *src, int hash_size)
+static void hex_format(char *dest, const unsigned char *src, int hash_size)
 {
        assert(hash_size > 0);
        if (src) {
@@ -299,11 +307,8 @@ void reftable_ref_record_release(struct reftable_ref_record *ref)
                reftable_free(ref->value.symref);
                break;
        case REFTABLE_REF_VAL2:
-               reftable_free(ref->value.val2.target_value);
-               reftable_free(ref->value.val2.value);
                break;
        case REFTABLE_REF_VAL1:
-               reftable_free(ref->value.val1);
                break;
        case REFTABLE_REF_DELETION:
                break;
@@ -369,24 +374,33 @@ static int reftable_ref_record_encode(const void *rec, struct string_view s,
 
 static int reftable_ref_record_decode(void *rec, struct strbuf key,
                                      uint8_t val_type, struct string_view in,
-                                     int hash_size)
+                                     int hash_size, struct strbuf *scratch)
 {
        struct reftable_ref_record *r = rec;
        struct string_view start = in;
        uint64_t update_index = 0;
-       int n = get_var_int(&update_index, &in);
+       const char *refname = NULL;
+       size_t refname_cap = 0;
+       int n;
+
+       assert(hash_size > 0);
+
+       n = get_var_int(&update_index, &in);
        if (n < 0)
                return n;
        string_view_consume(&in, n);
 
+       SWAP(refname, r->refname);
+       SWAP(refname_cap, r->refname_cap);
        reftable_ref_record_release(r);
+       SWAP(r->refname, refname);
+       SWAP(r->refname_cap, refname_cap);
 
-       assert(hash_size > 0);
-
-       r->refname = reftable_realloc(r->refname, key.len + 1);
+       REFTABLE_ALLOC_GROW(r->refname, key.len + 1, r->refname_cap);
        memcpy(r->refname, key.buf, key.len);
-       r->update_index = update_index;
        r->refname[key.len] = 0;
+
+       r->update_index = update_index;
        r->value_type = val_type;
        switch (val_type) {
        case REFTABLE_REF_VAL1:
@@ -394,7 +408,6 @@ static int reftable_ref_record_decode(void *rec, struct strbuf key,
                        return -1;
                }
 
-               r->value.val1 = reftable_malloc(hash_size);
                memcpy(r->value.val1, in.buf, hash_size);
                string_view_consume(&in, hash_size);
                break;
@@ -404,23 +417,20 @@ static int reftable_ref_record_decode(void *rec, struct strbuf key,
                        return -1;
                }
 
-               r->value.val2.value = reftable_malloc(hash_size);
                memcpy(r->value.val2.value, in.buf, hash_size);
                string_view_consume(&in, hash_size);
 
-               r->value.val2.target_value = reftable_malloc(hash_size);
                memcpy(r->value.val2.target_value, in.buf, hash_size);
                string_view_consume(&in, hash_size);
                break;
 
        case REFTABLE_REF_SYMREF: {
-               struct strbuf dest = STRBUF_INIT;
-               int n = decode_string(&dest, in);
+               int n = decode_string(scratch, in);
                if (n < 0) {
                        return -1;
                }
                string_view_consume(&in, n);
-               r->value.symref = dest.buf;
+               r->value.symref = strbuf_detach(scratch, NULL);
        } break;
 
        case REFTABLE_REF_DELETION:
@@ -439,7 +449,6 @@ static int reftable_ref_record_is_deletion_void(const void *p)
                (const struct reftable_ref_record *)p);
 }
 
-
 static int reftable_ref_record_equal_void(const void *a,
                                          const void *b, int hash_size)
 {
@@ -448,6 +457,13 @@ static int reftable_ref_record_equal_void(const void *a,
        return reftable_ref_record_equal(ra, rb, hash_size);
 }
 
+static int reftable_ref_record_cmp_void(const void *_a, const void *_b)
+{
+       const struct reftable_ref_record *a = _a;
+       const struct reftable_ref_record *b = _b;
+       return strcmp(a->refname, b->refname);
+}
+
 static void reftable_ref_record_print_void(const void *rec,
                                           int hash_size)
 {
@@ -464,6 +480,7 @@ static struct reftable_record_vtable reftable_ref_record_vtable = {
        .release = &reftable_ref_record_release_void,
        .is_deletion = &reftable_ref_record_is_deletion_void,
        .equal = &reftable_ref_record_equal_void,
+       .cmp = &reftable_ref_record_cmp_void,
        .print = &reftable_ref_record_print_void,
 };
 
@@ -506,12 +523,13 @@ static void reftable_obj_record_copy_from(void *rec, const void *src_rec,
                (const struct reftable_obj_record *)src_rec;
 
        reftable_obj_record_release(obj);
-       obj->hash_prefix = reftable_malloc(src->hash_prefix_len);
+
+       REFTABLE_ALLOC_ARRAY(obj->hash_prefix, src->hash_prefix_len);
        obj->hash_prefix_len = src->hash_prefix_len;
        if (src->hash_prefix_len)
                memcpy(obj->hash_prefix, src->hash_prefix, obj->hash_prefix_len);
 
-       obj->offsets = reftable_malloc(src->offset_len * sizeof(uint64_t));
+       REFTABLE_ALLOC_ARRAY(obj->offsets, src->offset_len);
        obj->offset_len = src->offset_len;
        COPY_ARRAY(obj->offsets, src->offsets, src->offset_len);
 }
@@ -560,7 +578,7 @@ static int reftable_obj_record_encode(const void *rec, struct string_view s,
 
 static int reftable_obj_record_decode(void *rec, struct strbuf key,
                                      uint8_t val_type, struct string_view in,
-                                     int hash_size)
+                                     int hash_size, struct strbuf *scratch UNUSED)
 {
        struct string_view start = in;
        struct reftable_obj_record *r = rec;
@@ -568,7 +586,10 @@ static int reftable_obj_record_decode(void *rec, struct strbuf key,
        int n = 0;
        uint64_t last;
        int j;
-       r->hash_prefix = reftable_malloc(key.len);
+
+       reftable_obj_record_release(r);
+
+       REFTABLE_ALLOC_ARRAY(r->hash_prefix, key.len);
        memcpy(r->hash_prefix, key.buf, key.len);
        r->hash_prefix_len = key.len;
 
@@ -586,7 +607,7 @@ static int reftable_obj_record_decode(void *rec, struct strbuf key,
        if (count == 0)
                return start.len - in.len;
 
-       r->offsets = reftable_malloc(count * sizeof(uint64_t));
+       REFTABLE_ALLOC_ARRAY(r->offsets, count);
        r->offset_len = count;
 
        n = get_var_int(&r->offsets[0], &in);
@@ -634,6 +655,25 @@ static int reftable_obj_record_equal_void(const void *a, const void *b, int hash
        return 1;
 }
 
+static int reftable_obj_record_cmp_void(const void *_a, const void *_b)
+{
+       const struct reftable_obj_record *a = _a;
+       const struct reftable_obj_record *b = _b;
+       int cmp;
+
+       cmp = memcmp(a->hash_prefix, b->hash_prefix,
+                    a->hash_prefix_len > b->hash_prefix_len ?
+                    a->hash_prefix_len : b->hash_prefix_len);
+       if (cmp)
+               return cmp;
+
+       /*
+        * When the prefix is the same then the object record that is longer is
+        * considered to be bigger.
+        */
+       return a->hash_prefix_len - b->hash_prefix_len;
+}
+
 static struct reftable_record_vtable reftable_obj_record_vtable = {
        .key = &reftable_obj_record_key,
        .type = BLOCK_TYPE_OBJ,
@@ -644,6 +684,7 @@ static struct reftable_record_vtable reftable_obj_record_vtable = {
        .release = &reftable_obj_record_release,
        .is_deletion = &not_a_deletion,
        .equal = &reftable_obj_record_equal_void,
+       .cmp = &reftable_obj_record_cmp_void,
        .print = &reftable_obj_record_print,
 };
 
@@ -723,16 +764,10 @@ static void reftable_log_record_copy_from(void *rec, const void *src_rec,
                                xstrdup(dst->value.update.message);
                }
 
-               if (dst->value.update.new_hash) {
-                       dst->value.update.new_hash = reftable_malloc(hash_size);
-                       memcpy(dst->value.update.new_hash,
-                              src->value.update.new_hash, hash_size);
-               }
-               if (dst->value.update.old_hash) {
-                       dst->value.update.old_hash = reftable_malloc(hash_size);
-                       memcpy(dst->value.update.old_hash,
-                              src->value.update.old_hash, hash_size);
-               }
+               memcpy(dst->value.update.new_hash,
+                      src->value.update.new_hash, hash_size);
+               memcpy(dst->value.update.old_hash,
+                      src->value.update.old_hash, hash_size);
                break;
        }
 }
@@ -750,8 +785,6 @@ void reftable_log_record_release(struct reftable_log_record *r)
        case REFTABLE_LOG_DELETION:
                break;
        case REFTABLE_LOG_UPDATE:
-               reftable_free(r->value.update.new_hash);
-               reftable_free(r->value.update.old_hash);
                reftable_free(r->value.update.name);
                reftable_free(r->value.update.email);
                reftable_free(r->value.update.message);
@@ -768,33 +801,20 @@ static uint8_t reftable_log_record_val_type(const void *rec)
        return reftable_log_record_is_deletion(log) ? 0 : 1;
 }
 
-static uint8_t zero[GIT_SHA256_RAWSZ] = { 0 };
-
 static int reftable_log_record_encode(const void *rec, struct string_view s,
                                      int hash_size)
 {
        const struct reftable_log_record *r = rec;
        struct string_view start = s;
        int n = 0;
-       uint8_t *oldh = NULL;
-       uint8_t *newh = NULL;
        if (reftable_log_record_is_deletion(r))
                return 0;
 
-       oldh = r->value.update.old_hash;
-       newh = r->value.update.new_hash;
-       if (!oldh) {
-               oldh = zero;
-       }
-       if (!newh) {
-               newh = zero;
-       }
-
        if (s.len < 2 * hash_size)
                return -1;
 
-       memcpy(s.buf, oldh, hash_size);
-       memcpy(s.buf + hash_size, newh, hash_size);
+       memcpy(s.buf, r->value.update.old_hash, hash_size);
+       memcpy(s.buf + hash_size, r->value.update.new_hash, hash_size);
        string_view_consume(&s, 2 * hash_size);
 
        n = encode_string(r->value.update.name ? r->value.update.name : "", s);
@@ -830,19 +850,18 @@ static int reftable_log_record_encode(const void *rec, struct string_view s,
 
 static int reftable_log_record_decode(void *rec, struct strbuf key,
                                      uint8_t val_type, struct string_view in,
-                                     int hash_size)
+                                     int hash_size, struct strbuf *scratch)
 {
        struct string_view start = in;
        struct reftable_log_record *r = rec;
        uint64_t max = 0;
        uint64_t ts = 0;
-       struct strbuf dest = STRBUF_INIT;
        int n;
 
        if (key.len <= 9 || key.buf[key.len - 9] != 0)
                return REFTABLE_FORMAT_ERROR;
 
-       r->refname = reftable_realloc(r->refname, key.len - 8);
+       REFTABLE_ALLOC_GROW(r->refname, key.len - 8, r->refname_cap);
        memcpy(r->refname, key.buf, key.len - 8);
        ts = get_be64(key.buf + key.len - 8);
 
@@ -851,9 +870,8 @@ static int reftable_log_record_decode(void *rec, struct strbuf key,
        if (val_type != r->value_type) {
                switch (r->value_type) {
                case REFTABLE_LOG_UPDATE:
-                       FREE_AND_NULL(r->value.update.old_hash);
-                       FREE_AND_NULL(r->value.update.new_hash);
                        FREE_AND_NULL(r->value.update.message);
+                       r->value.update.message_cap = 0;
                        FREE_AND_NULL(r->value.update.email);
                        FREE_AND_NULL(r->value.update.name);
                        break;
@@ -869,36 +887,43 @@ static int reftable_log_record_decode(void *rec, struct strbuf key,
        if (in.len < 2 * hash_size)
                return REFTABLE_FORMAT_ERROR;
 
-       r->value.update.old_hash =
-               reftable_realloc(r->value.update.old_hash, hash_size);
-       r->value.update.new_hash =
-               reftable_realloc(r->value.update.new_hash, hash_size);
-
        memcpy(r->value.update.old_hash, in.buf, hash_size);
        memcpy(r->value.update.new_hash, in.buf + hash_size, hash_size);
 
        string_view_consume(&in, 2 * hash_size);
 
-       n = decode_string(&dest, in);
+       n = decode_string(scratch, in);
        if (n < 0)
                goto done;
        string_view_consume(&in, n);
 
-       r->value.update.name =
-               reftable_realloc(r->value.update.name, dest.len + 1);
-       memcpy(r->value.update.name, dest.buf, dest.len);
-       r->value.update.name[dest.len] = 0;
+       /*
+        * In almost all cases we can expect the reflog name to not change for
+        * reflog entries as they are tied to the local identity, not to the
+        * target commits. As an optimization for this common case we can thus
+        * skip copying over the name in case it's accurate already.
+        */
+       if (!r->value.update.name ||
+           strcmp(r->value.update.name, scratch->buf)) {
+               r->value.update.name =
+                       reftable_realloc(r->value.update.name, scratch->len + 1);
+               memcpy(r->value.update.name, scratch->buf, scratch->len);
+               r->value.update.name[scratch->len] = 0;
+       }
 
-       strbuf_reset(&dest);
-       n = decode_string(&dest, in);
+       n = decode_string(scratch, in);
        if (n < 0)
                goto done;
        string_view_consume(&in, n);
 
-       r->value.update.email =
-               reftable_realloc(r->value.update.email, dest.len + 1);
-       memcpy(r->value.update.email, dest.buf, dest.len);
-       r->value.update.email[dest.len] = 0;
+       /* Same as above, but for the reflog email. */
+       if (!r->value.update.email ||
+           strcmp(r->value.update.email, scratch->buf)) {
+               r->value.update.email =
+                       reftable_realloc(r->value.update.email, scratch->len + 1);
+               memcpy(r->value.update.email, scratch->buf, scratch->len);
+               r->value.update.email[scratch->len] = 0;
+       }
 
        ts = 0;
        n = get_var_int(&ts, &in);
@@ -912,22 +937,19 @@ static int reftable_log_record_decode(void *rec, struct strbuf key,
        r->value.update.tz_offset = get_be16(in.buf);
        string_view_consume(&in, 2);
 
-       strbuf_reset(&dest);
-       n = decode_string(&dest, in);
+       n = decode_string(scratch, in);
        if (n < 0)
                goto done;
        string_view_consume(&in, n);
 
-       r->value.update.message =
-               reftable_realloc(r->value.update.message, dest.len + 1);
-       memcpy(r->value.update.message, dest.buf, dest.len);
-       r->value.update.message[dest.len] = 0;
+       REFTABLE_ALLOC_GROW(r->value.update.message, scratch->len + 1,
+                           r->value.update.message_cap);
+       memcpy(r->value.update.message, scratch->buf, scratch->len);
+       r->value.update.message[scratch->len] = 0;
 
-       strbuf_release(&dest);
        return start.len - in.len;
 
 done:
-       strbuf_release(&dest);
        return REFTABLE_FORMAT_ERROR;
 }
 
@@ -943,17 +965,6 @@ static int null_streq(char *a, char *b)
        return 0 == strcmp(a, b);
 }
 
-static int zero_hash_eq(uint8_t *a, uint8_t *b, int sz)
-{
-       if (!a)
-               a = zero;
-
-       if (!b)
-               b = zero;
-
-       return !memcmp(a, b, sz);
-}
-
 static int reftable_log_record_equal_void(const void *a,
                                          const void *b, int hash_size)
 {
@@ -962,6 +973,22 @@ static int reftable_log_record_equal_void(const void *a,
                                         hash_size);
 }
 
+static int reftable_log_record_cmp_void(const void *_a, const void *_b)
+{
+       const struct reftable_log_record *a = _a;
+       const struct reftable_log_record *b = _b;
+       int cmp = strcmp(a->refname, b->refname);
+       if (cmp)
+               return cmp;
+
+       /*
+        * Note that the comparison here is reversed. This is because the
+        * update index is reversed when comparing keys. For reference, see how
+        * we handle this in reftable_log_record_key()`.
+        */
+       return b->update_index - a->update_index;
+}
+
 int reftable_log_record_equal(const struct reftable_log_record *a,
                              const struct reftable_log_record *b, int hash_size)
 {
@@ -981,10 +1008,10 @@ int reftable_log_record_equal(const struct reftable_log_record *a,
                                  b->value.update.email) &&
                       null_streq(a->value.update.message,
                                  b->value.update.message) &&
-                      zero_hash_eq(a->value.update.old_hash,
-                                   b->value.update.old_hash, hash_size) &&
-                      zero_hash_eq(a->value.update.new_hash,
-                                   b->value.update.new_hash, hash_size);
+                      !memcmp(a->value.update.old_hash,
+                              b->value.update.old_hash, hash_size) &&
+                      !memcmp(a->value.update.new_hash,
+                              b->value.update.new_hash, hash_size);
        }
 
        abort();
@@ -1011,6 +1038,7 @@ static struct reftable_record_vtable reftable_log_record_vtable = {
        .release = &reftable_log_record_release_void,
        .is_deletion = &reftable_log_record_is_deletion_void,
        .equal = &reftable_log_record_equal_void,
+       .cmp = &reftable_log_record_cmp_void,
        .print = &reftable_log_record_print_void,
 };
 
@@ -1061,7 +1089,7 @@ static int reftable_index_record_encode(const void *rec, struct string_view out,
 
 static int reftable_index_record_decode(void *rec, struct strbuf key,
                                        uint8_t val_type, struct string_view in,
-                                       int hash_size)
+                                       int hash_size, struct strbuf *scratch UNUSED)
 {
        struct string_view start = in;
        struct reftable_index_record *r = rec;
@@ -1086,6 +1114,13 @@ static int reftable_index_record_equal(const void *a, const void *b, int hash_si
        return ia->offset == ib->offset && !strbuf_cmp(&ia->last_key, &ib->last_key);
 }
 
+static int reftable_index_record_cmp(const void *_a, const void *_b)
+{
+       const struct reftable_index_record *a = _a;
+       const struct reftable_index_record *b = _b;
+       return strbuf_cmp(&a->last_key, &b->last_key);
+}
+
 static void reftable_index_record_print(const void *rec, int hash_size)
 {
        const struct reftable_index_record *idx = rec;
@@ -1103,6 +1138,7 @@ static struct reftable_record_vtable reftable_index_record_vtable = {
        .release = &reftable_index_record_release,
        .is_deletion = &not_a_deletion,
        .equal = &reftable_index_record_equal,
+       .cmp = &reftable_index_record_cmp,
        .print = &reftable_index_record_print,
 };
 
@@ -1111,11 +1147,6 @@ void reftable_record_key(struct reftable_record *rec, struct strbuf *dest)
        reftable_record_vtable(rec)->key(reftable_record_data(rec), dest);
 }
 
-uint8_t reftable_record_type(struct reftable_record *rec)
-{
-       return rec->type;
-}
-
 int reftable_record_encode(struct reftable_record *rec, struct string_view dest,
                           int hash_size)
 {
@@ -1139,10 +1170,12 @@ uint8_t reftable_record_val_type(struct reftable_record *rec)
 }
 
 int reftable_record_decode(struct reftable_record *rec, struct strbuf key,
-                          uint8_t extra, struct string_view src, int hash_size)
+                          uint8_t extra, struct string_view src, int hash_size,
+                          struct strbuf *scratch)
 {
        return reftable_record_vtable(rec)->decode(reftable_record_data(rec),
-                                                  key, extra, src, hash_size);
+                                                  key, extra, src, hash_size,
+                                                  scratch);
 }
 
 void reftable_record_release(struct reftable_record *rec)
@@ -1156,6 +1189,14 @@ int reftable_record_is_deletion(struct reftable_record *rec)
                reftable_record_data(rec));
 }
 
+int reftable_record_cmp(struct reftable_record *a, struct reftable_record *b)
+{
+       if (a->type != b->type)
+               BUG("cannot compare reftable records of different type");
+       return reftable_record_vtable(a)->cmp(
+               reftable_record_data(a), reftable_record_data(b));
+}
+
 int reftable_record_equal(struct reftable_record *a, struct reftable_record *b, int hash_size)
 {
        if (a->type != b->type)
@@ -1164,7 +1205,7 @@ int reftable_record_equal(struct reftable_record *a, struct reftable_record *b,
                reftable_record_data(a), reftable_record_data(b), hash_size);
 }
 
-static int hash_equal(uint8_t *a, uint8_t *b, int hash_size)
+static int hash_equal(const unsigned char *a, const unsigned char *b, int hash_size)
 {
        if (a && b)
                return !memcmp(a, b, hash_size);
@@ -1229,12 +1270,6 @@ int reftable_log_record_is_deletion(const struct reftable_log_record *log)
        return (log->value_type == REFTABLE_LOG_DELETION);
 }
 
-void string_view_consume(struct string_view *s, int n)
-{
-       s->buf += n;
-       s->len -= n;
-}
-
 static void *reftable_record_data(struct reftable_record *rec)
 {
        switch (rec->type) {
@@ -1266,45 +1301,22 @@ reftable_record_vtable(struct reftable_record *rec)
        abort();
 }
 
-struct reftable_record reftable_new_record(uint8_t typ)
+void reftable_record_init(struct reftable_record *rec, uint8_t typ)
 {
-       struct reftable_record clean = {
-               .type = typ,
-       };
+       memset(rec, 0, sizeof(*rec));
+       rec->type = typ;
 
-       /* the following is involved, but the naive solution (just return
-        * `clean` as is, except for BLOCK_TYPE_INDEX), returns a garbage
-        * clean.u.obj.offsets pointer on Windows VS CI.  Go figure.
-        */
        switch (typ) {
-       case BLOCK_TYPE_OBJ:
-       {
-               struct reftable_obj_record obj = { 0 };
-               clean.u.obj = obj;
-               break;
-       }
-       case BLOCK_TYPE_INDEX:
-       {
-               struct reftable_index_record idx = {
-                       .last_key = STRBUF_INIT,
-               };
-               clean.u.idx = idx;
-               break;
-       }
        case BLOCK_TYPE_REF:
-       {
-               struct reftable_ref_record ref = { 0 };
-               clean.u.ref = ref;
-               break;
-       }
        case BLOCK_TYPE_LOG:
-       {
-               struct reftable_log_record log = { 0 };
-               clean.u.log = log;
-               break;
-       }
+       case BLOCK_TYPE_OBJ:
+               return;
+       case BLOCK_TYPE_INDEX:
+               strbuf_init(&rec->u.idx.last_key, 0);
+               return;
+       default:
+               BUG("unhandled record type");
        }
-       return clean;
 }
 
 void reftable_record_print(struct reftable_record *rec, int hash_size)
index fd80cd451d5d4c3ffea93d5bb1c7a0014531fae9..826ee1c55c3b64d2bf4cfe1a170cf99ca3511259 100644 (file)
@@ -25,7 +25,11 @@ struct string_view {
 };
 
 /* Advance `s.buf` by `n`, and decrease length. */
-void string_view_consume(struct string_view *s, int n);
+static inline void string_view_consume(struct string_view *s, int n)
+{
+       s->buf += n;
+       s->len -= n;
+}
 
 /* utilities for de/encoding varints */
 
@@ -51,7 +55,8 @@ struct reftable_record_vtable {
 
        /* decode data from `src` into the record. */
        int (*decode)(void *rec, struct strbuf key, uint8_t extra,
-                     struct string_view src, int hash_size);
+                     struct string_view src, int hash_size,
+                     struct strbuf *scratch);
 
        /* deallocate and null the record. */
        void (*release)(void *rec);
@@ -62,6 +67,12 @@ struct reftable_record_vtable {
        /* Are two records equal? This assumes they have the same type. Returns 0 for non-equal. */
        int (*equal)(const void *a, const void *b, int hash_size);
 
+       /*
+        * Compare keys of two records with each other. The records must have
+        * the same type.
+        */
+       int (*cmp)(const void *a, const void *b);
+
        /* Print on stdout, for debugging. */
        void (*print)(const void *rec, int hash_size);
 };
@@ -69,18 +80,18 @@ struct reftable_record_vtable {
 /* returns true for recognized block types. Block start with the block type. */
 int reftable_is_block_type(uint8_t typ);
 
-/* return an initialized record for the given type */
-struct reftable_record reftable_new_record(uint8_t typ);
-
 /* Encode `key` into `dest`. Sets `is_restart` to indicate a restart. Returns
  * number of bytes written. */
 int reftable_encode_key(int *is_restart, struct string_view dest,
                        struct strbuf prev_key, struct strbuf key,
                        uint8_t extra);
 
-/* Decode into `key` and `extra` from `in` */
-int reftable_decode_key(struct strbuf *key, uint8_t *extra,
-                       struct strbuf last_key, struct string_view in);
+/*
+ * Decode into `last_key` and `extra` from `in`. `last_key` is expected to
+ * contain the decoded key of the preceding record, if any.
+ */
+int reftable_decode_key(struct strbuf *last_key, uint8_t *extra,
+                       struct string_view in);
 
 /* reftable_index_record are used internally to speed up lookups. */
 struct reftable_index_record {
@@ -100,8 +111,8 @@ struct reftable_obj_record {
 /* record is a generic wrapper for different types of records. It is normally
  * created on the stack, or embedded within another struct. If the type is
  * known, a fresh instance can be initialized explicitly. Otherwise, use
- * reftable_new_record() to initialize generically (as the index_record is not
- * valid as 0-initialized structure)
+ * `reftable_record_init()` to initialize generically (as the index_record is
+ * not valid as 0-initialized structure)
  */
 struct reftable_record {
        uint8_t type;
@@ -113,11 +124,14 @@ struct reftable_record {
        } u;
 };
 
+/* Initialize the reftable record for the given type */
+void reftable_record_init(struct reftable_record *rec, uint8_t typ);
+
 /* see struct record_vtable */
+int reftable_record_cmp(struct reftable_record *a, struct reftable_record *b);
 int reftable_record_equal(struct reftable_record *a, struct reftable_record *b, int hash_size);
 void reftable_record_print(struct reftable_record *rec, int hash_size);
 void reftable_record_key(struct reftable_record *rec, struct strbuf *dest);
-uint8_t reftable_record_type(struct reftable_record *rec);
 void reftable_record_copy_from(struct reftable_record *rec,
                               struct reftable_record *src, int hash_size);
 uint8_t reftable_record_val_type(struct reftable_record *rec);
@@ -125,9 +139,14 @@ int reftable_record_encode(struct reftable_record *rec, struct string_view dest,
                           int hash_size);
 int reftable_record_decode(struct reftable_record *rec, struct strbuf key,
                           uint8_t extra, struct string_view src,
-                          int hash_size);
+                          int hash_size, struct strbuf *scratch);
 int reftable_record_is_deletion(struct reftable_record *rec);
 
+static inline uint8_t reftable_record_type(struct reftable_record *rec)
+{
+       return rec->type;
+}
+
 /* frees and zeroes out the embedded record */
 void reftable_record_release(struct reftable_record *rec);
 
index 70ae78feca4f11cdb50f4fdcb08d90118bf487df..c158ee79ffe36a0bdf13259f83c4eef119f36981 100644 (file)
 
 static void test_copy(struct reftable_record *rec)
 {
-       struct reftable_record copy = { 0 };
+       struct reftable_record copy;
        uint8_t typ;
 
        typ = reftable_record_type(rec);
-       copy = reftable_new_record(typ);
+       reftable_record_init(&copy, typ);
        reftable_record_copy_from(&copy, rec, GIT_SHA1_RAWSZ);
        /* do it twice to catch memory leaks */
        reftable_record_copy_from(&copy, rec, GIT_SHA1_RAWSZ);
@@ -99,6 +99,7 @@ static void set_hash(uint8_t *h, int j)
 
 static void test_reftable_ref_record_roundtrip(void)
 {
+       struct strbuf scratch = STRBUF_INIT;
        int i = 0;
 
        for (i = REFTABLE_REF_DELETION; i < REFTABLE_NR_REF_VALUETYPES; i++) {
@@ -119,15 +120,10 @@ static void test_reftable_ref_record_roundtrip(void)
                case REFTABLE_REF_DELETION:
                        break;
                case REFTABLE_REF_VAL1:
-                       in.u.ref.value.val1 = reftable_malloc(GIT_SHA1_RAWSZ);
                        set_hash(in.u.ref.value.val1, 1);
                        break;
                case REFTABLE_REF_VAL2:
-                       in.u.ref.value.val2.value =
-                               reftable_malloc(GIT_SHA1_RAWSZ);
                        set_hash(in.u.ref.value.val2.value, 1);
-                       in.u.ref.value.val2.target_value =
-                               reftable_malloc(GIT_SHA1_RAWSZ);
                        set_hash(in.u.ref.value.val2.target_value, 2);
                        break;
                case REFTABLE_REF_SYMREF:
@@ -145,7 +141,7 @@ static void test_reftable_ref_record_roundtrip(void)
                EXPECT(n > 0);
 
                /* decode into a non-zero reftable_record to test for leaks. */
-               m = reftable_record_decode(&out, key, i, dest, GIT_SHA1_RAWSZ);
+               m = reftable_record_decode(&out, key, i, dest, GIT_SHA1_RAWSZ, &scratch);
                EXPECT(n == m);
 
                EXPECT(reftable_ref_record_equal(&in.u.ref, &out.u.ref,
@@ -155,6 +151,8 @@ static void test_reftable_ref_record_roundtrip(void)
                strbuf_release(&key);
                reftable_record_release(&out);
        }
+
+       strbuf_release(&scratch);
 }
 
 static void test_reftable_log_record_equal(void)
@@ -180,7 +178,6 @@ static void test_reftable_log_record_equal(void)
 static void test_reftable_log_record_roundtrip(void)
 {
        int i;
-
        struct reftable_log_record in[] = {
                {
                        .refname = xstrdup("refs/heads/master"),
@@ -188,8 +185,6 @@ static void test_reftable_log_record_roundtrip(void)
                        .value_type = REFTABLE_LOG_UPDATE,
                        .value = {
                                .update = {
-                                       .old_hash = reftable_malloc(GIT_SHA1_RAWSZ),
-                                       .new_hash = reftable_malloc(GIT_SHA1_RAWSZ),
                                        .name = xstrdup("han-wen"),
                                        .email = xstrdup("hanwen@google.com"),
                                        .message = xstrdup("test"),
@@ -207,15 +202,10 @@ static void test_reftable_log_record_roundtrip(void)
                        .refname = xstrdup("branch"),
                        .update_index = 33,
                        .value_type = REFTABLE_LOG_UPDATE,
-                       .value = {
-                               .update = {
-                                       .old_hash = reftable_malloc(GIT_SHA1_RAWSZ),
-                                       .new_hash = reftable_malloc(GIT_SHA1_RAWSZ),
-                                       /* rest of fields left empty. */
-                               },
-                       },
                }
        };
+       struct strbuf scratch = STRBUF_INIT;
+
        set_test_hash(in[0].value.update.new_hash, 1);
        set_test_hash(in[0].value.update.old_hash, 2);
        set_test_hash(in[2].value.update.new_hash, 3);
@@ -236,8 +226,6 @@ static void test_reftable_log_record_roundtrip(void)
                                .value_type = REFTABLE_LOG_UPDATE,
                                .value = {
                                        .update = {
-                                               .new_hash = reftable_calloc(GIT_SHA1_RAWSZ),
-                                               .old_hash = reftable_calloc(GIT_SHA1_RAWSZ),
                                                .name = xstrdup("old name"),
                                                .email = xstrdup("old@email"),
                                                .message = xstrdup("old message"),
@@ -257,7 +245,7 @@ static void test_reftable_log_record_roundtrip(void)
                EXPECT(n >= 0);
                valtype = reftable_record_val_type(&rec);
                m = reftable_record_decode(&out, key, valtype, dest,
-                                          GIT_SHA1_RAWSZ);
+                                          GIT_SHA1_RAWSZ, &scratch);
                EXPECT(n == m);
 
                EXPECT(reftable_log_record_equal(&in[i], &out.u.log,
@@ -266,6 +254,8 @@ static void test_reftable_log_record_roundtrip(void)
                strbuf_release(&key);
                reftable_record_release(&out);
        }
+
+       strbuf_release(&scratch);
 }
 
 static void test_u24_roundtrip(void)
@@ -300,7 +290,8 @@ static void test_key_roundtrip(void)
        EXPECT(!restart);
        EXPECT(n > 0);
 
-       m = reftable_decode_key(&roundtrip, &rt_extra, last_key, dest);
+       strbuf_addstr(&roundtrip, "refs/heads/master");
+       m = reftable_decode_key(&roundtrip, &rt_extra, dest);
        EXPECT(n == m);
        EXPECT(0 == strbuf_cmp(&key, &roundtrip));
        EXPECT(rt_extra == extra);
@@ -314,23 +305,27 @@ static void test_reftable_obj_record_roundtrip(void)
 {
        uint8_t testHash1[GIT_SHA1_RAWSZ] = { 1, 2, 3, 4, 0 };
        uint64_t till9[] = { 1, 2, 3, 4, 500, 600, 700, 800, 9000 };
-       struct reftable_obj_record recs[3] = { {
-                                                      .hash_prefix = testHash1,
-                                                      .hash_prefix_len = 5,
-                                                      .offsets = till9,
-                                                      .offset_len = 3,
-                                              },
-                                              {
-                                                      .hash_prefix = testHash1,
-                                                      .hash_prefix_len = 5,
-                                                      .offsets = till9,
-                                                      .offset_len = 9,
-                                              },
-                                              {
-                                                      .hash_prefix = testHash1,
-                                                      .hash_prefix_len = 5,
-                                              } };
+       struct reftable_obj_record recs[3] = {
+               {
+                       .hash_prefix = testHash1,
+                       .hash_prefix_len = 5,
+                       .offsets = till9,
+                       .offset_len = 3,
+               },
+               {
+                       .hash_prefix = testHash1,
+                       .hash_prefix_len = 5,
+                       .offsets = till9,
+                       .offset_len = 9,
+               },
+               {
+                       .hash_prefix = testHash1,
+                       .hash_prefix_len = 5,
+               },
+       };
+       struct strbuf scratch = STRBUF_INIT;
        int i = 0;
+
        for (i = 0; i < ARRAY_SIZE(recs); i++) {
                uint8_t buffer[1024] = { 0 };
                struct string_view dest = {
@@ -354,13 +349,15 @@ static void test_reftable_obj_record_roundtrip(void)
                EXPECT(n > 0);
                extra = reftable_record_val_type(&in);
                m = reftable_record_decode(&out, key, extra, dest,
-                                          GIT_SHA1_RAWSZ);
+                                          GIT_SHA1_RAWSZ, &scratch);
                EXPECT(n == m);
 
                EXPECT(reftable_record_equal(&in, &out, GIT_SHA1_RAWSZ));
                strbuf_release(&key);
                reftable_record_release(&out);
        }
+
+       strbuf_release(&scratch);
 }
 
 static void test_reftable_index_record_roundtrip(void)
@@ -377,6 +374,7 @@ static void test_reftable_index_record_roundtrip(void)
                .buf = buffer,
                .len = sizeof(buffer),
        };
+       struct strbuf scratch = STRBUF_INIT;
        struct strbuf key = STRBUF_INIT;
        struct reftable_record out = {
                .type = BLOCK_TYPE_INDEX,
@@ -394,13 +392,15 @@ static void test_reftable_index_record_roundtrip(void)
        EXPECT(n > 0);
 
        extra = reftable_record_val_type(&in);
-       m = reftable_record_decode(&out, key, extra, dest, GIT_SHA1_RAWSZ);
+       m = reftable_record_decode(&out, key, extra, dest, GIT_SHA1_RAWSZ,
+                                  &scratch);
        EXPECT(m == n);
 
        EXPECT(reftable_record_equal(&in, &out, GIT_SHA1_RAWSZ));
 
        reftable_record_release(&out);
        strbuf_release(&key);
+       strbuf_release(&scratch);
        strbuf_release(&in.u.idx.last_key);
 }
 
index 957349693247ae34c0b248a130e1e97f83ba1a71..7570e4acf9eec740057a4c6ba8a615878f48799f 100644 (file)
@@ -140,8 +140,8 @@ int validate_ref_record_addition(struct reftable_table tab,
 {
        struct modification mod = {
                .tab = tab,
-               .add = reftable_calloc(sizeof(char *) * sz),
-               .del = reftable_calloc(sizeof(char *) * sz),
+               .add = reftable_calloc(sz, sizeof(*mod.add)),
+               .del = reftable_calloc(sz, sizeof(*mod.del)),
        };
        int i = 0;
        int err = 0;
index 8645cd93bbd8f9b51e05eb9143ed99217bfa1035..b9cc62554ea1569a66e8fc08be40e04452e3032c 100644 (file)
@@ -9,7 +9,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "basics.h"
 #include "block.h"
 #include "blocksource.h"
-#include "constants.h"
 #include "reader.h"
 #include "record.h"
 #include "refname.h"
@@ -31,7 +30,7 @@ static void test_conflict(void)
        struct reftable_write_options opts = { 0 };
        struct strbuf buf = STRBUF_INIT;
        struct reftable_writer *w =
-               reftable_new_writer(&strbuf_add_void, &buf, &opts);
+               reftable_new_writer(&strbuf_add_void, &noop_flush, &buf, &opts);
        struct reftable_ref_record rec = {
                .refname = "a/b",
                .value_type = REFTABLE_REF_SYMREF,
index 1a6d16915ab453b480f0ca657448034a11ddf6be..c91a2d83a2b8a956e4b2d4999b4548ed1860269b 100644 (file)
@@ -33,7 +33,7 @@ struct reftable_table;
    the stack array.
 */
 int reftable_new_merged_table(struct reftable_merged_table **dest,
-                             struct reftable_table *stack, int n,
+                             struct reftable_table *stack, size_t n,
                              uint32_t hash_id);
 
 /* returns an iterator positioned just before 'name' */
index 67104f8fbfecd7984127d29dd1ae3fa9bb263394..2a2943cd134cebf1e6b9713613ba228d49576281 100644 (file)
@@ -9,6 +9,7 @@ https://developers.google.com/open-source/licenses/bsd
 #ifndef REFTABLE_RECORD_H
 #define REFTABLE_RECORD_H
 
+#include "hash-ll.h"
 #include <stdint.h>
 
 /*
@@ -21,6 +22,7 @@ https://developers.google.com/open-source/licenses/bsd
 /* reftable_ref_record holds a ref database entry target_value */
 struct reftable_ref_record {
        char *refname; /* Name of the ref, malloced. */
+       size_t refname_cap;
        uint64_t update_index; /* Logical timestamp at which this value is
                                * written */
 
@@ -38,10 +40,10 @@ struct reftable_ref_record {
 #define REFTABLE_NR_REF_VALUETYPES 4
        } value_type;
        union {
-               uint8_t *val1; /* malloced hash. */
+               unsigned char val1[GIT_MAX_RAWSZ];
                struct {
-                       uint8_t *value; /* first value, malloced hash  */
-                       uint8_t *target_value; /* second value, malloced hash */
+                       unsigned char value[GIT_MAX_RAWSZ]; /* first hash  */
+                       unsigned char target_value[GIT_MAX_RAWSZ]; /* second hash */
                } val2;
                char *symref; /* referent, malloced 0-terminated string */
        } value;
@@ -49,11 +51,11 @@ struct reftable_ref_record {
 
 /* Returns the first hash, or NULL if `rec` is not of type
  * REFTABLE_REF_VAL1 or REFTABLE_REF_VAL2. */
-uint8_t *reftable_ref_record_val1(const struct reftable_ref_record *rec);
+const unsigned char *reftable_ref_record_val1(const struct reftable_ref_record *rec);
 
 /* Returns the second hash, or NULL if `rec` is not of type
  * REFTABLE_REF_VAL2. */
-uint8_t *reftable_ref_record_val2(const struct reftable_ref_record *rec);
+const unsigned char *reftable_ref_record_val2(const struct reftable_ref_record *rec);
 
 /* returns whether 'ref' represents a deletion */
 int reftable_ref_record_is_deletion(const struct reftable_ref_record *ref);
@@ -72,6 +74,7 @@ int reftable_ref_record_equal(const struct reftable_ref_record *a,
 /* reftable_log_record holds a reflog entry */
 struct reftable_log_record {
        char *refname;
+       size_t refname_cap;
        uint64_t update_index; /* logical timestamp of a transactional update.
                                */
 
@@ -86,13 +89,14 @@ struct reftable_log_record {
 
        union {
                struct {
-                       uint8_t *new_hash;
-                       uint8_t *old_hash;
+                       unsigned char new_hash[GIT_MAX_RAWSZ];
+                       unsigned char old_hash[GIT_MAX_RAWSZ];
                        char *name;
                        char *email;
                        uint64_t time;
                        int16_t tz_offset;
                        char *message;
+                       size_t message_cap;
                } update;
        } value;
 };
index db8de197f6c42a0de203fc1fbca8174f7f4d2938..7c7cae5f99b7cd4c2be74707bb550366e1088a35 100644 (file)
@@ -88,6 +88,7 @@ struct reftable_stats {
 /* reftable_new_writer creates a new writer */
 struct reftable_writer *
 reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
+                   int (*flush_func)(void *),
                    void *writer_arg, struct reftable_write_options *opts);
 
 /* Set the range of update indices for the records we will add. When writing a
index ddbdf1b9c8bf4668dfe4f9b7c03cabd43effb660..1ecf1b9751ce4975580ab7deed2bbe2a9a7847bc 100644 (file)
@@ -8,6 +8,7 @@ https://developers.google.com/open-source/licenses/bsd
 
 #include "stack.h"
 
+#include "../write-or-die.h"
 #include "system.h"
 #include "merged.h"
 #include "reader.h"
@@ -16,13 +17,15 @@ https://developers.google.com/open-source/licenses/bsd
 #include "reftable-record.h"
 #include "reftable-merged.h"
 #include "writer.h"
+#include "tempfile.h"
 
 static int stack_try_add(struct reftable_stack *st,
                         int (*write_table)(struct reftable_writer *wr,
                                            void *arg),
                         void *arg);
 static int stack_write_compact(struct reftable_stack *st,
-                              struct reftable_writer *wr, int first, int last,
+                              struct reftable_writer *wr,
+                              size_t first, size_t last,
                               struct reftable_log_expiry_config *config);
 static int stack_check_addition(struct reftable_stack *st,
                                const char *new_tab_name);
@@ -42,14 +45,20 @@ static void stack_filename(struct strbuf *dest, struct reftable_stack *st,
 static ssize_t reftable_fd_write(void *arg, const void *data, size_t sz)
 {
        int *fdp = (int *)arg;
-       return write(*fdp, data, sz);
+       return write_in_full(*fdp, data, sz);
+}
+
+static int reftable_fd_flush(void *arg)
+{
+       int *fdp = (int *)arg;
+
+       return fsync_component(FSYNC_COMPONENT_REFERENCE, *fdp);
 }
 
 int reftable_new_stack(struct reftable_stack **dest, const char *dir,
                       struct reftable_write_options config)
 {
-       struct reftable_stack *p =
-               reftable_calloc(sizeof(struct reftable_stack));
+       struct reftable_stack *p = reftable_calloc(1, sizeof(*p));
        struct strbuf list_file_name = STRBUF_INIT;
        int err = 0;
 
@@ -64,6 +73,7 @@ int reftable_new_stack(struct reftable_stack **dest, const char *dir,
        strbuf_addstr(&list_file_name, "/tables.list");
 
        p->list_file = strbuf_detach(&list_file_name, NULL);
+       p->list_fd = -1;
        p->reftable_dir = xstrdup(dir);
        p->config = config;
 
@@ -91,8 +101,8 @@ static int fd_read_lines(int fd, char ***namesp)
                goto done;
        }
 
-       buf = reftable_malloc(size + 1);
-       if (read(fd, buf, size) != size) {
+       REFTABLE_ALLOC_ARRAY(buf, size + 1);
+       if (read_in_full(fd, buf, size) != size) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
@@ -111,7 +121,7 @@ int read_lines(const char *filename, char ***namesp)
        int err = 0;
        if (fd < 0) {
                if (errno == ENOENT) {
-                       *namesp = reftable_calloc(sizeof(char *));
+                       REFTABLE_CALLOC_ARRAY(*namesp, 1);
                        return 0;
                }
 
@@ -173,6 +183,12 @@ void reftable_stack_destroy(struct reftable_stack *st)
                st->readers_len = 0;
                FREE_AND_NULL(st->readers);
        }
+
+       if (st->list_fd >= 0) {
+               close(st->list_fd);
+               st->list_fd = -1;
+       }
+
        FREE_AND_NULL(st->list_file);
        FREE_AND_NULL(st->reftable_dir);
        reftable_free(st);
@@ -182,8 +198,7 @@ void reftable_stack_destroy(struct reftable_stack *st)
 static struct reftable_reader **stack_copy_readers(struct reftable_stack *st,
                                                   int cur_len)
 {
-       struct reftable_reader **cur =
-               reftable_calloc(sizeof(struct reftable_reader *) * cur_len);
+       struct reftable_reader **cur = reftable_calloc(cur_len, sizeof(*cur));
        int i = 0;
        for (i = 0; i < cur_len; i++) {
                cur[i] = st->readers[i];
@@ -194,17 +209,18 @@ static struct reftable_reader **stack_copy_readers(struct reftable_stack *st,
 static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
                                      int reuse_open)
 {
-       int cur_len = !st->merged ? 0 : st->merged->stack_len;
+       size_t cur_len = !st->merged ? 0 : st->merged->stack_len;
        struct reftable_reader **cur = stack_copy_readers(st, cur_len);
-       int err = 0;
-       int names_len = names_length(names);
+       size_t names_len = names_length(names);
        struct reftable_reader **new_readers =
-               reftable_calloc(sizeof(struct reftable_reader *) * names_len);
+               reftable_calloc(names_len, sizeof(*new_readers));
        struct reftable_table *new_tables =
-               reftable_calloc(sizeof(struct reftable_table) * names_len);
-       int new_readers_len = 0;
+               reftable_calloc(names_len, sizeof(*new_tables));
+       size_t new_readers_len = 0;
        struct reftable_merged_table *new_merged = NULL;
-       int i;
+       struct strbuf table_path = STRBUF_INIT;
+       int err = 0;
+       size_t i;
 
        while (*names) {
                struct reftable_reader *rd = NULL;
@@ -212,24 +228,20 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
 
                /* this is linear; we assume compaction keeps the number of
                   tables under control so this is not quadratic. */
-               int j = 0;
-               for (j = 0; reuse_open && j < cur_len; j++) {
-                       if (cur[j] && 0 == strcmp(cur[j]->name, name)) {
-                               rd = cur[j];
-                               cur[j] = NULL;
+               for (i = 0; reuse_open && i < cur_len; i++) {
+                       if (cur[i] && 0 == strcmp(cur[i]->name, name)) {
+                               rd = cur[i];
+                               cur[i] = NULL;
                                break;
                        }
                }
 
                if (!rd) {
                        struct reftable_block_source src = { NULL };
-                       struct strbuf table_path = STRBUF_INIT;
                        stack_filename(&table_path, st, name);
 
                        err = reftable_block_source_from_file(&src,
                                                              table_path.buf);
-                       strbuf_release(&table_path);
-
                        if (err < 0)
                                goto done;
 
@@ -267,16 +279,13 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
        for (i = 0; i < cur_len; i++) {
                if (cur[i]) {
                        const char *name = reader_name(cur[i]);
-                       struct strbuf filename = STRBUF_INIT;
-                       stack_filename(&filename, st, name);
+                       stack_filename(&table_path, st, name);
 
                        reader_close(cur[i]);
                        reftable_reader_free(cur[i]);
 
                        /* On Windows, can only unlink after closing. */
-                       unlink(filename.buf);
-
-                       strbuf_release(&filename);
+                       unlink(table_path.buf);
                }
        }
 
@@ -288,6 +297,7 @@ done:
        reftable_free(new_readers);
        reftable_free(new_tables);
        reftable_free(cur);
+       strbuf_release(&table_path);
        return err;
 }
 
@@ -306,69 +316,134 @@ static int tv_cmp(struct timeval *a, struct timeval *b)
 static int reftable_stack_reload_maybe_reuse(struct reftable_stack *st,
                                             int reuse_open)
 {
-       struct timeval deadline = { 0 };
-       int err = gettimeofday(&deadline, NULL);
+       char **names = NULL, **names_after = NULL;
+       struct timeval deadline;
        int64_t delay = 0;
-       int tries = 0;
-       if (err < 0)
-               return err;
+       int tries = 0, err;
+       int fd = -1;
 
+       err = gettimeofday(&deadline, NULL);
+       if (err < 0)
+               goto out;
        deadline.tv_sec += 3;
+
        while (1) {
-               char **names = NULL;
-               char **names_after = NULL;
-               struct timeval now = { 0 };
-               int err = gettimeofday(&now, NULL);
-               int err2 = 0;
-               if (err < 0) {
-                       return err;
-               }
+               struct timeval now;
+
+               err = gettimeofday(&now, NULL);
+               if (err < 0)
+                       goto out;
 
-               /* Only look at deadlines after the first few times. This
-                  simplifies debugging in GDB */
+               /*
+                * Only look at deadlines after the first few times. This
+                * simplifies debugging in GDB.
+                */
                tries++;
-               if (tries > 3 && tv_cmp(&now, &deadline) >= 0) {
-                       break;
-               }
+               if (tries > 3 && tv_cmp(&now, &deadline) >= 0)
+                       goto out;
 
-               err = read_lines(st->list_file, &names);
-               if (err < 0) {
-                       free_names(names);
-                       return err;
-               }
-               err = reftable_stack_reload_once(st, names, reuse_open);
-               if (err == 0) {
-                       free_names(names);
-                       break;
-               }
-               if (err != REFTABLE_NOT_EXIST_ERROR) {
-                       free_names(names);
-                       return err;
-               }
+               fd = open(st->list_file, O_RDONLY);
+               if (fd < 0) {
+                       if (errno != ENOENT) {
+                               err = REFTABLE_IO_ERROR;
+                               goto out;
+                       }
 
-               /* err == REFTABLE_NOT_EXIST_ERROR can be caused by a concurrent
-                  writer. Check if there was one by checking if the name list
-                  changed.
-               */
-               err2 = read_lines(st->list_file, &names_after);
-               if (err2 < 0) {
-                       free_names(names);
-                       return err2;
+                       REFTABLE_CALLOC_ARRAY(names, 1);
+               } else {
+                       err = fd_read_lines(fd, &names);
+                       if (err < 0)
+                               goto out;
                }
 
+               err = reftable_stack_reload_once(st, names, reuse_open);
+               if (!err)
+                       break;
+               if (err != REFTABLE_NOT_EXIST_ERROR)
+                       goto out;
+
+               /*
+                * REFTABLE_NOT_EXIST_ERROR can be caused by a concurrent
+                * writer. Check if there was one by checking if the name list
+                * changed.
+                */
+               err = read_lines(st->list_file, &names_after);
+               if (err < 0)
+                       goto out;
                if (names_equal(names_after, names)) {
-                       free_names(names);
-                       free_names(names_after);
-                       return err;
+                       err = REFTABLE_NOT_EXIST_ERROR;
+                       goto out;
                }
+
                free_names(names);
+               names = NULL;
                free_names(names_after);
+               names_after = NULL;
+               close(fd);
+               fd = -1;
 
                delay = delay + (delay * rand()) / RAND_MAX + 1;
                sleep_millisec(delay);
        }
 
-       return 0;
+out:
+       /*
+        * Invalidate the stat cache. It is sufficient to only close the file
+        * descriptor and keep the cached stat info because we never use the
+        * latter when the former is negative.
+        */
+       if (st->list_fd >= 0) {
+               close(st->list_fd);
+               st->list_fd = -1;
+       }
+
+       /*
+        * Cache stat information in case it provides a useful signal to us.
+        * According to POSIX, "The st_ino and st_dev fields taken together
+        * uniquely identify the file within the system." That being said,
+        * Windows is not POSIX compliant and we do not have these fields
+        * available. So the information we have there is insufficient to
+        * determine whether two file descriptors point to the same file.
+        *
+        * While we could fall back to using other signals like the file's
+        * mtime, those are not sufficient to avoid races. We thus refrain from
+        * using the stat cache on such systems and fall back to the secondary
+        * caching mechanism, which is to check whether contents of the file
+        * have changed.
+        *
+        * On other systems which are POSIX compliant we must keep the file
+        * descriptor open. This is to avoid a race condition where two
+        * processes access the reftable stack at the same point in time:
+        *
+        *   1. A reads the reftable stack and caches its stat info.
+        *
+        *   2. B updates the stack, appending a new table to "tables.list".
+        *      This will both use a new inode and result in a different file
+        *      size, thus invalidating A's cache in theory.
+        *
+        *   3. B decides to auto-compact the stack and merges two tables. The
+        *      file size now matches what A has cached again. Furthermore, the
+        *      filesystem may decide to recycle the inode number of the file
+        *      we have replaced in (2) because it is not in use anymore.
+        *
+        *   4. A reloads the reftable stack. Neither the inode number nor the
+        *      file size changed. If the timestamps did not change either then
+        *      we think the cached copy of our stack is up-to-date.
+        *
+        * By keeping the file descriptor open the inode number cannot be
+        * recycled, mitigating the race.
+        */
+       if (!err && fd >= 0 && !fstat(fd, &st->list_st) &&
+           st->list_st.st_dev && st->list_st.st_ino) {
+               st->list_fd = fd;
+               fd = -1;
+       }
+
+       if (fd >= 0)
+               close(fd);
+       free_names(names);
+       free_names(names_after);
+       return err;
 }
 
 /* -1 = error
@@ -377,8 +452,44 @@ static int reftable_stack_reload_maybe_reuse(struct reftable_stack *st,
 static int stack_uptodate(struct reftable_stack *st)
 {
        char **names = NULL;
-       int err = read_lines(st->list_file, &names);
+       int err;
        int i = 0;
+
+       /*
+        * When we have cached stat information available then we use it to
+        * verify whether the file has been rewritten.
+        *
+        * Note that we explicitly do not want to use `stat_validity_check()`
+        * and friends here because they may end up not comparing the `st_dev`
+        * and `st_ino` fields. These functions thus cannot guarantee that we
+        * indeed still have the same file.
+        */
+       if (st->list_fd >= 0) {
+               struct stat list_st;
+
+               if (stat(st->list_file, &list_st) < 0) {
+                       /*
+                        * It's fine for "tables.list" to not exist. In that
+                        * case, we have to refresh when the loaded stack has
+                        * any readers.
+                        */
+                       if (errno == ENOENT)
+                               return !!st->readers_len;
+                       return REFTABLE_IO_ERROR;
+               }
+
+               /*
+                * When "tables.list" refers to the same file we can assume
+                * that it didn't change. This is because we always use
+                * rename(3P) to update the file and never write to it
+                * directly.
+                */
+               if (st->list_st.st_dev == list_st.st_dev &&
+                   st->list_st.st_ino == list_st.st_ino)
+                       return 0;
+       }
+
+       err = read_lines(st->list_file, &names);
        if (err < 0)
                return err;
 
@@ -427,16 +538,13 @@ int reftable_stack_add(struct reftable_stack *st,
                return err;
        }
 
-       if (!st->disable_auto_compact)
-               return reftable_stack_auto_compact(st);
-
        return 0;
 }
 
 static void format_name(struct strbuf *dest, uint64_t min, uint64_t max)
 {
        char buf[100];
-       uint32_t rnd = (uint32_t)rand();
+       uint32_t rnd = (uint32_t)git_rand();
        snprintf(buf, sizeof(buf), "0x%012" PRIx64 "-0x%012" PRIx64 "-%08x",
                 min, max, rnd);
        strbuf_reset(dest);
@@ -444,33 +552,27 @@ static void format_name(struct strbuf *dest, uint64_t min, uint64_t max)
 }
 
 struct reftable_addition {
-       int lock_file_fd;
-       struct strbuf lock_file_name;
+       struct tempfile *lock_file;
        struct reftable_stack *stack;
 
        char **new_tables;
-       int new_tables_len;
+       size_t new_tables_len, new_tables_cap;
        uint64_t next_update_index;
 };
 
-#define REFTABLE_ADDITION_INIT                \
-       {                                     \
-               .lock_file_name = STRBUF_INIT \
-       }
+#define REFTABLE_ADDITION_INIT {0}
 
 static int reftable_stack_init_addition(struct reftable_addition *add,
                                        struct reftable_stack *st)
 {
+       struct strbuf lock_file_name = STRBUF_INIT;
        int err = 0;
        add->stack = st;
 
-       strbuf_reset(&add->lock_file_name);
-       strbuf_addstr(&add->lock_file_name, st->list_file);
-       strbuf_addstr(&add->lock_file_name, ".lock");
+       strbuf_addf(&lock_file_name, "%s.lock", st->list_file);
 
-       add->lock_file_fd = open(add->lock_file_name.buf,
-                                O_EXCL | O_CREAT | O_WRONLY, 0666);
-       if (add->lock_file_fd < 0) {
+       add->lock_file = create_tempfile(lock_file_name.buf);
+       if (!add->lock_file) {
                if (errno == EEXIST) {
                        err = REFTABLE_LOCK_ERROR;
                } else {
@@ -479,7 +581,7 @@ static int reftable_stack_init_addition(struct reftable_addition *add,
                goto done;
        }
        if (st->config.default_permissions) {
-               if (chmod(add->lock_file_name.buf, st->config.default_permissions) < 0) {
+               if (chmod(add->lock_file->filename.buf, st->config.default_permissions) < 0) {
                        err = REFTABLE_IO_ERROR;
                        goto done;
                }
@@ -499,13 +601,15 @@ done:
        if (err) {
                reftable_addition_close(add);
        }
+       strbuf_release(&lock_file_name);
        return err;
 }
 
 static void reftable_addition_close(struct reftable_addition *add)
 {
-       int i = 0;
        struct strbuf nm = STRBUF_INIT;
+       size_t i;
+
        for (i = 0; i < add->new_tables_len; i++) {
                stack_filename(&nm, add->stack, add->new_tables[i]);
                unlink(nm.buf);
@@ -515,16 +619,9 @@ static void reftable_addition_close(struct reftable_addition *add)
        reftable_free(add->new_tables);
        add->new_tables = NULL;
        add->new_tables_len = 0;
+       add->new_tables_cap = 0;
 
-       if (add->lock_file_fd > 0) {
-               close(add->lock_file_fd);
-               add->lock_file_fd = 0;
-       }
-       if (add->lock_file_name.len > 0) {
-               unlink(add->lock_file_name.buf);
-               strbuf_release(&add->lock_file_name);
-       }
-
+       delete_tempfile(&add->lock_file);
        strbuf_release(&nm);
 }
 
@@ -540,8 +637,10 @@ void reftable_addition_destroy(struct reftable_addition *add)
 int reftable_addition_commit(struct reftable_addition *add)
 {
        struct strbuf table_list = STRBUF_INIT;
-       int i = 0;
+       int lock_file_fd = get_tempfile_fd(add->lock_file);
        int err = 0;
+       size_t i;
+
        if (add->new_tables_len == 0)
                goto done;
 
@@ -554,36 +653,37 @@ int reftable_addition_commit(struct reftable_addition *add)
                strbuf_addstr(&table_list, "\n");
        }
 
-       err = write(add->lock_file_fd, table_list.buf, table_list.len);
+       err = write_in_full(lock_file_fd, table_list.buf, table_list.len);
        strbuf_release(&table_list);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
 
-       err = close(add->lock_file_fd);
-       add->lock_file_fd = 0;
-       if (err < 0) {
-               err = REFTABLE_IO_ERROR;
-               goto done;
-       }
+       fsync_component_or_die(FSYNC_COMPONENT_REFERENCE, lock_file_fd,
+                              get_tempfile_path(add->lock_file));
 
-       err = rename(add->lock_file_name.buf, add->stack->list_file);
+       err = rename_tempfile(&add->lock_file, add->stack->list_file);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
 
        /* success, no more state to clean up. */
-       strbuf_release(&add->lock_file_name);
-       for (i = 0; i < add->new_tables_len; i++) {
+       for (i = 0; i < add->new_tables_len; i++)
                reftable_free(add->new_tables[i]);
-       }
        reftable_free(add->new_tables);
        add->new_tables = NULL;
        add->new_tables_len = 0;
+       add->new_tables_cap = 0;
+
+       err = reftable_stack_reload_maybe_reuse(add->stack, 1);
+       if (err)
+               goto done;
+
+       if (!add->stack->disable_auto_compact)
+               err = reftable_stack_auto_compact(add->stack);
 
-       err = reftable_stack_reload(add->stack);
 done:
        reftable_addition_close(add);
        return err;
@@ -594,7 +694,7 @@ int reftable_stack_new_addition(struct reftable_addition **dest,
 {
        int err = 0;
        struct reftable_addition empty = REFTABLE_ADDITION_INIT;
-       *dest = reftable_calloc(sizeof(**dest));
+       REFTABLE_CALLOC_ARRAY(*dest, 1);
        **dest = empty;
        err = reftable_stack_init_addition(*dest, st);
        if (err) {
@@ -637,8 +737,9 @@ int reftable_addition_add(struct reftable_addition *add,
        struct strbuf tab_file_name = STRBUF_INIT;
        struct strbuf next_name = STRBUF_INIT;
        struct reftable_writer *wr = NULL;
+       struct tempfile *tab_file = NULL;
        int err = 0;
-       int tab_fd = 0;
+       int tab_fd;
 
        strbuf_reset(&next_name);
        format_name(&next_name, add->next_update_index, add->next_update_index);
@@ -646,18 +747,21 @@ int reftable_addition_add(struct reftable_addition *add,
        stack_filename(&temp_tab_file_name, add->stack, next_name.buf);
        strbuf_addstr(&temp_tab_file_name, ".temp.XXXXXX");
 
-       tab_fd = mkstemp(temp_tab_file_name.buf);
-       if (tab_fd < 0) {
+       tab_file = mks_tempfile(temp_tab_file_name.buf);
+       if (!tab_file) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
        if (add->stack->config.default_permissions) {
-               if (chmod(temp_tab_file_name.buf, add->stack->config.default_permissions)) {
+               if (chmod(get_tempfile_path(tab_file),
+                         add->stack->config.default_permissions)) {
                        err = REFTABLE_IO_ERROR;
                        goto done;
                }
        }
-       wr = reftable_new_writer(reftable_fd_write, &tab_fd,
+       tab_fd = get_tempfile_fd(tab_file);
+
+       wr = reftable_new_writer(reftable_fd_write, reftable_fd_flush, &tab_fd,
                                 &add->stack->config);
        err = write_table(wr, arg);
        if (err < 0)
@@ -671,14 +775,13 @@ int reftable_addition_add(struct reftable_addition *add,
        if (err < 0)
                goto done;
 
-       err = close(tab_fd);
-       tab_fd = 0;
+       err = close_tempfile_gently(tab_file);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
 
-       err = stack_check_addition(add->stack, temp_tab_file_name.buf);
+       err = stack_check_addition(add->stack, get_tempfile_path(tab_file));
        if (err < 0)
                goto done;
 
@@ -689,33 +792,23 @@ int reftable_addition_add(struct reftable_addition *add,
 
        format_name(&next_name, wr->min_update_index, wr->max_update_index);
        strbuf_addstr(&next_name, ".ref");
-
        stack_filename(&tab_file_name, add->stack, next_name.buf);
 
        /*
          On windows, this relies on rand() picking a unique destination name.
          Maybe we should do retry loop as well?
         */
-       err = rename(temp_tab_file_name.buf, tab_file_name.buf);
+       err = rename_tempfile(&tab_file, tab_file_name.buf);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
 
-       add->new_tables = reftable_realloc(add->new_tables,
-                                          sizeof(*add->new_tables) *
-                                                  (add->new_tables_len + 1));
-       add->new_tables[add->new_tables_len] = strbuf_detach(&next_name, NULL);
-       add->new_tables_len++;
+       REFTABLE_ALLOC_GROW(add->new_tables, add->new_tables_len + 1,
+                           add->new_tables_cap);
+       add->new_tables[add->new_tables_len++] = strbuf_detach(&next_name, NULL);
 done:
-       if (tab_fd > 0) {
-               close(tab_fd);
-               tab_fd = 0;
-       }
-       if (temp_tab_file_name.len > 0) {
-               unlink(temp_tab_file_name.buf);
-       }
-
+       delete_tempfile(&tab_file);
        strbuf_release(&temp_tab_file_name);
        strbuf_release(&tab_file_name);
        strbuf_release(&next_name);
@@ -732,66 +825,77 @@ uint64_t reftable_stack_next_update_index(struct reftable_stack *st)
        return 1;
 }
 
-static int stack_compact_locked(struct reftable_stack *st, int first, int last,
-                               struct strbuf *temp_tab,
-                               struct reftable_log_expiry_config *config)
+static int stack_compact_locked(struct reftable_stack *st,
+                               size_t first, size_t last,
+                               struct reftable_log_expiry_config *config,
+                               struct tempfile **tab_file_out)
 {
        struct strbuf next_name = STRBUF_INIT;
-       int tab_fd = -1;
+       struct strbuf tab_file_path = STRBUF_INIT;
        struct reftable_writer *wr = NULL;
-       int err = 0;
+       struct tempfile *tab_file;
+       int tab_fd, err = 0;
 
        format_name(&next_name,
                    reftable_reader_min_update_index(st->readers[first]),
                    reftable_reader_max_update_index(st->readers[last]));
+       stack_filename(&tab_file_path, st, next_name.buf);
+       strbuf_addstr(&tab_file_path, ".temp.XXXXXX");
 
-       stack_filename(temp_tab, st, next_name.buf);
-       strbuf_addstr(temp_tab, ".temp.XXXXXX");
+       tab_file = mks_tempfile(tab_file_path.buf);
+       if (!tab_file) {
+               err = REFTABLE_IO_ERROR;
+               goto done;
+       }
+       tab_fd = get_tempfile_fd(tab_file);
 
-       tab_fd = mkstemp(temp_tab->buf);
-       wr = reftable_new_writer(reftable_fd_write, &tab_fd, &st->config);
+       if (st->config.default_permissions &&
+           chmod(get_tempfile_path(tab_file), st->config.default_permissions) < 0) {
+               err = REFTABLE_IO_ERROR;
+               goto done;
+       }
 
+       wr = reftable_new_writer(reftable_fd_write, reftable_fd_flush,
+                                &tab_fd, &st->config);
        err = stack_write_compact(st, wr, first, last, config);
        if (err < 0)
                goto done;
+
        err = reftable_writer_close(wr);
        if (err < 0)
                goto done;
 
-       err = close(tab_fd);
-       tab_fd = 0;
+       err = close_tempfile_gently(tab_file);
+       if (err < 0)
+               goto done;
+
+       *tab_file_out = tab_file;
+       tab_file = NULL;
 
 done:
+       delete_tempfile(&tab_file);
        reftable_writer_free(wr);
-       if (tab_fd > 0) {
-               close(tab_fd);
-               tab_fd = 0;
-       }
-       if (err != 0 && temp_tab->len > 0) {
-               unlink(temp_tab->buf);
-               strbuf_release(temp_tab);
-       }
        strbuf_release(&next_name);
+       strbuf_release(&tab_file_path);
        return err;
 }
 
 static int stack_write_compact(struct reftable_stack *st,
-                              struct reftable_writer *wr, int first, int last,
+                              struct reftable_writer *wr,
+                              size_t first, size_t last,
                               struct reftable_log_expiry_config *config)
 {
-       int subtabs_len = last - first + 1;
+       size_t subtabs_len = last - first + 1;
        struct reftable_table *subtabs = reftable_calloc(
-               sizeof(struct reftable_table) * (last - first + 1));
+               last - first + 1, sizeof(*subtabs));
        struct reftable_merged_table *mt = NULL;
-       int err = 0;
        struct reftable_iterator it = { NULL };
        struct reftable_ref_record ref = { NULL };
        struct reftable_log_record log = { NULL };
-
        uint64_t entries = 0;
+       int err = 0;
 
-       int i = 0, j = 0;
-       for (i = first, j = 0; i <= last; i++) {
+       for (size_t i = first, j = 0; i <= last; i++) {
                struct reftable_reader *t = st->readers[i];
                reftable_table_from_reader(&subtabs[j++], t);
                st->stats.bytes += t->size;
@@ -816,18 +920,16 @@ static int stack_write_compact(struct reftable_stack *st,
                        err = 0;
                        break;
                }
-               if (err < 0) {
-                       break;
-               }
+               if (err < 0)
+                       goto done;
 
                if (first == 0 && reftable_ref_record_is_deletion(&ref)) {
                        continue;
                }
 
                err = reftable_writer_add_ref(wr, &ref);
-               if (err < 0) {
-                       break;
-               }
+               if (err < 0)
+                       goto done;
                entries++;
        }
        reftable_iterator_destroy(&it);
@@ -842,9 +944,8 @@ static int stack_write_compact(struct reftable_stack *st,
                        err = 0;
                        break;
                }
-               if (err < 0) {
-                       break;
-               }
+               if (err < 0)
+                       goto done;
                if (first == 0 && reftable_log_record_is_deletion(&log)) {
                        continue;
                }
@@ -860,9 +961,8 @@ static int stack_write_compact(struct reftable_stack *st,
                }
 
                err = reftable_writer_add_log(wr, &log);
-               if (err < 0) {
-                       break;
-               }
+               if (err < 0)
+                       goto done;
                entries++;
        }
 
@@ -879,26 +979,19 @@ done:
 }
 
 /* <  0: error. 0 == OK, > 0 attempt failed; could retry. */
-static int stack_compact_range(struct reftable_stack *st, int first, int last,
+static int stack_compact_range(struct reftable_stack *st,
+                              size_t first, size_t last,
                               struct reftable_log_expiry_config *expiry)
 {
-       struct strbuf temp_tab_file_name = STRBUF_INIT;
+       struct strbuf tables_list_buf = STRBUF_INIT;
        struct strbuf new_table_name = STRBUF_INIT;
-       struct strbuf lock_file_name = STRBUF_INIT;
-       struct strbuf ref_list_contents = STRBUF_INIT;
        struct strbuf new_table_path = STRBUF_INIT;
-       int err = 0;
-       int have_lock = 0;
-       int lock_file_fd = -1;
-       int compact_count = last - first + 1;
-       char **listp = NULL;
-       char **delete_on_success =
-               reftable_calloc(sizeof(char *) * (compact_count + 1));
-       char **subtable_locks =
-               reftable_calloc(sizeof(char *) * (compact_count + 1));
-       int i = 0;
-       int j = 0;
-       int is_empty_table = 0;
+       struct strbuf table_name = STRBUF_INIT;
+       struct lock_file tables_list_lock = LOCK_INIT;
+       struct lock_file *table_locks = NULL;
+       struct tempfile *new_table = NULL;
+       int is_empty_table = 0, err = 0;
+       size_t i;
 
        if (first > last || (!expiry && first == last)) {
                err = 0;
@@ -907,196 +1000,200 @@ static int stack_compact_range(struct reftable_stack *st, int first, int last,
 
        st->stats.attempts++;
 
-       strbuf_reset(&lock_file_name);
-       strbuf_addstr(&lock_file_name, st->list_file);
-       strbuf_addstr(&lock_file_name, ".lock");
-
-       lock_file_fd =
-               open(lock_file_name.buf, O_EXCL | O_CREAT | O_WRONLY, 0666);
-       if (lock_file_fd < 0) {
-               if (errno == EEXIST) {
+       /*
+        * Hold the lock so that we can read "tables.list" and lock all tables
+        * which are part of the user-specified range.
+        */
+       err = hold_lock_file_for_update(&tables_list_lock, st->list_file,
+                                       LOCK_NO_DEREF);
+       if (err < 0) {
+               if (errno == EEXIST)
                        err = 1;
-               } else {
+               else
                        err = REFTABLE_IO_ERROR;
-               }
                goto done;
        }
-       /* Don't want to write to the lock for now.  */
-       close(lock_file_fd);
-       lock_file_fd = -1;
 
-       have_lock = 1;
        err = stack_uptodate(st);
-       if (err != 0)
+       if (err)
                goto done;
 
-       for (i = first, j = 0; i <= last; i++) {
-               struct strbuf subtab_file_name = STRBUF_INIT;
-               struct strbuf subtab_lock = STRBUF_INIT;
-               int sublock_file_fd = -1;
-
-               stack_filename(&subtab_file_name, st,
-                              reader_name(st->readers[i]));
-
-               strbuf_reset(&subtab_lock);
-               strbuf_addbuf(&subtab_lock, &subtab_file_name);
-               strbuf_addstr(&subtab_lock, ".lock");
+       /*
+        * Lock all tables in the user-provided range. This is the slice of our
+        * stack which we'll compact.
+        */
+       REFTABLE_CALLOC_ARRAY(table_locks, last - first + 1);
+       for (i = first; i <= last; i++) {
+               stack_filename(&table_name, st, reader_name(st->readers[i]));
 
-               sublock_file_fd = open(subtab_lock.buf,
-                                      O_EXCL | O_CREAT | O_WRONLY, 0666);
-               if (sublock_file_fd >= 0) {
-                       close(sublock_file_fd);
-               } else if (sublock_file_fd < 0) {
-                       if (errno == EEXIST) {
+               err = hold_lock_file_for_update(&table_locks[i - first],
+                                               table_name.buf, LOCK_NO_DEREF);
+               if (err < 0) {
+                       if (errno == EEXIST)
                                err = 1;
-                       } else {
+                       else
                                err = REFTABLE_IO_ERROR;
-                       }
+                       goto done;
                }
 
-               subtable_locks[j] = subtab_lock.buf;
-               delete_on_success[j] = subtab_file_name.buf;
-               j++;
-
-               if (err != 0)
+               /*
+                * We need to close the lockfiles as we might otherwise easily
+                * run into file descriptor exhaustion when we compress a lot
+                * of tables.
+                */
+               err = close_lock_file_gently(&table_locks[i - first]);
+               if (err < 0) {
+                       err = REFTABLE_IO_ERROR;
                        goto done;
+               }
        }
 
-       err = unlink(lock_file_name.buf);
-       if (err < 0)
+       /*
+        * We have locked all tables in our range and can thus release the
+        * "tables.list" lock while compacting the locked tables. This allows
+        * concurrent updates to the stack to proceed.
+        */
+       err = rollback_lock_file(&tables_list_lock);
+       if (err < 0) {
+               err = REFTABLE_IO_ERROR;
                goto done;
-       have_lock = 0;
-
-       err = stack_compact_locked(st, first, last, &temp_tab_file_name,
-                                  expiry);
-       /* Compaction + tombstones can create an empty table out of non-empty
-        * tables. */
-       is_empty_table = (err == REFTABLE_EMPTY_TABLE_ERROR);
-       if (is_empty_table) {
-               err = 0;
        }
-       if (err < 0)
-               goto done;
 
-       lock_file_fd =
-               open(lock_file_name.buf, O_EXCL | O_CREAT | O_WRONLY, 0666);
-       if (lock_file_fd < 0) {
-               if (errno == EEXIST) {
+       /*
+        * Compact the now-locked tables into a new table. Note that compacting
+        * these tables may end up with an empty new table in case tombstones
+        * end up cancelling out all refs in that range.
+        */
+       err = stack_compact_locked(st, first, last, expiry, &new_table);
+       if (err < 0) {
+               if (err != REFTABLE_EMPTY_TABLE_ERROR)
+                       goto done;
+               is_empty_table = 1;
+       }
+
+       /*
+        * Now that we have written the new, compacted table we need to re-lock
+        * "tables.list". We'll then replace the compacted range of tables with
+        * the new table.
+        */
+       err = hold_lock_file_for_update(&tables_list_lock, st->list_file,
+                                       LOCK_NO_DEREF);
+       if (err < 0) {
+               if (errno == EEXIST)
                        err = 1;
-               } else {
+               else
                        err = REFTABLE_IO_ERROR;
-               }
                goto done;
        }
-       have_lock = 1;
+
        if (st->config.default_permissions) {
-               if (chmod(lock_file_name.buf, st->config.default_permissions) < 0) {
+               if (chmod(get_lock_file_path(&tables_list_lock),
+                         st->config.default_permissions) < 0) {
                        err = REFTABLE_IO_ERROR;
                        goto done;
                }
        }
 
-       format_name(&new_table_name, st->readers[first]->min_update_index,
-                   st->readers[last]->max_update_index);
-       strbuf_addstr(&new_table_name, ".ref");
-
-       stack_filename(&new_table_path, st, new_table_name.buf);
-
+       /*
+        * If the resulting compacted table is not empty, then we need to move
+        * it into place now.
+        */
        if (!is_empty_table) {
-               /* retry? */
-               err = rename(temp_tab_file_name.buf, new_table_path.buf);
+               format_name(&new_table_name, st->readers[first]->min_update_index,
+                           st->readers[last]->max_update_index);
+               strbuf_addstr(&new_table_name, ".ref");
+               stack_filename(&new_table_path, st, new_table_name.buf);
+
+               err = rename_tempfile(&new_table, new_table_path.buf);
                if (err < 0) {
                        err = REFTABLE_IO_ERROR;
                        goto done;
                }
        }
 
-       for (i = 0; i < first; i++) {
-               strbuf_addstr(&ref_list_contents, st->readers[i]->name);
-               strbuf_addstr(&ref_list_contents, "\n");
-       }
-       if (!is_empty_table) {
-               strbuf_addbuf(&ref_list_contents, &new_table_name);
-               strbuf_addstr(&ref_list_contents, "\n");
-       }
-       for (i = last + 1; i < st->merged->stack_len; i++) {
-               strbuf_addstr(&ref_list_contents, st->readers[i]->name);
-               strbuf_addstr(&ref_list_contents, "\n");
-       }
-
-       err = write(lock_file_fd, ref_list_contents.buf, ref_list_contents.len);
+       /*
+        * Write the new "tables.list" contents with the compacted table we
+        * have just written. In case the compacted table became empty we
+        * simply skip writing it.
+        */
+       for (i = 0; i < first; i++)
+               strbuf_addf(&tables_list_buf, "%s\n", st->readers[i]->name);
+       if (!is_empty_table)
+               strbuf_addf(&tables_list_buf, "%s\n", new_table_name.buf);
+       for (i = last + 1; i < st->merged->stack_len; i++)
+               strbuf_addf(&tables_list_buf, "%s\n", st->readers[i]->name);
+
+       err = write_in_full(get_lock_file_fd(&tables_list_lock),
+                           tables_list_buf.buf, tables_list_buf.len);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                unlink(new_table_path.buf);
                goto done;
        }
-       err = close(lock_file_fd);
-       lock_file_fd = -1;
+
+       err = fsync_component(FSYNC_COMPONENT_REFERENCE, get_lock_file_fd(&tables_list_lock));
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                unlink(new_table_path.buf);
                goto done;
        }
 
-       err = rename(lock_file_name.buf, st->list_file);
+       err = commit_lock_file(&tables_list_lock);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                unlink(new_table_path.buf);
                goto done;
        }
-       have_lock = 0;
 
-       /* Reload the stack before deleting. On windows, we can only delete the
-          files after we closed them.
-       */
+       /*
+        * Reload the stack before deleting the compacted tables. We can only
+        * delete the files after we closed them on Windows, so this needs to
+        * happen first.
+        */
        err = reftable_stack_reload_maybe_reuse(st, first < last);
+       if (err < 0)
+               goto done;
 
-       listp = delete_on_success;
-       while (*listp) {
-               if (strcmp(*listp, new_table_path.buf)) {
-                       unlink(*listp);
-               }
-               listp++;
+       /*
+        * Delete the old tables. They may still be in use by concurrent
+        * readers, so it is expected that unlinking tables may fail.
+        */
+       for (i = first; i <= last; i++) {
+               struct lock_file *table_lock = &table_locks[i - first];
+               char *table_path = get_locked_file_path(table_lock);
+               unlink(table_path);
+               free(table_path);
        }
 
 done:
-       free_names(delete_on_success);
+       rollback_lock_file(&tables_list_lock);
+       for (i = first; table_locks && i <= last; i++)
+               rollback_lock_file(&table_locks[i - first]);
+       reftable_free(table_locks);
 
-       listp = subtable_locks;
-       while (*listp) {
-               unlink(*listp);
-               listp++;
-       }
-       free_names(subtable_locks);
-       if (lock_file_fd >= 0) {
-               close(lock_file_fd);
-               lock_file_fd = -1;
-       }
-       if (have_lock) {
-               unlink(lock_file_name.buf);
-       }
+       delete_tempfile(&new_table);
        strbuf_release(&new_table_name);
        strbuf_release(&new_table_path);
-       strbuf_release(&ref_list_contents);
-       strbuf_release(&temp_tab_file_name);
-       strbuf_release(&lock_file_name);
+
+       strbuf_release(&tables_list_buf);
+       strbuf_release(&table_name);
        return err;
 }
 
 int reftable_stack_compact_all(struct reftable_stack *st,
                               struct reftable_log_expiry_config *config)
 {
-       return stack_compact_range(st, 0, st->merged->stack_len - 1, config);
+       return stack_compact_range(st, 0, st->merged->stack_len ?
+                       st->merged->stack_len - 1 : 0, config);
 }
 
-static int stack_compact_range_stats(struct reftable_stack *st, int first,
-                                    int last,
+static int stack_compact_range_stats(struct reftable_stack *st,
+                                    size_t first, size_t last,
                                     struct reftable_log_expiry_config *config)
 {
        int err = stack_compact_range(st, first, last, config);
-       if (err > 0) {
+       if (err > 0)
                st->stats.failures++;
-       }
        return err;
 }
 
@@ -1116,12 +1213,11 @@ int fastlog2(uint64_t sz)
        return l - 1;
 }
 
-struct segment *sizes_to_segments(int *seglen, uint64_t *sizes, int n)
+struct segment *sizes_to_segments(size_t *seglen, uint64_t *sizes, size_t n)
 {
-       struct segment *segs = reftable_calloc(sizeof(struct segment) * n);
-       int next = 0;
+       struct segment *segs = reftable_calloc(n, sizeof(*segs));
        struct segment cur = { 0 };
-       int i = 0;
+       size_t next = 0, i;
 
        if (n == 0) {
                *seglen = 0;
@@ -1147,29 +1243,27 @@ struct segment *sizes_to_segments(int *seglen, uint64_t *sizes, int n)
        return segs;
 }
 
-struct segment suggest_compaction_segment(uint64_t *sizes, int n)
+struct segment suggest_compaction_segment(uint64_t *sizes, size_t n)
 {
-       int seglen = 0;
-       struct segment *segs = sizes_to_segments(&seglen, sizes, n);
        struct segment min_seg = {
                .log = 64,
        };
-       int i = 0;
+       struct segment *segs;
+       size_t seglen = 0, i;
+
+       segs = sizes_to_segments(&seglen, sizes, n);
        for (i = 0; i < seglen; i++) {
-               if (segment_size(&segs[i]) == 1) {
+               if (segment_size(&segs[i]) == 1)
                        continue;
-               }
 
-               if (segs[i].log < min_seg.log) {
+               if (segs[i].log < min_seg.log)
                        min_seg = segs[i];
-               }
        }
 
        while (min_seg.start > 0) {
-               int prev = min_seg.start - 1;
-               if (fastlog2(min_seg.bytes) < fastlog2(sizes[prev])) {
+               size_t prev = min_seg.start - 1;
+               if (fastlog2(min_seg.bytes) < fastlog2(sizes[prev]))
                        break;
-               }
 
                min_seg.start = prev;
                min_seg.bytes += sizes[prev];
@@ -1182,7 +1276,7 @@ struct segment suggest_compaction_segment(uint64_t *sizes, int n)
 static uint64_t *stack_table_sizes_for_compaction(struct reftable_stack *st)
 {
        uint64_t *sizes =
-               reftable_calloc(sizeof(uint64_t) * st->merged->stack_len);
+               reftable_calloc(st->merged->stack_len, sizeof(*sizes));
        int version = (st->config.hash_id == GIT_SHA1_FORMAT_ID) ? 1 : 2;
        int overhead = header_size(version) - 1;
        int i = 0;
@@ -1281,17 +1375,12 @@ static int stack_check_addition(struct reftable_stack *st,
        while (1) {
                struct reftable_ref_record ref = { NULL };
                err = reftable_iterator_next_ref(&it, &ref);
-               if (err > 0) {
+               if (err > 0)
                        break;
-               }
                if (err < 0)
                        goto done;
 
-               if (len >= cap) {
-                       cap = 2 * cap + 1;
-                       refs = reftable_realloc(refs, cap * sizeof(refs[0]));
-               }
-
+               REFTABLE_ALLOC_GROW(refs, len + 1, cap);
                refs[len++] = ref;
        }
 
index f57005846e561272054883e856d7a1dd14863a19..d919455669ede0b2872a2d19ee12870479ab99ab 100644 (file)
@@ -14,7 +14,10 @@ https://developers.google.com/open-source/licenses/bsd
 #include "reftable-stack.h"
 
 struct reftable_stack {
+       struct stat list_st;
        char *list_file;
+       int list_fd;
+
        char *reftable_dir;
        int disable_auto_compact;
 
@@ -29,13 +32,13 @@ struct reftable_stack {
 int read_lines(const char *filename, char ***lines);
 
 struct segment {
-       int start, end;
+       size_t start, end;
        int log;
        uint64_t bytes;
 };
 
 int fastlog2(uint64_t sz);
-struct segment *sizes_to_segments(int *seglen, uint64_t *sizes, int n);
-struct segment suggest_compaction_segment(uint64_t *sizes, int n);
+struct segment *sizes_to_segments(size_t *seglen, uint64_t *sizes, size_t n);
+struct segment suggest_compaction_segment(uint64_t *sizes, size_t n);
 
 #endif
index d0b717510fa7d6dd8832bf77490630964e33b23b..7336757cf534058dd6f3e8346d15874036c5b763 100644 (file)
@@ -13,7 +13,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "reftable-reader.h"
 #include "merged.h"
 #include "basics.h"
-#include "constants.h"
 #include "record.h"
 #include "test_framework.h"
 #include "reftable-tests.h"
@@ -78,7 +77,7 @@ static void test_read_file(void)
        int i = 0;
 
        EXPECT(fd > 0);
-       n = write(fd, out, strlen(out));
+       n = write_in_full(fd, out, strlen(out));
        EXPECT(n == strlen(out));
        err = close(fd);
        EXPECT(err >= 0);
@@ -289,6 +288,61 @@ static void test_reftable_stack_transaction_api(void)
        clear_dir(dir);
 }
 
+static void test_reftable_stack_transaction_api_performs_auto_compaction(void)
+{
+       char *dir = get_tmp_dir(__LINE__);
+       struct reftable_write_options cfg = {0};
+       struct reftable_addition *add = NULL;
+       struct reftable_stack *st = NULL;
+       int i, n = 20, err;
+
+       err = reftable_new_stack(&st, dir, cfg);
+       EXPECT_ERR(err);
+
+       for (i = 0; i <= n; i++) {
+               struct reftable_ref_record ref = {
+                       .update_index = reftable_stack_next_update_index(st),
+                       .value_type = REFTABLE_REF_SYMREF,
+                       .value.symref = "master",
+               };
+               char name[100];
+
+               snprintf(name, sizeof(name), "branch%04d", i);
+               ref.refname = name;
+
+               /*
+                * Disable auto-compaction for all but the last runs. Like this
+                * we can ensure that we indeed honor this setting and have
+                * better control over when exactly auto compaction runs.
+                */
+               st->disable_auto_compact = i != n;
+
+               err = reftable_stack_new_addition(&add, st);
+               EXPECT_ERR(err);
+
+               err = reftable_addition_add(add, &write_test_ref, &ref);
+               EXPECT_ERR(err);
+
+               err = reftable_addition_commit(add);
+               EXPECT_ERR(err);
+
+               reftable_addition_destroy(add);
+
+               /*
+                * The stack length should grow continuously for all runs where
+                * auto compaction is disabled. When enabled, we should merge
+                * all tables in the stack.
+                */
+               if (i != n)
+                       EXPECT(st->merged->stack_len == i + 1);
+               else
+                       EXPECT(st->merged->stack_len == 1);
+       }
+
+       reftable_stack_destroy(st);
+       clear_dir(dir);
+}
+
 static void test_reftable_stack_validate_refname(void)
 {
        struct reftable_write_options cfg = { 0 };
@@ -389,15 +443,16 @@ static void test_reftable_stack_add(void)
        int err = 0;
        struct reftable_write_options cfg = {
                .exact_log_message = 1,
+               .default_permissions = 0660,
        };
        struct reftable_stack *st = NULL;
        char *dir = get_tmp_dir(__LINE__);
-
        struct reftable_ref_record refs[2] = { { NULL } };
        struct reftable_log_record logs[2] = { { NULL } };
+       struct strbuf path = STRBUF_INIT;
+       struct stat stat_result;
        int N = ARRAY_SIZE(refs);
 
-
        err = reftable_new_stack(&st, dir, cfg);
        EXPECT_ERR(err);
        st->disable_auto_compact = 1;
@@ -408,14 +463,11 @@ static void test_reftable_stack_add(void)
                refs[i].refname = xstrdup(buf);
                refs[i].update_index = i + 1;
                refs[i].value_type = REFTABLE_REF_VAL1;
-               refs[i].value.val1 = reftable_malloc(GIT_SHA1_RAWSZ);
                set_test_hash(refs[i].value.val1, i);
 
                logs[i].refname = xstrdup(buf);
                logs[i].update_index = N + i + 1;
                logs[i].value_type = REFTABLE_LOG_UPDATE;
-
-               logs[i].value.update.new_hash = reftable_malloc(GIT_SHA1_RAWSZ);
                logs[i].value.update.email = xstrdup("identity@invalid");
                set_test_hash(logs[i].value.update.new_hash, i);
        }
@@ -456,12 +508,32 @@ static void test_reftable_stack_add(void)
                reftable_log_record_release(&dest);
        }
 
+#ifndef GIT_WINDOWS_NATIVE
+       strbuf_addstr(&path, dir);
+       strbuf_addstr(&path, "/tables.list");
+       err = stat(path.buf, &stat_result);
+       EXPECT(!err);
+       EXPECT((stat_result.st_mode & 0777) == cfg.default_permissions);
+
+       strbuf_reset(&path);
+       strbuf_addstr(&path, dir);
+       strbuf_addstr(&path, "/");
+       /* do not try at home; not an external API for reftable. */
+       strbuf_addstr(&path, st->readers[0]->name);
+       err = stat(path.buf, &stat_result);
+       EXPECT(!err);
+       EXPECT((stat_result.st_mode & 0777) == cfg.default_permissions);
+#else
+       (void) stat_result;
+#endif
+
        /* cleanup */
        reftable_stack_destroy(st);
        for (i = 0; i < N; i++) {
                reftable_ref_record_release(&refs[i]);
                reftable_log_record_release(&logs[i]);
        }
+       strbuf_release(&path);
        clear_dir(dir);
 }
 
@@ -473,16 +545,17 @@ static void test_reftable_stack_log_normalize(void)
        };
        struct reftable_stack *st = NULL;
        char *dir = get_tmp_dir(__LINE__);
-
-       uint8_t h1[GIT_SHA1_RAWSZ] = { 0x01 }, h2[GIT_SHA1_RAWSZ] = { 0x02 };
-
-       struct reftable_log_record input = { .refname = "branch",
-                                            .update_index = 1,
-                                            .value_type = REFTABLE_LOG_UPDATE,
-                                            .value = { .update = {
-                                                               .new_hash = h1,
-                                                               .old_hash = h2,
-                                                       } } };
+       struct reftable_log_record input = {
+               .refname = "branch",
+               .update_index = 1,
+               .value_type = REFTABLE_LOG_UPDATE,
+               .value = {
+                       .update = {
+                               .new_hash = { 1 },
+                               .old_hash = { 2 },
+                       },
+               },
+       };
        struct reftable_log_record dest = {
                .update_index = 0,
        };
@@ -545,7 +618,6 @@ static void test_reftable_stack_tombstone(void)
                refs[i].update_index = i + 1;
                if (i % 2 == 0) {
                        refs[i].value_type = REFTABLE_REF_VAL1;
-                       refs[i].value.val1 = reftable_malloc(GIT_SHA1_RAWSZ);
                        set_test_hash(refs[i].value.val1, i);
                }
 
@@ -554,8 +626,6 @@ static void test_reftable_stack_tombstone(void)
                logs[i].update_index = 42;
                if (i % 2 == 0) {
                        logs[i].value_type = REFTABLE_LOG_UPDATE;
-                       logs[i].value.update.new_hash =
-                               reftable_malloc(GIT_SHA1_RAWSZ);
                        set_test_hash(logs[i].value.update.new_hash, i);
                        logs[i].value.update.email =
                                xstrdup("identity@invalid");
@@ -659,7 +729,7 @@ static void test_sizes_to_segments(void)
        uint64_t sizes[] = { 2, 3, 4, 5, 7, 9 };
        /* .................0  1  2  3  4  5 */
 
-       int seglen = 0;
+       size_t seglen = 0;
        struct segment *segs =
                sizes_to_segments(&seglen, sizes, ARRAY_SIZE(sizes));
        EXPECT(segs[2].log == 3);
@@ -674,7 +744,7 @@ static void test_sizes_to_segments(void)
 
 static void test_sizes_to_segments_empty(void)
 {
-       int seglen = 0;
+       size_t seglen = 0;
        struct segment *segs = sizes_to_segments(&seglen, NULL, 0);
        EXPECT(seglen == 0);
        reftable_free(segs);
@@ -683,8 +753,7 @@ static void test_sizes_to_segments_empty(void)
 static void test_sizes_to_segments_all_equal(void)
 {
        uint64_t sizes[] = { 5, 5 };
-
-       int seglen = 0;
+       size_t seglen = 0;
        struct segment *segs =
                sizes_to_segments(&seglen, sizes, ARRAY_SIZE(sizes));
        EXPECT(seglen == 1);
@@ -738,7 +807,6 @@ static void test_reflog_expire(void)
                logs[i].update_index = i;
                logs[i].value_type = REFTABLE_LOG_UPDATE;
                logs[i].value.update.time = i;
-               logs[i].value.update.new_hash = reftable_malloc(GIT_SHA1_RAWSZ);
                logs[i].value.update.email = xstrdup("identity@invalid");
                set_test_hash(logs[i].value.update.new_hash, i);
        }
@@ -850,6 +918,54 @@ static void test_reftable_stack_auto_compaction(void)
        clear_dir(dir);
 }
 
+static void test_reftable_stack_add_performs_auto_compaction(void)
+{
+       struct reftable_write_options cfg = { 0 };
+       struct reftable_stack *st = NULL;
+       struct strbuf refname = STRBUF_INIT;
+       char *dir = get_tmp_dir(__LINE__);
+       int err, i, n = 20;
+
+       err = reftable_new_stack(&st, dir, cfg);
+       EXPECT_ERR(err);
+
+       for (i = 0; i <= n; i++) {
+               struct reftable_ref_record ref = {
+                       .update_index = reftable_stack_next_update_index(st),
+                       .value_type = REFTABLE_REF_SYMREF,
+                       .value.symref = "master",
+               };
+
+               /*
+                * Disable auto-compaction for all but the last runs. Like this
+                * we can ensure that we indeed honor this setting and have
+                * better control over when exactly auto compaction runs.
+                */
+               st->disable_auto_compact = i != n;
+
+               strbuf_reset(&refname);
+               strbuf_addf(&refname, "branch-%04d", i);
+               ref.refname = refname.buf;
+
+               err = reftable_stack_add(st, &write_test_ref, &ref);
+               EXPECT_ERR(err);
+
+               /*
+                * The stack length should grow continuously for all runs where
+                * auto compaction is disabled. When enabled, we should merge
+                * all tables in the stack.
+                */
+               if (i != n)
+                       EXPECT(st->merged->stack_len == i + 1);
+               else
+                       EXPECT(st->merged->stack_len == 1);
+       }
+
+       reftable_stack_destroy(st);
+       strbuf_release(&refname);
+       clear_dir(dir);
+}
+
 static void test_reftable_stack_compaction_concurrent(void)
 {
        struct reftable_write_options cfg = { 0 };
@@ -960,6 +1076,7 @@ int stack_test_main(int argc, const char *argv[])
        RUN_TEST(test_reftable_stack_add);
        RUN_TEST(test_reftable_stack_add_one);
        RUN_TEST(test_reftable_stack_auto_compaction);
+       RUN_TEST(test_reftable_stack_add_performs_auto_compaction);
        RUN_TEST(test_reftable_stack_compaction_concurrent);
        RUN_TEST(test_reftable_stack_compaction_concurrent_clean);
        RUN_TEST(test_reftable_stack_hash_id);
@@ -967,6 +1084,7 @@ int stack_test_main(int argc, const char *argv[])
        RUN_TEST(test_reftable_stack_log_normalize);
        RUN_TEST(test_reftable_stack_tombstone);
        RUN_TEST(test_reftable_stack_transaction_api);
+       RUN_TEST(test_reftable_stack_transaction_api_performs_auto_compaction);
        RUN_TEST(test_reftable_stack_update_index_check);
        RUN_TEST(test_reftable_stack_uptodate);
        RUN_TEST(test_reftable_stack_validate_refname);
index 6b74a8151436144225c2e579340dfc3426a26470..5d8b6dede50414b750f39778c6070731b096d218 100644 (file)
@@ -12,7 +12,9 @@ https://developers.google.com/open-source/licenses/bsd
 /* This header glues the reftable library to the rest of Git */
 
 #include "git-compat-util.h"
+#include "lockfile.h"
 #include "strbuf.h"
+#include "tempfile.h"
 #include "hash-ll.h" /* hash ID, sizes.*/
 #include "dir.h" /* remove_dir_recursively, for tests.*/
 
index 84ac972cad063a3402731c704d9c7bfde4d24d6e..4066924eee45dc6b4fe5b353f7fe54c9dc9f7d7e 100644 (file)
@@ -9,7 +9,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "system.h"
 #include "test_framework.h"
 
-#include "basics.h"
 
 void set_test_hash(uint8_t *p, int i)
 {
@@ -21,3 +20,8 @@ ssize_t strbuf_add_void(void *b, const void *data, size_t sz)
        strbuf_add(b, data, sz);
        return sz;
 }
+
+int noop_flush(void *arg)
+{
+       return 0;
+}
index 774cb275bf679440b804d86370c8858c9e0b1bd2..687390f9c239a397652a9a4c9a0bbb7a3510d232 100644 (file)
@@ -12,32 +12,38 @@ https://developers.google.com/open-source/licenses/bsd
 #include "system.h"
 #include "reftable-error.h"
 
-#define EXPECT_ERR(c)                                                  \
-       if (c != 0) {                                                  \
-               fflush(stderr);                                        \
-               fflush(stdout);                                        \
-               fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
-                       __FILE__, __LINE__, c, reftable_error_str(c)); \
-               abort();                                               \
-       }
-
-#define EXPECT_STREQ(a, b)                                               \
-       if (strcmp(a, b)) {                                              \
-               fflush(stderr);                                          \
-               fflush(stdout);                                          \
-               fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
-                       __LINE__, #a, a, #b, b);                         \
-               abort();                                                 \
-       }
-
-#define EXPECT(c)                                                          \
-       if (!(c)) {                                                        \
-               fflush(stderr);                                            \
-               fflush(stdout);                                            \
-               fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
-                       __LINE__, #c);                                     \
-               abort();                                                   \
-       }
+#define EXPECT_ERR(c)                                                          \
+       do {                                                                   \
+               if (c != 0) {                                                  \
+                       fflush(stderr);                                        \
+                       fflush(stdout);                                        \
+                       fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
+                               __FILE__, __LINE__, c, reftable_error_str(c)); \
+                       abort();                                               \
+               }                                                              \
+       } while (0)
+
+#define EXPECT_STREQ(a, b)                                                       \
+       do {                                                                     \
+               if (strcmp(a, b)) {                                              \
+                       fflush(stderr);                                          \
+                       fflush(stdout);                                          \
+                       fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
+                               __LINE__, #a, a, #b, b);                         \
+                       abort();                                                 \
+               }                                                                \
+       } while (0)
+
+#define EXPECT(c)                                                                  \
+       do {                                                                       \
+               if (!(c)) {                                                        \
+                       fflush(stderr);                                            \
+                       fflush(stdout);                                            \
+                       fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
+                               __LINE__, #c);                                     \
+                       abort();                                                   \
+               }                                                                  \
+       } while (0)
 
 #define RUN_TEST(f)                          \
        fprintf(stderr, "running %s\n", #f); \
@@ -50,4 +56,6 @@ void set_test_hash(uint8_t *p, int i);
  */
 ssize_t strbuf_add_void(void *b, const void *data, size_t sz);
 
+int noop_flush(void *);
+
 #endif
index a5bf880985472dee7cd7c9169047752245599488..528f33ae388d0a6ad93eaa5e3f604596f07071fb 100644 (file)
@@ -20,8 +20,8 @@ struct tree_node *tree_search(void *key, struct tree_node **rootp,
                if (!insert) {
                        return NULL;
                } else {
-                       struct tree_node *n =
-                               reftable_calloc(sizeof(struct tree_node));
+                       struct tree_node *n;
+                       REFTABLE_CALLOC_ARRAY(n, 1);
                        n->key = key;
                        *rootp = n;
                        return *rootp;
index ac3a045ad4afbc893f4daff8da98c768cabaf8fd..6961a657adb80497676895eedca696d142e5b57c 100644 (file)
@@ -9,8 +9,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "system.h"
 #include "tree.h"
 
-#include "basics.h"
-#include "record.h"
 #include "test_framework.h"
 #include "reftable-tests.h"
 
index 2e322a5683d081eea60fc85dfc4d792ce89b7a93..1d9ff0fbfabcc387e29697c0458467c882708c39 100644 (file)
@@ -49,7 +49,7 @@ static int padded_write(struct reftable_writer *w, uint8_t *data, size_t len,
 {
        int n = 0;
        if (w->pending_padding > 0) {
-               uint8_t *zeroed = reftable_calloc(w->pending_padding);
+               uint8_t *zeroed = reftable_calloc(w->pending_padding, sizeof(*zeroed));
                int n = w->write(w->write_arg, zeroed, w->pending_padding);
                if (n < 0)
                        return n;
@@ -121,10 +121,10 @@ static struct strbuf reftable_empty_strbuf = STRBUF_INIT;
 
 struct reftable_writer *
 reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
+                   int (*flush_func)(void *),
                    void *writer_arg, struct reftable_write_options *opts)
 {
-       struct reftable_writer *wp =
-               reftable_calloc(sizeof(struct reftable_writer));
+       struct reftable_writer *wp = reftable_calloc(1, sizeof(*wp));
        strbuf_init(&wp->block_writer_data.last_key, 0);
        options_set_defaults(opts);
        if (opts->block_size >= (1 << 24)) {
@@ -132,10 +132,11 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
                abort();
        }
        wp->last_key = reftable_empty_strbuf;
-       wp->block = reftable_calloc(opts->block_size);
+       REFTABLE_CALLOC_ARRAY(wp->block, opts->block_size);
        wp->write = writer_func;
        wp->write_arg = writer_arg;
        wp->opts = *opts;
+       wp->flush = flush_func;
        writer_reinit_block_writer(wp, BLOCK_TYPE_REF);
 
        return wp;
@@ -200,12 +201,7 @@ static void writer_index_hash(struct reftable_writer *w, struct strbuf *hash)
                return;
        }
 
-       if (key->offset_len == key->offset_cap) {
-               key->offset_cap = 2 * key->offset_cap + 1;
-               key->offsets = reftable_realloc(
-                       key->offsets, sizeof(uint64_t) * key->offset_cap);
-       }
-
+       REFTABLE_ALLOC_GROW(key->offsets, key->offset_len + 1, key->offset_cap);
        key->offsets[key->offset_len++] = off;
 }
 
@@ -377,20 +373,39 @@ int reftable_writer_add_logs(struct reftable_writer *w,
 
 static int writer_finish_section(struct reftable_writer *w)
 {
+       struct reftable_block_stats *bstats = NULL;
        uint8_t typ = block_writer_type(w->block_writer);
        uint64_t index_start = 0;
        int max_level = 0;
-       int threshold = w->opts.unpadded ? 1 : 3;
+       size_t threshold = w->opts.unpadded ? 1 : 3;
        int before_blocks = w->stats.idx_stats.blocks;
-       int err = writer_flush_block(w);
-       int i = 0;
-       struct reftable_block_stats *bstats = NULL;
+       int err;
+
+       err = writer_flush_block(w);
        if (err < 0)
                return err;
 
+       /*
+        * When the section we are about to index has a lot of blocks then the
+        * index itself may span across multiple blocks, as well. This would
+        * require a linear scan over index blocks only to find the desired
+        * indexed block, which is inefficient. Instead, we write a multi-level
+        * index where index records of level N+1 will refer to index blocks of
+        * level N. This isn't constant time, either, but at least logarithmic.
+        *
+        * This loop handles writing this multi-level index. Note that we write
+        * the lowest-level index pointing to the indexed blocks first. We then
+        * continue writing additional index levels until the current level has
+        * less blocks than the threshold so that the highest level will be at
+        * the end of the index section.
+        *
+        * Readers are thus required to start reading the index section from
+        * its end, which is why we set `index_start` to the beginning of the
+        * last index section.
+        */
        while (w->index_len > threshold) {
                struct reftable_index_record *idx = NULL;
-               int idx_len = 0;
+               size_t i, idx_len;
 
                max_level++;
                index_start = w->next;
@@ -409,35 +424,28 @@ static int writer_finish_section(struct reftable_writer *w)
                                        .idx = idx[i],
                                },
                        };
-                       if (block_writer_add(w->block_writer, &rec) == 0) {
-                               continue;
-                       }
 
-                       err = writer_flush_block(w);
+                       err = writer_add_record(w, &rec);
                        if (err < 0)
                                return err;
+               }
 
-                       writer_reinit_block_writer(w, BLOCK_TYPE_INDEX);
+               err = writer_flush_block(w);
+               if (err < 0)
+                       return err;
 
-                       err = block_writer_add(w->block_writer, &rec);
-                       if (err != 0) {
-                               /* write into fresh block should always succeed
-                                */
-                               abort();
-                       }
-               }
-               for (i = 0; i < idx_len; i++) {
+               for (i = 0; i < idx_len; i++)
                        strbuf_release(&idx[i].last_key);
-               }
                reftable_free(idx);
        }
 
+       /*
+        * The index may still contain a number of index blocks lower than the
+        * threshold. Clear it so that these entries don't leak into the next
+        * index section.
+        */
        writer_clear_index(w);
 
-       err = writer_flush_block(w);
-       if (err < 0)
-               return err;
-
        bstats = writer_reftable_block_stats(w, typ);
        bstats->index_blocks = w->stats.idx_stats.blocks - before_blocks;
        bstats->index_offset = index_start;
@@ -603,6 +611,12 @@ int reftable_writer_close(struct reftable_writer *w)
        put_be32(p, crc32(0, footer, p - footer));
        p += 4;
 
+       err = w->flush(w->write_arg);
+       if (err < 0) {
+               err = REFTABLE_IO_ERROR;
+               goto done;
+       }
+
        err = padded_write(w, footer, footer_size(writer_version(w)), 0);
        if (err < 0)
                goto done;
@@ -622,11 +636,8 @@ done:
 
 static void writer_clear_index(struct reftable_writer *w)
 {
-       int i = 0;
-       for (i = 0; i < w->index_len; i++) {
+       for (size_t i = 0; i < w->index_len; i++)
                strbuf_release(&w->index[i].last_key);
-       }
-
        FREE_AND_NULL(w->index);
        w->index_len = 0;
        w->index_cap = 0;
@@ -674,12 +685,7 @@ static int writer_flush_nonempty_block(struct reftable_writer *w)
        if (err < 0)
                return err;
 
-       if (w->index_cap == w->index_len) {
-               w->index_cap = 2 * w->index_cap + 1;
-               w->index = reftable_realloc(
-                       w->index,
-                       sizeof(struct reftable_index_record) * w->index_cap);
-       }
+       REFTABLE_ALLOC_GROW(w->index, w->index_len + 1, w->index_cap);
 
        ir.offset = w->next;
        strbuf_reset(&ir.last_key);
index 09b88673d9757536c3c0f5122f991703eb94a06e..8d0df9cc528dba79677716b6b6760b93c7dad057 100644 (file)
@@ -16,6 +16,7 @@ https://developers.google.com/open-source/licenses/bsd
 
 struct reftable_writer {
        ssize_t (*write)(void *, const void *, size_t);
+       int (*flush)(void *);
        void *write_arg;
        int pending_padding;
        struct strbuf last_key;
index ef05752ca5738ea16d16d38c8ea9c65e2a9ea167..1161dc7fed689259141ae2eb5403d84b906027d3 100644 (file)
@@ -8,11 +8,9 @@
 #include "strbuf.h"
 #include "walker.h"
 #include "http.h"
-#include "exec-cmd.h"
 #include "run-command.h"
 #include "pkt-line.h"
 #include "string-list.h"
-#include "sideband.h"
 #include "strvec.h"
 #include "credential.h"
 #include "oid-array.h"
@@ -22,6 +20,7 @@
 #include "quote.h"
 #include "trace2.h"
 #include "transport.h"
+#include "url.h"
 #include "write-or-die.h"
 
 static struct remote *remote;
@@ -1447,8 +1446,14 @@ static int stateless_connect(const char *service_name)
         * establish a stateless connection, otherwise we need to tell the
         * client to fallback to using other transport helper functions to
         * complete their request.
+        *
+        * The "git-upload-archive" service is a read-only operation. Fallback
+        * to use "git-upload-pack" service to discover protocol version.
         */
-       discover = discover_refs(service_name, 0);
+       if (!strcmp(service_name, "git-upload-archive"))
+               discover = discover_refs("git-upload-pack", 0);
+       else
+               discover = discover_refs(service_name, 0);
        if (discover->version != protocol_v2) {
                printf("fallback\n");
                fflush(stdout);
@@ -1486,9 +1491,11 @@ static int stateless_connect(const char *service_name)
 
        /*
         * Dump the capability listing that we got from the server earlier
-        * during the info/refs request.
+        * during the info/refs request. This does not work with the
+        * "git-upload-archive" service.
         */
-       write_or_die(rpc.in, discover->buf, discover->len);
+       if (strcmp(service_name, "git-upload-archive"))
+               write_or_die(rpc.in, discover->buf, discover->len);
 
        /* Until we see EOF keep sending POSTs */
        while (1) {
@@ -1564,8 +1571,11 @@ int cmd_main(int argc, const char **argv)
                if (buf.len == 0)
                        break;
                if (starts_with(buf.buf, "fetch ")) {
-                       if (nongit)
-                               die(_("remote-curl: fetch attempted without a local repo"));
+                       if (nongit) {
+                               setup_git_directory_gently(&nongit);
+                               if (nongit)
+                                       die(_("remote-curl: fetch attempted without a local repo"));
+                       }
                        parse_fetch(&buf);
 
                } else if (!strcmp(buf.buf, "list") || starts_with(buf.buf, "list ")) {
index abb24822beb2a17187d4afa9474dd1c537f078ba..2b650b813b741f722a5f6c69f359a1f53249bcb1 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -15,7 +15,6 @@
 #include "diff.h"
 #include "revision.h"
 #include "dir.h"
-#include "tag.h"
 #include "setup.h"
 #include "string-list.h"
 #include "strvec.h"
@@ -106,7 +105,7 @@ static int remotes_hash_cmp(const void *cmp_data UNUSED,
        b = container_of(entry_or_key, const struct remote, ent);
 
        if (key)
-               return strncmp(a->name, key->str, key->len) || a->name[key->len];
+               return !!xstrncmpz(a->name, key->str, key->len);
        else
                return strcmp(a->name, b->name);
 }
@@ -190,8 +189,7 @@ static int branches_hash_cmp(const void *cmp_data UNUSED,
        b = container_of(entry_or_key, const struct branch, ent);
 
        if (key)
-               return strncmp(a->name, key->str, key->len) ||
-                      a->name[key->len];
+               return !!xstrncmpz(a->name, key->str, key->len);
        else
                return strcmp(a->name, b->name);
 }
@@ -509,7 +507,7 @@ static void alias_all_urls(struct remote_state *remote_state)
        }
 }
 
-static void read_config(struct repository *repo)
+static void read_config(struct repository *repo, int early)
 {
        int flag;
 
@@ -518,7 +516,7 @@ static void read_config(struct repository *repo)
        repo->remote_state->initialized = 1;
 
        repo->remote_state->current_branch = NULL;
-       if (startup_info->have_repository) {
+       if (startup_info->have_repository && !early) {
                const char *head_ref = refs_resolve_ref_unsafe(
                        get_main_ref_store(repo), "HEAD", 0, NULL, &flag);
                if (head_ref && (flag & REF_ISSYMREF) &&
@@ -561,7 +559,7 @@ static const char *remotes_remote_for_branch(struct remote_state *remote_state,
 
 const char *remote_for_branch(struct branch *branch, int *explicit)
 {
-       read_config(the_repository);
+       read_config(the_repository, 0);
        die_on_missing_branch(the_repository, branch);
 
        return remotes_remote_for_branch(the_repository->remote_state, branch,
@@ -587,7 +585,7 @@ remotes_pushremote_for_branch(struct remote_state *remote_state,
 
 const char *pushremote_for_branch(struct branch *branch, int *explicit)
 {
-       read_config(the_repository);
+       read_config(the_repository, 0);
        die_on_missing_branch(the_repository, branch);
 
        return remotes_pushremote_for_branch(the_repository->remote_state,
@@ -599,7 +597,7 @@ static struct remote *remotes_remote_get(struct remote_state *remote_state,
 
 const char *remote_ref_for_branch(struct branch *branch, int for_push)
 {
-       read_config(the_repository);
+       read_config(the_repository, 0);
        die_on_missing_branch(the_repository, branch);
 
        if (branch) {
@@ -709,7 +707,13 @@ remotes_remote_get(struct remote_state *remote_state, const char *name)
 
 struct remote *remote_get(const char *name)
 {
-       read_config(the_repository);
+       read_config(the_repository, 0);
+       return remotes_remote_get(the_repository->remote_state, name);
+}
+
+struct remote *remote_get_early(const char *name)
+{
+       read_config(the_repository, 1);
        return remotes_remote_get(the_repository->remote_state, name);
 }
 
@@ -722,7 +726,7 @@ remotes_pushremote_get(struct remote_state *remote_state, const char *name)
 
 struct remote *pushremote_get(const char *name)
 {
-       read_config(the_repository);
+       read_config(the_repository, 0);
        return remotes_pushremote_get(the_repository->remote_state, name);
 }
 
@@ -738,7 +742,7 @@ int remote_is_configured(struct remote *remote, int in_repo)
 int for_each_remote(each_remote_fn fn, void *priv)
 {
        int i, result = 0;
-       read_config(the_repository);
+       read_config(the_repository, 0);
        for (i = 0; i < the_repository->remote_state->remotes_nr && !result;
             i++) {
                struct remote *remote =
@@ -1831,7 +1835,7 @@ struct branch *branch_get(const char *name)
 {
        struct branch *ret;
 
-       read_config(the_repository);
+       read_config(the_repository, 0);
        if (!name || !*name || !strcmp(name, "HEAD"))
                ret = the_repository->remote_state->current_branch;
        else
@@ -1973,7 +1977,7 @@ static const char *branch_get_push_1(struct remote_state *remote_state,
 
 const char *branch_get_push(struct branch *branch, struct strbuf *err)
 {
-       read_config(the_repository);
+       read_config(the_repository, 0);
        die_on_missing_branch(the_repository, branch);
 
        if (!branch)
@@ -2675,7 +2679,7 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote)
                if (MERGE_BASES_BATCH_SIZE < size)
                        size = MERGE_BASES_BATCH_SIZE;
 
-               if ((ret = repo_in_merge_bases_many(the_repository, commit, size, chunk)))
+               if ((ret = repo_in_merge_bases_many(the_repository, commit, size, chunk, 0)))
                        break;
        }
 
index cdc8b1db42c4a836804009a036628aaa94d94b5a..dfd4837e602755806bcfc73a725c04394ef81c6c 100644 (file)
--- a/remote.h
+++ b/remote.h
@@ -118,6 +118,7 @@ struct remote {
  * and configuration.
  */
 struct remote *remote_get(const char *name);
+struct remote *remote_get_early(const char *name);
 
 struct remote *pushremote_get(const char *name);
 int remote_is_configured(struct remote *remote, int in_repo);
@@ -400,8 +401,6 @@ struct ref *get_stale_heads(struct refspec *rs, struct ref *fetch_map);
 /*
  * Compare-and-swap
  */
-#define CAS_OPT_NAME "force-with-lease"
-
 struct push_cas_option {
        unsigned use_tracking_for_rest:1;
        unsigned use_force_if_includes:1;
index 525f69c0c7785845cdf8991e56c8d231c2e6d239..a0b590bc6c0bb927fb0846055f4c4826e9558c80 100644 (file)
@@ -2,7 +2,6 @@
 #include "config.h"
 #include "repository.h"
 #include "midx.h"
-#include "compat/fsmonitor/fsm-listen.h"
 
 static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
                          int def)
@@ -44,6 +43,7 @@ void prepare_repo_settings(struct repository *r)
        if (experimental) {
                r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
                r->settings.pack_use_bitmap_boundary_traversal = 1;
+               r->settings.pack_use_multi_pack_reuse = 1;
        }
        if (manyfiles) {
                r->settings.index_version = 4;
index 9d91536b613bca2734f9e90fa41d3178b93ecfe9..e15b416944dfb21f752093fab777fabf475d4f31 100644 (file)
@@ -114,6 +114,11 @@ void repo_set_compat_hash_algo(struct repository *repo, int algo)
                repo_read_loose_object_map(repo);
 }
 
+void repo_set_ref_storage_format(struct repository *repo, unsigned int format)
+{
+       repo->ref_storage_format = format;
+}
+
 /*
  * Attempt to resolve and set the provided 'gitdir' for repository 'repo'.
  * Return 0 upon success and a non-zero value upon failure.
@@ -195,6 +200,7 @@ int repo_init(struct repository *repo,
 
        repo_set_hash_algo(repo, format.hash_algo);
        repo_set_compat_hash_algo(repo, format.compat_hash_algo);
+       repo_set_ref_storage_format(repo, format.ref_storage_format);
        repo->repository_format_worktree_config = format.worktree_config;
 
        /* take ownership of format.partial_clone */
@@ -270,8 +276,6 @@ static void repo_clear_path_cache(struct repo_path_cache *cache)
        FREE_AND_NULL(cache->merge_rr);
        FREE_AND_NULL(cache->merge_mode);
        FREE_AND_NULL(cache->merge_head);
-       FREE_AND_NULL(cache->merge_autostash);
-       FREE_AND_NULL(cache->auto_merge);
        FREE_AND_NULL(cache->fetch_head);
        FREE_AND_NULL(cache->shallow);
 }
index bf3fc601cc532c76030cca964134e977ca2b94d4..268436779c8f315228aef0dde9039f9ebf4f723e 100644 (file)
@@ -24,6 +24,10 @@ enum fetch_negotiation_setting {
        FETCH_NEGOTIATION_NOOP,
 };
 
+#define REF_STORAGE_FORMAT_UNKNOWN  0
+#define REF_STORAGE_FORMAT_FILES    1
+#define REF_STORAGE_FORMAT_REFTABLE 2
+
 struct repo_settings {
        int initialized;
 
@@ -36,6 +40,7 @@ struct repo_settings {
        int sparse_index;
        int pack_read_reverse_index;
        int pack_use_bitmap_boundary_traversal;
+       int pack_use_multi_pack_reuse;
 
        /*
         * Does this repository have core.useReplaceRefs=true (on by
@@ -64,8 +69,6 @@ struct repo_path_cache {
        char *merge_rr;
        char *merge_mode;
        char *merge_head;
-       char *merge_autostash;
-       char *auto_merge;
        char *fetch_head;
        char *shallow;
 };
@@ -163,6 +166,9 @@ struct repository {
        /* Repository's compatibility hash algorithm. */
        const struct git_hash_algo *compat_hash_algo;
 
+       /* Repository's reference storage format, as serialized on disk. */
+       unsigned int ref_storage_format;
+
        /* A unique-id for tracing purposes. */
        int trace2_repo_id;
 
@@ -203,6 +209,7 @@ void repo_set_gitdir(struct repository *repo, const char *root,
 void repo_set_worktree(struct repository *repo, const char *path);
 void repo_set_hash_algo(struct repository *repo, int algo);
 void repo_set_compat_hash_algo(struct repository *repo, int compat_algo);
+void repo_set_ref_storage_format(struct repository *repo, unsigned int format);
 void initialize_the_repository(void);
 RESULT_MUST_BE_USED
 int repo_init(struct repository *r, const char *gitdir, const char *worktree);
index 725c1b6a95cdedd89152a0f80b8fe2477751458e..13c94ded03706dc3831b0948a1fa7438fa45ab9b 100644 (file)
--- a/rerere.c
+++ b/rerere.c
 #include "dir.h"
 #include "resolve-undo.h"
 #include "merge-ll.h"
-#include "attr.h"
 #include "path.h"
 #include "pathspec.h"
 #include "object-file.h"
 #include "object-store-ll.h"
-#include "hash-lookup.h"
 #include "strmap.h"
 
 #define RESOLVED 0
@@ -975,6 +973,9 @@ static int handle_cache(struct index_state *istate,
                        mmfile[i].ptr = repo_read_object_file(the_repository,
                                                              &ce->oid, &type,
                                                              &size);
+                       if (!mmfile[i].ptr)
+                               die(_("unable to read %s"),
+                                   oid_to_hex(&ce->oid));
                        mmfile[i].size = size;
                }
        }
@@ -1112,7 +1113,7 @@ int rerere_forget(struct repository *r, struct pathspec *pathspec)
         * recover the original conflicted state and then
         * find the conflicted paths.
         */
-       unmerge_index(r->index, pathspec);
+       unmerge_index(r->index, pathspec, 0);
        find_conflict(r, &conflict);
        for (i = 0; i < conflict.nr; i++) {
                struct string_list_item *it = &conflict.items[i];
diff --git a/reset.c b/reset.c
index 48da0adf851e1b09edfc22ffbbc0b1128cbbc5ab..d619cb7115323febadbf4ae84e6764200f962cab 100644 (file)
--- a/reset.c
+++ b/reset.c
@@ -6,7 +6,6 @@
 #include "object-name.h"
 #include "refs.h"
 #include "reset.h"
-#include "run-command.h"
 #include "tree-walk.h"
 #include "tree.h"
 #include "unpack-trees.h"
@@ -158,6 +157,11 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)
        }
 
        tree = parse_tree_indirect(oid);
+       if (!tree) {
+               ret = error(_("unable to read tree (%s)"), oid_to_hex(oid));
+               goto leave_reset_head;
+       }
+
        prime_cache_tree(r, r->index, tree);
 
        if (write_locked_index(r->index, &lock, COMMIT_LOCK) < 0) {
index 7817f5d6db178519c23b4eea66785820cb4315ca..cd02dc99289997e5bf3ac57da3a0c5d482a8301d 100644 (file)
@@ -117,86 +117,59 @@ void resolve_undo_clear_index(struct index_state *istate)
        istate->cache_changed |= RESOLVE_UNDO_CHANGED;
 }
 
-int unmerge_index_entry_at(struct index_state *istate, int pos)
+int unmerge_index_entry(struct index_state *istate, const char *path,
+                       struct resolve_undo_info *ru, unsigned ce_flags)
 {
-       const struct cache_entry *ce;
-       struct string_list_item *item;
-       struct resolve_undo_info *ru;
-       int i, err = 0, matched;
-       char *name;
-
-       if (!istate->resolve_undo)
-               return pos;
-
-       ce = istate->cache[pos];
-       if (ce_stage(ce)) {
-               /* already unmerged */
-               while ((pos < istate->cache_nr) &&
-                      ! strcmp(istate->cache[pos]->name, ce->name))
-                       pos++;
-               return pos - 1; /* return the last entry processed */
+       int i = index_name_pos(istate, path, strlen(path));
+
+       if (i < 0) {
+               /* unmerged? */
+               i = -i - 1;
+               if (i < istate->cache_nr &&
+                   !strcmp(istate->cache[i]->name, path))
+                       /* yes, it is already unmerged */
+                       return 0;
+               /* fallthru: resolved to removal */
+       } else {
+               /* merged - remove it to replace it with unmerged entries */
+               remove_index_entry_at(istate, i);
        }
-       item = string_list_lookup(istate->resolve_undo, ce->name);
-       if (!item)
-               return pos;
-       ru = item->util;
-       if (!ru)
-               return pos;
-       matched = ce->ce_flags & CE_MATCHED;
-       name = xstrdup(ce->name);
-       remove_index_entry_at(istate, pos);
+
        for (i = 0; i < 3; i++) {
-               struct cache_entry *nce;
+               struct cache_entry *ce;
                if (!ru->mode[i])
                        continue;
-               nce = make_cache_entry(istate,
-                                      ru->mode[i],
-                                      &ru->oid[i],
-                                      name, i + 1, 0);
-               if (matched)
-                       nce->ce_flags |= CE_MATCHED;
-               if (add_index_entry(istate, nce, ADD_CACHE_OK_TO_ADD)) {
-                       err = 1;
-                       error("cannot unmerge '%s'", name);
-               }
+               ce = make_cache_entry(istate, ru->mode[i], &ru->oid[i],
+                                     path, i + 1, 0);
+               ce->ce_flags |= ce_flags;
+               if (add_index_entry(istate, ce, ADD_CACHE_OK_TO_ADD))
+                       return error("cannot unmerge '%s'", path);
        }
-       free(name);
-       if (err)
-               return pos;
-       free(ru);
-       item->util = NULL;
-       return unmerge_index_entry_at(istate, pos);
+       return 0;
 }
 
-void unmerge_marked_index(struct index_state *istate)
+void unmerge_index(struct index_state *istate, const struct pathspec *pathspec,
+                  unsigned ce_flags)
 {
-       int i;
+       struct string_list_item *item;
 
        if (!istate->resolve_undo)
                return;
 
        /* TODO: audit for interaction with sparse-index. */
        ensure_full_index(istate);
-       for (i = 0; i < istate->cache_nr; i++) {
-               const struct cache_entry *ce = istate->cache[i];
-               if (ce->ce_flags & CE_MATCHED)
-                       i = unmerge_index_entry_at(istate, i);
-       }
-}
 
-void unmerge_index(struct index_state *istate, const struct pathspec *pathspec)
-{
-       int i;
-
-       if (!istate->resolve_undo)
-               return;
-
-       /* TODO: audit for interaction with sparse-index. */
-       ensure_full_index(istate);
-       for (i = 0; i < istate->cache_nr; i++) {
-               const struct cache_entry *ce = istate->cache[i];
-               if (!ce_path_match(istate, ce, pathspec, NULL))
+       for_each_string_list_item(item, istate->resolve_undo) {
+               const char *path = item->string;
+               struct resolve_undo_info *ru = item->util;
+               if (!item->util)
+                       continue;
+               if (!match_pathspec(istate, pathspec,
+                                   item->string, strlen(item->string),
+                                   0, NULL, 0))
                        continue;
-               i = unmerge_index_entry_at(istate, i);
+               unmerge_index_entry(istate, path, ru, ce_flags);
+               free(ru);
+               item->util = NULL;
        }
 }
index c5deafc92fe7751532162ec308cf2bd62d97cf1b..f3f8462751bfd2e7fb2ab38b2632f059b8f07013 100644 (file)
@@ -17,8 +17,7 @@ void record_resolve_undo(struct index_state *, struct cache_entry *);
 void resolve_undo_write(struct strbuf *, struct string_list *);
 struct string_list *resolve_undo_read(const char *, unsigned long);
 void resolve_undo_clear_index(struct index_state *);
-int unmerge_index_entry_at(struct index_state *, int);
-void unmerge_index(struct index_state *, const struct pathspec *);
-void unmerge_marked_index(struct index_state *);
+int unmerge_index_entry(struct index_state *, const char *, struct resolve_undo_info *, unsigned);
+void unmerge_index(struct index_state *, const struct pathspec *, unsigned);
 
 #endif
index a60dfc23a2a52b6a222e2974d2254d1a20d0e62b..7e45f765d9fe16c8380f457c0d40e385cbf88f55 100644 (file)
@@ -6,6 +6,7 @@
 #include "object-name.h"
 #include "object-file.h"
 #include "object-store-ll.h"
+#include "oidset.h"
 #include "tag.h"
 #include "blob.h"
 #include "tree.h"
 #include "reflog-walk.h"
 #include "patch-ids.h"
 #include "decorate.h"
-#include "log-tree.h"
 #include "string-list.h"
 #include "line-log.h"
 #include "mailmap.h"
 #include "commit-slab.h"
-#include "dir.h"
 #include "cache-tree.h"
 #include "bisect.h"
 #include "packfile.h"
@@ -382,13 +381,18 @@ static struct object *get_reference(struct rev_info *revs, const char *name,
 
        object = parse_object_with_flags(revs->repo, oid,
                                         revs->verify_objects ? 0 :
-                                        PARSE_OBJECT_SKIP_HASH_CHECK);
+                                        PARSE_OBJECT_SKIP_HASH_CHECK |
+                                        PARSE_OBJECT_DISCARD_TREE);
 
        if (!object) {
                if (revs->ignore_missing)
-                       return object;
+                       return NULL;
                if (revs->exclude_promisor_objects && is_promisor_object(oid))
                        return NULL;
+               if (revs->do_not_die_on_missing_objects) {
+                       oidset_insert(&revs->missing_commits, oid);
+                       return NULL;
+               }
                die("bad object %s", name);
        }
        object->flags |= flags;
@@ -416,15 +420,21 @@ static struct commit *handle_commit(struct rev_info *revs,
         */
        while (object->type == OBJ_TAG) {
                struct tag *tag = (struct tag *) object;
+               struct object_id *oid;
                if (revs->tag_objects && !(flags & UNINTERESTING))
                        add_pending_object(revs, object, tag->tag);
-               object = parse_object(revs->repo, get_tagged_oid(tag));
+               oid = get_tagged_oid(tag);
+               object = parse_object(revs->repo, oid);
                if (!object) {
                        if (revs->ignore_missing_links || (flags & UNINTERESTING))
                                return NULL;
                        if (revs->exclude_promisor_objects &&
                            is_promisor_object(&tag->tagged->oid))
                                return NULL;
+                       if (revs->do_not_die_on_missing_objects && oid) {
+                               oidset_insert(&revs->missing_commits, oid);
+                               return NULL;
+                       }
                        die("bad object %s", oid_to_hex(&tag->tagged->oid));
                }
                object->flags |= flags;
@@ -1112,6 +1122,9 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
 
        if (commit->object.flags & ADDED)
                return 0;
+       if (revs->do_not_die_on_missing_objects &&
+           oidset_contains(&revs->missing_commits, &commit->object.oid))
+               return 0;
        commit->object.flags |= ADDED;
 
        if (revs->include_check &&
@@ -1168,7 +1181,8 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
        for (parent = commit->parents; parent; parent = parent->next) {
                struct commit *p = parent->item;
                int gently = revs->ignore_missing_links ||
-                            revs->exclude_promisor_objects;
+                            revs->exclude_promisor_objects ||
+                            revs->do_not_die_on_missing_objects;
                if (repo_parse_commit_gently(revs->repo, p, gently) < 0) {
                        if (revs->exclude_promisor_objects &&
                            is_promisor_object(&p->object.oid)) {
@@ -1176,7 +1190,11 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
                                        break;
                                continue;
                        }
-                       return -1;
+
+                       if (revs->do_not_die_on_missing_objects)
+                               oidset_insert(&revs->missing_commits, &p->object.oid);
+                       else
+                               return -1; /* corrupt repository */
                }
                if (revs->sources) {
                        char **slot = revision_sources_at(revs->sources, p);
@@ -1679,9 +1697,7 @@ static int handle_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
        return 0;
 }
 
-static int handle_one_reflog(const char *refname_in_wt,
-                            const struct object_id *oid UNUSED,
-                            int flag UNUSED, void *cb_data)
+static int handle_one_reflog(const char *refname_in_wt, void *cb_data)
 {
        struct all_refs_cb *cb = cb_data;
        struct strbuf refname = STRBUF_INIT;
@@ -1940,6 +1956,7 @@ void repo_init_revisions(struct repository *r,
        init_display_notes(&revs->notes_opt);
        list_objects_filter_init(&revs->filter);
        init_ref_exclusions(&revs->ref_excludes);
+       oidset_init(&revs->missing_commits, 0);
 }
 
 static void add_pending_commit_list(struct rev_info *revs,
@@ -1954,11 +1971,31 @@ static void add_pending_commit_list(struct rev_info *revs,
        }
 }
 
+static const char *lookup_other_head(struct object_id *oid)
+{
+       int i;
+       static const char *const other_head[] = {
+               "MERGE_HEAD", "CHERRY_PICK_HEAD", "REVERT_HEAD", "REBASE_HEAD"
+       };
+
+       for (i = 0; i < ARRAY_SIZE(other_head); i++)
+               if (!read_ref_full(other_head[i],
+                               RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
+                               oid, NULL)) {
+                       if (is_null_oid(oid))
+                               die(_("%s exists but is a symbolic ref"), other_head[i]);
+                       return other_head[i];
+               }
+
+       die(_("--merge requires one of the pseudorefs MERGE_HEAD, CHERRY_PICK_HEAD, REVERT_HEAD or REBASE_HEAD"));
+}
+
 static void prepare_show_merge(struct rev_info *revs)
 {
-       struct commit_list *bases;
+       struct commit_list *bases = NULL;
        struct commit *head, *other;
        struct object_id oid;
+       const char *other_name;
        const char **prune = NULL;
        int i, prune_num = 1; /* counting terminating NULL */
        struct index_state *istate = revs->repo->index;
@@ -1966,12 +2003,12 @@ static void prepare_show_merge(struct rev_info *revs)
        if (repo_get_oid(the_repository, "HEAD", &oid))
                die("--merge without HEAD?");
        head = lookup_commit_or_die(&oid, "HEAD");
-       if (repo_get_oid(the_repository, "MERGE_HEAD", &oid))
-               die("--merge without MERGE_HEAD?");
-       other = lookup_commit_or_die(&oid, "MERGE_HEAD");
+       other_name = lookup_other_head(&oid);
+       other = lookup_commit_or_die(&oid, other_name);
        add_pending_object(revs, &head->object, "HEAD");
-       add_pending_object(revs, &other->object, "MERGE_HEAD");
-       bases = repo_get_merge_bases(the_repository, head, other);
+       add_pending_object(revs, &other->object, other_name);
+       if (repo_get_merge_bases(the_repository, head, other, &bases) < 0)
+               exit(128);
        add_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM);
        add_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM);
        free_commit_list(bases);
@@ -2059,14 +2096,17 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
        } else {
                /* A...B -- find merge bases between the two */
                struct commit *a, *b;
-               struct commit_list *exclude;
+               struct commit_list *exclude = NULL;
 
                a = lookup_commit_reference(revs->repo, &a_obj->oid);
                b = lookup_commit_reference(revs->repo, &b_obj->oid);
                if (!a || !b)
                        return dotdot_missing(arg, dotdot, revs, symmetric);
 
-               exclude = repo_get_merge_bases(the_repository, a, b);
+               if (repo_get_merge_bases(the_repository, a, b, &exclude) < 0) {
+                       free_commit_list(exclude);
+                       return -1;
+               }
                add_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE,
                                     flags_exclude);
                add_pending_commit_list(revs, exclude, flags_exclude);
@@ -2171,13 +2211,18 @@ static int handle_revision_arg_1(const char *arg_, struct rev_info *revs, int fl
        if (revarg_opt & REVARG_COMMITTISH)
                get_sha1_flags |= GET_OID_COMMITTISH;
 
+       /*
+        * Even if revs->do_not_die_on_missing_objects is set, we
+        * should error out if we can't even get an oid, as
+        * `--missing=print` should be able to report missing oids.
+        */
        if (get_oid_with_context(revs->repo, arg, get_sha1_flags, &oid, &oc))
                return revs->ignore_missing ? 0 : -1;
        if (!cant_be_filename)
                verify_non_filename(revs->prefix, arg);
        object = get_reference(revs, arg, &oid, flags ^ local_flags);
        if (!object)
-               return revs->ignore_missing ? 0 : -1;
+               return (revs->ignore_missing || revs->do_not_die_on_missing_objects) ? 0 : -1;
        add_rev_cmdline(revs, object, arg_, REV_CMD_REV, flags ^ local_flags);
        add_pending_object_with_path(revs, object, arg, oc.mode, oc.path);
        free(oc.path);
@@ -2214,6 +2259,27 @@ static void add_message_grep(struct rev_info *revs, const char *pattern)
        add_grep(revs, pattern, GREP_PATTERN_BODY);
 }
 
+static int parse_count(const char *arg)
+{
+       int count;
+
+       if (strtol_i(arg, 10, &count) < 0)
+               die("'%s': not an integer", arg);
+       return count;
+}
+
+static timestamp_t parse_age(const char *arg)
+{
+       timestamp_t num;
+       char *p;
+
+       errno = 0;
+       num = parse_timestamp(arg, &p, 10);
+       if (errno || *p || p == arg)
+               die("'%s': not a number of seconds since epoch", arg);
+       return num;
+}
+
 static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
                               int *unkc, const char **unkv,
                               const struct setup_revision_opt* opt)
@@ -2240,29 +2306,27 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
        }
 
        if ((argcount = parse_long_opt("max-count", argv, &optarg))) {
-               revs->max_count = atoi(optarg);
+               revs->max_count = parse_count(optarg);
                revs->no_walk = 0;
                return argcount;
        } else if ((argcount = parse_long_opt("skip", argv, &optarg))) {
-               revs->skip_count = atoi(optarg);
+               revs->skip_count = parse_count(optarg);
                return argcount;
        } else if ((*arg == '-') && isdigit(arg[1])) {
                /* accept -<digit>, like traditional "head" */
-               if (strtol_i(arg + 1, 10, &revs->max_count) < 0 ||
-                   revs->max_count < 0)
-                       die("'%s': not a non-negative integer", arg + 1);
+               revs->max_count = parse_count(arg + 1);
                revs->no_walk = 0;
        } else if (!strcmp(arg, "-n")) {
                if (argc <= 1)
                        return error("-n requires an argument");
-               revs->max_count = atoi(argv[1]);
+               revs->max_count = parse_count(argv[1]);
                revs->no_walk = 0;
                return 2;
        } else if (skip_prefix(arg, "-n", &optarg)) {
-               revs->max_count = atoi(optarg);
+               revs->max_count = parse_count(optarg);
                revs->no_walk = 0;
        } else if ((argcount = parse_long_opt("max-age", argv, &optarg))) {
-               revs->max_age = atoi(optarg);
+               revs->max_age = parse_age(optarg);
                return argcount;
        } else if ((argcount = parse_long_opt("since", argv, &optarg))) {
                revs->max_age = approxidate(optarg);
@@ -2274,7 +2338,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->max_age = approxidate(optarg);
                return argcount;
        } else if ((argcount = parse_long_opt("min-age", argv, &optarg))) {
-               revs->min_age = atoi(optarg);
+               revs->min_age = parse_age(optarg);
                return argcount;
        } else if ((argcount = parse_long_opt("before", argv, &optarg))) {
                revs->min_age = approxidate(optarg);
@@ -2294,7 +2358,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
        } else if (skip_prefix(arg, "--ancestry-path=", &optarg)) {
                struct commit *c;
                struct object_id oid;
-               const char *msg = _("could not get commit for ancestry-path argument %s");
+               const char *msg = _("could not get commit for --ancestry-path argument %s");
 
                revs->ancestry_path = 1;
                revs->simplify_history = 0;
@@ -2362,11 +2426,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
        } else if (!strcmp(arg, "--no-merges")) {
                revs->max_parents = 1;
        } else if (skip_prefix(arg, "--min-parents=", &optarg)) {
-               revs->min_parents = atoi(optarg);
+               revs->min_parents = parse_count(optarg);
        } else if (!strcmp(arg, "--no-min-parents")) {
                revs->min_parents = 0;
        } else if (skip_prefix(arg, "--max-parents=", &optarg)) {
-               revs->max_parents = atoi(optarg);
+               revs->max_parents = parse_count(optarg);
        } else if (!strcmp(arg, "--no-max-parents")) {
                revs->max_parents = -1;
        } else if (!strcmp(arg, "--boundary")) {
@@ -2375,8 +2439,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->left_right = 1;
        } else if (!strcmp(arg, "--left-only")) {
                if (revs->right_only)
-                       die("--left-only is incompatible with --right-only"
-                           " or --cherry");
+                       die(_("options '%s' and '%s' cannot be used together"),
+                           "--left-only", "--right-only/--cherry");
                revs->left_only = 1;
        } else if (!strcmp(arg, "--right-only")) {
                if (revs->left_only)
@@ -2484,6 +2548,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->break_bar = xstrdup(optarg);
                revs->track_linear = 1;
                revs->track_first_time = 1;
+       } else if (!strcmp(arg, "--show-notes-by-default")) {
+               revs->show_notes_by_default = 1;
        } else if (skip_prefix(arg, "--show-notes=", &optarg) ||
                   skip_prefix(arg, "--notes=", &optarg)) {
                if (starts_with(arg, "--show-notes=") &&
@@ -2698,7 +2764,8 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (!strcmp(arg, "--branches")) {
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --branches"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--branches");
                handle_refs(refs, revs, *flags, refs_for_each_branch_ref);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (!strcmp(arg, "--bisect")) {
@@ -2709,12 +2776,14 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
                revs->bisect = 1;
        } else if (!strcmp(arg, "--tags")) {
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --tags"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--tags");
                handle_refs(refs, revs, *flags, refs_for_each_tag_ref);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (!strcmp(arg, "--remotes")) {
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --remotes"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--remotes");
                handle_refs(refs, revs, *flags, refs_for_each_remote_ref);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if ((argcount = parse_long_opt("glob", argv, &optarg))) {
@@ -2732,21 +2801,24 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
        } else if (skip_prefix(arg, "--branches=", &optarg)) {
                struct all_refs_cb cb;
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --branches"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--branches");
                init_all_refs_cb(&cb, revs, *flags);
                for_each_glob_ref_in(handle_one_ref, optarg, "refs/heads/", &cb);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (skip_prefix(arg, "--tags=", &optarg)) {
                struct all_refs_cb cb;
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --tags"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--tags");
                init_all_refs_cb(&cb, revs, *flags);
                for_each_glob_ref_in(handle_one_ref, optarg, "refs/tags/", &cb);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (skip_prefix(arg, "--remotes=", &optarg)) {
                struct all_refs_cb cb;
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --remotes"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--remotes");
                init_all_refs_cb(&cb, revs, *flags);
                for_each_glob_ref_in(handle_one_ref, optarg, "refs/remotes/", &cb);
                clear_ref_exclusions(&revs->ref_excludes);
@@ -2788,13 +2860,13 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
 }
 
 static void read_revisions_from_stdin(struct rev_info *revs,
-                                     struct strvec *prune,
-                                     int *flags)
+                                     struct strvec *prune)
 {
        struct strbuf sb;
        int seen_dashdash = 0;
        int seen_end_of_options = 0;
        int save_warning;
+       int flags = 0;
 
        save_warning = warn_on_object_refname_ambiguity;
        warn_on_object_refname_ambiguity = 0;
@@ -2817,13 +2889,13 @@ static void read_revisions_from_stdin(struct rev_info *revs,
                                continue;
                        }
 
-                       if (handle_revision_pseudo_opt(revs, argv, flags) > 0)
+                       if (handle_revision_pseudo_opt(revs, argv, &flags) > 0)
                                continue;
 
                        die(_("invalid option '%s' in --stdin mode"), sb.buf);
                }
 
-               if (handle_revision_arg(sb.buf, revs, 0,
+               if (handle_revision_arg(sb.buf, revs, flags,
                                        REVARG_CANNOT_BE_FILENAME))
                        die("bad revision '%s'", sb.buf);
        }
@@ -2906,7 +2978,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
                                }
                                if (revs->read_from_stdin++)
                                        die("--stdin given twice?");
-                               read_revisions_from_stdin(revs, &prune_data, &flags);
+                               read_revisions_from_stdin(revs, &prune_data);
                                continue;
                        }
 
@@ -3025,8 +3097,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
                revs->grep_filter.ignore_locale = 1;
        compile_grep_patterns(&revs->grep_filter);
 
-       if (revs->reverse && revs->reflog_info)
-               die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--walk-reflogs");
        if (revs->reflog_info && revs->limited)
                die("cannot combine --walk-reflogs with history-limiting options");
        if (revs->rewrite_parents && revs->children.name)
@@ -3037,11 +3107,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
        /*
         * Limitations on the graph functionality
         */
-       if (revs->reverse && revs->graph)
-               die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--graph");
+       die_for_incompatible_opt3(!!revs->graph, "--graph",
+                                 !!revs->reverse, "--reverse",
+                                 !!revs->reflog_info, "--walk-reflogs");
 
-       if (revs->reflog_info && revs->graph)
-               die(_("options '%s' and '%s' cannot be used together"), "--walk-reflogs", "--graph");
        if (revs->no_walk && revs->graph)
                die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph");
        if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
@@ -3054,6 +3123,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
        if (revs->expand_tabs_in_log < 0)
                revs->expand_tabs_in_log = revs->expand_tabs_in_log_default;
 
+       if (!revs->show_notes_given && revs->show_notes_by_default) {
+               enable_default_display_notes(&revs->notes_opt, &revs->show_notes);
+               revs->show_notes_given = 1;
+       }
+
        return left;
 }
 
@@ -3076,6 +3150,11 @@ static void release_revisions_mailmap(struct string_list *mailmap)
 
 static void release_revisions_topo_walk_info(struct topo_walk_info *info);
 
+static void free_void_commit_list(void *list)
+{
+       free_commit_list(list);
+}
+
 void release_revisions(struct rev_info *revs)
 {
        free_commit_list(revs->commits);
@@ -3093,6 +3172,11 @@ void release_revisions(struct rev_info *revs)
        diff_free(&revs->pruning);
        reflog_walk_info_release(revs->reflog_info);
        release_revisions_topo_walk_info(revs->topo_walk_info);
+       clear_decoration(&revs->children, free_void_commit_list);
+       clear_decoration(&revs->merge_simplification, free);
+       clear_decoration(&revs->treesame, free);
+       line_log_free(revs);
+       oidset_clear(&revs->missing_commits);
 }
 
 static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)
index 82ab400139de30fd6af5e00f2047c51a62a8ed7d..94c43138bc3e68651accecf79cdf4c28ba98582f 100644 (file)
@@ -4,6 +4,7 @@
 #include "commit.h"
 #include "grep.h"
 #include "notes.h"
+#include "oidset.h"
 #include "pretty.h"
 #include "diff.h"
 #include "commit-slab-decl.h"
@@ -212,18 +213,19 @@ struct rev_info {
 
                        /*
                         * Blobs are shown without regard for their existence.
-                        * But not so for trees: unless exclude_promisor_objects
+                        * But not so for trees/commits: unless exclude_promisor_objects
                         * is set and the tree in question is a promisor object;
                         * OR ignore_missing_links is set, the revision walker
-                        * dies with a "bad tree object HASH" message when
-                        * encountering a missing tree. For callers that can
-                        * handle missing trees and want them to be filterable
+                        * dies with a "bad <type> object HASH" message when
+                        * encountering a missing object. For callers that can
+                        * handle missing trees/commits and want them to be filterable
                         * and showable, set this to true. The revision walker
-                        * will filter and show such a missing tree as usual,
-                        * but will not attempt to recurse into this tree
-                        * object.
+                        * will filter and show such a missing object as usual,
+                        * but will not attempt to recurse into this tree/commit
+                        * object. The revision walker will also set the MISSING
+                        * flag for such objects.
                         */
-                       do_not_die_on_missing_tree:1,
+                       do_not_die_on_missing_objects:1,
 
                        /* for internal use only */
                        exclude_promisor_objects:1;
@@ -253,6 +255,7 @@ struct rev_info {
                        shown_dashes:1,
                        show_merge:1,
                        show_notes_given:1,
+                       show_notes_by_default:1,
                        show_signature:1,
                        pretty_given:1,
                        abbrev_commit:1,
@@ -371,6 +374,9 @@ struct rev_info {
 
        /* Location where temporary objects for remerge-diff are written. */
        struct tmp_objdir *remerge_objdir;
+
+       /* Missing commits to be tracked without failing traversal. */
+       struct oidset missing_commits;
 };
 
 /**
index a558042c876ad2baefcfcc111163bab9691f7f1c..0e7435718a52267a2421a27320b783ee9ce0c1a4 100644 (file)
@@ -14,9 +14,7 @@
 #include "quote.h"
 #include "config.h"
 #include "packfile.h"
-#include "hook.h"
 #include "compat/nonblock.h"
-#include "alloc.h"
 
 void child_process_init(struct child_process *child)
 {
index df7358f481cc2d6fd307a27f0bfc5bd070daefd5..fb2940c2a00c94d806319dc8d45e8ffed1231c17 100644 (file)
--- a/scalar.c
+++ b/scalar.c
@@ -409,6 +409,7 @@ static int cmd_clone(int argc, const char **argv)
 {
        const char *branch = NULL;
        int full_clone = 0, single_branch = 0, show_progress = isatty(2);
+       int src = 1;
        struct option clone_options[] = {
                OPT_STRING('b', "branch", &branch, N_("<branch>"),
                           N_("branch to checkout after clone")),
@@ -417,10 +418,13 @@ static int cmd_clone(int argc, const char **argv)
                OPT_BOOL(0, "single-branch", &single_branch,
                         N_("only download metadata for the branch that will "
                            "be checked out")),
+               OPT_BOOL(0, "src", &src,
+                        N_("create repository within 'src' directory")),
                OPT_END(),
        };
        const char * const clone_usage[] = {
-               N_("scalar clone [<options>] [--] <repo> [<dir>]"),
+               N_("scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]\n"
+                  "\t[--[no-]src] <url> [<enlistment>]"),
                NULL
        };
        const char *url;
@@ -456,7 +460,10 @@ static int cmd_clone(int argc, const char **argv)
        if (is_directory(enlistment))
                die(_("directory '%s' exists already"), enlistment);
 
-       dir = xstrfmt("%s/src", enlistment);
+       if (src)
+               dir = xstrfmt("%s/src", enlistment);
+       else
+               dir = xstrdup(enlistment);
 
        strbuf_reset(&buf);
        if (branch)
@@ -657,6 +664,7 @@ static int cmd_reconfigure(int argc, const char **argv)
        git_config(get_scalar_repos, &scalar_repos);
 
        for (i = 0; i < scalar_repos.nr; i++) {
+               int succeeded = 0;
                const char *dir = scalar_repos.items[i].string;
 
                strbuf_reset(&commondir);
@@ -667,30 +675,56 @@ static int cmd_reconfigure(int argc, const char **argv)
 
                        if (errno != ENOENT) {
                                warning_errno(_("could not switch to '%s'"), dir);
-                               res = -1;
-                               continue;
+                               goto loop_end;
                        }
 
                        strbuf_addstr(&buf, dir);
                        if (remove_deleted_enlistment(&buf))
-                               res = error(_("could not remove stale "
-                                             "scalar.repo '%s'"), dir);
-                       else
-                               warning(_("removing stale scalar.repo '%s'"),
+                               error(_("could not remove stale "
+                                       "scalar.repo '%s'"), dir);
+                       else {
+                               warning(_("removed stale scalar.repo '%s'"),
                                        dir);
+                               succeeded = 1;
+                       }
                        strbuf_release(&buf);
-               } else if (discover_git_directory(&commondir, &gitdir) < 0) {
-                       warning_errno(_("git repository gone in '%s'"), dir);
-                       res = -1;
-               } else {
-                       git_config_clear();
+                       goto loop_end;
+               }
+
+               switch (discover_git_directory_reason(&commondir, &gitdir)) {
+               case GIT_DIR_INVALID_OWNERSHIP:
+                       warning(_("repository at '%s' has different owner"), dir);
+                       goto loop_end;
+
+               case GIT_DIR_INVALID_GITFILE:
+               case GIT_DIR_INVALID_FORMAT:
+                       warning(_("repository at '%s' has a format issue"), dir);
+                       goto loop_end;
+
+               case GIT_DIR_DISCOVERED:
+                       succeeded = 1;
+                       break;
+
+               default:
+                       warning(_("repository not found in '%s'"), dir);
+                       break;
+               }
 
-                       the_repository = &r;
-                       r.commondir = commondir.buf;
-                       r.gitdir = gitdir.buf;
+               git_config_clear();
 
-                       if (set_recommended_config(1) < 0)
-                               res = -1;
+               the_repository = &r;
+               r.commondir = commondir.buf;
+               r.gitdir = gitdir.buf;
+
+               if (set_recommended_config(1) >= 0)
+                       succeeded = 1;
+
+loop_end:
+               if (!succeeded) {
+                       res = -1;
+                       warning(_("to unregister this repository from Scalar, run\n"
+                                 "\tgit config --global --unset --fixed-value scalar.repo \"%s\""),
+                               dir);
                }
        }
 
index 89aca9d829ed046f532b87120f39d807c86ebcb9..37f59d4f66bbc2b21bf08288a75de4a159b24625 100644 (file)
@@ -4,7 +4,6 @@
 #include "date.h"
 #include "gettext.h"
 #include "hex.h"
-#include "refs.h"
 #include "object-store-ll.h"
 #include "pkt-line.h"
 #include "sideband.h"
@@ -12,7 +11,6 @@
 #include "remote.h"
 #include "connect.h"
 #include "send-pack.h"
-#include "quote.h"
 #include "transport.h"
 #include "version.h"
 #include "oid-array.h"
index 5e0c15a16b73b3bf04fc76afc2bc2bd1c15f677d..4e14fa6541c7012c8549e84957c47f386efbc7ec 100644 (file)
 #include "pager.h"
 #include "commit.h"
 #include "sequencer.h"
-#include "tag.h"
 #include "run-command.h"
 #include "hook.h"
-#include "exec-cmd.h"
 #include "utf8.h"
 #include "cache-tree.h"
 #include "diff.h"
@@ -39,7 +37,6 @@
 #include "notes-utils.h"
 #include "sigchain.h"
 #include "unpack-trees.h"
-#include "worktree.h"
 #include "oidmap.h"
 #include "oidset.h"
 #include "commit-slab.h"
 
 #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
 
+/*
+ * To accommodate common filesystem limitations, where the loose refs' file
+ * names must not exceed `NAME_MAX`, the labels generated by `git rebase
+ * --rebase-merges` need to be truncated if the corresponding commit subjects
+ * are too long.
+ * Add some margin to stay clear from reaching `NAME_MAX`.
+ */
+#define GIT_MAX_LABEL_LENGTH ((NAME_MAX) - (LOCK_SUFFIX_LEN) - 16)
+
 static const char sign_off_header[] = "Signed-off-by: ";
 static const char cherry_picked_prefix[] = "(cherry picked from commit ";
 
@@ -138,6 +144,11 @@ static GIT_PATH_FUNC(rebase_path_amend, "rebase-merge/amend")
  * the commit object name of the corresponding patch.
  */
 static GIT_PATH_FUNC(rebase_path_stopped_sha, "rebase-merge/stopped-sha")
+/*
+ * When we stop for the user to resolve conflicts this file contains
+ * the patch of the commit that is being picked.
+ */
+static GIT_PATH_FUNC(rebase_path_patch, "rebase-merge/patch")
 /*
  * For the post-rewrite hook, we make a list of rewritten commits and
  * their new sha1s.  The rewritten-pending list keeps the sha1s of
@@ -224,34 +235,29 @@ static int git_sequencer_config(const char *k, const char *v,
                                const struct config_context *ctx, void *cb)
 {
        struct replay_opts *opts = cb;
-       int status;
 
        if (!strcmp(k, "commit.cleanup")) {
-               const char *s;
-
-               status = git_config_string(&s, k, v);
-               if (status)
-                       return status;
+               if (!v)
+                       return config_error_nonbool(k);
 
-               if (!strcmp(s, "verbatim")) {
+               if (!strcmp(v, "verbatim")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
                        opts->explicit_cleanup = 1;
-               } else if (!strcmp(s, "whitespace")) {
+               } else if (!strcmp(v, "whitespace")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
                        opts->explicit_cleanup = 1;
-               } else if (!strcmp(s, "strip")) {
+               } else if (!strcmp(v, "strip")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_ALL;
                        opts->explicit_cleanup = 1;
-               } else if (!strcmp(s, "scissors")) {
+               } else if (!strcmp(v, "scissors")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SCISSORS;
                        opts->explicit_cleanup = 1;
                } else {
                        warning(_("invalid commit message cleanup mode '%s'"),
-                                 s);
+                                 v);
                }
 
-               free((char *)s);
-               return status;
+               return 0;
        }
 
        if (!strcmp(k, "commit.gpgsign")) {
@@ -326,12 +332,12 @@ static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob,
                sb->buf[sb->len - ignore_footer] = '\0';
        }
 
-       trailer_info_get(&info, sb->buf, &opts);
+       trailer_info_get(&opts, sb->buf, &info);
 
        if (ignore_footer)
                sb->buf[sb->len - ignore_footer] = saved_char;
 
-       if (info.trailer_start == info.trailer_end)
+       if (info.trailer_block_start == info.trailer_block_end)
                return 0;
 
        for (i = 0; i < info.trailer_nr; i++)
@@ -424,10 +430,9 @@ struct commit_message {
        const char *message;
 };
 
-static const char *short_commit_name(struct commit *commit)
+static const char *short_commit_name(struct repository *r, struct commit *commit)
 {
-       return repo_find_unique_abbrev(the_repository, &commit->object.oid,
-                                      DEFAULT_ABBREV);
+       return repo_find_unique_abbrev(r, &commit->object.oid, DEFAULT_ABBREV);
 }
 
 static int get_message(struct commit *commit, struct commit_message *out)
@@ -437,7 +442,7 @@ static int get_message(struct commit *commit, struct commit_message *out)
 
        out->message = repo_logmsg_reencode(the_repository, commit, NULL,
                                            get_commit_output_encoding());
-       abbrev = short_commit_name(commit);
+       abbrev = short_commit_name(the_repository, commit);
 
        subject_len = find_commit_subject(out->message, &subject);
 
@@ -456,10 +461,22 @@ static void free_message(struct commit *commit, struct commit_message *msg)
        repo_unuse_commit_buffer(the_repository, commit, msg->message);
 }
 
+const char *rebase_resolvemsg =
+N_("Resolve all conflicts manually, mark them as resolved with\n"
+"\"git add/rm <conflicted_files>\", then run \"git rebase --continue\".\n"
+"You can instead skip this commit: run \"git rebase --skip\".\n"
+"To abort and get back to the state before \"git rebase\", run "
+"\"git rebase --abort\".");
+
 static void print_advice(struct repository *r, int show_hint,
                         struct replay_opts *opts)
 {
-       char *msg = getenv("GIT_CHERRY_PICK_HELP");
+       const char *msg;
+
+       if (is_rebase_i(opts))
+               msg = rebase_resolvemsg;
+       else
+               msg = getenv("GIT_CHERRY_PICK_HELP");
 
        if (msg) {
                advise("%s\n", msg);
@@ -469,7 +486,7 @@ static void print_advice(struct repository *r, int show_hint,
                 * of the commit itself so remove CHERRY_PICK_HEAD
                 */
                refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
-                               NULL, 0);
+                               NULL, REF_NO_DEREF);
                return;
        }
 
@@ -702,6 +719,8 @@ static int do_recursive_merge(struct repository *r,
        o.show_rename_progress = 1;
 
        head_tree = parse_tree_indirect(head);
+       if (!head_tree)
+               return error(_("unable to read tree (%s)"), oid_to_hex(head));
        next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);
        base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r);
 
@@ -1662,7 +1681,7 @@ static int do_commit(struct repository *r,
                strbuf_release(&sb);
                if (!res) {
                        refs_delete_ref(get_main_ref_store(r), "",
-                                       "CHERRY_PICK_HEAD", NULL, 0);
+                                       "CHERRY_PICK_HEAD", NULL, REF_NO_DEREF);
                        unlink(git_path_merge_msg(r));
                        if (!is_rebase_i(opts))
                                print_commit_summary(r, NULL, &oid,
@@ -2249,6 +2268,8 @@ static int do_pick_commit(struct repository *r,
         */
 
        if (command == TODO_REVERT) {
+               const char *orig_subject;
+
                base = commit;
                base_label = msg.label;
                next = parent;
@@ -2256,6 +2277,15 @@ static int do_pick_commit(struct repository *r,
                if (opts->commit_use_reference) {
                        strbuf_addstr(&msgbuf,
                                "# *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***");
+               } else if (skip_prefix(msg.subject, "Revert \"", &orig_subject) &&
+                          /*
+                           * We don't touch pre-existing repeated reverts, because
+                           * theoretically these can be nested arbitrarily deeply,
+                           * thus requiring excessive complexity to deal with.
+                           */
+                          !starts_with(orig_subject, "Revert \"")) {
+                       strbuf_addstr(&msgbuf, "Reapply \"");
+                       strbuf_addstr(&msgbuf, orig_subject);
                } else {
                        strbuf_addstr(&msgbuf, "Revert \"");
                        strbuf_addstr(&msgbuf, msg.subject);
@@ -2311,7 +2341,7 @@ static int do_pick_commit(struct repository *r,
                        const char *dest = git_path_squash_msg(r);
                        unlink(dest);
                        if (copy_file(dest, rebase_path_squash_msg(), 0666)) {
-                               res = error(_("could not rename '%s' to '%s'"),
+                               res = error(_("could not copy '%s' to '%s'"),
                                            rebase_path_squash_msg(), dest);
                                goto leave;
                        }
@@ -2374,7 +2404,7 @@ static int do_pick_commit(struct repository *r,
                error(command == TODO_REVERT
                      ? _("could not revert %s... %s")
                      : _("could not apply %s... %s"),
-                     short_commit_name(commit), msg.subject);
+                     short_commit_name(r, commit), msg.subject);
                print_advice(r, res == 1, opts);
                repo_rerere(r, opts->allow_rerere_auto);
                goto leave;
@@ -2390,9 +2420,10 @@ static int do_pick_commit(struct repository *r,
        } else if (allow == 2) {
                drop_commit = 1;
                refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
-                               NULL, 0);
+                               NULL, REF_NO_DEREF);
                unlink(git_path_merge_msg(r));
-               unlink(git_path_auto_merge(r));
+               refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE",
+                               NULL, REF_NO_DEREF);
                fprintf(stderr,
                        _("dropping %s %s -- patch contents already upstream\n"),
                        oid_to_hex(&commit->object.oid), msg.subject);
@@ -2641,7 +2672,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
        return item->commit ? 0 : -1;
 }
 
-int sequencer_get_last_command(struct repository *r, enum replay_action *action)
+int sequencer_get_last_command(struct repository *r UNUSED, enum replay_action *action)
 {
        const char *todo_file, *bol;
        struct strbuf buf = STRBUF_INIT;
@@ -2786,7 +2817,7 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 
        if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD")) {
                if (!refs_delete_ref(get_main_ref_store(r), "",
-                                    "CHERRY_PICK_HEAD", NULL, 0) &&
+                                    "CHERRY_PICK_HEAD", NULL, REF_NO_DEREF) &&
                    verbose)
                        warning(_("cancelling a cherry picking in progress"));
                opts.action = REPLAY_PICK;
@@ -2795,14 +2826,15 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
 
        if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
                if (!refs_delete_ref(get_main_ref_store(r), "", "REVERT_HEAD",
-                                    NULL, 0) &&
+                                    NULL, REF_NO_DEREF) &&
                    verbose)
                        warning(_("cancelling a revert in progress"));
                opts.action = REPLAY_REVERT;
                need_cleanup = 1;
        }
 
-       unlink(git_path_auto_merge(r));
+       refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE",
+                       NULL, REF_NO_DEREF);
 
        if (!need_cleanup)
                return;
@@ -3163,7 +3195,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,
                item->offset_in_buf = todo_list->buf.len;
                subject_len = find_commit_subject(commit_buffer, &subject);
                strbuf_addf(&todo_list->buf, "%s %s %.*s\n", command_string,
-                       short_commit_name(commit), subject_len, subject);
+                       short_commit_name(the_repository, commit),
+                       subject_len, subject);
                repo_unuse_commit_buffer(the_repository, commit,
                                         commit_buffer);
        }
@@ -3392,7 +3425,8 @@ give_advice:
        return -1;
 }
 
-static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
+static int save_todo(struct todo_list *todo_list, struct replay_opts *opts,
+                    int reschedule)
 {
        struct lock_file todo_lock = LOCK_INIT;
        const char *todo_path = get_todo_path(opts);
@@ -3402,7 +3436,7 @@ static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
         * rebase -i writes "git-rebase-todo" without the currently executing
         * command, appending it to "done" instead.
         */
-       if (is_rebase_i(opts))
+       if (is_rebase_i(opts) && !reschedule)
                next++;
 
        fd = hold_lock_file_for_update(&todo_lock, todo_path, 0);
@@ -3415,7 +3449,7 @@ static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
        if (commit_lock_file(&todo_lock) < 0)
                return error(_("failed to finalize '%s'"), todo_path);
 
-       if (is_rebase_i(opts) && next > 0) {
+       if (is_rebase_i(opts) && !reschedule && next > 0) {
                const char *done = rebase_path_done();
                int fd = open(done, O_CREAT | O_WRONLY | O_APPEND, 0666);
                int ret = 0;
@@ -3496,18 +3530,19 @@ static int make_patch(struct repository *r,
                      struct commit *commit,
                      struct replay_opts *opts)
 {
-       struct strbuf buf = STRBUF_INIT;
        struct rev_info log_tree_opt;
        const char *subject;
        char hex[GIT_MAX_HEXSZ + 1];
        int res = 0;
 
+       if (!is_rebase_i(opts))
+               BUG("make_patch should only be called when rebasing");
+
        oid_to_hex_r(hex, &commit->object.oid);
        if (write_message(hex, strlen(hex), rebase_path_stopped_sha(), 1) < 0)
                return -1;
        res |= write_rebase_head(&commit->object.oid);
 
-       strbuf_addf(&buf, "%s/patch", get_dir(opts));
        memset(&log_tree_opt, 0, sizeof(log_tree_opt));
        repo_init_revisions(r, &log_tree_opt, NULL);
        log_tree_opt.abbrev = 0;
@@ -3515,28 +3550,26 @@ static int make_patch(struct repository *r,
        log_tree_opt.diffopt.output_format = DIFF_FORMAT_PATCH;
        log_tree_opt.disable_stdin = 1;
        log_tree_opt.no_commit_id = 1;
-       log_tree_opt.diffopt.file = fopen(buf.buf, "w");
+       log_tree_opt.diffopt.file = fopen(rebase_path_patch(), "w");
        log_tree_opt.diffopt.use_color = GIT_COLOR_NEVER;
        if (!log_tree_opt.diffopt.file)
-               res |= error_errno(_("could not open '%s'"), buf.buf);
+               res |= error_errno(_("could not open '%s'"),
+                                  rebase_path_patch());
        else {
                res |= log_tree_commit(&log_tree_opt, commit);
                fclose(log_tree_opt.diffopt.file);
        }
-       strbuf_reset(&buf);
 
-       strbuf_addf(&buf, "%s/message", get_dir(opts));
-       if (!file_exists(buf.buf)) {
+       if (!file_exists(rebase_path_message())) {
                const char *encoding = get_commit_output_encoding();
                const char *commit_buffer = repo_logmsg_reencode(r,
                                                                 commit, NULL,
                                                                 encoding);
                find_commit_subject(commit_buffer, &subject);
-               res |= write_message(subject, strlen(subject), buf.buf, 1);
+               res |= write_message(subject, strlen(subject), rebase_path_message(), 1);
                repo_unuse_commit_buffer(r, commit,
                                         commit_buffer);
        }
-       strbuf_release(&buf);
        release_revisions(&log_tree_opt);
 
        return res;
@@ -3584,7 +3617,7 @@ static int error_with_patch(struct repository *r,
        } else if (exit_code) {
                if (commit)
                        fprintf_ln(stderr, _("Could not apply %s... %.*s"),
-                                  short_commit_name(commit), subject_len, subject);
+                                  short_commit_name(r, commit), subject_len, subject);
                else
                        /*
                         * We don't have the hash of the parent so
@@ -3622,6 +3655,7 @@ static int do_exec(struct repository *r, const char *command_line)
        fprintf(stderr, _("Executing: %s\n"), command_line);
        cmd.use_shell = 1;
        strvec_push(&cmd.args, command_line);
+       strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP");
        status = run_command(&cmd);
 
        /* force re-reading of the cache */
@@ -3862,6 +3896,8 @@ static int do_reset(struct repository *r,
        }
 
        tree = parse_tree_indirect(&oid);
+       if (!tree)
+               return error(_("unable to read tree (%s)"), oid_to_hex(&oid));
        prime_cache_tree(r, r->index, tree);
 
        if (write_locked_index(r->index, &lock, COMMIT_LOCK) < 0)
@@ -3888,7 +3924,7 @@ static int do_merge(struct repository *r,
        int run_commit_flags = 0;
        struct strbuf ref_name = STRBUF_INIT;
        struct commit *head_commit, *merge_commit, *i;
-       struct commit_list *bases, *j;
+       struct commit_list *bases = NULL, *j;
        struct commit_list *to_merge = NULL, **tail = &to_merge;
        const char *strategy = !opts->xopts.nr &&
                (!opts->strategy ||
@@ -4099,7 +4135,7 @@ static int do_merge(struct repository *r,
 
                strbuf_release(&ref_name);
                refs_delete_ref(get_main_ref_store(r), "", "CHERRY_PICK_HEAD",
-                               NULL, 0);
+                               NULL, REF_NO_DEREF);
                rollback_lock_file(&lock);
 
                ret = run_command(&cmd);
@@ -4114,7 +4150,11 @@ static int do_merge(struct repository *r,
        }
 
        merge_commit = to_merge->item;
-       bases = repo_get_merge_bases(r, head_commit, merge_commit);
+       if (repo_get_merge_bases(r, head_commit, merge_commit, &bases) < 0) {
+               ret = -1;
+               goto leave_merge;
+       }
+
        if (bases && oideq(&merge_commit->object.oid,
                           &bases->item->object.oid)) {
                ret = 0;
@@ -4154,6 +4194,7 @@ static int do_merge(struct repository *r,
        if (ret < 0) {
                error(_("could not even attempt to merge '%.*s'"),
                      merge_arg_len, arg);
+               unlink(git_path_merge_msg(r));
                goto leave_merge;
        }
        /*
@@ -4443,12 +4484,17 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset)
        return -1;
 }
 
-void create_autostash(struct repository *r, const char *path)
+static void create_autostash_internal(struct repository *r,
+                                     const char *path,
+                                     const char *refname)
 {
        struct strbuf buf = STRBUF_INIT;
        struct lock_file lock_file = LOCK_INIT;
        int fd;
 
+       if (path && refname)
+               BUG("can only pass path or refname");
+
        fd = repo_hold_locked_index(r, &lock_file, 0);
        refresh_index(r->index, REFRESH_QUIET, NULL, NULL, NULL);
        if (0 <= fd)
@@ -4475,10 +4521,16 @@ void create_autostash(struct repository *r, const char *path)
                strbuf_reset(&buf);
                strbuf_add_unique_abbrev(&buf, &oid, DEFAULT_ABBREV);
 
-               if (safe_create_leading_directories_const(path))
-                       die(_("Could not create directory for '%s'"),
-                           path);
-               write_file(path, "%s", oid_to_hex(&oid));
+               if (path) {
+                       if (safe_create_leading_directories_const(path))
+                               die(_("Could not create directory for '%s'"),
+                                   path);
+                       write_file(path, "%s", oid_to_hex(&oid));
+               } else {
+                       refs_update_ref(get_main_ref_store(r), "", refname,
+                                       &oid, null_oid(), 0, UPDATE_REFS_DIE_ON_ERR);
+               }
+
                printf(_("Created autostash: %s\n"), buf.buf);
                if (reset_head(r, &ropts) < 0)
                        die(_("could not reset --hard"));
@@ -4489,6 +4541,16 @@ void create_autostash(struct repository *r, const char *path)
        strbuf_release(&buf);
 }
 
+void create_autostash(struct repository *r, const char *path)
+{
+       create_autostash_internal(r, path, NULL);
+}
+
+void create_autostash_ref(struct repository *r, const char *refname)
+{
+       create_autostash_internal(r, NULL, refname);
+}
+
 static int apply_save_autostash_oid(const char *stash_oid, int attempt_apply)
 {
        struct child_process child = CHILD_PROCESS_INIT;
@@ -4566,6 +4628,41 @@ int apply_autostash_oid(const char *stash_oid)
        return apply_save_autostash_oid(stash_oid, 1);
 }
 
+static int apply_save_autostash_ref(struct repository *r, const char *refname,
+                                   int attempt_apply)
+{
+       struct object_id stash_oid;
+       char stash_oid_hex[GIT_MAX_HEXSZ + 1];
+       int flag, ret;
+
+       if (!refs_ref_exists(get_main_ref_store(r), refname))
+               return 0;
+
+       if (!refs_resolve_ref_unsafe(get_main_ref_store(r), refname,
+                                    RESOLVE_REF_READING, &stash_oid, &flag))
+               return -1;
+       if (flag & REF_ISSYMREF)
+               return error(_("autostash reference is a symref"));
+
+       oid_to_hex_r(stash_oid_hex, &stash_oid);
+       ret = apply_save_autostash_oid(stash_oid_hex, attempt_apply);
+
+       refs_delete_ref(get_main_ref_store(r), "", refname,
+                       &stash_oid, REF_NO_DEREF);
+
+       return ret;
+}
+
+int save_autostash_ref(struct repository *r, const char *refname)
+{
+       return apply_save_autostash_ref(r, refname, 0);
+}
+
+int apply_autostash_ref(struct repository *r, const char *refname)
+{
+       return apply_save_autostash_ref(r, refname, 1);
+}
+
 static int checkout_onto(struct repository *r, struct replay_opts *opts,
                         const char *onto_name, const struct object_id *onto,
                         const struct object_id *orig_head)
@@ -4641,6 +4738,68 @@ N_("Could not execute the todo command\n"
 "    git rebase --edit-todo\n"
 "    git rebase --continue\n");
 
+static int pick_one_commit(struct repository *r,
+                          struct todo_list *todo_list,
+                          struct replay_opts *opts,
+                          int *check_todo, int* reschedule)
+{
+       int res;
+       struct todo_item *item = todo_list->items + todo_list->current;
+       const char *arg = todo_item_get_arg(todo_list, item);
+       if (is_rebase_i(opts))
+               opts->reflog_message = reflog_message(
+                       opts, command_to_string(item->command), NULL);
+
+       res = do_pick_commit(r, item, opts, is_final_fixup(todo_list),
+                            check_todo);
+       if (is_rebase_i(opts) && res < 0) {
+               /* Reschedule */
+               *reschedule = 1;
+               return -1;
+       }
+       if (item->command == TODO_EDIT) {
+               struct commit *commit = item->commit;
+               if (!res) {
+                       if (!opts->verbose)
+                               term_clear_line();
+                       fprintf(stderr, _("Stopped at %s...  %.*s\n"),
+                               short_commit_name(r, commit), item->arg_len, arg);
+               }
+               return error_with_patch(r, commit,
+                                       arg, item->arg_len, opts, res, !res);
+       }
+       if (is_rebase_i(opts) && !res)
+               record_in_rewritten(&item->commit->object.oid,
+                                   peek_command(todo_list, 1));
+       if (res && is_fixup(item->command)) {
+               if (res == 1)
+                       intend_to_amend();
+               return error_failed_squash(r, item->commit, opts,
+                                          item->arg_len, arg);
+       } else if (res && is_rebase_i(opts) && item->commit) {
+               int to_amend = 0;
+               struct object_id oid;
+
+               /*
+                * If we are rewording and have either
+                * fast-forwarded already, or are about to
+                * create a new root commit, we want to amend,
+                * otherwise we do not.
+                */
+               if (item->command == TODO_REWORD &&
+                   !repo_get_oid(r, "HEAD", &oid) &&
+                   (oideq(&item->commit->object.oid, &oid) ||
+                    (opts->have_squash_onto &&
+                     oideq(&opts->squash_onto, &oid))))
+                       to_amend = 1;
+
+               return res | error_with_patch(r, item->commit,
+                                             arg, item->arg_len, opts,
+                                             res, to_amend);
+       }
+       return res;
+}
+
 static int pick_commits(struct repository *r,
                        struct todo_list *todo_list,
                        struct replay_opts *opts)
@@ -4656,12 +4815,17 @@ static int pick_commits(struct repository *r,
        if (read_and_refresh_cache(r, opts))
                return -1;
 
+       unlink(rebase_path_message());
+       unlink(rebase_path_stopped_sha());
+       unlink(rebase_path_amend());
+       unlink(rebase_path_patch());
+
        while (todo_list->current < todo_list->nr) {
                struct todo_item *item = todo_list->items + todo_list->current;
                const char *arg = todo_item_get_arg(todo_list, item);
                int check_todo = 0;
 
-               if (save_todo(todo_list, opts))
+               if (save_todo(todo_list, opts, reschedule))
                        return -1;
                if (is_rebase_i(opts)) {
                        if (item->command != TODO_COMMENT) {
@@ -4679,13 +4843,12 @@ static int pick_commits(struct repository *r,
                                                todo_list->total_nr,
                                                opts->verbose ? "\n" : "\r");
                        }
-                       unlink(rebase_path_message());
                        unlink(rebase_path_author_script());
-                       unlink(rebase_path_stopped_sha());
-                       unlink(rebase_path_amend());
                        unlink(git_path_merge_head(r));
-                       unlink(git_path_auto_merge(r));
-                       delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
+                       refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE",
+                                       NULL, REF_NO_DEREF);
+                       refs_delete_ref(get_main_ref_store(r), "", "REBASE_HEAD",
+                                       NULL, REF_NO_DEREF);
 
                        if (item->command == TODO_BREAK) {
                                if (!opts->verbose)
@@ -4694,66 +4857,10 @@ static int pick_commits(struct repository *r,
                        }
                }
                if (item->command <= TODO_SQUASH) {
-                       if (is_rebase_i(opts))
-                               opts->reflog_message = reflog_message(opts,
-                                     command_to_string(item->command), NULL);
-
-                       res = do_pick_commit(r, item, opts,
-                                            is_final_fixup(todo_list),
-                                            &check_todo);
-                       if (is_rebase_i(opts) && res < 0) {
-                               /* Reschedule */
-                               advise(_(rescheduled_advice),
-                                      get_item_line_length(todo_list,
-                                                           todo_list->current),
-                                      get_item_line(todo_list,
-                                                    todo_list->current));
-                               todo_list->current--;
-                               if (save_todo(todo_list, opts))
-                                       return -1;
-                       }
-                       if (item->command == TODO_EDIT) {
-                               struct commit *commit = item->commit;
-                               if (!res) {
-                                       if (!opts->verbose)
-                                               term_clear_line();
-                                       fprintf(stderr,
-                                               _("Stopped at %s...  %.*s\n"),
-                                               short_commit_name(commit),
-                                               item->arg_len, arg);
-                               }
-                               return error_with_patch(r, commit,
-                                       arg, item->arg_len, opts, res, !res);
-                       }
-                       if (is_rebase_i(opts) && !res)
-                               record_in_rewritten(&item->commit->object.oid,
-                                       peek_command(todo_list, 1));
-                       if (res && is_fixup(item->command)) {
-                               if (res == 1)
-                                       intend_to_amend();
-                               return error_failed_squash(r, item->commit, opts,
-                                       item->arg_len, arg);
-                       } else if (res && is_rebase_i(opts) && item->commit) {
-                               int to_amend = 0;
-                               struct object_id oid;
-
-                               /*
-                                * If we are rewording and have either
-                                * fast-forwarded already, or are about to
-                                * create a new root commit, we want to amend,
-                                * otherwise we do not.
-                                */
-                               if (item->command == TODO_REWORD &&
-                                   !repo_get_oid(r, "HEAD", &oid) &&
-                                   (oideq(&item->commit->object.oid, &oid) ||
-                                    (opts->have_squash_onto &&
-                                     oideq(&opts->squash_onto, &oid))))
-                                       to_amend = 1;
-
-                               return res | error_with_patch(r, item->commit,
-                                               arg, item->arg_len, opts,
-                                               res, to_amend);
-                       }
+                       res = pick_one_commit(r, todo_list, opts, &check_todo,
+                                             &reschedule);
+                       if (!res && item->command == TODO_EDIT)
+                               return 0;
                } else if (item->command == TODO_EXEC) {
                        char *end_of_arg = (char *)(arg + item->arg_len);
                        int saved = *end_of_arg;
@@ -4801,32 +4908,25 @@ static int pick_commits(struct repository *r,
                               get_item_line_length(todo_list,
                                                    todo_list->current),
                               get_item_line(todo_list, todo_list->current));
-                       todo_list->current--;
-                       if (save_todo(todo_list, opts))
+                       if (save_todo(todo_list, opts, reschedule))
                                return -1;
                        if (item->commit)
-                               return error_with_patch(r,
-                                                       item->commit,
-                                                       arg, item->arg_len,
-                                                       opts, res, 0);
+                               write_rebase_head(&item->commit->object.oid);
                } else if (is_rebase_i(opts) && check_todo && !res &&
                           reread_todo_if_changed(r, todo_list, opts)) {
                        return -1;
                }
 
-               todo_list->current++;
                if (res)
                        return res;
+
+               todo_list->current++;
        }
 
        if (is_rebase_i(opts)) {
                struct strbuf head_ref = STRBUF_INIT, buf = STRBUF_INIT;
                struct stat st;
 
-               /* Stopped in the middle, as planned? */
-               if (todo_list->current < todo_list->nr)
-                       return 0;
-
                if (read_oneliner(&head_ref, rebase_path_head_name(), 0) &&
                                starts_with(head_ref.buf, "refs/")) {
                        const char *msg;
@@ -4969,6 +5069,11 @@ static int commit_staged_changes(struct repository *r,
 
        is_clean = !has_uncommitted_changes(r, 0);
 
+       if (!is_clean && !file_exists(rebase_path_message())) {
+               const char *gpg_opt = gpg_sign_opt_quoted(opts);
+
+               return error(_(staged_changes_advice), gpg_opt, gpg_opt);
+       }
        if (file_exists(rebase_path_amend())) {
                struct strbuf rev = STRBUF_INIT;
                struct object_id head, to_amend;
@@ -5084,7 +5189,7 @@ static int commit_staged_changes(struct repository *r,
                if (refs_ref_exists(get_main_ref_store(r),
                                    "CHERRY_PICK_HEAD") &&
                    refs_delete_ref(get_main_ref_store(r), "",
-                                   "CHERRY_PICK_HEAD", NULL, 0))
+                                   "CHERRY_PICK_HEAD", NULL, REF_NO_DEREF))
                        return error(_("could not remove CHERRY_PICK_HEAD"));
                if (unlink(git_path_merge_msg(r)) && errno != ENOENT)
                        return error_errno(_("could not remove '%s'"),
@@ -5098,7 +5203,8 @@ static int commit_staged_changes(struct repository *r,
                return error(_("could not commit staged changes."));
        unlink(rebase_path_amend());
        unlink(git_path_merge_head(r));
-       unlink(git_path_auto_merge(r));
+       refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE",
+                       NULL, REF_NO_DEREF);
        if (final_fixup) {
                unlink(rebase_path_fixup_msg());
                unlink(rebase_path_squash_msg());
@@ -5352,6 +5458,7 @@ struct label_state {
        struct oidmap commit2label;
        struct hashmap labels;
        struct strbuf buf;
+       int max_label_length;
 };
 
 static const char *label_oid(struct object_id *oid, const char *label,
@@ -5408,6 +5515,8 @@ static const char *label_oid(struct object_id *oid, const char *label,
                }
        } else {
                struct strbuf *buf = &state->buf;
+               int label_is_utf8 = 1; /* start with this assumption */
+               size_t max_len = buf->len + state->max_label_length;
 
                /*
                 * Sanitize labels by replacing non-alpha-numeric characters
@@ -5416,14 +5525,34 @@ static const char *label_oid(struct object_id *oid, const char *label,
                 *
                 * Note that we retain non-ASCII UTF-8 characters (identified
                 * via the most significant bit). They should be all acceptable
-                * in file names. We do not validate the UTF-8 here, that's not
-                * the job of this function.
+                * in file names.
+                *
+                * As we will use the labels as names of (loose) refs, it is
+                * vital that the name not be longer than the maximum component
+                * size of the file system (`NAME_MAX`). We are careful to
+                * truncate the label accordingly, allowing for the `.lock`
+                * suffix and for the label to be UTF-8 encoded (i.e. we avoid
+                * truncating in the middle of a character).
                 */
-               for (; *label; label++)
-                       if ((*label & 0x80) || isalnum(*label))
+               for (; *label && buf->len + 1 < max_len; label++)
+                       if (isalnum(*label) ||
+                           (!label_is_utf8 && (*label & 0x80)))
                                strbuf_addch(buf, *label);
+                       else if (*label & 0x80) {
+                               const char *p = label;
+
+                               utf8_width(&p, NULL);
+                               if (p) {
+                                       if (buf->len + (p - label) > max_len)
+                                               break;
+                                       strbuf_add(buf, label, p - label);
+                                       label = p - 1;
+                               } else {
+                                       label_is_utf8 = 0;
+                                       strbuf_addch(buf, *label);
+                               }
                        /* avoid leading dash and double-dashes */
-                       else if (buf->len && buf->buf[buf->len - 1] != '-')
+                       else if (buf->len && buf->buf[buf->len - 1] != '-')
                                strbuf_addch(buf, '-');
                if (!buf->len) {
                        strbuf_addstr(buf, "rev-");
@@ -5485,7 +5614,8 @@ static int make_script_with_merges(struct pretty_print_context *pp,
        struct string_entry *entry;
        struct oidset interesting = OIDSET_INIT, child_seen = OIDSET_INIT,
                shown = OIDSET_INIT;
-       struct label_state state = { OIDMAP_INIT, { NULL }, STRBUF_INIT };
+       struct label_state state =
+               { OIDMAP_INIT, { NULL }, STRBUF_INIT, GIT_MAX_LABEL_LENGTH };
 
        int abbr = flags & TODO_LIST_ABBREVIATE_CMDS;
        const char *cmd_pick = abbr ? "p" : "pick",
@@ -5493,6 +5623,8 @@ static int make_script_with_merges(struct pretty_print_context *pp,
                *cmd_reset = abbr ? "t" : "reset",
                *cmd_merge = abbr ? "m" : "merge";
 
+       git_config_get_int("rebase.maxlabellength", &state.max_label_length);
+
        oidmap_init(&commit2todo, 0);
        oidmap_init(&state.commit2label, 0);
        hashmap_init(&state.labels, labels_cmp, NULL, 0);
@@ -5529,7 +5661,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,
                if (!is_empty && (commit->object.flags & PATCHSAME)) {
                        if (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)
                                warning(_("skipped previously applied commit %s"),
-                                       short_commit_name(commit));
+                                       short_commit_name(the_repository, commit));
                        skipped_commit = 1;
                        continue;
                }
@@ -5765,7 +5897,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
                if (!is_empty && (commit->object.flags & PATCHSAME)) {
                        if (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)
                                warning(_("skipped previously applied commit %s"),
-                                       short_commit_name(commit));
+                                       short_commit_name(r, commit));
                        skipped_commit = 1;
                        continue;
                }
@@ -5857,7 +5989,8 @@ static void todo_list_add_exec_commands(struct todo_list *todo_list,
        todo_list->alloc = alloc;
 }
 
-static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_list,
+static void todo_list_to_strbuf(struct repository *r,
+                               struct todo_list *todo_list,
                                struct strbuf *buf, int num, unsigned flags)
 {
        struct todo_item *item;
@@ -5886,7 +6019,7 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis
                /* add commit id */
                if (item->commit) {
                        const char *oid = flags & TODO_LIST_SHORTEN_IDS ?
-                                         short_commit_name(item->commit) :
+                                         short_commit_name(r, item->commit) :
                                          oid_to_hex(&item->commit->object.oid);
 
                        if (item->command == TODO_FIXUP) {
@@ -6194,7 +6327,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
        if (checkout_onto(r, opts, onto_name, &oid, orig_head))
                goto cleanup;
 
-       if (require_clean_work_tree(r, "rebase", "", 1, 1))
+       if (require_clean_work_tree(r, "rebase", NULL, 1, 1))
                goto cleanup;
 
        todo_list_write_total_nr(&new_todo);
@@ -6245,7 +6378,7 @@ static int skip_fixupish(const char *subject, const char **p) {
 int todo_list_rearrange_squash(struct todo_list *todo_list)
 {
        struct hashmap subject2item;
-       int rearranged = 0, *next, *tail, i, nr = 0, alloc = 0;
+       int rearranged = 0, *next, *tail, i, nr = 0;
        char **subjects;
        struct commit_todo_item commit_todo;
        struct todo_item *items = NULL;
@@ -6357,6 +6490,8 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
        }
 
        if (rearranged) {
+               ALLOC_ARRAY(items, todo_list->nr);
+
                for (i = 0; i < todo_list->nr; i++) {
                        enum todo_command command = todo_list->items[i].command;
                        int cur = i;
@@ -6369,16 +6504,15 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
                                continue;
 
                        while (cur >= 0) {
-                               ALLOC_GROW(items, nr + 1, alloc);
                                items[nr++] = todo_list->items[cur];
                                cur = next[cur];
                        }
                }
 
+               assert(nr == todo_list->nr);
+               todo_list->alloc = nr;
                FREE_AND_NULL(todo_list->items);
                todo_list->items = items;
-               todo_list->nr = nr;
-               todo_list->alloc = alloc;
        }
 
        free(next);
index 913a0f652d9ab356bc066f162fa1e5197f6900eb..437eabd38af0398ae9f72b5badd2f691290aa694 100644 (file)
@@ -14,6 +14,8 @@ const char *rebase_path_todo(void);
 const char *rebase_path_todo_backup(void);
 const char *rebase_path_dropped(void);
 
+extern const char *rebase_resolvemsg;
+
 #define APPEND_SIGNOFF_DEDUP (1u << 0)
 
 enum replay_action {
@@ -225,9 +227,12 @@ void commit_post_rewrite(struct repository *r,
                         const struct object_id *new_head);
 
 void create_autostash(struct repository *r, const char *path);
+void create_autostash_ref(struct repository *r, const char *refname);
 int save_autostash(const char *path);
+int save_autostash_ref(struct repository *r, const char *refname);
 int apply_autostash(const char *path);
 int apply_autostash_oid(const char *stash_oid);
+int apply_autostash_ref(struct repository *r, const char *refname);
 
 #define SUMMARY_INITIAL_COMMIT   (1 << 0)
 #define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
diff --git a/serve.c b/serve.c
index a1d71134d49cc88ead5af690315b27ae23215e56..aa651b73e9b7a3378c51f7c92533a6dd0f82ce73 100644 (file)
--- a/serve.c
+++ b/serve.c
@@ -12,6 +12,7 @@
 #include "trace2.h"
 
 static int advertise_sid = -1;
+static int advertise_object_info = -1;
 static int client_hash_algo = GIT_HASH_SHA1;
 
 static int always_advertise(struct repository *r UNUSED,
@@ -67,6 +68,17 @@ static void session_id_receive(struct repository *r UNUSED,
        trace2_data_string("transfer", NULL, "client-sid", client_sid);
 }
 
+static int object_info_advertise(struct repository *r, struct strbuf *value UNUSED)
+{
+       if (advertise_object_info == -1 &&
+           repo_config_get_bool(r, "transfer.advertiseobjectinfo",
+                                &advertise_object_info)) {
+               /* disabled by default */
+               advertise_object_info = 0;
+       }
+       return advertise_object_info;
+}
+
 struct protocol_capability {
        /*
         * The name of the capability.  The server uses this name when
@@ -135,7 +147,7 @@ static struct protocol_capability capabilities[] = {
        },
        {
                .name = "object-info",
-               .advertise = always_advertise,
+               .advertise = object_info_advertise,
                .command = cap_object_info,
        },
        {
diff --git a/setup.c b/setup.c
index 85259a259be33e289d8c6ab464d0e1930431f448..f4b32f76e3d86b46dbd7713195592906b73b9571 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -13,7 +13,6 @@
 #include "string-list.h"
 #include "chdir-notify.h"
 #include "path.h"
-#include "promisor-remote.h"
 #include "quote.h"
 #include "trace2.h"
 #include "worktree.h"
@@ -559,6 +558,8 @@ static enum extension_result handle_extension_v0(const char *var,
                        data->precious_objects = git_config_bool(var, value);
                        return EXTENSION_OK;
                } else if (!strcmp(ext, "partialclone")) {
+                       if (!value)
+                               return config_error_nonbool(var);
                        data->partial_clone = xstrdup(value);
                        return EXTENSION_OK;
                } else if (!strcmp(ext, "worktreeconfig")) {
@@ -609,6 +610,17 @@ static enum extension_result handle_extension(const char *var,
                }
                data->compat_hash_algo = format;
                return EXTENSION_OK;
+       } else if (!strcmp(ext, "refstorage")) {
+               unsigned int format;
+
+               if (!value)
+                       return config_error_nonbool(var);
+               format = ref_storage_format_by_name(value);
+               if (format == REF_STORAGE_FORMAT_UNKNOWN)
+                       return error(_("invalid value for '%s': '%s'"),
+                                    "extensions.refstorage", value);
+               data->ref_storage_format = format;
+               return EXTENSION_OK;
        }
        return EXTENSION_UNKNOWN;
 }
@@ -712,29 +724,39 @@ int upgrade_repository_format(int target_version)
        struct strbuf err = STRBUF_INIT;
        struct strbuf repo_version = STRBUF_INIT;
        struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
+       int ret;
 
        strbuf_git_common_path(&sb, the_repository, "config");
        read_repository_format(&repo_fmt, sb.buf);
        strbuf_release(&sb);
 
-       if (repo_fmt.version >= target_version)
-               return 0;
+       if (repo_fmt.version >= target_version) {
+               ret = 0;
+               goto out;
+       }
 
        if (verify_repository_format(&repo_fmt, &err) < 0) {
-               error("cannot upgrade repository format from %d to %d: %s",
-                     repo_fmt.version, target_version, err.buf);
-               strbuf_release(&err);
-               return -1;
+               ret = error("cannot upgrade repository format from %d to %d: %s",
+                           repo_fmt.version, target_version, err.buf);
+               goto out;
+       }
+       if (!repo_fmt.version && repo_fmt.unknown_extensions.nr) {
+               ret = error("cannot upgrade repository format: "
+                           "unknown extension %s",
+                           repo_fmt.unknown_extensions.items[0].string);
+               goto out;
        }
-       if (!repo_fmt.version && repo_fmt.unknown_extensions.nr)
-               return error("cannot upgrade repository format: "
-                            "unknown extension %s",
-                            repo_fmt.unknown_extensions.items[0].string);
 
        strbuf_addf(&repo_version, "%d", target_version);
        git_config_set("core.repositoryformatversion", repo_version.buf);
+
+       ret = 1;
+
+out:
+       clear_repository_format(&repo_fmt);
        strbuf_release(&repo_version);
-       return 1;
+       strbuf_release(&err);
+       return ret;
 }
 
 static void init_repository_format(struct repository_format *format)
@@ -1240,18 +1262,31 @@ static const char *allowed_bare_repo_to_string(
        return NULL;
 }
 
-enum discovery_result {
-       GIT_DIR_NONE = 0,
-       GIT_DIR_EXPLICIT,
-       GIT_DIR_DISCOVERED,
-       GIT_DIR_BARE,
-       /* these are errors */
-       GIT_DIR_HIT_CEILING = -1,
-       GIT_DIR_HIT_MOUNT_POINT = -2,
-       GIT_DIR_INVALID_GITFILE = -3,
-       GIT_DIR_INVALID_OWNERSHIP = -4,
-       GIT_DIR_DISALLOWED_BARE = -5,
-};
+static int is_implicit_bare_repo(const char *path)
+{
+       /*
+        * what we found is a ".git" directory at the root of
+        * the working tree.
+        */
+       if (ends_with_path_components(path, ".git"))
+               return 1;
+
+       /*
+        * we are inside $GIT_DIR of a secondary worktree of a
+        * non-bare repository.
+        */
+       if (strstr(path, "/.git/worktrees/"))
+               return 1;
+
+       /*
+        * we are inside $GIT_DIR of a worktree of a non-embedded
+        * submodule, whose superproject is not a bare repository.
+        */
+       if (strstr(path, "/.git/modules/"))
+               return 1;
+
+       return 0;
+}
 
 /*
  * We cannot decide in this function whether we are in the work tree or
@@ -1381,7 +1416,8 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
 
                if (is_git_directory(dir->buf)) {
                        trace2_data_string("setup", NULL, "implicit-bare-repository", dir->buf);
-                       if (get_allowed_bare_repo() == ALLOWED_BARE_REPO_EXPLICIT)
+                       if (get_allowed_bare_repo() == ALLOWED_BARE_REPO_EXPLICIT &&
+                           !is_implicit_bare_repo(dir->buf))
                                return GIT_DIR_DISALLOWED_BARE;
                        if (!ensure_valid_ownership(NULL, NULL, dir->buf, report))
                                return GIT_DIR_INVALID_OWNERSHIP;
@@ -1404,21 +1440,23 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
        }
 }
 
-int discover_git_directory(struct strbuf *commondir,
-                          struct strbuf *gitdir)
+enum discovery_result discover_git_directory_reason(struct strbuf *commondir,
+                                                   struct strbuf *gitdir)
 {
        struct strbuf dir = STRBUF_INIT, err = STRBUF_INIT;
        size_t gitdir_offset = gitdir->len, cwd_len;
        size_t commondir_offset = commondir->len;
        struct repository_format candidate = REPOSITORY_FORMAT_INIT;
+       enum discovery_result result;
 
        if (strbuf_getcwd(&dir))
-               return -1;
+               return GIT_DIR_CWD_FAILURE;
 
        cwd_len = dir.len;
-       if (setup_git_directory_gently_1(&dir, gitdir, NULL, 0) <= 0) {
+       result = setup_git_directory_gently_1(&dir, gitdir, NULL, 0);
+       if (result <= 0) {
                strbuf_release(&dir);
-               return -1;
+               return result;
        }
 
        /*
@@ -1448,11 +1486,11 @@ int discover_git_directory(struct strbuf *commondir,
                strbuf_setlen(commondir, commondir_offset);
                strbuf_setlen(gitdir, gitdir_offset);
                clear_repository_format(&candidate);
-               return -1;
+               return GIT_DIR_INVALID_FORMAT;
        }
 
        clear_repository_format(&candidate);
-       return 0;
+       return result;
 }
 
 const char *setup_git_directory_gently(int *nongit_ok)
@@ -1534,10 +1572,11 @@ const char *setup_git_directory_gently(int *nongit_ok)
                }
                *nongit_ok = 1;
                break;
-       case GIT_DIR_NONE:
+       case GIT_DIR_CWD_FAILURE:
+       case GIT_DIR_INVALID_FORMAT:
                /*
                 * As a safeguard against setup_git_directory_gently_1 returning
-                * this value, fallthrough to BUG. Otherwise it is possible to
+                * these values, fallthrough to BUG. Otherwise it is possible to
                 * set startup_info->have_repository to 1 when we did nothing to
                 * find a repository.
                 */
@@ -1585,6 +1624,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
                        repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
                        repo_set_compat_hash_algo(the_repository,
                                                  repo_fmt.compat_hash_algo);
+                       repo_set_ref_storage_format(the_repository,
+                                                   repo_fmt.ref_storage_format);
                        the_repository->repository_format_worktree_config =
                                repo_fmt.worktree_config;
                        /* take ownership of repo_fmt.partial_clone */
@@ -1679,6 +1720,8 @@ void check_repository_format(struct repository_format *fmt)
        startup_info->have_repository = 1;
        repo_set_hash_algo(the_repository, fmt->hash_algo);
        repo_set_compat_hash_algo(the_repository, fmt->compat_hash_algo);
+       repo_set_ref_storage_format(the_repository,
+                                   fmt->ref_storage_format);
        the_repository->repository_format_worktree_config =
                fmt->worktree_config;
        the_repository->repository_format_partial_clone =
@@ -1887,12 +1930,22 @@ static int needs_work_tree_config(const char *git_dir, const char *work_tree)
        return 1;
 }
 
-void initialize_repository_version(int hash_algo, int reinit)
+void initialize_repository_version(int hash_algo,
+                                  unsigned int ref_storage_format,
+                                  int reinit)
 {
        char repo_version_string[10];
        int repo_version = GIT_REPO_VERSION;
 
-       if (hash_algo != GIT_HASH_SHA1)
+       /*
+        * Note that we initialize the repository version to 1 when the ref
+        * storage format is unknown. This is on purpose so that we can add the
+        * correct object format to the config during git-clone(1). The format
+        * version will get adjusted by git-clone(1) once it has learned about
+        * the remote repository's format.
+        */
+       if (hash_algo != GIT_HASH_SHA1 ||
+           ref_storage_format != REF_STORAGE_FORMAT_FILES)
                repo_version = GIT_REPO_VERSION_READ;
 
        /* This forces creation of new config file */
@@ -1900,28 +1953,76 @@ void initialize_repository_version(int hash_algo, int reinit)
                  "%d", repo_version);
        git_config_set("core.repositoryformatversion", repo_version_string);
 
-       if (hash_algo != GIT_HASH_SHA1)
+       if (hash_algo != GIT_HASH_SHA1 && hash_algo != GIT_HASH_UNKNOWN)
                git_config_set("extensions.objectformat",
                               hash_algos[hash_algo].name);
        else if (reinit)
                git_config_set_gently("extensions.objectformat", NULL);
+
+       if (ref_storage_format != REF_STORAGE_FORMAT_FILES)
+               git_config_set("extensions.refstorage",
+                              ref_storage_format_to_name(ref_storage_format));
+}
+
+static int is_reinit(void)
+{
+       struct strbuf buf = STRBUF_INIT;
+       char junk[2];
+       int ret;
+
+       git_path_buf(&buf, "HEAD");
+       ret = !access(buf.buf, R_OK) || readlink(buf.buf, junk, sizeof(junk) - 1) != -1;
+       strbuf_release(&buf);
+       return ret;
+}
+
+void create_reference_database(unsigned int ref_storage_format,
+                              const char *initial_branch, int quiet)
+{
+       struct strbuf err = STRBUF_INIT;
+       int reinit = is_reinit();
+
+       repo_set_ref_storage_format(the_repository, ref_storage_format);
+       if (refs_init_db(get_main_ref_store(the_repository), 0, &err))
+               die("failed to set up refs db: %s", err.buf);
+
+       /*
+        * Point the HEAD symref to the initial branch with if HEAD does
+        * not yet exist.
+        */
+       if (!reinit) {
+               char *ref;
+
+               if (!initial_branch)
+                       initial_branch = git_default_branch_name(quiet);
+
+               ref = xstrfmt("refs/heads/%s", initial_branch);
+               if (check_refname_format(ref, 0) < 0)
+                       die(_("invalid initial branch name: '%s'"),
+                           initial_branch);
+
+               if (create_symref("HEAD", ref, NULL) < 0)
+                       exit(1);
+               free(ref);
+       }
+
+       if (reinit && initial_branch)
+               warning(_("re-init: ignored --initial-branch=%s"),
+                       initial_branch);
+
+       strbuf_release(&err);
 }
 
 static int create_default_files(const char *template_path,
                                const char *original_git_dir,
-                               const char *initial_branch,
                                const struct repository_format *fmt,
-                               int prev_bare_repository,
-                               int init_shared_repository,
-                               int quiet)
+                               int init_shared_repository)
 {
        struct stat st1;
        struct strbuf buf = STRBUF_INIT;
        char *path;
-       char junk[2];
        int reinit;
        int filemode;
-       struct strbuf err = STRBUF_INIT;
        const char *init_template_dir = NULL;
        const char *work_tree = get_git_work_tree();
 
@@ -1941,40 +2042,16 @@ static int create_default_files(const char *template_path,
        reset_shared_repository();
        git_config(git_default_config, NULL);
 
+       reinit = is_reinit();
+
        /*
         * We must make sure command-line options continue to override any
         * values we might have just re-read from the config.
         */
        if (init_shared_repository != -1)
                set_shared_repository(init_shared_repository);
-       /*
-        * TODO: heed core.bare from config file in templates if no
-        *       command-line override given
-        */
-       is_bare_repository_cfg = prev_bare_repository || !work_tree;
-       /* TODO (continued):
-        *
-        * Unfortunately, the line above is equivalent to
-        *    is_bare_repository_cfg = !work_tree;
-        * which ignores the config entirely even if no `--[no-]bare`
-        * command line option was present.
-        *
-        * To see why, note that before this function, there was this call:
-        *    prev_bare_repository = is_bare_repository()
-        * expanding the right hand side:
-        *                 = is_bare_repository_cfg && !get_git_work_tree()
-        *                 = is_bare_repository_cfg && !work_tree
-        * note that the last simplification above is valid because nothing
-        * calls repo_init() or set_git_work_tree() between any of the
-        * relevant calls in the code, and thus the !get_git_work_tree()
-        * calls will return the same result each time.  So, what we are
-        * interested in computing is the right hand side of the line of
-        * code just above this comment:
-        *     prev_bare_repository || !work_tree
-        *        = is_bare_repository_cfg && !work_tree || !work_tree
-        *        = !work_tree
-        * because "A && !B || !B == !B" for all boolean values of A & B.
-        */
+
+       is_bare_repository_cfg = !work_tree;
 
        /*
         * We would have created the above under user's umask -- under
@@ -1984,40 +2061,7 @@ static int create_default_files(const char *template_path,
                adjust_shared_perm(get_git_dir());
        }
 
-       /*
-        * We need to create a "refs" dir in any case so that older
-        * versions of git can tell that this is a repository.
-        */
-       safe_create_dir(git_path("refs"), 1);
-       adjust_shared_perm(git_path("refs"));
-
-       if (refs_init_db(&err))
-               die("failed to set up refs db: %s", err.buf);
-
-       /*
-        * Point the HEAD symref to the initial branch with if HEAD does
-        * not yet exist.
-        */
-       path = git_path_buf(&buf, "HEAD");
-       reinit = (!access(path, R_OK)
-                 || readlink(path, junk, sizeof(junk)-1) != -1);
-       if (!reinit) {
-               char *ref;
-
-               if (!initial_branch)
-                       initial_branch = git_default_branch_name(quiet);
-
-               ref = xstrfmt("refs/heads/%s", initial_branch);
-               if (check_refname_format(ref, 0) < 0)
-                       die(_("invalid initial branch name: '%s'"),
-                           initial_branch);
-
-               if (create_symref("HEAD", ref, NULL) < 0)
-                       exit(1);
-               free(ref);
-       }
-
-       initialize_repository_version(fmt->hash_algo, 0);
+       initialize_repository_version(fmt->hash_algo, fmt->ref_storage_format, 0);
 
        /* Check filemode trustability */
        path = git_path_buf(&buf, "config");
@@ -2130,15 +2174,35 @@ static void validate_hash_algorithm(struct repository_format *repo_fmt, int hash
        }
 }
 
+static void validate_ref_storage_format(struct repository_format *repo_fmt,
+                                       unsigned int format)
+{
+       const char *name = getenv("GIT_DEFAULT_REF_FORMAT");
+
+       if (repo_fmt->version >= 0 &&
+           format != REF_STORAGE_FORMAT_UNKNOWN &&
+           format != repo_fmt->ref_storage_format) {
+               die(_("attempt to reinitialize repository with different reference storage format"));
+       } else if (format != REF_STORAGE_FORMAT_UNKNOWN) {
+               repo_fmt->ref_storage_format = format;
+       } else if (name) {
+               format = ref_storage_format_by_name(name);
+               if (format == REF_STORAGE_FORMAT_UNKNOWN)
+                       die(_("unknown ref storage format '%s'"), name);
+               repo_fmt->ref_storage_format = format;
+       }
+}
+
 int init_db(const char *git_dir, const char *real_git_dir,
-           const char *template_dir, int hash, const char *initial_branch,
+           const char *template_dir, int hash,
+           unsigned int ref_storage_format,
+           const char *initial_branch,
            int init_shared_repository, unsigned int flags)
 {
        int reinit;
        int exist_ok = flags & INIT_DB_EXIST_OK;
        char *original_git_dir = real_pathdup(git_dir, 1);
        struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
-       int prev_bare_repository;
 
        if (real_git_dir) {
                struct stat st;
@@ -2164,7 +2228,6 @@ int init_db(const char *git_dir, const char *real_git_dir,
 
        safe_create_dir(git_dir, 0);
 
-       prev_bare_repository = is_bare_repository();
 
        /* Check to see if the repository version is right.
         * Note that a newly created repository does not have
@@ -2174,16 +2237,21 @@ int init_db(const char *git_dir, const char *real_git_dir,
        check_repository_format(&repo_fmt);
 
        validate_hash_algorithm(&repo_fmt, hash);
+       validate_ref_storage_format(&repo_fmt, ref_storage_format);
 
        reinit = create_default_files(template_dir, original_git_dir,
-                                     initial_branch, &repo_fmt,
-                                     prev_bare_repository,
-                                     init_shared_repository,
-                                     flags & INIT_DB_QUIET);
-       if (reinit && initial_branch)
-               warning(_("re-init: ignored --initial-branch=%s"),
-                       initial_branch);
+                                     &repo_fmt, init_shared_repository);
 
+       /*
+        * Now that we have set up both the hash algorithm and the ref storage
+        * format we can update the repository's settings accordingly.
+        */
+       repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
+       repo_set_ref_storage_format(the_repository, repo_fmt.ref_storage_format);
+
+       if (!(flags & INIT_DB_SKIP_REFDB))
+               create_reference_database(repo_fmt.ref_storage_format,
+                                         initial_branch, flags & INIT_DB_QUIET);
        create_object_directory();
 
        if (get_shared_repository()) {
@@ -2222,6 +2290,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
                               git_dir, len && git_dir[len-1] != '/' ? "/" : "");
        }
 
+       clear_repository_format(&repo_fmt);
        free(original_git_dir);
        return 0;
 }
diff --git a/setup.h b/setup.h
index 5d678ceb8caae89e23823e632ac53ea71d4eb915..d88bb37aafb3c59cb091e7f7b02fc421cde6c2b2 100644 (file)
--- a/setup.h
+++ b/setup.h
@@ -42,16 +42,45 @@ const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);
 #define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)
 
 void setup_work_tree(void);
+
+/*
+ * discover_git_directory_reason() is similar to discover_git_directory(),
+ * except it returns an enum value instead. It is important to note that
+ * a zero-valued return here is actually GIT_DIR_NONE, which is different
+ * from discover_git_directory.
+ */
+enum discovery_result {
+       GIT_DIR_EXPLICIT = 1,
+       GIT_DIR_DISCOVERED = 2,
+       GIT_DIR_BARE = 3,
+       /* these are errors */
+       GIT_DIR_HIT_CEILING = -1,
+       GIT_DIR_HIT_MOUNT_POINT = -2,
+       GIT_DIR_INVALID_GITFILE = -3,
+       GIT_DIR_INVALID_OWNERSHIP = -4,
+       GIT_DIR_DISALLOWED_BARE = -5,
+       GIT_DIR_INVALID_FORMAT = -6,
+       GIT_DIR_CWD_FAILURE = -7,
+};
+enum discovery_result discover_git_directory_reason(struct strbuf *commondir,
+                                                   struct strbuf *gitdir);
+
 /*
  * Find the commondir and gitdir of the repository that contains the current
  * working directory, without changing the working directory or other global
  * state. The result is appended to commondir and gitdir.  If the discovered
  * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will
  * both have the same result appended to the buffer.  The return value is
- * either 0 upon success and non-zero if no repository was found.
+ * either 0 upon success and -1 if no repository was found.
  */
-int discover_git_directory(struct strbuf *commondir,
-                          struct strbuf *gitdir);
+static inline int discover_git_directory(struct strbuf *commondir,
+                                        struct strbuf *gitdir)
+{
+       if (discover_git_directory_reason(commondir, gitdir) <= 0)
+               return -1;
+       return 0;
+}
+
 const char *setup_git_directory_gently(int *);
 const char *setup_git_directory(void);
 char *prefix_path(const char *prefix, int len, const char *path);
@@ -87,6 +116,7 @@ struct repository_format {
        int is_bare;
        int hash_algo;
        int compat_hash_algo;
+       unsigned int ref_storage_format;
        int sparse_index;
        char *work_tree;
        struct string_list unknown_extensions;
@@ -103,6 +133,7 @@ struct repository_format {
        .version = -1, \
        .is_bare = -1, \
        .hash_algo = GIT_HASH_SHA1, \
+       .ref_storage_format = REF_STORAGE_FORMAT_FILES, \
        .unknown_extensions = STRING_LIST_INIT_DUP, \
        .v1_only_extensions = STRING_LIST_INIT_DUP, \
 }
@@ -141,14 +172,20 @@ int verify_repository_format(const struct repository_format *format,
  */
 void check_repository_format(struct repository_format *fmt);
 
-#define INIT_DB_QUIET 0x0001
-#define INIT_DB_EXIST_OK 0x0002
+#define INIT_DB_QUIET      (1 << 0)
+#define INIT_DB_EXIST_OK   (1 << 1)
+#define INIT_DB_SKIP_REFDB (1 << 2)
 
 int init_db(const char *git_dir, const char *real_git_dir,
            const char *template_dir, int hash_algo,
+           unsigned int ref_storage_format,
            const char *initial_branch, int init_shared_repository,
            unsigned int flags);
-void initialize_repository_version(int hash_algo, int reinit);
+void initialize_repository_version(int hash_algo,
+                                  unsigned int ref_storage_format,
+                                  int reinit);
+void create_reference_database(unsigned int ref_storage_format,
+                              const char *initial_branch, int quiet);
 
 /*
  * NOTE NOTE NOTE!!
index 133496bd4d9f2979dfe2765e98a50186463dde1d..f69fd166105a44a8be74fa6cd74841f06aa1a12d 100644 (file)
@@ -31,7 +31,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
 
 /* closeout.c - close standard output and standard error
    Copyright (C) 1998-2007 Free Software Foundation, Inc.
@@ -47,7 +47,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <stdio.h>
index dede2cbddf94f0c62ef01ba5e48a93026408c5d6..f993ef9c69091740ea2248d6c34452ecb58fba02 100644 (file)
@@ -88,7 +88,7 @@
 /*
  * Should define Big Endian for a whitelist of known processors. See
  * https://sourceforge.net/p/predef/wiki/Endianness/ and
- * http://www.oracle.com/technetwork/server-storage/solaris/portingtosolaris-138514.html
+ * https://web.archive.org/web/20140421151132/http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html
  */
 #define SHA1DC_BIGENDIAN
 
index 5413719fd4ef16c130117440c4d4687f9c1c5525..7ff50dd0da45e00ac3de5e03af473ff361d33b02 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -7,7 +7,6 @@
 #include "commit.h"
 #include "tag.h"
 #include "pkt-line.h"
-#include "remote.h"
 #include "refs.h"
 #include "oid-array.h"
 #include "path.h"
@@ -38,8 +37,10 @@ int register_shallow(struct repository *r, const struct object_id *oid)
 
        oidcpy(&graft->oid, oid);
        graft->nr_parent = -1;
-       if (commit && commit->object.parsed)
+       if (commit && commit->object.parsed) {
+               free_commit_list(commit->parents);
                commit->parents = NULL;
+       }
        return register_commit_graft(r, graft, 0);
 }
 
@@ -793,12 +794,16 @@ static void post_assign_shallow(struct shallow_info *info,
                if (!*bitmap)
                        continue;
                for (j = 0; j < bitmap_nr; j++)
-                       if (bitmap[0][j] &&
-                           /* Step 7, reachability test at commit level */
-                           !repo_in_merge_bases_many(the_repository, c, ca.nr, ca.commits)) {
-                               update_refstatus(ref_status, info->ref->nr, *bitmap);
-                               dst++;
-                               break;
+                       if (bitmap[0][j]) {
+                               /* Step 7, reachability test at commit level */
+                               int ret = repo_in_merge_bases_many(the_repository, c, ca.nr, ca.commits, 1);
+                               if (ret < 0)
+                                       exit(128);
+                               if (!ret) {
+                                       update_refstatus(ref_status, info->ref->nr, *bitmap);
+                                       dst++;
+                                       break;
+                               }
                        }
        }
        info->nr_ours = dst;
@@ -826,7 +831,10 @@ int delayed_reachability_test(struct shallow_info *si, int c)
                si->reachable[c] = repo_in_merge_bases_many(the_repository,
                                                            commit,
                                                            si->nr_commits,
-                                                           si->commits);
+                                                           si->commits,
+                                                           1);
+               if (si->reachable[c] < 0)
+                       exit(128);
                si->need_reachability_test[c] = 0;
        }
        return si->reachable[c];
index aeb80fc4d5a33e1b5c6f2e1bbdf4cc3279802eef..29bebd30d8acbce9f50661cef48ecdbae1e41f5a 100644 (file)
@@ -108,3 +108,11 @@ endif
 define mkdir_p_parent_template
 $(if $(wildcard $(@D)),,$(QUIET_MKDIR_P_PARENT)$(shell mkdir -p $(@D)))
 endef
+
+## Getting sick of writing -L$(SOMELIBDIR) $(CC_LD_DYNPATH)$(SOMELIBDIR)?
+## Write $(call libpath_template,$(SOMELIBDIR)) instead, perhaps?
+## With CC_LD_DYNPATH set to either an empty string or to "-L", the
+## the directory is not shown the second time.
+define libpath_template
+-L$(1) $(if $(filter-out -L,$(CC_LD_DYNPATH)),$(CC_LD_DYNPATH)$(1))
+endef
diff --git a/shell.c b/shell.c
index 5c67e7bd97e2c825d79c3503267b5b41cd83bb8a..2ece8b16e2e8e1e3473dbc7bae6deedea51ee4e8 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -4,7 +4,6 @@
 #include "strbuf.h"
 #include "run-command.h"
 #include "alias.h"
-#include "prompt.h"
 
 #define COMMAND_DIR "git-shell-commands"
 #define HELP_COMMAND COMMAND_DIR "/help"
index 6cbfd391c47fb531740eb4b963a11b77f8abe29d..5d8907151fec3982e906025fc19c2165ef4572d3 100644 (file)
@@ -69,7 +69,10 @@ void list_config_color_sideband_slots(struct string_list *list, const char *pref
  * of the line. This should be called for a single line only, which is
  * passed as the first N characters of the SRC array.
  *
- * NEEDSWORK: use "size_t n" instead for clarity.
+ * It is fine to use "int n" here instead of "size_t n" as all calls to this
+ * function pass an 'int' parameter. Additionally, the buffer involved in
+ * storing these 'int' values takes input from a packet via the pkt-line
+ * interface, which is capable of transferring only 64kB at a time.
  */
 static void maybe_colorize_sideband(struct strbuf *dest, const char *src, int n)
 {
@@ -217,7 +220,7 @@ int demultiplex_sideband(const char *me, int status,
                        }
 
                        strbuf_addch(scratch, *brk);
-                       xwrite(2, scratch->buf, scratch->len);
+                       write_in_full(2, scratch->buf, scratch->len);
                        strbuf_reset(scratch);
 
                        b = brk + 1;
@@ -244,7 +247,7 @@ cleanup:
                die("%s", scratch->buf);
        if (scratch->len) {
                strbuf_addch(scratch, '\n');
-               xwrite(2, scratch->buf, scratch->len);
+               write_in_full(2, scratch->buf, scratch->len);
        }
        strbuf_release(scratch);
        return 1;
index 1fdb07a9e69be2db0b03d283f0f100a1d2842ad2..e48e40cae71f975f98f1874b90fc8889c0c710e2 100644 (file)
@@ -391,7 +391,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
                strbuf_setlen(&base, 0);
                strbuf_add(&base, ce->name, strlen(ce->name));
 
-               read_tree_at(istate->repo, tree, &base, &ps,
+               read_tree_at(istate->repo, tree, &base, 0, &ps,
                             add_path_to_index, &ctx);
 
                /* free directory entries. full entries are re-used */
@@ -579,8 +579,9 @@ void expand_to_path(struct index_state *istate,
                replace++;
                temp = *replace;
                *replace = '\0';
+               substr_len = replace - path_mutable.buf;
                if (index_file_exists(istate, path_mutable.buf,
-                                     path_mutable.len, icase)) {
+                                     substr_len, icase)) {
                        /*
                         * We found a parent directory in the name-hash
                         * hashtable, because only sparse directory entries
@@ -593,7 +594,6 @@ void expand_to_path(struct index_state *istate,
                }
 
                *replace = temp;
-               substr_len = replace - path_mutable.buf;
        }
 
 cleanup:
index 17bb8966c33d6d01644e237288491a77e1575c51..3c6bc049c15d44c33c064fecbbd2236571b2dadb 100644 (file)
@@ -2,6 +2,22 @@
 #include "environment.h"
 #include "statinfo.h"
 
+/*
+ * Munge st_size into an unsigned int.
+ */
+static unsigned int munge_st_size(off_t st_size) {
+       unsigned int sd_size = st_size;
+
+       /*
+        * If the file is an exact multiple of 4 GiB, modify the value so it
+        * doesn't get marked as racily clean (zero).
+        */
+       if (!sd_size && st_size)
+               return 0x80000000;
+       else
+               return sd_size;
+}
+
 void fill_stat_data(struct stat_data *sd, struct stat *st)
 {
        sd->sd_ctime.sec = (unsigned int)st->st_ctime;
@@ -12,7 +28,34 @@ void fill_stat_data(struct stat_data *sd, struct stat *st)
        sd->sd_ino = st->st_ino;
        sd->sd_uid = st->st_uid;
        sd->sd_gid = st->st_gid;
-       sd->sd_size = st->st_size;
+       sd->sd_size = munge_st_size(st->st_size);
+}
+
+static void set_times(struct stat *st, const struct stat_data *sd)
+{
+       st->st_ctime = sd->sd_ctime.sec;
+       st->st_mtime = sd->sd_mtime.sec;
+#ifdef NO_NSEC
+       ; /* nothing */
+#else
+#ifdef USE_ST_TIMESPEC
+       st->st_ctimespec.tv_nsec = sd->sd_ctime.nsec;
+       st->st_mtimespec.tv_nsec = sd->sd_mtime.nsec;
+#else
+       st->st_ctim.tv_nsec = sd->sd_ctime.nsec;
+       st->st_mtim.tv_nsec = sd->sd_mtime.nsec;
+#endif
+#endif
+}
+
+void fake_lstat_data(const struct stat_data *sd, struct stat *st)
+{
+       set_times(st, sd);
+       st->st_dev = sd->sd_dev;
+       st->st_ino = sd->sd_ino;
+       st->st_uid = sd->sd_uid;
+       st->st_gid = sd->sd_gid;
+       st->st_size = sd->sd_size;
 }
 
 int match_stat_data(const struct stat_data *sd, struct stat *st)
@@ -51,7 +94,7 @@ int match_stat_data(const struct stat_data *sd, struct stat *st)
                        changed |= INODE_CHANGED;
 #endif
 
-       if (sd->sd_size != (unsigned int) st->st_size)
+       if (sd->sd_size != munge_st_size(st->st_size))
                changed |= DATA_CHANGED;
 
        return changed;
index 700f502ac0b3cb938c2f376653dc1e91ac4e6d24..5b21a30f90bfd2e1fed39fed0d61b9abb360af33 100644 (file)
@@ -46,6 +46,14 @@ struct stat_validity {
  */
 void fill_stat_data(struct stat_data *sd, struct stat *st);
 
+/*
+ * The inverse of the above.  When we know the cache_entry that
+ * contains sd is up-to-date, but still need to pretend we called
+ * lstat() to learn that fact, this function fills "st" enough to
+ * fool ie_match_stat().
+ */
+void fake_lstat_data(const struct stat_data *sd, struct stat *st);
+
 /*
  * Return 0 if st is consistent with a file not having been changed
  * since sd was filled.  If there are differences, return a
index 4c9ac6dc5e3cd34fd059ca3a20f8e98bd08b2d4a..7827178d8e5e374582357f48a14a77bb15d98320 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "gettext.h"
-#include "hex.h"
+#include "hex-ll.h"
 #include "strbuf.h"
 #include "string-list.h"
 #include "utf8.h"
index fd43c46433a4b938f3c46a634db740b4c352a475..e959caca876ac759debb0c77cd7c6d1046cbc25d 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -12,9 +12,9 @@
 struct string_list;
 
 /**
- * strbuf's are meant to be used with all the usual C string and memory
+ * strbufs are meant to be used with all the usual C string and memory
  * APIs. Given that the length of the buffer is known, it's often better to
- * use the mem* functions than a str* one (memchr vs. strchr e.g.).
+ * use the mem* functions than a str* one (e.g., memchr vs. strchr).
  * Though, one has to be careful about the fact that str* functions often
  * stop on NULs and that strbufs may have embedded NULs.
  *
@@ -24,7 +24,7 @@ struct string_list;
  * strbufs have some invariants that are very important to keep in mind:
  *
  *  - The `buf` member is never NULL, so it can be used in any usual C
- *    string operations safely. strbuf's _have_ to be initialized either by
+ *    string operations safely. strbufs _have_ to be initialized either by
  *    `strbuf_init()` or by `= STRBUF_INIT` before the invariants, though.
  *
  *    Do *not* assume anything on what `buf` really is (e.g. if it is
@@ -37,7 +37,7 @@ struct string_list;
  *
  *  - The `buf` member is a byte array that has at least `len + 1` bytes
  *    allocated. The extra byte is used to store a `'\0'`, allowing the
- *    `buf` member to be a valid C-string. Every strbuf function ensure this
+ *    `buf` member to be a valid C-string. All strbuf functions ensure this
  *    invariant is preserved.
  *
  *    NOTE: It is OK to "play" with the buffer directly if you work it this
index 89dc9e7e753313acbb0a5dc83b7705f3538a4c45..178f4f37480e1104e329674964a5d5c24d5ba7e5 100644 (file)
--- a/strvec.c
+++ b/strvec.c
@@ -1,6 +1,5 @@
 #include "git-compat-util.h"
 #include "strvec.h"
-#include "hex.h"
 #include "strbuf.h"
 
 const char *empty_strvec[] = { NULL };
index 9f55c8766ba9de77437275b8796f8e348fe35e03..4715d3e51f873e7b6618a80ebc79f2d2b4ebaab7 100644 (file)
--- a/strvec.h
+++ b/strvec.h
@@ -4,8 +4,8 @@
 /**
  * The strvec API allows one to dynamically build and store
  * NULL-terminated arrays of strings. A strvec maintains the invariant that the
- * `items` member always points to a non-NULL array, and that the array is
- * always NULL-terminated at the element pointed to by `items[nr]`. This
+ * `v` member always points to a non-NULL array, and that the array is
+ * always NULL-terminated at the element pointed to by `v[nr]`. This
  * makes the result suitable for passing to functions expecting to receive
  * argv from main().
  *
@@ -22,7 +22,7 @@ extern const char *empty_strvec[];
 
 /**
  * A single array. This should be initialized by assignment from
- * `STRVEC_INIT`, or by calling `strvec_init`. The `items`
+ * `STRVEC_INIT`, or by calling `strvec_init`. The `v`
  * member contains the actual array; the `nr` member contains the
  * number of elements in the array, not including the terminating
  * NULL.
@@ -80,7 +80,7 @@ void strvec_split(struct strvec *, const char *);
 void strvec_clear(struct strvec *);
 
 /**
- * Disconnect the `items` member from the `strvec` struct and
+ * Disconnect the `v` member from the `strvec` struct and
  * return it. The caller is responsible for freeing the memory used
  * by the array, and by the strings it references. After detaching,
  * the `strvec` is in a reinitialized state and can be pushed
index 6a48fd12f66f93d132aab6745d67effd482a168f..54130f6a38572b613d4b7ee8ae1cf3bc6035055d 100644 (file)
@@ -14,6 +14,8 @@
 #include "parse-options.h"
 #include "thread-utils.h"
 #include "tree-walk.h"
+#include "url.h"
+#include "urlmatch.h"
 
 /*
  * submodule cache lookup structure
@@ -228,6 +230,144 @@ in_component:
        return 0;
 }
 
+static int starts_with_dot_slash(const char *const path)
+{
+       return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_SLASH |
+                               PATH_MATCH_XPLATFORM);
+}
+
+static int starts_with_dot_dot_slash(const char *const path)
+{
+       return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_DOT_SLASH |
+                               PATH_MATCH_XPLATFORM);
+}
+
+static int submodule_url_is_relative(const char *url)
+{
+       return starts_with_dot_slash(url) || starts_with_dot_dot_slash(url);
+}
+
+/*
+ * Count directory components that a relative submodule URL should chop
+ * from the remote_url it is to be resolved against.
+ *
+ * In other words, this counts "../" components at the start of a
+ * submodule URL.
+ *
+ * Returns the number of directory components to chop and writes a
+ * pointer to the next character of url after all leading "./" and
+ * "../" components to out.
+ */
+static int count_leading_dotdots(const char *url, const char **out)
+{
+       int result = 0;
+       while (1) {
+               if (starts_with_dot_dot_slash(url)) {
+                       result++;
+                       url += strlen("../");
+                       continue;
+               }
+               if (starts_with_dot_slash(url)) {
+                       url += strlen("./");
+                       continue;
+               }
+               *out = url;
+               return result;
+       }
+}
+/*
+ * Check whether a transport is implemented by git-remote-curl.
+ *
+ * If it is, returns 1 and writes the URL that would be passed to
+ * git-remote-curl to the "out" parameter.
+ *
+ * Otherwise, returns 0 and leaves "out" untouched.
+ *
+ * Examples:
+ *   http::https://example.com/repo.git -> 1, https://example.com/repo.git
+ *   https://example.com/repo.git -> 1, https://example.com/repo.git
+ *   git://example.com/repo.git -> 0
+ *
+ * This is for use in checking for previously exploitable bugs that
+ * required a submodule URL to be passed to git-remote-curl.
+ */
+static int url_to_curl_url(const char *url, const char **out)
+{
+       /*
+        * We don't need to check for case-aliases, "http.exe", and so
+        * on because in the default configuration, is_transport_allowed
+        * prevents URLs with those schemes from being cloned
+        * automatically.
+        */
+       if (skip_prefix(url, "http::", out) ||
+           skip_prefix(url, "https::", out) ||
+           skip_prefix(url, "ftp::", out) ||
+           skip_prefix(url, "ftps::", out))
+               return 1;
+       if (starts_with(url, "http://") ||
+           starts_with(url, "https://") ||
+           starts_with(url, "ftp://") ||
+           starts_with(url, "ftps://")) {
+               *out = url;
+               return 1;
+       }
+       return 0;
+}
+
+int check_submodule_url(const char *url)
+{
+       const char *curl_url;
+
+       if (looks_like_command_line_option(url))
+               return -1;
+
+       if (submodule_url_is_relative(url) || starts_with(url, "git://")) {
+               char *decoded;
+               const char *next;
+               int has_nl;
+
+               /*
+                * This could be appended to an http URL and url-decoded;
+                * check for malicious characters.
+                */
+               decoded = url_decode(url);
+               has_nl = !!strchr(decoded, '\n');
+
+               free(decoded);
+               if (has_nl)
+                       return -1;
+
+               /*
+                * URLs which escape their root via "../" can overwrite
+                * the host field and previous components, resolving to
+                * URLs like https::example.com/submodule.git and
+                * https:///example.com/submodule.git that were
+                * susceptible to CVE-2020-11008.
+                */
+               if (count_leading_dotdots(url, &next) > 0 &&
+                   (*next == ':' || *next == '/'))
+                       return -1;
+       }
+
+       else if (url_to_curl_url(url, &curl_url)) {
+               int ret = 0;
+               char *normalized = url_normalize(curl_url, NULL);
+               if (normalized) {
+                       char *decoded = url_decode(normalized);
+                       if (strchr(decoded, '\n'))
+                               ret = -1;
+                       free(normalized);
+                       free(decoded);
+               } else {
+                       ret = -1;
+               }
+
+               return ret;
+       }
+
+       return 0;
+}
+
 static int name_and_item_from_var(const char *var, struct strbuf *name,
                                  struct strbuf *item)
 {
@@ -516,7 +656,9 @@ static int parse_config(const char *var, const char *value,
                        submodule->recommend_shallow =
                                git_config_bool(var, value);
        } else if (!strcmp(item.buf, "branch")) {
-               if (!me->overwrite && submodule->branch)
+               if (!value)
+                       ret = config_error_nonbool(var);
+               else if (!me->overwrite && submodule->branch)
                        warn_multiple_config(me->treeish_name, submodule->name,
                                             "branch");
                else {
index 2a37689cc272e30fa6f5dc9cfbbde044a52068c3..b6133af71b00d61abdafc3aa736fe4f4018695cf 100644 (file)
@@ -2,9 +2,7 @@
 #define SUBMODULE_CONFIG_CACHE_H
 
 #include "config.h"
-#include "hashmap.h"
 #include "submodule.h"
-#include "strbuf.h"
 #include "tree-walk.h"
 
 /**
@@ -91,6 +89,9 @@ int config_set_in_gitmodules_file_gently(const char *key, const char *value);
  */
 int check_submodule_name(const char *name);
 
+/* Returns 0 if the URL valid per RFC3986 and -1 otherwise. */
+int check_submodule_url(const char *url);
+
 /*
  * Note: these helper functions exist solely to maintain backward
  * compatibility with 'fetch' and 'update_clone' storing configuration in
index e603a19a876c88c59f18da33caa1541b15ded9f3..f0ddb31e8fb535264dded9fb0a7434fda1330f39 100644 (file)
 #include "string-list.h"
 #include "oid-array.h"
 #include "strvec.h"
-#include "blob.h"
 #include "thread-utils.h"
 #include "path.h"
-#include "quote.h"
 #include "remote.h"
 #include "worktree.h"
 #include "parse-options.h"
@@ -30,7 +28,6 @@
 #include "commit-reach.h"
 #include "read-cache-ll.h"
 #include "setup.h"
-#include "shallow.h"
 #include "trace2.h"
 
 static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;
@@ -595,7 +592,12 @@ static void show_submodule_header(struct diff_options *o,
             (!is_null_oid(two) && !*right))
                message = "(commits not present)";
 
-       *merge_bases = repo_get_merge_bases(sub, *left, *right);
+       *merge_bases = NULL;
+       if (repo_get_merge_bases(sub, *left, *right, merge_bases) < 0) {
+               message = "(corrupt repository)";
+               goto output_header;
+       }
+
        if (*merge_bases) {
                if ((*merge_bases)->item == *left)
                        fast_forward = 1;
@@ -1690,8 +1692,6 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
                task = get_fetch_task_from_changed(spf, err);
 
        if (task) {
-               struct strbuf submodule_prefix = STRBUF_INIT;
-
                child_process_init(cp);
                cp->dir = task->repo->gitdir;
                prepare_submodule_repo_env_in_gitdir(&cp->env);
@@ -1701,15 +1701,11 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
                        strvec_pushv(&cp->args, task->git_args.v);
                strvec_pushv(&cp->args, spf->args.v);
                strvec_push(&cp->args, task->default_argv);
-               strvec_push(&cp->args, "--submodule-prefix");
+               strvec_pushf(&cp->args, "--submodule-prefix=%s%s/",
+                            spf->prefix, task->sub->path);
 
-               strbuf_addf(&submodule_prefix, "%s%s/",
-                                               spf->prefix,
-                                               task->sub->path);
-               strvec_push(&cp->args, submodule_prefix.buf);
                *task_cb = task;
 
-               strbuf_release(&submodule_prefix);
                string_list_insert(&spf->seen_submodule_names, task->sub->name);
                return 1;
        }
@@ -1717,12 +1713,8 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
        if (spf->oid_fetch_tasks_nr) {
                struct fetch_task *task =
                        spf->oid_fetch_tasks[spf->oid_fetch_tasks_nr - 1];
-               struct strbuf submodule_prefix = STRBUF_INIT;
                spf->oid_fetch_tasks_nr--;
 
-               strbuf_addf(&submodule_prefix, "%s%s/",
-                           spf->prefix, task->sub->path);
-
                child_process_init(cp);
                prepare_submodule_repo_env_in_gitdir(&cp->env);
                cp->git_cmd = 1;
@@ -1731,8 +1723,8 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
                strvec_init(&cp->args);
                strvec_pushv(&cp->args, spf->args.v);
                strvec_push(&cp->args, "on-demand");
-               strvec_push(&cp->args, "--submodule-prefix");
-               strvec_push(&cp->args, submodule_prefix.buf);
+               strvec_pushf(&cp->args, "--submodule-prefix=%s%s/",
+                            spf->prefix, task->sub->path);
 
                /* NEEDSWORK: have get_default_remote from submodule--helper */
                strvec_push(&cp->args, "origin");
@@ -1740,7 +1732,6 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
                                          append_oid_to_argv, &cp->args);
 
                *task_cb = task;
-               strbuf_release(&submodule_prefix);
                return 1;
        }
 
index 3e00cdd801d637388edf1a546f9613a99cd3c737..2d95046f26ec6ebad9d8707e8c002aadc665a282 100644 (file)
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
 # Import tree-wide shared Makefile behavior and libraries
 include ../shared.mak
 
@@ -6,6 +9,7 @@ include ../shared.mak
 # Copyright (c) 2005 Junio C Hamano
 #
 
+-include ../config.mak.uname
 -include ../config.mak.autogen
 -include ../config.mak
 
@@ -17,6 +21,7 @@ TAR ?= $(TAR)
 RM ?= rm -f
 PROVE ?= prove
 DEFAULT_TEST_TARGET ?= test
+DEFAULT_UNIT_TEST_TARGET ?= unit-tests-raw
 TEST_LINT ?= test-lint
 
 ifdef TEST_OUTPUT_DIRECTORY
@@ -41,13 +46,16 @@ TPERF = $(sort $(wildcard perf/p[0-9][0-9][0-9][0-9]-*.sh))
 TINTEROP = $(sort $(wildcard interop/i[0-9][0-9][0-9][0-9]-*.sh))
 CHAINLINTTESTS = $(sort $(patsubst chainlint/%.test,%,$(wildcard chainlint/*.test)))
 CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl
+UNIT_TEST_SOURCES = $(wildcard unit-tests/t-*.c)
+UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES))
+UNIT_TESTS = $(sort $(filter-out unit-tests/bin/t-basic%,$(UNIT_TEST_PROGRAMS)))
 
 # `test-chainlint` (which is a dependency of `test-lint`, `test` and `prove`)
 # checks all tests in all scripts via a single invocation, so tell individual
 # scripts not to run the external "chainlint.pl" script themselves
 CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT &&
 
-all: $(DEFAULT_TEST_TARGET)
+all:: $(DEFAULT_TEST_TARGET)
 
 test: pre-clean check-chainlint $(TEST_LINT)
        $(CHAINLINTSUPPRESS) $(MAKE) aggregate-results-and-cleanup
@@ -65,6 +73,17 @@ prove: pre-clean check-chainlint $(TEST_LINT)
 $(T):
        @echo "*** $@ ***"; '$(TEST_SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
 
+$(UNIT_TESTS):
+       @echo "*** $@ ***"; $@
+
+.PHONY: unit-tests unit-tests-raw unit-tests-prove
+unit-tests: $(DEFAULT_UNIT_TEST_TARGET)
+
+unit-tests-raw: $(UNIT_TESTS)
+
+unit-tests-prove:
+       @echo "*** prove - unit tests ***"; $(PROVE) $(GIT_PROVE_OPTS) $(UNIT_TESTS)
+
 pre-clean:
        $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
 
@@ -90,20 +109,12 @@ check-chainlint:
                echo "# chainlint: $(CHAINLINTTMP_SQ)/tests" && \
                for i in $(CHAINLINTTESTS); do \
                        echo "# chainlint: $$i" && \
-                       sed -e '/^[     ]*$$/d' chainlint/$$i.expect; \
+                       cat chainlint/$$i.expect; \
                done \
        } >'$(CHAINLINTTMP_SQ)'/expect && \
        $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests | \
-               sed -e 's/^[1-9][0-9]* //;/^[   ]*$$/d' >'$(CHAINLINTTMP_SQ)'/actual && \
-       if test -f ../GIT-BUILD-OPTIONS; then \
-               . ../GIT-BUILD-OPTIONS; \
-       fi && \
-       if test -x ../git$$X; then \
-               DIFFW="../git$$X --no-pager diff -w --no-index"; \
-       else \
-               DIFFW="diff -w -u"; \
-       fi && \
-       $$DIFFW '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
+               sed -e 's/^[1-9][0-9]* //' >'$(CHAINLINTTMP_SQ)'/actual && \
+       diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
 
 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
        test-lint-filenames
@@ -149,4 +160,4 @@ perf:
        $(MAKE) -C perf/ all
 
 .PHONY: pre-clean $(T) aggregate-results clean valgrind perf \
-       check-chainlint clean-chainlint test-chainlint
+       check-chainlint clean-chainlint test-chainlint $(UNIT_TESTS)
index 61080859899bef0de95e04070ab54484bf591345..621d3b8c095441a8a8985b7f12363e26f8ab4d98 100644 (file)
--- a/t/README
+++ b/t/README
@@ -32,7 +32,7 @@ the tests.
     ok 2 - plain with GIT_WORK_TREE
     ok 3 - plain bare
 
-Since the tests all output TAP (see http://testanything.org) they can
+Since the tests all output TAP (see https://testanything.org) they can
 be run with any TAP harness. Here's an example of parallel testing
 powered by a recent version of prove(1):
 
@@ -262,8 +262,8 @@ The argument for --run, <test-selector>, is a list of description
 substrings or globs or individual test numbers or ranges with an
 optional negation prefix (of '!') that define what tests in a test
 suite to include (or exclude, if negated) in the run.  A range is two
-numbers separated with a dash and matches a range of tests with both
-ends been included.  You may omit the first or the second number to
+numbers separated with a dash and specifies an inclusive range of tests
+to run.  You may omit the first or the second number to
 mean "from the first test" or "up to the very last test" respectively.
 
 The argument to --run is split on commas into separate strings,
@@ -274,10 +274,10 @@ text that you want to match includes a comma, use the glob character
 on all tests that match either the glob *rebase* or the glob
 *merge?cherry-pick*.
 
-If --run starts with an unprefixed number or range the initial
-set of tests to run is empty. If the first item starts with '!'
+If --run starts with an unprefixed number or range, the initial
+set of tests to run is empty.  If the first item starts with '!',
 all the tests are added to the initial set.  After initial set is
-determined every test number or range is added or excluded from
+determined, every test number or range is added or excluded from
 the set one by one, from left to right.
 
 For example, to run only tests up to a specific test (21), one
@@ -479,6 +479,9 @@ GIT_TEST_DEFAULT_HASH=<hash-algo> specifies which hash algorithm to
 use in the test scripts. Recognized values for <hash-algo> are "sha1"
 and "sha256".
 
+GIT_TEST_DEFAULT_REF_FORMAT=<format> specifies which ref storage format
+to use in the test scripts. Recognized values for <format> are "files".
+
 GIT_TEST_NO_WRITE_REV_INDEX=<boolean>, when true disables the
 'pack.writeReverseIndex' setting.
 
@@ -579,11 +582,11 @@ This test harness library does the following things:
 
 Recommended style
 -----------------
-Here are some recommented styles when writing test case.
 
- - Keep test title the same line with test helper function itself.
+ - Keep the test_expect_* function call and test title on
+   the same line.
 
-   Take test_expect_success helper for example, write it like:
+   For example, with test_expect_success, write it like:
 
   test_expect_success 'test title' '
       ... test body ...
@@ -595,10 +598,9 @@ Here are some recommented styles when writing test case.
       'test title' \
       '... test body ...'
 
+ - End the line with an opening single quote.
 
- - End the line with a single quote.
-
- - Indent the body of here-document, and use "<<-" instead of "<<"
+ - Indent here-document bodies, and use "<<-" instead of "<<"
    to strip leading TABs used for indentation:
 
   test_expect_success 'test something' '
@@ -624,7 +626,7 @@ Here are some recommented styles when writing test case.
   '
 
  - Quote or escape the EOF delimiter that begins a here-document if
-   there is no parameter and other expansion in it, to signal readers
+   there is no parameter or other expansion in it, to signal readers
    that they can skim it more casually:
 
   cmd <<-\EOF
@@ -638,7 +640,7 @@ Do's & don'ts
 Here are a few examples of things you probably should and shouldn't do
 when writing tests.
 
-Here are the "do's:"
+The "do's:"
 
  - Put all code inside test_expect_success and other assertions.
 
@@ -888,7 +890,7 @@ see test-lib-functions.sh for the full list and their options.
    rare case where your test depends on more than one:
 
        test_expect_success PERL,PYTHON 'yo dawg' \
-           ' test $(perl -E 'print eval "1 +" . qx[python -c "print 2"]') == "4" '
+           ' test $(perl -E '\''print eval "1 +" . qx[python -c "print(2)"]'\'') = "4" '
 
  - test_expect_failure [<prereq>] <message> <script>
 
@@ -1237,8 +1239,8 @@ and it knows that the object ID of an empty tree is a certain
 because the things the very basic core test tries to achieve is
 to serve as a basis for people who are changing the Git internals
 drastically.  For these people, after making certain changes,
-not seeing failures from the basic test _is_ a failure.  And
-such drastic changes to the core Git that even changes these
+not seeing failures from the basic test _is_ a failure.  Any
+Git core changes so drastic that they change even these
 otherwise supposedly stable object IDs should be accompanied by
 an update to t0000-basic.sh.
 
@@ -1248,7 +1250,7 @@ knowledge of the core Git internals.  If all the test scripts
 hardcoded the object IDs like t0000-basic.sh does, that defeats
 the purpose of t0000-basic.sh, which is to isolate that level of
 validation in one place.  Your test also ends up needing
-updating when such a change to the internal happens, so do _not_
+an update whenever the internals change, so do _not_
 do it and leave the low level of validation to t0000-basic.sh.
 
 Test coverage
@@ -1279,7 +1281,7 @@ Devel::Cover module. To install it do:
    sudo aptitude install libdevel-cover-perl
 
    # From the CPAN with cpanminus
-   curl -L http://cpanmin.us | perl - --sudo --self-upgrade
+   curl -L https://cpanmin.us/ | perl - --sudo --self-upgrade
    cpanm --sudo Devel::Cover
 
 Then, at the top-level:
index 5e21e84f3884eb8c787ab82a5d1360d2b7cffb74..87572459e4b873cdc78f36867ba782e022eb13f4 100644 (file)
@@ -532,7 +532,7 @@ test_expect_success 'blame -L :funcname with userdiff driver' '
                "$(cat file.template)" &&
        test_commit --author "B <B@test.git>" \
                "change" "$fortran_file" \
-               "$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" &&
+               "$(sed -e s/ChangeMe/IWasChanged/ file.template)" &&
        check_count -f "$fortran_file" -L:RIGHT A 3 B 1
 '
 
index 48ed4eb1246efc67b0064b03ea531ea3fad3a320..056e03003d3e7847ead4f14e47b69de630cb507e 100644 (file)
@@ -1,11 +1,11 @@
-test_done ( ) {
+test_done () {
        case "$test_failure" in
-       0 )
+       0)
                test_at_end_hook_
 
                exit 0 ;;
 
-       * )
+       *)
                if test $test_external_has_tap -eq 0
                then
                        say_color error "# failed $test_failure among $msg"
@@ -14,5 +14,5 @@ test_done ( ) {
 
                exit 1 ;;
 
-               esac
+       esac
 }
index f76fde1ffba91d7becf17c0990c39ac25a7083f0..b47827d7499f607289cc6ec78a7b0030ee2449c0 100644 (file)
@@ -1,4 +1,8 @@
 (
+
        nothing &&
+
        something
+
+
 )
index a3bcea492a915f62cc6870a3e194fd86c19344a7..1c873263647907de91d461b4bf19b48ea5e85c3a 100644 (file)
@@ -12,9 +12,9 @@
 ) &&
 
 {
-       echo a ; ?!AMP?! echo b
+       echo a; ?!AMP?! echo b
 } &&
-{ echo a ; ?!AMP?! echo b ; } &&
+{ echo a; ?!AMP?! echo b; } &&
 
 {
        echo "${var}9" &&
index 28f9114f42de6b4dd6682ba7fdea5cd2bd3de263..20d0bb5333083208285e87408e5f16fb7263594c 100644 (file)
@@ -1,9 +1,9 @@
 JGIT_DAEMON_PID= &&
 git init --bare empty.git &&
-> empty.git/git-daemon-export-ok &&
+>empty.git/git-daemon-export-ok &&
 mkfifo jgit_daemon_output &&
 {
-       jgit daemon --port="$JGIT_DAEMON_PORT" . > jgit_daemon_output &
+       jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output &
        JGIT_DAEMON_PID=$!
 } &&
 test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
index 1732d221c32e98bf40438167769869cb597ed4a1..4cd18e2edfc80a4bcb30ea409da0e6afac0d341b 100644 (file)
@@ -1,16 +1,16 @@
 case "$(git ls-files)" in
-one ) echo pass one ;;
-* ) echo bad one ; return 1 ;;
+one) echo pass one ;;
+*) echo bad one; return 1 ;;
 esac &&
 (
        case "$(git ls-files)" in
-       two ) echo pass two ;;
-       * ) echo bad two ; exit 1 ;;
-esac
+       two) echo pass two ;;
+       *) echo bad two; exit 1 ;;
+       esac
 ) &&
 case "$(git ls-files)" in
-dir/two"$LF"one ) echo pass both ;;
-* ) echo bad ; return 1 ;;
+dir/two"$LF"one) echo pass both ;;
+*) echo bad; return 1 ;;
 esac &&
 
 for i in 1 2 3 4 ; do
index f4bada946322a6bee2634efc27b1e67f684c1c5e..e6b3b2193e869136e222ec582853ba3f17254e53 100644 (file)
@@ -1,7 +1,7 @@
-OUT=$(( ( large_git ; echo $? 1 >& 3 ) | : ) 3 >& 1) &&
+OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
 test_match_signal 13 "$OUT" &&
 
-{ test-tool sigchain > actual ; ret=$? ; } &&
+{ test-tool sigchain >actual; ret=$?; } &&
 {
        test_match_signal 15 "$ret" ||
        test "$ret" = 3
index af0369d3285b177dac4d2ccbf6528aa6b76ec2f8..83810ea7ec7d34d439c69b12bbfe2d70be16e3df 100644 (file)
@@ -4,7 +4,7 @@ mkdir sub && (
        nuff said
 ) &&
 
-cut "-d " -f actual | ( read s1 s2 s3 &&
+cut "-d " -f actual | (read s1 s2 s3 &&
 test -f $s1 ?!AMP?!
 test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1 )
+test $(cat $s3) = tree3path1)
index ab2f79e845703731124315bee2d90b6eff329126..ec42f2c30c98630ef0538936bbaa5f96c0fa7626 100644 (file)
@@ -1,2 +1,2 @@
-OUT=$(( ( large_git 1 >& 3 ) | : ) 3 >& 1) &&
+OUT=$( ((large_git 1>&3) | :) 3>&1 ) &&
 test_match_signal 13 "$OUT"
index bf9ced60d4c4a360266fc942430bbe79f6689345..37eab80738e4018e48b966cb9933ca332ae71f5e 100644 (file)
@@ -1,3 +1,5 @@
-echo 'fatal: reword option of --fixup is mutually exclusive with' '--patch/--interactive/--all/--include/--only' > expect &&
-test_must_fail git commit --fixup=reword:HEAD~ $1 2 > actual &&
+
+echo 'fatal: reword option of --fixup is mutually exclusive with'      '--patch/--interactive/--all/--include/--only' >expect &&
+test_must_fail git commit --fixup=reword:HEAD~ $1 2>actual &&
 test_cmp expect actual
+
index 10724987a5fbb6ba19ba0972c77b5689ca52ab28..087eda15e49144a9cbe24f9fc526f489b63aa068 100644 (file)
@@ -6,6 +6,7 @@ grep "^\.git$" output.txt &&
 (
        cd client$version &&
        GIT_TEST_PROTOCOL_VERSION=$version git fetch-pack --no-progress .. $(cat ../input)
-) > output &&
-       cut -d ' ' -f 2 < output | sort > actual &&
+) >output &&
+       cut -d ' ' -f 2 <output | sort >actual &&
        test_cmp expect actual
+
index e8733c97c645afce31a1253e90a69cfb017e4d7d..8507721192aeb4b5486ca7e7ddd2ecd7a484ebe0 100644 (file)
@@ -1,4 +1,4 @@
-git ls-tree $tree path > current &&
-cat > expected <<\EOF &&
+git ls-tree $tree path >current &&
+cat >expected <<\EOF &&
 EOF
 test_output
index 2d961a58c6676cee9db9ecfb573d4bac51f2d071..765a35bb4c47e31d369e481a3531ab7eaec2b097 100644 (file)
@@ -1,4 +1,4 @@
-if ! condition ; then echo nope ; else yep ; fi &&
+if ! condition; then echo nope; else yep; fi &&
 test_prerequisite !MINGW &&
 mail uucp!address &&
 echo !whatever!
index a21007a63f171c92482e47c381a759f7e6f20e03..02c0d15cca5cd42d7909f9fccbb95a932e217953 100644 (file)
@@ -1,5 +1,5 @@
 for it
 do
-       path=$(expr "$it" : ( [^:]*) ) &&
+       path=$(expr "$it" : ([^:]*)) &&
        git update-index --add "$path" || exit
 done
index d65c82129a68b7c3e2088ba9a95971e03a6952ee..d2237f1e38fad73938ff6335dac9de538e337caa 100644 (file)
@@ -6,6 +6,7 @@
                bar
                EOF
        done ?!AMP?!
+
        for i in a b c; do
                echo $i &&
                cat $i ?!LOOP?!
index a14388e6b9faeb67cdc79eea38a0cb3f94b240f8..dd7c997a3c340d633d9cbf7a78f4b29727a22ce4 100644 (file)
@@ -1,8 +1,8 @@
-sha1_file ( ) {
+sha1_file() {
        echo "$*" | sed "s#..#.git/objects/&/#"
 } &&
 
-remove_object ( ) {
+remove_object() {
        file=$(sha1_file "$*") &&
        test -e "$file" ?!AMP?!
        rm -f "$file"
index 1df3f782821b6a7221767fbdd76ad2c26b5d67c9..91b961242a1cabb7cc3f5edecaa6d99eb3eeef9e 100644 (file)
@@ -1,6 +1,6 @@
 boodle wobba \
-       gorgo snoot \
-       wafta snurb <<EOF &&
+       gorgo snoot \
+       wafta snurb <<EOF &&
 quoth the raven,
 nevermore...
 EOF
index 24da9e86d596b5d068b149242e213ba0224051d3..7ce3a348060dcfaf91299282eb4eee2b471f58bc 100644 (file)
@@ -1,18 +1,18 @@
-( while test $i -le $blobcount
-do
-       printf "Generating blob $i/$blobcount\r" >& 2 &&
+(while test $i -le $blobcount
+ do
+       printf "Generating blob $i/$blobcount\r" >&2 &&
        printf "blob\nmark :$i\ndata $blobsize\n" &&
        #test-tool genrandom $i $blobsize &&
        printf "%-${blobsize}s" $i &&
        echo "M 100644 :$i $i" >> commit &&
        i=$(($i+1)) ||
        echo $? > exit-status
-done &&
-echo "commit refs/heads/main" &&
-echo "author A U Thor <author@email.com> 123456789 +0000" &&
-echo "committer C O Mitter <committer@email.com> 123456789 +0000" &&
-echo "data 5" &&
-echo ">2gb" &&
-cat commit ) |
+ done &&
+ echo "commit refs/heads/main" &&
+ echo "author A U Thor <author@email.com> 123456789 +0000" &&
+ echo "committer C O Mitter <committer@email.com> 123456789 +0000" &&
+ echo "data 5" &&
+ echo ">2gb" &&
+ cat commit) |
 git fast-import --big-file-threshold=2 &&
 test ! -f exit-status
index 2a86885ee6a330450a76591248b60b89e601816f..3836049cc4190e4a37c35511279cd3fd36040b65 100644 (file)
@@ -2,18 +2,24 @@
        (cd foo &&
                bar
        ) &&
+
        (cd foo &&
                bar
        ) ?!AMP?!
+
        (
                cd foo &&
                bar) &&
+
        (
                cd foo &&
                bar) ?!AMP?!
+
        (cd foo &&
                bar) &&
+
        (cd foo &&
                bar) ?!AMP?!
+
        foobar
 )
index 4793a0e8e12aeb0f4d4c4497a2e77a87a2d6d2b6..3461df40e5129423ab58d92f84518d145f2f8b5d 100644 (file)
@@ -1,31 +1,31 @@
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" ?!LOOP?!
+               echo "$i$j" >"path$i$j" ?!LOOP?!
        done ?!LOOP?!
 done &&
 
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" || return 1
+               echo "$i$j" >"path$i$j" || return 1
        done
 done &&
 
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" ?!LOOP?!
+               echo "$i$j" >"path$i$j" ?!LOOP?!
        done || return 1
 done &&
 
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" || return 1
+               echo "$i$j" >"path$i$j" || return 1
        done || return 1
 done
index 02e0a9f1bb5f302a2903817b5d8ef7ff25b2efa7..73ff28546ae720bd7ce8e15cd9597e27e6afae41 100644 (file)
@@ -4,6 +4,7 @@
                echo a &&
                echo b
        ) >file &&
+
        cd foo &&
        (
                echo a ?!AMP?!
index 2cfc0282970db02dd37eaf1c0c079e22a233cef1..811971b1a3c495da2adf0064c24007c6a7bf913d 100644 (file)
@@ -2,7 +2,9 @@
        foo |
        bar |
        baz &&
+
        fish |
        cow ?!AMP?!
+
        sunder
 )
index 52789278d13b7605a63c0c92c09c518990ab316f..75d6f607e295638e9e0c5029711357bc2e9d2fda 100644 (file)
@@ -1,7 +1,7 @@
 (
        echo wobba \
-               gorgo snoot \
-               wafta snurb <<-EOF &&
+              gorgo snoot \
+              wafta snurb <<-EOF &&
        quoth the raven,
        nevermore...
        EOF
index b7015361bfe6a3555d02e97d2bdc0413b8f8c432..8f694990e8d9f1ce1205399f54b61436cfe4100c 100644 (file)
@@ -2,13 +2,18 @@
        (foo && bar) &&
        (foo && bar) |
        (foo && bar) >baz &&
+
        (foo; ?!AMP?! bar) &&
        (foo; ?!AMP?! bar) |
        (foo; ?!AMP?! bar) >baz &&
+
        (foo || exit 1) &&
        (foo || exit 1) |
        (foo || exit 1) >baz &&
+
        (foo && bar) ?!AMP?!
+
        (foo && bar; ?!AMP?! baz) ?!AMP?!
+
        foobar
 )
index 71b3b3bc20ed1d6718f8d0ee6efe35b147557b8c..02f3129232a0d114bf90211b9a6508385d0115bd 100644 (file)
@@ -15,6 +15,7 @@ main-sub4" &&
 $chkms
 TXT
 ) &&
+
        subfiles=$(git ls-files) &&
        check_equal "$subfiles" "$chkms
 $chks"
index 342360bcd05941c55c924e041a4715e9fe201361..6a387917a7af18bc39b70c91b091b91eb6a7ee82 100644 (file)
@@ -4,22 +4,22 @@ git config filter.rot13.clean ./rot13.sh &&
 {
     echo "*.t filter=rot13" ?!AMP?!
     echo "*.i ident"
-} > .gitattributes &&
+} >.gitattributes &&
 
 {
     echo a b c d e f g h i j k l m ?!AMP?!
     echo n o p q r s t u v w x y z ?!AMP?!
     echo '$Id$'
-} > test &&
-cat test > test.t &&
-cat test > test.o &&
-cat test > test.i &&
+} >test &&
+cat test >test.t &&
+cat test >test.o &&
+cat test >test.i &&
 git add test test.t test.i &&
 rm -f test test.t test.i &&
 git checkout -- test test.t test.i &&
 
-echo "content-test2" > test2.o &&
-echo "content-test3 - filename with special characters" > "test3 'sq',$x=.o" ?!AMP?!
+echo "content-test2" >test2.o &&
+echo "content-test3 - filename with special characters" >"test3 'sq',$x=.o" ?!AMP?!
 
 downstream_url_for_sed=$(
        printf "%sn" "$downstream_url" |
index 1f5eaea0fd59757ea78b7dc0b24ec0971c2faa36..06c1567f481e8cbc21cf50fdf58bfb9a502d439e 100644 (file)
@@ -6,6 +6,7 @@
                bar
                EOF
        done ?!AMP?!
+
        while true; do
                echo foo &&
                cat bar ?!LOOP?!
index aabe31d724b675e4f69c9f3760bcd0a6e8e9bbad..1281e66876f35d380d5360be23883c5ed27aafcf 100644 (file)
@@ -40,7 +40,6 @@ static void get_bloom_filter_for_commit(const struct object_id *commit_oid)
 {
        struct commit *c;
        struct bloom_filter *filter;
-       setup_git_directory();
        c = lookup_commit(the_repository, commit_oid);
        filter = get_or_compute_bloom_filter(the_repository, c, 1,
                                             &settings,
index 475058592d157da39a40ff32231a91f62a5d186a..09dc78733c009d386a7da4981aee1f3de4c57dda 100644 (file)
@@ -5,9 +5,7 @@
 #include "strbuf.h"
 #include "string-list.h"
 #include "transport.h"
-#include "ref-filter.h"
 #include "remote.h"
-#include "refs.h"
 
 enum input_mode {
        KEY_VALUE_PAIRS,
diff --git a/t/helper/test-ctype.c b/t/helper/test-ctype.c
deleted file mode 100644 (file)
index e5659df..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#include "test-tool.h"
-
-static int rc;
-
-static void report_error(const char *class, int ch)
-{
-       printf("%s classifies char %d (0x%02x) wrongly\n", class, ch, ch);
-       rc = 1;
-}
-
-static int is_in(const char *s, int ch)
-{
-       /*
-        * We can't find NUL using strchr. Accept it as the first
-        * character in the spec -- there are no empty classes.
-        */
-       if (ch == '\0')
-               return ch == *s;
-       if (*s == '\0')
-               s++;
-       return !!strchr(s, ch);
-}
-
-#define TEST_CLASS(t,s) {                      \
-       int i;                                  \
-       for (i = 0; i < 256; i++) {             \
-               if (is_in(s, i) != t(i))        \
-                       report_error(#t, i);    \
-       }                                       \
-       if (t(EOF))                             \
-               report_error(#t, EOF);          \
-}
-
-#define DIGIT "0123456789"
-#define LOWER "abcdefghijklmnopqrstuvwxyz"
-#define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-#define PUNCT "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
-#define ASCII \
-       "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
-       "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
-       "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" \
-       "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" \
-       "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" \
-       "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" \
-       "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
-       "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
-#define CNTRL \
-       "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
-       "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
-       "\x7f"
-
-int cmd__ctype(int argc UNUSED, const char **argv UNUSED)
-{
-       TEST_CLASS(isdigit, DIGIT);
-       TEST_CLASS(isspace, " \n\r\t");
-       TEST_CLASS(isalpha, LOWER UPPER);
-       TEST_CLASS(isalnum, LOWER UPPER DIGIT);
-       TEST_CLASS(is_glob_special, "*?[\\");
-       TEST_CLASS(is_regex_special, "$()*+.?[\\^{|");
-       TEST_CLASS(is_pathspec_magic, "!\"#%&',-/:;<=>@_`~");
-       TEST_CLASS(isascii, ASCII);
-       TEST_CLASS(islower, LOWER);
-       TEST_CLASS(isupper, UPPER);
-       TEST_CLASS(iscntrl, CNTRL);
-       TEST_CLASS(ispunct, PUNCT);
-       TEST_CLASS(isxdigit, DIGIT "abcdefABCDEF");
-       TEST_CLASS(isprint, LOWER UPPER DIGIT PUNCT " ");
-
-       return rc;
-}
index 66c88b8ff3d311573db482035aa143a0c1ad136f..1c486888a42d0da490f6b9a4d90941b09eda754b 100644 (file)
@@ -1,5 +1,5 @@
 #include "test-tool.h"
-#include "config.h"
+#include "parse.h"
 #include "parse-options.h"
 
 static char const * const env__helper_usage[] = {
index 2ed910adaa3da3b5db771679ccb1eefb0a8da2f5..8f59f6be4cff6c53da68ebb4ea7201e71793cbe1 100644 (file)
@@ -72,5 +72,7 @@ int cmd__example_decorate(int argc UNUSED, const char **argv UNUSED)
        if (objects_noticed != 2)
                BUG("should have 2 objects");
 
+       clear_decoration(&n, NULL);
+
        return 0;
 }
diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c
deleted file mode 100644 (file)
index cac20a7..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * "git fast-rebase" builtin command
- *
- * FAST: Forking Any Subprocesses (is) Taboo
- *
- * This is meant SOLELY as a demo of what is possible.  sequencer.c and
- * rebase.c should be refactored to use the ideas here, rather than attempting
- * to extend this file to replace those (unless Phillip or Dscho say that
- * refactoring is too hard and we need a clean slate, but I'm guessing that
- * refactoring is the better route).
- */
-
-#define USE_THE_INDEX_VARIABLE
-#include "test-tool.h"
-#include "cache-tree.h"
-#include "commit.h"
-#include "environment.h"
-#include "gettext.h"
-#include "hash.h"
-#include "hex.h"
-#include "lockfile.h"
-#include "merge-ort.h"
-#include "object-name.h"
-#include "read-cache-ll.h"
-#include "refs.h"
-#include "revision.h"
-#include "sequencer.h"
-#include "setup.h"
-#include "strvec.h"
-#include "tree.h"
-
-static const char *short_commit_name(struct commit *commit)
-{
-       return repo_find_unique_abbrev(the_repository, &commit->object.oid,
-                                      DEFAULT_ABBREV);
-}
-
-static struct commit *peel_committish(const char *name)
-{
-       struct object *obj;
-       struct object_id oid;
-
-       if (repo_get_oid(the_repository, name, &oid))
-               return NULL;
-       obj = parse_object(the_repository, &oid);
-       return (struct commit *)repo_peel_to_type(the_repository, name, 0, obj,
-                                                 OBJ_COMMIT);
-}
-
-static char *get_author(const char *message)
-{
-       size_t len;
-       const char *a;
-
-       a = find_commit_header(message, "author", &len);
-       if (a)
-               return xmemdupz(a, len);
-
-       return NULL;
-}
-
-static struct commit *create_commit(struct tree *tree,
-                                   struct commit *based_on,
-                                   struct commit *parent)
-{
-       struct object_id ret;
-       struct object *obj;
-       struct commit_list *parents = NULL;
-       char *author;
-       char *sign_commit = NULL;
-       struct commit_extra_header *extra;
-       struct strbuf msg = STRBUF_INIT;
-       const char *out_enc = get_commit_output_encoding();
-       const char *message = repo_logmsg_reencode(the_repository, based_on,
-                                                  NULL, out_enc);
-       const char *orig_message = NULL;
-       const char *exclude_gpgsig[] = { "gpgsig", NULL };
-
-       commit_list_insert(parent, &parents);
-       extra = read_commit_extra_headers(based_on, exclude_gpgsig);
-       find_commit_subject(message, &orig_message);
-       strbuf_addstr(&msg, orig_message);
-       author = get_author(message);
-       reset_ident_date();
-       if (commit_tree_extended(msg.buf, msg.len, &tree->object.oid, parents,
-                                &ret, author, NULL, sign_commit, extra)) {
-               error(_("failed to write commit object"));
-               return NULL;
-       }
-       free(author);
-       strbuf_release(&msg);
-
-       obj = parse_object(the_repository, &ret);
-       return (struct commit *)obj;
-}
-
-int cmd__fast_rebase(int argc, const char **argv)
-{
-       struct commit *onto;
-       struct commit *last_commit = NULL, *last_picked_commit = NULL;
-       struct object_id head;
-       struct lock_file lock = LOCK_INIT;
-       struct strvec rev_walk_args = STRVEC_INIT;
-       struct rev_info revs;
-       struct commit *commit;
-       struct merge_options merge_opt;
-       struct tree *next_tree, *base_tree, *head_tree;
-       struct merge_result result;
-       struct strbuf reflog_msg = STRBUF_INIT;
-       struct strbuf branch_name = STRBUF_INIT;
-       int ret = 0;
-
-       /*
-        * test-tool stuff doesn't set up the git directory by default; need to
-        * do that manually.
-        */
-       setup_git_directory();
-
-       if (argc == 2 && !strcmp(argv[1], "-h")) {
-               printf("Sorry, I am not a psychiatrist; I can not give you the help you need.  Oh, you meant usage...\n");
-               exit(129);
-       }
-
-       if (argc != 5 || strcmp(argv[1], "--onto"))
-               die("usage: read the code, figure out how to use it, then do so");
-
-       onto = peel_committish(argv[2]);
-       strbuf_addf(&branch_name, "refs/heads/%s", argv[4]);
-
-       /* Sanity check */
-       if (repo_get_oid(the_repository, "HEAD", &head))
-               die(_("Cannot read HEAD"));
-       assert(oideq(&onto->object.oid, &head));
-
-       repo_hold_locked_index(the_repository, &lock, LOCK_DIE_ON_ERROR);
-       if (repo_read_index(the_repository) < 0)
-               BUG("Could not read index");
-
-       repo_init_revisions(the_repository, &revs, NULL);
-       revs.verbose_header = 1;
-       revs.max_parents = 1;
-       revs.cherry_mark = 1;
-       revs.limited = 1;
-       revs.reverse = 1;
-       revs.right_only = 1;
-       revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
-       revs.topo_order = 1;
-       strvec_pushl(&rev_walk_args, "", argv[4], "--not", argv[3], NULL);
-
-       if (setup_revisions(rev_walk_args.nr, rev_walk_args.v, &revs, NULL) > 1) {
-               ret = error(_("unhandled options"));
-               goto cleanup;
-       }
-
-       strvec_clear(&rev_walk_args);
-
-       if (prepare_revision_walk(&revs) < 0) {
-               ret = error(_("error preparing revisions"));
-               goto cleanup;
-       }
-
-       init_merge_options(&merge_opt, the_repository);
-       memset(&result, 0, sizeof(result));
-       merge_opt.show_rename_progress = 1;
-       merge_opt.branch1 = "HEAD";
-       head_tree = repo_get_commit_tree(the_repository, onto);
-       result.tree = head_tree;
-       last_commit = onto;
-       while ((commit = get_revision(&revs))) {
-               struct commit *base;
-
-               fprintf(stderr, "Rebasing %s...\r",
-                       oid_to_hex(&commit->object.oid));
-               assert(commit->parents && !commit->parents->next);
-               base = commit->parents->item;
-
-               next_tree = repo_get_commit_tree(the_repository, commit);
-               base_tree = repo_get_commit_tree(the_repository, base);
-
-               merge_opt.branch2 = short_commit_name(commit);
-               merge_opt.ancestor = xstrfmt("parent of %s", merge_opt.branch2);
-
-               merge_incore_nonrecursive(&merge_opt,
-                                         base_tree,
-                                         result.tree,
-                                         next_tree,
-                                         &result);
-
-               free((char*)merge_opt.ancestor);
-               merge_opt.ancestor = NULL;
-               if (!result.clean)
-                       break;
-               last_picked_commit = commit;
-               last_commit = create_commit(result.tree, commit, last_commit);
-       }
-
-       merge_switch_to_result(&merge_opt, head_tree, &result, 1, !result.clean);
-
-       if (result.clean < 0)
-               exit(128);
-
-       if (result.clean) {
-               fprintf(stderr, "\nDone.\n");
-               strbuf_addf(&reflog_msg, "finish rebase %s onto %s",
-                           oid_to_hex(&last_picked_commit->object.oid),
-                           oid_to_hex(&last_commit->object.oid));
-               if (update_ref(reflog_msg.buf, branch_name.buf,
-                              &last_commit->object.oid,
-                              &last_picked_commit->object.oid,
-                              REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
-                       error(_("could not update %s"), argv[4]);
-                       die("Failed to update %s", argv[4]);
-               }
-               if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
-                       die(_("unable to update HEAD"));
-
-               prime_cache_tree(the_repository, the_repository->index,
-                                result.tree);
-       } else {
-               fprintf(stderr, "\nAborting: Hit a conflict.\n");
-               strbuf_addf(&reflog_msg, "rebase progress up to %s",
-                           oid_to_hex(&last_picked_commit->object.oid));
-               if (update_ref(reflog_msg.buf, "HEAD",
-                              &last_commit->object.oid,
-                              &head,
-                              REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
-                       error(_("could not update %s"), argv[4]);
-                       die("Failed to update %s", argv[4]);
-               }
-       }
-       if (write_locked_index(&the_index, &lock,
-                              COMMIT_LOCK | SKIP_IF_UNCHANGED))
-               die(_("unable to write %s"), get_index_file());
-
-       ret = (result.clean == 0);
-cleanup:
-       strbuf_release(&reflog_msg);
-       strbuf_release(&branch_name);
-       release_revisions(&revs);
-       return ret;
-}
diff --git a/t/helper/test-find-pack.c b/t/helper/test-find-pack.c
new file mode 100644 (file)
index 0000000..e8bd793
--- /dev/null
@@ -0,0 +1,50 @@
+#include "test-tool.h"
+#include "object-name.h"
+#include "object-store.h"
+#include "packfile.h"
+#include "parse-options.h"
+#include "setup.h"
+
+/*
+ * Display the path(s), one per line, of the packfile(s) containing
+ * the given object.
+ *
+ * If '--check-count <n>' is passed, then error out if the number of
+ * packfiles containing the object is not <n>.
+ */
+
+static const char *find_pack_usage[] = {
+       "test-tool find-pack [--check-count <n>] <object>",
+       NULL
+};
+
+int cmd__find_pack(int argc, const char **argv)
+{
+       struct object_id oid;
+       struct packed_git *p;
+       int count = -1, actual_count = 0;
+       const char *prefix = setup_git_directory();
+
+       struct option options[] = {
+               OPT_INTEGER('c', "check-count", &count, "expected number of packs"),
+               OPT_END(),
+       };
+
+       argc = parse_options(argc, argv, prefix, options, find_pack_usage, 0);
+       if (argc != 1)
+               usage(find_pack_usage[0]);
+
+       if (repo_get_oid(the_repository, argv[0], &oid))
+               die("cannot parse %s as an object name", argv[0]);
+
+       for (p = get_all_packs(the_repository); p; p = p->next)
+               if (find_pack_entry_one(oid.hash, p)) {
+                       printf("%s\n", p->pack_name);
+                       actual_count++;
+               }
+
+       if (count > -1 && count != actual_count)
+               die("bad packfile count %d instead of %d", actual_count, count);
+
+       return 0;
+}
diff --git a/t/helper/test-index-version.c b/t/helper/test-index-version.c
deleted file mode 100644 (file)
index f3c2dbe..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "test-tool.h"
-#include "read-cache-ll.h"
-
-int cmd__index_version(int argc UNUSED, const char **argv UNUSED)
-{
-       struct cache_header hdr;
-       int version;
-
-       memset(&hdr,0,sizeof(hdr));
-       if (read(0, &hdr, sizeof(hdr)) != sizeof(hdr))
-               return 0;
-       version = ntohl(hdr.hdr_version);
-       printf("%d\n", version);
-       return 0;
-}
index a4f6e24b0c6e1bf6557803921b5e9b21853791a3..ded8116cc5119f9d22d2d083cb8fa189e3783904 100644 (file)
@@ -21,6 +21,19 @@ static struct {
        int unset;
 } length_cb;
 
+static int mode34_callback(const struct option *opt, const char *arg, int unset)
+{
+       if (unset)
+               *(int *)opt->value = 0;
+       else if (!strcmp(arg, "3"))
+               *(int *)opt->value = 3;
+       else if (!strcmp(arg, "4"))
+               *(int *)opt->value = 4;
+       else
+               return error("invalid value for '%s': '%s'", "--mode34", arg);
+       return 0;
+}
+
 static int length_callback(const struct option *opt, const char *arg, int unset)
 {
        length_cb.called = 1;
@@ -124,6 +137,9 @@ int cmd__parse_options(int argc, const char **argv)
                OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23),
                OPT_CMDMODE(0, "mode1", &integer, "set integer to 1 (cmdmode option)", 1),
                OPT_CMDMODE(0, "mode2", &integer, "set integer to 2 (cmdmode option)", 2),
+               OPT_CALLBACK_F(0, "mode34", &integer, "(3|4)",
+                       "set integer to 3 or 4 (cmdmode option)",
+                       PARSE_OPT_CMDMODE, mode34_callback),
                OPT_CALLBACK('L', "length", &integer, "str",
                        "get length of <str>", length_callback),
                OPT_FILENAME('F', "file", &file, "set file to <file>"),
index f4d134a145214f3964e781db949c05cf51f32fc5..4daa82f00fcb5f0b178aa912033c906fe14c7718 100644 (file)
@@ -1,7 +1,9 @@
 #include "git-compat-util.h"
 #include "test-tool.h"
 #include "pkt-line.h"
+#include "sideband.h"
 #include "write-or-die.h"
+#include "parse-options.h"
 
 static void pack_line(const char *line)
 {
@@ -64,12 +66,33 @@ static void unpack(void)
        }
 }
 
-static void unpack_sideband(void)
+static void unpack_sideband(int argc, const char **argv)
 {
        struct packet_reader reader;
-       packet_reader_init(&reader, 0, NULL, 0,
-                          PACKET_READ_GENTLE_ON_EOF |
-                          PACKET_READ_CHOMP_NEWLINE);
+       int options = PACKET_READ_GENTLE_ON_EOF;
+       int chomp_newline = 1;
+       int reader_use_sideband = 0;
+       const char *const unpack_sideband_usage[] = {
+               "test_tool unpack_sideband [options...]", NULL
+       };
+       struct option cmd_options[] = {
+               OPT_BOOL(0, "reader-use-sideband", &reader_use_sideband,
+                        "set use_sideband bit for packet reader (Default: off)"),
+               OPT_BOOL(0, "chomp-newline", &chomp_newline,
+                        "chomp newline in packet (Default: on)"),
+               OPT_END()
+       };
+
+       argc = parse_options(argc, argv, "", cmd_options, unpack_sideband_usage,
+                            0);
+       if (argc > 0)
+               usage_msg_opt(_("too many arguments"), unpack_sideband_usage,
+                             cmd_options);
+
+       if (chomp_newline)
+               options |= PACKET_READ_CHOMP_NEWLINE;
+       packet_reader_init(&reader, 0, NULL, 0, options);
+       reader.use_sideband = reader_use_sideband;
 
        while (packet_reader_read(&reader) != PACKET_READ_EOF) {
                int band;
@@ -79,6 +102,17 @@ static void unpack_sideband(void)
                case PACKET_READ_EOF:
                        break;
                case PACKET_READ_NORMAL:
+                       /*
+                        * When the "use_sideband" field of the reader is turned
+                        * on, sideband packets other than the payload have been
+                        * parsed and consumed in packet_reader_read(), and only
+                        * the payload arrives here.
+                        */
+                       if (reader.use_sideband) {
+                               write_or_die(1, reader.line, reader.pktlen - 1);
+                               break;
+                       }
+
                        band = reader.line[0] & 0xff;
                        if (band < 1 || band > 2)
                                continue; /* skip non-sideband packets */
@@ -97,15 +131,31 @@ static void unpack_sideband(void)
 
 static int send_split_sideband(void)
 {
+       const char *foo = "Foo.\n";
+       const char *bar = "Bar.\n";
        const char *part1 = "Hello,";
        const char *primary = "\001primary: regular output\n";
        const char *part2 = " world!\n";
 
+       /* Each sideband message has a trailing newline character. */
+       send_sideband(1, 2, foo, strlen(foo), LARGE_PACKET_MAX);
+       send_sideband(1, 2, bar, strlen(bar), LARGE_PACKET_MAX);
+
+       /*
+        * One sideband message is divided into part1 and part2
+        * by the primary message.
+        */
        send_sideband(1, 2, part1, strlen(part1), LARGE_PACKET_MAX);
        packet_write(1, primary, strlen(primary));
        send_sideband(1, 2, part2, strlen(part2), LARGE_PACKET_MAX);
        packet_response_end(1);
 
+       /*
+        * We use unpack_sideband() to consume packets. A flush packet
+        * is required to end parsing.
+        */
+       packet_flush(1);
+
        return 0;
 }
 
@@ -126,7 +176,7 @@ int cmd__pkt_line(int argc, const char **argv)
        else if (!strcmp(argv[1], "unpack"))
                unpack();
        else if (!strcmp(argv[1], "unpack-sideband"))
-               unpack_sideband();
+               unpack_sideband(argc - 1, argv + 1);
        else if (!strcmp(argv[1], "send-split-sideband"))
                send_split_sideband();
        else if (!strcmp(argv[1], "receive-sideband"))
diff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c
deleted file mode 100644 (file)
index f0bf255..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "test-tool.h"
-#include "prio-queue.h"
-
-static int intcmp(const void *va, const void *vb, void *data UNUSED)
-{
-       const int *a = va, *b = vb;
-       return *a - *b;
-}
-
-static void show(int *v)
-{
-       if (!v)
-               printf("NULL\n");
-       else
-               printf("%d\n", *v);
-       free(v);
-}
-
-int cmd__prio_queue(int argc UNUSED, const char **argv)
-{
-       struct prio_queue pq = { intcmp };
-
-       while (*++argv) {
-               if (!strcmp(*argv, "get")) {
-                       void *peek = prio_queue_peek(&pq);
-                       void *get = prio_queue_get(&pq);
-                       if (peek != get)
-                               BUG("peek and get results do not match");
-                       show(get);
-               } else if (!strcmp(*argv, "dump")) {
-                       void *peek;
-                       void *get;
-                       while ((peek = prio_queue_peek(&pq))) {
-                               get = prio_queue_get(&pq);
-                               if (peek != get)
-                                       BUG("peek and get results do not match");
-                               show(get);
-                       }
-               } else if (!strcmp(*argv, "stack")) {
-                       pq.compare = NULL;
-               } else {
-                       int *v = xmalloc(sizeof(*v));
-                       *v = atoi(*argv);
-                       prio_queue_put(&pq, v);
-               }
-       }
-
-       clear_prio_queue(&pq);
-
-       return 0;
-}
index 3e173399a00f5296a70aa293107dfb4db94b1633..1e3b431e3e72116df65e825bed1916d5ff7859e6 100644 (file)
@@ -1,11 +1,9 @@
 #include "test-tool.h"
 #include "commit.h"
 #include "commit-reach.h"
-#include "config.h"
 #include "gettext.h"
 #include "hex.h"
 #include "object-name.h"
-#include "parse-options.h"
 #include "ref-filter.h"
 #include "setup.h"
 #include "string-list.h"
@@ -113,13 +111,16 @@ int cmd__reach(int ac, const char **av)
                       repo_in_merge_bases(the_repository, A, B));
        else if (!strcmp(av[1], "in_merge_bases_many"))
                printf("%s(A,X):%d\n", av[1],
-                      repo_in_merge_bases_many(the_repository, A, X_nr, X_array));
+                      repo_in_merge_bases_many(the_repository, A, X_nr, X_array, 0));
        else if (!strcmp(av[1], "is_descendant_of"))
                printf("%s(A,X):%d\n", av[1], repo_is_descendant_of(r, A, X));
        else if (!strcmp(av[1], "get_merge_bases_many")) {
-               struct commit_list *list = repo_get_merge_bases_many(the_repository,
-                                                                    A, X_nr,
-                                                                    X_array);
+               struct commit_list *list = NULL;
+               if (repo_get_merge_bases_many(the_repository,
+                                             A, X_nr,
+                                             X_array,
+                                             &list) < 0)
+                       exit(128);
                printf("%s(A,X):\n", av[1]);
                print_sorted_commit_ids(list);
        } else if (!strcmp(av[1], "reduce_heads")) {
index e9a444ddba55b49c9c47ceb3b27a31d3e022a8dc..4acae41bb993c883970227f394a61603a6e7152d 100644 (file)
@@ -6,6 +6,7 @@
 #include "pack-bitmap.h"
 #include "packfile.h"
 #include "setup.h"
+#include "gettext.h"
 
 static int read_midx_file(const char *object_dir, int show_objects)
 {
@@ -79,7 +80,7 @@ static int read_midx_checksum(const char *object_dir)
 static int read_midx_preferred_pack(const char *object_dir)
 {
        struct multi_pack_index *midx = NULL;
-       struct bitmap_index *bitmap = NULL;
+       uint32_t preferred_pack;
 
        setup_git_directory();
 
@@ -87,23 +88,45 @@ static int read_midx_preferred_pack(const char *object_dir)
        if (!midx)
                return 1;
 
-       bitmap = prepare_bitmap_git(the_repository);
-       if (!bitmap)
+       if (midx_preferred_pack(midx, &preferred_pack) < 0) {
+               warning(_("could not determine MIDX preferred pack"));
                return 1;
-       if (!bitmap_is_midx(bitmap)) {
-               free_bitmap_index(bitmap);
+       }
+
+       printf("%s\n", midx->pack_names[preferred_pack]);
+       return 0;
+}
+
+static int read_midx_bitmapped_packs(const char *object_dir)
+{
+       struct multi_pack_index *midx = NULL;
+       struct bitmapped_pack pack;
+       uint32_t i;
+
+       setup_git_directory();
+
+       midx = load_multi_pack_index(object_dir, 1);
+       if (!midx)
                return 1;
+
+       for (i = 0; i < midx->num_packs; i++) {
+               if (nth_bitmapped_pack(the_repository, midx, &pack, i) < 0)
+                       return 1;
+
+               printf("%s\n", pack_basename(pack.p));
+               printf("  bitmap_pos: %"PRIuMAX"\n", (uintmax_t)pack.bitmap_pos);
+               printf("  bitmap_nr: %"PRIuMAX"\n", (uintmax_t)pack.bitmap_nr);
        }
 
-       printf("%s\n", midx->pack_names[midx_preferred_pack(bitmap)]);
-       free_bitmap_index(bitmap);
+       close_midx(midx);
+
        return 0;
 }
 
 int cmd__read_midx(int argc, const char **argv)
 {
        if (!(argc == 2 || argc == 3))
-               usage("read-midx [--show-objects|--checksum|--preferred-pack] <object-dir>");
+               usage("read-midx [--show-objects|--checksum|--preferred-pack|--bitmap] <object-dir>");
 
        if (!strcmp(argv[1], "--show-objects"))
                return read_midx_file(argv[2], 1);
@@ -111,5 +134,7 @@ int cmd__read_midx(int argc, const char **argv)
                return read_midx_checksum(argv[2]);
        else if (!strcmp(argv[1], "--preferred-pack"))
                return read_midx_preferred_pack(argv[2]);
+       else if (!strcmp(argv[1], "--bitmap"))
+               return read_midx_bitmapped_packs(argv[2]);
        return read_midx_file(argv[1], 0);
 }
index 48552e6a9e0049365185499c02d9b1c7d1069d0c..7a0f6cac53d2433ade595ce95ab2d30e214b2ede 100644 (file)
@@ -221,15 +221,21 @@ static int cmd_verify_ref(struct ref_store *refs, const char **argv)
        return ret;
 }
 
+static int each_reflog(const char *refname, void *cb_data UNUSED)
+{
+       printf("%s\n", refname);
+       return 0;
+}
+
 static int cmd_for_each_reflog(struct ref_store *refs,
                               const char **argv UNUSED)
 {
-       return refs_for_each_reflog(refs, each_ref, NULL);
+       return refs_for_each_reflog(refs, each_reflog, NULL);
 }
 
-static int each_reflog(struct object_id *old_oid, struct object_id *new_oid,
-                      const char *committer, timestamp_t timestamp,
-                      int tz, const char *msg, void *cb_data UNUSED)
+static int each_reflog_ent(struct object_id *old_oid, struct object_id *new_oid,
+                          const char *committer, timestamp_t timestamp,
+                          int tz, const char *msg, void *cb_data UNUSED)
 {
        printf("%s %s %s %" PRItime " %+05d%s%s", oid_to_hex(old_oid),
               oid_to_hex(new_oid), committer, timestamp, tz,
@@ -241,14 +247,14 @@ static int cmd_for_each_reflog_ent(struct ref_store *refs, const char **argv)
 {
        const char *refname = notnull(*argv++, "refname");
 
-       return refs_for_each_reflog_ent(refs, refname, each_reflog, refs);
+       return refs_for_each_reflog_ent(refs, refname, each_reflog_ent, refs);
 }
 
 static int cmd_for_each_reflog_ent_reverse(struct ref_store *refs, const char **argv)
 {
        const char *refname = notnull(*argv++, "refname");
 
-       return refs_for_each_reflog_ent_reverse(refs, refname, each_reflog, refs);
+       return refs_for_each_reflog_ent_reverse(refs, refname, each_reflog_ent, refs);
 }
 
 static int cmd_reflog_exists(struct ref_store *refs, const char **argv)
@@ -298,16 +304,19 @@ static int cmd_update_ref(struct ref_store *refs, const char **argv)
        const char *new_sha1_buf = notnull(*argv++, "new-sha1");
        const char *old_sha1_buf = notnull(*argv++, "old-sha1");
        unsigned int flags = arg_flags(*argv++, "flags", transaction_flags);
-       struct object_id old_oid;
+       struct object_id old_oid, *old_oid_ptr = NULL;
        struct object_id new_oid;
 
-       if (get_oid_hex(old_sha1_buf, &old_oid))
-               die("cannot parse %s as %s", old_sha1_buf, the_hash_algo->name);
+       if (*old_sha1_buf) {
+               if (get_oid_hex(old_sha1_buf, &old_oid))
+                       die("cannot parse %s as %s", old_sha1_buf, the_hash_algo->name);
+               old_oid_ptr = &old_oid;
+       }
        if (get_oid_hex(new_sha1_buf, &new_oid))
                die("cannot parse %s as %s", new_sha1_buf, the_hash_algo->name);
 
        return refs_update_ref(refs, msg, refname,
-                              &new_oid, &old_oid,
+                              &new_oid, old_oid_ptr,
                               flags, UPDATE_REFS_DIE_ON_ERR);
 }
 
index bd871a735b4fbb19ed99e9bfab56f13d138a0567..80042eafc20603e0c84cb83d3ba400cd316010c7 100644 (file)
@@ -30,7 +30,7 @@ static int test_regex_bug(void)
        if (regexec(&r, str, 1, m, 0))
                die("no match of pattern '%s' to string '%s'", pat, str);
 
-       /* http://sourceware.org/bugzilla/show_bug.cgi?id=3957  */
+       /* https://sourceware.org/bugzilla/show_bug.cgi?id=3957 */
        if (m[0].rm_so == 3) /* matches '\n' when it should not */
                die("regex bug confirmed: re-build git with NO_REGEX=1");
 
index 4cd8a952e5c6f55fbb3cfdbffe8c3be07bf008d7..0c7c5aa4dd7641a72b930b57eeff17dbf90c4c16 100644 (file)
@@ -1,10 +1,8 @@
 #include "test-tool.h"
 #include "commit-graph.h"
 #include "commit.h"
-#include "config.h"
 #include "environment.h"
 #include "hex.h"
-#include "object-store-ll.h"
 #include "object.h"
 #include "repository.h"
 #include "setup.h"
index 3d1436da59872fcfe7551a5586c7720893221ddb..fb5927775daef80040ea9675742aa2cb47d46d4e 100644 (file)
@@ -4,7 +4,6 @@
 
 #include "test-tool.h"
 #include "gettext.h"
-#include "strbuf.h"
 #include "simple-ipc.h"
 #include "parse-options.h"
 #include "thread-utils.h"
@@ -278,7 +277,8 @@ static int daemon__run_server(void)
 
 static start_bg_wait_cb bg_wait_cb;
 
-static int bg_wait_cb(const struct child_process *cp, void *cb_data)
+static int bg_wait_cb(const struct child_process *cp UNUSED,
+                     void *cb_data UNUSED)
 {
        int s = ipc_get_active_state(cl_args.path);
 
index 356e0a26c5a0b87714d76f608a917807f69599f5..7197969a08149699a14c758ceef1223e494b7c35 100644 (file)
@@ -4,16 +4,24 @@
 #include "remote.h"
 #include "repository.h"
 #include "setup.h"
+#include "strbuf.h"
 #include "submodule-config.h"
 #include "submodule.h"
 
 #define TEST_TOOL_CHECK_NAME_USAGE \
-       "test-tool submodule check-name <name>"
+       "test-tool submodule check-name"
 static const char *submodule_check_name_usage[] = {
        TEST_TOOL_CHECK_NAME_USAGE,
        NULL
 };
 
+#define TEST_TOOL_CHECK_URL_USAGE \
+       "test-tool submodule check-url"
+static const char *submodule_check_url_usage[] = {
+       TEST_TOOL_CHECK_URL_USAGE,
+       NULL
+};
+
 #define TEST_TOOL_IS_ACTIVE_USAGE \
        "test-tool submodule is-active <name>"
 static const char *submodule_is_active_usage[] = {
@@ -30,31 +38,26 @@ static const char *submodule_resolve_relative_url_usage[] = {
 
 static const char *submodule_usage[] = {
        TEST_TOOL_CHECK_NAME_USAGE,
+       TEST_TOOL_CHECK_URL_USAGE,
        TEST_TOOL_IS_ACTIVE_USAGE,
        TEST_TOOL_RESOLVE_RELATIVE_URL_USAGE,
        NULL
 };
 
+typedef int (*check_fn_t)(const char *);
+
 /*
- * Exit non-zero if any of the submodule names given on the command line is
- * invalid. If no names are given, filter stdin to print only valid names
- * (which is primarily intended for testing).
+ * Apply 'check_fn' to each line of stdin, printing values that pass the check
+ * to stdout.
  */
-static int check_name(int argc, const char **argv)
+static int check_submodule(check_fn_t check_fn)
 {
-       if (argc > 1) {
-               while (*++argv) {
-                       if (check_submodule_name(*argv) < 0)
-                               return 1;
-               }
-       } else {
-               struct strbuf buf = STRBUF_INIT;
-               while (strbuf_getline(&buf, stdin) != EOF) {
-                       if (!check_submodule_name(buf.buf))
-                               printf("%s\n", buf.buf);
-               }
-               strbuf_release(&buf);
+       struct strbuf buf = STRBUF_INIT;
+       while (strbuf_getline(&buf, stdin) != EOF) {
+               if (!check_fn(buf.buf))
+                       printf("%s\n", buf.buf);
        }
+       strbuf_release(&buf);
        return 0;
 }
 
@@ -68,7 +71,20 @@ static int cmd__submodule_check_name(int argc, const char **argv)
        if (argc)
                usage_with_options(submodule_check_name_usage, options);
 
-       return check_name(argc, argv);
+       return check_submodule(check_submodule_name);
+}
+
+static int cmd__submodule_check_url(int argc, const char **argv)
+{
+       struct option options[] = {
+               OPT_END()
+       };
+       argc = parse_options(argc, argv, "test-tools", options,
+                            submodule_check_url_usage, 0);
+       if (argc)
+               usage_with_options(submodule_check_url_usage, options);
+
+       return check_submodule(check_submodule_url);
 }
 
 static int cmd__submodule_is_active(int argc, const char **argv)
@@ -194,6 +210,7 @@ static int cmd__submodule_config_writeable(int argc, const char **argv UNUSED)
 
 static struct test_cmd cmds[] = {
        { "check-name", cmd__submodule_check_name },
+       { "check-url", cmd__submodule_check_url },
        { "is-active", cmd__submodule_is_active },
        { "resolve-relative-url", cmd__submodule_resolve_relative_url},
        { "config-list", cmd__submodule_config_list },
index 8b6c84f202d6c551656b24a40f391ea75c4a8495..80a946b847e67da00d8a6fc9884ab6d7cdfe2903 100644 (file)
@@ -19,7 +19,6 @@ static struct test_cmd cmds[] = {
        { "config", cmd__config },
        { "crontab", cmd__crontab },
        { "csprng", cmd__csprng },
-       { "ctype", cmd__ctype },
        { "date", cmd__date },
        { "delete-gpgsig", cmd__delete_gpgsig },
        { "delta", cmd__delta },
@@ -31,7 +30,7 @@ static struct test_cmd cmds[] = {
        { "dump-untracked-cache", cmd__dump_untracked_cache },
        { "env-helper", cmd__env_helper },
        { "example-decorate", cmd__example_decorate },
-       { "fast-rebase", cmd__fast_rebase },
+       { "find-pack", cmd__find_pack },
        { "fsmonitor-client", cmd__fsmonitor_client },
        { "genrandom", cmd__genrandom },
        { "genzeros", cmd__genzeros },
@@ -39,7 +38,6 @@ static struct test_cmd cmds[] = {
        { "hashmap", cmd__hashmap },
        { "hash-speed", cmd__hash_speed },
        { "hexdump", cmd__hexdump },
-       { "index-version", cmd__index_version },
        { "json-writer", cmd__json_writer },
        { "lazy-init-name-hash", cmd__lazy_init_name_hash },
        { "match-trees", cmd__match_trees },
@@ -58,7 +56,6 @@ static struct test_cmd cmds[] = {
        { "path-utils", cmd__path_utils },
        { "pcre2-config", cmd__pcre2_config },
        { "pkt-line", cmd__pkt_line },
-       { "prio-queue", cmd__prio_queue },
        { "proc-receive", cmd__proc_receive },
        { "progress", cmd__progress },
        { "reach", cmd__reach },
@@ -87,6 +84,7 @@ static struct test_cmd cmds[] = {
        { "submodule-nested-repo-config", cmd__submodule_nested_repo_config },
        { "subprocess", cmd__subprocess },
        { "trace2", cmd__trace2 },
+       { "truncate", cmd__truncate },
        { "userdiff", cmd__userdiff },
        { "urlmatch-normalization", cmd__urlmatch_normalization },
        { "xml-encode", cmd__xml_encode },
index 76baaece35b918bf28078f1e3ddd7211e6f61b32..2808b924191f21ee4ac18462397efd86289eb0c0 100644 (file)
@@ -12,7 +12,6 @@ int cmd__chmtime(int argc, const char **argv);
 int cmd__config(int argc, const char **argv);
 int cmd__crontab(int argc, const char **argv);
 int cmd__csprng(int argc, const char **argv);
-int cmd__ctype(int argc, const char **argv);
 int cmd__date(int argc, const char **argv);
 int cmd__delta(int argc, const char **argv);
 int cmd__delete_gpgsig(int argc, const char **argv);
@@ -25,7 +24,7 @@ int cmd__dump_untracked_cache(int argc, const char **argv);
 int cmd__dump_reftable(int argc, const char **argv);
 int cmd__env_helper(int argc, const char **argv);
 int cmd__example_decorate(int argc, const char **argv);
-int cmd__fast_rebase(int argc, const char **argv);
+int cmd__find_pack(int argc, const char **argv);
 int cmd__fsmonitor_client(int argc, const char **argv);
 int cmd__genrandom(int argc, const char **argv);
 int cmd__genzeros(int argc, const char **argv);
@@ -33,7 +32,6 @@ int cmd__getcwd(int argc, const char **argv);
 int cmd__hashmap(int argc, const char **argv);
 int cmd__hash_speed(int argc, const char **argv);
 int cmd__hexdump(int argc, const char **argv);
-int cmd__index_version(int argc, const char **argv);
 int cmd__json_writer(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__match_trees(int argc, const char **argv);
@@ -51,7 +49,6 @@ int cmd__partial_clone(int argc, const char **argv);
 int cmd__path_utils(int argc, const char **argv);
 int cmd__pcre2_config(int argc, const char **argv);
 int cmd__pkt_line(int argc, const char **argv);
-int cmd__prio_queue(int argc, const char **argv);
 int cmd__proc_receive(int argc, const char **argv);
 int cmd__progress(int argc, const char **argv);
 int cmd__reach(int argc, const char **argv);
@@ -80,6 +77,7 @@ int cmd__submodule_config(int argc, const char **argv);
 int cmd__submodule_nested_repo_config(int argc, const char **argv);
 int cmd__subprocess(int argc, const char **argv);
 int cmd__trace2(int argc, const char **argv);
+int cmd__truncate(int argc, const char **argv);
 int cmd__userdiff(int argc, const char **argv);
 int cmd__urlmatch_normalization(int argc, const char **argv);
 int cmd__xml_encode(int argc, const char **argv);
index 20c7495f38593550a8a4dd35a957cc62cf3a2ded..1adac29a575254492f206bf4c4e4b6cab08f999d 100644 (file)
@@ -45,7 +45,7 @@ static int get_i(int *p_value, const char *data)
  * [] "def_param" events for all of the "interesting" pre-defined
  * config settings.
  */
-static int ut_001return(int argc, const char **argv)
+static int ut_001return(int argc UNUSED, const char **argv)
 {
        int rc;
 
@@ -65,7 +65,7 @@ static int ut_001return(int argc, const char **argv)
  * [] "def_param" events for all of the "interesting" pre-defined
  * config settings.
  */
-static int ut_002exit(int argc, const char **argv)
+static int ut_002exit(int argc UNUSED, const char **argv)
 {
        int rc;
 
@@ -201,7 +201,7 @@ static int ut_006data(int argc, const char **argv)
        return 0;
 }
 
-static int ut_007BUG(int argc, const char **argv)
+static int ut_007BUG(int argc UNUSED, const char **argv UNUSED)
 {
        /*
         * Exercise BUG() to ensure that the message is printed to trace2.
@@ -412,6 +412,56 @@ static int ut_201counter(int argc, const char **argv)
        return 0;
 }
 
+static int ut_300redact_start(int argc, const char **argv)
+{
+       if (!argc)
+               die("expect <argv...>");
+
+       trace2_cmd_start(argv);
+
+       return 0;
+}
+
+static int ut_301redact_child_start(int argc, const char **argv)
+{
+       struct child_process cmd = CHILD_PROCESS_INIT;
+       int k;
+
+       if (!argc)
+               die("expect <argv...>");
+
+       for (k = 0; argv[k]; k++)
+               strvec_push(&cmd.args, argv[k]);
+
+       trace2_child_start(&cmd);
+
+       strvec_clear(&cmd.args);
+
+       return 0;
+}
+
+static int ut_302redact_exec(int argc, const char **argv)
+{
+       if (!argc)
+               die("expect <exe> <argv...>");
+
+       trace2_exec(argv[0], &argv[1]);
+
+       return 0;
+}
+
+static int ut_303redact_def_param(int argc, const char **argv)
+{
+       struct key_value_info kvi = KVI_INIT;
+
+       if (argc < 2)
+               die("expect <key> <value>");
+
+       trace2_def_param(argv[0], argv[1], &kvi);
+
+       return 0;
+}
+
 /*
  * Usage:
  *     test-tool trace2 <ut_name_1> <ut_usage_1>
@@ -438,6 +488,11 @@ static struct unit_test ut_table[] = {
 
        { ut_200counter,  "200counter", "<v1> [<v2> [<v3> [...]]]" },
        { ut_201counter,  "201counter", "<v1> <v2> <threads>" },
+
+       { ut_300redact_start,       "300redact_start",       "<argv...>" },
+       { ut_301redact_child_start, "301redact_child_start", "<argv...>" },
+       { ut_302redact_exec,        "302redact_exec",        "<exe> <argv...>" },
+       { ut_303redact_def_param,   "303redact_def_param",   "<key> <value>" },
 };
 /* clang-format on */
 
diff --git a/t/helper/test-truncate.c b/t/helper/test-truncate.c
new file mode 100644 (file)
index 0000000..3931dea
--- /dev/null
@@ -0,0 +1,25 @@
+#include "test-tool.h"
+#include "git-compat-util.h"
+
+/*
+ * Truncate a file to the given size.
+ */
+int cmd__truncate(int argc, const char **argv)
+{
+       char *p = NULL;
+       uintmax_t sz = 0;
+       int fd = -1;
+
+       if (argc != 3)
+               die("expected filename and size");
+
+       sz = strtoumax(argv[2], &p, 0);
+       if (*p)
+               die("invalid size");
+
+       fd = xopen(argv[1], O_WRONLY | O_CREAT, 0600);
+
+       if (ftruncate(fd, (off_t) sz) < 0)
+               die_errno("failed to truncate file");
+       return 0;
+}
diff --git a/t/lib-chunk.sh b/t/lib-chunk.sh
new file mode 100644 (file)
index 0000000..a7cd9c3
--- /dev/null
@@ -0,0 +1,17 @@
+# Shell library for working with "chunk" files (commit-graph, midx, etc).
+
+# corrupt_chunk_file <fn> <chunk> <offset> <bytes>
+#
+# Corrupt a chunk-based file (like a commit-graph) by overwriting the bytes
+# found in the chunk specified by the 4-byte <chunk> identifier. If <offset> is
+# "clear", replace the chunk entirely. Otherwise, overwrite data <offset> bytes
+# into the chunk.
+#
+# The <bytes> are interpreted as pairs of hex digits (so "000000FE" would be
+# big-endian 254).
+corrupt_chunk_file () {
+       fn=$1; shift
+       perl "$TEST_DIRECTORY"/lib-chunk/corrupt-chunk-file.pl \
+               "$@" <"$fn" >"$fn.tmp" &&
+       mv "$fn.tmp" "$fn"
+}
diff --git a/t/lib-chunk/corrupt-chunk-file.pl b/t/lib-chunk/corrupt-chunk-file.pl
new file mode 100644 (file)
index 0000000..0e11aad
--- /dev/null
@@ -0,0 +1,90 @@
+#!/usr/bin/perl
+
+my ($chunk, $seek, $bytes) = @ARGV;
+$bytes =~ s/../chr(hex($&))/ge;
+
+binmode STDIN;
+binmode STDOUT;
+
+# A few helpers to read bytes, or read and copy them to the
+# output.
+sub get {
+       my $n = shift;
+       return unless $n;
+       read(STDIN, my $buf, $n)
+               or die "read error or eof: $!\n";
+       return $buf;
+}
+sub copy {
+       my $buf = get(@_);
+       print $buf;
+       return $buf;
+}
+
+# Some platforms' perl builds don't support 64-bit integers, and hence do not
+# allow packing/unpacking quadwords with "Q". The chunk format uses 64-bit file
+# offsets to support files of any size, but in practice our test suite will
+# only use small files. So we can fake it by asking for two 32-bit values and
+# discarding the first (most significant) one, which is equivalent as long as
+# it's just zero.
+sub unpack_quad {
+       my $bytes = shift;
+       my ($n1, $n2) = unpack("NN", $bytes);
+       die "quad value exceeds 32 bits" if $n1;
+       return $n2;
+}
+sub pack_quad {
+       my $n = shift;
+       my $ret = pack("NN", 0, $n);
+       # double check that our original $n did not exceed the 32-bit limit.
+       # This is presumably impossible on a 32-bit system (which would have
+       # truncated much earlier), but would still alert us on a 64-bit build
+       # of a new test that would fail on a 32-bit build (though we'd
+       # presumably see the die() from unpack_quad() in such a case).
+       die "quad round-trip failed" if unpack_quad($ret) != $n;
+       return $ret;
+}
+
+# read until we find table-of-contents entry for chunk;
+# note that we cheat a bit by assuming 4-byte alignment and
+# that no ToC entry will accidentally look like a header.
+#
+# If we don't find the entry, copy() will hit EOF and exit
+# (which should cause the caller to fail the test).
+while (copy(4) ne $chunk) { }
+my $offset = unpack_quad(copy(8));
+
+# In clear mode, our length will change. So figure out
+# the length by comparing to the offset of the next chunk, and
+# then adjust that offset (and all subsequent) ones.
+my $len;
+if ($seek eq "clear") {
+       my $id;
+       do {
+               $id = copy(4);
+               my $next = unpack_quad(get(8));
+               if (!defined $len) {
+                       $len = $next - $offset;
+               }
+               print pack_quad($next - $len + length($bytes));
+       } while (unpack("N", $id));
+}
+
+# and now copy up to our existing chunk data
+copy($offset - tell(STDIN));
+if ($seek eq "clear") {
+       # if clearing, skip past existing data
+       get($len);
+} else {
+       # otherwise, copy up to the requested offset,
+       # and skip past the overwritten bytes
+       copy($seek);
+       get(length($bytes));
+}
+
+# now write out the requested bytes, along
+# with any other remaining data
+print $bytes;
+while (read(STDIN, my $buf, 4096)) {
+       print $buf;
+}
index 032b2d8fcc48aa2cd72c60fa05f9b1299680f92c..44799c0d38fdb35d1c56a3e9ac8d91a963d2ee1c 100644 (file)
@@ -43,11 +43,14 @@ helper_test_clean() {
        reject $1 https example.com store-user
        reject $1 https example.com user1
        reject $1 https example.com user2
+       reject $1 https example.com user-expiry
+       reject $1 https example.com user-expiry-overwrite
        reject $1 https example.com user4
        reject $1 https example.com user-distinct-pass
        reject $1 https example.com user-overwrite
        reject $1 https example.com user-erase1
        reject $1 https example.com user-erase2
+       reject $1 https victim.example.com user
        reject $1 http path.tld user
        reject $1 https timeout.tld user
        reject $1 https sso.tld
@@ -431,6 +434,81 @@ helper_test_timeout() {
        '
 }
 
+helper_test_password_expiry_utc() {
+       HELPER=$1
+
+       test_expect_success "helper ($HELPER) stores password_expiry_utc" '
+               check approve $HELPER <<-\EOF
+               protocol=https
+               host=example.com
+               username=user-expiry
+               password=pass
+               password_expiry_utc=9999999999
+               EOF
+       '
+
+       test_expect_success "helper ($HELPER) gets password_expiry_utc" '
+               check fill $HELPER <<-\EOF
+               protocol=https
+               host=example.com
+               username=user-expiry
+               --
+               protocol=https
+               host=example.com
+               username=user-expiry
+               password=pass
+               password_expiry_utc=9999999999
+               --
+               EOF
+       '
+
+       test_expect_success "helper ($HELPER) overwrites when password_expiry_utc changes" '
+               check approve $HELPER <<-\EOF &&
+               protocol=https
+               host=example.com
+               username=user-expiry-overwrite
+               password=pass1
+               password_expiry_utc=9999999998
+               EOF
+               check approve $HELPER <<-\EOF &&
+               protocol=https
+               host=example.com
+               username=user-expiry-overwrite
+               password=pass2
+               password_expiry_utc=9999999999
+               EOF
+               check fill $HELPER <<-\EOF &&
+               protocol=https
+               host=example.com
+               username=user-expiry-overwrite
+               --
+               protocol=https
+               host=example.com
+               username=user-expiry-overwrite
+               password=pass2
+               password_expiry_utc=9999999999
+               EOF
+               check reject $HELPER <<-\EOF &&
+               protocol=https
+               host=example.com
+               username=user-expiry-overwrite
+               password=pass2
+               EOF
+               check fill $HELPER <<-\EOF
+               protocol=https
+               host=example.com
+               username=user-expiry-overwrite
+               --
+               protocol=https
+               host=example.com
+               username=user-expiry-overwrite
+               password=askpass-password
+               --
+               askpass: Password for '\''https://user-expiry-overwrite@example.com'\'':
+               EOF
+       '
+}
+
 helper_test_oauth_refresh_token() {
        HELPER=$1
 
index 32b34733790834362612816eb5eac63cc6acdf33..57b9b2db9b3f8244dfec5a6cf5b6dc6a6dcb1138 100644 (file)
@@ -71,8 +71,8 @@ test_cmp_branch_tree () {
                find . -type d -name .git -prune -o -type f -print
        ) | sort >module-git-"$1".list &&
        test_cmp module-cvs-"$1".list module-git-"$1".list &&
-       cat module-cvs-"$1".list | while read f
+       while read f
        do
                test_cmp_branch_file "$1" "$f" || return 1
-       done
+       done <module-cvs-"$1".list
 }
index 4eebd9c2b50f0445b975c46bc660efc9eb90ecd5..add11e88fc00d7c452f62c0f6da0835fd12f53a2 100644 (file)
@@ -13,7 +13,7 @@ test_lazy_prereq GPG '
        gpg_version=$(gpg --version 2>&1)
        test $? != 127 || exit 1
 
-       # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
+       # As said here: https://web.archive.org/web/20130212022238/https://www.gnupg.org/faq/gnupg-faq.html#why-does-gnupg-1.0.6-bail-out-on-keyrings-used-with-1.0.7
        # the gpg version 1.0.6 did not parse trust packets correctly, so for
        # that version, creation of signed tags using the generated key fails.
        case "$gpg_version" in
@@ -45,6 +45,7 @@ test_lazy_prereq GPG '
                        "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
                gpg --homedir "${GNUPGHOME}" --import-ownertrust \
                        "$TEST_DIRECTORY"/lib-gpg/ownertrust &&
+               gpg --homedir "${GNUPGHOME}" --update-trustdb &&
                gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null \
                        --sign -u committer@example.com
                ;;
index 2fb1b2ae5613a5384dea41df405658cdb787117b..d83bafeab32d40d6fd373e084757221ac7181d06 100644 (file)
@@ -55,21 +55,31 @@ fi
 
 HTTPD_PARA=""
 
-for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' '/usr/sbin/apache2'
+for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' \
+                         '/usr/sbin/apache2' \
+                         "$(command -v httpd)" \
+                         "$(command -v apache2)"
 do
-       if test -x "$DEFAULT_HTTPD_PATH"
+       if test -n "$DEFAULT_HTTPD_PATH" && test -x "$DEFAULT_HTTPD_PATH"
        then
                break
        fi
 done
 
+if test -x "$DEFAULT_HTTPD_PATH"
+then
+       DETECTED_HTTPD_ROOT="$("$DEFAULT_HTTPD_PATH" -V 2>/dev/null | sed -n 's/^ -D HTTPD_ROOT="\(.*\)"$/\1/p')"
+fi
+
 for DEFAULT_HTTPD_MODULE_PATH in '/usr/libexec/apache2' \
                                 '/usr/lib/apache2/modules' \
                                 '/usr/lib64/httpd/modules' \
                                 '/usr/lib/httpd/modules' \
-                                '/usr/libexec/httpd'
+                                '/usr/libexec/httpd' \
+                                '/usr/lib/apache2' \
+                                "${DETECTED_HTTPD_ROOT:+${DETECTED_HTTPD_ROOT}/modules}"
 do
-       if test -d "$DEFAULT_HTTPD_MODULE_PATH"
+       if test -n "$DEFAULT_HTTPD_MODULE_PATH" && test -d "$DEFAULT_HTTPD_MODULE_PATH"
        then
                break
        fi
@@ -127,6 +137,20 @@ else
                "Could not identify web server at '$LIB_HTTPD_PATH'"
 fi
 
+if test -n "$LIB_HTTPD_DAV" && test -f /etc/os-release
+then
+       case "$(grep "^ID=" /etc/os-release | cut -d= -f2-)" in
+       alpine)
+               # The WebDAV module in Alpine Linux is broken at least up to
+               # Alpine v3.16 as the default DBM driver is missing.
+               #
+               # https://gitlab.alpinelinux.org/alpine/aports/-/issues/13112
+               test_skip_or_die GIT_TEST_HTTPD \
+                       "Apache WebDAV module does not have default DBM backend driver"
+               ;;
+       esac
+fi
+
 install_script () {
        write_script "$HTTPD_ROOT_PATH/$1" <"$TEST_PATH/$1"
 }
@@ -255,7 +279,7 @@ test_http_push_nonff () {
        '
 
        test_expect_success 'non-fast-forward push shows help message' '
-               test_i18ngrep "Updates were rejected because" output
+               test_grep "Updates were rejected because" output
        '
 
        test_expect_${EXPECT_CAS_RESULT} 'force with lease aka cas' '
index a22d1386052b40334ddec013ec230af6655fb086..022276a6b9ace5565211327053f9900ff4a1fb06 100644 (file)
@@ -92,6 +92,7 @@ PassEnv GIT_VALGRIND_OPTIONS
 PassEnv GNUPGHOME
 PassEnv ASAN_OPTIONS
 PassEnv LSAN_OPTIONS
+PassEnv UBSAN_OPTIONS
 PassEnv GIT_TRACE
 PassEnv GIT_CONFIG_NOSYSTEM
 PassEnv GIT_TEST_SIDEBAND_ALL
index 99a34d648742f669e7b501298a92fab401bc1971..d9c122f34828919da09284529b9e5a70b4ffeec1 100644 (file)
@@ -1 +1 @@
-user@host:xb4E8pqD81KQs
+user@host:$apr1$LGPmCZWj$9vxEwj5Z5GzQLBMxp3mCx1
index 77c25138e074005dbfd21fc726f230be615cd27f..2ad7705d9a3946f92487a8553526af945ce0bc71 100644 (file)
@@ -1 +1 @@
-proxuser:2x7tAukjAED5M
+proxuser:$apr1$RxS6MLkD$DYsqQdflheq4GPNxzJpx5.
index 7ca5b918f0445cbb3097e531883861f5574e29a1..11d2dc9fe341b61d22c467ea8ae6a9d13ff1ac18 100644 (file)
@@ -8,18 +8,21 @@
 # - check that non-commit messages have a certain line count with $EXPECT_COUNT
 # - check the commit count in the commit message header with $EXPECT_HEADER_COUNT
 # - rewrite a rebase -i script as directed by $FAKE_LINES.
-#   $FAKE_LINES consists of a sequence of words separated by spaces.
-#   The following word combinations are possible:
+#   $FAKE_LINES consists of a sequence of words separated by spaces;
+#   spaces inside the words are encoded as underscores.
+#   The following words are possible:
 #
-#   "<lineno>" -- add a "pick" line with the SHA1 taken from the
-#       specified line.
+#   "<cmd>" -- override the command for the next line specification. Can be
+#       "pick", "squash", "fixup[_-(c|C)]", "edit", "reword", "drop",
+#       "merge[_-(c|C)_<rev>]", or "bad" for an invalid command.
 #
-#   "<cmd> <lineno>" -- add a line with the specified command
-#       ("pick", "squash", "fixup"|"fixup_-C"|"fixup_-c", "edit", "reword" or "drop")
-#       and the SHA1 taken from the specified line.
+#   "<lineno>" -- add a command, using the specified line as a template.
+#       If the command has not been overridden, the line will be copied
+#       verbatim, usually resulting in a "pick" line.
 #
-#   "_" -- add a space, like "fixup_-C" implies "fixup -C" and
-#       "exec_cmd_with_args" add an "exec cmd with args" line.
+#   "fakesha" -- add a command ("pick" by default), using a fake SHA1.
+#
+#   "exec_[command...]", "break" -- add the specified command.
 #
 #   "#" -- Add a comment line.
 #
@@ -49,7 +52,7 @@ set_fake_editor () {
        action=\&
        for line in $FAKE_LINES; do
                case $line in
-               pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d|label|l|reset|r|merge|m)
+               pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d|label|l|reset|t|merge|m)
                        action="$line";;
                exec_*|x_*|break|b)
                        echo "$line" | sed 's/_/ /g' >> "$1";;
@@ -64,7 +67,7 @@ set_fake_editor () {
                fakesha)
                        test \& != "$action" || action=pick
                        echo "$action XXXXXXX False commit" >> "$1"
-                       action=pick;;
+                       action=\&;;
                *)
                        sed -n "${line}s/^[a-z][a-z]*/$action/p" < "$1".tmp >> "$1"
                        action=\&;;
index 9acb0d5d19d2ec44827856a7496a2f785c537e02..36f767cb7488bff81696f985e3614a5fffcda495 100644 (file)
@@ -830,7 +830,7 @@ test_submodule_recursing_with_args_common () {
                        cd submodule_update &&
                        git branch -t invalid_sub1 origin/invalid_sub1 &&
                        test_must_fail $command invalid_sub1 2>err &&
-                       test_i18ngrep sub1 err &&
+                       test_grep sub1 err &&
                        test_superproject_content origin/add_sub1 &&
                        test_submodule_content sub1 origin/add_sub1
                )
index 96ed3e1d69881541c82bdaf8c7f6b6fd8af97ef5..39e92b0841437bee9cbd939de6e216fae81a7ff2 100755 (executable)
@@ -134,5 +134,6 @@ test_perf_on_all git diff-files -- $SPARSE_CONE/a
 test_perf_on_all git diff-tree HEAD
 test_perf_on_all git diff-tree HEAD -- $SPARSE_CONE/a
 test_perf_on_all "git worktree add ../temp && git worktree remove ../temp"
+test_perf_on_all git check-attr -a -- $SPARSE_CONE/a
 
 test_done
diff --git a/t/perf/p5332-multi-pack-reuse.sh b/t/perf/p5332-multi-pack-reuse.sh
new file mode 100755 (executable)
index 0000000..5c6c575
--- /dev/null
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+test_description='tests pack performance with multi-pack reuse'
+
+. ./perf-lib.sh
+. "${TEST_DIRECTORY}/perf/lib-pack.sh"
+
+packdir=.git/objects/pack
+
+test_perf_large_repo
+
+find_pack () {
+       for idx in $packdir/pack-*.idx
+       do
+               if git show-index <$idx | grep -q "$1"
+               then
+                       basename $idx
+               fi || return 1
+       done
+}
+
+repack_into_n_chunks () {
+       git repack -adk &&
+
+       test "$1" -eq 1 && return ||
+
+       find $packdir -type f | sort >packs.before &&
+
+       # partition the repository into $1 chunks of consecutive commits, and
+       # then create $1 packs with the objects reachable from each chunk
+       # (excluding any objects reachable from the previous chunks)
+       sz="$(($(git rev-list --count --all) / $1))"
+       for rev in $(git rev-list --all | awk "NR % $sz == 0" | tac)
+       do
+               pack="$(echo "$rev" | git pack-objects --revs \
+                       --honor-pack-keep --delta-base-offset $packdir/pack)" &&
+               touch $packdir/pack-$pack.keep || return 1
+       done
+
+       # grab any remaining objects not packed by the previous step(s)
+       git pack-objects --revs --all --honor-pack-keep --delta-base-offset \
+               $packdir/pack &&
+
+       find $packdir -type f | sort >packs.after &&
+
+       # and install the whole thing
+       for f in $(comm -12 packs.before packs.after)
+       do
+               rm -f "$f" || return 1
+       done
+       rm -fr $packdir/*.keep
+}
+
+for nr_packs in 1 10 100
+do
+       test_expect_success "create $nr_packs-pack scenario" '
+               repack_into_n_chunks $nr_packs
+       '
+
+       test_expect_success "setup bitmaps for $nr_packs-pack scenario" '
+               find $packdir -type f -name "*.idx" | sed -e "s/.*\/\(.*\)$/+\1/g" |
+               git multi-pack-index write --stdin-packs --bitmap \
+                       --preferred-pack="$(find_pack $(git rev-parse HEAD))"
+       '
+
+       for reuse in single multi
+       do
+               test_perf "clone for $nr_packs-pack scenario ($reuse-pack reuse)" "
+                       git for-each-ref --format='%(objectname)' refs/heads refs/tags >in &&
+                       git -c pack.allowPackReuse=$reuse pack-objects \
+                               --revs --delta-base-offset --use-bitmap-index \
+                               --stdout <in >result
+               "
+
+               test_size "clone size for $nr_packs-pack scenario ($reuse-pack reuse)" '
+                       wc -c <result
+               '
+       done
+done
+
+test_done
diff --git a/t/perf/p6300-for-each-ref.sh b/t/perf/p6300-for-each-ref.sh
new file mode 100755 (executable)
index 0000000..fa7289c
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+test_description='performance of for-each-ref'
+. ./perf-lib.sh
+
+test_perf_fresh_repo
+
+ref_count_per_type=10000
+test_iteration_count=10
+
+test_expect_success "setup" '
+       test_commit_bulk $(( 1 + $ref_count_per_type )) &&
+
+       # Create refs
+       test_seq $ref_count_per_type |
+               sed "s,.*,update refs/heads/branch_& HEAD~&\nupdate refs/custom/special_& HEAD~&," |
+               git update-ref --stdin &&
+
+       # Create annotated tags
+       for i in $(test_seq $ref_count_per_type)
+       do
+               # Base tags
+               echo "tag tag_$i" &&
+               echo "mark :$i" &&
+               echo "from HEAD~$i" &&
+               printf "tagger %s <%s> %s\n" \
+                       "$GIT_COMMITTER_NAME" \
+                       "$GIT_COMMITTER_EMAIL" \
+                       "$GIT_COMMITTER_DATE" &&
+               echo "data <<EOF" &&
+               echo "tag $i" &&
+               echo "EOF" &&
+
+               # Nested tags
+               echo "tag nested_$i" &&
+               echo "from :$i" &&
+               printf "tagger %s <%s> %s\n" \
+                       "$GIT_COMMITTER_NAME" \
+                       "$GIT_COMMITTER_EMAIL" \
+                       "$GIT_COMMITTER_DATE" &&
+               echo "data <<EOF" &&
+               echo "nested tag $i" &&
+               echo "EOF" || return 1
+       done | git fast-import
+'
+
+test_for_each_ref () {
+       title="for-each-ref"
+       if test $# -gt 0; then
+               title="$title ($1)"
+               shift
+       fi
+       args="$@"
+
+       test_perf "$title" "
+               for i in \$(test_seq $test_iteration_count); do
+                       git for-each-ref $args >/dev/null
+               done
+       "
+}
+
+run_tests () {
+       test_for_each_ref "$1"
+       test_for_each_ref "$1, no sort" --no-sort
+       test_for_each_ref "$1, --count=1" --count=1
+       test_for_each_ref "$1, --count=1, no sort" --no-sort --count=1
+       test_for_each_ref "$1, tags" refs/tags/
+       test_for_each_ref "$1, tags, no sort" --no-sort refs/tags/
+       test_for_each_ref "$1, tags, dereferenced" '--format="%(refname) %(objectname) %(*objectname)"' refs/tags/
+       test_for_each_ref "$1, tags, dereferenced, no sort" --no-sort '--format="%(refname) %(objectname) %(*objectname)"' refs/tags/
+
+       test_perf "for-each-ref ($1, tags) + cat-file --batch-check (dereferenced)" "
+               for i in \$(test_seq $test_iteration_count); do
+                       git for-each-ref --format='%(objectname)^{} %(refname) %(objectname)' refs/tags/ | \
+                               git cat-file --batch-check='%(objectname) %(rest)' >/dev/null
+               done
+       "
+}
+
+run_tests "loose"
+
+test_expect_success 'pack refs' '
+       git pack-refs --all
+'
+run_tests "packed"
+
+test_done
index e7786775a9016151e063335047256bfea93d2f63..ab0c7634119282e6b2914f3ea50064b4daa92574 100644 (file)
@@ -15,7 +15,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 
 # These variables must be set before the inclusion of test-lib.sh below,
 # because it will change our working directory.
@@ -31,7 +31,7 @@ unset GIT_CONFIG_NOSYSTEM
 GIT_CONFIG_SYSTEM="$TEST_DIRECTORY/perf/config"
 export GIT_CONFIG_SYSTEM
 
-if test -n "$GIT_TEST_INSTALLED" -a -z "$PERF_SET_GIT_TEST_INSTALLED"
+if test -n "$GIT_TEST_INSTALLED" && test -z "$PERF_SET_GIT_TEST_INSTALLED"
 then
        error "Do not use GIT_TEST_INSTALLED with the perf tests.
 
index fcfc992b5b02e885fb3b8c337dfdc41d986a9052..412e4b450b16fbd63300e70faf026593fc073f57 100755 (executable)
@@ -33,7 +33,7 @@ do
 done
 
 git ls-tree -r HEAD >GEN_src_list
-nr_src_files=$(cat GEN_src_list | wc -l)
+nr_src_files=$(wc -l <GEN_src_list)
 
 src_branch=$(git symbolic-ref --short HEAD)
 
index 34115edec356831d4863a3ca891be0d885bf46fc..486ead21980ec27de640745fe2b67fe869a08b4c 100755 (executable)
@@ -91,10 +91,10 @@ set_git_test_installed () {
 run_dirs_helper () {
        mydir=${1%/}
        shift
-       while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
+       while test $# -gt 0 && test "$1" != -- && test ! -f "$1"; do
                shift
        done
-       if test $# -gt 0 -a "$1" = --; then
+       if test $# -gt 0 && test "$1" = --; then
                shift
        fi
 
@@ -124,7 +124,7 @@ run_dirs_helper () {
 }
 
 run_dirs () {
-       while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
+       while test $# -gt 0 && test "$1" != -- && test ! -f "$1"; do
                run_dirs_helper "$@"
                shift
        done
@@ -180,7 +180,8 @@ run_subsection () {
        GIT_PERF_AGGREGATING_LATER=t
        export GIT_PERF_AGGREGATING_LATER
 
-       if test $# = 0 -o "$1" = -- -o -f "$1"; then
+       if test $# = 0 || test "$1" = -- || test -f "$1"
+       then
                set -- . "$@"
        fi
 
index 30a6edca1d29fcef63cfc155685600c63553f636..b131d665db40e9858d4a3f9c13ab71eb77d6cc5f 100755 (executable)
@@ -168,8 +168,8 @@ test_expect_success 'reinit' '
                git -c init.defaultBranch=initial init >out1 2>err1 &&
                git init >out2 2>err2
        ) &&
-       test_i18ngrep "Initialized empty" again/out1 &&
-       test_i18ngrep "Reinitialized existing" again/out2 &&
+       test_grep "Initialized empty" again/out1 &&
+       test_grep "Reinitialized existing" again/out2 &&
        test_must_be_empty again/err1 &&
        test_must_be_empty again/err2
 '
@@ -332,7 +332,7 @@ test_expect_success 'init with separate gitdir' '
 
 test_expect_success 'explicit bare & --separate-git-dir incompatible' '
        test_must_fail git init --bare --separate-git-dir goop.git bare.git 2>err &&
-       test_i18ngrep "cannot be used together" err
+       test_grep "cannot be used together" err
 '
 
 test_expect_success 'implicit bare & --separate-git-dir incompatible' '
@@ -340,7 +340,7 @@ test_expect_success 'implicit bare & --separate-git-dir incompatible' '
        mkdir -p bare.git &&
        test_must_fail env GIT_DIR=. \
                git -C bare.git init --separate-git-dir goop.git 2>err &&
-       test_i18ngrep "incompatible" err
+       test_grep "incompatible" err
 '
 
 test_expect_success 'bare & --separate-git-dir incompatible within worktree' '
@@ -349,7 +349,7 @@ test_expect_success 'bare & --separate-git-dir incompatible within worktree' '
        git clone --bare . bare.git &&
        git -C bare.git worktree add --detach ../linkwt &&
        test_must_fail git -C linkwt init --separate-git-dir seprepo 2>err &&
-       test_i18ngrep "incompatible" err
+       test_grep "incompatible" err
 '
 
 test_lazy_prereq GETCWD_IGNORES_PERMS '
@@ -532,6 +532,76 @@ test_expect_success 'init rejects attempts to initialize with different hash' '
        test_must_fail git -C sha256 init --object-format=sha1
 '
 
+test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage is not allowed with repo version 0' '
+       test_when_finished "rm -rf refstorage" &&
+       git init refstorage &&
+       git -C refstorage config extensions.refStorage files &&
+       test_must_fail git -C refstorage rev-parse 2>err &&
+       grep "repo version is 0, but v1-only extension found" err
+'
+
+test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with files backend' '
+       test_when_finished "rm -rf refstorage" &&
+       git init refstorage &&
+       git -C refstorage config core.repositoryformatversion 1 &&
+       git -C refstorage config extensions.refStorage files &&
+       test_commit -C refstorage A &&
+       git -C refstorage rev-parse --verify HEAD
+'
+
+test_expect_success DEFAULT_REPO_FORMAT 'extensions.refStorage with unknown backend' '
+       test_when_finished "rm -rf refstorage" &&
+       git init refstorage &&
+       git -C refstorage config core.repositoryformatversion 1 &&
+       git -C refstorage config extensions.refStorage garbage &&
+       test_must_fail git -C refstorage rev-parse 2>err &&
+       grep "invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}garbage${SQ}" err
+'
+
+test_expect_success DEFAULT_REPO_FORMAT 'init with GIT_DEFAULT_REF_FORMAT=files' '
+       test_when_finished "rm -rf refformat" &&
+       GIT_DEFAULT_REF_FORMAT=files git init refformat &&
+       echo 0 >expect &&
+       git -C refformat config core.repositoryformatversion >actual &&
+       test_cmp expect actual &&
+       test_must_fail git -C refformat config extensions.refstorage
+'
+
+test_expect_success 'init with GIT_DEFAULT_REF_FORMAT=garbage' '
+       test_when_finished "rm -rf refformat" &&
+       cat >expect <<-EOF &&
+       fatal: unknown ref storage format ${SQ}garbage${SQ}
+       EOF
+       test_must_fail env GIT_DEFAULT_REF_FORMAT=garbage git init refformat 2>err &&
+       test_cmp expect err
+'
+
+test_expect_success 'init with --ref-format=files' '
+       test_when_finished "rm -rf refformat" &&
+       git init --ref-format=files refformat &&
+       echo files >expect &&
+       git -C refformat rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 're-init with same format' '
+       test_when_finished "rm -rf refformat" &&
+       git init --ref-format=files refformat &&
+       git init --ref-format=files refformat &&
+       echo files >expect &&
+       git -C refformat rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'init with --ref-format=garbage' '
+       test_when_finished "rm -rf refformat" &&
+       cat >expect <<-EOF &&
+       fatal: unknown ref storage format ${SQ}garbage${SQ}
+       EOF
+       test_must_fail git init --ref-format=garbage refformat 2>err &&
+       test_cmp expect err
+'
+
 test_expect_success MINGW 'core.hidedotfiles = false' '
        git config --global core.hidedotfiles false &&
        rm -rf newdir &&
@@ -563,7 +633,7 @@ test_expect_success '--initial-branch' '
 
        : re-initializing should not change the branch name &&
        git init --initial-branch=ignore initial-branch-option 2>err &&
-       test_i18ngrep "ignored --initial-branch" err &&
+       test_grep "ignored --initial-branch" err &&
        git -C initial-branch-option symbolic-ref HEAD >actual &&
        grep hello actual
 '
@@ -579,7 +649,7 @@ test_expect_success 'advice on unconfigured init.defaultBranch' '
        GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= git -c color.advice=always \
                init unconfigured-default-branch-name 2>err &&
        test_decode_color <err >decoded &&
-       test_i18ngrep "<YELLOW>hint: " decoded
+       test_grep "<YELLOW>hint: " decoded
 '
 
 test_expect_success 'overridden default main branch name (env)' '
@@ -592,7 +662,7 @@ test_expect_success 'overridden default main branch name (env)' '
 test_expect_success 'invalid default branch name' '
        test_must_fail env GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME="with space" \
                git init initial-branch-invalid 2>err &&
-       test_i18ngrep "invalid branch name" err
+       test_grep "invalid branch name" err
 '
 
 test_expect_success 'branch -m with the initial branch' '
index e013d38f485cc8b06c1afb51579ed6a4d322dfaa..bf3bf604abe3470f19cc5a10e5c88c905cb28329 100755 (executable)
@@ -22,13 +22,13 @@ test_expect_success 'initial setup' '
 test_expect_success 'bad setup: invalid .git file format' '
        echo "gitdir $REAL" >.git &&
        test_must_fail git rev-parse 2>.err &&
-       test_i18ngrep "invalid gitfile format" .err
+       test_grep "invalid gitfile format" .err
 '
 
 test_expect_success 'bad setup: invalid .git file path' '
        echo "gitdir: $REAL.not" >.git &&
        test_must_fail git rev-parse 2>.err &&
-       test_i18ngrep "not a git repository" .err
+       test_grep "not a git repository" .err
 '
 
 test_expect_success 'final setup + check rev-parse --git-dir' '
@@ -40,7 +40,7 @@ test_expect_success 'final setup + check rev-parse --git-dir' '
 
 test_expect_success 'check hash-object' '
        echo "foo" >bar &&
-       SHA=$(cat bar | git hash-object -w --stdin) &&
+       SHA=$(git hash-object -w --stdin <bar) &&
        test_path_is_file "$REAL/objects/$(objpath $SHA)"
 '
 
index 26e082f05b4473a553b4de9b7747b928179439cd..774b52c2980ca10e6183cf74ad10427f00c2514b 100755 (executable)
@@ -19,6 +19,20 @@ attr_check () {
        test_must_be_empty err
 }
 
+attr_check_object_mode_basic () {
+       path="$1" &&
+       expect="$2" &&
+       check_opts="$3" &&
+       git check-attr $check_opts builtin_objectmode -- "$path" >actual 2>err &&
+       echo "$path: builtin_objectmode: $expect" >expect &&
+       test_cmp expect actual
+}
+
+attr_check_object_mode () {
+       attr_check_object_mode_basic "$@" &&
+       test_must_be_empty err
+}
+
 attr_check_quote () {
        path="$1" quoted_path="$2" expect="$3" &&
 
@@ -40,6 +54,10 @@ attr_check_source () {
        test_cmp expect actual &&
        test_must_be_empty err
 
+       git $git_opts -c "attr.tree=$source" check-attr test -- "$path" >actual 2>err &&
+       test_cmp expect actual &&
+       test_must_be_empty err
+
        GIT_ATTR_SOURCE="$source" git $git_opts check-attr test -- "$path" >actual 2>err &&
        test_cmp expect actual &&
        test_must_be_empty err
@@ -259,7 +277,7 @@ test_expect_success 'root subdir attribute test' '
 test_expect_success 'negative patterns' '
        echo "!f test=bar" >.gitattributes &&
        git check-attr test -- '"'"'!f'"'"' 2>errors &&
-       test_i18ngrep "Negative patterns are ignored" errors
+       test_grep "Negative patterns are ignored" errors
 '
 
 test_expect_success 'patterns starting with exclamation' '
@@ -342,6 +360,74 @@ test_expect_success 'bare repository: check that .gitattribute is ignored' '
        )
 '
 
+bad_attr_source_err="fatal: bad --attr-source or GIT_ATTR_SOURCE"
+
+test_expect_success '--attr-source is bad' '
+       test_when_finished rm -rf empty &&
+       git init empty &&
+       (
+               cd empty &&
+               echo "$bad_attr_source_err" >expect_err &&
+               test_must_fail git --attr-source=HEAD check-attr test -- f/path 2>err &&
+               test_cmp expect_err err
+       )
+'
+
+test_expect_success 'attr.tree when HEAD is unborn' '
+       test_when_finished rm -rf empty &&
+       git init empty &&
+       (
+               cd empty &&
+               echo "f/path: test: unspecified" >expect &&
+               git -c attr.tree=HEAD check-attr test -- f/path >actual 2>err &&
+               test_must_be_empty err &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'bad attr source defaults to reading .gitattributes file' '
+       test_when_finished rm -rf empty &&
+       git init empty &&
+       (
+               cd empty &&
+               echo "f/path test=val" >.gitattributes &&
+               echo "f/path: test: val" >expect &&
+               git -c attr.tree=HEAD check-attr test -- f/path >actual 2>err &&
+               test_must_be_empty err &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'bare repo defaults to reading .gitattributes from HEAD' '
+       test_when_finished rm -rf test bare_with_gitattribute &&
+       git init test &&
+       test_commit -C test gitattributes .gitattributes "f/path test=val" &&
+       git clone --bare test bare_with_gitattribute &&
+       echo "f/path: test: val" >expect &&
+       git -C bare_with_gitattribute check-attr test -- f/path >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'precedence of --attr-source, GIT_ATTR_SOURCE, then attr.tree' '
+       test_when_finished rm -rf empty &&
+       git init empty &&
+       (
+               cd empty &&
+               git checkout -b attr-source &&
+               test_commit "val1" .gitattributes "f/path test=val1" &&
+               git checkout -b attr-tree &&
+               test_commit "val2" .gitattributes "f/path test=val2" &&
+               git checkout attr-source &&
+               echo "f/path: test: val1" >expect &&
+               GIT_ATTR_SOURCE=attr-source git -c attr.tree=attr-tree --attr-source=attr-source \
+               check-attr test -- f/path >actual &&
+               test_cmp expect actual &&
+               GIT_ATTR_SOURCE=attr-source git -c attr.tree=attr-tree \
+               check-attr test -- f/path >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_expect_success 'bare repository: with --source' '
        (
                cd bare.git &&
@@ -424,7 +510,7 @@ test_expect_success SYMLINKS 'symlinks not respected in-tree' '
        mkdir subdir &&
        ln -s ../attr subdir/.gitattributes &&
        attr_check_basic subdir/file unspecified &&
-       test_i18ngrep "unable to access.*gitattributes" err
+       test_grep "unable to access.*gitattributes" err
 '
 
 test_expect_success 'large attributes line ignored in tree' '
@@ -486,4 +572,66 @@ test_expect_success EXPENSIVE 'large attributes file ignored in index' '
        test_cmp expect err
 '
 
+test_expect_success 'builtin object mode attributes work (dir and regular paths)' '
+       >normal &&
+       attr_check_object_mode normal 100644 &&
+       mkdir dir &&
+       attr_check_object_mode dir 040000
+'
+
+test_expect_success POSIXPERM 'builtin object mode attributes work (executable)' '
+       >exec &&
+       chmod +x exec &&
+       attr_check_object_mode exec 100755
+'
+
+test_expect_success SYMLINKS 'builtin object mode attributes work (symlinks)' '
+       ln -s to_sym sym &&
+       attr_check_object_mode sym 120000
+'
+
+test_expect_success 'native object mode attributes work with --cached' '
+       >normal &&
+       git add normal &&
+       empty_blob=$(git rev-parse :normal) &&
+       git update-index --index-info <<-EOF &&
+       100755 $empty_blob 0    exec
+       120000 $empty_blob 0    symlink
+       EOF
+       attr_check_object_mode normal 100644 --cached &&
+       attr_check_object_mode exec 100755 --cached &&
+       attr_check_object_mode symlink 120000 --cached
+'
+
+test_expect_success 'check object mode attributes work for submodules' '
+       mkdir sub &&
+       (
+               cd sub &&
+               git init &&
+               mv .git .real &&
+               echo "gitdir: .real" >.git &&
+               test_commit first
+       ) &&
+       attr_check_object_mode sub 160000 &&
+       attr_check_object_mode sub unspecified --cached &&
+       git add sub &&
+       attr_check_object_mode sub 160000 --cached
+'
+
+test_expect_success 'we do not allow user defined builtin_* attributes' '
+       echo "foo* builtin_foo" >.gitattributes &&
+       git add .gitattributes 2>actual &&
+       echo "builtin_foo is not a valid attribute name: .gitattributes:1" >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'user defined builtin_objectmode values are ignored' '
+       echo "foo* builtin_objectmode=12345" >.gitattributes &&
+       git add .gitattributes &&
+       >foo_1 &&
+       attr_check_object_mode_basic foo_1 100644 &&
+       echo "builtin_objectmode is not a valid attribute name: .gitattributes:1" >expect &&
+       test_cmp expect err
+'
+
 test_done
index e18b1602864ec432553266e89d3796e94741e8e0..3031256d143b154dc1ff5e55ae46a7ffd4c7cf6d 100755 (executable)
@@ -46,6 +46,7 @@ check_show () {
 TIME='1466000000 +0200'
 check_show iso8601 "$TIME" '2016-06-15 16:13:20 +0200'
 check_show iso8601-strict "$TIME" '2016-06-15T16:13:20+02:00'
+check_show iso8601-strict "$(echo "$TIME" | sed 's/+0200$/+0000/')" '2016-06-15T14:13:20Z'
 check_show rfc2822 "$TIME" 'Wed, 15 Jun 2016 16:13:20 +0200'
 check_show short "$TIME" '2016-06-15'
 check_show default "$TIME" 'Wed Jun 15 16:13:20 2016 +0200'
@@ -69,6 +70,14 @@ check_show 'format:%s' '123456789 +1234' 123456789
 check_show 'format:%s' '123456789 -1234' 123456789
 check_show 'format-local:%s' '123456789 -1234' 123456789
 
+# negative TZ offset
+TIME='1466000000 -0200'
+check_show iso8601 "$TIME" '2016-06-15 12:13:20 -0200'
+check_show iso8601-strict "$TIME" '2016-06-15T12:13:20-02:00'
+check_show rfc2822 "$TIME" 'Wed, 15 Jun 2016 12:13:20 -0200'
+check_show default "$TIME" 'Wed Jun 15 12:13:20 2016 -0200'
+check_show raw "$TIME" '1466000000 -0200'
+
 # arbitrary time absurdly far in the future
 FUTURE="5758122296 -0400"
 check_show iso       "$FUTURE" "2152-06-19 18:24:56 -0400" TIME_IS_64BIT,TIME_T_IS_64BIT
index 8cb597f99c4cead2388681416d3cc0eddd90fa0f..ff4fd9348cca6470f4dbacbc4c9a3d775f15c06d 100755 (executable)
@@ -268,4 +268,13 @@ test_expect_success 'listing and asking for variables are exclusive' '
        test_must_fail git var -l GIT_COMMITTER_IDENT
 '
 
+test_expect_success '`git var -l` works even without HOME' '
+       (
+               XDG_CONFIG_HOME= &&
+               export XDG_CONFIG_HOME &&
+               unset HOME &&
+               git var -l
+       )
+'
+
 test_done
index c70d11bc914d09df5baa8cf74e9a2c292fc861b8..361446b2f4c9ed39cc5d1b9c301751420c0a670d 100755 (executable)
@@ -49,7 +49,7 @@ broken_c_unquote_verbose () {
 
 stderr_contains () {
        regexp="$1"
-       if test_i18ngrep "$regexp" "$HOME/stderr"
+       if test_grep "$regexp" "$HOME/stderr"
        then
                return 0
        else
@@ -942,7 +942,7 @@ test_expect_success SYMLINKS 'symlinks not respected in-tree' '
        ln -s ignore subdir/.gitignore &&
        test_must_fail git check-ignore subdir/file >actual 2>err &&
        test_must_be_empty actual &&
-       test_i18ngrep "unable to access.*gitignore" err
+       test_grep "unable to access.*gitignore" err
 '
 
 test_done
diff --git a/t/t0009-prio-queue.sh b/t/t0009-prio-queue.sh
deleted file mode 100755 (executable)
index eea9910..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-
-test_description='basic tests for priority queue implementation'
-
-TEST_PASSES_SANITIZE_LEAK=true
-. ./test-lib.sh
-
-cat >expect <<'EOF'
-1
-2
-3
-4
-5
-5
-6
-7
-8
-9
-10
-EOF
-test_expect_success 'basic ordering' '
-       test-tool prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
-       test_cmp expect actual
-'
-
-cat >expect <<'EOF'
-2
-3
-4
-1
-5
-6
-EOF
-test_expect_success 'mixed put and get' '
-       test-tool prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
-       test_cmp expect actual
-'
-
-cat >expect <<'EOF'
-1
-2
-NULL
-1
-2
-NULL
-EOF
-test_expect_success 'notice empty queue' '
-       test-tool prio-queue 1 2 get get get 1 2 get get get >actual &&
-       test_cmp expect actual
-'
-
-cat >expect <<'EOF'
-3
-2
-6
-4
-5
-1
-8
-EOF
-test_expect_success 'stack order' '
-       test-tool prio-queue stack 8 1 5 4 6 2 3 dump >actual &&
-       test_cmp expect actual
-'
-
-test_done
index 837c8b7228b98e8e7b3dbfecd5046673554ef464..84172a3739094adc6cdf6496b016fe68e0b2a771 100755 (executable)
@@ -10,25 +10,24 @@ TEST_PASSES_SANITIZE_LEAK=true
 
 for trial in 0 1 2 3 4
 do
-       rm -f .git/index
-       echo frotz >infocom
-       git update-index --add infocom
-       echo xyzzy >infocom
-
-       files=$(git diff-files -p)
-       test_expect_success \
-       "Racy GIT trial #$trial part A" \
-       'test "" != "$files"'
-
+       test_expect_success "Racy git trial #$trial part A" '
+               rm -f .git/index &&
+               echo frotz >infocom &&
+               git update-index --add infocom &&
+               echo xyzzy >infocom &&
+
+               git diff-files -p >out &&
+               test_file_not_empty out
+       '
        sleep 1
-       echo xyzzy >cornerstone
-       git update-index --add cornerstone
 
-       files=$(git diff-files -p)
-       test_expect_success \
-       "Racy GIT trial #$trial part B" \
-       'test "" != "$files"'
+       test_expect_success "Racy git trial #$trial part B" '
+               echo xyzzy >cornerstone &&
+               git update-index --add cornerstone &&
 
+               git diff-files -p >out &&
+               test_file_not_empty out
+       '
 done
 
 test_done
index 1cb6aa6824321656264e427f299899acf0754357..46e74ad1072b1d662297204960d38d823534c208 100755 (executable)
@@ -239,7 +239,7 @@ test_expect_success 'grow / shrink' '
        echo value40 >> expect &&
        echo size >> in &&
        echo 64 39 >> expect &&
-       cat in | test-tool hashmap > out &&
+       test-tool hashmap <in >out &&
        test_cmp expect out
 
 '
index dbfc5c826764bca4ec5561b603d8016f7d50f20d..1d273d91c2125ae2c16ae1a14c628cf23fcecc06 100755 (executable)
@@ -100,17 +100,17 @@ test_expect_success "--help does not work for guides" "
 
 test_expect_success 'git help' '
        git help >help.output &&
-       test_i18ngrep "^   clone  " help.output &&
-       test_i18ngrep "^   add    " help.output &&
-       test_i18ngrep "^   log    " help.output &&
-       test_i18ngrep "^   commit " help.output &&
-       test_i18ngrep "^   fetch  " help.output
+       test_grep "^   clone  " help.output &&
+       test_grep "^   add    " help.output &&
+       test_grep "^   log    " help.output &&
+       test_grep "^   commit " help.output &&
+       test_grep "^   fetch  " help.output
 '
 
 test_expect_success 'git help -g' '
        git help -g >help.output &&
-       test_i18ngrep "^   everyday   " help.output &&
-       test_i18ngrep "^   tutorial   " help.output
+       test_grep "^   everyday   " help.output &&
+       test_grep "^   tutorial   " help.output
 '
 
 test_expect_success 'git help fails for non-existing html pages' '
@@ -257,7 +257,7 @@ do
                        export GIT_CEILING_DIRECTORIES &&
                        test_expect_code 129 git -C sub $builtin -h >output 2>&1
                ) &&
-               test_i18ngrep usage output
+               test_grep usage output
        '
 done <builtins
 
index 53240476896d8e80a969f1b9b448fd01b45fa711..08814173cb111c941c59e2fa764ac271fcbe9dab 100755 (executable)
@@ -16,7 +16,7 @@ fi
 
 test_expect_success 'test-sha1 detects shattered pdf' '
        test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
-       test_i18ngrep collision err &&
+       test_grep collision err &&
        grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
 '
 
index 8d3d9144c06d6129b91d3513c1ec605a3fb4da73..95568342be35f3208d16706ed674d8db5e0932ed 100755 (executable)
@@ -8,7 +8,7 @@ test_expect_success 'nested aliases - internal execution' '
        git config alias.nested-internal-1 nested-internal-2 &&
        git config alias.nested-internal-2 status &&
        git nested-internal-1 >output &&
-       test_i18ngrep "^On branch " output
+       test_grep "^On branch " output
 '
 
 test_expect_success 'nested aliases - mixed execution' '
@@ -16,7 +16,7 @@ test_expect_success 'nested aliases - mixed execution' '
        git config alias.nested-external-2 "!git nested-external-3" &&
        git config alias.nested-external-3 status &&
        git nested-external-1 >output &&
-       test_i18ngrep "^On branch " output
+       test_grep "^On branch " output
 '
 
 test_expect_success 'looping aliases - internal execution' '
@@ -24,7 +24,7 @@ test_expect_success 'looping aliases - internal execution' '
        git config alias.loop-internal-2 loop-internal-3 &&
        git config alias.loop-internal-3 loop-internal-2 &&
        test_must_fail git loop-internal-1 2>output &&
-       test_i18ngrep "^fatal: alias loop detected: expansion of" output
+       test_grep "^fatal: alias loop detected: expansion of" output
 '
 
 # This test is disabled until external loops are fixed, because would block
@@ -34,7 +34,7 @@ test_expect_success 'looping aliases - internal execution' '
 #      git config alias.loop-mixed-1 loop-mixed-2 &&
 #      git config alias.loop-mixed-2 "!git loop-mixed-1" &&
 #      test_must_fail git loop-mixed-1 2>output &&
-#      test_i18ngrep "^fatal: alias loop detected: expansion of" output
+#      test_grep "^fatal: alias loop detected: expansion of" output
 #'
 
 test_expect_success 'run-command formats empty args properly' '
index c13057a4ca3be22e431771fd60d5ab0325349bdc..0dcfb760a2ba922570d12e17cc1ff6297bdab913 100755 (executable)
@@ -17,7 +17,6 @@ test_expect_success 'advice should be printed when config variable is unset' '
 test_expect_success 'advice should be printed when config variable is set to true' '
        cat >expect <<-\EOF &&
        hint: This is a piece of advice
-       hint: Disable this message with "git config advice.nestedTag false"
        EOF
        test_config advice.nestedTag true &&
        test-tool advise "This is a piece of advice" 2>actual &&
index 46abbeed683992672f9dcaa6f9e2b256f1ea02eb..0b4997022bf88a713845f45f67ab55b03992a659 100755 (executable)
@@ -263,7 +263,7 @@ test_expect_success 'required filter with absent clean field' '
 
        echo test >test.ac &&
        test_must_fail git add test.ac 2>stderr &&
-       test_i18ngrep "fatal: test.ac: clean filter .absentclean. failed" stderr
+       test_grep "fatal: test.ac: clean filter .absentclean. failed" stderr
 '
 
 test_expect_success 'required filter with absent smudge field' '
@@ -276,7 +276,7 @@ test_expect_success 'required filter with absent smudge field' '
        git add test.as &&
        rm -f test.as &&
        test_must_fail git checkout -- test.as 2>stderr &&
-       test_i18ngrep "fatal: test.as: smudge filter absentsmudge failed" stderr
+       test_grep "fatal: test.as: smudge filter absentsmudge failed" stderr
 '
 
 test_expect_success 'filtering large input to small output should use little memory' '
@@ -733,7 +733,7 @@ test_expect_success 'process filter should restart after unexpected write failur
                git checkout --quiet --no-progress . 2>git-stderr.log &&
 
                grep "smudge write error" git-stderr.log &&
-               test_i18ngrep "error: external filter" git-stderr.log &&
+               test_grep "error: external filter" git-stderr.log &&
 
                cat >expected.log <<-EOF &&
                        START
index a34de5642073d1323b37b7c82f56edfe798fcfdd..a7f4de4a43ffa022ae56ebf14999cbe81900a4a9 100755 (executable)
@@ -9,7 +9,7 @@ test_expect_success setup '
 
        git config core.autocrlf true &&
 
-       printf "CRLF line ending\r\nAnd another\r\n" > sample &&
+       printf "CRLF line ending\r\nAnd another\r\n" >sample &&
        git add sample &&
 
        test_tick &&
@@ -19,8 +19,9 @@ test_expect_success setup '
 
 test_expect_success 'tar archive' '
 
-       git archive --format=tar HEAD |
-       ( mkdir untarred && cd untarred && "$TAR" -xf - ) &&
+       git archive --format=tar HEAD >test.tar &&
+       mkdir untarred &&
+       "$TAR" xf test.tar -C untarred &&
 
        test_cmp sample untarred/sample
 
@@ -30,7 +31,11 @@ test_expect_success UNZIP 'zip archive' '
 
        git archive --format=zip HEAD >test.zip &&
 
-       ( mkdir unzipped && cd unzipped && "$GIT_UNZIP" ../test.zip ) &&
+       mkdir unzipped &&
+       (
+               cd unzipped &&
+               "$GIT_UNZIP" ../test.zip
+       ) &&
 
        test_cmp sample unzipped/sample
 
index c196fdb0ee21a27b6093902dcafe133abfc98ce0..ad151a346708a5898eb5bdc536131baddafdf987 100755 (executable)
@@ -92,23 +92,23 @@ do
                # In these cases the BOM is prohibited.
                cp bebom.utf${i}be.raw bebom.utf${i}be &&
                test_must_fail git add bebom.utf${i}be 2>err.out &&
-               test_i18ngrep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
-               test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out &&
+               test_grep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
+               test_grep "use UTF-${i} as working-tree-encoding" err.out &&
 
                cp lebom.utf${i}le.raw lebom.utf${i}be &&
                test_must_fail git add lebom.utf${i}be 2>err.out &&
-               test_i18ngrep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
-               test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out &&
+               test_grep "fatal: BOM is prohibited .* utf-${i}be" err.out &&
+               test_grep "use UTF-${i} as working-tree-encoding" err.out &&
 
                cp bebom.utf${i}be.raw bebom.utf${i}le &&
                test_must_fail git add bebom.utf${i}le 2>err.out &&
-               test_i18ngrep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
-               test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out &&
+               test_grep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
+               test_grep "use UTF-${i} as working-tree-encoding" err.out &&
 
                cp lebom.utf${i}le.raw lebom.utf${i}le &&
                test_must_fail git add lebom.utf${i}le 2>err.out &&
-               test_i18ngrep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
-               test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out
+               test_grep "fatal: BOM is prohibited .* utf-${i}LE" err.out &&
+               test_grep "use UTF-${i} as working-tree-encoding" err.out
        '
 
        test_expect_success "check required UTF-${i} BOM" '
@@ -118,21 +118,21 @@ do
 
                cp nobom.utf${i}be.raw nobom.utf${i} &&
                test_must_fail git add nobom.utf${i} 2>err.out &&
-               test_i18ngrep "fatal: BOM is required .* utf-${i}" err.out &&
-               test_i18ngrep "use UTF-${i}BE or UTF-${i}LE" err.out &&
+               test_grep "fatal: BOM is required .* utf-${i}" err.out &&
+               test_grep "use UTF-${i}BE or UTF-${i}LE" err.out &&
 
                cp nobom.utf${i}le.raw nobom.utf${i} &&
                test_must_fail git add nobom.utf${i} 2>err.out &&
-               test_i18ngrep "fatal: BOM is required .* utf-${i}" err.out &&
-               test_i18ngrep "use UTF-${i}BE or UTF-${i}LE" err.out
+               test_grep "fatal: BOM is required .* utf-${i}" err.out &&
+               test_grep "use UTF-${i}BE or UTF-${i}LE" err.out
        '
 
        test_expect_success "eol conversion for UTF-${i} encoded files on checkout" '
                test_when_finished "rm -f crlf.utf${i}.raw lf.utf${i}.raw" &&
                test_when_finished "git reset --hard HEAD^" &&
 
-               cat lf.utf8.raw | write_utf${i} >lf.utf${i}.raw &&
-               cat crlf.utf8.raw | write_utf${i} >crlf.utf${i}.raw &&
+               write_utf${i} <lf.utf8.raw >lf.utf${i}.raw &&
+               write_utf${i} <crlf.utf8.raw >crlf.utf${i}.raw &&
                cp crlf.utf${i}.raw eol.utf${i} &&
 
                cat >expectIndexLF <<-EOF &&
@@ -169,7 +169,7 @@ test_expect_success 'check unsupported encodings' '
        echo "*.set text working-tree-encoding" >.gitattributes &&
        printf "set" >t.set &&
        test_must_fail git add t.set 2>err.out &&
-       test_i18ngrep "true/false are no valid working-tree-encodings" err.out &&
+       test_grep "true/false are no valid working-tree-encodings" err.out &&
 
        echo "*.unset text -working-tree-encoding" >.gitattributes &&
        printf "unset" >t.unset &&
@@ -182,7 +182,7 @@ test_expect_success 'check unsupported encodings' '
        echo "*.garbage text working-tree-encoding=garbage" >.gitattributes &&
        printf "garbage" >t.garbage &&
        test_must_fail git add t.garbage 2>err.out &&
-       test_i18ngrep "failed to encode" err.out
+       test_grep "failed to encode" err.out
 '
 
 test_expect_success 'error if encoding round trip is not the same during refresh' '
@@ -201,7 +201,7 @@ test_expect_success 'error if encoding round trip is not the same during refresh
        git update-ref refs/heads/main $COMMIT &&
 
        test_must_fail git checkout HEAD^ 2>err.out &&
-       test_i18ngrep "error: .* overwritten by checkout:" err.out
+       test_grep "error: .* overwritten by checkout:" err.out
 '
 
 test_expect_success 'error if encoding garbage is already in Git' '
@@ -217,7 +217,7 @@ test_expect_success 'error if encoding garbage is already in Git' '
        git update-ref refs/heads/main $COMMIT &&
 
        git diff 2>err.out &&
-       test_i18ngrep "error: BOM is required" err.out
+       test_grep "error: BOM is required" err.out
 '
 
 test_lazy_prereq ICONV_SHIFT_JIS '
index 038b8b788d7dea688c2efa807e1d1856b8f33c13..d3cb2a1cb9edb8f9ad7480be6ec3e02b464046bd 100755 (executable)
@@ -29,9 +29,20 @@ expect_rejected () {
        grep -F "implicit-bare-repository:$pwd" "$pwd/trace.perf"
 }
 
-test_expect_success 'setup bare repo in worktree' '
+test_expect_success 'setup an embedded bare repo, secondary worktree and submodule' '
        git init outer-repo &&
-       git init --bare outer-repo/bare-repo
+       git init --bare --initial-branch=main outer-repo/bare-repo &&
+       git -C outer-repo worktree add ../outer-secondary &&
+       test_path_is_dir outer-secondary &&
+       (
+               cd outer-repo &&
+               test_commit A &&
+               git push bare-repo +HEAD:refs/heads/main &&
+               git -c protocol.file.allow=always \
+                       submodule add --name subn -- ./bare-repo subd
+       ) &&
+       test_path_is_dir outer-repo/.git/worktrees/outer-secondary &&
+       test_path_is_dir outer-repo/.git/modules/subn
 '
 
 test_expect_success 'safe.bareRepository unset' '
@@ -53,8 +64,7 @@ test_expect_success 'safe.bareRepository in the repository' '
        # safe.bareRepository must not be "explicit", otherwise
        # git config fails with "fatal: not in a git directory" (like
        # safe.directory)
-       test_config -C outer-repo/bare-repo safe.bareRepository \
-               all &&
+       test_config -C outer-repo/bare-repo safe.bareRepository all &&
        test_config_global safe.bareRepository explicit &&
        expect_rejected -C outer-repo/bare-repo
 '
@@ -78,4 +88,20 @@ test_expect_success 'no trace when GIT_DIR is explicitly provided' '
        expect_accepted_explicit "$pwd/outer-repo/bare-repo"
 '
 
+test_expect_success 'no trace when "bare repository" is .git' '
+       expect_accepted_implicit -C outer-repo/.git
+'
+
+test_expect_success 'no trace when "bare repository" is a subdir of .git' '
+       expect_accepted_implicit -C outer-repo/.git/objects
+'
+
+test_expect_success 'no trace in $GIT_DIR of secondary worktree' '
+       expect_accepted_implicit -C outer-repo/.git/worktrees/outer-secondary
+'
+
+test_expect_success 'no trace in $GIT_DIR of a submodule' '
+       expect_accepted_implicit -C outer-repo/.git/modules/subn
+'
+
 test_done
index e19a19963697a08255bb1b933631cdc90d57340d..8bb2a8b453ce0bd6ce1960542e21d3bcd74567e0 100755 (executable)
@@ -13,30 +13,36 @@ usage: test-tool parse-options <options>
 
     A helper function for the parse-options API.
 
-    --yes                 get a boolean
+    --[no-]yes            get a boolean
     -D, --no-doubt        begins with 'no-'
+    --doubt               opposite of --no-doubt
     -B, --no-fear         be brave
-    -b, --boolean         increment by one
-    -4, --or4             bitwise-or boolean with ...0100
-    --neg-or4             same as --no-or4
+    -b, --[no-]boolean    increment by one
+    -4, --[no-]or4        bitwise-or boolean with ...0100
+    --[no-]neg-or4        same as --no-or4
 
-    -i, --integer <n>     get a integer
+    -i, --[no-]integer <n>
+                          get a integer
     -j <n>                get a integer, too
     -m, --magnitude <n>   get a magnitude
-    --set23               set integer to 23
+    --[no-]set23          set integer to 23
     --mode1               set integer to 1 (cmdmode option)
     --mode2               set integer to 2 (cmdmode option)
-    -L, --length <str>    get length of <str>
-    -F, --file <file>     set file to <file>
+    --[no-]mode34 (3|4)   set integer to 3 or 4 (cmdmode option)
+    -L, --[no-]length <str>
+                          get length of <str>
+    -F, --[no-]file <file>
+                          set file to <file>
 
 String options
-    -s, --string <string> get a string
-    --string2 <str>       get another string
-    --st <st>             get another string (pervert ordering)
+    -s, --[no-]string <string>
+                          get a string
+    --[no-]string2 <str>  get another string
+    --[no-]st <st>        get another string (pervert ordering)
     -o <str>              get another string
     --longhelp            help text of this entry
                           spans multiple lines
-    --list <str>          add str to list
+    --[no-]list <str>     add str to list
 
 Magic arguments
     -NUM                  set integer to NUM
@@ -45,16 +51,17 @@ Magic arguments
     --no-ambiguous        negative ambiguity
 
 Standard options
-    --abbrev[=<n>]        use <n> digits to display object names
-    -v, --verbose         be verbose
-    -n, --dry-run         dry run
-    -q, --quiet           be quiet
-    --expect <string>     expected output in the variable dump
+    --[no-]abbrev[=<n>]   use <n> digits to display object names
+    -v, --[no-]verbose    be verbose
+    -n, --[no-]dry-run    dry run
+    -q, --[no-]quiet      be quiet
+    --[no-]expect <string>
+                          expected output in the variable dump
 
 Alias
-    -A, --alias-source <string>
+    -A, --[no-]alias-source <string>
                           get a string
-    -Z, --alias-target <string>
+    -Z, --[no-]alias-target <string>
                           alias of --alias-source
 
 EOF
@@ -203,6 +210,22 @@ test_expect_success 'superfluous value provided: boolean' '
        test_cmp expect actual
 '
 
+test_expect_success 'superfluous value provided: boolean, abbreviated' '
+       cat >expect <<-\EOF &&
+       error: option `yes'\'' takes no value
+       EOF
+       test_expect_code 129 env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \
+       test-tool parse-options --ye=hi 2>actual &&
+       test_cmp expect actual &&
+
+       cat >expect <<-\EOF &&
+       error: option `no-yes'\'' takes no value
+       EOF
+       test_expect_code 129 env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \
+       test-tool parse-options --no-ye=hi 2>actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'superfluous value provided: cmdmode' '
        cat >expect <<-\EOF &&
        error: option `mode1'\'' takes no value
@@ -360,19 +383,41 @@ test_expect_success 'OPT_NEGBIT() works' '
 '
 
 test_expect_success 'OPT_CMDMODE() works' '
-       test-tool parse-options --expect="integer: 1" --mode1
+       test-tool parse-options --expect="integer: 1" --mode1 &&
+       test-tool parse-options --expect="integer: 3" --mode34=3
 '
 
-test_expect_success 'OPT_CMDMODE() detects incompatibility' '
+test_expect_success 'OPT_CMDMODE() detects incompatibility (1)' '
        test_must_fail test-tool parse-options --mode1 --mode2 >output 2>output.err &&
        test_must_be_empty output &&
-       test_i18ngrep "incompatible with --mode" output.err
+       test_grep "mode1" output.err &&
+       test_grep "mode2" output.err &&
+       test_grep "cannot be used together" output.err
 '
 
-test_expect_success 'OPT_CMDMODE() detects incompatibility with something else' '
+test_expect_success 'OPT_CMDMODE() detects incompatibility (2)' '
        test_must_fail test-tool parse-options --set23 --mode2 >output 2>output.err &&
        test_must_be_empty output &&
-       test_i18ngrep "incompatible with something else" output.err
+       test_grep "mode2" output.err &&
+       test_grep "set23" output.err &&
+       test_grep "cannot be used together" output.err
+'
+
+test_expect_success 'OPT_CMDMODE() detects incompatibility (3)' '
+       test_must_fail test-tool parse-options --mode2 --set23 >output 2>output.err &&
+       test_must_be_empty output &&
+       test_grep "mode2" output.err &&
+       test_grep "set23" output.err &&
+       test_grep "cannot be used together" output.err
+'
+
+test_expect_success 'OPT_CMDMODE() detects incompatibility (4)' '
+       test_must_fail test-tool parse-options --mode2 --mode34=3 \
+               >output 2>output.err &&
+       test_must_be_empty output &&
+       test_grep "mode2" output.err &&
+       test_grep "mode34.3" output.err &&
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
index 9ea974b0c6c68a247ddd3f1b7cae806a4c79fbc4..1464294bd1bfc36d48f06a3ead7826daeb9a745c 100755 (executable)
@@ -21,8 +21,8 @@ test_expect_success 'tag --contains <existent_tag>' '
 test_expect_success 'tag --contains <inexistent_tag>' '
        test_must_fail git tag --contains "notag" >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "error" actual.err &&
-       test_i18ngrep ! "usage" actual.err
+       test_grep "error" actual.err &&
+       test_grep ! "usage" actual.err
 '
 
 test_expect_success 'tag --no-contains <existent_tag>' '
@@ -34,27 +34,27 @@ test_expect_success 'tag --no-contains <existent_tag>' '
 test_expect_success 'tag --no-contains <inexistent_tag>' '
        test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "error" actual.err &&
-       test_i18ngrep ! "usage" actual.err
+       test_grep "error" actual.err &&
+       test_grep ! "usage" actual.err
 '
 
 test_expect_success 'tag usage error' '
        test_must_fail git tag --noopt >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "usage" actual.err
+       test_grep "usage" actual.err
 '
 
 test_expect_success 'branch --contains <existent_commit>' '
        git branch --contains "main" >actual 2>actual.err &&
-       test_i18ngrep "main" actual &&
+       test_grep "main" actual &&
        test_line_count = 0 actual.err
 '
 
 test_expect_success 'branch --contains <inexistent_commit>' '
        test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "error" actual.err &&
-       test_i18ngrep ! "usage" actual.err
+       test_grep "error" actual.err &&
+       test_grep ! "usage" actual.err
 '
 
 test_expect_success 'branch --no-contains <existent_commit>' '
@@ -66,14 +66,14 @@ test_expect_success 'branch --no-contains <existent_commit>' '
 test_expect_success 'branch --no-contains <inexistent_commit>' '
        test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "error" actual.err &&
-       test_i18ngrep ! "usage" actual.err
+       test_grep "error" actual.err &&
+       test_grep ! "usage" actual.err
 '
 
 test_expect_success 'branch usage error' '
        test_must_fail git branch --noopt >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "usage" actual.err
+       test_grep "usage" actual.err
 '
 
 test_expect_success 'for-each-ref --contains <existent_object>' '
@@ -85,8 +85,8 @@ test_expect_success 'for-each-ref --contains <existent_object>' '
 test_expect_success 'for-each-ref --contains <inexistent_object>' '
        test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "error" actual.err &&
-       test_i18ngrep ! "usage" actual.err
+       test_grep "error" actual.err &&
+       test_grep ! "usage" actual.err
 '
 
 test_expect_success 'for-each-ref --no-contains <existent_object>' '
@@ -98,14 +98,14 @@ test_expect_success 'for-each-ref --no-contains <existent_object>' '
 test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
        test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "error" actual.err &&
-       test_i18ngrep ! "usage" actual.err
+       test_grep "error" actual.err &&
+       test_grep ! "usage" actual.err
 '
 
 test_expect_success 'for-each-ref usage error' '
        test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
        test_line_count = 0 actual &&
-       test_i18ngrep "usage" actual.err
+       test_grep "usage" actual.err
 '
 
 test_done
index e2411f6a9bd93bad152360b6997bb9785d55ef18..20986b693cfbe8de91552f43daa11be630842f34 100755 (executable)
@@ -19,12 +19,12 @@ test_expect_success MINGW 'subprocess inherits only std handles' '
 
 test_expect_success 'start_command reports ENOENT (slash)' '
        test-tool run-command start-command-ENOENT ./does-not-exist 2>err &&
-       test_i18ngrep "\./does-not-exist" err
+       test_grep "\./does-not-exist" err
 '
 
 test_expect_success 'start_command reports ENOENT (no slash)' '
        test-tool run-command start-command-ENOENT does-not-exist 2>err &&
-       test_i18ngrep "does-not-exist" err
+       test_grep "does-not-exist" err
 '
 
 test_expect_success 'run_command can run a command' '
@@ -49,7 +49,7 @@ test_expect_success !RUNS_COMMANDS_FROM_PWD 'run_command is restricted to PATH'
        echo yikes
        EOF
        test_must_fail test-tool run-command run-command should-not-run 2>err &&
-       test_i18ngrep "should-not-run" err
+       test_grep "should-not-run" err
 '
 
 test_expect_success !MINGW 'run_command can run a script without a #! line' '
index 574de3419800e5f392038de8f35374d355fc9bcf..0ecec2ba71116959fd2efceac7fc46683d1a3e91 100755 (executable)
@@ -9,10 +9,6 @@ Verify wrappers and compatibility functions.
 TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
-test_expect_success 'character classes (isspace, isalpha etc.)' '
-       test-tool ctype
-'
-
 test_expect_success 'mktemp to nonexistent directory prints filename' '
        test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
        grep "doesnotexist/test" err
@@ -44,13 +40,71 @@ test_expect_success 'incomplete sideband messages are reassembled' '
 test_expect_success 'eof on sideband message is reported' '
        printf 1234 >input &&
        test-tool pkt-line receive-sideband <input 2>err &&
-       test_i18ngrep "unexpected disconnect" err
+       test_grep "unexpected disconnect" err
 '
 
 test_expect_success 'missing sideband designator is reported' '
        printf 0004 >input &&
        test-tool pkt-line receive-sideband <input 2>err &&
-       test_i18ngrep "missing sideband" err
+       test_grep "missing sideband" err
+'
+
+test_expect_success 'unpack-sideband: --no-chomp-newline' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --no-chomp-newline <split-sideband >out 2>err &&
+       cat >expect-out <<-EOF &&
+               primary: regular output
+       EOF
+       cat >expect-err <<-EOF &&
+               Foo.
+               Bar.
+               Hello, world!
+       EOF
+       test_cmp expect-out out &&
+       test_cmp expect-err err
+'
+
+test_expect_success 'unpack-sideband: --chomp-newline (default)' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --chomp-newline <split-sideband >out 2>err &&
+       printf "primary: regular output" >expect-out &&
+       printf "Foo.Bar.Hello, world!" >expect-err &&
+       test_cmp expect-out out &&
+       test_cmp expect-err err
+'
+
+test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, no chomp payload' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --reader-use-sideband \
+               --no-chomp-newline <split-sideband >out 2>err &&
+       cat >expect-out <<-EOF &&
+               primary: regular output
+       EOF
+       printf "remote: Foo.        \n"           >expect-err &&
+       printf "remote: Bar.        \n"          >>expect-err &&
+       printf "remote: Hello, world!        \n" >>expect-err &&
+       test_cmp expect-out out &&
+       test_cmp expect-err err
+'
+
+test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, chomp payload' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --reader-use-sideband \
+               --chomp-newline <split-sideband >out 2>err &&
+       printf "primary: regular output" >expect-out &&
+       printf "remote: Foo.        \n"           >expect-err &&
+       printf "remote: Bar.        \n"          >>expect-err &&
+       printf "remote: Hello, world!        \n" >>expect-err &&
+       test_cmp expect-out out &&
+       test_cmp expect-err err
 '
 
 test_done
diff --git a/t/t0080-unit-test-output.sh b/t/t0080-unit-test-output.sh
new file mode 100755 (executable)
index 0000000..6657c11
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+test_description='Test the output of the unit test framework'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+test_expect_success 'TAP output from unit tests' '
+       cat >expect <<-EOF &&
+       ok 1 - passing test
+       ok 2 - passing test and assertion return 1
+       # check "1 == 2" failed at t/unit-tests/t-basic.c:76
+       #    left: 1
+       #   right: 2
+       not ok 3 - failing test
+       ok 4 - failing test and assertion return 0
+       not ok 5 - passing TEST_TODO() # TODO
+       ok 6 - passing TEST_TODO() returns 1
+       # todo check ${SQ}check(x)${SQ} succeeded at t/unit-tests/t-basic.c:25
+       not ok 7 - failing TEST_TODO()
+       ok 8 - failing TEST_TODO() returns 0
+       # check "0" failed at t/unit-tests/t-basic.c:30
+       # skipping test - missing prerequisite
+       # skipping check ${SQ}1${SQ} at t/unit-tests/t-basic.c:32
+       ok 9 - test_skip() # SKIP
+       ok 10 - skipped test returns 1
+       # skipping test - missing prerequisite
+       ok 11 - test_skip() inside TEST_TODO() # SKIP
+       ok 12 - test_skip() inside TEST_TODO() returns 1
+       # check "0" failed at t/unit-tests/t-basic.c:48
+       not ok 13 - TEST_TODO() after failing check
+       ok 14 - TEST_TODO() after failing check returns 0
+       # check "0" failed at t/unit-tests/t-basic.c:56
+       not ok 15 - failing check after TEST_TODO()
+       ok 16 - failing check after TEST_TODO() returns 0
+       # check "!strcmp("\thello\\\\", "there\"\n")" failed at t/unit-tests/t-basic.c:61
+       #    left: "\011hello\\\\"
+       #   right: "there\"\012"
+       # check "!strcmp("NULL", NULL)" failed at t/unit-tests/t-basic.c:62
+       #    left: "NULL"
+       #   right: NULL
+       # check "${SQ}a${SQ} == ${SQ}\n${SQ}" failed at t/unit-tests/t-basic.c:63
+       #    left: ${SQ}a${SQ}
+       #   right: ${SQ}\012${SQ}
+       # check "${SQ}\\\\${SQ} == ${SQ}\\${SQ}${SQ}" failed at t/unit-tests/t-basic.c:64
+       #    left: ${SQ}\\\\${SQ}
+       #   right: ${SQ}\\${SQ}${SQ}
+       not ok 17 - messages from failing string and char comparison
+       # BUG: test has no checks at t/unit-tests/t-basic.c:91
+       not ok 18 - test with no checks
+       ok 19 - test with no checks returns 0
+       1..19
+       EOF
+
+       ! "$GIT_BUILD_DIR"/t/unit-tests/bin/t-basic >actual &&
+       test_cmp expect actual
+'
+
+test_done
diff --git a/t/t0081-find-pack.sh b/t/t0081-find-pack.sh
new file mode 100755 (executable)
index 0000000..67b1121
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+test_description='test `test-tool find-pack`'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+       test_commit one &&
+       test_commit two &&
+       test_commit three &&
+       test_commit four &&
+       test_commit five
+'
+
+test_expect_success 'repack everything into a single packfile' '
+       git repack -a -d --no-write-bitmap-index &&
+
+       head_commit_pack=$(test-tool find-pack HEAD) &&
+       head_tree_pack=$(test-tool find-pack HEAD^{tree}) &&
+       one_pack=$(test-tool find-pack HEAD:one.t) &&
+       three_pack=$(test-tool find-pack HEAD:three.t) &&
+       old_commit_pack=$(test-tool find-pack HEAD~4) &&
+
+       test-tool find-pack --check-count 1 HEAD &&
+       test-tool find-pack --check-count=1 HEAD^{tree} &&
+       ! test-tool find-pack --check-count=0 HEAD:one.t &&
+       ! test-tool find-pack -c 2 HEAD:one.t &&
+       test-tool find-pack -c 1 HEAD:three.t &&
+
+       # Packfile exists at the right path
+       case "$head_commit_pack" in
+               ".git/objects/pack/pack-"*".pack") true ;;
+               *) false ;;
+       esac &&
+       test -f "$head_commit_pack" &&
+
+       # Everything is in the same pack
+       test "$head_commit_pack" = "$head_tree_pack" &&
+       test "$head_commit_pack" = "$one_pack" &&
+       test "$head_commit_pack" = "$three_pack" &&
+       test "$head_commit_pack" = "$old_commit_pack"
+'
+
+test_expect_success 'add more packfiles' '
+       git rev-parse HEAD^{tree} HEAD:two.t HEAD:four.t >objects &&
+       git pack-objects .git/objects/pack/mypackname1 >packhash1 <objects &&
+
+       git rev-parse HEAD~ HEAD~^{tree} HEAD:five.t >objects &&
+       git pack-objects .git/objects/pack/mypackname2 >packhash2 <objects &&
+
+       head_commit_pack=$(test-tool find-pack HEAD) &&
+
+       # HEAD^{tree} is in 2 packfiles
+       test-tool find-pack HEAD^{tree} >head_tree_packs &&
+       grep "$head_commit_pack" head_tree_packs &&
+       grep mypackname1 head_tree_packs &&
+       ! grep mypackname2 head_tree_packs &&
+       test-tool find-pack --check-count 2 HEAD^{tree} &&
+       ! test-tool find-pack --check-count 1 HEAD^{tree} &&
+
+       # HEAD:five.t is also in 2 packfiles
+       test-tool find-pack HEAD:five.t >five_packs &&
+       grep "$head_commit_pack" five_packs &&
+       ! grep mypackname1 five_packs &&
+       grep mypackname2 five_packs &&
+       test-tool find-pack -c 2 HEAD:five.t &&
+       ! test-tool find-pack --check-count=0 HEAD:five.t
+'
+
+test_expect_success 'add more commits (as loose objects)' '
+       test_commit six &&
+       test_commit seven &&
+
+       test -z "$(test-tool find-pack HEAD)" &&
+       test -z "$(test-tool find-pack HEAD:six.t)" &&
+       test-tool find-pack --check-count 0 HEAD &&
+       test-tool find-pack -c 0 HEAD:six.t &&
+       ! test-tool find-pack -c 1 HEAD:seven.t
+'
+
+test_done
index f6998269beb4fea3f68f14ffae22b541a066e6b3..fca39048fe8840099c2d7a393e91dfd3a6683029 100755 (executable)
@@ -39,9 +39,9 @@ test_expect_success 'sanity check "System Info" section' '
 
        sed -ne "/^\[System Info\]$/,/^$/p" <git-bugreport-format.txt >system &&
 
-       # The beginning should match "git version --build-info" verbatim,
+       # The beginning should match "git version --build-options" verbatim,
        # but rather than checking bit-for-bit equality, just test some basics.
-       grep "git version [0-9]." system &&
+       grep "git version " system &&
        grep "shell-path: ." system &&
 
        # After the version, there should be some more info.
@@ -65,7 +65,14 @@ test_expect_success '--output-directory puts the report in the provided dir' '
 
 test_expect_success 'incorrect arguments abort with usage' '
        test_must_fail git bugreport --false 2>output &&
-       test_i18ngrep usage output &&
+       test_grep usage output &&
+       test_path_is_missing git-bugreport-*
+'
+
+test_expect_success 'incorrect positional arguments abort with usage and hint' '
+       test_must_fail git bugreport false 2>output &&
+       test_grep usage output &&
+       test_grep false output &&
        test_path_is_missing git-bugreport-*
 '
 
index 2cbf7b95907384b4b4b5ac91f801026810b85f0a..47d96a2a13f93b235f6f3d0c9f8f06922f6ee872 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-use 5.008;
+use 5.008001;
 use lib (split(/:/, $ENV{GITPERLLIB}));
 use strict;
 use warnings;
index 4f2e0dcb02bda84409789b54f33237798c8f7e19..310a4500125f4a0d18f6c68a10cf1e8fe7d3beff 100755 (executable)
@@ -82,7 +82,7 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext.c: git init UTF-8 -> ISO-8859-1'
     printf "Bjó til tóma Git lind" >expect &&
     LANGUAGE=is LC_ALL="$is_IS_iso_locale" git init repo >actual &&
     test_when_finished "rm -rf repo" &&
-    grep "^$(cat expect | iconv -f UTF-8 -t ISO8859-1) " actual
+    grep "^$(iconv -f UTF-8 -t ISO8859-1 <expect) " actual
 '
 
 test_done
index 80e76a4695ed8d5abbaf8deb1ea2a55d2f535d41..c312657a12cd34334ce58361c7f0a73f384daff6 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='test trace2 facility (normal target)'
 
-TEST_PASSES_SANITIZE_LEAK=true
+TEST_PASSES_SANITIZE_LEAK=false
 . ./test-lib.sh
 
 # Turn off any inherited trace2 settings for this test.
@@ -283,4 +283,22 @@ test_expect_success 'using global config with include' '
        test_cmp expect actual
 '
 
+test_expect_success 'unsafe URLs are redacted by default' '
+       test_when_finished \
+               "rm -r trace.normal unredacted.normal clone clone2" &&
+
+       test_config_global \
+               "url.$(pwd).insteadOf" https://user:pwd@example.com/ &&
+       test_config_global trace2.configParams "core.*,remote.*.url" &&
+
+       GIT_TRACE2="$(pwd)/trace.normal" \
+               git clone https://user:pwd@example.com/ clone &&
+       ! grep user:pwd trace.normal &&
+
+       GIT_TRACE2_REDACT=0 GIT_TRACE2="$(pwd)/unredacted.normal" \
+               git clone https://user:pwd@example.com/ clone2 &&
+       grep "start .* clone https://user:pwd@example.com" unredacted.normal &&
+       grep "remote.origin.url=https://user:pwd@example.com" unredacted.normal
+'
+
 test_done
index cfba6861322e373c64897e4c543838b7879cf3e0..13ef69b92f897b0e4bd5019ea3a7b48f15061e37 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='test trace2 facility (perf target)'
 
-TEST_PASSES_SANITIZE_LEAK=true
+TEST_PASSES_SANITIZE_LEAK=false
 . ./test-lib.sh
 
 # Turn off any inherited trace2 settings for this test.
@@ -268,4 +268,254 @@ test_expect_success PTHREADS 'global counter test/test2' '
        have_counter_event "main" "counter" "test" "test2" 60 actual
 '
 
+test_expect_success 'unsafe URLs are redacted by default' '
+       test_when_finished \
+               "rm -r actual trace.perf unredacted.perf clone clone2" &&
+
+       test_config_global \
+               "url.$(pwd).insteadOf" https://user:pwd@example.com/ &&
+       test_config_global trace2.configParams "core.*,remote.*.url" &&
+
+       GIT_TRACE2_PERF="$(pwd)/trace.perf" \
+               git clone https://user:pwd@example.com/ clone &&
+       ! grep user:pwd trace.perf &&
+
+       GIT_TRACE2_REDACT=0 GIT_TRACE2_PERF="$(pwd)/unredacted.perf" \
+               git clone https://user:pwd@example.com/ clone2 &&
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <unredacted.perf >actual &&
+       grep "d0|main|start|.* clone https://user:pwd@example.com" actual &&
+       grep "d0|main|def_param|.*|remote.origin.url:https://user:pwd@example.com" actual
+'
+
+# Confirm that the requested command produces a "cmd_name" and a
+# set of "def_param" events.
+#
+try_simple () {
+       test_when_finished "rm prop.perf actual" &&
+
+       cmd=$1 &&
+       cmd_name=$2 &&
+
+       test_config_global "trace2.configParams" "cfg.prop.*" &&
+       test_config_global "trace2.envvars" "ENV_PROP_FOO,ENV_PROP_BAR" &&
+
+       test_config_global "cfg.prop.foo" "red" &&
+
+       ENV_PROP_FOO=blue \
+               GIT_TRACE2_PERF="$(pwd)/prop.perf" \
+                       $cmd &&
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
+       grep "d0|main|cmd_name|.*|$cmd_name" actual &&
+       grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual
+}
+
+# Representative mainstream builtin Git command dispatched
+# in run_builtin() in git.c
+#
+test_expect_success 'expect def_params for normal builtin command' '
+       try_simple "git version" "version"
+'
+
+# Representative query command dispatched in handle_options()
+# in git.c
+#
+test_expect_success 'expect def_params for query command' '
+       try_simple "git --man-path" "_query_"
+'
+
+# remote-curl.c does not use the builtin setup in git.c, so confirm
+# that executables built from remote-curl.c emit def_params.
+#
+# Also tests the dashed-command handling where "git foo" silently
+# spawns "git-foo".  Make sure that both commands should emit
+# def_params.
+#
+# Pass bogus arguments to remote-https and allow the command to fail
+# because we don't actually have a remote to fetch from.  We just want
+# to see the run-dashed code run an executable built from
+# remote-curl.c rather than git.c.  Confirm that we get def_param
+# events from both layers.
+#
+test_expect_success 'expect def_params for remote-curl and _run_dashed_' '
+       test_when_finished "rm prop.perf actual" &&
+
+       test_config_global "trace2.configParams" "cfg.prop.*" &&
+       test_config_global "trace2.envvars" "ENV_PROP_FOO,ENV_PROP_BAR" &&
+
+       test_config_global "cfg.prop.foo" "red" &&
+
+       test_might_fail env \
+               ENV_PROP_FOO=blue \
+               GIT_TRACE2_PERF="$(pwd)/prop.perf" \
+               git remote-http x y &&
+
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
+
+       grep "d0|main|cmd_name|.*|_run_dashed_" actual &&
+       grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
+
+       grep "d1|main|cmd_name|.*|remote-curl" actual &&
+       grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
+'
+
+# Similarly, `git-http-fetch` is not built from git.c so do a
+# trivial fetch so that the main git.c run-dashed code spawns
+# an executable built from http-fetch.c.  Confirm that we get
+# def_param events from both layers.
+#
+test_expect_success 'expect def_params for http-fetch and _run_dashed_' '
+       test_when_finished "rm prop.perf actual" &&
+
+       test_config_global "trace2.configParams" "cfg.prop.*" &&
+       test_config_global "trace2.envvars" "ENV_PROP_FOO,ENV_PROP_BAR" &&
+
+       test_config_global "cfg.prop.foo" "red" &&
+
+       test_might_fail env \
+               ENV_PROP_FOO=blue \
+               GIT_TRACE2_PERF="$(pwd)/prop.perf" \
+               git http-fetch --stdin file:/// <<-EOF &&
+       EOF
+
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
+
+       grep "d0|main|cmd_name|.*|_run_dashed_" actual &&
+       grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
+
+       grep "d1|main|cmd_name|.*|http-fetch" actual &&
+       grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
+'
+
+# Historically, alias expansion explicitly emitted the def_param
+# events (independent of whether the command was a builtin, a Git
+# command or arbitrary shell command) so that it wasn't dependent
+# upon the unpeeling of the alias. Let's make sure that we preserve
+# the net effect.
+#
+test_expect_success 'expect def_params during git alias expansion' '
+       test_when_finished "rm prop.perf actual" &&
+
+       test_config_global "trace2.configParams" "cfg.prop.*" &&
+       test_config_global "trace2.envvars" "ENV_PROP_FOO,ENV_PROP_BAR" &&
+
+       test_config_global "cfg.prop.foo" "red" &&
+
+       test_config_global "alias.xxx" "version" &&
+
+       ENV_PROP_FOO=blue \
+               GIT_TRACE2_PERF="$(pwd)/prop.perf" \
+                       git xxx &&
+
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
+
+       # "git xxx" is first mapped to "git-xxx" and the child will fail.
+       grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
+
+       # We unpeel that and substitute "version" into "xxx" (giving
+       # "git version") and update the cmd_name event.
+       grep "d0|main|cmd_name|.*|_run_git_alias_ (_run_dashed_/_run_git_alias_)" actual &&
+
+       # These def_param events could be associated with either of the
+       # above cmd_name events.  It does not matter.
+       grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
+
+       # The "git version" child sees a different cmd_name hierarchy.
+       # Also test the def_param (only for completeness).
+       grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_git_alias_/version)" actual &&
+       grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
+'
+
+test_expect_success 'expect def_params during shell alias expansion' '
+       test_when_finished "rm prop.perf actual" &&
+
+       test_config_global "trace2.configParams" "cfg.prop.*" &&
+       test_config_global "trace2.envvars" "ENV_PROP_FOO,ENV_PROP_BAR" &&
+
+       test_config_global "cfg.prop.foo" "red" &&
+
+       test_config_global "alias.xxx" "!git version" &&
+
+       ENV_PROP_FOO=blue \
+               GIT_TRACE2_PERF="$(pwd)/prop.perf" \
+                       git xxx &&
+
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
+
+       # "git xxx" is first mapped to "git-xxx" and the child will fail.
+       grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
+
+       # We unpeel that and substitute "git version" for "git xxx" (as a
+       # shell command.  Another cmd_name event is emitted as we unpeel.
+       grep "d0|main|cmd_name|.*|_run_shell_alias_ (_run_dashed_/_run_shell_alias_)" actual &&
+
+       # These def_param events could be associated with either of the
+       # above cmd_name events.  It does not matter.
+       grep "d0|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
+
+       # We get the following only because we used a git command for the
+       # shell command. In general, it could have been a shell script and
+       # we would see nothing.
+       #
+       # The child knows the cmd_name hierarchy so it includes it.
+       grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_shell_alias_/version)" actual &&
+       grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
+'
+
+test_expect_success 'expect def_params during nested git alias expansion' '
+       test_when_finished "rm prop.perf actual" &&
+
+       test_config_global "trace2.configParams" "cfg.prop.*" &&
+       test_config_global "trace2.envvars" "ENV_PROP_FOO,ENV_PROP_BAR" &&
+
+       test_config_global "cfg.prop.foo" "red" &&
+
+       test_config_global "alias.xxx" "yyy" &&
+       test_config_global "alias.yyy" "version" &&
+
+       ENV_PROP_FOO=blue \
+               GIT_TRACE2_PERF="$(pwd)/prop.perf" \
+                       git xxx &&
+
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <prop.perf >actual &&
+
+       # "git xxx" is first mapped to "git-xxx" and try to spawn "git-xxx"
+       # and the child will fail.
+       grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_)" actual &&
+       grep "d0|main|child_start|.*|.* class:dashed argv:\[git-xxx\]" actual &&
+
+       # We unpeel that and substitute "yyy" into "xxx" (giving "git yyy")
+       # and spawn "git-yyy" and the child will fail.
+       grep "d0|main|alias|.*|alias:xxx argv:\[yyy\]" actual &&
+       grep "d0|main|cmd_name|.*|_run_dashed_ (_run_dashed_/_run_dashed_)" actual &&
+       grep "d0|main|child_start|.*|.* class:dashed argv:\[git-yyy\]" actual &&
+
+       # We unpeel that and substitute "version" into "xxx" (giving
+       # "git version") and update the cmd_name event.
+       grep "d0|main|alias|.*|alias:yyy argv:\[version\]" actual &&
+       grep "d0|main|cmd_name|.*|_run_git_alias_ (_run_dashed_/_run_dashed_/_run_git_alias_)" actual &&
+
+       # These def_param events could be associated with any of the
+       # above cmd_name events.  It does not matter.
+       grep "d0|main|def_param|.*|cfg.prop.foo:red" actual >actual.matches &&
+       grep "d0|main|def_param|.*|ENV_PROP_FOO:blue" actual &&
+
+       # However, we do not want them repeated each time we unpeel.
+       test_line_count = 1 actual.matches &&
+
+       # The "git version" child sees a different cmd_name hierarchy.
+       # Also test the def_param (only for completeness).
+       grep "d1|main|cmd_name|.*|version (_run_dashed_/_run_dashed_/_run_git_alias_/version)" actual &&
+       grep "d1|main|def_param|.*|cfg.prop.foo:red" actual &&
+       grep "d1|main|def_param|.*|ENV_PROP_FOO:blue" actual
+'
+
 test_done
index 6d3374ff773c1ef3b612b2a0df9aa9df4525790e..147643d582643efebf794000fa48e3d460c76173 100755 (executable)
@@ -323,4 +323,44 @@ test_expect_success 'discard traces when there are too many files' '
        head -n2 trace_target_dir/git-trace2-discard | tail -n1 | grep \"event\":\"too_many_files\"
 '
 
+# In the following "...redact..." tests, skip testing the GIT_TRACE2_REDACT=0
+# case because we would need to exactly model the full JSON event stream like
+# we did in the basic tests above and I do not think it is worth it.
+
+test_expect_success 'unsafe URLs are redacted by default in cmd_start events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 300redact_start git clone https://user:pwd@example.com/ clone2 &&
+       ! grep user:pwd trace.event
+'
+
+test_expect_success 'unsafe URLs are redacted by default in child_start events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 301redact_child_start git clone https://user:pwd@example.com/ clone2 &&
+       ! grep user:pwd trace.event
+'
+
+test_expect_success 'unsafe URLs are redacted by default in exec events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 302redact_exec git clone https://user:pwd@example.com/ clone2 &&
+       ! grep user:pwd trace.event
+'
+
+test_expect_success 'unsafe URLs are redacted by default in def_param events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 303redact_def_param url https://user:pwd@example.com/ &&
+       ! grep user:pwd trace.event
+'
+
 test_done
index a4f5bba5075c3d61a86b2fad1cb95ba73058bc8e..400f6bdbca13c2a93cb8521e21e08fbd4e1eb3bd 100755 (executable)
@@ -827,7 +827,7 @@ test_expect_success 'credential config with partial URLs' '
        git -c credential.$partial.helper=yep \
                -c credential.with%0anewline.username=uh-oh \
                credential fill <stdin 2>stderr &&
-       test_i18ngrep "skipping credential lookup for key" stderr
+       test_grep "skipping credential lookup for key" stderr
 '
 
 test_done
index c02a3b5969c3d2265d1552132464df7135cd522b..8300faadea9a76f19e3d2c82f5ff600f38bfe18f 100755 (executable)
@@ -29,6 +29,7 @@ test_atexit 'git credential-cache exit'
 
 # test that the daemon works with no special setup
 helper_test cache
+helper_test_password_expiry_utc cache
 helper_test_oauth_refresh_token cache
 
 test_expect_success 'socket defaults to ~/.cache/git/credential/socket' '
index f028fd1418285107a90e170a6ea1cd7657e31bb8..72ae405c3ed979edee54cbe83e73ec566d23f6d1 100755 (executable)
@@ -32,9 +32,24 @@ commands.
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-credential.sh
 
+# If we're not given a specific external helper to run against,
+# there isn't much to test. But we can still run through our
+# battery of tests with a fake helper and check that the
+# test themselves are self-consistent and clean up after
+# themselves.
+#
+# We'll use the "store" helper, since we can easily inspect
+# its state by looking at the on-disk file. But since it doesn't
+# implement any caching or expiry logic, we'll cheat and override
+# the "check" function to just report all results as OK.
 if test -z "$GIT_TEST_CREDENTIAL_HELPER"; then
-       skip_all="used to test external credential helpers"
-       test_done
+       GIT_TEST_CREDENTIAL_HELPER=store
+       GIT_TEST_CREDENTIAL_HELPER_TIMEOUT=store
+       check () {
+               test "$1" = "approve" || return 0
+               git -c credential.helper=store credential approve
+       }
+       check_cleanup=t
 fi
 
 test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" ||
@@ -45,6 +60,8 @@ test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" ||
 helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
 
 helper_test "$GIT_TEST_CREDENTIAL_HELPER"
+helper_test_password_expiry_utc "$GIT_TEST_CREDENTIAL_HELPER"
+helper_test_oauth_refresh_token "$GIT_TEST_CREDENTIAL_HELPER"
 
 if test -z "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"; then
        say "# skipping timeout tests (GIT_TEST_CREDENTIAL_HELPER_TIMEOUT not set)"
@@ -57,4 +74,11 @@ fi
 # might be long-term system storage
 helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
 
+if test "$check_cleanup" = "t"
+then
+       test_expect_success 'test cleanup removes everything' '
+               test_must_be_empty "$HOME/.git-credentials"
+       '
+fi
+
 test_done
index 5b7bee888d567b5b55e2d4e7c53849db8945fdcb..88a66f09040ce0aa2a3a653579d6c3685e750ba1 100755 (executable)
@@ -49,7 +49,7 @@ test_expect_success 'convert shallow clone to partial clone' '
        test_cmp_config -C client 1 core.repositoryformatversion
 '
 
-test_expect_success SHA1 'convert to partial clone with noop extension' '
+test_expect_success DEFAULT_REPO_FORMAT 'convert to partial clone with noop extension' '
        rm -fr server client &&
        test_create_repo server &&
        test_commit -C server my_commit 1 &&
@@ -60,7 +60,7 @@ test_expect_success SHA1 'convert to partial clone with noop extension' '
        git -C client fetch --unshallow --filter="blob:none"
 '
 
-test_expect_success SHA1 'converting to partial clone fails with unrecognized extension' '
+test_expect_success DEFAULT_REPO_FORMAT 'converting to partial clone fails with unrecognized extension' '
        rm -fr server client &&
        test_create_repo server &&
        test_commit -C server my_commit 1 &&
@@ -665,6 +665,21 @@ test_expect_success 'lazy-fetch when accessing object not in the_repository' '
        git -C partial.git rev-list --objects --missing=print HEAD >out &&
        grep "[?]$FILE_HASH" out &&
 
+       # The no-lazy-fetch mechanism prevents Git from fetching
+       test_must_fail env GIT_NO_LAZY_FETCH=1 \
+               git -C partial.git cat-file -e "$FILE_HASH" &&
+
+       # The same with command line option to "git"
+       test_must_fail git --no-lazy-fetch -C partial.git cat-file -e "$FILE_HASH" &&
+
+       # The same, forcing a subprocess via an alias
+       test_must_fail git --no-lazy-fetch -C partial.git \
+               -c alias.foo="!git cat-file" foo -e "$FILE_HASH" &&
+
+       # Sanity check that the file is still missing
+       git -C partial.git rev-list --objects --missing=print HEAD >out &&
+       grep "[?]$FILE_HASH" out &&
+
        git -C full cat-file -s "$FILE_HASH" >expect &&
        test-tool partial-clone object-info partial.git "$FILE_HASH" >actual &&
        test_cmp expect actual &&
diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh
new file mode 100755 (executable)
index 0000000..6421434
--- /dev/null
@@ -0,0 +1,475 @@
+#!/bin/sh
+
+test_description='Test reffiles backend'
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+if ! test_have_prereq REFFILES
+then
+       skip_all='skipping reffiles specific tests'
+       test_done
+fi
+
+test_expect_success 'setup' '
+       git commit --allow-empty -m Initial &&
+       C=$(git rev-parse HEAD) &&
+       git commit --allow-empty -m Second &&
+       D=$(git rev-parse HEAD) &&
+       git commit --allow-empty -m Third &&
+       E=$(git rev-parse HEAD)
+'
+
+test_expect_success 'empty directory should not fool rev-parse' '
+       prefix=refs/e-rev-parse &&
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       echo "$C" >expected &&
+       git rev-parse $prefix/foo >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'empty directory should not fool for-each-ref' '
+       prefix=refs/e-for-each-ref &&
+       git update-ref $prefix/foo $C &&
+       git for-each-ref $prefix >expected &&
+       git pack-refs --all &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       git for-each-ref $prefix >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'empty directory should not fool create' '
+       prefix=refs/e-create &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       printf "create %s $C\n" $prefix/foo |
+       git update-ref --stdin
+'
+
+test_expect_success 'empty directory should not fool verify' '
+       prefix=refs/e-verify &&
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       printf "verify %s $C\n" $prefix/foo |
+       git update-ref --stdin
+'
+
+test_expect_success 'empty directory should not fool 1-arg update' '
+       prefix=refs/e-update-1 &&
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       printf "update %s $D\n" $prefix/foo |
+       git update-ref --stdin
+'
+
+test_expect_success 'empty directory should not fool 2-arg update' '
+       prefix=refs/e-update-2 &&
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       printf "update %s $D $C\n" $prefix/foo |
+       git update-ref --stdin
+'
+
+test_expect_success 'empty directory should not fool 0-arg delete' '
+       prefix=refs/e-delete-0 &&
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       printf "delete %s\n" $prefix/foo |
+       git update-ref --stdin
+'
+
+test_expect_success 'empty directory should not fool 1-arg delete' '
+       prefix=refs/e-delete-1 &&
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       mkdir -p .git/$prefix/foo/bar/baz &&
+       printf "delete %s $C\n" $prefix/foo |
+       git update-ref --stdin
+'
+
+test_expect_success 'non-empty directory blocks create' '
+       prefix=refs/ne-create &&
+       mkdir -p .git/$prefix/foo/bar &&
+       : >.git/$prefix/foo/bar/baz.lock &&
+       test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ
+       EOF
+       printf "%s\n" "update $prefix/foo $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ
+       EOF
+       printf "%s\n" "update $prefix/foo $D $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err
+'
+
+test_expect_success 'broken reference blocks create' '
+       prefix=refs/broken-create &&
+       mkdir -p .git/$prefix &&
+       echo "gobbledigook" >.git/$prefix/foo &&
+       test_when_finished "rm -f .git/$prefix/foo" &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
+       EOF
+       printf "%s\n" "update $prefix/foo $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
+       EOF
+       printf "%s\n" "update $prefix/foo $D $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err
+'
+
+test_expect_success 'non-empty directory blocks indirect create' '
+       prefix=refs/ne-indirect-create &&
+       git symbolic-ref $prefix/symref $prefix/foo &&
+       mkdir -p .git/$prefix/foo/bar &&
+       : >.git/$prefix/foo/bar/baz.lock &&
+       test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ
+       EOF
+       printf "%s\n" "update $prefix/symref $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ
+       EOF
+       printf "%s\n" "update $prefix/symref $D $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err
+'
+
+test_expect_success 'broken reference blocks indirect create' '
+       prefix=refs/broken-indirect-create &&
+       git symbolic-ref $prefix/symref $prefix/foo &&
+       echo "gobbledigook" >.git/$prefix/foo &&
+       test_when_finished "rm -f .git/$prefix/foo" &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
+       EOF
+       printf "%s\n" "update $prefix/symref $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err &&
+       cat >expected <<-EOF &&
+       fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
+       EOF
+       printf "%s\n" "update $prefix/symref $D $C" |
+       test_must_fail git update-ref --stdin 2>output.err &&
+       test_cmp expected output.err
+'
+
+test_expect_success 'no bogus intermediate values during delete' '
+       prefix=refs/slow-transaction &&
+       # Set up a reference with differing loose and packed versions:
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       git update-ref $prefix/foo $D &&
+       # Now try to update the reference, but hold the `packed-refs` lock
+       # for a while to see what happens while the process is blocked:
+       : >.git/packed-refs.lock &&
+       test_when_finished "rm -f .git/packed-refs.lock" &&
+       {
+               # Note: the following command is intentionally run in the
+               # background. We increase the timeout so that `update-ref`
+               # attempts to acquire the `packed-refs` lock for much longer
+               # than it takes for us to do the check then delete it:
+               git -c core.packedrefstimeout=30000 update-ref -d $prefix/foo &
+       } &&
+       pid2=$! &&
+       # Give update-ref plenty of time to get to the point where it tries
+       # to lock packed-refs:
+       sleep 1 &&
+       # Make sure that update-ref did not complete despite the lock:
+       kill -0 $pid2 &&
+       # Verify that the reference still has its old value:
+       sha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) &&
+       case "$sha1" in
+       $D)
+               # This is what we hope for; it means that nothing
+               # user-visible has changed yet.
+               : ;;
+       undefined)
+               # This is not correct; it means the deletion has happened
+               # already even though update-ref should not have been
+               # able to acquire the lock yet.
+               echo "$prefix/foo deleted prematurely" &&
+               break
+               ;;
+       $C)
+               # This value should never be seen. Probably the loose
+               # reference has been deleted but the packed reference
+               # is still there:
+               echo "$prefix/foo incorrectly observed to be C" &&
+               break
+               ;;
+       *)
+               # WTF?
+               echo "unexpected value observed for $prefix/foo: $sha1" &&
+               break
+               ;;
+       esac >out &&
+       rm -f .git/packed-refs.lock &&
+       wait $pid2 &&
+       test_must_be_empty out &&
+       test_must_fail git rev-parse --verify --quiet $prefix/foo
+'
+
+test_expect_success 'delete fails cleanly if packed-refs file is locked' '
+       prefix=refs/locked-packed-refs &&
+       # Set up a reference with differing loose and packed versions:
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       git update-ref $prefix/foo $D &&
+       git for-each-ref $prefix >unchanged &&
+       # Now try to delete it while the `packed-refs` lock is held:
+       : >.git/packed-refs.lock &&
+       test_when_finished "rm -f .git/packed-refs.lock" &&
+       test_must_fail git update-ref -d $prefix/foo >out 2>err &&
+       git for-each-ref $prefix >actual &&
+       test_grep "Unable to create $SQ.*packed-refs.lock$SQ: " err &&
+       test_cmp unchanged actual
+'
+
+test_expect_success 'delete fails cleanly if packed-refs.new write fails' '
+       # Setup and expectations are similar to the test above.
+       prefix=refs/failed-packed-refs &&
+       git update-ref $prefix/foo $C &&
+       git pack-refs --all &&
+       git update-ref $prefix/foo $D &&
+       git for-each-ref $prefix >unchanged &&
+       # This should not happen in practice, but it is an easy way to get a
+       # reliable error (we open with create_tempfile(), which uses O_EXCL).
+       : >.git/packed-refs.new &&
+       test_when_finished "rm -f .git/packed-refs.new" &&
+       test_must_fail git update-ref -d $prefix/foo &&
+       git for-each-ref $prefix >actual &&
+       test_cmp unchanged actual
+'
+
+RWT="test-tool ref-store worktree:wt"
+RMAIN="test-tool ref-store worktree:main"
+
+test_expect_success 'setup worktree' '
+       test_commit first &&
+       git worktree add -b wt-main wt &&
+       (
+               cd wt &&
+               test_commit second
+       )
+'
+
+# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should
+# only appear in the for-each-reflog output if it is called from the correct
+# worktree, which is exercised in this test. This test is poorly written for
+# mulitple reasons: 1) it creates invalidly formatted log entres. 2) it uses
+# direct FS access for creating the reflogs. 3) PSEUDO-WT and refs/bisect/random
+# do not create reflogs by default, so it is not testing a realistic scenario.
+test_expect_success 'for_each_reflog()' '
+       echo $ZERO_OID >.git/logs/PSEUDO_MAIN_HEAD &&
+       mkdir -p     .git/logs/refs/bisect &&
+       echo $ZERO_OID >.git/logs/refs/bisect/random &&
+
+       echo $ZERO_OID >.git/worktrees/wt/logs/PSEUDO_WT_HEAD &&
+       mkdir -p     .git/worktrees/wt/logs/refs/bisect &&
+       echo $ZERO_OID >.git/worktrees/wt/logs/refs/bisect/wt-random &&
+
+       $RWT for-each-reflog >actual &&
+       cat >expected <<-\EOF &&
+       HEAD
+       PSEUDO_WT_HEAD
+       refs/bisect/wt-random
+       refs/heads/main
+       refs/heads/wt-main
+       EOF
+       test_cmp expected actual &&
+
+       $RMAIN for-each-reflog >actual &&
+       cat >expected <<-\EOF &&
+       HEAD
+       PSEUDO_MAIN_HEAD
+       refs/bisect/random
+       refs/heads/main
+       refs/heads/wt-main
+       EOF
+       test_cmp expected actual
+'
+
+# Triggering the bug detected by this test requires a newline to fall
+# exactly BUFSIZ-1 bytes from the end of the file. We don't know
+# what that value is, since it's platform dependent. However, if
+# we choose some value N, we also catch any D which divides N evenly
+# (since we will read backwards in chunks of D). So we choose 8K,
+# which catches glibc (with an 8K BUFSIZ) and *BSD (1K).
+#
+# Each line is 114 characters, so we need 75 to still have a few before the
+# last 8K. The 89-character padding on the final entry lines up our
+# newline exactly.
+test_expect_success SHA1 'parsing reverse reflogs at BUFSIZ boundaries' '
+       git checkout -b reflogskip &&
+       zf=$(test_oid zero_2) &&
+       ident="abc <xyz> 0000000001 +0000" &&
+       for i in $(test_seq 1 75); do
+               printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" &&
+               if test $i = 75; then
+                       for j in $(test_seq 1 89); do
+                               printf X || return 1
+                       done
+               else
+                       printf X
+               fi &&
+               printf "\n" || return 1
+       done >.git/logs/refs/heads/reflogskip &&
+       git rev-parse reflogskip@{73} >actual &&
+       echo ${zf}03 >expect &&
+       test_cmp expect actual
+'
+
+# This test takes a lock on an individual ref; this is not supported in
+# reftable.
+test_expect_success 'reflog expire operates on symref not referrent' '
+       git branch --create-reflog the_symref &&
+       git branch --create-reflog referrent &&
+       git update-ref referrent HEAD &&
+       git symbolic-ref refs/heads/the_symref refs/heads/referrent &&
+       test_when_finished "rm -f .git/refs/heads/referrent.lock" &&
+       touch .git/refs/heads/referrent.lock &&
+       git reflog expire --expire=all the_symref
+'
+
+test_expect_success 'empty reflog' '
+       test_when_finished "rm -rf empty" &&
+       git init empty &&
+       test_commit -C empty A &&
+       >empty/.git/logs/refs/heads/foo &&
+       git -C empty reflog expire --all 2>err &&
+       test_must_be_empty err
+'
+
+test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '
+       ln -s does-not-exist .git/refs/heads/broken &&
+       test_must_fail git rev-parse --verify broken
+'
+
+test_expect_success 'log diagnoses bogus HEAD hash' '
+       git init empty &&
+       test_when_finished "rm -rf empty" &&
+       echo 1234abcd >empty/.git/refs/heads/main &&
+       test_must_fail git -C empty log 2>stderr &&
+       test_grep broken stderr
+'
+
+test_expect_success 'log diagnoses bogus HEAD symref' '
+       git init empty &&
+       test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock &&
+       test_must_fail git -C empty log 2>stderr &&
+       test_grep broken stderr &&
+       test_must_fail git -C empty log --default totally-bogus 2>stderr &&
+       test_grep broken stderr
+'
+
+test_expect_success 'empty directory removal' '
+       git branch d1/d2/r1 HEAD &&
+       git branch d1/r2 HEAD &&
+       test_path_is_file .git/refs/heads/d1/d2/r1 &&
+       test_path_is_file .git/logs/refs/heads/d1/d2/r1 &&
+       git branch -d d1/d2/r1 &&
+       test_must_fail git show-ref --verify -q refs/heads/d1/d2 &&
+       test_must_fail git show-ref --verify -q logs/refs/heads/d1/d2 &&
+       test_path_is_file .git/refs/heads/d1/r2 &&
+       test_path_is_file .git/logs/refs/heads/d1/r2
+'
+
+test_expect_success 'symref empty directory removal' '
+       git branch e1/e2/r1 HEAD &&
+       git branch e1/r2 HEAD &&
+       git checkout e1/e2/r1 &&
+       test_when_finished "git checkout main" &&
+       test_path_is_file .git/refs/heads/e1/e2/r1 &&
+       test_path_is_file .git/logs/refs/heads/e1/e2/r1 &&
+       git update-ref -d HEAD &&
+       test_must_fail git show-ref --verify -q refs/heads/e1/e2 &&
+       test_must_fail git show-ref --verify -q logs/refs/heads/e1/e2 &&
+       test_path_is_file .git/refs/heads/e1/r2 &&
+       test_path_is_file .git/logs/refs/heads/e1/r2 &&
+       test_path_is_file .git/logs/HEAD
+'
+
+test_expect_success 'directory not created deleting packed ref' '
+       git branch d1/d2/r1 HEAD &&
+       git pack-refs --all &&
+       test_path_is_missing .git/refs/heads/d1/d2 &&
+       git update-ref -d refs/heads/d1/d2/r1 &&
+       test_path_is_missing .git/refs/heads/d1/d2 &&
+       test_path_is_missing .git/refs/heads/d1
+'
+
+test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' '
+       git branch --create-reflog u &&
+       mv .git/logs/refs/heads/u real-u &&
+       ln -s real-u .git/logs/refs/heads/u &&
+       test_must_fail git branch -m u v
+'
+
+test_expect_success SYMLINKS 'git branch -m with symlinked .git/refs' '
+       test_when_finished "rm -rf subdir" &&
+       git init --bare subdir &&
+
+       rm -rfv subdir/refs subdir/objects subdir/packed-refs &&
+       ln -s ../.git/refs subdir/refs &&
+       ln -s ../.git/objects subdir/objects &&
+       ln -s ../.git/packed-refs subdir/packed-refs &&
+
+       git -C subdir rev-parse --absolute-git-dir >subdir.dir &&
+       git rev-parse --absolute-git-dir >our.dir &&
+       ! test_cmp subdir.dir our.dir &&
+
+       git -C subdir log &&
+       git -C subdir branch rename-src &&
+       git rev-parse rename-src >expect &&
+       git -C subdir branch -m rename-src rename-dest &&
+       git rev-parse rename-dest >actual &&
+       test_cmp expect actual &&
+       git branch -D rename-dest
+'
+
+test_expect_success MINGW,SYMLINKS_WINDOWS 'rebase when .git/logs is a symlink' '
+       git checkout main &&
+       mv .git/logs actual_logs &&
+       cmd //c "mklink /D .git\logs ..\actual_logs" &&
+       git rebase -f HEAD^ &&
+       test -L .git/logs &&
+       rm .git/logs &&
+       mv actual_logs .git/logs
+'
+
+test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
+       umask 077 &&
+       git config core.sharedRepository group &&
+       git reflog expire --all &&
+       actual="$(ls -l .git/logs/refs/heads/main)" &&
+       case "$actual" in
+       -rw-rw-*)
+               : happy
+               ;;
+       *)
+               echo Ooops, .git/logs/refs/heads/main is not 066x [$actual]
+               false
+               ;;
+       esac
+'
+
+test_done
similarity index 80%
rename from t/t3210-pack-refs.sh
rename to t/t0601-reffiles-pack-refs.sh
index 7326adb70f743c422d75386320febf2d8ecaab84..c309d2bae8a19816907b81d82cef9099b2fa21e9 100755 (executable)
@@ -15,6 +15,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
+if ! test_have_prereq REFFILES
+then
+       skip_all='skipping reffiles specific tests'
+       test_done
+fi
+
 test_expect_success 'enable reflogs' '
        git config core.logallrefupdates true
 '
@@ -26,6 +32,14 @@ test_expect_success 'prepare a trivial repository' '
        HEAD=$(git rev-parse --verify HEAD)
 '
 
+test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
+       N=`find .git/refs -type f | wc -l` &&
+       test "$N" != 0 &&
+       test-tool ref-store main pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&
+       N=`find .git/refs -type f` &&
+       test -z "$N"
+'
+
 SHA1=
 
 test_expect_success 'see if git show-ref works as expected' '
@@ -227,7 +241,7 @@ test_expect_success 'notice d/f conflict with existing directory' '
 
 test_expect_success 'existing directory reports concrete ref' '
        test_must_fail git branch foo 2>stderr &&
-       test_i18ngrep refs/heads/foo/bar/baz stderr
+       test_grep refs/heads/foo/bar/baz stderr
 '
 
 test_expect_success 'notice d/f conflict with existing ref' '
@@ -294,4 +308,54 @@ test_expect_success SYMLINKS 'pack symlinked packed-refs' '
        test "$(test_readlink .git/packed-refs)" = "my-deviant-packed-refs"
 '
 
+# The 'packed-refs' file is stored directly in .git/. This means it is global
+# to the repository, and can only contain refs that are shared across all
+# worktrees.
+test_expect_success 'refs/worktree must not be packed' '
+       test_commit initial &&
+       test_commit wt1 &&
+       test_commit wt2 &&
+       git worktree add wt1 wt1 &&
+       git worktree add wt2 wt2 &&
+       git checkout initial &&
+       git update-ref refs/worktree/foo HEAD &&
+       git -C wt1 update-ref refs/worktree/foo HEAD &&
+       git -C wt2 update-ref refs/worktree/foo HEAD &&
+       git pack-refs --all &&
+       test_path_is_missing .git/refs/tags/wt1 &&
+       test_path_is_file .git/refs/worktree/foo &&
+       test_path_is_file .git/worktrees/wt1/refs/worktree/foo &&
+       test_path_is_file .git/worktrees/wt2/refs/worktree/foo
+'
+
+# we do not want to count on running pack-refs to
+# actually pack it, as it is perfectly reasonable to
+# skip processing a broken ref
+test_expect_success 'create packed-refs file with broken ref' '
+       test_tick && git commit --allow-empty -m one &&
+       recoverable=$(git rev-parse HEAD) &&
+       test_tick && git commit --allow-empty -m two &&
+       missing=$(git rev-parse HEAD) &&
+       rm -f .git/refs/heads/main &&
+       cat >.git/packed-refs <<-EOF &&
+       $missing refs/heads/main
+       $recoverable refs/heads/other
+       EOF
+       echo $missing >expect &&
+       git rev-parse refs/heads/main >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'pack-refs does not silently delete broken packed ref' '
+       git pack-refs --all --prune &&
+       git rev-parse refs/heads/main >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'pack-refs does not drop broken refs during deletion' '
+       git update-ref -d refs/heads/other &&
+       git rev-parse refs/heads/main >actual &&
+       test_cmp expect actual
+'
+
 test_done
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
new file mode 100755 (executable)
index 0000000..6867811
--- /dev/null
@@ -0,0 +1,899 @@
+#!/bin/sh
+#
+# Copyright (c) 2020 Google LLC
+#
+
+test_description='reftable basics'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+if ! test_have_prereq REFTABLE
+then
+       skip_all='skipping reftable tests; set GIT_TEST_DEFAULT_REF_FORMAT=reftable'
+       test_done
+fi
+
+INVALID_OID=$(test_oid 001)
+
+test_expect_success 'init: creates basic reftable structures' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_path_is_dir repo/.git/reftable &&
+       test_path_is_file repo/.git/reftable/tables.list &&
+       echo reftable >expect &&
+       git -C repo rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'init: sha256 object format via environment variable' '
+       test_when_finished "rm -rf repo" &&
+       GIT_DEFAULT_HASH=sha256 git init repo &&
+       cat >expect <<-EOF &&
+       sha256
+       reftable
+       EOF
+       git -C repo rev-parse --show-object-format --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'init: sha256 object format via option' '
+       test_when_finished "rm -rf repo" &&
+       git init --object-format=sha256 repo &&
+       cat >expect <<-EOF &&
+       sha256
+       reftable
+       EOF
+       git -C repo rev-parse --show-object-format --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'init: reinitializing reftable backend succeeds' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo A &&
+
+       git -C repo for-each-ref >expect &&
+       git init --ref-format=reftable repo &&
+       git -C repo for-each-ref >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'init: reinitializing files with reftable backend fails' '
+       test_when_finished "rm -rf repo" &&
+       git init --ref-format=files repo &&
+       test_commit -C repo file &&
+
+       cp repo/.git/HEAD expect &&
+       test_must_fail git init --ref-format=reftable repo &&
+       test_cmp expect repo/.git/HEAD
+'
+
+test_expect_success 'init: reinitializing reftable with files backend fails' '
+       test_when_finished "rm -rf repo" &&
+       git init --ref-format=reftable repo &&
+       test_commit -C repo file &&
+
+       cp repo/.git/HEAD expect &&
+       test_must_fail git init --ref-format=files repo &&
+       test_cmp expect repo/.git/HEAD
+'
+
+test_expect_perms () {
+       local perms="$1"
+       local file="$2"
+       local actual=$(ls -l "$file") &&
+
+       case "$actual" in
+       $perms*)
+               : happy
+               ;;
+       *)
+               echo "$(basename $2) is not $perms but $actual"
+               false
+               ;;
+       esac
+}
+
+for umask in 002 022
+do
+       test_expect_success POSIXPERM 'init: honors core.sharedRepository' '
+               test_when_finished "rm -rf repo" &&
+               (
+                       umask $umask &&
+                       git init --shared=true repo &&
+                       test 1 = "$(git -C repo config core.sharedrepository)"
+               ) &&
+               test_expect_perms "-rw-rw-r--" repo/.git/reftable/tables.list &&
+               for table in repo/.git/reftable/*.ref
+               do
+                       test_expect_perms "-rw-rw-r--" "$table" ||
+                       return 1
+               done
+       '
+done
+
+test_expect_success 'clone: can clone reftable repository' '
+       test_when_finished "rm -rf repo clone" &&
+       git init repo &&
+       test_commit -C repo message1 file1 &&
+
+       git clone repo cloned &&
+       echo reftable >expect &&
+       git -C cloned rev-parse --show-ref-format >actual &&
+       test_cmp expect actual &&
+       test_path_is_file cloned/file1
+'
+
+test_expect_success 'clone: can clone reffiles into reftable repository' '
+       test_when_finished "rm -rf reffiles reftable" &&
+       git init --ref-format=files reffiles &&
+       test_commit -C reffiles A &&
+       git clone --ref-format=reftable ./reffiles reftable &&
+
+       git -C reffiles rev-parse HEAD >expect &&
+       git -C reftable rev-parse HEAD >actual &&
+       test_cmp expect actual &&
+
+       git -C reftable rev-parse --show-ref-format >actual &&
+       echo reftable >expect &&
+       test_cmp expect actual &&
+
+       git -C reffiles rev-parse --show-ref-format >actual &&
+       echo files >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'clone: can clone reftable into reffiles repository' '
+       test_when_finished "rm -rf reffiles reftable" &&
+       git init --ref-format=reftable reftable &&
+       test_commit -C reftable A &&
+       git clone --ref-format=files ./reftable reffiles &&
+
+       git -C reftable rev-parse HEAD >expect &&
+       git -C reffiles rev-parse HEAD >actual &&
+       test_cmp expect actual &&
+
+       git -C reftable rev-parse --show-ref-format >actual &&
+       echo reftable >expect &&
+       test_cmp expect actual &&
+
+       git -C reffiles rev-parse --show-ref-format >actual &&
+       echo files >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'ref transaction: corrupted tables cause failure' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit file1 &&
+               for f in .git/reftable/*.ref
+               do
+                       : >"$f" || return 1
+               done &&
+               test_must_fail git update-ref refs/heads/main HEAD
+       )
+'
+
+test_expect_success 'ref transaction: corrupted tables.list cause failure' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit file1 &&
+               echo garbage >.git/reftable/tables.list &&
+               test_must_fail git update-ref refs/heads/main HEAD
+       )
+'
+
+test_expect_success 'ref transaction: refuses to write ref causing F/D conflict' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo file &&
+       test_must_fail git -C repo update-ref refs/heads/main/forbidden
+'
+
+test_expect_success 'ref transaction: deleting ref with invalid name fails' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo file &&
+       test_must_fail git -C repo update-ref -d ../../my-private-file
+'
+
+test_expect_success 'ref transaction: can skip object ID verification' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_must_fail test-tool -C repo ref-store main update-ref msg refs/heads/branch $INVALID_OID $ZERO_OID 0 &&
+       test-tool -C repo ref-store main update-ref msg refs/heads/branch $INVALID_OID $ZERO_OID REF_SKIP_OID_VERIFICATION
+'
+
+test_expect_success 'ref transaction: updating same ref multiple times fails' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo A &&
+       cat >updates <<-EOF &&
+       update refs/heads/main $A
+       update refs/heads/main $A
+       EOF
+       cat >expect <<-EOF &&
+       fatal: multiple updates for ref ${SQ}refs/heads/main${SQ} not allowed
+       EOF
+       test_must_fail git -C repo update-ref --stdin <updates 2>err &&
+       test_cmp expect err
+'
+
+test_expect_success 'ref transaction: can delete symbolic self-reference with git-symbolic-ref(1)' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       git -C repo symbolic-ref refs/heads/self refs/heads/self &&
+       git -C repo symbolic-ref -d refs/heads/self
+'
+
+test_expect_success 'ref transaction: deleting symbolic self-reference without --no-deref fails' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       git -C repo symbolic-ref refs/heads/self refs/heads/self &&
+       cat >expect <<-EOF &&
+       error: multiple updates for ${SQ}refs/heads/self${SQ} (including one via symref ${SQ}refs/heads/self${SQ}) are not allowed
+       EOF
+       test_must_fail git -C repo update-ref -d refs/heads/self 2>err &&
+       test_cmp expect err
+'
+
+test_expect_success 'ref transaction: deleting symbolic self-reference with --no-deref succeeds' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       git -C repo symbolic-ref refs/heads/self refs/heads/self &&
+       git -C repo update-ref -d --no-deref refs/heads/self
+'
+
+test_expect_success 'ref transaction: creating symbolic ref fails with F/D conflict' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo A &&
+       cat >expect <<-EOF &&
+       error: unable to write symref for refs/heads: file/directory conflict
+       EOF
+       test_must_fail git -C repo symbolic-ref refs/heads refs/heads/foo 2>err &&
+       test_cmp expect err
+'
+
+test_expect_success 'ref transaction: ref deletion' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit file &&
+               HEAD_OID=$(git show-ref -s --verify HEAD) &&
+               cat >expect <<-EOF &&
+               $HEAD_OID refs/heads/main
+               $HEAD_OID refs/tags/file
+               EOF
+               git show-ref >actual &&
+               test_cmp expect actual &&
+
+               test_must_fail git update-ref -d refs/tags/file $INVALID_OID &&
+               git show-ref >actual &&
+               test_cmp expect actual &&
+
+               git update-ref -d refs/tags/file $HEAD_OID &&
+               echo "$HEAD_OID refs/heads/main" >expect &&
+               git show-ref >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'ref transaction: writes cause auto-compaction' '
+       test_when_finished "rm -rf repo" &&
+
+       git init repo &&
+       test_line_count = 1 repo/.git/reftable/tables.list &&
+
+       test_commit -C repo --no-tag A &&
+       test_line_count = 2 repo/.git/reftable/tables.list &&
+
+       test_commit -C repo --no-tag B &&
+       test_line_count = 1 repo/.git/reftable/tables.list
+'
+
+check_fsync_events () {
+       local trace="$1" &&
+       shift &&
+
+       cat >expect &&
+       sed -n \
+               -e '/^{"event":"counter",.*"category":"fsync",/ {
+                       s/.*"category":"fsync",//;
+                       s/}$//;
+                       p;
+               }' \
+               <"$trace" >actual &&
+       test_cmp expect actual
+}
+
+test_expect_success 'ref transaction: writes are synced' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo initial &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
+       GIT_TEST_FSYNC=true \
+               git -C repo -c core.fsync=reference \
+               -c core.fsyncMethod=fsync update-ref refs/heads/branch HEAD &&
+       check_fsync_events trace2.txt <<-EOF
+       "name":"hardware-flush","count":2
+       EOF
+'
+
+test_expect_success 'ref transaction: empty transaction in empty repo' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo --no-tag A &&
+       git -C repo update-ref -d refs/heads/main &&
+       test-tool -C repo ref-store main delete-refs REF_NO_DEREF msg HEAD &&
+       git -C repo update-ref --stdin <<-EOF
+       prepare
+       commit
+       EOF
+'
+
+test_expect_success 'pack-refs: compacts tables' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+
+       test_commit -C repo A &&
+       ls -1 repo/.git/reftable >table-files &&
+       test_line_count = 4 table-files &&
+       test_line_count = 3 repo/.git/reftable/tables.list &&
+
+       git -C repo pack-refs &&
+       ls -1 repo/.git/reftable >table-files &&
+       test_line_count = 2 table-files &&
+       test_line_count = 1 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'pack-refs: prunes stale tables' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       touch repo/.git/reftable/stale-table.ref &&
+       git -C repo pack-refs &&
+       test_path_is_missing repo/.git/reftable/stable-ref.ref
+'
+
+test_expect_success 'pack-refs: does not prune non-table files' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       touch repo/.git/reftable/garbage &&
+       git -C repo pack-refs &&
+       test_path_is_file repo/.git/reftable/garbage
+'
+
+for umask in 002 022
+do
+       test_expect_success POSIXPERM 'pack-refs: honors core.sharedRepository' '
+               test_when_finished "rm -rf repo" &&
+               (
+                       umask $umask &&
+                       git init --shared=true repo &&
+                       test_commit -C repo A &&
+                       test_line_count = 3 repo/.git/reftable/tables.list
+               ) &&
+               git -C repo pack-refs &&
+               test_expect_perms "-rw-rw-r--" repo/.git/reftable/tables.list &&
+               for table in repo/.git/reftable/*.ref
+               do
+                       test_expect_perms "-rw-rw-r--" "$table" ||
+                       return 1
+               done
+       '
+done
+
+test_expect_success 'packed-refs: writes are synced' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo initial &&
+       test_line_count = 2 table-files &&
+
+       : >trace2.txt &&
+       GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
+       GIT_TEST_FSYNC=true \
+               git -C repo -c core.fsync=reference \
+               -c core.fsyncMethod=fsync pack-refs &&
+       check_fsync_events trace2.txt <<-EOF
+       "name":"hardware-flush","count":2
+       EOF
+'
+
+test_expect_success 'ref iterator: bogus names are flagged' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit --no-tag file &&
+               test-tool ref-store main update-ref msg "refs/heads/bogus..name" $(git rev-parse HEAD) $ZERO_OID REF_SKIP_REFNAME_VERIFICATION &&
+
+               cat >expect <<-EOF &&
+               $ZERO_OID refs/heads/bogus..name 0xc
+               $(git rev-parse HEAD) refs/heads/main 0x0
+               EOF
+               test-tool ref-store main for-each-ref "" >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'ref iterator: missing object IDs are not flagged' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test-tool ref-store main update-ref msg "refs/heads/broken-hash" $INVALID_OID $ZERO_OID REF_SKIP_OID_VERIFICATION &&
+
+               cat >expect <<-EOF &&
+               $INVALID_OID refs/heads/broken-hash 0x0
+               EOF
+               test-tool ref-store main for-each-ref "" >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'basic: commit and list refs' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo file &&
+       test_write_lines refs/heads/main refs/tags/file >expect &&
+       git -C repo for-each-ref --format="%(refname)" >actual &&
+       test_cmp actual expect
+'
+
+test_expect_success 'basic: can write large commit message' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       perl -e "
+               print \"this is a long commit message\" x 50000
+       " >commit-msg &&
+       git -C repo commit --allow-empty --file=../commit-msg
+'
+
+test_expect_success 'basic: show-ref fails with empty repository' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_must_fail git -C repo show-ref >actual &&
+       test_must_be_empty actual
+'
+
+test_expect_success 'basic: can check out unborn branch' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       git -C repo checkout -b main
+'
+
+test_expect_success 'basic: peeled tags are stored' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       test_commit -C repo file &&
+       git -C repo tag -m "annotated tag" test_tag HEAD &&
+       for ref in refs/heads/main refs/tags/file refs/tags/test_tag refs/tags/test_tag^{}
+       do
+               echo "$(git -C repo rev-parse "$ref") $ref" || return 1
+       done >expect &&
+       git -C repo show-ref -d >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'basic: for-each-ref can print symrefs' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit file &&
+               git branch &&
+               git symbolic-ref refs/heads/sym refs/heads/main &&
+               cat >expected <<-EOF &&
+               refs/heads/main
+               EOF
+               git for-each-ref --format="%(symref)" refs/heads/sym >actual &&
+               test_cmp expected actual
+       )
+'
+
+test_expect_success 'basic: notes' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               write_script fake_editor <<-\EOF &&
+               echo "$MSG" >"$1"
+               echo "$MSG" >&2
+               EOF
+
+               test_commit 1st &&
+               test_commit 2nd &&
+               GIT_EDITOR=./fake_editor MSG=b4 git notes add &&
+               GIT_EDITOR=./fake_editor MSG=b3 git notes edit &&
+               echo b4 >expect &&
+               git notes --ref commits@{1} show >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'basic: stash' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit file &&
+               git stash list >expect &&
+               test_line_count = 0 expect &&
+
+               echo hoi >>file.t &&
+               git stash push -m stashed &&
+               git stash list >expect &&
+               test_line_count = 1 expect &&
+
+               git stash clear &&
+               git stash list >expect &&
+               test_line_count = 0 expect
+       )
+'
+
+test_expect_success 'basic: cherry-pick' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit message1 file1 &&
+               test_commit message2 file2 &&
+               git branch source &&
+               git checkout HEAD^ &&
+               test_commit message3 file3 &&
+               git cherry-pick source &&
+               test_path_is_file file2
+       )
+'
+
+test_expect_success 'basic: rebase' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit message1 file1 &&
+               test_commit message2 file2 &&
+               git branch source &&
+               git checkout HEAD^ &&
+               test_commit message3 file3 &&
+               git rebase source &&
+               test_path_is_file file2
+       )
+'
+
+test_expect_success 'reflog: can delete separate reflog entries' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+
+               test_commit file &&
+               test_commit file2 &&
+               test_commit file3 &&
+               test_commit file4 &&
+               git reflog >actual &&
+               grep file3 actual &&
+
+               git reflog delete HEAD@{1} &&
+               git reflog >actual &&
+               ! grep file3 actual
+       )
+'
+
+test_expect_success 'reflog: can switch to previous branch' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit file1 &&
+               git checkout -b branch1 &&
+               test_commit file2 &&
+               git checkout -b branch2 &&
+               git switch - &&
+               git rev-parse --symbolic-full-name HEAD >actual &&
+               echo refs/heads/branch1 >expect &&
+               test_cmp actual expect
+       )
+'
+
+test_expect_success 'reflog: copying branch writes reflog entry' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit file1 &&
+               test_commit file2 &&
+               oid=$(git rev-parse --short HEAD) &&
+               git branch src &&
+               cat >expect <<-EOF &&
+               ${oid} dst@{0}: Branch: copied refs/heads/src to refs/heads/dst
+               ${oid} dst@{1}: branch: Created from main
+               EOF
+               git branch -c src dst &&
+               git reflog dst >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'reflog: renaming branch writes reflog entry' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               git symbolic-ref HEAD refs/heads/before &&
+               test_commit file &&
+               git show-ref >expected.refs &&
+               sed s/before/after/g <expected.refs >expected &&
+               git branch -M after &&
+               git show-ref >actual &&
+               test_cmp expected actual &&
+               echo refs/heads/after >expected &&
+               git symbolic-ref HEAD >actual &&
+               test_cmp expected actual
+       )
+'
+
+test_expect_success 'reflog: can store empty logs' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+
+               test_must_fail test-tool ref-store main reflog-exists refs/heads/branch &&
+               test-tool ref-store main create-reflog refs/heads/branch &&
+               test-tool ref-store main reflog-exists refs/heads/branch &&
+               test-tool ref-store main for-each-reflog-ent-reverse refs/heads/branch >actual &&
+               test_must_be_empty actual
+       )
+'
+
+test_expect_success 'reflog: expiry empties reflog' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+
+               test_commit initial &&
+               git checkout -b branch &&
+               test_commit fileA &&
+               test_commit fileB &&
+
+               cat >expect <<-EOF &&
+               commit: fileB
+               commit: fileA
+               branch: Created from HEAD
+               EOF
+               git reflog show --format="%gs" refs/heads/branch >actual &&
+               test_cmp expect actual &&
+
+               git reflog expire branch --expire=all &&
+               git reflog show --format="%gs" refs/heads/branch >actual &&
+               test_must_be_empty actual &&
+               test-tool ref-store main reflog-exists refs/heads/branch
+       )
+'
+
+test_expect_success 'reflog: can be deleted' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit initial &&
+               test-tool ref-store main reflog-exists refs/heads/main &&
+               test-tool ref-store main delete-reflog refs/heads/main &&
+               test_must_fail test-tool ref-store main reflog-exists refs/heads/main
+       )
+'
+
+test_expect_success 'reflog: garbage collection deletes reflog entries' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+
+               for count in $(test_seq 1 10)
+               do
+                       test_commit "number $count" file.t $count number-$count ||
+                       return 1
+               done &&
+               git reflog refs/heads/main >actual &&
+               test_line_count = 10 actual &&
+               grep "commit (initial): number 1" actual &&
+               grep "commit: number 10" actual &&
+
+               git gc &&
+               git reflog refs/heads/main >actual &&
+               test_line_count = 0 actual
+       )
+'
+
+test_expect_success 'reflog: updates via HEAD update HEAD reflog' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit main-one &&
+               git checkout -b new-branch &&
+               test_commit new-one &&
+               test_commit new-two &&
+
+               echo new-one >expect &&
+               git log -1 --format=%s HEAD@{1} >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'worktree: adding worktree creates separate stack' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo A &&
+
+       git -C repo worktree add ../worktree &&
+       test_path_is_file repo/.git/worktrees/worktree/refs/heads &&
+       echo "ref: refs/heads/.invalid" >expect &&
+       test_cmp expect repo/.git/worktrees/worktree/HEAD &&
+       test_path_is_dir repo/.git/worktrees/worktree/reftable &&
+       test_path_is_file repo/.git/worktrees/worktree/reftable/tables.list
+'
+
+test_expect_success 'worktree: pack-refs in main repo packs main refs' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo A &&
+       git -C repo worktree add ../worktree &&
+
+       test_line_count = 3 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 4 repo/.git/reftable/tables.list &&
+       git -C repo pack-refs &&
+       test_line_count = 3 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'worktree: pack-refs in worktree packs worktree refs' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo A &&
+       git -C repo worktree add ../worktree &&
+
+       test_line_count = 3 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 4 repo/.git/reftable/tables.list &&
+       git -C worktree pack-refs &&
+       test_line_count = 1 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 4 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'worktree: creating shared ref updates main stack' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo A &&
+
+       git -C repo worktree add ../worktree &&
+       git -C repo pack-refs &&
+       git -C worktree pack-refs &&
+       test_line_count = 1 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list &&
+
+       git -C worktree update-ref refs/heads/shared HEAD &&
+       test_line_count = 1 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 2 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'worktree: creating per-worktree ref updates worktree stack' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo A &&
+
+       git -C repo worktree add ../worktree &&
+       git -C repo pack-refs &&
+       git -C worktree pack-refs &&
+       test_line_count = 1 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list &&
+
+       git -C worktree update-ref refs/bisect/per-worktree HEAD &&
+       test_line_count = 2 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'worktree: creating per-worktree ref from main repo' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo A &&
+
+       git -C repo worktree add ../worktree &&
+       git -C repo pack-refs &&
+       git -C worktree pack-refs &&
+       test_line_count = 1 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list &&
+
+       git -C repo update-ref worktrees/worktree/refs/bisect/per-worktree HEAD &&
+       test_line_count = 2 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'worktree: creating per-worktree ref from second worktree' '
+       test_when_finished "rm -rf repo wt1 wt2" &&
+       git init repo &&
+       test_commit -C repo A &&
+
+       git -C repo worktree add ../wt1 &&
+       git -C repo worktree add ../wt2 &&
+       git -C repo pack-refs &&
+       git -C wt1 pack-refs &&
+       git -C wt2 pack-refs &&
+       test_line_count = 1 repo/.git/worktrees/wt1/reftable/tables.list &&
+       test_line_count = 1 repo/.git/worktrees/wt2/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list &&
+
+       git -C wt1 update-ref worktrees/wt2/refs/bisect/per-worktree HEAD &&
+       test_line_count = 1 repo/.git/worktrees/wt1/reftable/tables.list &&
+       test_line_count = 2 repo/.git/worktrees/wt2/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'worktree: can create shared and per-worktree ref in one transaction' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo A &&
+
+       git -C repo worktree add ../worktree &&
+       git -C repo pack-refs &&
+       git -C worktree pack-refs &&
+       test_line_count = 1 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 1 repo/.git/reftable/tables.list &&
+
+       cat >stdin <<-EOF &&
+       create worktrees/worktree/refs/bisect/per-worktree HEAD
+       create refs/branches/shared HEAD
+       EOF
+       git -C repo update-ref --stdin <stdin &&
+       test_line_count = 2 repo/.git/worktrees/worktree/reftable/tables.list &&
+       test_line_count = 2 repo/.git/reftable/tables.list
+'
+
+test_expect_success 'worktree: can access common refs' '
+       test_when_finished "rm -rf repo worktree" &&
+       git init repo &&
+       test_commit -C repo file1 &&
+       git -C repo branch branch1 &&
+       git -C repo worktree add ../worktree &&
+
+       echo refs/heads/worktree >expect &&
+       git -C worktree symbolic-ref HEAD >actual &&
+       test_cmp expect actual &&
+       git -C worktree checkout branch1
+'
+
+test_expect_success 'worktree: adds worktree with detached HEAD' '
+       test_when_finished "rm -rf repo worktree" &&
+
+       git init repo &&
+       test_commit -C repo A &&
+       git -C repo rev-parse main >expect &&
+
+       git -C repo worktree add --detach ../worktree main &&
+       git -C worktree rev-parse HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'fetch: accessing FETCH_HEAD special ref works' '
+       test_when_finished "rm -rf repo sub" &&
+
+       git init sub &&
+       test_commit -C sub two &&
+       git -C sub rev-parse HEAD >expect &&
+
+       git init repo &&
+       test_commit -C repo one &&
+       git -C repo fetch ../sub &&
+       git -C repo rev-parse FETCH_HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_done
diff --git a/t/t0611-reftable-httpd.sh b/t/t0611-reftable-httpd.sh
new file mode 100755 (executable)
index 0000000..5e05b9c
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+test_description='reftable HTTPD tests'
+
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-httpd.sh
+
+start_httpd
+
+REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo"
+
+test_expect_success 'serving ls-remote' '
+       git init --ref-format=reftable -b main "$REPO" &&
+       cd "$REPO" &&
+       test_commit m1 &&
+       >.git/git-daemon-export-ok &&
+       git ls-remote "http://127.0.0.1:$LIB_HTTPD_PORT/smart/repo" | cut -f 2-2 -d "   " >actual &&
+       cat >expect <<-EOF &&
+       HEAD
+       refs/heads/main
+       refs/tags/m1
+       EOF
+       test_cmp actual expect
+'
+
+test_done
index 23d3d37283bbce7ea336f3a448815ff97c43ad0d..e12b2219721c4e9e1f29dd5eeb2e9b787d9b78db 100755 (executable)
@@ -6,7 +6,7 @@ test_description='git cat-file'
 
 test_cmdmode_usage () {
        test_expect_code 129 "$@" 2>err &&
-       grep "^error:.*is incompatible with" err
+       grep "^error: .* cannot be used together" err
 }
 
 for switches in \
@@ -1157,6 +1157,42 @@ test_expect_success 'cat-file --batch="batman" with --batch-all-objects will wor
        cmp expect actual
 '
 
+test_expect_success 'cat-file %(objectsize:disk) with --batch-all-objects' '
+       # our state has both loose and packed objects,
+       # so find both for our expected output
+       {
+               find .git/objects/?? -type f |
+               awk -F/ "{ print \$0, \$3\$4 }" |
+               while read path oid
+               do
+                       size=$(test_file_size "$path") &&
+                       echo "$oid $size" ||
+                       return 1
+               done &&
+               rawsz=$(test_oid rawsz) &&
+               find .git/objects/pack -name "*.idx" |
+               while read idx
+               do
+                       git show-index <"$idx" >idx.raw &&
+                       sort -nr <idx.raw >idx.sorted &&
+                       packsz=$(test_file_size "${idx%.idx}.pack") &&
+                       end=$((packsz - rawsz)) &&
+                       while read start oid rest
+                       do
+                               size=$((end - start)) &&
+                               end=$start &&
+                               echo "$oid $size" ||
+                               return 1
+                       done <idx.sorted ||
+                       return 1
+               done
+       } >expect.raw &&
+       sort <expect.raw >expect &&
+       git cat-file --batch-all-objects \
+               --batch-check="%(objectname) %(objectsize:disk)" >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'set up replacement object' '
        orig=$(git rev-parse HEAD) &&
        git cat-file commit $orig >orig &&
index ac3d173767ae72be7bc43e4df269d88fb040f7ba..64aea3848606ccda03b5dd82f878e8d1e8351706 100755 (executable)
@@ -124,8 +124,8 @@ test_expect_success 'check that appropriate filter is invoke when --path is used
        path0_sha=$(git hash-object --path=file0 file1) &&
        test "$file0_sha" = "$path0_sha" &&
        test "$file1_sha" = "$path1_sha" &&
-       path1_sha=$(cat file0 | git hash-object --path=file1 --stdin) &&
-       path0_sha=$(cat file1 | git hash-object --path=file0 --stdin) &&
+       path1_sha=$(git hash-object --path=file1 --stdin <file0) &&
+       path0_sha=$(git hash-object --path=file0 --stdin <file1) &&
        test "$file0_sha" = "$path0_sha" &&
        test "$file1_sha" = "$path1_sha"
 '
@@ -154,7 +154,7 @@ test_expect_success '--path works in a subdirectory' '
 test_expect_success 'check that --no-filters option works' '
        nofilters_file1=$(git hash-object --no-filters file1) &&
        test "$file0_sha" = "$nofilters_file1" &&
-       nofilters_file1=$(cat file1 | git hash-object --stdin) &&
+       nofilters_file1=$(git hash-object --stdin <file1) &&
        test "$file0_sha" = "$nofilters_file1"
 '
 
index 35261afc9d6d02fe1d9d1572591406b293522fa8..5e0f0a334f4d43dd76199a50037c5900da2cb63b 100755 (executable)
@@ -125,7 +125,7 @@ test_expect_success 'fetch into corrupted repo with index-pack' '
                cd bit-error-cp &&
                test_must_fail git -c transfer.unpackLimit=1 \
                        fetch ../no-bit-error 2>stderr &&
-               test_i18ngrep ! -i collision stderr
+               test_grep ! -i collision stderr
        )
 '
 
index 9ceb17f911891964aa5e3a2837a2739bead2bc3c..ab3a105ffff2532b35074611de9e65d60b8db082 100755 (executable)
@@ -47,7 +47,7 @@ test_expect_success 'setup' '
 test_expect_success 'git sparse-checkout list (not sparse)' '
        test_must_fail git -C repo sparse-checkout list >list 2>err &&
        test_must_be_empty list &&
-       test_i18ngrep "this worktree is not sparse" err
+       test_grep "this worktree is not sparse" err
 '
 
 test_expect_success 'git sparse-checkout list (not sparse)' '
@@ -55,7 +55,7 @@ test_expect_success 'git sparse-checkout list (not sparse)' '
        rm repo/.git/info/sparse-checkout &&
        git -C repo sparse-checkout list >list 2>err &&
        test_must_be_empty list &&
-       test_i18ngrep "this worktree is not sparse (sparse-checkout file may not exist)" err
+       test_grep "this worktree is not sparse (sparse-checkout file may not exist)" err
 '
 
 test_expect_success 'git sparse-checkout list (populated)' '
@@ -230,7 +230,7 @@ test_expect_success 'cone mode: match patterns' '
        git -C repo config --worktree core.sparseCheckoutCone true &&
        rm -rf repo/a repo/folder1 repo/folder2 &&
        git -C repo read-tree -mu HEAD 2>err &&
-       test_i18ngrep ! "disabling cone patterns" err &&
+       test_grep ! "disabling cone patterns" err &&
        git -C repo reset --hard &&
        check_files repo a folder1 folder2
 '
@@ -240,7 +240,7 @@ test_expect_success 'cone mode: warn on bad pattern' '
        cp repo/.git/info/sparse-checkout . &&
        echo "!/deep/deeper/*/" >>repo/.git/info/sparse-checkout &&
        git -C repo read-tree -mu HEAD 2>err &&
-       test_i18ngrep "unrecognized negative pattern" err
+       test_grep "unrecognized negative pattern" err
 '
 
 test_expect_success 'sparse-checkout disable' '
@@ -283,7 +283,7 @@ test_expect_success 'sparse-index enabled and disabled' '
 test_expect_success 'cone mode: init and set' '
        git -C repo sparse-checkout init --cone &&
        git -C repo config --list >config &&
-       test_i18ngrep "core.sparsecheckoutcone=true" config &&
+       test_grep "core.sparsecheckoutcone=true" config &&
        list_files repo >dir  &&
        echo a >expect &&
        test_cmp expect dir &&
@@ -334,7 +334,7 @@ test_expect_success 'cone mode: set with nested folders' '
 
 test_expect_success 'cone mode: add independent path' '
        git -C repo sparse-checkout set deep/deeper1 &&
-       git -C repo sparse-checkout add folder1 &&
+       git -C repo sparse-checkout add --end-of-options folder1 &&
        cat >expect <<-\EOF &&
        /*
        !/*/
@@ -386,7 +386,7 @@ test_expect_success 'not-up-to-date does not block rest of sparsification' '
 
        git -C repo sparse-checkout set deep/deeper1 2>err &&
 
-       test_i18ngrep "The following paths are not up to date" err &&
+       test_grep "The following paths are not up to date" err &&
        test_cmp expect repo/.git/info/sparse-checkout &&
        check_files repo/deep a deeper1 deeper2 &&
        check_files repo/deep/deeper1 a deepest &&
@@ -401,8 +401,8 @@ test_expect_success 'revert to old sparse-checkout on empty update' '
                git add file &&
                git commit -m "test" &&
                git sparse-checkout set nothing 2>err &&
-               test_i18ngrep ! "Sparse checkout leaves no entry on working directory" err &&
-               test_i18ngrep ! ".git/index.lock" err &&
+               test_grep ! "Sparse checkout leaves no entry on working directory" err &&
+               test_grep ! ".git/index.lock" err &&
                git sparse-checkout set --no-cone file
        )
 '
@@ -411,14 +411,14 @@ test_expect_success 'fail when lock is taken' '
        test_when_finished rm -rf repo/.git/info/sparse-checkout.lock &&
        touch repo/.git/info/sparse-checkout.lock &&
        test_must_fail git -C repo sparse-checkout set deep 2>err &&
-       test_i18ngrep "Unable to create .*\.lock" err
+       test_grep "Unable to create .*\.lock" err
 '
 
 test_expect_success '.gitignore should not warn about cone mode' '
        git -C repo config --worktree core.sparseCheckoutCone true &&
        echo "**/bin/*" >repo/.gitignore &&
        git -C repo reset --hard 2>err &&
-       test_i18ngrep ! "disabling cone patterns" err
+       test_grep ! "disabling cone patterns" err
 '
 
 test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status' '
@@ -426,10 +426,10 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status'
        echo dirty >dirty/folder1/a &&
 
        git -C dirty sparse-checkout init --no-cone 2>err &&
-       test_i18ngrep "warning.*The following paths are not up to date" err &&
+       test_grep "warning.*The following paths are not up to date" err &&
 
        git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* 2>err &&
-       test_i18ngrep "warning.*The following paths are not up to date" err &&
+       test_grep "warning.*The following paths are not up to date" err &&
        test_path_is_file dirty/folder1/a &&
 
        git -C dirty sparse-checkout disable 2>err &&
@@ -453,14 +453,14 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with unmerged stat
        git -C unmerged update-index --index-info <input &&
 
        git -C unmerged sparse-checkout init --no-cone 2>err &&
-       test_i18ngrep "warning.*The following paths are unmerged" err &&
+       test_grep "warning.*The following paths are unmerged" err &&
 
        git -C unmerged sparse-checkout set /folder2/* /deep/deeper1/* 2>err &&
-       test_i18ngrep "warning.*The following paths are unmerged" err &&
+       test_grep "warning.*The following paths are unmerged" err &&
        test_path_is_file dirty/folder1/a &&
 
        git -C unmerged sparse-checkout disable 2>err &&
-       test_i18ngrep "warning.*The following paths are unmerged" err &&
+       test_grep "warning.*The following paths are unmerged" err &&
 
        git -C unmerged reset --hard &&
        git -C unmerged sparse-checkout init --no-cone &&
@@ -480,24 +480,24 @@ test_expect_failure 'sparse-checkout reapply' '
        git -C tweak update-index --index-info <input &&
 
        git -C tweak sparse-checkout init --cone 2>err &&
-       test_i18ngrep "warning.*The following paths are not up to date" err &&
-       test_i18ngrep "warning.*The following paths are unmerged" err &&
+       test_grep "warning.*The following paths are not up to date" err &&
+       test_grep "warning.*The following paths are unmerged" err &&
 
        git -C tweak sparse-checkout set folder2 deep/deeper1 2>err &&
-       test_i18ngrep "warning.*The following paths are not up to date" err &&
-       test_i18ngrep "warning.*The following paths are unmerged" err &&
+       test_grep "warning.*The following paths are not up to date" err &&
+       test_grep "warning.*The following paths are unmerged" err &&
 
        git -C tweak sparse-checkout reapply 2>err &&
-       test_i18ngrep "warning.*The following paths are not up to date" err &&
+       test_grep "warning.*The following paths are not up to date" err &&
        test_path_is_file tweak/deep/deeper2/a &&
-       test_i18ngrep "warning.*The following paths are unmerged" err &&
+       test_grep "warning.*The following paths are unmerged" err &&
        test_path_is_file tweak/folder1/a &&
 
        git -C tweak checkout HEAD deep/deeper2/a &&
        git -C tweak sparse-checkout reapply 2>err &&
-       test_i18ngrep ! "warning.*The following paths are not up to date" err &&
+       test_grep ! "warning.*The following paths are not up to date" err &&
        test_path_is_missing tweak/deep/deeper2/a &&
-       test_i18ngrep "warning.*The following paths are unmerged" err &&
+       test_grep "warning.*The following paths are unmerged" err &&
        test_path_is_file tweak/folder1/a &&
 
        # NEEDSWORK: We are asking to update a file outside of the
@@ -578,8 +578,8 @@ test_expect_success 'check-rules interaction with submodules' '
        git -C super ls-tree --name-only -r HEAD >all-files &&
        git -C super sparse-checkout check-rules >check-rules-matches <all-files &&
 
-       test_i18ngrep ! "modules/" check-rules-matches &&
-       test_i18ngrep "folder1/" check-rules-matches
+       test_grep ! "modules/" check-rules-matches &&
+       test_grep "folder1/" check-rules-matches
 '
 
 test_expect_success 'different sparse-checkouts with worktrees' '
@@ -616,7 +616,7 @@ check_read_tree_errors () {
        then
                test_must_be_empty err
        else
-               test_i18ngrep "$ERRORS" err
+               test_grep "$ERRORS" err
        fi &&
        check_files $REPO $FILES
 }
@@ -886,6 +886,12 @@ test_expect_success 'by default, cone mode will error out when passed files' '
        grep ".gitignore.*is not a directory" error
 '
 
+test_expect_success 'error on mistyped command line options' '
+       test_must_fail git -C repo sparse-checkout add --sikp-checks .gitignore 2>error &&
+
+       grep "unknown option.*sikp-checks" error
+'
+
 test_expect_success 'by default, non-cone mode will warn on individual files' '
        git -C repo sparse-checkout reapply --no-cone &&
        git -C repo sparse-checkout add .gitignore 2>warning &&
@@ -898,32 +904,32 @@ test_expect_success 'setup bare repo' '
 '
 test_expect_success 'list fails outside work tree' '
        test_must_fail git -C bare sparse-checkout list 2>err &&
-       test_i18ngrep "this operation must be run in a work tree" err
+       test_grep "this operation must be run in a work tree" err
 '
 
 test_expect_success 'add fails outside work tree' '
        test_must_fail git -C bare sparse-checkout add deeper 2>err &&
-       test_i18ngrep "this operation must be run in a work tree" err
+       test_grep "this operation must be run in a work tree" err
 '
 
 test_expect_success 'set fails outside work tree' '
        test_must_fail git -C bare sparse-checkout set deeper 2>err &&
-       test_i18ngrep "this operation must be run in a work tree" err
+       test_grep "this operation must be run in a work tree" err
 '
 
 test_expect_success 'init fails outside work tree' '
        test_must_fail git -C bare sparse-checkout init 2>err &&
-       test_i18ngrep "this operation must be run in a work tree" err
+       test_grep "this operation must be run in a work tree" err
 '
 
 test_expect_success 'reapply fails outside work tree' '
        test_must_fail git -C bare sparse-checkout reapply 2>err &&
-       test_i18ngrep "this operation must be run in a work tree" err
+       test_grep "this operation must be run in a work tree" err
 '
 
 test_expect_success 'disable fails outside work tree' '
        test_must_fail git -C bare sparse-checkout disable 2>err &&
-       test_i18ngrep "this operation must be run in a work tree" err
+       test_grep "this operation must be run in a work tree" err
 '
 
 test_expect_success 'setup clean' '
@@ -946,8 +952,8 @@ test_expect_success 'check-rules cone mode' '
 
        git -C repo sparse-checkout check-rules >check-rules-default <all-files &&
 
-       test_i18ngrep "deep/deeper1/deepest/a" check-rules-file &&
-       test_i18ngrep ! "deep/deeper2" check-rules-file &&
+       test_grep "deep/deeper1/deepest/a" check-rules-file &&
+       test_grep ! "deep/deeper2" check-rules-file &&
 
        test_cmp check-rules-file ls-files &&
        test_cmp check-rules-file check-rules-default
@@ -962,7 +968,7 @@ test_expect_success 'check-rules non-cone mode' '
        git -C bare sparse-checkout check-rules --no-cone --rules-file ../rules\
                >check-rules-file <all-files &&
 
-       cat rules | git -C repo sparse-checkout set --no-cone --stdin &&
+       git -C repo sparse-checkout set --no-cone --stdin <rules &&
        git -C repo ls-files -t >out &&
        sed -n "/^S /!s/^. //p" out >ls-files &&
 
index 8a95adf4b50de6b543598ceac84f8515d9442f4d..2f1ae5fd3bc409a1109216d1562456fe11564306 100755 (executable)
@@ -337,8 +337,8 @@ test_expect_success 'status reports sparse-checkout' '
        init_repos &&
        git -C sparse-checkout status >full &&
        git -C sparse-index status >sparse &&
-       test_i18ngrep "You are in a sparse checkout with " full &&
-       test_i18ngrep "You are in a sparse checkout." sparse
+       test_grep "You are in a sparse checkout with " full &&
+       test_grep "You are in a sparse checkout." sparse
 '
 
 test_expect_success 'add, commit, checkout' '
@@ -1182,7 +1182,7 @@ test_expect_success 'checkout-index outside sparse definition' '
        # Without --ignore-skip-worktree-bits, outside-of-cone files will trigger
        # an error
        test_sparse_match test_must_fail git checkout-index -- folder1/a &&
-       test_i18ngrep "folder1/a has skip-worktree enabled" sparse-checkout-err &&
+       test_grep "folder1/a has skip-worktree enabled" sparse-checkout-err &&
        test_path_is_missing folder1/a &&
 
        # With --ignore-skip-worktree-bits, outside-of-cone files are checked out
@@ -2259,4 +2259,76 @@ test_expect_success 'worktree is not expanded' '
        ensure_not_expanded worktree remove .worktrees/hotfix
 '
 
+test_expect_success 'check-attr with pathspec inside sparse definition' '
+       init_repos &&
+
+       echo "a -crlf myAttr" >>.gitattributes &&
+       run_on_all cp ../.gitattributes ./deep &&
+
+       test_all_match git check-attr -a -- deep/a &&
+
+       test_all_match git add deep/.gitattributes &&
+       test_all_match git check-attr -a --cached -- deep/a
+'
+
+test_expect_success 'check-attr with pathspec outside sparse definition' '
+       init_repos &&
+
+       echo "a -crlf myAttr" >>.gitattributes &&
+       run_on_sparse mkdir folder1 &&
+       run_on_all cp ../.gitattributes ./folder1 &&
+       run_on_all cp a folder1/a &&
+
+       test_all_match git check-attr -a -- folder1/a &&
+
+       git -C full-checkout add folder1/.gitattributes &&
+       test_sparse_match git add --sparse folder1/.gitattributes &&
+       test_all_match git commit -m "add .gitattributes" &&
+       test_sparse_match git sparse-checkout reapply &&
+       test_all_match git check-attr -a --cached -- folder1/a
+'
+
+# NEEDSWORK: The 'diff --check' test is left as 'test_expect_failure' due
+# to an underlying issue in oneway_diff() within diff-lib.c.
+# 'do_oneway_diff()' is not called as expected for paths that could match
+# inside of a sparse directory. Specifically, the 'ce_path_match()' function
+# fails to recognize files inside a sparse directory (e.g., when 'folder1/'
+# is a sparse directory, 'folder1/a' cannot be recognized). The goal is to
+# proceed with 'do_oneway_diff()' if the pathspec could match inside of a
+# sparse directory.
+test_expect_failure 'diff --check with pathspec outside sparse definition' '
+       init_repos &&
+
+       write_script edit-contents <<-\EOF &&
+       echo "a " >"$1"
+       EOF
+
+       test_all_match git config core.whitespace -trailing-space,-space-before-tab &&
+
+       echo "a whitespace=trailing-space,space-before-tab" >>.gitattributes &&
+       run_on_all mkdir -p folder1 &&
+       run_on_all cp ../.gitattributes ./folder1 &&
+       test_all_match git add --sparse folder1/.gitattributes &&
+       run_on_all ../edit-contents folder1/a &&
+       test_all_match git add --sparse folder1/a &&
+
+       test_sparse_match git sparse-checkout reapply &&
+       test_all_match test_must_fail git diff --check --cached -- folder1/a
+'
+
+test_expect_success 'sparse-index is not expanded: check-attr' '
+       init_repos &&
+
+       echo "a -crlf myAttr" >>.gitattributes &&
+       mkdir ./sparse-index/folder1 &&
+       cp ./sparse-index/a ./sparse-index/folder1/a &&
+       cp .gitattributes ./sparse-index/deep &&
+       cp .gitattributes ./sparse-index/folder1 &&
+
+       git -C sparse-index add deep/.gitattributes &&
+       git -C sparse-index add --sparse folder1/.gitattributes &&
+       ensure_not_expanded check-attr -a --cached -- deep/a &&
+       ensure_not_expanded check-attr -a --cached -- folder1/a
+'
+
 test_done
index 387d336c91f44e58d1e5073febdae266156212c8..31c38786870849e7a815f32a08933f059c9c8ffb 100755 (executable)
@@ -453,7 +453,7 @@ test_expect_success 'get bool variable with empty value' '
 
 test_expect_success 'no arguments, but no crash' '
        test_must_fail git config >output 2>&1 &&
-       test_i18ngrep usage output
+       test_grep usage output
 '
 
 cat > .git/config << EOF
@@ -720,25 +720,25 @@ test_expect_success 'invalid unit' '
        git config aninvalid.unit "1auto" &&
        test_cmp_config 1auto aninvalid.unit &&
        test_must_fail git config --int --get aninvalid.unit 2>actual &&
-       test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
+       test_grep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
 '
 
 test_expect_success 'invalid unit boolean' '
        git config commit.gpgsign "1true" &&
        test_cmp_config 1true commit.gpgsign &&
        test_must_fail git config --bool --get commit.gpgsign 2>actual &&
-       test_i18ngrep "bad boolean config value .1true. for .commit.gpgsign." actual
+       test_grep "bad boolean config value .1true. for .commit.gpgsign." actual
 '
 
 test_expect_success 'line number is reported correctly' '
        printf "[bool]\n\tvar\n" >invalid &&
        test_must_fail git config -f invalid --path bool.var 2>actual &&
-       test_i18ngrep "line 2" actual
+       test_grep "line 2" actual
 '
 
 test_expect_success 'invalid stdin config' '
        echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
-       test_i18ngrep "bad config line 1 in standard input" output
+       test_grep "bad config line 1 in standard input" output
 '
 
 cat > expect << EOF
@@ -919,7 +919,7 @@ test_expect_success !MINGW 'get --path copes with unset $HOME' '
                git config --get --path path.normal >>result &&
                git config --get --path path.trailingtilde >>result
        ) &&
-       test_i18ngrep "[Ff]ailed to expand.*~/" msg &&
+       test_grep "[Ff]ailed to expand.*~/" msg &&
        test_cmp expect result
 '
 
@@ -986,7 +986,7 @@ test_expect_success 'get --type=color barfs on non-color' '
 
 test_expect_success 'set --type=color barfs on non-color' '
        test_must_fail git config --type=color foo.color "not-a-color" 2>error &&
-       test_i18ngrep "cannot parse color" error
+       test_grep "cannot parse color" error
 '
 
 cat > expect << EOF
@@ -1098,15 +1098,20 @@ test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
        test_must_fail git config --file=linktolinktonada --list
 '
 
-test_expect_success 'check split_cmdline return' "
-       git config alias.split-cmdline-fix 'echo \"' &&
-       test_must_fail git split-cmdline-fix &&
-       echo foo > foo &&
-       git add foo &&
-       git commit -m 'initial commit' &&
-       git config branch.main.mergeoptions 'echo \"' &&
-       test_must_fail git merge main
-"
+test_expect_success 'check split_cmdline return' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               git config alias.split-cmdline-fix "echo \"" &&
+               test_must_fail git split-cmdline-fix &&
+               echo foo >foo &&
+               git add foo &&
+               git commit -m "initial commit" &&
+               git config branch.main.mergeoptions "echo \"" &&
+               test_must_fail git merge main
+       )
+'
 
 test_expect_success 'git -c "key=value" support' '
        cat >expect <<-\EOF &&
@@ -1157,10 +1162,16 @@ test_expect_success 'git -c works with aliases of builtins' '
 '
 
 test_expect_success 'aliases can be CamelCased' '
-       test_config alias.CamelCased "rev-parse HEAD" &&
-       git CamelCased >out &&
-       git rev-parse HEAD >expect &&
-       test_cmp expect out
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A &&
+               git config alias.CamelCased "rev-parse HEAD" &&
+               git CamelCased >out &&
+               git rev-parse HEAD >expect &&
+               test_cmp expect out
+       )
 '
 
 test_expect_success 'git -c does not split values on equals' '
@@ -1447,12 +1458,12 @@ test_expect_success 'git --config-env with missing value' '
 
 test_expect_success 'git --config-env fails with invalid parameters' '
        test_must_fail git --config-env=foo.flag config --bool foo.flag 2>error &&
-       test_i18ngrep "invalid config format: foo.flag" error &&
+       test_grep "invalid config format: foo.flag" error &&
        test_must_fail git --config-env=foo.flag= config --bool foo.flag 2>error &&
-       test_i18ngrep "missing environment variable name for configuration ${SQ}foo.flag${SQ}" error &&
+       test_grep "missing environment variable name for configuration ${SQ}foo.flag${SQ}" error &&
        sane_unset NONEXISTENT &&
        test_must_fail git --config-env=foo.flag=NONEXISTENT config --bool foo.flag 2>error &&
-       test_i18ngrep "missing environment variable ${SQ}NONEXISTENT${SQ} for configuration ${SQ}foo.flag${SQ}" error
+       test_grep "missing environment variable ${SQ}NONEXISTENT${SQ} for configuration ${SQ}foo.flag${SQ}" error
 '
 
 test_expect_success 'git -c and --config-env work together' '
@@ -1533,21 +1544,21 @@ test_expect_success 'git config ignores pairs with empty count' '
 
 test_expect_success 'git config fails with invalid count' '
        test_must_fail env GIT_CONFIG_COUNT=10a git config --list 2>error &&
-       test_i18ngrep "bogus count" error &&
+       test_grep "bogus count" error &&
        test_must_fail env GIT_CONFIG_COUNT=9999999999999999 git config --list 2>error &&
-       test_i18ngrep "too many entries" error
+       test_grep "too many entries" error
 '
 
 test_expect_success 'git config fails with missing config key' '
        test_must_fail env GIT_CONFIG_COUNT=1 GIT_CONFIG_VALUE_0="value" \
                git config --list 2>error &&
-       test_i18ngrep "missing config key" error
+       test_grep "missing config key" error
 '
 
 test_expect_success 'git config fails with missing config value' '
        test_must_fail env GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="pair.one" \
                git config --list 2>error &&
-       test_i18ngrep "missing config value" error
+       test_grep "missing config value" error
 '
 
 test_expect_success 'git config fails with invalid config pair key' '
@@ -1617,7 +1628,7 @@ test_expect_success 'barf on syntax error' '
        key garbage
        EOF
        test_must_fail git config --get section.key 2>error &&
-       test_i18ngrep " line 3 " error
+       test_grep " line 3 " error
 '
 
 test_expect_success 'barf on incomplete section header' '
@@ -1627,7 +1638,7 @@ test_expect_success 'barf on incomplete section header' '
        key = value
        EOF
        test_must_fail git config --get section.key 2>error &&
-       test_i18ngrep " line 2 " error
+       test_grep " line 2 " error
 '
 
 test_expect_success 'barf on incomplete string' '
@@ -1637,7 +1648,7 @@ test_expect_success 'barf on incomplete string' '
        key = "value string
        EOF
        test_must_fail git config --get section.key 2>error &&
-       test_i18ngrep " line 3 " error
+       test_grep " line 3 " error
 '
 
 test_expect_success 'urlmatch' '
@@ -2009,11 +2020,11 @@ test_expect_success '--show-origin getting a single key' '
 '
 
 test_expect_success 'set up custom config file' '
-       CUSTOM_CONFIG_FILE="custom.conf" &&
-       cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
+       cat >"custom.conf" <<-\EOF &&
        [user]
                custom = true
        EOF
+       CUSTOM_CONFIG_FILE="$(test-tool path-utils real_path custom.conf)"
 '
 
 test_expect_success !MINGW 'set up custom config file with special name characters' '
@@ -2052,22 +2063,33 @@ test_expect_success '--show-origin stdin with file include' '
 '
 
 test_expect_success '--show-origin blob' '
-       blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
-       cat >expect <<-EOF &&
-       blob:$blob      user.custom=true
-       EOF
-       git config --blob=$blob --show-origin --list >output &&
-       test_cmp expect output
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
+               cat >expect <<-EOF &&
+               blob:$blob      user.custom=true
+               EOF
+               git config --blob=$blob --show-origin --list >output &&
+               test_cmp expect output
+       )
 '
 
 test_expect_success '--show-origin blob ref' '
-       cat >expect <<-\EOF &&
-       blob:main:custom.conf   user.custom=true
-       EOF
-       git add "$CUSTOM_CONFIG_FILE" &&
-       git commit -m "new config file" &&
-       git config --blob=main:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
-       test_cmp expect output
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               cat >expect <<-\EOF &&
+               blob:main:custom.conf   user.custom=true
+               EOF
+               cp "$CUSTOM_CONFIG_FILE" custom.conf &&
+               git add custom.conf &&
+               git commit -m "new config file" &&
+               git config --blob=main:custom.conf --show-origin --list >output &&
+               test_cmp expect output
+       )
 '
 
 test_expect_success '--show-origin with --default' '
@@ -2266,17 +2288,17 @@ test_expect_success 'identical mixed --type specifiers are allowed' '
 
 test_expect_success 'non-identical modern --type specifiers are not allowed' '
        test_must_fail git config --type=int --type=bool section.big 2>error &&
-       test_i18ngrep "only one type at a time" error
+       test_grep "only one type at a time" error
 '
 
 test_expect_success 'non-identical legacy --type specifiers are not allowed' '
        test_must_fail git config --int --bool section.big 2>error &&
-       test_i18ngrep "only one type at a time" error
+       test_grep "only one type at a time" error
 '
 
 test_expect_success 'non-identical mixed --type specifiers are not allowed' '
        test_must_fail git config --type=int --bool section.big 2>error &&
-       test_i18ngrep "only one type at a time" error
+       test_grep "only one type at a time" error
 '
 
 test_expect_success '--type allows valid type specifiers' '
@@ -2293,7 +2315,7 @@ test_expect_success 'unset type specifiers may be reset to conflicting ones' '
 
 test_expect_success '--type rejects unknown specifiers' '
        test_must_fail git config --type=nonsense section.foo 2>error &&
-       test_i18ngrep "unrecognized --type argument" error
+       test_grep "unrecognized --type argument" error
 '
 
 test_expect_success '--type=int requires at least one digit' '
@@ -2339,7 +2361,7 @@ test_expect_success 'set all config with value-pattern' '
 
        # multiple matches => failure
        test_must_fail git config --file=config abc.key three o+ 2>err &&
-       test_i18ngrep "has multiple values" err &&
+       test_grep "has multiple values" err &&
 
        # multiple values, no match => add
        git config --file=config abc.key three a+ &&
index e5a0d65caa3e4cc363319826f37a4254bfc99b33..29cf8a966133a7851722c8cdf828fe3c524a12ec 100755 (executable)
@@ -52,7 +52,7 @@ test_expect_success 'shared=all' '
        test 2 = $(git config core.sharedrepository)
 '
 
-test_expect_failure 'template can set core.bare' '
+test_expect_success 'template cannot set core.bare' '
        test_when_finished "rm -rf subdir" &&
        test_when_finished "rm -rf templates" &&
        test_config core.bare true &&
@@ -60,18 +60,7 @@ test_expect_failure 'template can set core.bare' '
        mkdir -p templates/ &&
        cp .git/config templates/config &&
        git init --template=templates subdir &&
-       test_path_exists subdir/HEAD
-'
-
-test_expect_success 'template can set core.bare but overridden by command line' '
-       test_when_finished "rm -rf subdir" &&
-       test_when_finished "rm -rf templates" &&
-       test_config core.bare true &&
-       umask 0022 &&
-       mkdir -p templates/ &&
-       cp .git/config templates/config &&
-       git init --no-bare --template=templates subdir &&
-       test_path_exists subdir/.git/HEAD
+       test_path_is_missing subdir/HEAD
 '
 
 test_expect_success POSIXPERM 'update-server-info honors core.sharedRepository' '
@@ -137,22 +126,6 @@ test_expect_success POSIXPERM 'info/refs respects umask in unshared repo' '
        test_cmp expect actual
 '
 
-test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
-       umask 077 &&
-       git config core.sharedRepository group &&
-       git reflog expire --all &&
-       actual="$(ls -l .git/logs/refs/heads/main)" &&
-       case "$actual" in
-       -rw-rw-*)
-               : happy
-               ;;
-       *)
-               echo Ooops, .git/logs/refs/heads/main is not 066x [$actual]
-               false
-               ;;
-       esac
-'
-
 test_expect_success POSIXPERM 'forced modes' '
        test_when_finished "rm -rf new" &&
        mkdir -p templates/hooks &&
index 179474fa651e159bf68714620ab4f1be2c259fe5..42caa0d2978b58755d43b3361589c6e7691c34db 100755 (executable)
@@ -9,10 +9,6 @@ TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
-       test_oid_cache <<-\EOF &&
-       version sha1:0
-       version sha256:1
-       EOF
        cat >test.patch <<-\EOF &&
        diff --git a/test.txt b/test.txt
        new file mode 100644
@@ -28,7 +24,12 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'gitdir selection on normal repos' '
-       test_oid version >expect &&
+       if test_have_prereq DEFAULT_REPO_FORMAT
+       then
+               echo 0
+       else
+               echo 1
+       fi >expect &&
        git config core.repositoryformatversion >actual &&
        git -C test config core.repositoryformatversion >actual2 &&
        test_cmp expect actual &&
@@ -79,8 +80,13 @@ mkconfig () {
 
 while read outcome version extensions; do
        test_expect_success "$outcome version=$version $extensions" "
-               mkconfig $version $extensions >.git/config &&
-               check_${outcome}
+               test_when_finished 'rm -rf extensions' &&
+               git init extensions &&
+               (
+                       cd extensions &&
+                       mkconfig $version $extensions >.git/config &&
+                       check_${outcome}
+               )
        "
 done <<\EOF
 allow 0
@@ -94,7 +100,8 @@ allow 1 noop-v1
 EOF
 
 test_expect_success 'precious-objects allowed' '
-       mkconfig 1 preciousObjects >.git/config &&
+       git config core.repositoryFormatVersion 1 &&
+       git config extensions.preciousObjects 1 &&
        check_allow
 '
 
index 0a7099d6f52b68cf9abc263933267925a994378a..b9852fe40e4a045ae4a355a85aa6e2d14d758479 100755 (executable)
@@ -63,7 +63,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '
        git commit -m broken &&
 
        test_must_fail git config --blob=HEAD:config some.value 2>err &&
-       test_i18ngrep "HEAD:config" err
+       test_grep "HEAD:config" err
 '
 
 test_expect_success 'can parse blob ending with CR' '
index 777648722c72830c86d27f7083fac78843844ca0..3bfec07f1abcc1d997f428e84acf6cc3490b1b6a 100755 (executable)
@@ -172,7 +172,7 @@ test_expect_success 'find string value for a key' '
 
 test_expect_success 'check line error when NULL string is queried' '
        test_expect_code 128 test-tool config get_string case.foo 2>result &&
-       test_i18ngrep "fatal: .*case\.foo.*\.git/config.*line 7" result
+       test_grep "fatal: .*case\.foo.*\.git/config.*line 7" result
 '
 
 test_expect_success 'find integer if value is non parse-able' '
@@ -342,14 +342,14 @@ test_expect_success 'check line errors for malformed values' '
                br
        EOF
        test_expect_code 128 git br 2>result &&
-       test_i18ngrep "missing value for .alias\.br" result &&
-       test_i18ngrep "fatal: .*\.git/config" result &&
-       test_i18ngrep "fatal: .*line 2" result
+       test_grep "missing value for .alias\.br" result &&
+       test_grep "fatal: .*\.git/config" result &&
+       test_grep "fatal: .*line 2" result
 '
 
 test_expect_success 'error on modifying repo config without repo' '
        nongit test_must_fail git config a.b c 2>err &&
-       test_i18ngrep "not in a git directory" err
+       test_grep "not in a git directory" err
 '
 
 cmdline_config="'foo.bar=from-cmdline'"
index 537435b90ae9314a8062c81186fd00853d38b230..523aa99a1e264661c9af03e450ff14c345831617 100755 (executable)
@@ -78,7 +78,7 @@ test_with_config () {
 
 test_expect_success 'ignore .git/ with incompatible repository version' '
        test_with_config "[core]repositoryformatversion = 999999" 2>err &&
-       test_i18ngrep "warning:.* Expected git repo version <= [1-9]" err
+       test_grep "warning:.* Expected git repo version <= [1-9]" err
 '
 
 test_expect_failure 'ignore .git/ with invalid repository version' '
index 09b10c144ba9d162635a12d66b8796b9cd94fb6c..1a90d31201a612b69944bffba27b347eeb0ab580 100755 (executable)
@@ -26,12 +26,12 @@ test_expect_success 'canonicalizes --default with appropriate type' '
 test_expect_success 'dies when --default cannot be parsed' '
        test_must_fail git config -f config --type=expiry-date --default=x --get \
                not.a.section 2>error &&
-       test_i18ngrep "failed to format default config value" error
+       test_grep "failed to format default config value" error
 '
 
 test_expect_success 'does not allow --default without --get' '
        test_must_fail git config --default=quux --unset a.section >output 2>&1 &&
-       test_i18ngrep "\-\-default is only applicable to" output
+       test_grep "\-\-default is only applicable to" output
 '
 
 test_done
index 4d66cd7f4a1fce8ebdaa42a37e7bd8f03853645e..6ebc3ef9453b71dbc7d90a052834af482dfd48ec 100755 (executable)
@@ -9,8 +9,6 @@ test_description='Test git update-ref and basic ref logging'
 Z=$ZERO_OID
 
 m=refs/heads/main
-n_dir=refs/heads/gu
-n=$n_dir/fixes
 outside=refs/foo
 bare=bare-repo
 
@@ -62,10 +60,10 @@ test_expect_success "delete $m without oldvalue verification" '
        test_must_fail git show-ref --verify -q $m
 '
 
-test_expect_success "fail to create $n" '
-       test_when_finished "rm -f .git/$n_dir" &&
-       touch .git/$n_dir &&
-       test_must_fail git update-ref $n $A
+test_expect_success "fail to create $n due to file/directory conflict" '
+       test_when_finished "git update-ref -d refs/heads/gu" &&
+       git update-ref refs/heads/gu $A &&
+       test_must_fail git update-ref refs/heads/gu/fixes $A
 '
 
 test_expect_success "create $m (by HEAD)" '
@@ -92,7 +90,8 @@ test_expect_success "deleting current branch adds message to HEAD's log" '
        git symbolic-ref HEAD $m &&
        git update-ref -m delete-$m -d $m &&
        test_must_fail git show-ref --verify -q $m &&
-       grep "delete-$m$" .git/logs/HEAD
+       test-tool ref-store main for-each-reflog-ent HEAD >actual &&
+       grep "delete-$m$" actual
 '
 
 test_expect_success "deleting by HEAD adds message to HEAD's log" '
@@ -101,7 +100,8 @@ test_expect_success "deleting by HEAD adds message to HEAD's log" '
        git symbolic-ref HEAD $m &&
        git update-ref -m delete-by-head -d HEAD &&
        test_must_fail git show-ref --verify -q $m &&
-       grep "delete-by-head$" .git/logs/HEAD
+       test-tool ref-store main for-each-reflog-ent HEAD >actual &&
+       grep "delete-by-head$" actual
 '
 
 test_expect_success 'update-ref does not create reflogs by default' '
@@ -132,7 +132,7 @@ test_expect_success 'creates no reflog in bare repository' '
 
 test_expect_success 'core.logAllRefUpdates=true creates reflog in bare repository' '
        test_when_finished "git -C $bare config --unset core.logAllRefUpdates && \
-               rm $bare/logs/$m" &&
+               test-tool ref-store main delete-reflog $m" &&
        git -C $bare config core.logAllRefUpdates true &&
        git -C $bare update-ref $m $bareB &&
        git -C $bare rev-parse $bareB >expect &&
@@ -221,27 +221,27 @@ test_expect_success 'delete symref without dereference when the referred ref is
 '
 
 test_expect_success 'update-ref -d is not confused by self-reference' '
+       test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF refs/heads/self" &&
        git symbolic-ref refs/heads/self refs/heads/self &&
-       test_when_finished "rm -f .git/refs/heads/self" &&
-       test_path_is_file .git/refs/heads/self &&
+       git symbolic-ref --no-recurse refs/heads/self &&
        test_must_fail git update-ref -d refs/heads/self &&
-       test_path_is_file .git/refs/heads/self
+       git symbolic-ref --no-recurse refs/heads/self
 '
 
 test_expect_success 'update-ref --no-deref -d can delete self-reference' '
+       test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF refs/heads/self" &&
        git symbolic-ref refs/heads/self refs/heads/self &&
-       test_when_finished "rm -f .git/refs/heads/self" &&
-       test_path_is_file .git/refs/heads/self &&
+       git symbolic-ref --no-recurse refs/heads/self &&
        git update-ref --no-deref -d refs/heads/self &&
        test_must_fail git show-ref --verify -q refs/heads/self
 '
 
-test_expect_success 'update-ref --no-deref -d can delete reference to bad ref' '
+test_expect_success REFFILES 'update-ref --no-deref -d can delete reference to bad ref' '
        >.git/refs/heads/bad &&
        test_when_finished "rm -f .git/refs/heads/bad" &&
        git symbolic-ref refs/heads/ref-to-bad refs/heads/bad &&
        test_when_finished "git update-ref -d refs/heads/ref-to-bad" &&
-       test_path_is_file .git/refs/heads/ref-to-bad &&
+       git symbolic-ref --no-recurse refs/heads/ref-to-bad &&
        git update-ref --no-deref -d refs/heads/ref-to-bad &&
        test_must_fail git show-ref --verify -q refs/heads/ref-to-bad
 '
@@ -265,7 +265,10 @@ test_expect_success "(not) changed .git/$m" '
        ! test $B = $(git show-ref -s --verify $m)
 '
 
-rm -f .git/logs/refs/heads/main
+test_expect_success "clean up reflog" '
+       test-tool ref-store main delete-reflog $m
+'
+
 test_expect_success "create $m (logged by touch)" '
        test_config core.logAllRefUpdates false &&
        GIT_COMMITTER_DATE="2005-05-26 23:30" \
@@ -285,40 +288,13 @@ test_expect_success "set $m (logged by touch)" '
        test $A = $(git show-ref -s --verify $m)
 '
 
-test_expect_success 'empty directory removal' '
-       git branch d1/d2/r1 HEAD &&
-       git branch d1/r2 HEAD &&
-       test_path_is_file .git/refs/heads/d1/d2/r1 &&
-       test_path_is_file .git/logs/refs/heads/d1/d2/r1 &&
-       git branch -d d1/d2/r1 &&
-       test_must_fail git show-ref --verify -q refs/heads/d1/d2 &&
-       test_must_fail git show-ref --verify -q logs/refs/heads/d1/d2 &&
-       test_path_is_file .git/refs/heads/d1/r2 &&
-       test_path_is_file .git/logs/refs/heads/d1/r2
-'
-
-test_expect_success 'symref empty directory removal' '
-       git branch e1/e2/r1 HEAD &&
-       git branch e1/r2 HEAD &&
-       git checkout e1/e2/r1 &&
-       test_when_finished "git checkout main" &&
-       test_path_is_file .git/refs/heads/e1/e2/r1 &&
-       test_path_is_file .git/logs/refs/heads/e1/e2/r1 &&
-       git update-ref -d HEAD &&
-       test_must_fail git show-ref --verify -q refs/heads/e1/e2 &&
-       test_must_fail git show-ref --verify -q logs/refs/heads/e1/e2 &&
-       test_path_is_file .git/refs/heads/e1/r2 &&
-       test_path_is_file .git/logs/refs/heads/e1/r2 &&
-       test_path_is_file .git/logs/HEAD
-'
-
 cat >expect <<EOF
 $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000      Initial Creation
 $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150260 +0000      Switch
 $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000
 EOF
 test_expect_success "verifying $m's log (logged by touch)" '
-       test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" &&
+       test_when_finished "git update-ref -d $m && git reflog expire --expire=all --all && rm -rf actual expect" &&
        test-tool ref-store main for-each-reflog-ent $m >actual &&
        test_cmp actual expect
 '
@@ -348,20 +324,34 @@ $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 +0000 Switch
 $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
 EOF
 test_expect_success "verifying $m's log (logged by config)" '
-       test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" &&
+       test_when_finished "git update-ref -d $m && git reflog expire --expire=all --all && rm -rf actual expect" &&
        test-tool ref-store main for-each-reflog-ent $m >actual &&
        test_cmp actual expect
 '
 
 test_expect_success 'set up for querying the reflog' '
+       git update-ref -d $m &&
+       test-tool ref-store main delete-reflog $m &&
+
+       GIT_COMMITTER_DATE="1117150320 -0500" git update-ref $m $C &&
+       GIT_COMMITTER_DATE="1117150350 -0500" git update-ref $m $A &&
+       GIT_COMMITTER_DATE="1117150380 -0500" git update-ref $m $B &&
+       GIT_COMMITTER_DATE="1117150680 -0500" git update-ref $m $F &&
+       GIT_COMMITTER_DATE="1117150980 -0500" git update-ref $m $E &&
        git update-ref $m $D &&
-       cat >.git/logs/$m <<-EOF
+       # Delete the last reflog entry so that the tip of m and the reflog for
+       # it disagree.
+       git reflog delete $m@{0} &&
+
+       cat >expect <<-EOF &&
        $Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
        $C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
        $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
-       $F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
-       $Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
+       $B $F $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
+       $F $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
        EOF
+       test-tool ref-store main for-each-reflog-ent $m >actual &&
+       test_cmp expect actual
 '
 
 ed="Thu, 26 May 2005 18:32:00 -0500"
@@ -409,13 +399,12 @@ test_expect_success 'Query "main@{2005-05-26 23:33:01}" (middle of history with
        test_when_finished "rm -f o e" &&
        git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
        echo "$B" >expect &&
-       test_cmp expect o &&
-       test_i18ngrep -F "warning: log for ref $m has gap after $gd" e
+       test_cmp expect o
 '
 test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
        test_when_finished "rm -f o e" &&
        git rev-parse --verify "main@{2005-05-26 23:38:00}" >o 2>e &&
-       echo "$Z" >expect &&
+       echo "$F" >expect &&
        test_cmp expect o &&
        test_must_be_empty e
 '
@@ -431,10 +420,27 @@ test_expect_success 'Query "main@{2005-05-28}" (past end of history)' '
        git rev-parse --verify "main@{2005-05-28}" >o 2>e &&
        echo "$D" >expect &&
        test_cmp expect o &&
-       test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e
+       test_grep -F "warning: log for ref $m unexpectedly ended on $ld" e
 '
 
-rm -f .git/$m .git/logs/$m expect
+rm -f expect
+git update-ref -d $m
+
+test_expect_success 'query reflog with gap' '
+       test_when_finished "git update-ref -d $m" &&
+
+       GIT_COMMITTER_DATE="1117150320 -0500" git update-ref $m $A &&
+       GIT_COMMITTER_DATE="1117150380 -0500" git update-ref $m $B &&
+       GIT_COMMITTER_DATE="1117150480 -0500" git update-ref $m $C &&
+       GIT_COMMITTER_DATE="1117150580 -0500" git update-ref $m $D &&
+       GIT_COMMITTER_DATE="1117150680 -0500" git update-ref $m $F &&
+       git reflog delete $m@{2} &&
+
+       git rev-parse --verify "main@{2005-05-26 23:33:01}" >actual 2>stderr &&
+       echo "$B" >expect &&
+       test_cmp expect actual &&
+       test_grep -F "warning: log for ref $m has gap after $gd" stderr
+'
 
 test_expect_success 'creating initial files' '
        test_when_finished rm -f M &&
@@ -486,57 +492,57 @@ test_expect_success 'git cat-file blob main@{2005-05-26 23:42}:F (expect OTHER)'
 test_expect_success 'given old value for missing pseudoref, do not create' '
        test_must_fail git update-ref PSEUDOREF $A $B 2>err &&
        test_must_fail git rev-parse PSEUDOREF &&
-       test_i18ngrep "unable to resolve reference" err
+       test_grep "unable to resolve reference" err
 '
 
 test_expect_success 'create pseudoref' '
        git update-ref PSEUDOREF $A &&
-       test $A = $(git rev-parse PSEUDOREF)
+       test $A = $(git show-ref -s --verify PSEUDOREF)
 '
 
 test_expect_success 'overwrite pseudoref with no old value given' '
        git update-ref PSEUDOREF $B &&
-       test $B = $(git rev-parse PSEUDOREF)
+       test $B = $(git show-ref -s --verify PSEUDOREF)
 '
 
 test_expect_success 'overwrite pseudoref with correct old value' '
        git update-ref PSEUDOREF $C $B &&
-       test $C = $(git rev-parse PSEUDOREF)
+       test $C = $(git show-ref -s --verify PSEUDOREF)
 '
 
 test_expect_success 'do not overwrite pseudoref with wrong old value' '
        test_must_fail git update-ref PSEUDOREF $D $E 2>err &&
-       test $C = $(git rev-parse PSEUDOREF) &&
-       test_i18ngrep "cannot lock ref.*expected" err
+       test $C = $(git show-ref -s --verify PSEUDOREF) &&
+       test_grep "cannot lock ref.*expected" err
 '
 
 test_expect_success 'delete pseudoref' '
        git update-ref -d PSEUDOREF &&
-       test_must_fail git rev-parse PSEUDOREF
+       test_must_fail git show-ref -s --verify PSEUDOREF
 '
 
 test_expect_success 'do not delete pseudoref with wrong old value' '
        git update-ref PSEUDOREF $A &&
        test_must_fail git update-ref -d PSEUDOREF $B 2>err &&
-       test $A = $(git rev-parse PSEUDOREF) &&
-       test_i18ngrep "cannot lock ref.*expected" err
+       test $A = $(git show-ref -s --verify PSEUDOREF) &&
+       test_grep "cannot lock ref.*expected" err
 '
 
 test_expect_success 'delete pseudoref with correct old value' '
        git update-ref -d PSEUDOREF $A &&
-       test_must_fail git rev-parse PSEUDOREF
+       test_must_fail git show-ref -s --verify PSEUDOREF
 '
 
 test_expect_success 'create pseudoref with old OID zero' '
        git update-ref PSEUDOREF $A $Z &&
-       test $A = $(git rev-parse PSEUDOREF)
+       test $A = $(git show-ref -s --verify PSEUDOREF)
 '
 
 test_expect_success 'do not overwrite pseudoref with old OID zero' '
        test_when_finished git update-ref -d PSEUDOREF &&
        test_must_fail git update-ref PSEUDOREF $B $Z 2>err &&
-       test $A = $(git rev-parse PSEUDOREF) &&
-       test_i18ngrep "already exists" err
+       test $A = $(git show-ref -s --verify PSEUDOREF) &&
+       test_grep "already exists" err
 '
 
 # Test --stdin
@@ -556,7 +562,7 @@ test_expect_success 'stdin test setup' '
 
 test_expect_success '-z fails without --stdin' '
        test_must_fail git update-ref -z $m $m $m 2>err &&
-       test_i18ngrep "usage: git update-ref" err
+       test_grep "usage: git update-ref" err
 '
 
 test_expect_success 'stdin works with no input' '
@@ -674,7 +680,7 @@ test_expect_success 'stdin fails with duplicate refs' '
        create $a $m
        EOF
        test_must_fail git update-ref --stdin <stdin 2>err &&
-       test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
+       test_grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
 '
 
 test_expect_success 'stdin create ref works' '
@@ -1107,7 +1113,7 @@ test_expect_success 'stdin -z fails option with unknown name' '
 test_expect_success 'stdin -z fails with duplicate refs' '
        printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin &&
        test_must_fail git update-ref -z --stdin <stdin 2>err &&
-       test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
+       test_grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
 '
 
 test_expect_success 'stdin -z create ref works' '
@@ -1338,7 +1344,7 @@ test_expect_success 'fails with duplicate HEAD update' '
        update HEAD $B
        EOF
        test_must_fail git update-ref --stdin <stdin 2>err &&
-       test_i18ngrep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
+       test_grep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
        echo "refs/heads/target1" >expect &&
        git symbolic-ref HEAD >actual &&
        test_cmp expect actual &&
@@ -1355,7 +1361,7 @@ test_expect_success 'fails with duplicate ref update via symref' '
        update refs/heads/symref2 $B
        EOF
        test_must_fail git update-ref --stdin <stdin 2>err &&
-       test_i18ngrep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
+       test_grep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
        echo "refs/heads/target2" >expect &&
        git symbolic-ref refs/heads/symref2 >actual &&
        test_cmp expect actual &&
@@ -1635,13 +1641,4 @@ test_expect_success PIPE 'transaction flushes status updates' '
        test_cmp expected actual
 '
 
-test_expect_success 'directory not created deleting packed ref' '
-       git branch d1/d2/r1 HEAD &&
-       git pack-refs --all &&
-       test_path_is_missing .git/refs/heads/d1/d2 &&
-       git update-ref -d refs/heads/d1/d2/r1 &&
-       test_path_is_missing .git/refs/heads/d1/d2 &&
-       test_path_is_missing .git/refs/heads/d1
-'
-
 test_done
index c7745e1bf69e910c2d66a61bb8bef36b45473a56..5c60d6f812dc20c1c86f5125b5feabb4ce1df9ce 100755 (executable)
@@ -106,9 +106,8 @@ test_expect_success LONG_REF 'we can parse long symbolic ref' '
 '
 
 test_expect_success 'symbolic-ref reports failure in exit code' '
-       test_when_finished "rm -f .git/HEAD.lock" &&
-       >.git/HEAD.lock &&
-       test_must_fail git symbolic-ref HEAD refs/heads/whatever
+       # Create d/f conflict to simulate failure.
+       test_must_fail git symbolic-ref refs/heads refs/heads/foo
 '
 
 test_expect_success 'symbolic-ref writes reflog entry' '
@@ -171,8 +170,8 @@ test_expect_success 'symbolic-ref refuses invalid target for non-HEAD' '
 '
 
 test_expect_success 'symbolic-ref allows top-level target for non-HEAD' '
-       git symbolic-ref refs/heads/top-level FETCH_HEAD &&
-       git update-ref FETCH_HEAD HEAD &&
+       git symbolic-ref refs/heads/top-level ORIG_HEAD &&
+       git update-ref ORIG_HEAD HEAD &&
        test_cmp_rev top-level HEAD
 '
 
index 9252a581abf8a702fffb01bc7c388666207d5251..33fb7a38ffff849db2a825de61eacbc34a8eb11d 100755 (executable)
@@ -174,6 +174,14 @@ test_expect_success 'show-ref --verify HEAD' '
        test_must_be_empty actual
 '
 
+test_expect_success 'show-ref --verify pseudorefs' '
+       git update-ref CHERRY_PICK_HEAD HEAD $ZERO_OID &&
+       test_when_finished "git update-ref -d CHERRY_PICK_HEAD" &&
+       git show-ref -s --verify HEAD >actual &&
+       git show-ref -s --verify CHERRY_PICK_HEAD >expect &&
+       test_cmp actual expect
+'
+
 test_expect_success 'show-ref --verify with dangling ref' '
        sha1_file() {
                echo "$*" | sed "s#..#.git/objects/&/#"
@@ -196,4 +204,86 @@ test_expect_success 'show-ref --verify with dangling ref' '
        )
 '
 
+test_expect_success 'show-ref sub-modes are mutually exclusive' '
+       test_must_fail git show-ref --verify --exclude-existing 2>err &&
+       grep "verify" err &&
+       grep "exclude-existing" err &&
+       grep "cannot be used together" err &&
+
+       test_must_fail git show-ref --verify --exists 2>err &&
+       grep "verify" err &&
+       grep "exists" err &&
+       grep "cannot be used together" err &&
+
+       test_must_fail git show-ref --exclude-existing --exists 2>err &&
+       grep "exclude-existing" err &&
+       grep "exists" err &&
+       grep "cannot be used together" err
+'
+
+test_expect_success '--exists with existing reference' '
+       git show-ref --exists refs/heads/$GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+'
+
+test_expect_success '--exists with missing reference' '
+       test_expect_code 2 git show-ref --exists refs/heads/does-not-exist
+'
+
+test_expect_success '--exists does not use DWIM' '
+       test_expect_code 2 git show-ref --exists $GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 2>err &&
+       grep "reference does not exist" err
+'
+
+test_expect_success '--exists with HEAD' '
+       git show-ref --exists HEAD
+'
+
+test_expect_success '--exists with bad reference name' '
+       test_when_finished "git update-ref -d refs/heads/bad...name" &&
+       new_oid=$(git rev-parse HEAD) &&
+       test-tool ref-store main update-ref msg refs/heads/bad...name $new_oid $ZERO_OID REF_SKIP_REFNAME_VERIFICATION &&
+       git show-ref --exists refs/heads/bad...name
+'
+
+test_expect_success '--exists with arbitrary symref' '
+       test_when_finished "git symbolic-ref -d refs/symref" &&
+       git symbolic-ref refs/symref refs/heads/$GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME &&
+       git show-ref --exists refs/symref
+'
+
+test_expect_success '--exists with dangling symref' '
+       test_when_finished "git symbolic-ref -d refs/heads/dangling" &&
+       git symbolic-ref refs/heads/dangling refs/heads/does-not-exist &&
+       git show-ref --exists refs/heads/dangling
+'
+
+test_expect_success '--exists with nonexistent object ID' '
+       test-tool ref-store main update-ref msg refs/heads/missing-oid $(test_oid 001) $ZERO_OID REF_SKIP_OID_VERIFICATION &&
+       git show-ref --exists refs/heads/missing-oid
+'
+
+test_expect_success '--exists with non-commit object' '
+       tree_oid=$(git rev-parse HEAD^{tree}) &&
+       test-tool ref-store main update-ref msg refs/heads/tree ${tree_oid} $ZERO_OID REF_SKIP_OID_VERIFICATION &&
+       git show-ref --exists refs/heads/tree
+'
+
+test_expect_success '--exists with directory fails with generic error' '
+       cat >expect <<-EOF &&
+       error: reference does not exist
+       EOF
+       test_expect_code 2 git show-ref --exists refs/heads 2>err &&
+       test_cmp expect err
+'
+
+test_expect_success '--exists with non-existent special ref' '
+       test_expect_code 2 git show-ref --exists FETCH_HEAD
+'
+
+test_expect_success '--exists with existing special ref' '
+       test_when_finished "rm .git/FETCH_HEAD" &&
+       git rev-parse HEAD >.git/FETCH_HEAD &&
+       git show-ref --exists FETCH_HEAD
+'
+
 test_done
index 937ae0d73347c3d0797fd28b5c3bfa83baf55632..98e9158bd2ab41f17af11612ef1bfd5e65796605 100755 (executable)
@@ -29,7 +29,7 @@ test_update_rejected () {
        fi &&
        printf "create $prefix/%s $C\n" $create >input &&
        test_must_fail git update-ref --stdin <input 2>output.err &&
-       test_i18ngrep -F "$error" output.err &&
+       test_grep -F "$error" output.err &&
        git for-each-ref $prefix >actual &&
        test_cmp unchanged actual
 }
@@ -92,9 +92,6 @@ df_test() {
        else
                delname="$delref"
        fi &&
-       cat >expected-err <<-EOF &&
-       fatal: cannot lock ref $SQ$addname$SQ: $SQ$delref$SQ exists; cannot create $SQ$addref$SQ
-       EOF
        $pack &&
        if $add_del
        then
@@ -103,7 +100,7 @@ df_test() {
                printf "%s\n" "delete $delname" "create $addname $D"
        fi >commands &&
        test_must_fail git update-ref --stdin <commands 2>output.err &&
-       test_cmp expected-err output.err &&
+       grep "fatal:\( cannot lock ref $SQ$addname$SQ:\)\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err &&
        printf "%s\n" "$C $delref" >expected-refs &&
        git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
        test_cmp expected-refs actual-refs
@@ -191,141 +188,69 @@ test_expect_success 'one new ref is a simple prefix of another' '
 
 '
 
-test_expect_success REFFILES 'empty directory should not fool rev-parse' '
-       prefix=refs/e-rev-parse &&
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       echo "$C" >expected &&
-       git rev-parse $prefix/foo >actual &&
-       test_cmp expected actual
-'
-
-test_expect_success REFFILES 'empty directory should not fool for-each-ref' '
-       prefix=refs/e-for-each-ref &&
-       git update-ref $prefix/foo $C &&
-       git for-each-ref $prefix >expected &&
-       git pack-refs --all &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       git for-each-ref $prefix >actual &&
-       test_cmp expected actual
-'
-
-test_expect_success REFFILES 'empty directory should not fool create' '
-       prefix=refs/e-create &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       printf "create %s $C\n" $prefix/foo |
-       git update-ref --stdin
-'
-
-test_expect_success REFFILES 'empty directory should not fool verify' '
-       prefix=refs/e-verify &&
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       printf "verify %s $C\n" $prefix/foo |
-       git update-ref --stdin
-'
-
-test_expect_success REFFILES 'empty directory should not fool 1-arg update' '
-       prefix=refs/e-update-1 &&
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       printf "update %s $D\n" $prefix/foo |
-       git update-ref --stdin
-'
-
-test_expect_success REFFILES 'empty directory should not fool 2-arg update' '
-       prefix=refs/e-update-2 &&
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       printf "update %s $D $C\n" $prefix/foo |
-       git update-ref --stdin
-'
-
-test_expect_success REFFILES 'empty directory should not fool 0-arg delete' '
-       prefix=refs/e-delete-0 &&
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       printf "delete %s\n" $prefix/foo |
-       git update-ref --stdin
-'
-
-test_expect_success REFFILES 'empty directory should not fool 1-arg delete' '
-       prefix=refs/e-delete-1 &&
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       mkdir -p .git/$prefix/foo/bar/baz &&
-       printf "delete %s $C\n" $prefix/foo |
-       git update-ref --stdin
-'
-
-test_expect_success REFFILES 'D/F conflict prevents add long + delete short' '
+test_expect_success 'D/F conflict prevents add long + delete short' '
        df_test refs/df-al-ds --add-del foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents add short + delete long' '
+test_expect_success 'D/F conflict prevents add short + delete long' '
        df_test refs/df-as-dl --add-del foo foo/bar
 '
 
-test_expect_success REFFILES 'D/F conflict prevents delete long + add short' '
+test_expect_success 'D/F conflict prevents delete long + add short' '
        df_test refs/df-dl-as --del-add foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents delete short + add long' '
+test_expect_success 'D/F conflict prevents delete short + add long' '
        df_test refs/df-ds-al --del-add foo foo/bar
 '
 
-test_expect_success REFFILES 'D/F conflict prevents add long + delete short packed' '
+test_expect_success 'D/F conflict prevents add long + delete short packed' '
        df_test refs/df-al-dsp --pack --add-del foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents add short + delete long packed' '
+test_expect_success 'D/F conflict prevents add short + delete long packed' '
        df_test refs/df-as-dlp --pack --add-del foo foo/bar
 '
 
-test_expect_success REFFILES 'D/F conflict prevents delete long packed + add short' '
+test_expect_success 'D/F conflict prevents delete long packed + add short' '
        df_test refs/df-dlp-as --pack --del-add foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents delete short packed + add long' '
+test_expect_success 'D/F conflict prevents delete short packed + add long' '
        df_test refs/df-dsp-al --pack --del-add foo foo/bar
 '
 
 # Try some combinations involving symbolic refs...
 
-test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short' '
+test_expect_success 'D/F conflict prevents indirect add long + delete short' '
        df_test refs/df-ial-ds --sym-add --add-del foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short' '
+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' '
        df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents indirect add short + indirect delete long' '
+test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' '
        df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar
 '
 
-test_expect_success REFFILES 'D/F conflict prevents indirect delete long + indirect add short' '
+test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' '
        df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents indirect add long + delete short packed' '
+test_expect_success 'D/F conflict prevents indirect add long + delete short packed' '
        df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents indirect add long + indirect delete short packed' '
+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' '
        df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents add long + indirect delete short packed' '
+test_expect_success 'D/F conflict prevents add long + indirect delete short packed' '
        df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo
 '
 
-test_expect_success REFFILES 'D/F conflict prevents indirect delete long packed + indirect add short' '
+test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' '
        df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo
 '
 
@@ -468,169 +393,4 @@ test_expect_success 'incorrect old value blocks indirect no-deref delete' '
        test_cmp expected output.err
 '
 
-test_expect_success REFFILES 'non-empty directory blocks create' '
-       prefix=refs/ne-create &&
-       mkdir -p .git/$prefix/foo/bar &&
-       : >.git/$prefix/foo/bar/baz.lock &&
-       test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/foo$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ
-       EOF
-       printf "%s\n" "update $prefix/foo $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ
-       EOF
-       printf "%s\n" "update $prefix/foo $D $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err
-'
-
-test_expect_success REFFILES 'broken reference blocks create' '
-       prefix=refs/broken-create &&
-       mkdir -p .git/$prefix &&
-       echo "gobbledigook" >.git/$prefix/foo &&
-       test_when_finished "rm -f .git/$prefix/foo" &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
-       EOF
-       printf "%s\n" "update $prefix/foo $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/foo$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
-       EOF
-       printf "%s\n" "update $prefix/foo $D $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err
-'
-
-test_expect_success REFFILES 'non-empty directory blocks indirect create' '
-       prefix=refs/ne-indirect-create &&
-       git symbolic-ref $prefix/symref $prefix/foo &&
-       mkdir -p .git/$prefix/foo/bar &&
-       : >.git/$prefix/foo/bar/baz.lock &&
-       test_when_finished "rm -f .git/$prefix/foo/bar/baz.lock" &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/symref$SQ: there is a non-empty directory $SQ.git/$prefix/foo$SQ blocking reference $SQ$prefix/foo$SQ
-       EOF
-       printf "%s\n" "update $prefix/symref $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ
-       EOF
-       printf "%s\n" "update $prefix/symref $D $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err
-'
-
-test_expect_success REFFILES 'broken reference blocks indirect create' '
-       prefix=refs/broken-indirect-create &&
-       git symbolic-ref $prefix/symref $prefix/foo &&
-       echo "gobbledigook" >.git/$prefix/foo &&
-       test_when_finished "rm -f .git/$prefix/foo" &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
-       EOF
-       printf "%s\n" "update $prefix/symref $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err &&
-       cat >expected <<-EOF &&
-       fatal: cannot lock ref $SQ$prefix/symref$SQ: unable to resolve reference $SQ$prefix/foo$SQ: reference broken
-       EOF
-       printf "%s\n" "update $prefix/symref $D $C" |
-       test_must_fail git update-ref --stdin 2>output.err &&
-       test_cmp expected output.err
-'
-
-test_expect_success REFFILES 'no bogus intermediate values during delete' '
-       prefix=refs/slow-transaction &&
-       # Set up a reference with differing loose and packed versions:
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       git update-ref $prefix/foo $D &&
-       # Now try to update the reference, but hold the `packed-refs` lock
-       # for a while to see what happens while the process is blocked:
-       : >.git/packed-refs.lock &&
-       test_when_finished "rm -f .git/packed-refs.lock" &&
-       {
-               # Note: the following command is intentionally run in the
-               # background. We increase the timeout so that `update-ref`
-               # attempts to acquire the `packed-refs` lock for much longer
-               # than it takes for us to do the check then delete it:
-               git -c core.packedrefstimeout=30000 update-ref -d $prefix/foo &
-       } &&
-       pid2=$! &&
-       # Give update-ref plenty of time to get to the point where it tries
-       # to lock packed-refs:
-       sleep 1 &&
-       # Make sure that update-ref did not complete despite the lock:
-       kill -0 $pid2 &&
-       # Verify that the reference still has its old value:
-       sha1=$(git rev-parse --verify --quiet $prefix/foo || echo undefined) &&
-       case "$sha1" in
-       $D)
-               # This is what we hope for; it means that nothing
-               # user-visible has changed yet.
-               : ;;
-       undefined)
-               # This is not correct; it means the deletion has happened
-               # already even though update-ref should not have been
-               # able to acquire the lock yet.
-               echo "$prefix/foo deleted prematurely" &&
-               break
-               ;;
-       $C)
-               # This value should never be seen. Probably the loose
-               # reference has been deleted but the packed reference
-               # is still there:
-               echo "$prefix/foo incorrectly observed to be C" &&
-               break
-               ;;
-       *)
-               # WTF?
-               echo "unexpected value observed for $prefix/foo: $sha1" &&
-               break
-               ;;
-       esac >out &&
-       rm -f .git/packed-refs.lock &&
-       wait $pid2 &&
-       test_must_be_empty out &&
-       test_must_fail git rev-parse --verify --quiet $prefix/foo
-'
-
-test_expect_success REFFILES 'delete fails cleanly if packed-refs file is locked' '
-       prefix=refs/locked-packed-refs &&
-       # Set up a reference with differing loose and packed versions:
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       git update-ref $prefix/foo $D &&
-       git for-each-ref $prefix >unchanged &&
-       # Now try to delete it while the `packed-refs` lock is held:
-       : >.git/packed-refs.lock &&
-       test_when_finished "rm -f .git/packed-refs.lock" &&
-       test_must_fail git update-ref -d $prefix/foo >out 2>err &&
-       git for-each-ref $prefix >actual &&
-       test_i18ngrep "Unable to create $SQ.*packed-refs.lock$SQ: " err &&
-       test_cmp unchanged actual
-'
-
-test_expect_success REFFILES 'delete fails cleanly if packed-refs.new write fails' '
-       # Setup and expectations are similar to the test above.
-       prefix=refs/failed-packed-refs &&
-       git update-ref $prefix/foo $C &&
-       git pack-refs --all &&
-       git update-ref $prefix/foo $D &&
-       git for-each-ref $prefix >unchanged &&
-       # This should not happen in practice, but it is an easy way to get a
-       # reliable error (we open with create_tempfile(), which uses O_EXCL).
-       : >.git/packed-refs.new &&
-       test_when_finished "rm -f .git/packed-refs.new" &&
-       test_must_fail git update-ref -d $prefix/foo &&
-       git for-each-ref $prefix >actual &&
-       test_cmp unchanged actual
-'
-
 test_done
index e4627cf1b61f0b3128a79e28f15a9d5e5693e30c..a6bcd62ab658eefcd11ae1778692ad6d7f4c3008 100755 (executable)
@@ -15,14 +15,6 @@ test_expect_success 'setup' '
        test_commit one
 '
 
-test_expect_success REFFILES 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' '
-       N=`find .git/refs -type f | wc -l` &&
-       test "$N" != 0 &&
-       $RUN pack-refs PACK_REFS_PRUNE,PACK_REFS_ALL &&
-       N=`find .git/refs -type f` &&
-       test -z "$N"
-'
-
 test_expect_success 'create_symref(FOO, refs/heads/main)' '
        $RUN create-symref FOO refs/heads/main nothing &&
        echo refs/heads/main >expected &&
@@ -41,12 +33,6 @@ test_expect_success 'delete_refs(FOO, refs/tags/new-tag)' '
        test_must_fail git rev-parse refs/tags/new-tag --
 '
 
-# In reftable, we keep the reflogs around for deleted refs.
-test_expect_success !REFFILES 'delete-reflog(FOO, refs/tags/new-tag)' '
-       $RUN delete-reflog FOO &&
-       $RUN delete-reflog refs/tags/new-tag
-'
-
 test_expect_success 'rename_refs(main, new-main)' '
        git rev-parse main >expected &&
        $RUN rename-ref refs/heads/main refs/heads/new-main &&
@@ -82,11 +68,11 @@ test_expect_success 'verify_ref(new-main)' '
 '
 
 test_expect_success 'for_each_reflog()' '
-       $RUN for-each-reflog | sort -k2 | cut -d" " -f 2- >actual &&
+       $RUN for-each-reflog >actual &&
        cat >expected <<-\EOF &&
-       HEAD 0x1
-       refs/heads/main 0x0
-       refs/heads/new-main 0x0
+       HEAD
+       refs/heads/main
+       refs/heads/new-main
        EOF
        test_cmp expected actual
 '
@@ -112,7 +98,7 @@ test_expect_success 'delete_reflog(HEAD)' '
        test_must_fail git reflog exists HEAD
 '
 
-test_expect_success REFFILES 'create-reflog(HEAD)' '
+test_expect_success 'create-reflog(HEAD)' '
        $RUN create-reflog HEAD &&
        git reflog exists HEAD
 '
index e6a7f7334b6a96e4aa310532c8dc7d6c727fdd16..c01f0f14a1266f93f9066c738693d7c8a9a526dc 100755 (executable)
@@ -63,11 +63,11 @@ test_expect_success 'verify_ref(new-main)' '
 '
 
 test_expect_success 'for_each_reflog()' '
-       $RUN for-each-reflog | sort | cut -d" " -f 2- >actual &&
+       $RUN for-each-reflog >actual &&
        cat >expected <<-\EOF &&
-       HEAD 0x1
-       refs/heads/main 0x0
-       refs/heads/new-main 0x0
+       HEAD
+       refs/heads/main
+       refs/heads/new-main
        EOF
        test_cmp expected actual
 '
index 05b1881c5911780b53a3d882dbe1a4dfae0034d8..48b1c92a41450b25645d6cd782aa86c8e630164b 100755 (executable)
@@ -53,41 +53,4 @@ test_expect_success 'create_symref(FOO, refs/heads/main)' '
        test_cmp expected actual
 '
 
-# Some refs (refs/bisect/*, pseudorefs) are kept per worktree, so they should
-# only appear in the for-each-reflog output if it is called from the correct
-# worktree, which is exercised in this test. This test is poorly written (and
-# therefore marked REFFILES) for mulitple reasons: 1) it creates invalidly
-# formatted log entres. 2) it uses direct FS access for creating the reflogs. 3)
-# PSEUDO-WT and refs/bisect/random do not create reflogs by default, so it is
-# not testing a realistic scenario.
-test_expect_success REFFILES 'for_each_reflog()' '
-       echo $ZERO_OID > .git/logs/PSEUDO-MAIN &&
-       mkdir -p     .git/logs/refs/bisect &&
-       echo $ZERO_OID > .git/logs/refs/bisect/random &&
-
-       echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&
-       mkdir -p     .git/worktrees/wt/logs/refs/bisect &&
-       echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&
-
-       $RWT for-each-reflog | cut -d" " -f 2- | sort >actual &&
-       cat >expected <<-\EOF &&
-       HEAD 0x1
-       PSEUDO-WT 0x0
-       refs/bisect/wt-random 0x0
-       refs/heads/main 0x0
-       refs/heads/wt-main 0x0
-       EOF
-       test_cmp expected actual &&
-
-       $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual &&
-       cat >expected <<-\EOF &&
-       HEAD 0x1
-       PSEUDO-MAIN 0x0
-       refs/bisect/random 0x0
-       refs/heads/main 0x0
-       refs/heads/wt-main 0x0
-       EOF
-       test_cmp expected actual
-'
-
 test_done
index f23c0152a858265e4a8c6b0c068e00823aadb444..7748973733e6adab07117192accabf7698189681 100755 (executable)
@@ -5,6 +5,12 @@ test_description='avoid rewriting packed-refs unnecessarily'
 TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
+if test_have_prereq !REFFILES
+then
+  skip_all='skipping files-backend specific pack-refs tests'
+  test_done
+fi
+
 # Add an identifying mark to the packed-refs file header line. This
 # shouldn't upset readers, and it should be omitted if the file is
 # ever rewritten.
index 6c45965b1e4bef9652a1bc876f28605ad213b261..5bf883f1e363306a74b15df1ab02988564aa3208 100755 (executable)
@@ -29,7 +29,7 @@ check_fsck () {
        '')
                test_must_be_empty fsck.output ;;
        *)
-               test_i18ngrep "$1" fsck.output ;;
+               test_grep "$1" fsck.output ;;
        esac
 }
 
@@ -308,9 +308,9 @@ test_expect_success 'git reflog expire unknown reference' '
        test_config gc.reflogexpireunreachable never &&
 
        test_must_fail git reflog expire main@{123} 2>stderr &&
-       test_i18ngrep "points nowhere" stderr &&
+       test_grep "points nowhere" stderr &&
        test_must_fail git reflog expire does-not-exist 2>stderr &&
-       test_i18ngrep "points nowhere" stderr
+       test_grep "points nowhere" stderr
 '
 
 test_expect_success 'checkout should not delete log for packed ref' '
@@ -354,36 +354,6 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '
        test_must_be_empty actual
 '
 
-# Triggering the bug detected by this test requires a newline to fall
-# exactly BUFSIZ-1 bytes from the end of the file. We don't know
-# what that value is, since it's platform dependent. However, if
-# we choose some value N, we also catch any D which divides N evenly
-# (since we will read backwards in chunks of D). So we choose 8K,
-# which catches glibc (with an 8K BUFSIZ) and *BSD (1K).
-#
-# Each line is 114 characters, so we need 75 to still have a few before the
-# last 8K. The 89-character padding on the final entry lines up our
-# newline exactly.
-test_expect_success REFFILES,SHA1 'parsing reverse reflogs at BUFSIZ boundaries' '
-       git checkout -b reflogskip &&
-       zf=$(test_oid zero_2) &&
-       ident="abc <xyz> 0000000001 +0000" &&
-       for i in $(test_seq 1 75); do
-               printf "$zf%02d $zf%02d %s\t" $i $(($i+1)) "$ident" &&
-               if test $i = 75; then
-                       for j in $(test_seq 1 89); do
-                               printf X || return 1
-                       done
-               else
-                       printf X
-               fi &&
-               printf "\n" || return 1
-       done >.git/logs/refs/heads/reflogskip &&
-       git rev-parse reflogskip@{73} >actual &&
-       echo ${zf}03 >expect &&
-       test_cmp expect actual
-'
-
 test_expect_success 'no segfaults for reflog containing non-commit sha1s' '
        git update-ref --create-reflog -m "Creating ref" \
                refs/tests/tree-in-reflog HEAD &&
@@ -397,18 +367,6 @@ test_expect_failure 'reflog with non-commit entries displays all entries' '
        test_line_count = 3 actual
 '
 
-# This test takes a lock on an individual ref; this is not supported in
-# reftable.
-test_expect_success REFFILES 'reflog expire operates on symref not referrent' '
-       git branch --create-reflog the_symref &&
-       git branch --create-reflog referrent &&
-       git update-ref referrent HEAD &&
-       git symbolic-ref refs/heads/the_symref refs/heads/referrent &&
-       test_when_finished "rm -f .git/refs/heads/referrent.lock" &&
-       touch .git/refs/heads/referrent.lock &&
-       git reflog expire --expire=all the_symref
-'
-
 test_expect_success 'continue walking past root commits' '
        git init orphanage &&
        (
@@ -446,13 +404,144 @@ test_expect_success 'expire with multiple worktrees' '
        )
 '
 
-test_expect_success REFFILES 'empty reflog' '
+test_expect_success 'expire one of multiple worktrees' '
+       git init main-wt2 &&
+       (
+               cd main-wt2 &&
+               test_tick &&
+               test_commit foo &&
+               git worktree add link-wt &&
+               test_tick &&
+               test_commit -C link-wt foobar &&
+               test_tick &&
+               test-tool ref-store worktree:link-wt for-each-reflog-ent HEAD \
+                       >expect-link-wt &&
+               git reflog expire --verbose --all --expire=$test_tick \
+                       --single-worktree &&
+               test-tool ref-store worktree:main for-each-reflog-ent HEAD \
+                       >actual-main &&
+               test-tool ref-store worktree:link-wt for-each-reflog-ent HEAD \
+                       >actual-link-wt &&
+               test_must_be_empty actual-main &&
+               test_cmp expect-link-wt actual-link-wt
+       )
+'
+
+test_expect_success 'empty reflog' '
        test_when_finished "rm -rf empty" &&
        git init empty &&
        test_commit -C empty A &&
-       >empty/.git/logs/refs/heads/foo &&
+       test-tool ref-store main create-reflog refs/heads/foo &&
        git -C empty reflog expire --all 2>err &&
        test_must_be_empty err
 '
 
+test_expect_success 'list reflogs' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               git reflog list >actual &&
+               test_must_be_empty actual &&
+
+               test_commit A &&
+               cat >expect <<-EOF &&
+               HEAD
+               refs/heads/main
+               EOF
+               git reflog list >actual &&
+               test_cmp expect actual &&
+
+               git branch b &&
+               cat >expect <<-EOF &&
+               HEAD
+               refs/heads/b
+               refs/heads/main
+               EOF
+               git reflog list >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'list reflogs with worktree' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+
+               test_commit A &&
+               git worktree add wt &&
+               git -c core.logAllRefUpdates=always \
+                       update-ref refs/worktree/main HEAD &&
+               git -c core.logAllRefUpdates=always \
+                       update-ref refs/worktree/per-worktree HEAD &&
+               git -c core.logAllRefUpdates=always -C wt \
+                       update-ref refs/worktree/per-worktree HEAD &&
+               git -c core.logAllRefUpdates=always -C wt \
+                       update-ref refs/worktree/worktree HEAD &&
+
+               cat >expect <<-EOF &&
+               HEAD
+               refs/heads/main
+               refs/heads/wt
+               refs/worktree/main
+               refs/worktree/per-worktree
+               EOF
+               git reflog list >actual &&
+               test_cmp expect actual &&
+
+               cat >expect <<-EOF &&
+               HEAD
+               refs/heads/main
+               refs/heads/wt
+               refs/worktree/per-worktree
+               refs/worktree/worktree
+               EOF
+               git -C wt reflog list >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'reflog list returns error with additional args' '
+       cat >expect <<-EOF &&
+       error: list does not accept arguments: ${SQ}bogus${SQ}
+       EOF
+       test_must_fail git reflog list bogus 2>err &&
+       test_cmp expect err
+'
+
+test_expect_success 'reflog for symref with unborn target can be listed' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A &&
+               git symbolic-ref HEAD refs/heads/unborn &&
+               cat >expect <<-EOF &&
+               HEAD
+               refs/heads/main
+               EOF
+               git reflog list >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'reflog with invalid object ID can be listed' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A &&
+               test-tool ref-store main update-ref msg refs/heads/missing \
+                       $(test_oid deadbeef) "$ZERO_OID" REF_SKIP_OID_VERIFICATION &&
+               cat >expect <<-EOF &&
+               HEAD
+               refs/heads/main
+               refs/heads/missing
+               EOF
+               git reflog list >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_done
index ea64cecf47bf14277c79cc54e954c64022e0519a..be6c3f472c176525b64383b726ad7b05b664accd 100755 (executable)
@@ -121,13 +121,12 @@ test_expect_success 'min/max age uses entry date to limit' '
 
 # Create a situation where the reflog and ref database disagree about the latest
 # state of HEAD.
-test_expect_success REFFILES 'walk prefers reflog to ref tip' '
+test_expect_success 'walk prefers reflog to ref tip' '
+       test_commit A &&
+       test_commit B &&
+       git reflog delete HEAD@{0} &&
        head=$(git rev-parse HEAD) &&
-       one=$(git rev-parse one) &&
-       ident="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
-       echo "$head $one $ident broken reflog entry" >>.git/logs/HEAD &&
-
-       echo $one >expect &&
+       git rev-parse A >expect &&
        git log -g --format=%H -1 >actual &&
        test_cmp expect actual
 '
index 3b531842dd4c864b45bfd89c36e14f9327d6b29e..eb4eec8becbfa64efcde4e866334363a866c01a2 100755 (executable)
@@ -17,17 +17,6 @@ test_expect_success 'setup' '
        git -C wt2 update-ref refs/worktree/foo HEAD
 '
 
-# The 'packed-refs' file is stored directly in .git/. This means it is global
-# to the repository, and can only contain refs that are shared across all
-# worktrees.
-test_expect_success REFFILES 'refs/worktree must not be packed' '
-       git pack-refs --all &&
-       test_path_is_missing .git/refs/tags/wt1 &&
-       test_path_is_file .git/refs/worktree/foo &&
-       test_path_is_file .git/worktrees/wt1/refs/worktree/foo &&
-       test_path_is_file .git/worktrees/wt2/refs/worktree/foo
-'
-
 test_expect_success 'refs/worktree are per-worktree' '
        test_cmp_rev worktree/foo initial &&
        ( cd wt1 && test_cmp_rev worktree/foo wt1 ) &&
index b32ca798f9ff9fb60796dfefd41ad391e229dbf5..2092488090de5624103f277b8ad3d44030ce3767 100755 (executable)
@@ -37,7 +37,7 @@ test_expect_success 'hook aborts updating ref in prepared state' '
                fi
        EOF
        test_must_fail git update-ref HEAD POST 2>err &&
-       test_i18ngrep "ref updates aborted by hook" err
+       test_grep "ref updates aborted by hook" err
 '
 
 test_expect_success 'hook gets all queued updates in prepared state' '
index 14f13b57c6d2017d199a5d91d6908665c7f2671d..0eb5e674bc1f0dbc688523dd3f94a5e5bb32b6d7 100755 (executable)
@@ -14,9 +14,13 @@ test_expect_success 'setup' '
                test_commit B &&
                test_commit C &&
 
-               cp .git/logs/HEAD HEAD.old &&
+               git reflog HEAD >expect &&
                git reset --hard HEAD~ &&
-               cp HEAD.old .git/logs/HEAD
+               # Make sure that the reflog does not point to the same commit
+               # as HEAD.
+               git reflog delete HEAD@{0} &&
+               git reflog HEAD >actual &&
+               test_cmp expect actual
        )
 '
 
@@ -25,7 +29,7 @@ test_reflog_updateref () {
        shift
        args="$@"
 
-       test_expect_success REFFILES "get '$exp' with '$args'"  '
+       test_expect_success "get '$exp' with '$args'"  '
                test_when_finished "rm -rf copy" &&
                cp -R repo copy &&
 
index 5d8c86b657399e0d8852909a33491449f1eaefa9..13595744190b54e539a581f2409ab3be5e3932d3 100755 (executable)
@@ -8,6 +8,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
+if test_have_prereq !REFFILES
+then
+       skip_all='skipping `git for-each-ref --exclude` tests; need files backend'
+       test_done
+fi
+
 for_each_ref__exclude () {
        GIT_TRACE2_PERF=1 test-tool ref-store main \
                for-each-ref--exclude "$@" >actual.raw
index ff1c967d550318e0b17ad3c9d1e08654c51e7506..0c00118c2b3f798777bad27a7082e5c0a2f29ea4 100755 (executable)
@@ -47,7 +47,7 @@ test_expect_success 'git branch shows badly named ref as warning' '
        test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
        git branch >output 2>error &&
-       test_i18ngrep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
+       test_grep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
        ! grep -e "broken\.\.\.ref" output
 '
 
@@ -158,23 +158,23 @@ test_expect_success 'rev-parse skips symref pointing to broken name' '
        git rev-parse --verify one >expect &&
        git rev-parse --verify shadow >actual 2>err &&
        test_cmp expect actual &&
-       test_i18ngrep "ignoring dangling symref refs/tags/shadow" err
+       test_grep "ignoring dangling symref refs/tags/shadow" err
 '
 
 test_expect_success 'for-each-ref emits warnings for broken names' '
        test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
-       printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname &&
+       test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
-       printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
+       test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
        git for-each-ref >output 2>error &&
        ! grep -e "broken\.\.\.ref" output &&
        ! grep -e "badname" output &&
        ! grep -e "broken\.\.\.symref" output &&
-       test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
-       test_i18ngrep ! "ignoring broken ref refs/heads/badname" error &&
-       test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error
+       test_grep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error &&
+       test_grep ! "ignoring broken ref refs/heads/badname" error &&
+       test_grep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error
 '
 
 test_expect_success 'update-ref -d can delete broken name' '
@@ -192,7 +192,7 @@ test_expect_success 'branch -d can delete broken name' '
        test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
        git branch -d broken...ref >output 2>error &&
-       test_i18ngrep "Deleted branch broken...ref (was broken)" output &&
+       test_grep "Deleted branch broken...ref (was broken)" output &&
        test_must_be_empty error &&
        git branch >output 2>error &&
        ! grep -e "broken\.\.\.ref" error &&
@@ -205,8 +205,9 @@ test_expect_success 'update-ref --no-deref -d can delete symref to broken name'
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
        test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref msg &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
+       test_ref_exists refs/heads/badname &&
        git update-ref --no-deref -d refs/heads/badname >output 2>error &&
-       test_path_is_missing .git/refs/heads/badname &&
+       test_ref_missing refs/heads/badname &&
        test_must_be_empty output &&
        test_must_be_empty error
 '
@@ -216,17 +217,19 @@ test_expect_success 'branch -d can delete symref to broken name' '
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
        test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref msg &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
+       test_ref_exists refs/heads/badname &&
        git branch -d badname >output 2>error &&
-       test_path_is_missing .git/refs/heads/badname &&
-       test_i18ngrep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
+       test_ref_missing refs/heads/badname &&
+       test_grep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
        test_must_be_empty error
 '
 
 test_expect_success 'update-ref --no-deref -d can delete dangling symref to broken name' '
        test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref msg &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
+       test_ref_exists refs/heads/badname &&
        git update-ref --no-deref -d refs/heads/badname >output 2>error &&
-       test_path_is_missing .git/refs/heads/badname &&
+       test_ref_missing refs/heads/badname &&
        test_must_be_empty output &&
        test_must_be_empty error
 '
@@ -234,9 +237,10 @@ test_expect_success 'update-ref --no-deref -d can delete dangling symref to brok
 test_expect_success 'branch -d can delete dangling symref to broken name' '
        test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref msg &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
+       test_ref_exists refs/heads/badname &&
        git branch -d badname >output 2>error &&
-       test_path_is_missing .git/refs/heads/badname &&
-       test_i18ngrep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
+       test_ref_missing refs/heads/badname &&
+       test_grep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
        test_must_be_empty error
 '
 
@@ -245,45 +249,50 @@ test_expect_success 'update-ref -d can delete broken name through symref' '
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
        test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref msg &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
+       test_ref_exists refs/heads/broken...ref &&
        git update-ref -d refs/heads/badname >output 2>error &&
-       test_path_is_missing .git/refs/heads/broken...ref &&
+       test_ref_missing refs/heads/broken...ref &&
        test_must_be_empty output &&
        test_must_be_empty error
 '
 
 test_expect_success 'update-ref --no-deref -d can delete symref with broken name' '
-       printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
+       test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
+       test_ref_exists refs/heads/broken...symref &&
        git update-ref --no-deref -d refs/heads/broken...symref >output 2>error &&
-       test_path_is_missing .git/refs/heads/broken...symref &&
+       test_ref_missing refs/heads/broken...symref &&
        test_must_be_empty output &&
        test_must_be_empty error
 '
 
 test_expect_success 'branch -d can delete symref with broken name' '
-       printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
+       test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
+       test_ref_exists refs/heads/broken...symref &&
        git branch -d broken...symref >output 2>error &&
-       test_path_is_missing .git/refs/heads/broken...symref &&
-       test_i18ngrep "Deleted branch broken...symref (was refs/heads/main)" output &&
+       test_ref_missing refs/heads/broken...symref &&
+       test_grep "Deleted branch broken...symref (was refs/heads/main)" output &&
        test_must_be_empty error
 '
 
 test_expect_success 'update-ref --no-deref -d can delete dangling symref with broken name' '
-       printf "ref: refs/heads/idonotexist\n" >.git/refs/heads/broken...symref &&
+       test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/idonotexist &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
+       test_ref_exists refs/heads/broken...symref &&
        git update-ref --no-deref -d refs/heads/broken...symref >output 2>error &&
-       test_path_is_missing .git/refs/heads/broken...symref &&
+       test_ref_missing refs/heads/broken...symref &&
        test_must_be_empty output &&
        test_must_be_empty error
 '
 
 test_expect_success 'branch -d can delete dangling symref with broken name' '
-       printf "ref: refs/heads/idonotexist\n" >.git/refs/heads/broken...symref &&
+       test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/idonotexist &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
+       test_ref_exists refs/heads/broken...symref &&
        git branch -d broken...symref >output 2>error &&
-       test_path_is_missing .git/refs/heads/broken...symref &&
-       test_i18ngrep "Deleted branch broken...symref (was refs/heads/idonotexist)" output &&
+       test_ref_missing refs/heads/broken...symref &&
+       test_grep "Deleted branch broken...symref (was refs/heads/idonotexist)" output &&
        test_must_be_empty error
 '
 
@@ -292,7 +301,7 @@ test_expect_success 'update-ref -d cannot delete non-ref in .git dir' '
        echo precious >expect &&
        test_must_fail git update-ref -d my-private-file >output 2>error &&
        test_must_be_empty output &&
-       test_i18ngrep -e "refusing to update ref with bad name" error &&
+       test_grep -e "refusing to update ref with bad name" error &&
        test_cmp expect .git/my-private-file
 '
 
index 5805d47eb96c1eb72c761e50a8ba4670f5d7947a..8a456b1142d1cc463f97c5e8809bcfc83ffa1e96 100755 (executable)
@@ -15,6 +15,7 @@ test_expect_success setup '
        git config --unset i18n.commitencoding &&
        git checkout HEAD^0 &&
        test_commit B fileB two &&
+       orig_head=$(git rev-parse HEAD) &&
        git tag -d A B &&
        git reflog expire --expire=now --all
 '
@@ -115,63 +116,62 @@ test_expect_success 'zlib corrupt loose object output ' '
 '
 
 test_expect_success 'branch pointing to non-commit' '
-       git rev-parse HEAD^{tree} >.git/refs/heads/invalid &&
+       tree_oid=$(git rev-parse --verify HEAD^{tree}) &&
        test_when_finished "git update-ref -d refs/heads/invalid" &&
+       test-tool ref-store main update-ref msg refs/heads/invalid $tree_oid $ZERO_OID REF_SKIP_OID_VERIFICATION &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "not a commit" out
+       test_grep "not a commit" out
 '
 
-test_expect_success 'HEAD link pointing at a funny object' '
-       test_when_finished "mv .git/SAVED_HEAD .git/HEAD" &&
-       mv .git/HEAD .git/SAVED_HEAD &&
+test_expect_success REFFILES 'HEAD link pointing at a funny object' '
+       test_when_finished "git update-ref HEAD $orig_head" &&
        echo $ZERO_OID >.git/HEAD &&
        # avoid corrupt/broken HEAD from interfering with repo discovery
        test_must_fail env GIT_DIR=.git git fsck 2>out &&
-       test_i18ngrep "detached HEAD points" out
+       test_grep "detached HEAD points" out
 '
 
 test_expect_success 'HEAD link pointing at a funny place' '
-       test_when_finished "mv .git/SAVED_HEAD .git/HEAD" &&
-       mv .git/HEAD .git/SAVED_HEAD &&
-       echo "ref: refs/funny/place" >.git/HEAD &&
+       test_when_finished "git update-ref --no-deref HEAD $orig_head" &&
+       test-tool ref-store main create-symref HEAD refs/funny/place &&
        # avoid corrupt/broken HEAD from interfering with repo discovery
        test_must_fail env GIT_DIR=.git git fsck 2>out &&
-       test_i18ngrep "HEAD points to something strange" out
+       test_grep "HEAD points to something strange" out
 '
 
-test_expect_success 'HEAD link pointing at a funny object (from different wt)' '
-       test_when_finished "mv .git/SAVED_HEAD .git/HEAD" &&
-       test_when_finished "rm -rf .git/worktrees wt" &&
+test_expect_success REFFILES 'HEAD link pointing at a funny object (from different wt)' '
+       test_when_finished "git update-ref HEAD $orig_head" &&
+       test_when_finished "git worktree remove -f wt" &&
        git worktree add wt &&
-       mv .git/HEAD .git/SAVED_HEAD &&
        echo $ZERO_OID >.git/HEAD &&
        # avoid corrupt/broken HEAD from interfering with repo discovery
        test_must_fail git -C wt fsck 2>out &&
-       test_i18ngrep "main-worktree/HEAD: detached HEAD points" out
+       test_grep "main-worktree/HEAD: detached HEAD points" out
 '
 
-test_expect_success 'other worktree HEAD link pointing at a funny object' '
-       test_when_finished "rm -rf .git/worktrees other" &&
+test_expect_success REFFILES 'other worktree HEAD link pointing at a funny object' '
+       test_when_finished "git worktree remove -f other" &&
        git worktree add other &&
        echo $ZERO_OID >.git/worktrees/other/HEAD &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "worktrees/other/HEAD: detached HEAD points" out
+       test_grep "worktrees/other/HEAD: detached HEAD points" out
 '
 
 test_expect_success 'other worktree HEAD link pointing at missing object' '
-       test_when_finished "rm -rf .git/worktrees other" &&
+       test_when_finished "git worktree remove -f other" &&
        git worktree add other &&
-       echo "Contents missing from repo" | git hash-object --stdin >.git/worktrees/other/HEAD &&
+       object_id=$(echo "Contents missing from repo" | git hash-object --stdin) &&
+       test-tool -C other ref-store main update-ref msg HEAD $object_id "" REF_NO_DEREF,REF_SKIP_OID_VERIFICATION &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "worktrees/other/HEAD: invalid sha1 pointer" out
+       test_grep "worktrees/other/HEAD: invalid sha1 pointer" out
 '
 
 test_expect_success 'other worktree HEAD link pointing at a funny place' '
-       test_when_finished "rm -rf .git/worktrees other" &&
+       test_when_finished "git worktree remove -f other" &&
        git worktree add other &&
-       echo "ref: refs/funny/place" >.git/worktrees/other/HEAD &&
+       git -C other symbolic-ref HEAD refs/funny/place &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "worktrees/other/HEAD points to something strange" out
+       test_grep "worktrees/other/HEAD points to something strange" out
 '
 
 test_expect_success 'commit with multiple signatures is okay' '
@@ -217,7 +217,7 @@ test_expect_success 'email with embedded > is not okay' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in commit $new" out
+       test_grep "error in commit $new" out
 '
 
 test_expect_success 'missing < email delimiter is reported nicely' '
@@ -228,7 +228,7 @@ test_expect_success 'missing < email delimiter is reported nicely' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in commit $new.* - bad name" out
+       test_grep "error in commit $new.* - bad name" out
 '
 
 test_expect_success 'missing email is reported nicely' '
@@ -239,7 +239,7 @@ test_expect_success 'missing email is reported nicely' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in commit $new.* - missing email" out
+       test_grep "error in commit $new.* - missing email" out
 '
 
 test_expect_success '> in name is reported' '
@@ -250,7 +250,7 @@ test_expect_success '> in name is reported' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in commit $new" out
+       test_grep "error in commit $new" out
 '
 
 # date is 2^64 + 1
@@ -263,7 +263,7 @@ test_expect_success 'integer overflow in timestamps is reported' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in commit $new.*integer overflow" out
+       test_grep "error in commit $new.*integer overflow" out
 '
 
 test_expect_success 'commit with NUL in header' '
@@ -274,7 +274,7 @@ test_expect_success 'commit with NUL in header' '
        git update-ref refs/heads/bogus "$new" &&
        test_when_finished "git update-ref -d refs/heads/bogus" &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in commit $new.*unterminated header: NUL at offset" out
+       test_grep "error in commit $new.*unterminated header: NUL at offset" out
 '
 
 test_expect_success 'tree object with duplicate entries' '
@@ -295,7 +295,7 @@ test_expect_success 'tree object with duplicate entries' '
                git hash-object --literally -w -t tree --stdin
        ) &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in tree .*contains duplicate file entries" out
+       test_grep "error in tree .*contains duplicate file entries" out
 '
 
 check_duplicate_names () {
@@ -318,8 +318,8 @@ check_duplicate_names () {
                done >badtree &&
                badtree=$(git mktree <badtree) &&
                test_must_fail git fsck 2>out &&
-               test_i18ngrep "$badtree" out &&
-               test_i18ngrep "error in tree .*contains duplicate file entries" out
+               test_grep "$badtree" out &&
+               test_grep "error in tree .*contains duplicate file entries" out
        '
 }
 
@@ -341,9 +341,9 @@ test_expect_success 'unparseable tree object' '
        commit_sha1=$(git commit-tree $tree_sha1) &&
        git update-ref refs/heads/wrong $commit_sha1 &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error: empty filename in tree entry" out &&
-       test_i18ngrep "$tree_sha1" out &&
-       test_i18ngrep ! "fatal: empty filename in tree entry" out
+       test_grep "error: empty filename in tree entry" out &&
+       test_grep "$tree_sha1" out &&
+       test_grep ! "fatal: empty filename in tree entry" out
 '
 
 test_expect_success 'tree entry with type mismatch' '
@@ -360,8 +360,8 @@ test_expect_success 'tree entry with type mismatch' '
        commit=$(git commit-tree $tree) &&
        git update-ref refs/heads/type_mismatch $commit &&
        test_must_fail git fsck >out 2>&1 &&
-       test_i18ngrep "is a blob, not a tree" out &&
-       test_i18ngrep ! "dangling blob" out
+       test_grep "is a blob, not a tree" out &&
+       test_grep ! "dangling blob" out
 '
 
 test_expect_success 'tree entry with bogus mode' '
@@ -391,10 +391,10 @@ test_expect_success 'tag pointing to nonexistent' '
 
        tag=$(git hash-object -t tag -w --stdin <invalid-tag) &&
        test_when_finished "remove_object $tag" &&
-       echo $tag >.git/refs/tags/invalid &&
+       git update-ref refs/tags/invalid $tag &&
        test_when_finished "git update-ref -d refs/tags/invalid" &&
        test_must_fail git fsck --tags >out &&
-       test_i18ngrep "broken link" out
+       test_grep "broken link" out
 '
 
 test_expect_success 'tag pointing to something else than its type' '
@@ -411,7 +411,7 @@ test_expect_success 'tag pointing to something else than its type' '
 
        tag=$(git hash-object -t tag -w --stdin <wrong-tag) &&
        test_when_finished "remove_object $tag" &&
-       echo $tag >.git/refs/tags/wrong &&
+       git update-ref refs/tags/wrong $tag &&
        test_when_finished "git update-ref -d refs/tags/wrong" &&
        test_must_fail git fsck --tags
 '
@@ -428,7 +428,7 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
 
        tag=$(git hash-object --literally -t tag -w --stdin <wrong-tag) &&
        test_when_finished "remove_object $tag" &&
-       echo $tag >.git/refs/tags/wrong &&
+       git update-ref refs/tags/wrong $tag &&
        test_when_finished "git update-ref -d refs/tags/wrong" &&
        git fsck --tags 2>out &&
 
@@ -452,10 +452,10 @@ test_expect_success 'tag with bad tagger' '
 
        tag=$(git hash-object --literally -t tag -w --stdin <wrong-tag) &&
        test_when_finished "remove_object $tag" &&
-       echo $tag >.git/refs/tags/wrong &&
+       git update-ref refs/tags/wrong $tag &&
        test_when_finished "git update-ref -d refs/tags/wrong" &&
        test_must_fail git fsck --tags 2>out &&
-       test_i18ngrep "error in tag .*: invalid author/committer" out
+       test_grep "error in tag .*: invalid author/committer" out
 '
 
 test_expect_success 'tag with NUL in header' '
@@ -471,10 +471,10 @@ test_expect_success 'tag with NUL in header' '
 
        tag=$(git hash-object --literally -t tag -w --stdin <tag-NUL-header) &&
        test_when_finished "remove_object $tag" &&
-       echo $tag >.git/refs/tags/wrong &&
+       git update-ref refs/tags/wrong $tag &&
        test_when_finished "git update-ref -d refs/tags/wrong" &&
        test_must_fail git fsck --tags 2>out &&
-       test_i18ngrep "error in tag $tag.*unterminated header: NUL at offset" out
+       test_grep "error in tag $tag.*unterminated header: NUL at offset" out
 '
 
 test_expect_success 'cleaned up' '
@@ -504,7 +504,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '
        test_when_finished "git update-ref -d refs/heads/bogus" &&
 
        test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&
-       test_i18ngrep -q "error: hash mismatch $(dirname $new)$(test_oid ff_2)" out
+       test_grep -q "error: hash mismatch $(dirname $new)$(test_oid ff_2)" out
 '
 
 # An actual bit corruption is more likely than swapped commits, but
@@ -575,7 +575,7 @@ test_expect_success 'fsck notices blob entry pointing to null sha1' '
         sha=$(printf "100644 file$_bz$_bzoid" |
               git hash-object --literally -w --stdin -t tree) &&
          git fsck 2>out &&
-         test_i18ngrep "warning.*null sha1" out
+         test_grep "warning.*null sha1" out
        )
 '
 
@@ -585,7 +585,17 @@ test_expect_success 'fsck notices submodule entry pointing to null sha1' '
         sha=$(printf "160000 submodule$_bz$_bzoid" |
               git hash-object --literally -w --stdin -t tree) &&
          git fsck 2>out &&
-         test_i18ngrep "warning.*null sha1" out
+         test_grep "warning.*null sha1" out
+       )
+'
+
+test_expect_success 'fsck notices excessively large tree entry name' '
+       git init large-name &&
+       (
+               cd large-name &&
+               test_commit a-long-name &&
+               git -c fsck.largePathname=warn:10 fsck 2>out &&
+               grep "warning.*large pathname" out
        )
 '
 
@@ -606,7 +616,7 @@ while read name path pretty; do
                        printf "$mode $type %s\t%s" "$value" "$path" >bad &&
                        bad_tree=$(git mktree <bad) &&
                        git fsck 2>out &&
-                       test_i18ngrep "warning.*tree $bad_tree" out
+                       test_grep "warning.*tree $bad_tree" out
                )'
        done <<-\EOF
        100644 blob
@@ -652,9 +662,9 @@ test_expect_success 'NUL in commit' '
                git branch bad $(cat name) &&
 
                test_must_fail git -c fsck.nulInCommit=error fsck 2>warn.1 &&
-               test_i18ngrep nulInCommit warn.1 &&
+               test_grep nulInCommit warn.1 &&
                git fsck 2>warn.2 &&
-               test_i18ngrep nulInCommit warn.2
+               test_grep nulInCommit warn.2
        )
 '
 
@@ -774,7 +784,7 @@ test_expect_success 'fsck --name-objects' '
                tree=$(git rev-parse --verify julius:) &&
                git tag -d julius &&
                test_must_fail git fsck --name-objects >out &&
-               test_i18ngrep "$tree (refs/tags/augustus44\\^:" out
+               test_grep "$tree (refs/tags/augustus44\\^:" out
        )
 '
 
@@ -787,7 +797,7 @@ test_expect_success 'alternate objects are correctly blamed' '
        mkdir alt.git/objects/$(dirname $path) &&
        >alt.git/objects/$(dirname $path)/$(basename $path) &&
        test_must_fail git fsck >out 2>&1 &&
-       test_i18ngrep alt.git out
+       test_grep alt.git out
 '
 
 test_expect_success 'fsck errors in packed objects' '
@@ -806,8 +816,8 @@ test_expect_success 'fsck errors in packed objects' '
        remove_object $one &&
        remove_object $two &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "error in commit $one.* - bad name" out &&
-       test_i18ngrep "error in commit $two.* - bad name" out &&
+       test_grep "error in commit $one.* - bad name" out &&
+       test_grep "error in commit $two.* - bad name" out &&
        ! grep corrupt out
 '
 
@@ -824,7 +834,7 @@ test_expect_success 'fsck fails on corrupt packfile' '
        test_when_finished "rm -f .git/objects/pack/pack-$pack.*" &&
        remove_object $hsh &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "checksum mismatch" out
+       test_grep "checksum mismatch" out
 '
 
 test_expect_success 'fsck finds problems in duplicate loose objects' '
@@ -861,7 +871,7 @@ test_expect_success 'fsck detects trailing loose garbage (commit)' '
        chmod +w "$file" &&
        echo garbage >>"$file" &&
        test_must_fail git fsck 2>out &&
-       test_i18ngrep "garbage.*$commit" out
+       test_grep "garbage.*$commit" out
 '
 
 test_expect_success 'fsck detects trailing loose garbage (large blob)' '
@@ -871,7 +881,7 @@ test_expect_success 'fsck detects trailing loose garbage (large blob)' '
        chmod +w "$file" &&
        echo garbage >>"$file" &&
        test_must_fail git -c core.bigfilethreshold=5 fsck 2>out &&
-       test_i18ngrep "garbage.*$blob" out
+       test_grep "garbage.*$blob" out
 '
 
 test_expect_success 'fsck detects truncated loose object' '
@@ -887,10 +897,10 @@ test_expect_success 'fsck detects truncated loose object' '
 
        # check both regular and streaming code paths
        test_must_fail git fsck 2>out &&
-       test_i18ngrep corrupt.*$blob out &&
+       test_grep corrupt.*$blob out &&
 
        test_must_fail git -c core.bigfilethreshold=128 fsck 2>out &&
-       test_i18ngrep corrupt.*$blob out
+       test_grep corrupt.*$blob out
 '
 
 # for each of type, we have one version which is referenced by another object
@@ -979,7 +989,7 @@ test_expect_success 'detect corrupt index file in fsck' '
        test_when_finished "mv .git/index.backup .git/index" &&
        corrupt_index_checksum &&
        test_must_fail git fsck --cache 2>errors &&
-       test_i18ngrep "bad index file" errors
+       test_grep "bad index file" errors
 '
 
 test_expect_success 'fsck error and recovery on invalid object type' '
index 37ee5091b5caa7c087663cbb51f701084227c414..a669e592f1d95ca7e0dc575697342326a7a6654f 100755 (executable)
@@ -208,6 +208,23 @@ test_expect_success 'rev-parse --show-object-format in repo' '
        grep "unknown mode for --show-object-format: squeamish-ossifrage" err
 '
 
+test_expect_success 'rev-parse --show-ref-format' '
+       test_detect_ref_format >expect &&
+       git rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'rev-parse --show-ref-format with invalid storage' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               git config extensions.refstorage broken &&
+               test_must_fail git rev-parse --show-ref-format 2>err &&
+               grep "error: invalid value for ${SQ}extensions.refstorage${SQ}: ${SQ}broken${SQ}" err
+       )
+'
+
 test_expect_success '--show-toplevel from subdir of working tree' '
        pwd >expect &&
        git -C sub/dir rev-parse --show-toplevel >actual &&
@@ -264,4 +281,27 @@ test_expect_success 'rev-parse --since= unsqueezed ordering' '
        test_cmp expect actual
 '
 
+test_expect_success 'rev-parse --bisect includes bad, excludes good' '
+       test_commit_bulk 6 &&
+
+       git update-ref refs/bisect/bad-1 HEAD~1 &&
+       git update-ref refs/bisect/b HEAD~2 &&
+       git update-ref refs/bisect/bad-3 HEAD~3 &&
+       git update-ref refs/bisect/good-3 HEAD~3 &&
+       git update-ref refs/bisect/bad-4 HEAD~4 &&
+       git update-ref refs/bisect/go HEAD~4 &&
+
+       # Note: refs/bisect/b and refs/bisect/go should be ignored because they
+       # do not match the refs/bisect/bad or refs/bisect/good prefixes.
+       cat >expect <<-EOF &&
+       refs/bisect/bad-1
+       refs/bisect/bad-3
+       refs/bisect/bad-4
+       ^refs/bisect/good-3
+       EOF
+
+       git rev-parse --symbolic-full-name --bisect >actual &&
+       test_cmp expect actual
+'
+
 test_done
index dd811b7fb467c4f3f27ef1be14427e022f73caeb..b754b9fd74bd17e7a969026a93cd6e70c8771cb8 100755 (executable)
@@ -3,13 +3,29 @@
 test_description='test git rev-parse --parseopt'
 . ./test-lib.sh
 
+check_invalid_long_option () {
+       spec="$1"
+       opt="$2"
+       test_expect_success "test --parseopt invalid switch $opt help output for $spec" '
+               {
+                       cat <<-\EOF &&
+                       error: unknown option `'${opt#--}\''
+                       EOF
+                       sed -e 1d -e \$d <"$TEST_DIRECTORY/t1502/$spec.help"
+               } >expect &&
+               test_expect_code 129 git rev-parse --parseopt -- $opt \
+                       2>output <"$TEST_DIRECTORY/t1502/$spec" &&
+               test_cmp expect output
+       '
+}
+
 test_expect_success 'setup optionspec' '
        sed -e "s/^|//" >optionspec <<\EOF
 |some-command [options] <args>...
 |
 |some-command does foo and bar!
 |--
-|h,help    show the help
+|h,help!   show the help
 |
 |foo       some nifty option --foo
 |bar=      some cool option --bar with an argument
@@ -58,44 +74,8 @@ EOF
 '
 
 test_expect_success 'test --parseopt help output' '
-       sed -e "s/^|//" >expect <<\END_EXPECT &&
-|cat <<\EOF
-|usage: some-command [options] <args>...
-|
-|    some-command does foo and bar!
-|
-|    -h, --help            show the help
-|    --foo                 some nifty option --foo
-|    --bar ...             some cool option --bar with an argument
-|    -b, --baz             a short and long option
-|
-|An option group Header
-|    -C[...]               option C with an optional argument
-|    -d, --data[=...]      short and long option with an optional argument
-|
-|Argument hints
-|    -B <arg>              short option required argument
-|    --bar2 <arg>          long option required argument
-|    -e, --fuz <with-space>
-|                          short and long option required argument
-|    -s[<some>]            short option optional argument
-|    --long[=<data>]       long option optional argument
-|    -g, --fluf[=<path>]   short and long option optional argument
-|    --longest <very-long-argument-hint>
-|                          a very long argument hint
-|    --pair <key=value>    with an equals sign in the hint
-|    --aswitch             help te=t contains? fl*g characters!`
-|    --bswitch <hint>      hint has trailing tab character
-|    --cswitch             switch has trailing tab character
-|    --short-hint <a>      with a one symbol hint
-|
-|Extras
-|    --extra1              line above used to cause a segfault but no longer does
-|
-|EOF
-END_EXPECT
        test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
-       test_cmp expect output
+       test_cmp "$TEST_DIRECTORY/t1502/optionspec.help" output
 '
 
 test_expect_success 'test --parseopt help output no switches' '
@@ -131,7 +111,7 @@ test_expect_success 'test --parseopt help-all output hidden switches' '
 |
 |    some-command does foo and bar!
 |
-|    --hidden1             A hidden switch
+|    --[no-]hidden1        A hidden switch
 |
 |EOF
 END_EXPECT
@@ -140,41 +120,12 @@ END_EXPECT
 '
 
 test_expect_success 'test --parseopt invalid switch help output' '
-       sed -e "s/^|//" >expect <<\END_EXPECT &&
-|error: unknown option `does-not-exist'\''
-|usage: some-command [options] <args>...
-|
-|    some-command does foo and bar!
-|
-|    -h, --help            show the help
-|    --foo                 some nifty option --foo
-|    --bar ...             some cool option --bar with an argument
-|    -b, --baz             a short and long option
-|
-|An option group Header
-|    -C[...]               option C with an optional argument
-|    -d, --data[=...]      short and long option with an optional argument
-|
-|Argument hints
-|    -B <arg>              short option required argument
-|    --bar2 <arg>          long option required argument
-|    -e, --fuz <with-space>
-|                          short and long option required argument
-|    -s[<some>]            short option optional argument
-|    --long[=<data>]       long option optional argument
-|    -g, --fluf[=<path>]   short and long option optional argument
-|    --longest <very-long-argument-hint>
-|                          a very long argument hint
-|    --pair <key=value>    with an equals sign in the hint
-|    --aswitch             help te=t contains? fl*g characters!`
-|    --bswitch <hint>      hint has trailing tab character
-|    --cswitch             switch has trailing tab character
-|    --short-hint <a>      with a one symbol hint
-|
-|Extras
-|    --extra1              line above used to cause a segfault but no longer does
-|
-END_EXPECT
+       {
+               cat <<-\EOF &&
+               error: unknown option `does-not-exist'\''
+               EOF
+               sed -e 1d -e \$d <"$TEST_DIRECTORY/t1502/optionspec.help"
+       } >expect &&
        test_expect_code 129 git rev-parse --parseopt -- --does-not-exist 1>/dev/null 2>output < optionspec &&
        test_cmp expect output
 '
@@ -288,7 +239,7 @@ test_expect_success 'test --parseopt help output: "wrapped" options normal "or:"
        |    [--another-option]
        |cmd [--yet-another-option]
        |--
-       |h,help    show the help
+       |h,help!   show the help
        EOF
 
        sed -e "s/^|//" >expect <<-\END_EXPECT &&
@@ -322,7 +273,7 @@ test_expect_success 'test --parseopt help output: multi-line blurb after empty l
        |line
        |blurb
        |--
-       |h,help    show the help
+       |h,help!   show the help
        EOF
 
        sed -e "s/^|//" >expect <<-\END_EXPECT &&
@@ -343,4 +294,43 @@ test_expect_success 'test --parseopt help output: multi-line blurb after empty l
        test_cmp expect actual
 '
 
+test_expect_success 'test --parseopt help output for optionspec-neg' '
+       test_expect_code 129 git rev-parse --parseopt -- \
+               -h >output <"$TEST_DIRECTORY/t1502/optionspec-neg" &&
+       test_cmp "$TEST_DIRECTORY/t1502/optionspec-neg.help" output
+'
+
+test_expect_success 'test --parseopt valid options for optionspec-neg' '
+       cat >expect <<-\EOF &&
+       set -- --foo --no-foo --no-bar --positive-only --no-negative --
+       EOF
+       git rev-parse --parseopt -- <"$TEST_DIRECTORY/t1502/optionspec-neg" >output \
+              --foo --no-foo --no-bar --positive-only --no-negative &&
+       test_cmp expect output
+'
+
+test_expect_success 'test --parseopt positivated option for optionspec-neg' '
+       cat >expect <<-\EOF &&
+       set -- --no-no-bar --no-no-bar --
+       EOF
+       git rev-parse --parseopt -- <"$TEST_DIRECTORY/t1502/optionspec-neg" >output \
+              --no-no-bar --bar &&
+       test_cmp expect output
+'
+
+check_invalid_long_option optionspec-neg --no-positive-only
+check_invalid_long_option optionspec-neg --negative
+check_invalid_long_option optionspec-neg --no-no-negative
+
+test_expect_success 'ambiguous: --no matches both --noble and --no-noble' '
+       cat >spec <<-\EOF &&
+       some-command [options]
+       --
+       noble The feudal switch.
+       EOF
+       test_expect_code 129 env GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=false \
+       git rev-parse --parseopt -- <spec 2>err --no &&
+       grep "error: ambiguous option: no (could be --noble or --no-noble)" err
+'
+
 test_done
diff --git a/t/t1502/.gitattributes b/t/t1502/.gitattributes
new file mode 100644 (file)
index 0000000..562b12e
--- /dev/null
@@ -0,0 +1 @@
+* -whitespace
diff --git a/t/t1502/optionspec-neg b/t/t1502/optionspec-neg
new file mode 100644 (file)
index 0000000..392f43e
--- /dev/null
@@ -0,0 +1,8 @@
+some-command [options] <args>...
+
+some-command does foo and bar!
+--
+foo            can be negated
+no-bar         can be positivated
+positive-only! cannot be negated
+no-negative!   cannot be positivated
diff --git a/t/t1502/optionspec-neg.help b/t/t1502/optionspec-neg.help
new file mode 100644 (file)
index 0000000..7a29f8c
--- /dev/null
@@ -0,0 +1,12 @@
+cat <<\EOF
+usage: some-command [options] <args>...
+
+    some-command does foo and bar!
+
+    --[no-]foo            can be negated
+    --no-bar              can be positivated
+    --bar                 opposite of --no-bar
+    --positive-only       cannot be negated
+    --no-negative         cannot be positivated
+
+EOF
diff --git a/t/t1502/optionspec.help b/t/t1502/optionspec.help
new file mode 100755 (executable)
index 0000000..cbdd54d
--- /dev/null
@@ -0,0 +1,36 @@
+cat <<\EOF
+usage: some-command [options] <args>...
+
+    some-command does foo and bar!
+
+    -h, --help            show the help
+    --[no-]foo            some nifty option --foo
+    --[no-]bar ...        some cool option --bar with an argument
+    -b, --[no-]baz        a short and long option
+
+An option group Header
+    -C[...]               option C with an optional argument
+    -d, --[no-]data[=...] short and long option with an optional argument
+
+Argument hints
+    -B <arg>              short option required argument
+    --[no-]bar2 <arg>     long option required argument
+    -e, --[no-]fuz <with-space>
+                          short and long option required argument
+    -s[<some>]            short option optional argument
+    --[no-]long[=<data>]  long option optional argument
+    -g, --[no-]fluf[=<path>]
+                          short and long option optional argument
+    --[no-]longest <very-long-argument-hint>
+                          a very long argument hint
+    --[no-]pair <key=value>
+                          with an equals sign in the hint
+    --[no-]aswitch        help te=t contains? fl*g characters!`
+    --[no-]bswitch <hint> hint has trailing tab character
+    --[no-]cswitch        switch has trailing tab character
+    --[no-]short-hint <a> with a one symbol hint
+
+Extras
+    --[no-]extra1         line above used to cause a segfault but no longer does
+
+EOF
index bc136833c1098d1c4e43d4b05cfadc7bef50b24c..79df65ec7f619baa053b2aa50d5ec08557cb820a 100755 (executable)
@@ -144,11 +144,6 @@ test_expect_success 'main@{n} for various n' '
        test_must_fail git rev-parse --verify main@{$Np1}
 '
 
-test_expect_success SYMLINKS,REFFILES 'ref resolution not confused by broken symlinks' '
-       ln -s does-not-exist .git/refs/heads/broken &&
-       test_must_fail git rev-parse --verify broken
-'
-
 test_expect_success 'options can appear after --verify' '
        git rev-parse --verify HEAD >expect &&
        git rev-parse --verify -q HEAD >actual &&
index 18688cae17d57e8174f4d1d61eeb2e2ed341eac6..ef40511d8972924fed8abc1e8cb29f9bcf0cda77 100755 (executable)
@@ -107,16 +107,16 @@ test_expect_success 'correct relative file objects (6)' '
 
 test_expect_success 'incorrect revision id' '
        test_must_fail git rev-parse foobar:file.txt 2>error &&
-       test_i18ngrep "invalid object name .foobar." error &&
+       test_grep "invalid object name .foobar." error &&
        test_must_fail git rev-parse foobar 2>error &&
-       test_i18ngrep "unknown revision or path not in the working tree." error
+       test_grep "unknown revision or path not in the working tree." error
 '
 
 test_expect_success 'incorrect file in sha1:path' '
        test_must_fail git rev-parse HEAD:nothing.txt 2>error &&
-       test_i18ngrep "path .nothing.txt. does not exist in .HEAD." error &&
+       test_grep "path .nothing.txt. does not exist in .HEAD." error &&
        test_must_fail git rev-parse HEAD:index-only.txt 2>error &&
-       test_i18ngrep "path .index-only.txt. exists on disk, but not in .HEAD." error &&
+       test_grep "path .index-only.txt. exists on disk, but not in .HEAD." error &&
        (cd subdir &&
         test_must_fail git rev-parse HEAD:file2.txt 2>error &&
         test_did_you_mean HEAD subdir/ file2.txt exists )
@@ -124,9 +124,9 @@ test_expect_success 'incorrect file in sha1:path' '
 
 test_expect_success 'incorrect file in :path and :N:path' '
        test_must_fail git rev-parse :nothing.txt 2>error &&
-       test_i18ngrep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
+       test_grep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
        test_must_fail git rev-parse :1:nothing.txt 2>error &&
-       test_i18ngrep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
+       test_grep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
        test_must_fail git rev-parse :1:file.txt 2>error &&
        test_did_you_mean ":0" "" file.txt "is in the index" "at stage 1" &&
        (cd subdir &&
@@ -137,42 +137,42 @@ test_expect_success 'incorrect file in :path and :N:path' '
         test_must_fail git rev-parse :2:file2.txt 2>error &&
         test_did_you_mean :0 subdir/ file2.txt "is in the index") &&
        test_must_fail git rev-parse :disk-only.txt 2>error &&
-       test_i18ngrep "path .disk-only.txt. exists on disk, but not in the index" error
+       test_grep "path .disk-only.txt. exists on disk, but not in the index" error
 '
 
 test_expect_success 'invalid @{n} reference' '
        test_must_fail git rev-parse main@{99999} >output 2>error &&
        test_must_be_empty output &&
-       test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error  &&
+       test_grep "log for [^ ]* only has [0-9][0-9]* entries" error  &&
        test_must_fail git rev-parse --verify main@{99999} >output 2>error &&
        test_must_be_empty output &&
-       test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error
+       test_grep "log for [^ ]* only has [0-9][0-9]* entries" error
 '
 
 test_expect_success 'relative path not found' '
        (
                cd subdir &&
                test_must_fail git rev-parse HEAD:./nonexistent.txt 2>error &&
-               test_i18ngrep subdir/nonexistent.txt error
+               test_grep subdir/nonexistent.txt error
        )
 '
 
 test_expect_success 'relative path outside worktree' '
        test_must_fail git rev-parse HEAD:../file.txt >output 2>error &&
        test_must_be_empty output &&
-       test_i18ngrep "outside repository" error
+       test_grep "outside repository" error
 '
 
 test_expect_success 'relative path when cwd is outside worktree' '
        test_must_fail git --git-dir=.git --work-tree=subdir rev-parse HEAD:./file.txt >output 2>error &&
        test_must_be_empty output &&
-       test_i18ngrep "relative path syntax can.t be used outside working tree" error
+       test_grep "relative path syntax can.t be used outside working tree" error
 '
 
 test_expect_success '<commit>:file correctly diagnosed after a pathname' '
        test_must_fail git rev-parse file.txt HEAD:file.txt 1>actual 2>error &&
-       test_i18ngrep ! "exists on disk" error &&
-       test_i18ngrep "no such path in the working tree" error &&
+       test_grep ! "exists on disk" error &&
+       test_grep "no such path in the working tree" error &&
        cat >expect <<-\EOF &&
        file.txt
        HEAD:file.txt
@@ -214,13 +214,13 @@ test_expect_success 'dotdot does not peel endpoints' '
 
 test_expect_success 'arg before dashdash must be a revision (missing)' '
        test_must_fail git rev-parse foobar -- 2>stderr &&
-       test_i18ngrep "bad revision" stderr
+       test_grep "bad revision" stderr
 '
 
 test_expect_success 'arg before dashdash must be a revision (file)' '
        >foobar &&
        test_must_fail git rev-parse foobar -- 2>stderr &&
-       test_i18ngrep "bad revision" stderr
+       test_grep "bad revision" stderr
 '
 
 test_expect_success 'arg before dashdash must be a revision (ambiguous)' '
@@ -269,7 +269,7 @@ test_expect_success 'arg after dashdash not interpreted as option' '
 
 test_expect_success 'arg after end-of-options not interpreted as option' '
        test_must_fail git rev-parse --end-of-options --not-real -- 2>err &&
-       test_i18ngrep bad.revision.*--not-real err
+       test_grep bad.revision.*--not-real err
 '
 
 test_expect_success 'end-of-options still allows --' '
index 6d47e2c725f7c7842a604b7a72fd4c4ca64e71bb..dc997e0a643752708fb04a8f64032127f02a5cfd 100755 (executable)
@@ -43,7 +43,7 @@ rsync --exclude-from t/t1509/excludes -Ha . "$R$(pwd)"
 # env might slip through, see test-lib.sh, unset.*PERL_PATH
 sed 's|^PERL_PATH=.*|PERL_PATH=/bin/true|' GIT-BUILD-OPTIONS > "$R$(pwd)/GIT-BUILD-OPTIONS"
 for cmd in git $BB;do 
-       ldd $cmd | grep '/' | sed 's,.*\s\(/[^ ]*\).*,\1,' | while read i; do
+       ldd $cmd | sed -n '/\//s,.*\s\(/[^ ]*\).*,\1,p' | while read i; do
                mkdir -p "$R$(dirname $i)"
                cp "$i" "$R/$i"
        done
index 98cefe3b7039fe726148e47fdf81b1f9fb454e15..70f1e0a998e103704373e2cc4ffd21e09c7c64b0 100755 (executable)
@@ -129,7 +129,7 @@ test_expect_success 'blob and tree' '
 
 test_expect_success 'warn ambiguity when no candidate matches type hint' '
        test_must_fail git rev-parse --verify 000000000^{commit} 2>actual &&
-       test_i18ngrep "short object ID 000000000 is ambiguous" actual
+       test_grep "short object ID 000000000 is ambiguous" actual
 '
 
 test_expect_success 'disambiguate tree-ish' '
@@ -470,10 +470,10 @@ test_expect_success 'cat-file --batch and --batch-check show ambiguous' '
        echo "0000 ambiguous" >expect &&
        echo 0000 | git cat-file --batch-check >actual 2>err &&
        test_cmp expect actual &&
-       test_i18ngrep hint: err &&
+       test_grep hint: err &&
        echo 0000 | git cat-file --batch >actual 2>err &&
        test_cmp expect actual &&
-       test_i18ngrep hint: err
+       test_grep hint: err
 '
 
 test_done
index 9368d82f7d70ca8133616ed40f167ae4344266c4..62e7fd15964bba7cbc8904471879027219368951 100755 (executable)
@@ -118,7 +118,7 @@ test_index_version () {
                fi &&
                git add a &&
                echo $EXPECTED_OUTPUT_VERSION >expect &&
-               test-tool index-version <.git/index >actual &&
+               git update-index --show-index-version >actual &&
                test_cmp expect actual
        )
 }
index b4ab166369ec06c69add33eb240d69531459276c..a7b7263b35d1d8f142eec5311c9e42c25e398878 100755 (executable)
@@ -43,7 +43,7 @@ test_expect_success 'enable split index' '
        git config splitIndex.maxPercentChange 100 &&
        git update-index --split-index &&
        test-tool dump-split-index .git/index >actual &&
-       indexversion=$(test-tool index-version <.git/index) &&
+       indexversion=$(git update-index --show-index-version) &&
 
        # NEEDSWORK: Stop hard-coding checksums.
        if test "$indexversion" = "4"
index b16d69ca4ae0e8b61ce00a085273d8ad6f40f104..98e818f09f21fe6ea374dba692c3f4ed619af735 100755 (executable)
@@ -93,7 +93,7 @@ test_expect_success 'checkout all stages of unknown path' '
        rm -f path* .merge_* actual &&
        test_must_fail git checkout-index --stage=all --temp \
                -- does-not-exist 2>stderr &&
-       test_i18ngrep not.in.the.cache stderr
+       test_grep not.in.the.cache stderr
 '
 
 test_expect_success 'checkout all stages/one file to nothing' '
@@ -117,6 +117,26 @@ test_expect_success 'checkout all stages/one file to temporary files' '
        test $(cat $s3) = tree3path1)
 '
 
+test_expect_success '--stage=all implies --temp' '
+       rm -f path* .merge_* actual &&
+       git checkout-index --stage=all -- path1 &&
+       test_path_is_missing path1
+'
+
+test_expect_success 'overriding --stage=all resets implied --temp' '
+       rm -f path* .merge_* actual &&
+       git checkout-index --stage=all --stage=2 -- path1 &&
+       echo tree2path1 >expect &&
+       test_cmp expect path1
+'
+
+test_expect_success '--stage=all --no-temp is rejected' '
+       rm -f path* .merge_* actual &&
+       test_must_fail git checkout-index --stage=all --no-temp -- path1 2>err &&
+       grep -v "already exists" err &&
+       grep "options .--stage=all. and .--no-temp. cannot be used together" err
+'
+
 test_expect_success 'checkout some stages/one file to temporary files' '
        rm -f path* .merge_* actual &&
        git checkout-index --stage=all --temp -- path2 >actual &&
index 5d119871d416cd4e79b3bff7c56aeac729b276e6..570ba38580d99513fe12a2c6ed1e1a4c6951e0e2 100755 (executable)
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true
 
 test_expect_success 'checkout-index --gobbledegook' '
        test_expect_code 129 git checkout-index --gobbledegook 2>err &&
-       test_i18ngrep "[Uu]sage" err
+       test_grep "[Uu]sage" err
 '
 
 test_expect_success 'checkout-index -h in broken repository' '
@@ -19,18 +19,18 @@ test_expect_success 'checkout-index -h in broken repository' '
                >.git/index &&
                test_expect_code 129 git checkout-index -h >usage 2>&1
        ) &&
-       test_i18ngrep "[Uu]sage" broken/usage
+       test_grep "[Uu]sage" broken/usage
 '
 
 test_expect_success 'checkout-index reports errors (cmdline)' '
        test_must_fail git checkout-index -- does-not-exist 2>stderr &&
-       test_i18ngrep not.in.the.cache stderr
+       test_grep not.in.the.cache stderr
 '
 
 test_expect_success 'checkout-index reports errors (stdin)' '
        echo does-not-exist |
        test_must_fail git checkout-index --stdin 2>stderr &&
-       test_i18ngrep not.in.the.cache stderr
+       test_grep not.in.the.cache stderr
 '
 for mode in 'case' 'utf-8'
 do
@@ -88,8 +88,8 @@ test_expect_success 'checkout-index --temp correctly reports error on missing bl
        git update-index --index-info <objs &&
 
        test_must_fail git checkout-index --temp symlink file 2>stderr &&
-       test_i18ngrep "unable to read sha1 file of file ($missing_blob)" stderr &&
-       test_i18ngrep "unable to read sha1 file of symlink ($missing_blob)" stderr
+       test_grep "unable to read sha1 file of file ($missing_blob)" stderr &&
+       test_grep "unable to read sha1 file of symlink ($missing_blob)" stderr
 '
 
 test_expect_success 'checkout-index --temp correctly reports error for submodules' '
@@ -98,7 +98,7 @@ test_expect_success 'checkout-index --temp correctly reports error for submodule
        git submodule add ./sub &&
        git commit -m sub &&
        test_must_fail git checkout-index --temp sub 2>stderr &&
-       test_i18ngrep "cannot create temporary submodule sub" stderr
+       test_grep "cannot create temporary submodule sub" stderr
 '
 
 test_done
index 9d4b37526a326396fc334580350ff3cef3102b1e..82c3bfeac1ad9b96eb2adb9ae835fb2032222bd5 100755 (executable)
@@ -62,8 +62,8 @@ test_expect_success 'disambiguate checking out from a tree-ish' '
 
 test_expect_success 'accurate error message with more than one ref' '
        test_must_fail git checkout HEAD main -- 2>actual &&
-       test_i18ngrep 2 actual &&
-       test_i18ngrep "one reference expected, 2 given" actual
+       test_grep 2 actual &&
+       test_grep "one reference expected, 2 given" actual
 '
 
 test_done
index d9997e7b6b41a19537eed0bd512be1e8c78dc3d6..04f53b1ea14cb5046ee3cf3ad70804812c6fce8a 100755 (executable)
@@ -18,12 +18,12 @@ test_expect_success 'checkout should not start branch from a tree' '
        test_must_fail git checkout -b newbranch main^{tree}
 '
 
-test_expect_success 'checkout main from invalid HEAD' '
+test_expect_success REFFILES 'checkout main from invalid HEAD' '
        echo $ZERO_OID >.git/HEAD &&
        git checkout main --
 '
 
-test_expect_success 'checkout notices failure to lock HEAD' '
+test_expect_success REFFILES 'checkout notices failure to lock HEAD' '
        test_when_finished "rm -f .git/HEAD.lock" &&
        >.git/HEAD.lock &&
        test_must_fail git checkout -b other
@@ -31,11 +31,8 @@ test_expect_success 'checkout notices failure to lock HEAD' '
 
 test_expect_success 'create ref directory/file conflict scenario' '
        git update-ref refs/heads/outer/inner main &&
-
-       # do not rely on symbolic-ref to get a known state,
-       # as it may use the same code we are testing
        reset_to_df () {
-               echo "ref: refs/heads/outer" >.git/HEAD
+               git symbolic-ref HEAD refs/heads/outer
        }
 '
 
index 747eb5563eca8f1df4374f179a08019221ba1fac..c4f9bf09aa4fd8d541a858d55cfbff34e78de1c0 100755 (executable)
@@ -38,26 +38,32 @@ test_expect_success 'git checkout -p with staged changes' '
        verify_state dir/foo index index
 '
 
-test_expect_success 'git checkout -p HEAD with NO staged changes: abort' '
-       set_and_save_state dir/foo work head &&
-       test_write_lines n y n | git checkout -p HEAD &&
-       verify_saved_state bar &&
-       verify_saved_state dir/foo
-'
-
-test_expect_success 'git checkout -p HEAD with NO staged changes: apply' '
-       test_write_lines n y y | git checkout -p HEAD &&
-       verify_saved_state bar &&
-       verify_state dir/foo head head
-'
-
-test_expect_success 'git checkout -p HEAD with change already staged' '
-       set_state dir/foo index index &&
-       # the third n is to get out in case it mistakenly does not apply
-       test_write_lines n y n | git checkout -p HEAD &&
-       verify_saved_state bar &&
-       verify_state dir/foo head head
-'
+for opt in "HEAD" "@"
+do
+       test_expect_success "git checkout -p $opt with NO staged changes: abort" '
+               set_and_save_state dir/foo work head &&
+               test_write_lines n y n | git checkout -p $opt >output &&
+               verify_saved_state bar &&
+               verify_saved_state dir/foo &&
+               test_grep "Discard" output
+       '
+
+       test_expect_success "git checkout -p $opt with NO staged changes: apply" '
+               test_write_lines n y y | git checkout -p $opt >output &&
+               verify_saved_state bar &&
+               verify_state dir/foo head head &&
+               test_grep "Discard" output
+       '
+
+       test_expect_success "git checkout -p $opt with change already staged" '
+               set_state dir/foo index index &&
+               # the third n is to get out in case it mistakenly does not apply
+               test_write_lines n y n | git checkout -p $opt >output &&
+               verify_saved_state bar &&
+               verify_state dir/foo head head &&
+               test_grep "Discard" output
+       '
+done
 
 test_expect_success 'git checkout -p HEAD^...' '
        # the third n is to get out in case it mistakenly does not apply
index 947d1587ac8be9a2ab333049a2196c4e211185e6..a5c7358eeabefb3dacc94ae94e2c61d200381ac5 100755 (executable)
@@ -86,7 +86,7 @@ test_expect_success '--orphan makes reflog by default' '
        git rev-parse --verify delta@{0}
 '
 
-test_expect_success REFFILES '--orphan does not make reflog when core.logAllRefUpdates = false' '
+test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '
        git checkout main &&
        git config core.logAllRefUpdates false &&
        git checkout --orphan epsilon &&
index 8581ad3437907862e022e1bea8339182d68ef873..43551cc1481c3813c3aae0b291bac2b1a17b63d7 100755 (executable)
@@ -278,12 +278,12 @@ test_expect_success 'checkout -b to a new branch preserves mergeable changes des
 
 test_expect_success 'checkout -b rejects an invalid start point' '
        test_must_fail git checkout -b branch4 file1 2>err &&
-       test_i18ngrep "is not a commit" err
+       test_grep "is not a commit" err
 '
 
 test_expect_success 'checkout -b rejects an extra path argument' '
        test_must_fail git checkout -b branch5 branch1 file1 2>err &&
-       test_i18ngrep "Cannot update paths and switch to branch" err
+       test_grep "Cannot update paths and switch to branch" err
 '
 
 test_done
index 95405886640a4fb304a565ccc4a166f450c0f5c8..c67261e2b68a9d330dc14c92783a485b0f605601 100755 (executable)
@@ -32,8 +32,8 @@ test_expect_success 'checkout chooses branch over tag' '
 '
 
 test_expect_success 'checkout reports switch to branch' '
-       test_i18ngrep "Switched to branch" stderr &&
-       test_i18ngrep ! "^HEAD is now at" stderr
+       test_grep "Switched to branch" stderr &&
+       test_grep ! "^HEAD is now at" stderr
 '
 
 test_expect_success 'checkout vague ref succeeds' '
@@ -54,8 +54,8 @@ test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' '
 '
 
 test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' '
-       test_i18ngrep "Switched to branch" stderr &&
-       test_i18ngrep ! "^HEAD is now at" stderr
+       test_grep "Switched to branch" stderr &&
+       test_grep ! "^HEAD is now at" stderr
 '
 
 test_done
index 2eab6474f8d0f4b3116455c95cb71cd69f78a311..bce284c2978848967ffe88764e396fad5059df54 100755 (executable)
@@ -17,12 +17,12 @@ check_not_detached () {
 
 PREV_HEAD_DESC='Previous HEAD position was'
 check_orphan_warning() {
-       test_i18ngrep "you are leaving $2 behind" "$1" &&
-       test_i18ngrep ! "$PREV_HEAD_DESC" "$1"
+       test_grep "you are leaving $2 behind" "$1" &&
+       test_grep ! "$PREV_HEAD_DESC" "$1"
 }
 check_no_orphan_warning() {
-       test_i18ngrep ! "you are leaving .* commit.*behind" "$1" &&
-       test_i18ngrep "$PREV_HEAD_DESC" "$1"
+       test_grep ! "you are leaving .* commit.*behind" "$1" &&
+       test_grep "$PREV_HEAD_DESC" "$1"
 }
 
 reset () {
@@ -45,6 +45,18 @@ test_expect_success 'checkout branch does not detach' '
        check_not_detached
 '
 
+for opt in "HEAD" "@"
+do
+       test_expect_success "checkout $opt no-op/don't detach" '
+               reset &&
+               cat .git/HEAD >expect &&
+               git checkout $opt &&
+               cat .git/HEAD >actual &&
+               check_not_detached &&
+               test_cmp expect actual
+       '
+done
+
 test_expect_success 'checkout tag detaches' '
        reset &&
        git checkout tag &&
index 74049a9812ba4ff80bce1b235d636782800a5a13..a3b1449ef1166756e5bd029a2f94ac6e1c50b03b 100755 (executable)
@@ -93,7 +93,7 @@ test_expect_success 'when arg matches multiple remotes, do not fallback to inter
 
        test_must_fail git checkout ambiguous_branch_and_file 2>err &&
 
-       test_i18ngrep "matched multiple (2) remote tracking branches" err &&
+       test_grep "matched multiple (2) remote tracking branches" err &&
 
        # file must not be altered
        test_cmp expect ambiguous_branch_and_file
@@ -105,20 +105,20 @@ test_expect_success 'checkout of branch from multiple remotes fails with advice'
        test_must_fail git checkout foo 2>stderr &&
        test_branch main &&
        status_uno_is_clean &&
-       test_i18ngrep "^hint: " stderr &&
+       test_grep "^hint: " stderr &&
        test_must_fail git -c advice.checkoutAmbiguousRemoteBranchName=false \
                checkout foo 2>stderr &&
        test_branch main &&
        status_uno_is_clean &&
-       test_i18ngrep ! "^hint: " stderr
+       test_grep ! "^hint: " stderr
 '
 
-test_expect_success PERL 'checkout -p with multiple remotes does not print advice' '
+test_expect_success 'checkout -p with multiple remotes does not print advice' '
        git checkout -B main &&
        test_might_fail git branch -D foo &&
 
        git checkout -p foo 2>stderr &&
-       test_i18ngrep ! "^hint: " stderr &&
+       test_grep ! "^hint: " stderr &&
        status_uno_is_clean
 '
 
index 3832c3de8135524b4294b7ece693194b3bf506c1..246609d54d050e5fce76730318123b30f322b75a 100755 (executable)
@@ -26,7 +26,7 @@ test_expect_success 'checkout --no-overlay removing last file from directory' '
 
 test_expect_success 'checkout -p --overlay is disallowed' '
        test_must_fail git checkout -p --overlay HEAD 2>actual &&
-       test_i18ngrep "fatal: options .-p. and .--overlay. cannot be used together" actual
+       test_grep "fatal: options .-p. and .--overlay. cannot be used together" actual
 '
 
 test_expect_success '--no-overlay --theirs with D/F conflict deletes file' '
index 9c651aefbca44283f3ac5f018557d97fb615106c..acd55217a6231c35d17f4fbefe2ea27e30d05501 100755 (executable)
@@ -149,16 +149,16 @@ test_expect_success 'error conditions' '
        echo fileA.t >list &&
 
        test_must_fail git checkout --pathspec-from-file=list --detach 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--detach. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--detach. cannot be used together" err &&
 
        test_must_fail git checkout --pathspec-from-file=list --patch 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git checkout --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
+       test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git checkout --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
+       test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
 '
 
 test_done
index a8bbc60954f5f0d41815582a32d85f70e4dc2b8c..98f16c72399806d2e0a5cdc0580072dcc8c65dae 100755 (executable)
@@ -22,7 +22,7 @@ test_expect_success 'checkout --track -b creates a new tracking branch' '
 
 test_expect_success 'checkout --track -b rejects an extra path argument' '
        test_must_fail git checkout --track -b branch2 main one.t 2>err &&
-       test_i18ngrep "cannot be used with updating paths" err
+       test_grep "cannot be used with updating paths" err
 '
 
 test_expect_success 'checkout --track -b overrides autoSetupMerge=inherit' '
index 2d8c70b03a50e9ca082f7343d78dbcf6ad456159..be3fcdde07562c27da31e7dfe549058f3ced0ea9 100755 (executable)
@@ -37,11 +37,17 @@ prime_resolve_undo () {
        git checkout second^0 &&
        test_tick &&
        test_must_fail git merge third^0 &&
-       echo merge does not leave anything &&
        check_resolve_undo empty &&
-       echo different >fi/le &&
-       git add fi/le &&
-       echo resolving records &&
+
+       # how should the conflict be resolved?
+       case "$1" in
+       remove)
+               rm -f file/le && git rm fi/le
+               ;;
+       *) # modify
+               echo different >fi/le && git add fi/le
+               ;;
+       esac
        check_resolve_undo recorded fi/le initial:fi/le second:fi/le third:fi/le
 }
 
@@ -122,6 +128,37 @@ test_expect_success 'add records checkout -m undoes' '
 test_expect_success 'unmerge with plumbing' '
        prime_resolve_undo &&
        git update-index --unresolve fi/le &&
+       git ls-files --resolve-undo fi/le >actual &&
+       test_must_be_empty actual &&
+       git ls-files -u >actual &&
+       test_line_count = 3 actual
+'
+
+test_expect_success 'unmerge can be done even after committing' '
+       prime_resolve_undo &&
+       git commit -m "record to nuke MERGE_HEAD" &&
+       git update-index --unresolve fi/le &&
+       git ls-files --resolve-undo fi/le >actual &&
+       test_must_be_empty actual &&
+       git ls-files -u >actual &&
+       test_line_count = 3 actual
+'
+
+test_expect_success 'unmerge removal' '
+       prime_resolve_undo remove &&
+       git update-index --unresolve fi/le &&
+       git ls-files --resolve-undo fi/le >actual &&
+       test_must_be_empty actual &&
+       git ls-files -u >actual &&
+       test_line_count = 3 actual
+'
+
+test_expect_success 'unmerge removal after committing' '
+       prime_resolve_undo remove &&
+       git commit -m "record to nuke MERGE_HEAD" &&
+       git update-index --unresolve fi/le &&
+       git ls-files --resolve-undo fi/le >actual &&
+       test_must_be_empty actual &&
        git ls-files -u >actual &&
        test_line_count = 3 actual
 '
@@ -191,7 +228,7 @@ test_expect_success 'rerere forget (add-add conflict)' '
        git commit -m "add differently" &&
        test_must_fail git merge fifth &&
        git rerere forget add-differently 2>actual &&
-       test_i18ngrep "no remembered" actual
+       test_grep "no remembered" actual
 '
 
 test_expect_success 'resolve-undo keeps blobs from gc' '
index e247a4735bbc26b01fecd600ed3e529bea16f464..c91c4db9361133e4e790f2c0201c5f41c14eaff1 100755 (executable)
@@ -170,8 +170,10 @@ test_expect_success 'switch back when temporarily detached and checked out elsew
        # we test in both worktrees to ensure that works
        # as expected with "first" and "next" worktrees
        test_must_fail git -C wt1 switch shared &&
+       test_must_fail git -C wt1 switch -C shared &&
        git -C wt1 switch --ignore-other-worktrees shared &&
        test_must_fail git -C wt2 switch shared &&
+       test_must_fail git -C wt2 switch -C shared &&
        git -C wt2 switch --ignore-other-worktrees shared
 '
 
index c5d19dd973d7f4ea7a3a496d7df92a5c74fa667d..ac404945d4c4e28b608f664f64c4b422557b2684 100755 (executable)
@@ -5,6 +5,7 @@ test_description='restore basic functionality'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
@@ -137,11 +138,78 @@ test_expect_success 'restore --staged invalidates cache tree for deletions' '
        test_must_fail git rev-parse HEAD:new1
 '
 
-test_expect_success 'restore with merge options rejects --staged' '
+test_expect_success 'restore --merge to unresolve' '
+       O=$(echo original | git hash-object -w --stdin) &&
+       A=$(echo ourside | git hash-object -w --stdin) &&
+       B=$(echo theirside | git hash-object -w --stdin) &&
+       {
+               echo "100644 $O 1       file" &&
+               echo "100644 $A 2       file" &&
+               echo "100644 $B 3       file"
+       } | git update-index --index-info &&
+       echo nothing >file &&
+       git restore --worktree --merge file &&
+       cat >expect <<-\EOF &&
+       <<<<<<< ours
+       ourside
+       =======
+       theirside
+       >>>>>>> theirs
+       EOF
+       test_cmp expect file
+'
+
+test_expect_success 'restore --merge to unresolve after (mistaken) resolution' '
+       O=$(echo original | git hash-object -w --stdin) &&
+       A=$(echo ourside | git hash-object -w --stdin) &&
+       B=$(echo theirside | git hash-object -w --stdin) &&
+       {
+               echo "100644 $O 1       file" &&
+               echo "100644 $A 2       file" &&
+               echo "100644 $B 3       file"
+       } | git update-index --index-info &&
+       echo nothing >file &&
+       git add file &&
+       git restore --worktree --merge file &&
+       cat >expect <<-\EOF &&
+       <<<<<<< ours
+       ourside
+       =======
+       theirside
+       >>>>>>> theirs
+       EOF
+       test_cmp expect file
+'
+
+test_expect_success 'restore --merge to unresolve after (mistaken) resolution' '
+       O=$(echo original | git hash-object -w --stdin) &&
+       A=$(echo ourside | git hash-object -w --stdin) &&
+       B=$(echo theirside | git hash-object -w --stdin) &&
+       {
+               echo "100644 $O 1       file" &&
+               echo "100644 $A 2       file" &&
+               echo "100644 $B 3       file"
+       } | git update-index --index-info &&
+       git rm -f file &&
+       git restore --worktree --merge file &&
+       cat >expect <<-\EOF &&
+       <<<<<<< ours
+       ourside
+       =======
+       theirside
+       >>>>>>> theirs
+       EOF
+       test_cmp expect file
+'
+
+test_expect_success 'restore with merge options are incompatible with certain options' '
        for opts in \
                "--staged --ours" \
                "--staged --theirs" \
                "--staged --merge" \
+               "--source=HEAD --ours" \
+               "--source=HEAD --theirs" \
+               "--source=HEAD --merge" \
                "--staged --conflict=diff3" \
                "--staged --worktree --ours" \
                "--staged --worktree --theirs" \
@@ -149,7 +217,7 @@ test_expect_success 'restore with merge options rejects --staged' '
                "--staged --worktree --conflict=zdiff3"
        do
                test_must_fail git restore $opts . 2>err &&
-               grep "cannot be used with --staged" err || return
+               grep "cannot be used" err || return
        done
 '
 
index b5c5c0ff7e37ced9b6b50a06e4ec3e30c536cd53..42d552211915754e14ddb79d869fc9ba8f517fce 100755 (executable)
@@ -2,9 +2,10 @@
 
 test_description='git restore --patch'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-patch-mode.sh
 
-test_expect_success PERL 'setup' '
+test_expect_success 'setup' '
        mkdir dir &&
        echo parent >dir/foo &&
        echo dummy >bar &&
@@ -16,43 +17,47 @@ test_expect_success PERL 'setup' '
        save_head
 '
 
-test_expect_success PERL 'restore -p without pathspec is fine' '
+test_expect_success 'restore -p without pathspec is fine' '
        echo q >cmd &&
        git restore -p <cmd
 '
 
 # note: bar sorts before dir/foo, so the first 'n' is always to skip 'bar'
 
-test_expect_success PERL 'saying "n" does nothing' '
+test_expect_success 'saying "n" does nothing' '
        set_and_save_state dir/foo work head &&
        test_write_lines n n | git restore -p &&
        verify_saved_state bar &&
        verify_saved_state dir/foo
 '
 
-test_expect_success PERL 'git restore -p' '
+test_expect_success 'git restore -p' '
        set_and_save_state dir/foo work head &&
        test_write_lines n y | git restore -p &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
 
-test_expect_success PERL 'git restore -p with staged changes' '
+test_expect_success 'git restore -p with staged changes' '
        set_state dir/foo work index &&
        test_write_lines n y | git restore -p &&
        verify_saved_state bar &&
        verify_state dir/foo index index
 '
 
-test_expect_success PERL 'git restore -p --source=HEAD' '
-       set_state dir/foo work index &&
-       # the third n is to get out in case it mistakenly does not apply
-       test_write_lines n y n | git restore -p --source=HEAD &&
-       verify_saved_state bar &&
-       verify_state dir/foo head index
-'
-
-test_expect_success PERL 'git restore -p --source=HEAD^' '
+for opt in "HEAD" "@"
+do
+       test_expect_success "git restore -p --source=$opt" '
+               set_state dir/foo work index &&
+               # the third n is to get out in case it mistakenly does not apply
+               test_write_lines n y n | git restore -p --source=$opt >output &&
+               verify_saved_state bar &&
+               verify_state dir/foo head index &&
+               test_grep "Discard" output
+       '
+done
+
+test_expect_success 'git restore -p --source=HEAD^' '
        set_state dir/foo work index &&
        # the third n is to get out in case it mistakenly does not apply
        test_write_lines n y n | git restore -p --source=HEAD^ &&
@@ -60,7 +65,7 @@ test_expect_success PERL 'git restore -p --source=HEAD^' '
        verify_state dir/foo parent index
 '
 
-test_expect_success PERL 'git restore -p --source=HEAD^...' '
+test_expect_success 'git restore -p --source=HEAD^...' '
        set_state dir/foo work index &&
        # the third n is to get out in case it mistakenly does not apply
        test_write_lines n y n | git restore -p --source=HEAD^... &&
@@ -68,7 +73,7 @@ test_expect_success PERL 'git restore -p --source=HEAD^...' '
        verify_state dir/foo parent index
 '
 
-test_expect_success PERL 'git restore -p handles deletion' '
+test_expect_success 'git restore -p handles deletion' '
        set_state dir/foo work index &&
        rm dir/foo &&
        test_write_lines n y | git restore -p &&
@@ -81,21 +86,21 @@ test_expect_success PERL 'git restore -p handles deletion' '
 # dir/foo.  There's always an extra 'n' to reject edits to dir/foo in
 # the failure case (and thus get out of the loop).
 
-test_expect_success PERL 'path limiting works: dir' '
+test_expect_success 'path limiting works: dir' '
        set_state dir/foo work head &&
        test_write_lines y n | git restore -p dir &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
 
-test_expect_success PERL 'path limiting works: -- dir' '
+test_expect_success 'path limiting works: -- dir' '
        set_state dir/foo work head &&
        test_write_lines y n | git restore -p -- dir &&
        verify_saved_state bar &&
        verify_state dir/foo head head
 '
 
-test_expect_success PERL 'path limiting works: HEAD^ -- dir' '
+test_expect_success 'path limiting works: HEAD^ -- dir' '
        set_state dir/foo work head &&
        # the third n is to get out in case it mistakenly does not apply
        test_write_lines y n n | git restore -p --source=HEAD^ -- dir &&
@@ -103,7 +108,7 @@ test_expect_success PERL 'path limiting works: HEAD^ -- dir' '
        verify_state dir/foo parent head
 '
 
-test_expect_success PERL 'path limiting works: foo inside dir' '
+test_expect_success 'path limiting works: foo inside dir' '
        set_state dir/foo work head &&
        # the third n is to get out in case it mistakenly does not apply
        test_write_lines y n n | (cd dir && git restore -p foo) &&
@@ -111,7 +116,7 @@ test_expect_success PERL 'path limiting works: foo inside dir' '
        verify_state dir/foo head head
 '
 
-test_expect_success PERL 'none of this moved HEAD' '
+test_expect_success 'none of this moved HEAD' '
        verify_saved_head
 '
 
index c22669b39f938d901555e2c9a43d8d1f07de6da8..86c9c887881b94a586dc96b3f495a72c022fd827 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='restore --pathspec-from-file'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_tick
@@ -152,16 +153,16 @@ test_expect_success 'error conditions' '
        >empty_list &&
 
        test_must_fail git restore --pathspec-from-file=list --patch --source=HEAD^1 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git restore --pathspec-from-file=list --source=HEAD^1 -- fileA.t 2>err &&
-       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
+       test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git restore --pathspec-file-nul --source=HEAD^1 2>err &&
-       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
+       test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        test_must_fail git restore --pathspec-from-file=empty_list --source=HEAD^1 2>err &&
-       test_i18ngrep -e "you must specify path(s) to restore" err
+       test_grep -e "you must specify path(s) to restore" err
 '
 
 test_expect_success 'wildcard pathspec matches file in subdirectory' '
index b8686aabd38b5ac8a60753bff80fddd4e91a5102..0bab134d71d3e785194562779ef63085de4e6545 100755 (executable)
@@ -39,7 +39,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'index is at version 2' '
-       test "$(test-tool index-version < .git/index)" = 2
+       test "$(git update-index --show-index-version)" = 2
 '
 
 test_expect_success 'update-index --skip-worktree' '
@@ -48,7 +48,7 @@ test_expect_success 'update-index --skip-worktree' '
 '
 
 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
-       test "$(test-tool index-version < .git/index)" = 3
+       test "$(git update-index --show-index-version)" = 3
 '
 
 test_expect_success 'ls-files -t' '
@@ -61,7 +61,7 @@ test_expect_success 'update-index --no-skip-worktree' '
 '
 
 test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
-       test "$(test-tool index-version < .git/index)" = 2
+       test "$(git update-index --show-index-version)" = 2
 '
 
 test_done
index d943ddf47e08f98b20a1f3365dca594815e06ea5..95c004dc5c5462b8b18cf348e5b1c44115a73042 100755 (executable)
@@ -22,7 +22,7 @@ test_expect_success 'do not switch branches with dirty file' '
        echo dirt >file &&
        git update-index --assume-unchanged file &&
        test_must_fail git checkout - 2>err &&
-       test_i18ngrep overwritten err
+       test_grep overwritten err
 '
 
 test_done
index 89b285fa3a608f917a269c56ee2f44fa51f5d01f..cc72ead79f397873b5005196a99baad6b0ba2450 100755 (executable)
@@ -14,7 +14,7 @@ test_expect_success 'update-index --nonsense fails' '
 
 test_expect_success 'update-index --nonsense dumps usage' '
        test_expect_code 129 git update-index --nonsense 2>err &&
-       test_i18ngrep "[Uu]sage: git update-index" err
+       test_grep "[Uu]sage: git update-index" err
 '
 
 test_expect_success 'update-index -h with corrupt index' '
@@ -25,7 +25,7 @@ test_expect_success 'update-index -h with corrupt index' '
                >.git/index &&
                test_expect_code 129 git update-index -h >usage 2>&1
        ) &&
-       test_i18ngrep "[Uu]sage: git update-index" broken/usage
+       test_grep "[Uu]sage: git update-index" broken/usage
 '
 
 test_expect_success '--cacheinfo complains of missing arguments' '
@@ -111,4 +111,35 @@ test_expect_success '--chmod=+x and chmod=-x in the same argument list' '
        test_cmp expect actual
 '
 
+test_expect_success '--index-version' '
+       git commit --allow-empty -m snap &&
+       git reset --hard &&
+       git rm -f -r --cached . &&
+
+       # The default index version is 2 --- update this test
+       # when you change it in the code
+       git update-index --show-index-version >actual &&
+       echo 2 >expect &&
+       test_cmp expect actual &&
+
+       # The next test wants us to be using version 2
+       git update-index --index-version 2 &&
+
+       git update-index --index-version 4 --verbose >actual &&
+       echo "index-version: was 2, set to 4" >expect &&
+       test_cmp expect actual &&
+
+       git update-index --index-version 4 --verbose >actual &&
+       echo "index-version: was 4, set to 4" >expect &&
+       test_cmp expect actual &&
+
+       git update-index --index-version 2 --verbose >actual &&
+       echo "index-version: was 4, set to 2" >expect &&
+       test_cmp expect actual &&
+
+       # non-verbose should be silent
+       git update-index --index-version 4 >actual &&
+       test_must_be_empty actual
+'
+
 test_done
index ebf58db2d1827209464c94ac621f16f1693367d5..8fa44a92a277f414018d3f71731f791ec4b4f490 100755 (executable)
@@ -173,7 +173,7 @@ test_expect_success 'rename detection finds the right names' '
                git add -N third &&
 
                git status | grep -v "^?" >actual.1 &&
-               test_i18ngrep "renamed: *first -> third" actual.1 &&
+               test_grep "renamed: *first -> third" actual.1 &&
 
                git status --porcelain | grep -v "^?" >actual.2 &&
                cat >expected.2 <<-\EOF &&
@@ -213,8 +213,8 @@ test_expect_success 'double rename detection in status' '
                git add -N third &&
 
                git status | grep -v "^?" >actual.1 &&
-               test_i18ngrep "renamed: *first -> second" actual.1 &&
-               test_i18ngrep "renamed: *second -> third" actual.1 &&
+               test_grep "renamed: *first -> second" actual.1 &&
+               test_grep "renamed: *second -> third" actual.1 &&
 
                git status --porcelain | grep -v "^?" >actual.2 &&
                cat >expected.2 <<-\EOF &&
index 89424abccd1c5663b8c2a8a6c3b023831887f330..b7cf1e492c1073ee3fb4705bf8755d8b49c3d6d0 100755 (executable)
@@ -36,7 +36,7 @@ do
        '
 
        test_expect_success "complaints for ignored $i output" '
-               test_i18ngrep -e "Use -f if" err
+               test_grep -e "Use -f if" err
        '
 
        test_expect_success "complaints for ignored $i with unignored file" '
@@ -46,7 +46,7 @@ do
                test_must_be_empty out
        '
        test_expect_success "complaints for ignored $i with unignored file output" '
-               test_i18ngrep -e "Use -f if" err
+               test_grep -e "Use -f if" err
        '
 done
 
@@ -65,7 +65,7 @@ do
        test_expect_success "complaints for ignored $i in dir output" '
                (
                        cd dir &&
-                       test_i18ngrep -e "Use -f if" err
+                       test_grep -e "Use -f if" err
                )
        '
 done
@@ -85,7 +85,7 @@ do
        test_expect_success "complaints for ignored $i in sub output" '
                (
                        cd sub &&
-                       test_i18ngrep -e "Use -f if" err
+                       test_grep -e "Use -f if" err
                )
        '
 done
index 051363acbbc784ec5b2cc3d0c6ddfc3af87cdd6c..c28c04133c8a1c953406c5bdea0e83c8cb82870f 100755 (executable)
@@ -121,7 +121,30 @@ test_expect_success '"add" worktree creating new branch' '
 test_expect_success 'die the same branch is already checked out' '
        (
                cd here &&
-               test_must_fail git checkout newmain
+               test_must_fail git checkout newmain 2>actual &&
+               grep "already used by worktree at" actual
+       )
+'
+
+test_expect_success 'refuse to reset a branch in use elsewhere' '
+       (
+               cd here &&
+
+               # we know we are on detached HEAD but just in case ...
+               git checkout --detach HEAD &&
+               git rev-parse --verify HEAD >old.head &&
+
+               git rev-parse --verify refs/heads/newmain >old.branch &&
+               test_must_fail git checkout -B newmain 2>error &&
+               git rev-parse --verify refs/heads/newmain >new.branch &&
+               git rev-parse --verify HEAD >new.head &&
+
+               grep "already used by worktree at" error &&
+               test_cmp old.branch new.branch &&
+               test_cmp old.head new.head &&
+
+               # and we must be still on the same detached HEAD state
+               test_must_fail git symbolic-ref HEAD
        )
 '
 
@@ -414,7 +437,7 @@ test_wt_add_orphan_hint () {
                git -C repo switch --orphan noref &&
                test_must_fail git -C repo worktree add $opts foobar/ 2>actual &&
                ! grep "error: unknown switch" actual &&
-               grep "hint: If you meant to create a worktree containing a new orphan branch" actual &&
+               grep "hint: If you meant to create a worktree containing a new unborn branch" actual &&
                if [ $use_branch -eq 1 ]
                then
                        grep -E "^hint: +git worktree add --orphan -b [^ ]+ [^ ]+$" actual
@@ -435,7 +458,7 @@ test_expect_success "'worktree add' doesn't show orphan hint in bad/orphan HEAD
        (cd repo && test_commit commit) &&
        test_must_fail git -C repo worktree add --quiet foobar_branch foobar/ 2>actual &&
        ! grep "error: unknown switch" actual &&
-       ! grep "hint: If you meant to create a worktree containing a new orphan branch" actual
+       ! grep "hint: If you meant to create a worktree containing a new unborn branch" actual
 '
 
 test_expect_success 'local clone from linked checkout' '
@@ -467,7 +490,8 @@ test_expect_success 'put a worktree under rebase' '
                cd under-rebase &&
                set_fake_editor &&
                FAKE_LINES="edit 1" git rebase -i HEAD^ &&
-               git worktree list | grep "under-rebase.*detached HEAD"
+               git worktree list >actual &&
+               grep "under-rebase.*detached HEAD" actual
        )
 '
 
@@ -508,7 +532,8 @@ test_expect_success 'checkout a branch under bisect' '
                git bisect start &&
                git bisect bad &&
                git bisect good HEAD~2 &&
-               git worktree list | grep "under-bisect.*detached HEAD" &&
+               git worktree list >actual &&
+               grep "under-bisect.*detached HEAD" actual &&
                test_must_fail git worktree add new-bisect under-bisect &&
                ! test -d new-bisect
        )
@@ -708,9 +733,9 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '
 test_dwim_orphan () {
        local info_text="No possible source branch, inferring '--orphan'" &&
        local fetch_error_text="fatal: No local or remote refs exist despite at least one remote" &&
-       local orphan_hint="hint: If you meant to create a worktree containing a new orphan branch" &&
+       local orphan_hint="hint: If you meant to create a worktree containing a new unborn branch" &&
        local invalid_ref_regex="^fatal: invalid reference: " &&
-       local bad_combo_regex="^fatal: '[-a-z]*' and '[-a-z]*' cannot be used together" &&
+       local bad_combo_regex="^fatal: options '[-a-z]*' and '[-a-z]*' cannot be used together" &&
 
        local git_ns="repo" &&
        local dashc_args="-C $git_ns" &&
index 568a47ec4268778052534d93a168361744215efa..71aa9bcd620f8a504fe628a2d7332d8b47fd4701 100755 (executable)
@@ -47,7 +47,7 @@ test_expect_success SANITY 'prune directories with unreadable gitdir' '
        : >.git/worktrees/def/gitdir &&
        chmod u-r .git/worktrees/def/gitdir &&
        git worktree prune --verbose 2>actual &&
-       test_i18ngrep "Removing worktrees/def: unable to read gitdir file" actual &&
+       test_grep "Removing worktrees/def: unable to read gitdir file" actual &&
        ! test -d .git/worktrees/def &&
        ! test -d .git/worktrees
 '
@@ -57,7 +57,7 @@ test_expect_success 'prune directories with invalid gitdir' '
        : >.git/worktrees/def/def &&
        : >.git/worktrees/def/gitdir &&
        git worktree prune --verbose 2>actual &&
-       test_i18ngrep "Removing worktrees/def: invalid gitdir file" actual &&
+       test_grep "Removing worktrees/def: invalid gitdir file" actual &&
        ! test -d .git/worktrees/def &&
        ! test -d .git/worktrees
 '
@@ -67,7 +67,7 @@ test_expect_success 'prune directories with gitdir pointing to nowhere' '
        : >.git/worktrees/def/def &&
        echo "$(pwd)"/nowhere >.git/worktrees/def/gitdir &&
        git worktree prune --verbose 2>actual &&
-       test_i18ngrep "Removing worktrees/def: gitdir file points to non-existent location" actual &&
+       test_grep "Removing worktrees/def: gitdir file points to non-existent location" actual &&
        ! test -d .git/worktrees/def &&
        ! test -d .git/worktrees
 '
@@ -103,7 +103,7 @@ test_expect_success 'prune duplicate (linked/linked)' '
        sed "s/w2/w1/" .git/worktrees/w2/gitdir >.git/worktrees/w2/gitdir.new &&
        mv .git/worktrees/w2/gitdir.new .git/worktrees/w2/gitdir &&
        git worktree prune --verbose 2>actual &&
-       test_i18ngrep "duplicate entry" actual &&
+       test_grep "duplicate entry" actual &&
        test -d .git/worktrees/w1 &&
        ! test -d .git/worktrees/w2
 '
@@ -116,7 +116,7 @@ test_expect_success 'prune duplicate (main/linked)' '
        rm -fr wt &&
        mv repo wt &&
        git -C wt worktree prune --verbose 2>actual &&
-       test_i18ngrep "duplicate entry" actual &&
+       test_grep "duplicate entry" actual &&
        ! test -d .git/worktrees/wt
 '
 
index 9ad9be0c2089335b67fcb08f00ade4b46ab5637c..33ea9cb21ba07c9563530b54da06753eaa993fe2 100755 (executable)
@@ -143,7 +143,7 @@ test_expect_success '"list" all worktrees --porcelain with prunable' '
        rm -rf prunable &&
        git worktree list --porcelain >out &&
        sed -n "/^worktree .*\/prunable$/,/^$/p" <out >only_prunable &&
-       test_i18ngrep "^prunable gitdir file points to non-existent location$" only_prunable
+       test_grep "^prunable gitdir file points to non-existent location$" only_prunable
 '
 
 test_expect_success '"list" all worktrees with prunable consistent with "prune"' '
@@ -155,8 +155,8 @@ test_expect_success '"list" all worktrees with prunable consistent with "prune"'
        grep "/prunable  *[0-9a-f].* prunable$" out &&
        ! grep "/unprunable  *[0-9a-f].* unprunable$" out &&
        git worktree prune --verbose 2>out &&
-       test_i18ngrep "^Removing worktrees/prunable" out &&
-       test_i18ngrep ! "^Removing worktrees/unprunable" out
+       test_grep "^Removing worktrees/prunable" out &&
+       test_grep ! "^Removing worktrees/unprunable" out
 '
 
 test_expect_success '"list" --verbose and --porcelain mutually exclusive' '
index 230a55e99af85f9f0b60d13df1b15372012e0f89..901342ea09b51a8e832f1109fbb737df84283aa2 100755 (executable)
@@ -202,7 +202,7 @@ test_expect_success 'proper error when worktree not found' '
        for i in noodle noodle/bork
        do
                test_must_fail git worktree lock $i 2>err &&
-               test_i18ngrep "not a working tree" err || return 1
+               test_grep "not a working tree" err || return 1
        done
 '
 
index 8970780efccd85f54c1e1bd830f841d34ce90ce8..edbf502ec57bb7e778b96ffc0ef6798b4f2f3233 100755 (executable)
@@ -25,7 +25,7 @@ test_expect_success 'worktree path not directory' '
        >notdir &&
        test_must_fail git worktree repair >out 2>err &&
        test_must_be_empty out &&
-       test_i18ngrep "not a directory" err
+       test_grep "not a directory" err
 '
 
 test_expect_success "don't clobber .git repo" '
@@ -35,7 +35,7 @@ test_expect_success "don't clobber .git repo" '
        test_create_repo repo &&
        test_must_fail git worktree repair >out 2>err &&
        test_must_be_empty out &&
-       test_i18ngrep ".git is not a file" err
+       test_grep ".git is not a file" err
 '
 
 test_corrupt_gitfile () {
@@ -47,7 +47,7 @@ test_corrupt_gitfile () {
        git -C corrupt rev-parse --absolute-git-dir >expect &&
        eval "$butcher" &&
        git -C "$repairdir" worktree repair 2>err &&
-       test_i18ngrep "$problem" err &&
+       test_grep "$problem" err &&
        git -C corrupt rev-parse --absolute-git-dir >actual &&
        test_cmp expect actual
 }
@@ -93,7 +93,7 @@ test_expect_success 'repair .git file from bare.git' '
 test_expect_success 'invalid worktree path' '
        test_must_fail git worktree repair /notvalid >out 2>err &&
        test_must_be_empty out &&
-       test_i18ngrep "not a valid path" err
+       test_grep "not a valid path" err
 '
 
 test_expect_success 'repo not found; .git not file' '
@@ -101,7 +101,7 @@ test_expect_success 'repo not found; .git not file' '
        test_create_repo not-a-worktree &&
        test_must_fail git worktree repair not-a-worktree >out 2>err &&
        test_must_be_empty out &&
-       test_i18ngrep ".git is not a file" err
+       test_grep ".git is not a file" err
 '
 
 test_expect_success 'repo not found; .git not referencing repo' '
@@ -111,7 +111,7 @@ test_expect_success 'repo not found; .git not referencing repo' '
        mv side/.newgit side/.git &&
        mkdir not-a-repo &&
        test_must_fail git worktree repair side 2>err &&
-       test_i18ngrep ".git file does not reference a repository" err
+       test_grep ".git file does not reference a repository" err
 '
 
 test_expect_success 'repo not found; .git file broken' '
@@ -121,7 +121,7 @@ test_expect_success 'repo not found; .git file broken' '
        mv orig moved &&
        test_must_fail git worktree repair moved >out 2>err &&
        test_must_be_empty out &&
-       test_i18ngrep ".git file broken" err
+       test_grep ".git file broken" err
 '
 
 test_expect_success 'repair broken gitdir' '
@@ -132,7 +132,7 @@ test_expect_success 'repair broken gitdir' '
        mv orig moved &&
        git worktree repair moved 2>err &&
        test_cmp expect .git/worktrees/orig/gitdir &&
-       test_i18ngrep "gitdir unreadable" err
+       test_grep "gitdir unreadable" err
 '
 
 test_expect_success 'repair incorrect gitdir' '
@@ -142,7 +142,7 @@ test_expect_success 'repair incorrect gitdir' '
        mv orig moved &&
        git worktree repair moved 2>err &&
        test_cmp expect .git/worktrees/orig/gitdir &&
-       test_i18ngrep "gitdir incorrect" err
+       test_grep "gitdir incorrect" err
 '
 
 test_expect_success 'repair gitdir (implicit) from linked worktree' '
@@ -152,7 +152,7 @@ test_expect_success 'repair gitdir (implicit) from linked worktree' '
        mv orig moved &&
        git -C moved worktree repair 2>err &&
        test_cmp expect .git/worktrees/orig/gitdir &&
-       test_i18ngrep "gitdir incorrect" err
+       test_grep "gitdir incorrect" err
 '
 
 test_expect_success 'unable to repair gitdir (implicit) from main worktree' '
@@ -177,8 +177,8 @@ test_expect_success 'repair multiple gitdir files' '
        git worktree repair moved1 moved2 2>err &&
        test_cmp expect1 .git/worktrees/orig1/gitdir &&
        test_cmp expect2 .git/worktrees/orig2/gitdir &&
-       test_i18ngrep "gitdir incorrect:.*orig1/gitdir$" err &&
-       test_i18ngrep "gitdir incorrect:.*orig2/gitdir$" err
+       test_grep "gitdir incorrect:.*orig1/gitdir$" err &&
+       test_grep "gitdir incorrect:.*orig2/gitdir$" err
 '
 
 test_expect_success 'repair moved main and linked worktrees' '
index 469443d8ae8c44483c7dbea8dd3c3fc2baef0745..f6835c91dcc49cfeb23881fe0ef7a96629bfb2e6 100755 (executable)
@@ -45,7 +45,7 @@ test_expect_success 'refuse to overwrite: checked out in worktree' '
                grep "cannot force update the branch" err &&
 
                test_must_fail git branch -D wt-$i 2>err &&
-               grep "Cannot delete branch" err || return 1
+               grep "cannot delete branch" err || return 1
        done
 '
 
index a16e25c79bdde748cbb9c1d5419960e0e5f8f3f5..12e41a7b40e0ab73efa1fc30354e80996c3a91a4 100755 (executable)
@@ -21,7 +21,7 @@ test_expect_success 'ls-files with nonexistent path' '
 
 test_expect_success 'ls-files with nonsense option' '
        test_expect_code 129 git ls-files --nonsense 2>actual &&
-       test_i18ngrep "[Uu]sage: git ls-files" actual
+       test_grep "[Uu]sage: git ls-files" actual
 '
 
 test_expect_success 'ls-files -h in corrupt repository' '
@@ -32,7 +32,7 @@ test_expect_success 'ls-files -h in corrupt repository' '
                >.git/index &&
                test_expect_code 129 git ls-files -h >usage 2>&1
        ) &&
-       test_i18ngrep "[Uu]sage: git ls-files " broken/usage
+       test_grep "[Uu]sage: git ls-files " broken/usage
 '
 
 test_expect_success SYMLINKS 'ls-files with absolute paths to symlinks' '
index 7308a3d4e25a8be915c6e2157b31c21a3585bd0c..61771eec830c0688587588ee0a334282effdb1bb 100755 (executable)
@@ -296,7 +296,7 @@ test_expect_success '--recurse-submodules and relative paths' '
 
 test_expect_success '--recurse-submodules does not support --error-unmatch' '
        test_must_fail git ls-files --recurse-submodules --error-unmatch 2>actual &&
-       test_i18ngrep "does not support --error-unmatch" actual
+       test_grep "does not support --error-unmatch" actual
 '
 
 test_expect_success '--recurse-submodules parses submodule repo config' '
@@ -335,7 +335,7 @@ test_expect_success '--recurse-submodules submodules ignore super project worktr
 test_incompatible_with_recurse_submodules () {
        test_expect_success "--recurse-submodules and $1 are incompatible" "
                test_must_fail git ls-files --recurse-submodules $1 2>actual &&
-               test_i18ngrep 'unsupported mode' actual
+               test_grep 'unsupported mode' actual
        "
 }
 
index daf1666df7adb9594c50445764440ad339f43645..d3bbd00b818a4f26e2c19ae0ec432138200afc62 100755 (executable)
@@ -25,10 +25,10 @@ test_expect_success 'prepare a trivial repository' '
 
 test_expect_success 'git branch --help should not have created a bogus branch' '
        test_might_fail git branch --man --help </dev/null >/dev/null 2>&1 &&
-       test_path_is_missing .git/refs/heads/--help
+       test_ref_missing refs/heads/--help
 '
 
-test_expect_success 'branch -h in broken repository' '
+test_expect_success REFFILES 'branch -h in broken repository' '
        mkdir broken &&
        (
                cd broken &&
@@ -36,11 +36,12 @@ test_expect_success 'branch -h in broken repository' '
                >.git/refs/heads/main &&
                test_expect_code 129 git branch -h >usage 2>&1
        ) &&
-       test_i18ngrep "[Uu]sage" broken/usage
+       test_grep "[Uu]sage" broken/usage
 '
 
 test_expect_success 'git branch abc should create a branch' '
-       git branch abc && test_path_is_file .git/refs/heads/abc
+       git branch abc &&
+       test_ref_exists refs/heads/abc
 '
 
 test_expect_success 'git branch abc should fail when abc exists' '
@@ -61,31 +62,33 @@ test_expect_success 'git branch --force abc should succeed when abc exists' '
 '
 
 test_expect_success 'git branch a/b/c should create a branch' '
-       git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c
+       git branch a/b/c &&
+       test_ref_exists refs/heads/a/b/c
 '
 
 test_expect_success 'git branch mb main... should create a branch' '
-       git branch mb main... && test_path_is_file .git/refs/heads/mb
+       git branch mb main... &&
+       test_ref_exists refs/heads/mb
 '
 
 test_expect_success 'git branch HEAD should fail' '
        test_must_fail git branch HEAD
 '
 
-cat >expect <<EOF
-$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000    branch: Created from main
-EOF
 test_expect_success 'git branch --create-reflog d/e/f should create a branch and a log' '
        GIT_COMMITTER_DATE="2005-05-26 23:30" \
        git -c core.logallrefupdates=false branch --create-reflog d/e/f &&
-       test_path_is_file .git/refs/heads/d/e/f &&
-       test_path_is_file .git/logs/refs/heads/d/e/f &&
-       test_cmp expect .git/logs/refs/heads/d/e/f
+       test_ref_exists refs/heads/d/e/f &&
+       cat >expect <<-EOF &&
+       $HEAD refs/heads/d/e/f@{0}: branch: Created from main
+       EOF
+       git reflog show --no-abbrev-commit refs/heads/d/e/f >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'git branch -d d/e/f should delete a branch and a log' '
        git branch -d d/e/f &&
-       test_path_is_missing .git/refs/heads/d/e/f &&
+       test_ref_missing refs/heads/d/e/f &&
        test_must_fail git reflog exists refs/heads/d/e/f
 '
 
@@ -103,7 +106,7 @@ test_expect_success 'git branch l should work after branch l/m has been deleted'
 
 test_expect_success 'git branch -m dumps usage' '
        test_expect_code 128 git branch -m 2>err &&
-       test_i18ngrep "branch name required" err
+       test_grep "branch name required" err
 '
 
 test_expect_success 'git branch -m m broken_symref should work' '
@@ -200,10 +203,9 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou
        test $(git rev-parse --abbrev-ref HEAD) = bam
 '
 
-test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD' '
-       msg="Branch: renamed refs/heads/baz to refs/heads/bam" &&
-       grep " $ZERO_OID.*$msg$" .git/logs/HEAD &&
-       grep "^$ZERO_OID.*$msg$" .git/logs/HEAD
+test_expect_success 'git branch -M baz bam should add entries to HEAD reflog' '
+       git reflog show HEAD >actual &&
+       grep "HEAD@{0}: Branch: renamed refs/heads/baz to refs/heads/bam" actual
 '
 
 test_expect_success 'git branch -M should leave orphaned HEAD alone' '
@@ -212,17 +214,20 @@ test_expect_success 'git branch -M should leave orphaned HEAD alone' '
                cd orphan &&
                test_commit initial &&
                git checkout --orphan lonely &&
-               grep lonely .git/HEAD &&
-               test_path_is_missing .git/refs/head/lonely &&
+               git symbolic-ref HEAD >expect &&
+               echo refs/heads/lonely >actual &&
+               test_cmp expect actual &&
+               test_ref_missing refs/head/lonely &&
                git branch -M main mistress &&
-               grep lonely .git/HEAD
+               git symbolic-ref HEAD >expect &&
+               test_cmp expect actual
        )
 '
 
 test_expect_success 'resulting reflog can be shown by log -g' '
        oid=$(git rev-parse HEAD) &&
        cat >expect <<-EOF &&
-       HEAD@{0} $oid $msg
+       HEAD@{0} $oid Branch: renamed refs/heads/baz to refs/heads/bam
        HEAD@{2} $oid checkout: moving from foo to baz
        EOF
        git log -g --format="%gd %H %gs" -2 HEAD >actual &&
@@ -240,7 +245,7 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou
        git worktree prune
 '
 
-test_expect_success 'git branch -M fails if updating any linked working tree fails' '
+test_expect_success REFFILES 'git branch -M fails if updating any linked working tree fails' '
        git worktree add -b baz bazdir1 &&
        git worktree add -f bazdir2 baz &&
        touch .git/worktrees/bazdir1/HEAD.lock &&
@@ -291,10 +296,10 @@ test_expect_success 'git branch -M topic topic should work when main is checked
 test_expect_success 'git branch -M and -C fail on detached HEAD' '
        git checkout HEAD^{} &&
        test_when_finished git checkout - &&
-       echo "fatal: cannot rename the current branch while not on any." >expect &&
+       echo "fatal: cannot rename the current branch while not on any" >expect &&
        test_must_fail git branch -M must-fail 2>err &&
        test_cmp expect err &&
-       echo "fatal: cannot copy the current branch while not on any." >expect &&
+       echo "fatal: cannot copy the current branch while not on any" >expect &&
        test_must_fail git branch -C must-fail 2>err &&
        test_cmp expect err
 '
@@ -435,10 +440,10 @@ test_expect_success 'git branch --list -v with --abbrev' '
 
 test_expect_success 'git branch --column' '
        COLUMNS=81 git branch --column=column >actual &&
-       cat >expect <<\EOF &&
-  a/b/c   bam     foo     l     * main    n       o/p     r
-  abc     bar     j/k     m/m     mb      o/o     q       topic
-EOF
+       cat >expect <<-\EOF &&
+         a/b/c   bam     foo     l     * main    n       o/p     r
+         abc     bar     j/k     m/m     mb      o/o     q       topic
+       EOF
        test_cmp expect actual
 '
 
@@ -448,25 +453,25 @@ test_expect_success 'git branch --column with an extremely long branch name' '
        test_when_finished "git branch -d $long" &&
        git branch $long &&
        COLUMNS=80 git branch --column=column >actual &&
-       cat >expect <<EOF &&
-  a/b/c
-  abc
-  bam
-  bar
-  foo
-  j/k
-  l
-  m/m
-* main
-  mb
-  n
-  o/o
-  o/p
-  q
-  r
-  topic
-  $long
-EOF
+       cat >expect <<-EOF &&
+         a/b/c
+         abc
+         bam
+         bar
+         foo
+         j/k
+         l
+         m/m
+       * main
+         mb
+         n
+         o/o
+         o/p
+         q
+         r
+         topic
+         $long
+       EOF
        test_cmp expect actual
 '
 
@@ -476,10 +481,10 @@ test_expect_success 'git branch with column.*' '
        COLUMNS=80 git branch >actual &&
        git config --unset column.branch &&
        git config --unset column.ui &&
-       cat >expect <<\EOF &&
-  a/b/c   bam   foo   l   * main   n     o/p   r
-  abc     bar   j/k   m/m   mb     o/o   q     topic
-EOF
+       cat >expect <<-\EOF &&
+         a/b/c   bam   foo   l   * main   n     o/p   r
+         abc     bar   j/k   m/m   mb     o/o   q     topic
+       EOF
        test_cmp expect actual
 '
 
@@ -491,39 +496,36 @@ test_expect_success 'git branch -v with column.ui ignored' '
        git config column.ui column &&
        COLUMNS=80 git branch -v | cut -c -8 | sed "s/ *$//" >actual &&
        git config --unset column.ui &&
-       cat >expect <<\EOF &&
-  a/b/c
-  abc
-  bam
-  bar
-  foo
-  j/k
-  l
-  m/m
-* main
-  mb
-  n
-  o/o
-  o/p
-  q
-  r
-  topic
-EOF
+       cat >expect <<-\EOF &&
+         a/b/c
+         abc
+         bam
+         bar
+         foo
+         j/k
+         l
+         m/m
+       * main
+         mb
+         n
+         o/o
+         o/p
+         q
+         r
+         topic
+       EOF
        test_cmp expect actual
 '
 
-mv .git/config .git/config-saved
-
-test_expect_success SHA1 'git branch -m q q2 without config should succeed' '
+test_expect_success DEFAULT_REPO_FORMAT 'git branch -m q q2 without config should succeed' '
+       test_when_finished mv .git/config-saved .git/config &&
+       mv .git/config .git/config-saved &&
        git branch -m q q2 &&
        git branch -m q2 q
 '
 
-mv .git/config-saved .git/config
-
-git config branch.s/s.dummy Hello
-
 test_expect_success 'git branch -m s/s s should work when s/t is deleted' '
+       git config branch.s/s.dummy Hello &&
        git branch --create-reflog s/s &&
        git reflog exists refs/heads/s/s &&
        git branch --create-reflog s/t &&
@@ -574,19 +576,19 @@ EOF
 
        # ...and that the comments for those sections are also
        # preserved.
-       cat config.branch | sed "s/\"source\"/\"dest\"/" >expect &&
+       sed "s/\"source\"/\"dest\"/" config.branch >expect &&
        sed -n -e "/Note the lack/,\$p" .git/config >actual &&
        test_cmp expect actual
 '
 
 test_expect_success 'git branch -c dumps usage' '
        test_expect_code 128 git branch -c 2>err &&
-       test_i18ngrep "branch name required" err
+       test_grep "branch name required" err
 '
 
 test_expect_success 'git branch --copy dumps usage' '
        test_expect_code 128 git branch --copy 2>err &&
-       test_i18ngrep "branch name required" err
+       test_grep "branch name required" err
 '
 
 test_expect_success 'git branch -c d e should work' '
@@ -696,7 +698,8 @@ test_expect_success 'git branch -C c1 c2 should succeed when c1 is checked out'
 
 test_expect_success 'git branch -C c1 c2 should never touch HEAD' '
        msg="Branch: copied refs/heads/c1 to refs/heads/c2" &&
-       ! grep "$msg$" .git/logs/HEAD
+       git reflog HEAD >actual &&
+       ! grep "$msg$" actual
 '
 
 test_expect_success 'git branch -C main should work when main is checked out' '
@@ -799,26 +802,26 @@ test_expect_success 'deleting a symref' '
        git symbolic-ref refs/heads/symref refs/heads/target &&
        echo "Deleted branch symref (was refs/heads/target)." >expect &&
        git branch -d symref >actual &&
-       test_path_is_file .git/refs/heads/target &&
-       test_path_is_missing .git/refs/heads/symref &&
+       test_ref_exists refs/heads/target &&
+       test_ref_missing refs/heads/symref &&
        test_cmp expect actual
 '
 
 test_expect_success 'deleting a dangling symref' '
        git symbolic-ref refs/heads/dangling-symref nowhere &&
-       test_path_is_file .git/refs/heads/dangling-symref &&
+       git symbolic-ref --no-recurse refs/heads/dangling-symref &&
        echo "Deleted branch dangling-symref (was nowhere)." >expect &&
        git branch -d dangling-symref >actual &&
-       test_path_is_missing .git/refs/heads/dangling-symref &&
+       test_ref_missing refs/heads/dangling-symref &&
        test_cmp expect actual
 '
 
 test_expect_success 'deleting a self-referential symref' '
        git symbolic-ref refs/heads/self-reference refs/heads/self-reference &&
-       test_path_is_file .git/refs/heads/self-reference &&
+       test_ref_exists refs/heads/self-reference &&
        echo "Deleted branch self-reference (was refs/heads/self-reference)." >expect &&
        git branch -d self-reference >actual &&
-       test_path_is_missing .git/refs/heads/self-reference &&
+       test_ref_missing refs/heads/self-reference &&
        test_cmp expect actual
 '
 
@@ -826,37 +829,8 @@ test_expect_success 'renaming a symref is not allowed' '
        git symbolic-ref refs/heads/topic refs/heads/main &&
        test_must_fail git branch -m topic new-topic &&
        git symbolic-ref refs/heads/topic &&
-       test_path_is_file .git/refs/heads/main &&
-       test_path_is_missing .git/refs/heads/new-topic
-'
-
-test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' '
-       git branch --create-reflog u &&
-       mv .git/logs/refs/heads/u real-u &&
-       ln -s real-u .git/logs/refs/heads/u &&
-       test_must_fail git branch -m u v
-'
-
-test_expect_success SYMLINKS 'git branch -m with symlinked .git/refs' '
-       test_when_finished "rm -rf subdir" &&
-       git init --bare subdir &&
-
-       rm -rfv subdir/refs subdir/objects subdir/packed-refs &&
-       ln -s ../.git/refs subdir/refs &&
-       ln -s ../.git/objects subdir/objects &&
-       ln -s ../.git/packed-refs subdir/packed-refs &&
-
-       git -C subdir rev-parse --absolute-git-dir >subdir.dir &&
-       git rev-parse --absolute-git-dir >our.dir &&
-       ! test_cmp subdir.dir our.dir &&
-
-       git -C subdir log &&
-       git -C subdir branch rename-src &&
-       git rev-parse rename-src >expect &&
-       git -C subdir branch -m rename-src rename-dest &&
-       git rev-parse rename-dest >actual &&
-       test_cmp expect actual &&
-       git branch -D rename-dest
+       test_ref_exists refs/heads/main &&
+       test_ref_missing refs/heads/new-topic
 '
 
 test_expect_success 'test tracking setup via --track' '
@@ -942,7 +916,19 @@ test_expect_success 'test deleting branch without config' '
 test_expect_success 'deleting currently checked out branch fails' '
        git worktree add -b my7 my7 &&
        test_must_fail git -C my7 branch -d my7 &&
-       test_must_fail git branch -d my7 &&
+       test_must_fail git branch -d my7 2>actual &&
+       grep "^error: cannot delete branch .my7. used by worktree at " actual &&
+       rm -r my7 &&
+       git worktree prune
+'
+
+test_expect_success 'deleting in-use branch fails' '
+       git worktree add my7 &&
+       test_commit -C my7 bt7 &&
+       git -C my7 bisect start HEAD HEAD~2 &&
+       test_must_fail git -C my7 branch -d my7 &&
+       test_must_fail git branch -d my7 2>actual &&
+       grep "^error: cannot delete branch .my7. used by worktree at " actual &&
        rm -r my7 &&
        git worktree prune
 '
@@ -1012,7 +998,7 @@ test_expect_success '--set-upstream-to fails on multiple branches' '
 test_expect_success '--set-upstream-to fails on detached HEAD' '
        git checkout HEAD^{} &&
        test_when_finished git checkout - &&
-       echo "fatal: could not set upstream of HEAD to main when it does not point to any branch." >expect &&
+       echo "fatal: could not set upstream of HEAD to main when it does not point to any branch" >expect &&
        test_must_fail git branch --set-upstream-to main 2>err &&
        test_cmp expect err
 '
@@ -1025,7 +1011,7 @@ test_expect_success '--set-upstream-to fails on a missing dst branch' '
 
 test_expect_success '--set-upstream-to fails on a missing src branch' '
        test_must_fail git branch --set-upstream-to does-not-exist main 2>err &&
-       test_i18ngrep "the requested upstream branch '"'"'does-not-exist'"'"' does not exist" err
+       test_grep "the requested upstream branch '"'"'does-not-exist'"'"' does not exist" err
 '
 
 test_expect_success '--set-upstream-to fails on a non-ref' '
@@ -1039,7 +1025,7 @@ test_expect_success '--set-upstream-to fails on locked config' '
        >.git/config.lock &&
        git branch locked &&
        test_must_fail git branch --set-upstream-to locked 2>err &&
-       test_i18ngrep "could not lock config file .git/config" err
+       test_grep "could not lock config file .git/config" err
 '
 
 test_expect_success 'use --set-upstream-to modify HEAD' '
@@ -1060,7 +1046,7 @@ test_expect_success 'use --set-upstream-to modify a particular branch' '
 '
 
 test_expect_success '--unset-upstream should fail if given a non-existent branch' '
-       echo "fatal: Branch '"'"'i-dont-exist'"'"' has no upstream information" >expect &&
+       echo "fatal: branch '"'"'i-dont-exist'"'"' has no upstream information" >expect &&
        test_must_fail git branch --unset-upstream i-dont-exist 2>err &&
        test_cmp expect err
 '
@@ -1070,7 +1056,7 @@ test_expect_success '--unset-upstream should fail if config is locked' '
        git branch --set-upstream-to locked &&
        >.git/config.lock &&
        test_must_fail git branch --unset-upstream 2>err &&
-       test_i18ngrep "could not lock config file .git/config" err
+       test_grep "could not lock config file .git/config" err
 '
 
 test_expect_success 'test --unset-upstream on HEAD' '
@@ -1082,7 +1068,7 @@ test_expect_success 'test --unset-upstream on HEAD' '
        test_must_fail git config branch.main.remote &&
        test_must_fail git config branch.main.merge &&
        # fail for a branch without upstream set
-       echo "fatal: Branch '"'"'main'"'"' has no upstream information" >expect &&
+       echo "fatal: branch '"'"'main'"'"' has no upstream information" >expect &&
        test_must_fail git branch --unset-upstream 2>err &&
        test_cmp expect err
 '
@@ -1096,7 +1082,7 @@ test_expect_success '--unset-upstream should fail on multiple branches' '
 test_expect_success '--unset-upstream should fail on detached HEAD' '
        git checkout HEAD^{} &&
        test_when_finished git checkout - &&
-       echo "fatal: could not unset upstream of HEAD when it does not point to any branch." >expect &&
+       echo "fatal: could not unset upstream of HEAD when it does not point to any branch" >expect &&
        test_must_fail git branch --unset-upstream 2>err &&
        test_cmp expect err
 '
@@ -1123,16 +1109,16 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
        test_cmp expect actual
 "
 
-# Keep this test last, as it changes the current branch
-cat >expect <<EOF
-$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000    branch: Created from main
-EOF
 test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' '
+       test_when_finished git checkout main &&
        GIT_COMMITTER_DATE="2005-05-26 23:30" \
        git checkout -b g/h/i -l main &&
-       test_path_is_file .git/refs/heads/g/h/i &&
-       test_path_is_file .git/logs/refs/heads/g/h/i &&
-       test_cmp expect .git/logs/refs/heads/g/h/i
+       test_ref_exists refs/heads/g/h/i &&
+       cat >expect <<-EOF &&
+       $HEAD refs/heads/g/h/i@{0}: branch: Created from main
+       EOF
+       git reflog show --no-abbrev-commit refs/heads/g/h/i >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'checkout -b makes reflog by default' '
@@ -1506,7 +1492,7 @@ test_expect_success '--list during rebase' '
        set_fake_editor &&
        git rebase -i HEAD~2 &&
        git branch --list >actual &&
-       test_i18ngrep "rebasing main" actual
+       test_grep "rebasing main" actual
 '
 
 test_expect_success '--list during rebase from detached HEAD' '
@@ -1518,7 +1504,7 @@ test_expect_success '--list during rebase from detached HEAD' '
        set_fake_editor &&
        git rebase -i HEAD~2 &&
        git branch --list >actual &&
-       test_i18ngrep "rebasing detached HEAD $oid" actual
+       test_grep "rebasing detached HEAD $oid" actual
 '
 
 test_expect_success 'tracking with unexpected .fetch refspec' '
@@ -1558,9 +1544,10 @@ test_expect_success 'tracking with unexpected .fetch refspec' '
 
 test_expect_success 'configured committerdate sort' '
        git init -b main sort &&
+       test_config -C sort branch.sort "committerdate" &&
+
        (
                cd sort &&
-               git config branch.sort committerdate &&
                test_commit initial &&
                git checkout -b a &&
                test_commit a &&
@@ -1580,9 +1567,10 @@ test_expect_success 'configured committerdate sort' '
 '
 
 test_expect_success 'option override configured sort' '
+       test_config -C sort branch.sort "committerdate" &&
+
        (
                cd sort &&
-               git config branch.sort committerdate &&
                git branch --sort=refname >actual &&
                cat >expect <<-\EOF &&
                  a
@@ -1594,10 +1582,70 @@ test_expect_success 'option override configured sort' '
        )
 '
 
+test_expect_success '--no-sort cancels config sort keys' '
+       test_config -C sort branch.sort "-refname" &&
+
+       (
+               cd sort &&
+
+               # objecttype is identical for all of them, so sort falls back on
+               # default (ascending refname)
+               git branch \
+                       --no-sort \
+                       --sort="objecttype" >actual &&
+               cat >expect <<-\EOF &&
+                 a
+               * b
+                 c
+                 main
+               EOF
+               test_cmp expect actual
+       )
+
+'
+
+test_expect_success '--no-sort cancels command line sort keys' '
+       (
+               cd sort &&
+
+               # objecttype is identical for all of them, so sort falls back on
+               # default (ascending refname)
+               git branch \
+                       --sort="-refname" \
+                       --no-sort \
+                       --sort="objecttype" >actual &&
+               cat >expect <<-\EOF &&
+                 a
+               * b
+                 c
+                 main
+               EOF
+               test_cmp expect actual
+       )
+'
+
+test_expect_success '--no-sort without subsequent --sort prints expected branches' '
+       (
+               cd sort &&
+
+               # Sort the results with `sort` for a consistent comparison
+               # against expected
+               git branch --no-sort | sort >actual &&
+               cat >expect <<-\EOF &&
+                 a
+                 c
+                 main
+               * b
+               EOF
+               test_cmp expect actual
+       )
+'
+
 test_expect_success 'invalid sort parameter in configuration' '
+       test_config -C sort branch.sort "v:notvalid" &&
+
        (
                cd sort &&
-               git config branch.sort "v:notvalid" &&
 
                # this works in the "listing" mode, so bad sort key
                # is a dying offence.
@@ -1645,4 +1693,14 @@ test_expect_success '--track overrides branch.autoSetupMerge' '
        test_cmp_config "" --default "" branch.foo5.merge
 '
 
+test_expect_success 'errors if given a bad branch name' '
+       cat <<-\EOF >expect &&
+       fatal: '\''foo..bar'\'' is not a valid branch name
+       hint: See `man git check-ref-format`
+       hint: Disable this message with "git config advice.refSyntax false"
+       EOF
+       test_must_fail git branch foo..bar >actual 2>&1 &&
+       test_cmp expect actual
+'
+
 test_done
index b17f388f56dfea819e70a04cf25000f0fb4b3658..a1139f79e2ccfdff2b562571bdd8bdf8aa974883 100755 (executable)
@@ -4,13 +4,10 @@ test_description='test show-branch'
 
 . ./test-lib.sh
 
-# arbitrary reference time: 2009-08-30 19:20:00
-GIT_TEST_DATE_NOW=1251660000; export GIT_TEST_DATE_NOW
-
 test_expect_success 'error descriptions on empty repository' '
        current=$(git branch --show-current) &&
        cat >expect <<-EOF &&
-       error: No commit on branch '\''$current'\'' yet.
+       error: no commit on branch '\''$current'\'' yet
        EOF
        test_must_fail git branch --edit-description 2>actual &&
        test_cmp expect actual &&
@@ -21,7 +18,7 @@ test_expect_success 'error descriptions on empty repository' '
 test_expect_success 'fatal descriptions on empty repository' '
        current=$(git branch --show-current) &&
        cat >expect <<-EOF &&
-       fatal: No commit on branch '\''$current'\'' yet.
+       fatal: no commit on branch '\''$current'\'' yet
        EOF
        test_must_fail git branch --set-upstream-to=non-existent 2>actual &&
        test_cmp expect actual &&
@@ -187,18 +184,6 @@ test_expect_success 'show branch --merge-base with N arguments' '
        test_cmp expect actual
 '
 
-test_expect_success 'show branch --reflog=2' '
-       sed "s/^>       //" >expect <<-\EOF &&
-       >       ! [refs/heads/branch10@{0}] (4 years, 5 months ago) commit: branch10
-       >        ! [refs/heads/branch10@{1}] (4 years, 5 months ago) commit: branch10
-       >       --
-       >       +  [refs/heads/branch10@{0}] branch10
-       >       ++ [refs/heads/branch10@{1}] initial
-       EOF
-       git show-branch --reflog=2 >actual &&
-       test_cmp actual expect
-'
-
 # incompatible options
 while read combo
 do
@@ -224,7 +209,7 @@ done
 
 test_expect_success 'error descriptions on non-existent branch' '
        cat >expect <<-EOF &&
-       error: No branch named '\''non-existent'\'.'
+       error: no branch named '\''non-existent'\''
        EOF
        test_must_fail git branch --edit-description non-existent 2>actual &&
        test_cmp expect actual
@@ -238,7 +223,7 @@ test_expect_success 'fatal descriptions on non-existent branch' '
        test_cmp expect actual &&
 
        cat >expect <<-EOF &&
-       fatal: No branch named '\''non-existent'\''.
+       fatal: no branch named '\''non-existent'\''
        EOF
        test_must_fail git branch -c non-existent new-branch 2>actual &&
        test_cmp expect actual &&
@@ -253,7 +238,7 @@ test_expect_success 'error descriptions on orphan branch' '
        test_branch_op_in_wt() {
                test_orphan_error() {
                        test_must_fail git $* 2>actual &&
-                       test_i18ngrep "No commit on branch .orphan-branch. yet.$" actual
+                       test_grep "no commit on branch .orphan-branch. yet$" actual
                } &&
                test_orphan_error -C wt branch $1 $2 &&                # implicit branch
                test_orphan_error -C wt branch $1 orphan-branch $2 &&  # explicit branch
@@ -264,4 +249,38 @@ test_expect_success 'error descriptions on orphan branch' '
        test_branch_op_in_wt -c new-branch
 '
 
+test_expect_success 'setup reflogs' '
+       test_commit base &&
+       git checkout -b branch &&
+       test_commit one &&
+       git reset --hard HEAD^ &&
+       test_commit two &&
+       test_commit three
+'
+
+test_expect_success '--reflog shows reflog entries' '
+       cat >expect <<-\EOF &&
+       ! [branch@{0}] (0 seconds ago) commit: three
+        ! [branch@{1}] (60 seconds ago) commit: two
+         ! [branch@{2}] (2 minutes ago) reset: moving to HEAD^
+          ! [branch@{3}] (2 minutes ago) commit: one
+       ----
+       +    [branch@{0}] three
+       ++   [branch@{1}] two
+          + [branch@{3}] one
+       ++++ [branch@{2}] base
+       EOF
+       # the output always contains relative timestamps; use
+       # a known time to get deterministic results
+       GIT_TEST_DATE_NOW=$test_tick \
+       git show-branch --reflog branch >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--reflog handles missing reflog' '
+       git reflog expire --expire=now branch &&
+       git show-branch --reflog branch >actual &&
+       test_must_be_empty actual
+'
+
 test_done
index b5f4d6a653045dafa7c2317036196866f78b9ca5..7b05bf3961923035bba7fd26b2c389a9f4d151a0 100755 (executable)
@@ -195,7 +195,7 @@ test_expect_success 'A^! and A^-<n> (unmodified)' '
 
 test_expect_success 'A^{/..} is not mistaken for a range' '
        test_must_fail git range-diff topic^.. topic^{/..} -- 2>error &&
-       test_i18ngrep "not a commit range" error
+       test_grep "not a commit range" error
 '
 
 test_expect_success 'trivial reordering' '
@@ -537,7 +537,7 @@ do
                        main..unmodified >actual &&
                test_when_finished "rm 000?-*" &&
                test_line_count = 5 actual &&
-               test_i18ngrep "^Range-diff:$" 0000-* &&
+               test_grep "^Range-diff:$" 0000-* &&
                grep "= 1: .* s/5/A" 0000-* &&
                grep "= 2: .* s/4/A" 0000-* &&
                grep "= 3: .* s/11/B" 0000-* &&
@@ -549,7 +549,7 @@ test_expect_success 'format-patch --range-diff as commentary' '
        git format-patch --range-diff=HEAD~1 HEAD~1 >actual &&
        test_when_finished "rm 0001-*" &&
        test_line_count = 1 actual &&
-       test_i18ngrep "^Range-diff:$" 0001-* &&
+       test_grep "^Range-diff:$" 0001-* &&
        grep "> 1: .* new message" 0001-*
 '
 
@@ -557,7 +557,7 @@ test_expect_success 'format-patch --range-diff reroll-count with a non-integer'
        git format-patch --range-diff=HEAD~1 -v2.9 HEAD~1 >actual &&
        test_when_finished "rm v2.9-0001-*" &&
        test_line_count = 1 actual &&
-       test_i18ngrep "^Range-diff:$" v2.9-0001-* &&
+       test_grep "^Range-diff:$" v2.9-0001-* &&
        grep "> 1: .* new message" v2.9-0001-*
 '
 
@@ -565,7 +565,7 @@ test_expect_success 'format-patch --range-diff reroll-count with a integer' '
        git format-patch --range-diff=HEAD~1 -v2 HEAD~1 >actual &&
        test_when_finished "rm v2-0001-*" &&
        test_line_count = 1 actual &&
-       test_i18ngrep "^Range-diff ..* v1:$" v2-0001-* &&
+       test_grep "^Range-diff ..* v1:$" v2-0001-* &&
        grep "> 1: .* new message" v2-0001-*
 '
 
@@ -573,7 +573,7 @@ test_expect_success 'format-patch --range-diff with v0' '
        git format-patch --range-diff=HEAD~1 -v0 HEAD~1 >actual &&
        test_when_finished "rm v0-0001-*" &&
        test_line_count = 1 actual &&
-       test_i18ngrep "^Range-diff:$" v0-0001-* &&
+       test_grep "^Range-diff:$" v0-0001-* &&
        grep "> 1: .* new message" v0-0001-*
 '
 
@@ -662,6 +662,20 @@ test_expect_success 'range-diff with multiple --notes' '
        test_cmp expect actual
 '
 
+# `range-diff` should act like `log` with regards to notes
+test_expect_success 'range-diff with --notes=custom does not show default notes' '
+       git notes add -m "topic note" topic &&
+       git notes add -m "unmodified note" unmodified &&
+       git notes --ref=custom add -m "topic note" topic &&
+       git notes --ref=custom add -m "unmodified note" unmodified &&
+       test_when_finished git notes remove topic unmodified &&
+       test_when_finished git notes --ref=custom remove topic unmodified &&
+       git range-diff --notes=custom main..topic main..unmodified \
+               >actual &&
+       ! grep "## Notes ##" actual &&
+       grep "## Notes (custom) ##" actual
+'
+
 test_expect_success 'format-patch --range-diff does not compare notes by default' '
        git notes add -m "topic note" topic &&
        git notes add -m "unmodified note" unmodified &&
@@ -670,7 +684,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
                main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
-       test_i18ngrep "^Range-diff:$" 0000-* &&
+       test_grep "^Range-diff:$" 0000-* &&
        grep "= 1: .* s/5/A" 0000-* &&
        grep "= 2: .* s/4/A" 0000-* &&
        grep "= 3: .* s/11/B" 0000-* &&
@@ -679,6 +693,20 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
        ! grep "note" 0000-*
 '
 
+test_expect_success 'format-patch --notes=custom --range-diff only compares custom notes' '
+       git notes add -m "topic note" topic &&
+       git notes --ref=custom add -m "topic note (custom)" topic &&
+       git notes add -m "unmodified note" unmodified &&
+       git notes --ref=custom add -m "unmodified note (custom)" unmodified &&
+       test_when_finished git notes remove topic unmodified &&
+       test_when_finished git notes --ref=custom remove topic unmodified &&
+       git format-patch --notes=custom --cover-letter --range-diff=$prev \
+               main..unmodified >actual &&
+       test_when_finished "rm 000?-*" &&
+       grep "## Notes (custom) ##" 0000-* &&
+       ! grep "## Notes ##" 0000-*
+'
+
 test_expect_success 'format-patch --range-diff with --no-notes' '
        git notes add -m "topic note" topic &&
        git notes add -m "unmodified note" unmodified &&
@@ -687,7 +715,7 @@ test_expect_success 'format-patch --range-diff with --no-notes' '
                main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
-       test_i18ngrep "^Range-diff:$" 0000-* &&
+       test_grep "^Range-diff:$" 0000-* &&
        grep "= 1: .* s/5/A" 0000-* &&
        grep "= 2: .* s/4/A" 0000-* &&
        grep "= 3: .* s/11/B" 0000-* &&
@@ -704,7 +732,7 @@ test_expect_success 'format-patch --range-diff with --notes' '
                main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
-       test_i18ngrep "^Range-diff:$" 0000-* &&
+       test_grep "^Range-diff:$" 0000-* &&
        grep "= 1: .* s/5/A" 0000-* &&
        grep "= 2: .* s/4/A" 0000-* &&
        grep "= 3: .* s/11/B" 0000-* &&
@@ -733,7 +761,7 @@ test_expect_success 'format-patch --range-diff with format.notes config' '
                main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
-       test_i18ngrep "^Range-diff:$" 0000-* &&
+       test_grep "^Range-diff:$" 0000-* &&
        grep "= 1: .* s/5/A" 0000-* &&
        grep "= 2: .* s/4/A" 0000-* &&
        grep "= 3: .* s/11/B" 0000-* &&
@@ -764,7 +792,7 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
                main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
-       test_i18ngrep "^Range-diff:$" 0000-* &&
+       test_grep "^Range-diff:$" 0000-* &&
        grep "= 1: .* s/5/A" 0000-* &&
        grep "= 2: .* s/4/A" 0000-* &&
        grep "= 3: .* s/11/B" 0000-* &&
index d734000d2fca6ab25568b392ea57a05678915344..cf23c06c098756abec968d689bcbf3e58541901b 100755 (executable)
@@ -1469,9 +1469,9 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
 
 test_expect_success 'git notes copy diagnoses too many or too few arguments' '
        test_must_fail git notes copy 2>error &&
-       test_i18ngrep "too few arguments" error &&
+       test_grep "too few arguments" error &&
        test_must_fail git notes copy one two three 2>error &&
-       test_i18ngrep "too many arguments" error
+       test_grep "too many arguments" error
 '
 
 test_expect_success 'git notes get-ref expands refs/heads/main to refs/notes/refs/heads/main' '
index d3d72e25fe4b5ba05527d1378841978029f4c543..597df5ebc0a582018d30c018e734d1154c364ed6 100755 (executable)
@@ -216,7 +216,7 @@ test_expect_success 'merge z into m (== y) with default ("manual") resolver => C
        git config core.notesRef refs/notes/m &&
        test_must_fail git notes merge z >output 2>&1 &&
        # Output should point to where to resolve conflicts
-       test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
+       test_grep "\\.git/NOTES_MERGE_WORKTREE" output &&
        # Inspect merge conflicts
        ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
        test_cmp expect_conflicts output_conflicts &&
@@ -263,7 +263,7 @@ test_expect_success 'cannot do merge w/conflicts when previous merge is unfinish
        test -d .git/NOTES_MERGE_WORKTREE &&
        test_must_fail git notes merge z >output 2>&1 &&
        # Output should indicate what is wrong
-       test_i18ngrep -q "\\.git/NOTES_MERGE_\\* exists" output
+       test_grep -q "\\.git/NOTES_MERGE_\\* exists" output
 '
 
 # Setup non-conflicting merge between x and new notes ref w
@@ -417,7 +417,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol
        git config core.notesRef refs/notes/m &&
        test_must_fail git notes merge z >output 2>&1 &&
        # Output should point to where to resolve conflicts
-       test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
+       test_grep "\\.git/NOTES_MERGE_WORKTREE" output &&
        # Inspect merge conflicts
        ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
        test_cmp expect_conflicts output_conflicts &&
@@ -449,7 +449,7 @@ git rev-parse refs/notes/z > pre_merge_z
 test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
        test_must_fail git notes merge z >output 2>&1 &&
        # Output should point to where to resolve conflicts
-       test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
+       test_grep "\\.git/NOTES_MERGE_WORKTREE" output &&
        # Inspect merge conflicts
        ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
        test_cmp expect_conflicts output_conflicts &&
@@ -528,7 +528,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol
        git update-ref refs/notes/m refs/notes/y &&
        test_must_fail git notes merge z >output 2>&1 &&
        # Output should point to where to resolve conflicts
-       test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
+       test_grep "\\.git/NOTES_MERGE_WORKTREE" output &&
        # Inspect merge conflicts
        ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
        test_cmp expect_conflicts output_conflicts &&
@@ -561,9 +561,9 @@ y and z notes on 4th commit
 EOF
        # Fail to finalize merge
        test_must_fail git notes merge --commit >output 2>&1 &&
-       # .git/NOTES_MERGE_* must remain
-       test -f .git/NOTES_MERGE_PARTIAL &&
-       test -f .git/NOTES_MERGE_REF &&
+       # NOTES_MERGE_* refs and .git/NOTES_MERGE_* state files must remain
+       git rev-parse --verify NOTES_MERGE_PARTIAL &&
+       git rev-parse --verify NOTES_MERGE_REF &&
        test -f .git/NOTES_MERGE_WORKTREE/$commit_sha1 &&
        test -f .git/NOTES_MERGE_WORKTREE/$commit_sha2 &&
        test -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
@@ -573,9 +573,9 @@ EOF
        test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
        test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
        # Mention refs/notes/m, and its current and expected value in output
-       test_i18ngrep -q "refs/notes/m" output &&
-       test_i18ngrep -q "$(git rev-parse refs/notes/m)" output &&
-       test_i18ngrep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output &&
+       test_grep -q "refs/notes/m" output &&
+       test_grep -q "$(git rev-parse refs/notes/m)" output &&
+       test_grep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output &&
        # Verify that other notes refs has not changed (w, x, y and z)
        verify_notes w &&
        verify_notes x &&
index bff0aea550f285a6c2073efd50182cbc5fab8656..0fd33280cf91f7fe9384205df8b7570363a37076 100755 (executable)
@@ -57,7 +57,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' '
                cd worktree &&
                git config core.notesRef refs/notes/y &&
                test_must_fail git notes merge z 2>err &&
-               test_i18ngrep "a notes merge into refs/notes/y is already in-progress at" err
+               test_grep "a notes merge into refs/notes/y is already in-progress at" err
        ) &&
        test_must_fail git -C worktree symbolic-ref NOTES_MERGE_REF
 '
@@ -67,7 +67,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '
                cd worktree2 &&
                git config core.notesRef refs/notes/x &&
                test_must_fail git notes merge z >out 2>&1 &&
-               test_i18ngrep "Automatic notes merge failed" out &&
+               test_grep "Automatic notes merge failed" out &&
                grep -v "A notes merge into refs/notes/x is already in-progress in" out
        ) &&
        echo "refs/notes/x" >expect &&
index 028d825e8fb2d1757cd4341d693815bdd1c5642f..beca34605672d407244b26ebcffb1f70527f5915 100755 (executable)
@@ -5,6 +5,7 @@
 
 test_description='Test commit notes with stripspace behavior'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 MULTI_LF="$LF$LF$LF"
@@ -428,7 +429,7 @@ test_expect_success 'add notes with empty messages' '
        git notes add -m "${LF}" \
                      -m "${MULTI_LF}" \
                      -m "${LF}" >actual 2>&1 &&
-       test_i18ngrep "Removing note for object" actual
+       test_grep "Removing note for object" actual
 '
 
 test_expect_success 'add note by specifying "-C", "--no-stripspace" is the default behavior' '
@@ -441,7 +442,7 @@ test_expect_success 'add note by specifying "-C", "--no-stripspace" is the defau
        ${LF}
        EOF
 
-       cat expect | git hash-object -w --stdin >blob &&
+       git hash-object -w --stdin <expect >blob &&
        git notes add -C $(cat blob) &&
        git notes show >actual &&
        test_cmp expect actual &&
@@ -467,7 +468,7 @@ test_expect_success 'reuse note by specifying "-C" and "--stripspace"' '
        second-line
        EOF
 
-       cat data | git hash-object -w --stdin >blob &&
+       git hash-object -w --stdin <data >blob &&
        git notes add --stripspace -C $(cat blob) &&
        git notes show >actual &&
        test_cmp expect actual
@@ -491,7 +492,7 @@ test_expect_success 'reuse with "-C" and add note with "-m", "-m" will stripspac
        third-line
        EOF
 
-       cat data | git hash-object -w --stdin >blob &&
+       git hash-object -w --stdin <data >blob &&
        git notes add -C $(cat blob) -m "third-line" &&
        git notes show >actual &&
        test_cmp expect actual
@@ -510,7 +511,7 @@ test_expect_success 'add note with "-m" and reuse note with "-C", "-C" will not
        second-line
        EOF
 
-       cat data | git hash-object -w --stdin >blob &&
+       git hash-object -w --stdin <data >blob &&
        git notes add -m "first-line" -C $(cat blob)  &&
        git notes show >actual &&
        test_cmp expect actual
index 3ce918fdb8062fc5f720bb890ad58a2676547218..e1c8c5f70110aacfaa778194093f2a79251e055c 100755 (executable)
@@ -143,8 +143,8 @@ test_expect_success 'Show verbose error when HEAD could not be detached' '
        >B &&
        test_when_finished "rm -f B" &&
        test_must_fail git rebase topic 2>output.err >output.out &&
-       test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" output.err &&
-       test_i18ngrep B output.err
+       test_grep "The following untracked working tree files would be overwritten by checkout:" output.err &&
+       test_grep B output.err
 '
 
 test_expect_success 'fail when upstream arg is missing and not on branch' '
@@ -421,17 +421,7 @@ test_expect_success 'refuse to switch to branch checked out elsewhere' '
        git checkout main &&
        git worktree add wt &&
        test_must_fail git -C wt rebase main main 2>err &&
-       test_i18ngrep "already checked out" err
-'
-
-test_expect_success MINGW,SYMLINKS_WINDOWS 'rebase when .git/logs is a symlink' '
-       git checkout main &&
-       mv .git/logs actual_logs &&
-       cmd //c "mklink /D .git\logs ..\actual_logs" &&
-       git rebase -f HEAD^ &&
-       test -L .git/logs &&
-       rm .git/logs &&
-       mv actual_logs .git/logs
+       test_grep "already used by worktree at" err
 '
 
 test_expect_success 'rebase when inside worktree subdirectory' '
index e9e03ca4b5eb16e6c40815a25197e3e22bb37561..5c67d07ba3ecf6333d1967c341d9bfb75fc33769 100755 (executable)
@@ -171,7 +171,7 @@ test_expect_success '--reapply-cherry-picks' '
 
        # Regular rebase fails, because the 1-11 commit is deduplicated
        test_must_fail git -C repo rebase --merge main 2> err &&
-       test_i18ngrep "error: could not apply.*add 12 in another branch" err &&
+       test_grep "error: could not apply.*add 12 in another branch" err &&
        git -C repo rebase --abort &&
 
        # With --reapply-cherry-picks, it works
index f6e48644978b63ab00ccf40cca379e0770aef0b9..a1911c4a9d60e71f99d66ef6d7f30728ab8732df 100755 (executable)
@@ -108,10 +108,10 @@ test_expect_success 'correct advice upon picking empty commit' '
        test_when_finished "git rebase --abort" &&
        test_must_fail git rebase -i --onto goodbye \
                amended-goodbye^ amended-goodbye 2>err &&
-       test_i18ngrep "previous cherry-pick is now empty" err &&
-       test_i18ngrep "git rebase --skip" err &&
+       test_grep "previous cherry-pick is now empty" err &&
+       test_grep "git rebase --skip" err &&
        test_must_fail git commit &&
-       test_i18ngrep "git rebase --skip" err
+       test_grep "git rebase --skip" err
 '
 
 test_expect_success 'correct authorship when committing empty pick' '
@@ -131,10 +131,10 @@ test_expect_success 'correct advice upon rewording empty commit' '
                test_must_fail env FAKE_LINES="reword 1" git rebase -i \
                        --onto goodbye amended-goodbye^ amended-goodbye 2>err
        ) &&
-       test_i18ngrep "previous cherry-pick is now empty" err &&
-       test_i18ngrep "git rebase --skip" err &&
+       test_grep "previous cherry-pick is now empty" err &&
+       test_grep "git rebase --skip" err &&
        test_must_fail git commit &&
-       test_i18ngrep "git rebase --skip" err
+       test_grep "git rebase --skip" err
 '
 
 test_expect_success 'correct advice upon editing empty commit' '
@@ -144,10 +144,10 @@ test_expect_success 'correct advice upon editing empty commit' '
                test_must_fail env FAKE_LINES="edit 1" git rebase -i \
                        --onto goodbye amended-goodbye^ amended-goodbye 2>err
        ) &&
-       test_i18ngrep "previous cherry-pick is now empty" err &&
-       test_i18ngrep "git rebase --skip" err &&
+       test_grep "previous cherry-pick is now empty" err &&
+       test_grep "git rebase --skip" err &&
        test_must_fail git commit &&
-       test_i18ngrep "git rebase --skip" err
+       test_grep "git rebase --skip" err
 '
 
 test_expect_success 'correct advice upon cherry-picking an empty commit during a rebase' '
@@ -157,10 +157,10 @@ test_expect_success 'correct advice upon cherry-picking an empty commit during a
                test_must_fail env FAKE_LINES="1 exec_git_cherry-pick_amended-goodbye" \
                        git rebase -i goodbye^ goodbye 2>err
        ) &&
-       test_i18ngrep "previous cherry-pick is now empty" err &&
-       test_i18ngrep "git cherry-pick --skip" err &&
+       test_grep "previous cherry-pick is now empty" err &&
+       test_grep "git cherry-pick --skip" err &&
        test_must_fail git commit 2>err &&
-       test_i18ngrep "git cherry-pick --skip" err
+       test_grep "git cherry-pick --skip" err
 '
 
 test_expect_success 'correct advice upon multi cherry-pick picking an empty commit during a rebase' '
@@ -170,10 +170,10 @@ test_expect_success 'correct advice upon multi cherry-pick picking an empty comm
                test_must_fail env FAKE_LINES="1 exec_git_cherry-pick_goodbye_amended-goodbye" \
                        git rebase -i goodbye^^ goodbye 2>err
        ) &&
-       test_i18ngrep "previous cherry-pick is now empty" err &&
-       test_i18ngrep "git cherry-pick --skip" err &&
+       test_grep "previous cherry-pick is now empty" err &&
+       test_grep "git cherry-pick --skip" err &&
        test_must_fail git commit 2>err &&
-       test_i18ngrep "git cherry-pick --skip" err
+       test_grep "git cherry-pick --skip" err
 '
 
 test_expect_success 'fixup that empties commit fails' '
index 96a56aafbed67ca7e47ac173c00afdbe17b000ad..d1bead61fad03d8a847d75062ede8ad852f7d8e6 100755 (executable)
@@ -153,6 +153,18 @@ test_expect_success 'rebase -i with the exec command checks tree cleanness' '
        git rebase --continue
 '
 
+test_expect_success 'cherry-pick works with rebase --exec' '
+       test_when_finished "git cherry-pick --abort; \
+                           git rebase --abort; \
+                           git checkout primary" &&
+       echo "exec git cherry-pick G" >todo &&
+       (
+               set_replace_editor todo &&
+               test_must_fail git rebase -i D D
+       ) &&
+       test_cmp_rev G CHERRY_PICK_HEAD
+'
+
 test_expect_success 'rebase -x with empty command fails' '
        test_when_finished "git rebase --abort ||:" &&
        test_must_fail env git rebase -x "" @ 2>actual &&
@@ -291,9 +303,9 @@ test_expect_success 'abort with error when new base cannot be checked out' '
        git rm --cached file1 &&
        git commit -m "remove file in base" &&
        test_must_fail git rebase -i primary > output 2>&1 &&
-       test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" \
+       test_grep "The following untracked working tree files would be overwritten by checkout:" \
                output &&
-       test_i18ngrep "file1" output &&
+       test_grep "file1" output &&
        test_path_is_missing .git/rebase-merge &&
        rm file1 &&
        git reset --hard HEAD^
@@ -604,7 +616,8 @@ test_expect_success 'clean error after failed "exec"' '
        echo "edited again" > file7 &&
        git add file7 &&
        test_must_fail git rebase --continue 2>error &&
-       test_i18ngrep "you have staged changes in your working tree" error
+       test_grep "you have staged changes in your working tree" error &&
+       test_grep ! "could not open.*for reading" error
 '
 
 test_expect_success 'rebase a detached HEAD' '
@@ -758,7 +771,7 @@ test_expect_success 'reword' '
        git show HEAD~2 | grep "C changed"
 '
 
-test_expect_success 'no uncommited changes when rewording the todo list is reloaded' '
+test_expect_success 'no uncommitted changes when rewording and the todo list is reloaded' '
        git checkout E &&
        test_when_finished "git checkout @{-1}" &&
        (
@@ -955,7 +968,7 @@ test_expect_success 'rebase --exec works without -i ' '
        git reset --hard execute &&
        rm -rf exec_output &&
        EDITOR="echo >invoked_editor" git rebase --exec "echo a line >>exec_output"  HEAD~2 2>actual &&
-       test_i18ngrep  "Successfully rebased and updated" actual &&
+       test_grep  "Successfully rebased and updated" actual &&
        test_line_count = 2 exec_output &&
        test_path_is_missing invoked_editor
 '
@@ -963,7 +976,7 @@ test_expect_success 'rebase --exec works without -i ' '
 test_expect_success 'rebase -i --exec without <CMD>' '
        git reset --hard execute &&
        test_must_fail git rebase -i --exec 2>actual &&
-       test_i18ngrep "requires a value" actual &&
+       test_grep "requires a value" actual &&
        git checkout primary
 '
 
@@ -1272,24 +1285,38 @@ test_expect_success 'todo count' '
                test_set_editor "$(pwd)/dump-raw.sh" &&
                git rebase -i HEAD~4 >actual
        ) &&
-       test_i18ngrep "^# Rebase ..* onto ..* ([0-9]" actual
+       test_grep "^# Rebase ..* onto ..* ([0-9]" actual
 '
 
 test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '
-       git checkout --force branch2 &&
+       git checkout --force A &&
        git clean -f &&
+       cat >todo <<-EOF &&
+       exec >file2
+       pick $(git rev-parse B) B
+       pick $(git rev-parse C) C
+       pick $(git rev-parse D) D
+       exec cat .git/rebase-merge/done >actual
+       EOF
        (
-               set_fake_editor &&
-               FAKE_LINES="edit 1 2" git rebase -i A
-       ) &&
-       test_cmp_rev HEAD F &&
-       test_path_is_missing file6 &&
-       >file6 &&
-       test_must_fail git rebase --continue &&
-       test_cmp_rev HEAD F &&
-       rm file6 &&
+               set_replace_editor todo &&
+               test_must_fail git rebase -i A
+       ) &&
+       test_cmp_rev HEAD B &&
+       test_cmp_rev REBASE_HEAD C &&
+       head -n3 todo >expect &&
+       test_cmp expect .git/rebase-merge/done &&
+       rm file2 &&
+       test_path_is_missing .git/rebase-merge/patch &&
+       echo changed >file1 &&
+       git add file1 &&
+       test_must_fail git rebase --continue 2>err &&
+       grep "error: you have staged changes in your working tree" err &&
+       git reset --hard HEAD &&
        git rebase --continue &&
-       test_cmp_rev HEAD I
+       test_cmp_rev HEAD D &&
+       tail -n3 todo >>expect &&
+       test_cmp expect actual
 '
 
 test_expect_success 'rebase -i commits that overwrite untracked files (squash)' '
@@ -1305,7 +1332,14 @@ test_expect_success 'rebase -i commits that overwrite untracked files (squash)'
        >file6 &&
        test_must_fail git rebase --continue &&
        test_cmp_rev HEAD F &&
+       test_cmp_rev REBASE_HEAD I &&
        rm file6 &&
+       test_path_is_missing .git/rebase-merge/patch &&
+       echo changed >file1 &&
+       git add file1 &&
+       test_must_fail git rebase --continue 2>err &&
+       grep "error: you have staged changes in your working tree" err &&
+       git reset --hard HEAD &&
        git rebase --continue &&
        test $(git cat-file commit HEAD | sed -ne \$p) = I &&
        git reset --hard original-branch2
@@ -1323,7 +1357,14 @@ test_expect_success 'rebase -i commits that overwrite untracked files (no ff)' '
        >file6 &&
        test_must_fail git rebase --continue &&
        test $(git cat-file commit HEAD | sed -ne \$p) = F &&
+       test_cmp_rev REBASE_HEAD I &&
        rm file6 &&
+       test_path_is_missing .git/rebase-merge/patch &&
+       echo changed >file1 &&
+       git add file1 &&
+       test_must_fail git rebase --continue 2>err &&
+       grep "error: you have staged changes in your working tree" err &&
+       git reset --hard HEAD &&
        git rebase --continue &&
        test $(git cat-file commit HEAD | sed -ne \$p) = I
 '
@@ -1379,7 +1420,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
                FAKE_LINES="1 2 3 4" git rebase -i --root 2>actual
        ) &&
        test D = $(git cat-file commit HEAD | sed -ne \$p) &&
-       test_i18ngrep \
+       test_grep \
                "Successfully rebased and updated refs/heads/missing-commit" \
                actual
 '
@@ -1442,7 +1483,7 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = ig
                git rebase --continue 2>actual
        ) &&
        test D = $(git cat-file commit HEAD | sed -ne \$p) &&
-       test_i18ngrep \
+       test_grep \
                "Successfully rebased and updated refs/heads/missing-commit" \
                actual
 '
@@ -1477,7 +1518,7 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = wa
                git rebase --continue 2>actual
        ) &&
        test D = $(git cat-file commit HEAD | sed -ne \$p) &&
-       test_i18ngrep \
+       test_grep \
                "Successfully rebased and updated refs/heads/missing-commit" \
                actual
 '
@@ -1525,7 +1566,7 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = er
                git rebase --continue 2>actual
        ) &&
        test D = $(git cat-file commit HEAD | sed -ne \$p) &&
-       test_i18ngrep \
+       test_grep \
                "Successfully rebased and updated refs/heads/missing-commit" \
                actual
 '
@@ -1585,9 +1626,9 @@ test_expect_success 'static check of bad command' '
                set_fake_editor &&
                test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \
                git rebase -i --root 2>actual &&
-               test_i18ngrep "pickled $(git rev-list --oneline -1 primary~1)" \
+               test_grep "pickled $(git rev-list --oneline -1 primary~1)" \
                                actual &&
-               test_i18ngrep "You can fix this with .git rebase --edit-todo.." \
+               test_grep "You can fix this with .git rebase --edit-todo.." \
                                actual &&
                FAKE_LINES="1 2 3 drop 4 5" git rebase --edit-todo
        ) &&
@@ -1645,8 +1686,8 @@ test_expect_success 'static check of bad SHA-1' '
                set_fake_editor &&
                test_must_fail env FAKE_LINES="1 2 edit fakesha 3 4 5 #" \
                        git rebase -i --root 2>actual &&
-                       test_i18ngrep "edit XXXXXXX False commit" actual &&
-                       test_i18ngrep "You can fix this with .git rebase --edit-todo.." \
+                       test_grep "edit XXXXXXX False commit" actual &&
+                       test_grep "You can fix this with .git rebase --edit-todo.." \
                                        actual &&
                FAKE_LINES="1 2 4 5 6" git rebase --edit-todo
        ) &&
@@ -1673,7 +1714,7 @@ test_expect_success 'rebase -i --gpg-sign=<key-id>' '
                FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" \
                        HEAD^ >out 2>err
        ) &&
-       test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err
+       test_grep "$SQ-S\"S I Gner\"$SQ" err
 '
 
 test_expect_success 'rebase -i --gpg-sign=<key-id> overrides commit.gpgSign' '
@@ -1684,7 +1725,7 @@ test_expect_success 'rebase -i --gpg-sign=<key-id> overrides commit.gpgSign' '
                FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" \
                        HEAD^ >out 2>err
        ) &&
-       test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err
+       test_grep "$SQ-S\"S I Gner\"$SQ" err
 '
 
 test_expect_success 'valid author header after --root swap' '
@@ -1738,7 +1779,7 @@ test_expect_success 'correct error message for partial commit after empty pick'
        ) &&
        echo x >file1 &&
        test_must_fail git commit file1 2>err &&
-       test_i18ngrep "cannot do a partial commit during a rebase." err
+       test_grep "cannot do a partial commit during a rebase." err
 '
 
 test_expect_success 'correct error message for commit --amend after empty pick' '
@@ -1751,13 +1792,13 @@ test_expect_success 'correct error message for commit --amend after empty pick'
        ) &&
        echo x>file1 &&
        test_must_fail git commit -a --amend 2>err &&
-       test_i18ngrep "middle of a rebase -- cannot amend." err
+       test_grep "middle of a rebase -- cannot amend." err
 '
 
 test_expect_success 'todo has correct onto hash' '
        GIT_SEQUENCE_EDITOR=cat git rebase -i no-conflict-branch~4 no-conflict-branch >actual &&
        onto=$(git rev-parse --short HEAD~4) &&
-       test_i18ngrep "^# Rebase ..* onto $onto" actual
+       test_grep "^# Rebase ..* onto $onto" actual
 '
 
 test_expect_success 'ORIG_HEAD is updated correctly' '
@@ -2131,7 +2172,7 @@ test_expect_success '--update-refs: check failed ref update' '
        # recorded in the update-refs file. We will force-update the
        # "second" ref, but "git branch -f" will not work because of
        # the lock in the update-refs file.
-       git rev-parse third >.git/refs/heads/second &&
+       git update-ref refs/heads/second third &&
 
        test_must_fail git rebase --continue 2>err &&
        grep "update_ref failed for ref '\''refs/heads/second'\''" err &&
index ceca160005339168982d702e7d4e4e4897d494d3..a1d7fa7f7c6965f49cc017303aca52a658211b10 100755 (executable)
@@ -33,24 +33,24 @@ test_expect_success 'rebase -m' '
 
 test_expect_success 'rebase against main twice' '
        git rebase --apply main >out &&
-       test_i18ngrep "Current branch topic is up to date" out
+       test_grep "Current branch topic is up to date" out
 '
 
 test_expect_success 'rebase against main twice with --force' '
        git rebase --force-rebase --apply main >out &&
-       test_i18ngrep "Current branch topic is up to date, rebase forced" out
+       test_grep "Current branch topic is up to date, rebase forced" out
 '
 
 test_expect_success 'rebase against main twice from another branch' '
        git checkout topic^ &&
        git rebase --apply main topic >out &&
-       test_i18ngrep "Current branch topic is up to date" out
+       test_grep "Current branch topic is up to date" out
 '
 
 test_expect_success 'rebase fast-forward to main' '
        git checkout topic^ &&
        git rebase --apply topic >out &&
-       test_i18ngrep "Fast-forwarded HEAD to topic" out
+       test_grep "Fast-forwarded HEAD to topic" out
 '
 
 test_expect_success 'rebase --stat' '
@@ -75,14 +75,14 @@ test_expect_success 'rebase -n overrides config rebase.stat config' '
 
 test_expect_success 'rebase --onto outputs the invalid ref' '
        test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
-       test_i18ngrep "invalid-ref" err
+       test_grep "invalid-ref" err
 '
 
 test_expect_success 'error out early upon -C<n> or --whitespace=<bad>' '
        test_must_fail git rebase -Cnot-a-number HEAD 2>err &&
-       test_i18ngrep "numerical value" err &&
+       test_grep "numerical value" err &&
        test_must_fail git rebase --whitespace=bad HEAD 2>err &&
-       test_i18ngrep "Invalid whitespace option" err
+       test_grep "Invalid whitespace option" err
 '
 
 write_reflog_expect () {
@@ -251,8 +251,8 @@ test_expect_success 'rebase -i onto unrelated history' '
        git -C unrelated remote add -f origin "$PWD" &&
        git -C unrelated branch --set-upstream-to=origin/main &&
        git -C unrelated -c core.editor=true rebase -i -v --stat >actual &&
-       test_i18ngrep "Changes to " actual &&
-       test_i18ngrep "5 files changed" actual
+       test_grep "Changes to " actual &&
+       test_grep "5 files changed" actual
 '
 
 test_done
index ebbaed147a6ce2156472f45d88a0d300ec6612ac..9f49c4228b629589d7bfcf3435fda8e7c4b308be 100755 (executable)
@@ -40,9 +40,24 @@ testrebase() {
                test_path_is_missing "$state_dir"
        '
 
+       test_expect_success "pre rebase$type head is marked as reachable" '
+               # Clean up the state from the previous one
+               git checkout -f --detach pre-rebase &&
+               test_tick &&
+               git commit --amend --only -m "reworded" &&
+               orig_head=$(git rev-parse HEAD) &&
+               test_must_fail git rebase$type main &&
+               # Stop ORIG_HEAD marking $state_dir/orig-head as reachable
+               git update-ref -d ORIG_HEAD &&
+               git reflog expire --expire="$GIT_COMMITTER_DATE" --all &&
+               git prune --expire=now &&
+               git rebase --abort &&
+               test_cmp_rev $orig_head HEAD
+       '
+
        test_expect_success "rebase$type --abort after --skip" '
                # Clean up the state from the previous one
-               git reset --hard pre-rebase &&
+               git checkout -B to-rebase pre-rebase &&
                test_must_fail git rebase$type main &&
                test_path_is_dir "$state_dir" &&
                test_must_fail git rebase --skip &&
index a364530d7629fc0bb47c30211935b878e1aa9805..fcc40d6fe1fd5b2a9c4f2a5e4ede15e73c247790 100755 (executable)
@@ -43,7 +43,7 @@ test_auto_fixup () {
 
        git tag $1 &&
        test_tick &&
-       git rebase $2 -i HEAD^^^ &&
+       git rebase $2 HEAD^^^ &&
        git log --oneline >actual &&
        if test -n "$no_squash"
        then
@@ -61,15 +61,24 @@ test_auto_fixup () {
 }
 
 test_expect_success 'auto fixup (option)' '
-       test_auto_fixup final-fixup-option --autosquash
+       test_auto_fixup fixup-option --autosquash &&
+       test_auto_fixup fixup-option-i "--autosquash -i"
 '
 
-test_expect_success 'auto fixup (config)' '
+test_expect_success 'auto fixup (config true)' '
        git config rebase.autosquash true &&
-       test_auto_fixup final-fixup-config-true &&
+       test_auto_fixup ! fixup-config-true &&
+       test_auto_fixup fixup-config-true-i -i &&
        test_auto_fixup ! fixup-config-true-no --no-autosquash &&
+       test_auto_fixup ! fixup-config-true-i-no "-i --no-autosquash"
+'
+
+test_expect_success 'auto fixup (config false)' '
        git config rebase.autosquash false &&
-       test_auto_fixup ! final-fixup-config-false
+       test_auto_fixup ! fixup-config-false &&
+       test_auto_fixup ! fixup-config-false-i -i &&
+       test_auto_fixup fixup-config-false-yes --autosquash &&
+       test_auto_fixup fixup-config-false-i-yes "-i --autosquash"
 '
 
 test_auto_squash () {
@@ -87,7 +96,7 @@ test_auto_squash () {
        git commit -m "squash! first" -m "extra para for first" &&
        git tag $1 &&
        test_tick &&
-       git rebase $2 -i HEAD^^^ &&
+       git rebase $2 HEAD^^^ &&
        git log --oneline >actual &&
        if test -n "$no_squash"
        then
@@ -105,15 +114,24 @@ test_auto_squash () {
 }
 
 test_expect_success 'auto squash (option)' '
-       test_auto_squash final-squash --autosquash
+       test_auto_squash squash-option --autosquash &&
+       test_auto_squash squash-option-i "--autosquash -i"
 '
 
-test_expect_success 'auto squash (config)' '
+test_expect_success 'auto squash (config true)' '
        git config rebase.autosquash true &&
-       test_auto_squash final-squash-config-true &&
+       test_auto_squash ! squash-config-true &&
+       test_auto_squash squash-config-true-i -i &&
        test_auto_squash ! squash-config-true-no --no-autosquash &&
+       test_auto_squash ! squash-config-true-i-no "-i --no-autosquash"
+'
+
+test_expect_success 'auto squash (config false)' '
        git config rebase.autosquash false &&
-       test_auto_squash ! final-squash-config-false
+       test_auto_squash ! squash-config-false &&
+       test_auto_squash ! squash-config-false-i -i &&
+       test_auto_squash squash-config-false-yes --autosquash &&
+       test_auto_squash squash-config-false-i-yes "-i --autosquash"
 '
 
 test_expect_success 'misspelled auto squash' '
index fb7b68990cc33a6cbd08ba7031d405713db87446..127216f7225aa412022bb0f296f716c42ce15f56 100755 (executable)
@@ -182,8 +182,8 @@ test_expect_success '--skip after failed fixup cleans commit message' '
 
        : Final squash failed, but there was still a squash &&
        head -n1 .git/copy.txt >first-line &&
-       test_i18ngrep "# This is a combination of 3 commits" first-line &&
-       test_i18ngrep "# This is the commit message #3:" .git/copy.txt
+       test_grep "# This is a combination of 3 commits" first-line &&
+       test_grep "# This is the commit message #3:" .git/copy.txt
 '
 
 test_expect_success 'setup rerere database' '
@@ -268,6 +268,24 @@ test_expect_success 'the todo command "break" works' '
        test_path_is_file execed
 '
 
+test_expect_success 'patch file is removed before break command' '
+       test_when_finished "git rebase --abort" &&
+       cat >todo <<-\EOF &&
+       pick commit-new-file-F2-on-topic-branch
+       break
+       EOF
+
+       (
+               set_replace_editor todo &&
+               test_must_fail git rebase -i --onto commit-new-file-F2 HEAD
+       ) &&
+       test_path_is_file .git/rebase-merge/patch &&
+       echo 22>F2 &&
+       git add F2 &&
+       git rebase --continue &&
+       test_path_is_missing .git/rebase-merge/patch
+'
+
 test_expect_success '--reschedule-failed-exec' '
        test_when_finished "git rebase --abort" &&
        test_must_fail git rebase -x false --reschedule-failed-exec HEAD^ &&
@@ -276,7 +294,7 @@ test_expect_success '--reschedule-failed-exec' '
        test_must_fail git -c rebase.rescheduleFailedExec=true \
                rebase -x false HEAD^ 2>err &&
        grep "^exec false" .git/rebase-merge/git-rebase-todo &&
-       test_i18ngrep "has been rescheduled" err
+       test_grep "has been rescheduled" err
 '
 
 test_expect_success 'rebase.rescheduleFailedExec only affects `rebase -i`' '
index 693934ee8be9600e6edda9e691b5415f8c153b34..1a820f148155cbc65e2e1ad07275e25510e083b9 100755 (executable)
@@ -333,4 +333,14 @@ test_expect_success 'never change active branch' '
        test_cmp_rev not-the-feature-branch unrelated-onto-branch
 '
 
+test_expect_success 'autostash commit is marked as reachable' '
+       echo changed >file0 &&
+       git rebase --autostash --exec "git prune --expire=now" \
+               feature-branch^ feature-branch &&
+       # git rebase succeeds if the stash cannot be applied so we need to check
+       # the contents of file0
+       echo changed >expect &&
+       test_cmp expect file0
+'
+
 test_done
index 2eba00bdf5898531744c8f77429a8f4d1ad1b91d..b40f26250b7e3d8ce95b149589822bd57d84dbbe 100755 (executable)
@@ -100,12 +100,6 @@ test_rebase_am_only () {
                test_must_fail git rebase $opt --root A
        "
 
-       test_expect_success "$opt incompatible with rebase.autosquash" "
-               git checkout B^0 &&
-               test_must_fail git -c rebase.autosquash=true rebase $opt A 2>err &&
-               grep -e --no-autosquash err
-       "
-
        test_expect_success "$opt incompatible with rebase.rebaseMerges" "
                git checkout B^0 &&
                test_must_fail git -c rebase.rebaseMerges=true rebase $opt A 2>err &&
@@ -118,12 +112,6 @@ test_rebase_am_only () {
                grep -e --no-update-refs err
        "
 
-       test_expect_success "$opt okay with overridden rebase.autosquash" "
-               test_when_finished \"git reset --hard B^0\" &&
-               git checkout B^0 &&
-               git -c rebase.autosquash=true rebase --no-autosquash $opt A
-       "
-
        test_expect_success "$opt okay with overridden rebase.rebaseMerges" "
                test_when_finished \"git reset --hard B^0\" &&
                git checkout B^0 &&
index 96ae0edf1e17275825c2f6fdd57f09431834ed77..59b5d6b6f276c367862df92f847db37906715004 100755 (executable)
@@ -128,14 +128,24 @@ test_expect_success 'generate correct todo list' '
 '
 
 test_expect_success '`reset` refuses to overwrite untracked files' '
-       git checkout -b refuse-to-reset &&
+       git checkout B &&
        test_commit dont-overwrite-untracked &&
-       git checkout @{-1} &&
-       : >dont-overwrite-untracked.t &&
-       echo "reset refs/tags/dont-overwrite-untracked" >script-from-scratch &&
+       cat >script-from-scratch <<-EOF &&
+       exec >dont-overwrite-untracked.t
+       pick $(git rev-parse B) B
+       reset refs/tags/dont-overwrite-untracked
+       pick $(git rev-parse C) C
+       exec cat .git/rebase-merge/done >actual
+       EOF
        test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
-       test_must_fail git rebase -ir HEAD &&
-       git rebase --abort
+       test_must_fail git rebase -ir A &&
+       test_cmp_rev HEAD B &&
+       head -n3 script-from-scratch >expect &&
+       test_cmp expect .git/rebase-merge/done &&
+       rm dont-overwrite-untracked.t &&
+       git rebase --continue &&
+       tail -n3 script-from-scratch >>expect &&
+       test_cmp expect actual
 '
 
 test_expect_success '`reset` rejects trees' '
@@ -165,12 +175,16 @@ test_expect_success 'failed `merge -C` writes patch (may be rescheduled, too)' '
        test_config sequence.editor \""$PWD"/replace-editor.sh\" &&
        test_tick &&
        test_must_fail git rebase -ir HEAD &&
+       test_cmp_rev REBASE_HEAD H^0 &&
        grep "^merge -C .* G$" .git/rebase-merge/done &&
        grep "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
-       test_path_is_file .git/rebase-merge/patch &&
+       test_path_is_missing .git/rebase-merge/patch &&
+       echo changed >file1 &&
+       git add file1 &&
+       test_must_fail git rebase --continue 2>err &&
+       grep "error: you have staged changes in your working tree" err &&
 
        : fail because of merge conflict &&
-       rm G.t .git/rebase-merge/patch &&
        git reset --hard conflicting-G &&
        test_must_fail git rebase --continue &&
        ! grep "^merge -C .* G$" .git/rebase-merge/git-rebase-todo &&
@@ -586,4 +600,15 @@ test_expect_success 'progress shows the correct total' '
        test_line_count = 14 progress
 '
 
+test_expect_success 'truncate label names' '
+       commit=$(git commit-tree -p HEAD^ -p HEAD -m "0123456789 我 123" HEAD^{tree}) &&
+       git merge --ff-only $commit &&
+
+       done="$(git rev-parse --git-path rebase-merge/done)" &&
+       git -c rebase.maxLabelLength=14 rebase --rebase-merges -x "cp \"$done\" out" --root &&
+       grep "label 0123456789-我$" out &&
+       git -c rebase.maxLabelLength=13 rebase --rebase-merges -x "cp \"$done\" out" --root &&
+       grep "label 0123456789-$" out
+'
+
 test_done
index 4bfc779bb875fe9989bf67833eb5c5477095d72c..0bb284d61dbfae3077c7408ba266ca596e61207d 100755 (executable)
@@ -84,7 +84,7 @@ test_expect_success 'git rebase --fork-point with ambigous refname' '
 
 test_expect_success '--fork-point and --root both given' '
        test_must_fail git rebase --fork-point --root 2>err &&
-       test_i18ngrep "cannot be used together" err
+       test_grep "cannot be used together" err
 '
 
 test_expect_success 'rebase.forkPoint set to false' '
index e2ef6193233dd0b7a2341c391695aabd73d03200..aeab689a98d00919e0473380fc9bf40497b32c80 100755 (executable)
@@ -43,7 +43,7 @@ test_expect_success 'cherry-pick --nonsense' '
        git diff --exit-code HEAD &&
        test_must_fail git cherry-pick --nonsense 2>msg &&
        git diff --exit-code HEAD "$pos" &&
-       test_i18ngrep "[Uu]sage:" msg
+       test_grep "[Uu]sage:" msg
 '
 
 test_expect_success 'revert --nonsense' '
@@ -52,7 +52,7 @@ test_expect_success 'revert --nonsense' '
        git diff --exit-code HEAD &&
        test_must_fail git revert --nonsense 2>msg &&
        git diff --exit-code HEAD "$pos" &&
-       test_i18ngrep "[Uu]sage:" msg
+       test_grep "[Uu]sage:" msg
 '
 
 # the following two test cherry-pick and revert with renames
@@ -99,7 +99,7 @@ test_expect_success 'revert forbidden on dirty working tree' '
        echo content >extra_file &&
        git add extra_file &&
        test_must_fail git revert HEAD 2>errors &&
-       test_i18ngrep "your local changes would be overwritten by " errors
+       test_grep "your local changes would be overwritten by " errors
 
 '
 
@@ -176,6 +176,29 @@ test_expect_success 'advice from failed revert' '
        test_cmp expected actual
 '
 
+test_expect_subject () {
+       echo "$1" >expect &&
+       git log -1 --pretty=%s >actual &&
+       test_cmp expect actual
+}
+
+test_expect_success 'titles of fresh reverts' '
+       test_commit --no-tag A file1 &&
+       test_commit --no-tag B file1 &&
+       git revert --no-edit HEAD &&
+       test_expect_subject "Revert \"B\"" &&
+       git revert --no-edit HEAD &&
+       test_expect_subject "Reapply \"B\"" &&
+       git revert --no-edit HEAD &&
+       test_expect_subject "Revert \"Reapply \"B\"\""
+'
+
+test_expect_success 'title of legacy double revert' '
+       test_commit --no-tag "Revert \"Revert \"B\"\"" file1 &&
+       git revert --no-edit HEAD &&
+       test_expect_subject "Revert \"Revert \"Revert \"B\"\"\""
+'
+
 test_expect_success 'identification of reverted commit (default)' '
        test_commit to-ident &&
        test_when_finished "git reset --hard to-ident" &&
index f32799e04633fd831293d5b64106f9c856d3d407..c88d597b12682ccc611699f43c6451e35483fe6a 100755 (executable)
@@ -177,7 +177,7 @@ test_expect_success 'partial commit of cherry-pick fails' '
        git add foo &&
        test_must_fail git commit foo 2>err &&
 
-       test_i18ngrep "cannot do a partial commit during a cherry-pick." err
+       test_grep "cannot do a partial commit during a cherry-pick." err
 '
 
 test_expect_success 'commit --amend of cherry-pick fails' '
@@ -188,7 +188,7 @@ test_expect_success 'commit --amend of cherry-pick fails' '
        git add foo &&
        test_must_fail git commit --amend 2>err &&
 
-       test_i18ngrep "in the middle of a cherry-pick -- cannot amend." err
+       test_grep "in the middle of a cherry-pick -- cannot amend." err
 '
 
 test_expect_success 'successful final commit clears cherry-pick state' '
@@ -498,7 +498,7 @@ test_expect_success \
 test_expect_success 'failed cherry-pick does not forget -s' '
        pristine_detach initial &&
        test_must_fail git cherry-pick -s picked &&
-       test_i18ngrep -e "Signed-off-by" .git/MERGE_MSG
+       test_grep -e "Signed-off-by" .git/MERGE_MSG
 '
 
 test_expect_success 'commit after failed cherry-pick does not add duplicated -s' '
@@ -563,7 +563,7 @@ test_expect_success 'cherry-pick preserves sparse-checkout' '
        echo /unrelated >.git/info/sparse-checkout &&
        git read-tree --reset -u HEAD &&
        test_must_fail git cherry-pick -Xours picked>actual &&
-       test_i18ngrep ! "Changes not staged for commit:" actual
+       test_grep ! "Changes not staged for commit:" actual
 '
 
 test_expect_success 'cherry-pick --continue remembers --keep-redundant-commits' '
index 3b0fa66c33da5857012b56d465c5ffad77f61be4..72020a51c4375fd793af7e0129443cbf8d11d929 100755 (executable)
@@ -154,7 +154,7 @@ test_expect_success 'skip "empty" commit' '
        pristine_detach picked &&
        test_commit dummy foo d &&
        test_must_fail git cherry-pick anotherpick 2>err &&
-       test_i18ngrep "git cherry-pick --skip" err &&
+       test_grep "git cherry-pick --skip" err &&
        git cherry-pick --skip &&
        test_cmp_rev dummy HEAD
 '
@@ -314,7 +314,7 @@ test_expect_success '--abort does not unsafely change HEAD' '
        git reset --hard base &&
        test_must_fail git cherry-pick picked anotherpick &&
        git cherry-pick --abort 2>actual &&
-       test_i18ngrep "You seem to have moved HEAD" actual &&
+       test_grep "You seem to have moved HEAD" actual &&
        test_cmp_rev base HEAD
 '
 
@@ -520,7 +520,7 @@ test_expect_success '--continue asks for help after resolving patch to nil' '
        test_cmp_rev unrelatedpick CHERRY_PICK_HEAD &&
        git checkout HEAD -- unrelated &&
        test_must_fail git cherry-pick --continue 2>msg &&
-       test_i18ngrep "The previous cherry-pick is now empty" msg
+       test_grep "The previous cherry-pick is now empty" msg
 '
 
 test_expect_success 'follow advice and skip nil patch' '
index 0e8afe49ed100cb3c1b89f8c33b639ab8ac1cabb..98259e2adaa9dba9fa6bbcb79e50948e69a6b9e6 100755 (executable)
@@ -276,7 +276,7 @@ test_expect_success 'Resolving by removal is not a warning-worthy event' '
        blob=$(echo blob | git hash-object -w --stdin) &&
        printf "100644 $blob %d\tblob\n" 1 2 3 | git update-index --index-info &&
        git rm blob >msg 2>&1 &&
-       test_i18ngrep ! "needs merge" msg &&
+       test_grep ! "needs merge" msg &&
        test_must_fail git ls-files -s --error-unmatch blob
 '
 
@@ -631,7 +631,7 @@ test_expect_success 'rm of a populated submodule with a .git directory migrates
        test_path_is_missing submod/.git &&
        git status -s -uno --ignore-submodules=none >actual &&
        test_file_not_empty actual &&
-       test_i18ngrep Migrating output.err
+       test_grep Migrating output.err
 '
 
 cat >expect.deepmodified <<EOF
@@ -722,7 +722,7 @@ test_expect_success "rm absorbs submodule's nested .git directory" '
        test_path_is_missing submod/subsubmod/.git &&
        git status -s -uno --ignore-submodules=none >actual &&
        test_file_not_empty actual &&
-       test_i18ngrep Migrating output.err
+       test_grep Migrating output.err
 '
 
 test_expect_success 'checking out a commit after submodule removal needs manual updates' '
@@ -731,7 +731,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
        git submodule update &&
        git checkout -q HEAD^ &&
        git checkout -q main 2>actual &&
-       test_i18ngrep "^warning: unable to rmdir '\''submod'\'':" actual &&
+       test_grep "^warning: unable to rmdir '\''submod'\'':" actual &&
        git status -s submod >actual &&
        echo "?? submod/" >expected &&
        test_cmp expected actual &&
index a2a0c820fe38a976b963570453df17a089599f9d..7cef12981c4be0b611f70fe021d5960f1ad4e5a8 100755 (executable)
@@ -67,14 +67,14 @@ test_expect_success 'error conditions' '
        echo fileA.t >list &&
 
        test_must_fail git rm --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
+       test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git rm --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
+       test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        >empty_list &&
        test_must_fail git rm --pathspec-from-file=empty_list 2>err &&
-       test_i18ngrep -e "No pathspec was given. Which files should I remove?" err
+       test_grep -e "No pathspec was given. Which files should I remove?" err
 '
 
 test_done
diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh
new file mode 100755 (executable)
index 0000000..3896702
--- /dev/null
@@ -0,0 +1,198 @@
+#!/bin/sh
+
+test_description='basic git replay tests'
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+GIT_AUTHOR_NAME=author@name
+GIT_AUTHOR_EMAIL=bogus@email@address
+export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
+
+test_expect_success 'setup' '
+       test_commit A &&
+       test_commit B &&
+
+       git switch -c topic1 &&
+       test_commit C &&
+       git switch -c topic2 &&
+       test_commit D &&
+       test_commit E &&
+       git switch topic1 &&
+       test_commit F &&
+       git switch -c topic3 &&
+       test_commit G &&
+       test_commit H &&
+       git switch -c topic4 main &&
+       test_commit I &&
+       test_commit J &&
+
+       git switch -c next main &&
+       test_commit K &&
+       git merge -m "Merge topic1" topic1 &&
+       git merge -m "Merge topic2" topic2 &&
+       git merge -m "Merge topic3" topic3 &&
+       >evil &&
+       git add evil &&
+       git commit --amend &&
+       git merge -m "Merge topic4" topic4 &&
+
+       git switch main &&
+       test_commit L &&
+       test_commit M &&
+
+       git switch -c conflict B &&
+       test_commit C.conflict C.t conflict
+'
+
+test_expect_success 'setup bare' '
+       git clone --bare . bare
+'
+
+test_expect_success 'using replay to rebase two branches, one on top of other' '
+       git replay --onto main topic1..topic2 >result &&
+
+       test_line_count = 1 result &&
+
+       git log --format=%s $(cut -f 3 -d " " result) >actual &&
+       test_write_lines E D M L B A >expect &&
+       test_cmp expect actual &&
+
+       printf "update refs/heads/topic2 " >expect &&
+       printf "%s " $(cut -f 3 -d " " result) >>expect &&
+       git rev-parse topic2 >>expect &&
+
+       test_cmp expect result
+'
+
+test_expect_success 'using replay on bare repo to rebase two branches, one on top of other' '
+       git -C bare replay --onto main topic1..topic2 >result-bare &&
+       test_cmp expect result-bare
+'
+
+test_expect_success 'using replay to rebase with a conflict' '
+       test_expect_code 1 git replay --onto topic1 B..conflict
+'
+
+test_expect_success 'using replay on bare repo to rebase with a conflict' '
+       test_expect_code 1 git -C bare replay --onto topic1 B..conflict
+'
+
+test_expect_success 'using replay to perform basic cherry-pick' '
+       # The differences between this test and previous ones are:
+       #   --advance vs --onto
+       # 2nd field of result is refs/heads/main vs. refs/heads/topic2
+       # 4th field of result is hash for main instead of hash for topic2
+
+       git replay --advance main topic1..topic2 >result &&
+
+       test_line_count = 1 result &&
+
+       git log --format=%s $(cut -f 3 -d " " result) >actual &&
+       test_write_lines E D M L B A >expect &&
+       test_cmp expect actual &&
+
+       printf "update refs/heads/main " >expect &&
+       printf "%s " $(cut -f 3 -d " " result) >>expect &&
+       git rev-parse main >>expect &&
+
+       test_cmp expect result
+'
+
+test_expect_success 'using replay on bare repo to perform basic cherry-pick' '
+       git -C bare replay --advance main topic1..topic2 >result-bare &&
+       test_cmp expect result-bare
+'
+
+test_expect_success 'replay on bare repo fails with both --advance and --onto' '
+       test_must_fail git -C bare replay --advance main --onto main topic1..topic2 >result-bare
+'
+
+test_expect_success 'replay fails when both --advance and --onto are omitted' '
+       test_must_fail git replay topic1..topic2 >result
+'
+
+test_expect_success 'using replay to also rebase a contained branch' '
+       git replay --contained --onto main main..topic3 >result &&
+
+       test_line_count = 2 result &&
+       cut -f 3 -d " " result >new-branch-tips &&
+
+       git log --format=%s $(head -n 1 new-branch-tips) >actual &&
+       test_write_lines F C M L B A >expect &&
+       test_cmp expect actual &&
+
+       git log --format=%s $(tail -n 1 new-branch-tips) >actual &&
+       test_write_lines H G F C M L B A >expect &&
+       test_cmp expect actual &&
+
+       printf "update refs/heads/topic1 " >expect &&
+       printf "%s " $(head -n 1 new-branch-tips) >>expect &&
+       git rev-parse topic1 >>expect &&
+       printf "update refs/heads/topic3 " >>expect &&
+       printf "%s " $(tail -n 1 new-branch-tips) >>expect &&
+       git rev-parse topic3 >>expect &&
+
+       test_cmp expect result
+'
+
+test_expect_success 'using replay on bare repo to also rebase a contained branch' '
+       git -C bare replay --contained --onto main main..topic3 >result-bare &&
+       test_cmp expect result-bare
+'
+
+test_expect_success 'using replay to rebase multiple divergent branches' '
+       git replay --onto main ^topic1 topic2 topic4 >result &&
+
+       test_line_count = 2 result &&
+       cut -f 3 -d " " result >new-branch-tips &&
+
+       git log --format=%s $(head -n 1 new-branch-tips) >actual &&
+       test_write_lines E D M L B A >expect &&
+       test_cmp expect actual &&
+
+       git log --format=%s $(tail -n 1 new-branch-tips) >actual &&
+       test_write_lines J I M L B A >expect &&
+       test_cmp expect actual &&
+
+       printf "update refs/heads/topic2 " >expect &&
+       printf "%s " $(head -n 1 new-branch-tips) >>expect &&
+       git rev-parse topic2 >>expect &&
+       printf "update refs/heads/topic4 " >>expect &&
+       printf "%s " $(tail -n 1 new-branch-tips) >>expect &&
+       git rev-parse topic4 >>expect &&
+
+       test_cmp expect result
+'
+
+test_expect_success 'using replay on bare repo to rebase multiple divergent branches, including contained ones' '
+       git -C bare replay --contained --onto main ^main topic2 topic3 topic4 >result &&
+
+       test_line_count = 4 result &&
+       cut -f 3 -d " " result >new-branch-tips &&
+
+       >expect &&
+       for i in 2 1 3 4
+       do
+               printf "update refs/heads/topic$i " >>expect &&
+               printf "%s " $(grep topic$i result | cut -f 3 -d " ") >>expect &&
+               git -C bare rev-parse topic$i >>expect || return 1
+       done &&
+
+       test_cmp expect result &&
+
+       test_write_lines F C M L B A >expect1 &&
+       test_write_lines E D C M L B A >expect2 &&
+       test_write_lines H G F C M L B A >expect3 &&
+       test_write_lines J I M L B A >expect4 &&
+
+       for i in 1 2 3 4
+       do
+               git -C bare log --format=%s $(grep topic$i result | cut -f 3 -d " ") >actual &&
+               test_cmp expect$i actual || return 1
+       done
+'
+
+test_done
index 7623689da24501a7bb7cd7224035f854eeab43ff..f23d39f0d52ec6f5035acfb029550babc67859da 100755 (executable)
@@ -438,7 +438,7 @@ test_expect_success 'git add --chmod fails with non regular files (but updates t
        test_ln_s_add foo foo3 &&
        touch foo4 &&
        test_must_fail git add --chmod=+x foo3 foo4 2>stderr &&
-       test_i18ngrep "cannot chmod +x .foo3." stderr &&
+       test_grep "cannot chmod +x .foo3." stderr &&
        test_mode_in_index 120000 foo3 &&
        test_mode_in_index 100755 foo4
 '
@@ -455,12 +455,12 @@ test_expect_success 'git add --chmod --dry-run reports error for non regular fil
        git reset --hard &&
        test_ln_s_add foo foo4 &&
        test_must_fail git add --chmod=+x --dry-run foo4 2>stderr &&
-       test_i18ngrep "cannot chmod +x .foo4." stderr
+       test_grep "cannot chmod +x .foo4." stderr
 '
 
 test_expect_success 'git add --chmod --dry-run reports error for unmatched pathspec' '
        test_must_fail git add --chmod=+x --dry-run nonexistent 2>stderr &&
-       test_i18ngrep "pathspec .nonexistent. did not match any files" stderr
+       test_grep "pathspec .nonexistent. did not match any files" stderr
 '
 
 test_expect_success 'no file status change if no pathspec is given' '
index 34aabb7f5f6a543b31f89650f63b8783e9071271..0b5339ac6ca8248582ce723e3d552a8d4513e294 100755 (executable)
@@ -335,12 +335,12 @@ test_expect_success 'different prompts for mode change/deleted' '
 test_expect_success 'correct message when there is nothing to do' '
        git reset --hard &&
        git add -p 2>err &&
-       test_i18ngrep "No changes" err &&
+       test_grep "No changes" err &&
        printf "\\0123" >binary &&
        git add binary &&
        printf "\\0abc" >binary &&
        git add -p 2>err &&
-       test_i18ngrep "Only binary files changed" err
+       test_grep "Only binary files changed" err
 '
 
 test_expect_success 'setup again' '
@@ -497,7 +497,7 @@ test_expect_success 'adding an empty file' '
 
                echo y | git checkout -p added-file -- >actual &&
                test_path_is_file empty &&
-               test_i18ngrep "Apply addition to index and worktree" actual
+               test_grep "Apply addition to index and worktree" actual
        )
 '
 
@@ -838,7 +838,7 @@ test_expect_success 'diff.algorithm is passed to `git diff-files`' '
        git add file &&
        echo changed >file &&
        test_must_fail git -c diff.algorithm=bogus add -p 2>err &&
-       test_i18ngrep "error: option diff-algorithm accepts " err
+       test_grep "error: option diff-algorithm accepts " err
 '
 
 test_expect_success 'patch-mode via -i prompts for files' '
index 4e6b5177c9329b11ee9046d75e6cf5b0dbf358df..3aa59f6f639b5bfc79ab048f594cb2512755be73 100755 (executable)
@@ -138,23 +138,23 @@ test_expect_success 'error conditions' '
        >empty_list &&
 
        test_must_fail git add --pathspec-from-file=list --interactive 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
 
        test_must_fail git add --pathspec-from-file=list --patch 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
 
        test_must_fail git add --pathspec-from-file=list --edit 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--edit. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--edit. cannot be used together" err &&
 
        test_must_fail git add --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
+       test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git add --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
+       test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        # This case succeeds, but still prints to stderr
        git add --pathspec-from-file=empty_list 2>err &&
-       test_i18ngrep -e "Nothing specified, nothing added." err
+       test_grep -e "Nothing specified, nothing added." err
 '
 
 test_done
index bfab245eb32b07d9a30810f9b388dcf9c629bdf3..f27d09cfd9439ae31ec707fe738356bca88064f6 100755 (executable)
@@ -45,7 +45,7 @@ test_expect_success 'UTF-8 invalid characters refused' '
        printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
                >"$HOME/invalid" &&
        git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
-       test_i18ngrep "did not conform" "$HOME"/stderr
+       test_grep "did not conform" "$HOME"/stderr
 '
 
 test_expect_success 'UTF-8 overlong sequences rejected' '
@@ -55,7 +55,7 @@ test_expect_success 'UTF-8 overlong sequences rejected' '
        printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \
                >"$HOME/invalid" &&
        git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
-       test_i18ngrep "did not conform" "$HOME"/stderr
+       test_grep "did not conform" "$HOME"/stderr
 '
 
 test_expect_success 'UTF-8 non-characters refused' '
@@ -64,7 +64,7 @@ test_expect_success 'UTF-8 non-characters refused' '
        printf "Commit message\n\nNon-character:\364\217\277\276\n" \
                >"$HOME/invalid" &&
        git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
-       test_i18ngrep "did not conform" "$HOME"/stderr
+       test_grep "did not conform" "$HOME"/stderr
 '
 
 test_expect_success 'UTF-8 non-characters refused' '
@@ -73,7 +73,7 @@ test_expect_success 'UTF-8 non-characters refused' '
        printf "Commit message\n\nNon-character:\357\267\220\n" \
                >"$HOME/invalid" &&
        git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
-       test_i18ngrep "did not conform" "$HOME"/stderr
+       test_grep "did not conform" "$HOME"/stderr
 '
 
 for H in ISO8859-1 eucJP ISO-2022-JP
index 4f16a735d99e835b3b812130659ba609b1bfc284..4b37f78829819ff023db64b026fc6b8ea4061deb 100755 (executable)
@@ -298,7 +298,7 @@ test_expect_success 'am --no-utf8 (U/L)' '
 
        # commit-tree will warn that the commit message does not contain valid UTF-8
        # as mailinfo did not convert it
-       test_i18ngrep "did not conform" err &&
+       test_grep "did not conform" err &&
 
        check_encoding 2
 '
index 0b3dfeaea20048426be4d032dd6dc7e66359dc67..00db82fb2455b8397de6ae0e5ea8e4fd96ed3d6c 100755 (executable)
@@ -200,7 +200,7 @@ test_expect_success 'drop stash reflog updates refs/stash' '
        test_cmp expect actual
 '
 
-test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite' '
+test_expect_success 'drop stash reflog updates refs/stash with rewrite' '
        git init repo &&
        (
                cd repo &&
@@ -213,16 +213,16 @@ test_expect_success REFFILES 'drop stash reflog updates refs/stash with rewrite'
        new_oid="$(git -C repo rev-parse stash@{0})" &&
 
        cat >expect <<-EOF &&
-       $(test_oid zero) $old_oid
-       $old_oid $new_oid
+       $new_oid
+       $old_oid
        EOF
-       cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
+       git -C repo reflog show refs/stash --format=%H >actual &&
        test_cmp expect actual &&
 
        git -C repo stash drop stash@{1} &&
-       cut -d" " -f1-2 repo/.git/logs/refs/stash >actual &&
+       git -C repo reflog show refs/stash --format=%H >actual &&
        cat >expect <<-EOF &&
-       $(test_oid zero) $new_oid
+       $new_oid
        EOF
        test_cmp expect actual
 '
@@ -395,7 +395,7 @@ test_expect_success 'stash --staged' '
 
 test_expect_success 'dont assume push with non-option args' '
        test_must_fail git stash -q drop 2>err &&
-       test_i18ngrep -e "subcommand wasn'\''t specified; '\''push'\'' can'\''t be assumed due to unexpected token '\''drop'\''" err
+       test_grep -e "subcommand wasn'\''t specified; '\''push'\'' can'\''t be assumed due to unexpected token '\''drop'\''" err
 '
 
 test_expect_success 'stash --invalid-option' '
@@ -596,7 +596,7 @@ test_expect_success 'giving too many ref arguments does not modify files' '
        for type in apply pop "branch stash-branch"
        do
                test_must_fail git stash $type stash@{0} stash@{1} 2>err &&
-               test_i18ngrep "Too many revisions" err &&
+               test_grep "Too many revisions" err &&
                test 123456789 = $(test-tool chmtime -g file2) || return 1
        done
 '
@@ -604,14 +604,14 @@ test_expect_success 'giving too many ref arguments does not modify files' '
 test_expect_success 'drop: too many arguments errors out (does nothing)' '
        git stash list >expect &&
        test_must_fail git stash drop stash@{0} stash@{1} 2>err &&
-       test_i18ngrep "Too many revisions" err &&
+       test_grep "Too many revisions" err &&
        git stash list >actual &&
        test_cmp expect actual
 '
 
 test_expect_success 'show: too many arguments errors out (does nothing)' '
        test_must_fail git stash show stash@{0} stash@{1} 2>err 1>out &&
-       test_i18ngrep "Too many revisions" err &&
+       test_grep "Too many revisions" err &&
        test_must_be_empty out
 '
 
@@ -654,7 +654,7 @@ test_expect_success 'stash branch - stashes on stack, stash-like argument' '
 
 test_expect_success 'stash branch complains with no arguments' '
        test_must_fail git stash branch 2>err &&
-       test_i18ngrep "No branch name specified" err
+       test_grep "No branch name specified" err
 '
 
 test_expect_success 'stash show format defaults to --stat' '
@@ -931,6 +931,10 @@ test_expect_success 'store called with invalid commit' '
        test_must_fail git stash store foo
 '
 
+test_expect_success 'store called with non-stash commit' '
+       test_must_fail git stash store HEAD
+'
+
 test_expect_success 'store updates stash ref and reflog' '
        git stash clear &&
        git reset --hard &&
@@ -1512,4 +1516,56 @@ test_expect_success 'restore untracked files even when we hit conflicts' '
        )
 '
 
+test_expect_success 'stash create reports a locked index' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A A.file &&
+               echo change >A.file &&
+               touch .git/index.lock &&
+
+               cat >expect <<-EOF &&
+               error: could not write index
+               EOF
+               test_must_fail git stash create 2>err &&
+               test_cmp expect err
+       )
+'
+
+test_expect_success 'stash push reports a locked index' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A A.file &&
+               echo change >A.file &&
+               touch .git/index.lock &&
+
+               cat >expect <<-EOF &&
+               error: could not write index
+               EOF
+               test_must_fail git stash push 2>err &&
+               test_cmp expect err
+       )
+'
+
+test_expect_success 'stash apply reports a locked index' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A A.file &&
+               echo change >A.file &&
+               git stash push &&
+               touch .git/index.lock &&
+
+               cat >expect <<-EOF &&
+               error: could not write index
+               EOF
+               test_must_fail git stash apply 2>err &&
+               test_cmp expect err
+       )
+'
+
 test_done
index accfe3845c418ee90d8c9b1ec3100fa3e964d8d4..368fc2a6cc16755e4e2c6e9a7fba0e88bba5a033 100755 (executable)
@@ -3,12 +3,6 @@
 test_description='stash -p'
 . ./lib-patch-mode.sh
 
-if ! test_have_prereq PERL
-then
-       skip_all='skipping stash -p tests, perl not available'
-       test_done
-fi
-
 test_expect_success 'setup' '
        mkdir dir &&
        echo parent > dir/foo &&
index 5390eec4e3b57eefca8971d86fa08b8f09c93747..1289ae3e07c635d30930067022969247b2b63f1f 100755 (executable)
@@ -404,7 +404,7 @@ test_expect_success 'stash show --include-untracked errors on duplicate files' '
        ) &&
        w_commit=$(git commit-tree -p HEAD -p "$i_commit" -p "$u_commit" -m "WIP on any-branch" "$tree") &&
        test_must_fail git stash show --include-untracked "$w_commit" 2>err &&
-       test_i18ngrep "worktree and untracked commit have duplicate entries: tracked" err
+       test_grep "worktree and untracked commit have duplicate entries: tracked" err
 '
 
 test_expect_success 'stash show --{include,only}-untracked on stashes without untracked entries' '
index dead9f18d937599427afe2c29fc177ed00f187ec..73f2dbdeb022ee71d04e9961da959f60d6eabd5c 100755 (executable)
@@ -88,13 +88,13 @@ test_expect_success 'error conditions' '
        echo fileA.t >list &&
 
        test_must_fail git stash push --pathspec-from-file=list --patch 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git stash push --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
+       test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git stash push --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
+       test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
 '
 
 test_done
index 67fd2345affd78507a6cb714b48565ed190cb5af..50ae222f08424e4b4ed22a82c066526a3da3659c 100755 (executable)
@@ -10,7 +10,7 @@ LIB_CRLF_BRANCHES=""
 create_crlf_ref () {
        branch="$1" &&
        cat >.crlf-orig-$branch.txt &&
-       cat .crlf-orig-$branch.txt | append_cr >.crlf-message-$branch.txt &&
+       append_cr <.crlf-orig-$branch.txt >.crlf-message-$branch.txt &&
        grep 'Subject' .crlf-orig-$branch.txt | tr '\n' ' ' | sed 's/[ ]*$//' | tr -d '\n' >.crlf-subject-$branch.txt &&
        grep 'Body' .crlf-orig-$branch.txt | append_cr >.crlf-body-$branch.txt &&
        LIB_CRLF_BRANCHES="${LIB_CRLF_BRANCHES} ${branch}" &&
@@ -97,7 +97,7 @@ test_expect_success 'branch: --verbose works with messages using CRLF' '
        git branch -v >tmp &&
        # Remove first two columns, and the line for the currently checked out branch
        current=$(git branch --show-current) &&
-       grep -v $current <tmp | awk "{\$1=\$2=\"\"}1"  >actual &&
+       awk "/$current/ { next } { \$1 = \$2 = \"\" } 1" <tmp >actual &&
        test_cmp expect actual
 '
 
index 3dc90470446dbb81e9c9421dbc7c21d3648d91f4..49c042a38ae987fa95f201bd3a00f55e4adeffab 100755 (executable)
@@ -135,25 +135,25 @@ test_expect_success 'favour same basenames over different ones' '
        mkdir subdir &&
        git mv another-path subdir/path1 &&
        git status >out &&
-       test_i18ngrep "renamed: .*path1 -> subdir/path1" out
+       test_grep "renamed: .*path1 -> subdir/path1" out
 '
 
 test_expect_success 'test diff.renames=true for git status' '
        git -c diff.renames=true status >out &&
-       test_i18ngrep "renamed: .*path1 -> subdir/path1" out
+       test_grep "renamed: .*path1 -> subdir/path1" out
 '
 
 test_expect_success 'test diff.renames=false for git status' '
        git -c diff.renames=false status >out &&
-       test_i18ngrep ! "renamed: .*path1 -> subdir/path1" out &&
-       test_i18ngrep "new file: .*subdir/path1" out &&
-       test_i18ngrep "deleted: .*[^/]path1" out
+       test_grep ! "renamed: .*path1 -> subdir/path1" out &&
+       test_grep "new file: .*subdir/path1" out &&
+       test_grep "deleted: .*[^/]path1" out
 '
 
 test_expect_success 'favour same basenames even with minor differences' '
        git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
        git status >out &&
-       test_i18ngrep "renamed: .*path1 -> subdir/path1" out
+       test_grep "renamed: .*path1 -> subdir/path1" out
 '
 
 test_expect_success 'two files with same basename and same content' '
@@ -165,7 +165,7 @@ test_expect_success 'two files with same basename and same content' '
        git commit -m 2 &&
        git mv dir other-dir &&
        git status >out &&
-       test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file" out
+       test_grep "renamed: .*dir/A/file -> other-dir/A/file" out
 '
 
 test_expect_success 'setup for many rename source candidates' '
@@ -202,9 +202,9 @@ test_expect_success 'rename pretty print with nothing in common' '
        git mv a/b/c c/b/a &&
        git commit -m "a/b/c -> c/b/a" &&
        git diff -M --summary HEAD^ HEAD >output &&
-       test_i18ngrep " a/b/c => c/b/a " output &&
+       test_grep " a/b/c => c/b/a " output &&
        git diff -M --stat HEAD^ HEAD >output &&
-       test_i18ngrep " a/b/c => c/b/a " output
+       test_grep " a/b/c => c/b/a " output
 '
 
 test_expect_success 'rename pretty print with common prefix' '
@@ -212,9 +212,9 @@ test_expect_success 'rename pretty print with common prefix' '
        git mv c/b/a c/d/e &&
        git commit -m "c/b/a -> c/d/e" &&
        git diff -M --summary HEAD^ HEAD >output &&
-       test_i18ngrep " c/{b/a => d/e} " output &&
+       test_grep " c/{b/a => d/e} " output &&
        git diff -M --stat HEAD^ HEAD >output &&
-       test_i18ngrep " c/{b/a => d/e} " output
+       test_grep " c/{b/a => d/e} " output
 '
 
 test_expect_success 'rename pretty print with common suffix' '
@@ -222,9 +222,9 @@ test_expect_success 'rename pretty print with common suffix' '
        git mv c/d/e d/e &&
        git commit -m "c/d/e -> d/e" &&
        git diff -M --summary HEAD^ HEAD >output &&
-       test_i18ngrep " {c/d => d}/e " output &&
+       test_grep " {c/d => d}/e " output &&
        git diff -M --stat HEAD^ HEAD >output &&
-       test_i18ngrep " {c/d => d}/e " output
+       test_grep " {c/d => d}/e " output
 '
 
 test_expect_success 'rename pretty print with common prefix and suffix' '
@@ -232,9 +232,9 @@ test_expect_success 'rename pretty print with common prefix and suffix' '
        git mv d/e d/f/e &&
        git commit -m "d/e -> d/f/e" &&
        git diff -M --summary HEAD^ HEAD >output &&
-       test_i18ngrep " d/{ => f}/e " output &&
+       test_grep " d/{ => f}/e " output &&
        git diff -M --stat HEAD^ HEAD >output &&
-       test_i18ngrep " d/{ => f}/e " output
+       test_grep " d/{ => f}/e " output
 '
 
 test_expect_success 'rename pretty print common prefix and suffix overlap' '
@@ -242,9 +242,9 @@ test_expect_success 'rename pretty print common prefix and suffix overlap' '
        git mv d/f/e d/f/f/e &&
        git commit -m "d/f/e d/f/f/e" &&
        git diff -M --summary HEAD^ HEAD >output &&
-       test_i18ngrep " d/f/{ => f}/e " output &&
+       test_grep " d/f/{ => f}/e " output &&
        git diff -M --stat HEAD^ HEAD >output &&
-       test_i18ngrep " d/f/{ => f}/e " output
+       test_grep " d/f/{ => f}/e " output
 '
 
 test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
@@ -286,4 +286,28 @@ test_expect_success 'basename similarity vs best similarity' '
        test_cmp expected actual
 '
 
+test_expect_success 'last line matters too' '
+       {
+               test_write_lines a 0 1 2 3 4 5 6 7 8 9 &&
+               printf "git ignores final up to 63 characters if not newline terminated"
+       } >no-final-lf &&
+       git add no-final-lf &&
+       git commit -m "original version of file with no final newline" &&
+
+       # Change ONLY the first character of the whole file
+       {
+               test_write_lines b 0 1 2 3 4 5 6 7 8 9 &&
+               printf "git ignores final up to 63 characters if not newline terminated"
+       } >no-final-lf &&
+       git add no-final-lf &&
+       git mv no-final-lf still-absent-final-lf &&
+       git commit -a -m "rename no-final-lf -> still-absent-final-lf" &&
+       git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+       sed -e "s/^R[0-9]*      /R      /" actual >actual.munged &&
+       cat >expected <<-\EOF &&
+       R       no-final-lf     still-absent-final-lf
+       EOF
+       test_cmp expected actual.munged
+'
+
 test_done
index 7afc883ec374e1c4b747ed80ba64575d05017502..cb3307010c1ed97f1b7bdb91b366f3e6d17a2ac9 100755 (executable)
@@ -405,7 +405,7 @@ test_expect_success 'diff-tree -r B A == diff-tree -r -R A B' '
 
 test_expect_success 'diff can read from stdin' '
        test_must_fail git diff --no-index -- MN - < NN |
-               grep -v "^index" | sed "s#/-#/NN#" >.test-a &&
+               sed "/^index/d; s#/-#/NN#" >.test-a &&
        test_must_fail git diff --no-index -- MN NN |
                grep -v "^index" >.test-b &&
        test_cmp .test-a .test-b
index 5de1d190759f958f8c3c0319f7b4cca34f39d83c..1e3b2dbea48488ecb3a68a8dba82d57b6fbca2a7 100755 (executable)
@@ -178,32 +178,29 @@ process_diffs () {
 V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
 while read magic cmd
 do
-       status=success
        case "$magic" in
        '' | '#'*)
                continue ;;
-       :*)
-               magic=${magic#:}
+       :noellipses)
+               magic=noellipses
                label="$magic-$cmd"
-               case "$magic" in
-               noellipses) ;;
-               failure)
-                       status=failure
-                       magic=
-                       label="$cmd" ;;
-               *)
-                       BUG "unknown magic $magic" ;;
-               esac ;;
+               ;;
+       :*)
+               BUG "unknown magic $magic"
+               ;;
        *)
-               cmd="$magic $cmd" magic=
-               label="$cmd" ;;
+               cmd="$magic $cmd"
+               magic=
+               label="$cmd"
+               ;;
        esac
+
        test=$(echo "$label" | sed -e 's|[/ ][/ ]*|_|g')
        pfx=$(printf "%04d" $test_count)
        expect="$TEST_DIRECTORY/t4013/diff.$test"
        actual="$pfx-diff.$test"
 
-       test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
+       test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
                {
                        echo "$ git $cmd"
                        case "$magic" in
@@ -473,6 +470,14 @@ test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '
        test_cmp expected actual
 '
 
+test_expect_success 'log --dd matches --diff-merges=1 -p' '
+       git log --diff-merges=1 -p master >result &&
+       process_diffs result >expected &&
+       git log --dd master >result &&
+       process_diffs result >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success 'deny wrong log.diffMerges config' '
        test_config log.diffMerges wrong-value &&
        test_expect_code 128 git log
@@ -514,7 +519,7 @@ test_expect_success 'log -S requires an argument' '
 '
 
 test_expect_success 'diff --cached on unborn branch' '
-       echo ref: refs/heads/unborn >.git/HEAD &&
+       git symbolic-ref HEAD refs/heads/unborn &&
        git diff --cached >result &&
        process_diffs result >actual &&
        process_diffs "$TEST_DIRECTORY/t4013/diff.diff_--cached" >expected &&
@@ -613,7 +618,7 @@ test_expect_success 'diff -I<regex> --stat' '
 
 test_expect_success 'diff -I<regex>: detect malformed regex' '
        test_expect_code 129 git diff --ignore-matching-lines="^[124-9" 2>error &&
-       test_i18ngrep "invalid regex given to -I: " error
+       test_grep "invalid regex given to -I: " error
 '
 
 # check_prefix <patch> <src> <dst>
@@ -658,4 +663,10 @@ test_expect_success 'diff --default-prefix overrides diff.mnemonicprefix' '
        check_prefix actual a/file0 b/file0
 '
 
+test_expect_success 'diff --no-renames cannot be abbreviated' '
+       test_expect_code 129 git diff --no-rename >actual 2>error &&
+       test_must_be_empty actual &&
+       grep "invalid option: --no-rename" error
+'
+
 test_done
index 3cf2b7a7fb70ec272d9f12294a26e2a1685c5999..e37a1411ee247cc76083367870e0e0c2e16fbb84 100755 (executable)
@@ -1373,7 +1373,27 @@ test_expect_success '--rfc' '
        Subject: [RFC PATCH 1/1] header with . in it
        EOF
        git format-patch -n -1 --stdout --rfc >patch &&
-       grep ^Subject: patch >actual &&
+       grep "^Subject:" patch >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--rfc does not overwrite prefix' '
+       cat >expect <<-\EOF &&
+       Subject: [RFC PATCH foobar 1/1] header with . in it
+       EOF
+       git -c format.subjectPrefix="PATCH foobar" \
+               format-patch -n -1 --stdout --rfc >patch &&
+       grep "^Subject:" patch >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--rfc is argument order independent' '
+       cat >expect <<-\EOF &&
+       Subject: [RFC PATCH foobar 1/1] header with . in it
+       EOF
+       git format-patch -n -1 --stdout --rfc \
+               --subject-prefix="PATCH foobar" >patch &&
+       grep "^Subject:" patch >actual &&
        test_cmp expect actual
 '
 
@@ -1886,6 +1906,16 @@ body" &&
        grep "^body$" actual
 '
 
+test_expect_success 'cover letter with --cover-from-description subject (UTF-8 subject line)' '
+       test_config branch.rebuild-1.description "Café?
+
+body" &&
+       git checkout rebuild-1 &&
+       git format-patch --stdout --cover-letter --cover-from-description subject --encode-email-headers main >actual &&
+       grep "^Subject: \[PATCH 0/2\] =?UTF-8?q?Caf=C3=A9=3F?=$" actual &&
+       ! grep "Café" actual
+'
+
 test_expect_success 'cover letter with format.coverFromDescription = auto (short subject line)' '
        test_config branch.rebuild-1.description "config subject
 
@@ -1991,6 +2021,20 @@ test_expect_success 'cover letter using branch description (6)' '
        grep hello actual
 '
 
+test_expect_success 'cover letter with --description-file' '
+       test_when_finished "rm -f description.txt" &&
+       cat >description.txt <<-\EOF &&
+       subject from file
+
+       body from file
+       EOF
+       git checkout rebuild-1 &&
+       git format-patch --stdout --cover-letter --cover-from-description auto \
+               --description-file description.txt main >actual &&
+       grep "^Subject: \[PATCH 0/2\] subject from file$" actual &&
+       grep "^body from file$" actual
+'
+
 test_expect_success 'cover letter with nothing' '
        git format-patch --stdout --cover-letter >actual &&
        test_line_count = 0 actual
@@ -2369,25 +2413,25 @@ test_expect_success 'interdiff: cover-letter' '
        --q
        EOF
        git format-patch --cover-letter --interdiff=boop~2 -1 boop &&
-       test_i18ngrep "^Interdiff:$" 0000-cover-letter.patch &&
-       test_i18ngrep ! "^Interdiff:$" 0001-fleep.patch &&
+       test_grep "^Interdiff:$" 0000-cover-letter.patch &&
+       test_grep ! "^Interdiff:$" 0001-fleep.patch &&
        sed "1,/^@@ /d; /^-- $/q" 0000-cover-letter.patch >actual &&
        test_cmp expect actual
 '
 
 test_expect_success 'interdiff: reroll-count' '
        git format-patch --cover-letter --interdiff=boop~2 -v2 -1 boop &&
-       test_i18ngrep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch
+       test_grep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch
 '
 
 test_expect_success 'interdiff: reroll-count with a non-integer' '
        git format-patch --cover-letter --interdiff=boop~2 -v2.2 -1 boop &&
-       test_i18ngrep "^Interdiff:$" v2.2-0000-cover-letter.patch
+       test_grep "^Interdiff:$" v2.2-0000-cover-letter.patch
 '
 
 test_expect_success 'interdiff: reroll-count with a integer' '
        git format-patch --cover-letter --interdiff=boop~2 -v2 -1 boop &&
-       test_i18ngrep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch
+       test_grep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch
 '
 
 test_expect_success 'interdiff: solo-patch' '
@@ -2396,7 +2440,7 @@ test_expect_success 'interdiff: solo-patch' '
 
        EOF
        git format-patch --interdiff=boop~2 -1 boop &&
-       test_i18ngrep "^Interdiff:$" 0001-fleep.patch &&
+       test_grep "^Interdiff:$" 0001-fleep.patch &&
        sed "1,/^  @@ /d; /^$/q" 0001-fleep.patch >actual &&
        test_cmp expect actual
 '
index b298f220e01fe6de17a5dfe608550a5a57dcf9c6..b443626afd7271a6e58ccfc45429759b9b8c00ca 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # Copyright (c) 2006 Johannes E. Schindelin
-#
+# Copyright (c) 2023 Google LLC
 
 test_description='Test special whitespace in diff engine.
 
@@ -11,6 +11,43 @@ TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-diff.sh
 
+for opt_res in --patch --quiet -s --stat --shortstat --dirstat=lines \
+              --raw! --name-only! --name-status!
+do
+       opts=${opt_res%!} expect_failure=
+       test "$opts" = "$opt_res" ||
+               expect_failure="test_expect_code 1"
+
+       test_expect_success "status with $opts (different)" '
+               echo foo >x &&
+               git add x &&
+               echo bar >x &&
+               test_expect_code 1 git diff -w $opts --exit-code x
+       '
+
+       test_expect_success POSIXPERM "status with $opts (mode differs)" '
+               test_when_finished "git update-index --chmod=-x x" &&
+               echo foo >x &&
+               git add x &&
+               git update-index --chmod=+x x &&
+               test_expect_code 1 git diff -w $opts --exit-code x
+       '
+
+       test_expect_success "status with $opts (removing an empty file)" '
+               : >x &&
+               git add x &&
+               rm x &&
+               test_expect_code 1 git diff -w $opts --exit-code -- x
+       '
+
+       test_expect_success "status with $opts (different but equivalent)" '
+               echo foo >x &&
+               git add x &&
+               echo " foo" >x &&
+               $expect_failure git diff -w $opts --exit-code x
+       '
+done
+
 test_expect_success "Ray Lehtiniemi's example" '
        cat <<-\EOF >x &&
        do {
@@ -909,7 +946,7 @@ test_expect_success 'combined diff with autocrlf conversion' '
        git commit -m "the other side" x &&
        git config core.autocrlf true &&
        test_must_fail git merge one-side >actual &&
-       test_i18ngrep "Automatic merge failed" actual &&
+       test_grep "Automatic merge failed" actual &&
 
        git diff >actual.raw &&
        sed -e "1,/^@@@/d" actual.raw >actual &&
@@ -2187,27 +2224,27 @@ test_expect_success 'compare whitespace delta across moved blocks' '
 
 test_expect_success 'bogus settings in move detection erroring out' '
        test_must_fail git diff --color-moved=bogus 2>err &&
-       test_i18ngrep "must be one of" err &&
-       test_i18ngrep bogus err &&
+       test_grep "must be one of" err &&
+       test_grep bogus err &&
 
        test_must_fail git -c diff.colormoved=bogus diff 2>err &&
-       test_i18ngrep "must be one of" err &&
-       test_i18ngrep "from command-line config" err &&
+       test_grep "must be one of" err &&
+       test_grep "from command-line config" err &&
 
        test_must_fail git diff --color-moved-ws=bogus 2>err &&
-       test_i18ngrep "possible values" err &&
-       test_i18ngrep bogus err &&
+       test_grep "possible values" err &&
+       test_grep bogus err &&
 
        test_must_fail git -c diff.colormovedws=bogus diff 2>err &&
-       test_i18ngrep "possible values" err &&
-       test_i18ngrep "from command-line config" err
+       test_grep "possible values" err &&
+       test_grep "from command-line config" err
 '
 
 test_expect_success 'compare whitespace delta incompatible with other space options' '
        test_must_fail git diff \
                --color-moved-ws=allow-indentation-change,ignore-all-space \
                2>err &&
-       test_i18ngrep allow-indentation-change err
+       test_grep allow-indentation-change err
 '
 
 EMPTY=''
index 5bc28ad9f042a0476d94d9e90e5b58073cc17f99..f439f469bd2bfd3942a61e104fd290d8e3461e19 100755 (executable)
@@ -138,4 +138,9 @@ test_expect_success 'check honors conflict marker length' '
        git reset --hard
 '
 
+test_expect_success 'option errors are not confused by --exit-code' '
+       test_must_fail git diff --exit-code --nonsense 2>err &&
+       grep '^usage:' err
+'
+
 test_done
index c8d555771d5072f95185f48898b59a7e88ddcd26..e026fac1f4090330f81b5b417e1b9e930795fd96 100755 (executable)
@@ -53,15 +53,15 @@ do
                echo "*.java diff=$p" >.gitattributes &&
                test_expect_code 1 git diff --no-index \
                        A.java B.java 2>msg &&
-               test_i18ngrep ! fatal msg &&
-               test_i18ngrep ! error msg
+               test_grep ! fatal msg &&
+               test_grep ! error msg
        '
        test_expect_success "builtin $p wordRegex pattern compiles" '
                echo "*.java diff=$p" >.gitattributes &&
                test_expect_code 1 git diff --no-index --word-diff \
                        A.java B.java 2>msg &&
-               test_i18ngrep ! fatal msg &&
-               test_i18ngrep ! error msg
+               test_grep ! fatal msg &&
+               test_grep ! error msg
        '
 
        test_expect_success "builtin $p pattern compiles on bare repo with --attr-source" '
@@ -79,8 +79,8 @@ do
                git -C bare.git symbolic-ref HEAD refs/heads/master &&
                test_expect_code 1 git -C bare.git --attr-source=branchA \
                        diff --exit-code HEAD:A.java HEAD:B.java 2>msg &&
-               test_i18ngrep ! fatal msg &&
-               test_i18ngrep ! error msg
+               test_grep ! fatal msg &&
+               test_grep ! error msg
        '
 done
 
@@ -88,7 +88,7 @@ test_expect_success 'last regexp must not be negated' '
        echo "*.java diff=java" >.gitattributes &&
        test_config diff.java.funcname "!static" &&
        test_expect_code 128 git diff --no-index A.java B.java 2>msg &&
-       test_i18ngrep ": Last expression must not be negated:" msg
+       test_grep ": Last expression must not be negated:" msg
 '
 
 test_expect_success 'setup hunk header tests' '
index c1ac09ecc7140a3dcfcdf906bb4533ba131881de..fdd865f7c38dea5b60910b46c2a113ec7f5c2a09 100755 (executable)
@@ -232,7 +232,7 @@ keep_only_cr () {
 test_expect_success 'external diff with autocrlf = true' '
        test_config core.autocrlf true &&
        GIT_EXTERNAL_DIFF=./fake-diff.sh git diff &&
-       test $(wc -l < crlfed.txt) = $(cat crlfed.txt | keep_only_cr | wc -c)
+       test $(wc -l <crlfed.txt) = $(keep_only_cr <crlfed.txt | wc -c)
 '
 
 test_expect_success 'diff --cached' '
index eacc6694f785acb2e6287dd4c5bce9a5e834a361..c4394a27b56236aeda3c92df03aa19f9d8720190 100755 (executable)
@@ -53,7 +53,7 @@ test_expect_success 'rewrite diff --numstat shows binary changes' '
 test_expect_success 'diff --stat counts binary rewrite as 0 lines' '
        git diff -B --stat --summary >diff &&
        grep "Bin" diff &&
-       test_i18ngrep "0 insertions.*0 deletions" diff &&
+       test_grep "0 insertions.*0 deletions" diff &&
        grep " rewrite file" diff
 '
 
index e70e020ae9349c378b4b922933668932e95acc8d..eec3d73dc2b475be7185d9d1dc8733bf391a868b 100755 (executable)
@@ -28,8 +28,7 @@ test_expect_success 'diff-tree --exit-code' '
 
 test_expect_success 'diff-tree -b --exit-code' '
        git diff -b --exit-code HEAD^ HEAD &&
-       git diff-tree -b -p --exit-code HEAD^ HEAD &&
-       git diff-tree -b --exit-code HEAD^ HEAD
+       git diff-tree -b -p --exit-code HEAD^ HEAD
 '
 
 test_expect_success 'diff-index --cached --exit-code' '
index bf33aedf4b22868fd820330a460965d27e66cb91..8ebfa3c1be2fec46558c739fd3ccda37a952c225 100755 (executable)
@@ -118,4 +118,26 @@ test_expect_success 'log notes cache and still use cache for -p' '
        git log --no-walk -p refs/notes/textconv/magic HEAD
 '
 
+test_expect_success 'caching is silently ignored outside repo' '
+       mkdir -p non-repo &&
+       echo one >non-repo/one &&
+       echo two >non-repo/two &&
+       echo "* diff=test" >attr &&
+       test_expect_code 1 \
+       nongit git -c core.attributesFile="$PWD/attr" \
+                  -c diff.test.textconv="tr a-z A-Z <" \
+                  -c diff.test.cachetextconv=true \
+                  diff --no-index one two >actual &&
+       cat >expect <<-\EOF &&
+       diff --git a/one b/two
+       index 5626abf..f719efd 100644
+       --- a/one
+       +++ b/two
+       @@ -1 +1 @@
+       -ONE
+       +TWO
+       EOF
+       test_cmp expect actual
+'
+
 test_done
index 70224c3da1494262eb4b2a46c58e001d74f37a9e..7b73462d53d2c12def254e80a9d7c90e19f68794 100755 (executable)
@@ -943,37 +943,37 @@ test_expect_success '--dirstat=future_param,lines,0 should fail loudly' '
        test_must_fail git diff --dirstat=future_param,lines,0 HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
        test_debug "cat actual_error" &&
        test_must_be_empty actual_diff_dirstat &&
-       test_i18ngrep -q "future_param" actual_error &&
-       test_i18ngrep -q "\--dirstat" actual_error
+       test_grep -q "future_param" actual_error &&
+       test_grep -q "\--dirstat" actual_error
 '
 
 test_expect_success '--dirstat=dummy1,cumulative,2dummy should report both unrecognized parameters' '
        test_must_fail git diff --dirstat=dummy1,cumulative,2dummy HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
        test_debug "cat actual_error" &&
        test_must_be_empty actual_diff_dirstat &&
-       test_i18ngrep -q "dummy1" actual_error &&
-       test_i18ngrep -q "2dummy" actual_error &&
-       test_i18ngrep -q "\--dirstat" actual_error
+       test_grep -q "dummy1" actual_error &&
+       test_grep -q "2dummy" actual_error &&
+       test_grep -q "\--dirstat" actual_error
 '
 
 test_expect_success 'diff.dirstat=future_param,0,lines should warn, but still work' '
        git -c diff.dirstat=future_param,0,lines diff --dirstat HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
        test_debug "cat actual_error" &&
        test_cmp expect_diff_dirstat actual_diff_dirstat &&
-       test_i18ngrep -q "future_param" actual_error &&
-       test_i18ngrep -q "diff\\.dirstat" actual_error &&
+       test_grep -q "future_param" actual_error &&
+       test_grep -q "diff\\.dirstat" actual_error &&
 
        git -c diff.dirstat=future_param,0,lines diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M 2>actual_error &&
        test_debug "cat actual_error" &&
        test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
-       test_i18ngrep -q "future_param" actual_error &&
-       test_i18ngrep -q "diff\\.dirstat" actual_error &&
+       test_grep -q "future_param" actual_error &&
+       test_grep -q "diff\\.dirstat" actual_error &&
 
        git -c diff.dirstat=future_param,0,lines diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC 2>actual_error &&
        test_debug "cat actual_error" &&
        test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC &&
-       test_i18ngrep -q "future_param" actual_error &&
-       test_i18ngrep -q "diff\\.dirstat" actual_error
+       test_grep -q "future_param" actual_error &&
+       test_grep -q "diff\\.dirstat" actual_error
 '
 
 test_expect_success '--shortstat --dirstat should output only one dirstat' '
index 3ee27e277dca1cd95484ec9ef3b1251e38b22dde..7badd72488d664ff776e1004f620df1fbc774cdc 100755 (executable)
@@ -12,7 +12,7 @@ TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
-# 120 character name
+# 120-character name
 name=aaaaaaaaaa
 name=$name$name$name$name$name$name$name$name$name$name$name$name
 test_expect_success 'preparation' '
@@ -49,12 +49,41 @@ log -1 --stat
 EOF
 
 cat >expect.60 <<-'EOF'
- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
 EOF
 cat >expect.6030 <<-'EOF'
  ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
 EOF
-cat >expect2.60 <<-'EOF'
+while read verb expect cmd args
+do
+       # No width limit applied when statNameWidth is ignored
+       case "$expect" in expect72|expect.6030)
+               test_expect_success "$cmd $verb diff.statNameWidth with long name" '
+                       git -c diff.statNameWidth=30 $cmd $args >output &&
+                       grep " | " output >actual &&
+                       test_cmp $expect actual
+               ';;
+       esac
+       # Maximum width limit still applied when statNameWidth is ignored
+       case "$expect" in expect.60|expect.6030)
+               test_expect_success "$cmd --stat=width $verb diff.statNameWidth with long name" '
+                       git -c diff.statNameWidth=30 $cmd $args --stat=60 >output &&
+                       grep " | " output >actual &&
+                       test_cmp $expect actual
+               ';;
+       esac
+done <<\EOF
+ignores expect72 format-patch -1 --stdout
+ignores expect.60 format-patch -1 --stdout
+respects expect.6030 diff HEAD^ HEAD --stat
+respects expect.6030 show --stat
+respects expect.6030 log -1 --stat
+EOF
+
+cat >expect.40 <<-'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+EOF
+cat >expect2.40 <<-'EOF'
  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
 EOF
@@ -67,22 +96,22 @@ do
        test_expect_success "$cmd --stat=width: a long name is given more room when the bar is short" '
                git $cmd $args --stat=40 >output &&
                grep " | " output >actual &&
-               test_cmp $expect.60 actual
+               test_cmp $expect.40 actual
        '
 
        test_expect_success "$cmd --stat-width=width with long name" '
                git $cmd $args --stat-width=40 >output &&
                grep " | " output >actual &&
-               test_cmp $expect.60 actual
+               test_cmp $expect.40 actual
        '
 
-       test_expect_success "$cmd --stat=...,name-width with long name" '
+       test_expect_success "$cmd --stat=width,name-width with long name" '
                git $cmd $args --stat=60,30 >output &&
                grep " | " output >actual &&
                test_cmp $expect.6030 actual
        '
 
-       test_expect_success "$cmd --stat-name-width with long name" '
+       test_expect_success "$cmd --stat-name-width=width with long name" '
                git $cmd $args --stat-name-width=30 >output &&
                grep " | " output >actual &&
                test_cmp $expect.6030 actual
@@ -94,8 +123,7 @@ expect show --stat
 expect log -1 --stat
 EOF
 
-
-test_expect_success 'preparation for big change tests' '
+test_expect_success 'preparation for big-change tests' '
        >abcd &&
        git add abcd &&
        git commit -m message &&
@@ -111,7 +139,7 @@ cat >expect72 <<'EOF'
  abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 EOF
-test_expect_success "format-patch --cover-letter ignores COLUMNS (big change)" '
+test_expect_success "format-patch --cover-letter ignores COLUMNS with big change" '
        COLUMNS=200 git format-patch -1 --stdout --cover-letter >output &&
        grep " | " output >actual &&
        test_cmp expect72 actual
@@ -131,7 +159,7 @@ cat >expect200-graph <<'EOF'
 EOF
 while read verb expect cmd args
 do
-       test_expect_success "$cmd $verb COLUMNS (big change)" '
+       test_expect_success "$cmd $verb COLUMNS with big change" '
                COLUMNS=200 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
@@ -139,7 +167,7 @@ do
 
        case "$cmd" in diff|show) continue;; esac
 
-       test_expect_success "$cmd --graph $verb COLUMNS (big change)" '
+       test_expect_success "$cmd --graph $verb COLUMNS with big change" '
                COLUMNS=200 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
@@ -159,7 +187,7 @@ cat >expect40-graph <<'EOF'
 EOF
 while read verb expect cmd args
 do
-       test_expect_success "$cmd $verb not enough COLUMNS (big change)" '
+       test_expect_success "$cmd $verb not enough COLUMNS with big change" '
                COLUMNS=40 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
@@ -167,7 +195,7 @@ do
 
        case "$cmd" in diff|show) continue;; esac
 
-       test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" '
+       test_expect_success "$cmd --graph $verb not enough COLUMNS with big change" '
                COLUMNS=40 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
@@ -187,7 +215,7 @@ cat >expect40-graph <<'EOF'
 EOF
 while read verb expect cmd args
 do
-       test_expect_success "$cmd $verb statGraphWidth config" '
+       test_expect_success "$cmd $verb diff.statGraphWidth" '
                git -c diff.statGraphWidth=26 $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
@@ -195,7 +223,7 @@ do
 
        case "$cmd" in diff|show) continue;; esac
 
-       test_expect_success "$cmd --graph $verb statGraphWidth config" '
+       test_expect_success "$cmd --graph $verb diff.statGraphWidth" '
                git -c diff.statGraphWidth=26 $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
@@ -207,7 +235,6 @@ respects expect40 show --stat
 respects expect40 log -1 --stat
 EOF
 
-
 cat >expect <<'EOF'
  abcd | 1000 ++++++++++++++++++++++++++
 EOF
@@ -228,7 +255,7 @@ do
                test_cmp expect actual
        '
 
-       test_expect_success "$cmd --stat-graph-width with big change" '
+       test_expect_success "$cmd --stat-graph-width=width with big change" '
                git $cmd $args --stat-graph-width=26 >output &&
                grep " | " output >actual &&
                test_cmp expect actual
@@ -242,7 +269,7 @@ do
                test_cmp expect-graph actual
        '
 
-       test_expect_success "$cmd --stat-graph-width --graph with big change" '
+       test_expect_success "$cmd --stat-graph-width=width --graph with big change" '
                git $cmd $args --stat-graph-width=26 --graph >output &&
                grep " | " output >actual &&
                test_cmp expect-graph actual
@@ -254,7 +281,7 @@ show --stat
 log -1 --stat
 EOF
 
-test_expect_success 'preparation for long filename tests' '
+test_expect_success 'preparation for long-name tests' '
        cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
        git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
        git commit -m message
@@ -302,7 +329,7 @@ cat >expect200-graph <<'EOF'
 EOF
 while read verb expect cmd args
 do
-       test_expect_success "$cmd $verb COLUMNS (long filename)" '
+       test_expect_success "$cmd $verb COLUMNS with long name" '
                COLUMNS=200 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
@@ -310,7 +337,7 @@ do
 
        case "$cmd" in diff|show) continue;; esac
 
-       test_expect_success "$cmd --graph $verb COLUMNS (long filename)" '
+       test_expect_success "$cmd --graph $verb COLUMNS with long name" '
                COLUMNS=200 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
@@ -331,7 +358,7 @@ EOF
 while read verb expect cmd args
 do
        test_expect_success COLUMNS_CAN_BE_1 \
-               "$cmd $verb prefix greater than COLUMNS (big change)" '
+               "$cmd $verb prefix greater than COLUMNS with big change" '
                COLUMNS=1 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
@@ -340,7 +367,7 @@ do
        case "$cmd" in diff|show) continue;; esac
 
        test_expect_success COLUMNS_CAN_BE_1 \
-               "$cmd --graph $verb prefix greater than COLUMNS (big change)" '
+               "$cmd --graph $verb prefix greater than COLUMNS with big change" '
                COLUMNS=1 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
@@ -355,8 +382,14 @@ EOF
 cat >expect <<'EOF'
  abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 EOF
-test_expect_success 'merge --stat respects COLUMNS (big change)' '
-       git checkout -b branch HEAD^^ &&
+test_expect_success 'merge --stat respects diff.statGraphWidth with big change' '
+       git checkout -b branch1 HEAD^^ &&
+       git -c diff.statGraphWidth=26 merge --stat --no-ff main^ >output &&
+       grep " | " output >actual &&
+       test_cmp expect40 actual
+'
+test_expect_success 'merge --stat respects COLUMNS with big change' '
+       git checkout -b branch2 HEAD^^ &&
        COLUMNS=100 git merge --stat --no-ff main^ >output &&
        grep " | " output >actual &&
        test_cmp expect actual
@@ -365,7 +398,17 @@ test_expect_success 'merge --stat respects COLUMNS (big change)' '
 cat >expect <<'EOF'
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++
 EOF
-test_expect_success 'merge --stat respects COLUMNS (long filename)' '
+cat >expect.30 <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+test_expect_success 'merge --stat respects diff.statNameWidth with long name' '
+       git switch branch1 &&
+       git -c diff.statNameWidth=30 merge --stat --no-ff main >output &&
+       grep " | " output >actual &&
+       test_cmp expect.30 actual
+'
+test_expect_success 'merge --stat respects COLUMNS with long name' '
+       git switch branch2 &&
        COLUMNS=100 git merge --stat --no-ff main >output &&
        grep " | " output >actual &&
        test_cmp expect actual
index 6781cc90786e3eb247b83f107a5407d50ba139f3..651ec776606bb0990edc40bebf13ccc4937bb0ce 100755 (executable)
@@ -56,7 +56,7 @@ test_expect_success 'git diff --no-index executed outside repo gives correct err
                export GIT_CEILING_DIRECTORIES &&
                cd non/git &&
                test_must_fail git diff --no-index a 2>actual.err &&
-               test_i18ngrep "usage: git diff --no-index" actual.err
+               test_grep "usage: git diff --no-index" actual.err
        )
 '
 
@@ -205,6 +205,18 @@ test_expect_success POSIXPERM,SYMLINKS 'diff --no-index normalizes: mode not lik
        test_cmp expected actual
 '
 
+test_expect_success POSIXPERM 'external diff with mode-only change' '
+       echo content >not-executable &&
+       echo content >executable &&
+       chmod +x executable &&
+       echo executable executable $(test_oid zero) 100755 \
+               not-executable $(test_oid zero) 100644 not-executable \
+               >expect &&
+       test_expect_code 1 git -c diff.external=echo diff \
+               --no-index executable not-executable >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success "diff --no-index treats '-' as stdin" '
        cat >expect <<-EOF &&
        diff --git a/- b/a/1
@@ -224,6 +236,25 @@ test_expect_success "diff --no-index treats '-' as stdin" '
        test_must_be_empty actual
 '
 
+test_expect_success "diff --no-index -R treats '-' as stdin" '
+       cat >expect <<-EOF &&
+       diff --git b/a/1 a/-
+       index $(git hash-object --stdin <a/1)..$ZERO_OID 100644
+       --- b/a/1
+       +++ a/-
+       @@ -1 +1 @@
+       -1
+       +x
+       EOF
+
+       test_write_lines x | test_expect_code 1 \
+               git -c core.abbrev=no diff --no-index -R -- - a/1 >actual &&
+       test_cmp expect actual &&
+
+       test_write_lines 1 | git diff --no-index -R -- a/1 - >actual &&
+       test_must_be_empty actual
+'
+
 test_expect_success 'diff --no-index refuses to diff stdin and a directory' '
        test_must_fail git diff --no-index -- - a </dev/null 2>err &&
        grep "fatal: cannot compare stdin to a directory" err
index 73048d0a52683bed2d56de3b0be77680cecaaf5a..3ea9ae99e04b9304e4dd8014eed9b01795317a31 100755 (executable)
@@ -74,13 +74,13 @@ test_expect_success 'plumbing not affected' '
 test_expect_success 'non-integer config parsing' '
        git config diff.context no &&
        test_must_fail git diff 2>output &&
-       test_i18ngrep "bad numeric config value" output
+       test_grep "bad numeric config value" output
 '
 
 test_expect_success 'negative integer config parsing' '
        git config diff.context -1 &&
        test_must_fail git diff 2>output &&
-       test_i18ngrep "bad config variable" output
+       test_grep "bad config variable" output
 '
 
 test_expect_success '-U0 is valid, so is diff.context=0' '
index 2d650d8f1032ca7c113fa0f48c72719fb08ab245..eff63c16b064d124b59a2e4b310e3ce5e190c532 100755 (executable)
@@ -34,7 +34,7 @@ test_expect_success setup '
        echo c >c &&
        git add c &&
        git commit -m C &&
-       git tag commit-C &&
+       git tag -m commit-C commit-C &&
        git merge -m D main &&
        git tag commit-D &&
        git checkout main &&
@@ -68,27 +68,27 @@ test_expect_success 'diff with two merge bases' '
 
 test_expect_success 'diff with no merge bases' '
        test_must_fail git diff br2...br3 2>err &&
-       test_i18ngrep "fatal: br2...br3: no merge base" err
+       test_grep "fatal: br2...br3: no merge base" err
 '
 
 test_expect_success 'diff with too many symmetric differences' '
        test_must_fail git diff br1...main br2...br3 2>err &&
-       test_i18ngrep "usage" err
+       test_grep "usage" err
 '
 
 test_expect_success 'diff with symmetric difference and extraneous arg' '
        test_must_fail git diff main br1...main 2>err &&
-       test_i18ngrep "usage" err
+       test_grep "usage" err
 '
 
 test_expect_success 'diff with two ranges' '
        test_must_fail git diff main br1..main br2..br3 2>err &&
-       test_i18ngrep "usage" err
+       test_grep "usage" err
 '
 
 test_expect_success 'diff with ranges and extra arg' '
        test_must_fail git diff main br1..main commit-D 2>err &&
-       test_i18ngrep "usage" err
+       test_grep "usage" err
 '
 
 test_expect_success 'diff --merge-base with no commits' '
@@ -97,7 +97,7 @@ test_expect_success 'diff --merge-base with no commits' '
 
 test_expect_success 'diff --merge-base with three commits' '
        test_must_fail git diff --merge-base br1 br2 main 2>err &&
-       test_i18ngrep "usage" err
+       test_grep "usage" err
 '
 
 for cmd in diff-index diff
@@ -109,6 +109,13 @@ do
                test_cmp expect actual
        '
 
+       test_expect_success "$cmd --merge-base with annotated tag" '
+               git checkout main &&
+               git $cmd commit-C >expect &&
+               git $cmd --merge-base commit-C >actual &&
+               test_cmp expect actual
+       '
+
        test_expect_success "$cmd --merge-base with one commit and unstaged changes" '
                git checkout main &&
                test_when_finished git reset --hard &&
@@ -143,19 +150,19 @@ do
        test_expect_success "$cmd --merge-base with non-commit" '
                git checkout main &&
                test_must_fail git $cmd --merge-base main^{tree} 2>err &&
-               test_i18ngrep "fatal: --merge-base only works with commits" err
+               test_grep "is a tree, not a commit" err
        '
 
        test_expect_success "$cmd --merge-base with no merge bases and one commit" '
                git checkout main &&
                test_must_fail git $cmd --merge-base br3 2>err &&
-               test_i18ngrep "fatal: no merge base found" err
+               test_grep "fatal: no merge base found" err
        '
 
        test_expect_success "$cmd --merge-base with multiple merge bases and one commit" '
                git checkout main &&
                test_must_fail git $cmd --merge-base br1 2>err &&
-               test_i18ngrep "fatal: multiple merge bases found" err
+               test_grep "fatal: multiple merge bases found" err
        '
 done
 
@@ -169,28 +176,28 @@ do
 
        test_expect_success "$cmd --merge-base commit and non-commit" '
                test_must_fail git $cmd --merge-base br2 main^{tree} 2>err &&
-               test_i18ngrep "fatal: --merge-base only works with commits" err
+               test_grep "is a tree, not a commit" err
        '
 
        test_expect_success "$cmd --merge-base with no merge bases and two commits" '
                test_must_fail git $cmd --merge-base br2 br3 2>err &&
-               test_i18ngrep "fatal: no merge base found" err
+               test_grep "fatal: no merge base found" err
        '
 
        test_expect_success "$cmd --merge-base with multiple merge bases and two commits" '
                test_must_fail git $cmd --merge-base main br1 2>err &&
-               test_i18ngrep "fatal: multiple merge bases found" err
+               test_grep "fatal: multiple merge bases found" err
        '
 done
 
 test_expect_success 'diff-tree --merge-base with one commit' '
        test_must_fail git diff-tree --merge-base main 2>err &&
-       test_i18ngrep "fatal: --merge-base only works with two commits" err
+       test_grep "fatal: --merge-base only works with two commits" err
 '
 
 test_expect_success 'diff --merge-base with range' '
        test_must_fail git diff --merge-base br2..br3 2>err &&
-       test_i18ngrep "fatal: --merge-base does not work with ranges" err
+       test_grep "fatal: --merge-base does not work with ranges" err
 '
 
 test_done
index a22a90d552a8ac8beb61d02b6e373a43951be7a1..cbef0a593fb7ccfded7b9e97735c41dda0ce1cbd 100755 (executable)
@@ -136,7 +136,7 @@ test_expect_success SYMLINKS '--reject removes .rej symlink if it exists' '
 
        ln -s foo file.t.rej &&
        test_must_fail git apply patch --reject 2>err &&
-       test_i18ngrep "Rejected hunk" err &&
+       test_grep "Rejected hunk" err &&
        test_path_is_missing foo &&
        test_path_is_file file.t.rej
 '
index 497b62868d4aa0f81c62178ee9b1a5a108b89c0d..697e86c0ff456028948a769f2b6ccfa66bee2dc2 100755 (executable)
@@ -31,7 +31,7 @@ test_expect_success 'apply git diff with -p2' '
 test_expect_success 'apply with too large -p' '
        cp file1.saved file1 &&
        test_must_fail git apply --stat -p3 patch.file 2>err &&
-       test_i18ngrep "removing 3 leading" err
+       test_grep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) traditional diff with funny filenames' '
@@ -53,7 +53,7 @@ test_expect_success 'apply (-p2) traditional diff with funny filenames' '
 test_expect_success 'apply with too large -p and fancy filename' '
        cp file1.saved file1 &&
        test_must_fail git apply --stat -p3 patch.escaped 2>err &&
-       test_i18ngrep "removing 3 leading" err
+       test_grep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) diff, mode change only' '
index 96965373036a6944971b28cbf5c9f42e2c9abdb2..2089d84f64577b2b0ac6fdd762cfec8bd259c96c 100755 (executable)
@@ -95,19 +95,19 @@ test_expect_success SYMLINKS 'do not follow symbolic link (same input)' '
 
        # same input creates a confusing symbolic link
        test_must_fail git apply patch 2>error-wt &&
-       test_i18ngrep "beyond a symbolic link" error-wt &&
+       test_grep "beyond a symbolic link" error-wt &&
        test_path_is_missing arch/x86_64/dir &&
        test_path_is_missing arch/i386/dir/file &&
 
        test_must_fail git apply --index patch 2>error-ix &&
-       test_i18ngrep "beyond a symbolic link" error-ix &&
+       test_grep "beyond a symbolic link" error-ix &&
        test_path_is_missing arch/x86_64/dir &&
        test_path_is_missing arch/i386/dir/file &&
        test_must_fail git ls-files --error-unmatch arch/x86_64/dir &&
        test_must_fail git ls-files --error-unmatch arch/i386/dir &&
 
        test_must_fail git apply --cached patch 2>error-ct &&
-       test_i18ngrep "beyond a symbolic link" error-ct &&
+       test_grep "beyond a symbolic link" error-ct &&
        test_must_fail git ls-files --error-unmatch arch/x86_64/dir &&
        test_must_fail git ls-files --error-unmatch arch/i386/dir &&
 
@@ -135,23 +135,23 @@ test_expect_success SYMLINKS 'do not follow symbolic link (existing)' '
        git add arch/x86_64/dir &&
 
        test_must_fail git apply add_file.patch 2>error-wt-add &&
-       test_i18ngrep "beyond a symbolic link" error-wt-add &&
+       test_grep "beyond a symbolic link" error-wt-add &&
        test_path_is_missing arch/i386/dir/file &&
 
        mkdir arch/i386/dir &&
        >arch/i386/dir/file &&
        test_must_fail git apply del_file.patch 2>error-wt-del &&
-       test_i18ngrep "beyond a symbolic link" error-wt-del &&
+       test_grep "beyond a symbolic link" error-wt-del &&
        test_path_is_file arch/i386/dir/file &&
        rm arch/i386/dir/file &&
 
        test_must_fail git apply --index add_file.patch 2>error-ix-add &&
-       test_i18ngrep "beyond a symbolic link" error-ix-add &&
+       test_grep "beyond a symbolic link" error-ix-add &&
        test_path_is_missing arch/i386/dir/file &&
        test_must_fail git ls-files --error-unmatch arch/i386/dir &&
 
        test_must_fail git apply --cached add_file.patch 2>error-ct-file &&
-       test_i18ngrep "beyond a symbolic link" error-ct-file &&
+       test_grep "beyond a symbolic link" error-ct-file &&
        test_must_fail git ls-files --error-unmatch arch/i386/dir
 '
 
index a1c7686519ebb1284d818fd3f5615853082abc01..4eb84440298552ec53520307641419a7f6d7fd77 100755 (executable)
@@ -41,7 +41,8 @@ test_expect_success FILEMODE 'same mode (index only)' '
        chmod +x file &&
        git add file &&
        git apply --cached patch-0.txt &&
-       git ls-files -s file | grep "^100755"
+       git ls-files -s file >ls-files-output &&
+       test_grep "^100755" ls-files-output
 '
 
 test_expect_success FILEMODE 'mode update (no index)' '
@@ -60,19 +61,20 @@ test_expect_success FILEMODE 'mode update (with index)' '
 test_expect_success FILEMODE 'mode update (index only)' '
        git reset --hard &&
        git apply --cached patch-1.txt &&
-       git ls-files -s file | grep "^100755"
+       git ls-files -s file >ls-files-output &&
+       test_grep "^100755" ls-files-output
 '
 
 test_expect_success FILEMODE 'empty mode is rejected' '
        git reset --hard &&
        test_must_fail git apply patch-empty-mode.txt 2>err &&
-       test_i18ngrep "invalid mode" err
+       test_grep "invalid mode" err
 '
 
 test_expect_success FILEMODE 'bogus mode is rejected' '
        git reset --hard &&
        test_must_fail git apply patch-bogus-mode.txt 2>err &&
-       test_i18ngrep "invalid mode" err
+       test_grep "invalid mode" err
 '
 
 test_expect_success POSIXPERM 'do not use core.sharedRepository for working tree files' '
@@ -101,4 +103,31 @@ test_expect_success POSIXPERM 'do not use core.sharedRepository for working tree
        )
 '
 
+test_expect_success 'git apply respects core.fileMode' '
+       test_config core.fileMode false &&
+       echo true >script.sh &&
+       git add --chmod=+x script.sh &&
+       git ls-files -s script.sh >ls-files-output &&
+       test_grep "^100755" ls-files-output &&
+       test_tick && git commit -m "Add script" &&
+       git ls-tree -r HEAD script.sh >ls-tree-output &&
+       test_grep "^100755" ls-tree-output &&
+
+       echo true >>script.sh &&
+       test_tick && git commit -m "Modify script" script.sh &&
+       git format-patch -1 --stdout >patch &&
+       test_grep "^index.*100755$" patch &&
+
+       git switch -c branch HEAD^ &&
+       git apply --index patch 2>err &&
+       test_grep ! "has type 100644, expected 100755" err &&
+       git reset --hard &&
+
+       git apply patch 2>err &&
+       test_grep ! "has type 100644, expected 100755" err &&
+
+       git apply --cached patch 2>err &&
+       test_grep ! "has type 100644, expected 100755" err
+'
+
 test_done
index 35f1060bc8b47f3f4de129621392c0b23b8f4c18..c21ddb29466ec46b3441313ada2c36b3173067b7 100755 (executable)
@@ -32,9 +32,9 @@ EOF
 
 test_expect_success 'apply diff with inconsistent filenames in headers' '
        test_must_fail git apply bad1.patch 2>err &&
-       test_i18ngrep "inconsistent new filename" err &&
+       test_grep "inconsistent new filename" err &&
        test_must_fail git apply bad2.patch 2>err &&
-       test_i18ngrep "inconsistent old filename" err
+       test_grep "inconsistent old filename" err
 '
 
 test_expect_success 'apply diff with new filename missing from headers' '
@@ -46,7 +46,7 @@ test_expect_success 'apply diff with new filename missing from headers' '
        +1
        EOF
        test_must_fail git apply missing_new_filename.diff 2>err &&
-       test_i18ngrep "lacks filename information" err
+       test_grep "lacks filename information" err
 '
 
 test_expect_success 'apply diff with old filename missing from headers' '
@@ -58,7 +58,7 @@ test_expect_success 'apply diff with old filename missing from headers' '
        -1
        EOF
        test_must_fail git apply missing_old_filename.diff 2>err &&
-       test_i18ngrep "lacks filename information" err
+       test_grep "lacks filename information" err
 '
 
 test_done
index 2935fe1b2d63e758e91711a98d90f942a07e032c..3b125762694e02c9f67dc204f1e182caecead90c 100755 (executable)
@@ -779,7 +779,7 @@ test_expect_success 'am --resolved fails if index has unmerged entries' '
        test_must_fail git am --resolved >err &&
        test_path_is_dir .git/rebase-apply &&
        test_cmp_rev second HEAD &&
-       test_i18ngrep "still have unmerged paths" err
+       test_grep "still have unmerged paths" err
 '
 
 test_expect_success 'am takes patches from a Pine mailbox' '
@@ -913,7 +913,7 @@ test_expect_success 'am newline in subject' '
        test_tick &&
        sed -e "s/second/second \\\n foo/" patch1 >patchnl &&
        git am <patchnl >output.out 2>&1 &&
-       test_i18ngrep "^Applying: second \\\n foo$" output.out
+       test_grep "^Applying: second \\\n foo$" output.out
 '
 
 test_expect_success 'am -q is quiet' '
index 5ed7e228274ed6d283f138c4fe244f9b3d14e2f3..edb38da7010d33315f02a345a076ef803d460a32 100755 (executable)
@@ -46,7 +46,7 @@ do
 
        test_expect_success "am$with3 --skip continue after failed am$with3" '
                test_must_fail git am$with3 --skip >output &&
-               test_i18ngrep "^Applying: 6$" output &&
+               test_grep "^Applying: 6$" output &&
                test_cmp file-2-expect file-2 &&
                test ! -f .git/MERGE_RR
        '
index b7c3861407d026e7064dbab0237bfa709859c462..4add7c775782ff9c3f20a372fa2a076c4651b85b 100755 (executable)
@@ -53,7 +53,7 @@ test_expect_success '--no-quiet overrides --quiet' '
        # Applying side1 will be quiet.
        test_must_fail git am --quiet side[123].eml >out &&
        test_path_is_dir .git/rebase-apply &&
-       test_i18ngrep ! "^Applying: " out &&
+       test_grep ! "^Applying: " out &&
        echo side1 >file &&
        git add file &&
 
index 7025cfdae539c5109df5a33a1e0ec6e7bfeeb688..fb53dddf799c9863ec1df4fe82147ead6dead15a 100755 (executable)
@@ -433,13 +433,13 @@ test_expect_success 'rerere --no-no-rerere-autoupdate' '
        git update-index --index-info <failedmerge &&
        cp file3.conflict file3 &&
        test_must_fail git rerere --no-no-rerere-autoupdate 2>err &&
-       test_i18ngrep [Uu]sage err &&
+       test_grep [Uu]sage err &&
        test_must_fail git update-index --refresh
 '
 
 test_expect_success 'rerere -h' '
        test_must_fail git rerere -h >help &&
-       test_i18ngrep [Uu]sage help
+       test_grep [Uu]sage help
 '
 
 concat_insert () {
index 8e4effebdb71c6d44f9c7d272ad5c3cd44d0b1e8..f698d0c9ad274137a9aa254c8e89bcece8f4cddd 100755 (executable)
@@ -139,7 +139,7 @@ test_expect_success !MINGW 'shortlog can read --format=raw output' '
 
 test_expect_success 'shortlog from non-git directory refuses extra arguments' '
        test_must_fail env GIT_DIR=non-existing git shortlog foo 2>out &&
-       test_i18ngrep "too many arguments" out
+       test_grep "too many arguments" out
 '
 
 test_expect_success 'shortlog should add newline when input line matches wraplen' '
@@ -312,6 +312,38 @@ test_expect_success 'shortlog de-duplicates trailers in a single commit' '
        test_cmp expect actual
 '
 
+# Trailers that have unfolded (single line) and folded (multiline) values which
+# are otherwise identical are treated as the same trailer for de-duplication.
+test_expect_success 'shortlog de-duplicates trailers in a single commit (folded/unfolded values)' '
+       git commit --allow-empty -F - <<-\EOF &&
+       subject one
+
+       this message has two distinct values, plus a repeat (folded)
+
+       Repeated-trailer: Foo foo foo
+       Repeated-trailer: Bar
+       Repeated-trailer: Foo
+         foo foo
+       EOF
+
+       git commit --allow-empty -F - <<-\EOF &&
+       subject two
+
+       similar to the previous, but without the second distinct value
+
+       Repeated-trailer: Foo foo foo
+       Repeated-trailer: Foo
+         foo foo
+       EOF
+
+       cat >expect <<-\EOF &&
+            2  Foo foo foo
+            1  Bar
+       EOF
+       git shortlog -ns --group=trailer:repeated-trailer -2 HEAD >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'shortlog can match multiple groups' '
        git commit --allow-empty -F - <<-\EOF &&
        subject one
index af4a123cd223ef5a3cdff9c97cf6af35abe53854..60fe60d7610e2a8141c58385b2319c7fa43a5de3 100755 (executable)
@@ -1884,7 +1884,7 @@ test_expect_success '--no-graph does not unset --parents' '
 
 test_expect_success '--reverse and --graph conflict' '
        test_must_fail git log --reverse --graph 2>stderr &&
-       test_i18ngrep "cannot be used together" stderr
+       test_grep "cannot be used together" stderr
 '
 
 test_expect_success '--reverse --graph --no-graph works' '
@@ -1895,7 +1895,7 @@ test_expect_success '--reverse --graph --no-graph works' '
 
 test_expect_success '--show-linear-break and --graph conflict' '
        test_must_fail git log --show-linear-break --graph 2>stderr &&
-       test_i18ngrep "cannot be used together" stderr
+       test_grep "cannot be used together" stderr
 '
 
 test_expect_success '--show-linear-break --graph --no-graph works' '
@@ -1906,7 +1906,7 @@ test_expect_success '--show-linear-break --graph --no-graph works' '
 
 test_expect_success '--no-walk and --graph conflict' '
        test_must_fail git log --no-walk --graph 2>stderr &&
-       test_i18ngrep "cannot be used together" stderr
+       test_grep "cannot be used together" stderr
 '
 
 test_expect_success '--no-walk --graph --no-graph works' '
@@ -1917,8 +1917,8 @@ test_expect_success '--no-walk --graph --no-graph works' '
 
 test_expect_success '--walk-reflogs and --graph conflict' '
        test_must_fail git log --walk-reflogs --graph 2>stderr &&
-       (test_i18ngrep "cannot combine" stderr ||
-               test_i18ngrep "cannot be used together" stderr)
+       (test_grep "cannot combine" stderr ||
+               test_grep "cannot be used together" stderr)
 '
 
 test_expect_success '--walk-reflogs --graph --no-graph works' '
@@ -2252,24 +2252,7 @@ test_expect_success 'log on empty repo fails' '
        git init empty &&
        test_when_finished "rm -rf empty" &&
        test_must_fail git -C empty log 2>stderr &&
-       test_i18ngrep does.not.have.any.commits stderr
-'
-
-test_expect_success REFFILES 'log diagnoses bogus HEAD hash' '
-       git init empty &&
-       test_when_finished "rm -rf empty" &&
-       echo 1234abcd >empty/.git/refs/heads/main &&
-       test_must_fail git -C empty log 2>stderr &&
-       test_i18ngrep broken stderr
-'
-
-test_expect_success REFFILES 'log diagnoses bogus HEAD symref' '
-       git init empty &&
-       echo "ref: refs/heads/invalid.lock" > empty/.git/HEAD &&
-       test_must_fail git -C empty log 2>stderr &&
-       test_i18ngrep broken stderr &&
-       test_must_fail git -C empty log --default totally-bogus 2>stderr &&
-       test_i18ngrep broken stderr
+       test_grep does.not.have.any.commits stderr
 '
 
 test_expect_success 'log does not default to HEAD when rev input is given' '
index 2016132f5161743018a09a663224806a93496730..8a88dd7900ca8a63327bf0853403a38a2c2bc5a9 100755 (executable)
@@ -360,7 +360,7 @@ test_expect_success 'mailmap.blob might be the wrong type' '
        cp default.map .mailmap &&
 
        git -c mailmap.blob=HEAD: shortlog HEAD >actual 2>err &&
-       test_i18ngrep "mailmap is not a blob" err &&
+       test_grep "mailmap is not a blob" err &&
        test_cmp expect actual
 '
 
index dd9035aa384937bfec5793fe2f591032282837ac..1409eebcd8557f20de38fee9c4a6166a959056b9 100755 (executable)
@@ -156,7 +156,7 @@ test_expect_success 'NUL termination with --reflog --pretty=oneline' '
        for r in $revs
        do
                git show -s --pretty=oneline "$r" >raw &&
-               cat raw | lf_to_nul || return 1
+               lf_to_nul <raw || return 1
        done >expect &&
        # the trailing NUL is already produced so we do not need to
        # output another one
@@ -576,6 +576,38 @@ test_expect_success 'clean log decoration' '
        test_cmp expected actual1
 '
 
+test_expect_success 'pretty format %decorate' '
+       git checkout -b foo &&
+       git commit --allow-empty -m "new commit" &&
+       git tag bar &&
+       git branch qux &&
+
+       echo " (HEAD -> foo, tag: bar, qux)" >expect1 &&
+       git log --format="%(decorate)" -1 >actual1 &&
+       test_cmp expect1 actual1 &&
+
+       echo "HEAD -> foo, tag: bar, qux" >expect2 &&
+       git log --format="%(decorate:prefix=,suffix=)" -1 >actual2 &&
+       test_cmp expect2 actual2 &&
+
+       echo "[ bar; qux; foo ]" >expect3 &&
+       git log --format="%(decorate:prefix=[ ,suffix= ],separator=%x3B ,tag=)" \
+               --decorate-refs=refs/ -1 >actual3 &&
+       test_cmp expect3 actual3 &&
+
+       # Try with a typo (in "separator"), in which case the placeholder should
+       # not be replaced.
+       echo "%(decorate:prefix=[ ,suffix= ],separater=; )" >expect4 &&
+       git log --format="%(decorate:prefix=[ ,suffix= ],separater=%x3B )" \
+               -1 >actual4 &&
+       test_cmp expect4 actual4 &&
+
+       echo "HEAD->foo bar qux" >expect5 &&
+       git log --format="%(decorate:prefix=,suffix=,separator= ,tag=,pointer=->)" \
+               -1 >actual5 &&
+       test_cmp expect5 actual5
+'
+
 cat >trailers <<EOF
 Signed-off-by: A U Thor <author@example.com>
 Acked-by: A U Thor <author@example.com>
@@ -924,6 +956,36 @@ test_expect_success '%S in git log --format works with other placeholders (part
        test_cmp expect actual
 '
 
+test_expect_success 'setup more commits for %S with --bisect' '
+       test_commit four &&
+       test_commit five &&
+
+       head1=$(git rev-parse --verify HEAD~0) &&
+       head2=$(git rev-parse --verify HEAD~1) &&
+       head3=$(git rev-parse --verify HEAD~2) &&
+       head4=$(git rev-parse --verify HEAD~3)
+'
+
+test_expect_success '%S with --bisect labels commits with refs/bisect/bad ref' '
+       git update-ref refs/bisect/bad-$head1 $head1 &&
+       git update-ref refs/bisect/go $head1 &&
+       git update-ref refs/bisect/bad-$head2 $head2 &&
+       git update-ref refs/bisect/b $head3 &&
+       git update-ref refs/bisect/bad-$head4 $head4 &&
+       git update-ref refs/bisect/good-$head4 $head4 &&
+
+       # We expect to see the range of commits betwee refs/bisect/good-$head4
+       # and refs/bisect/bad-$head1. The "source" ref is the nearest bisect ref
+       # from which the commit is reachable.
+       cat >expect <<-EOF &&
+       $head1 refs/bisect/bad-$head1
+       $head2 refs/bisect/bad-$head2
+       $head3 refs/bisect/bad-$head2
+       EOF
+       git log --bisect --format="%H %S" >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'log --pretty=reference' '
        git log --pretty="tformat:%h (%s, %as)" >expect &&
        git log --pretty=reference >actual &&
index ded33a82e2c94cd4f44c1df4c9fe93ce9bf5f148..73ea9e515503baf7776aaba04a4b6d9de7e20c92 100755 (executable)
@@ -53,35 +53,45 @@ cmp_filtered_decorations () {
 # to this test since it does not contain any decoration, hence --first-parent
 test_expect_success 'commit decorations colored correctly' '
        cat >expect <<-EOF &&
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD -> \
-${c_reset}${c_branch}main${c_reset}${c_commit}, \
-${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit}, \
-${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A1${c_reset}${c_commit}, \
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}\
+${c_commit} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
+${c_reset}${c_tag}tag: ${c_reset}${c_tag}v1.0${c_reset}${c_commit}, \
+${c_reset}${c_tag}tag: ${c_reset}${c_tag}B${c_reset}${c_commit})${c_reset} B
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
+${c_tag}tag: ${c_reset}${c_tag}A1${c_reset}${c_commit}, \
 ${c_reset}${c_remoteBranch}other/main${c_reset}${c_commit})${c_reset} A1
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_stash}refs/stash${c_reset}${c_commit})${c_reset} \
-On main: Changes to A.t
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
+${c_stash}refs/stash${c_reset}${c_commit})${c_reset} On main: Changes to A.t
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
+${c_tag}tag: ${c_reset}${c_tag}A${c_reset}${c_commit})${c_reset} A
        EOF
 
        git log --first-parent --no-abbrev --decorate --oneline --color=always --all >actual &&
        cmp_filtered_decorations
 '
 
+remove_replace_refs () {
+       git for-each-ref 'refs/replace*/**' --format='delete %(refname)' >in &&
+       git update-ref --stdin <in &&
+       rm in
+}
+
 test_expect_success 'test coloring with replace-objects' '
-       test_when_finished rm -rf .git/refs/replace* &&
+       test_when_finished remove_replace_refs &&
        test_commit C &&
        test_commit D &&
 
        git replace HEAD~1 HEAD~2 &&
 
        cat >expect <<-EOF &&
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD -> \
-${c_reset}${c_branch}main${c_reset}${c_commit}, \
-${c_reset}${c_tag}tag: D${c_reset}${c_commit})${c_reset} D
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: C${c_reset}${c_commit}, \
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}\
+${c_commit} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
+${c_reset}${c_tag}tag: ${c_reset}${c_tag}D${c_reset}${c_commit})${c_reset} D
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
+${c_tag}tag: ${c_reset}${c_tag}C${c_reset}${c_commit}, \
 ${c_reset}${c_grafted}replaced${c_reset}${c_commit})${c_reset} B
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
+${c_tag}tag: ${c_reset}${c_tag}A${c_reset}${c_commit})${c_reset} A
 EOF
 
        git log --first-parent --no-abbrev --decorate --oneline --color=always HEAD >actual &&
@@ -95,18 +105,20 @@ EOF
 '
 
 test_expect_success 'test coloring with grafted commit' '
-       test_when_finished rm -rf .git/refs/replace* &&
+       test_when_finished remove_replace_refs &&
 
        git replace --graft HEAD HEAD~2 &&
 
        cat >expect <<-EOF &&
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD -> \
-${c_reset}${c_branch}main${c_reset}${c_commit}, \
-${c_reset}${c_tag}tag: D${c_reset}${c_commit}, \
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}\
+${c_commit} -> ${c_reset}${c_branch}main${c_reset}${c_commit}, \
+${c_reset}${c_tag}tag: ${c_reset}${c_tag}D${c_reset}${c_commit}, \
 ${c_reset}${c_grafted}replaced${c_reset}${c_commit})${c_reset} D
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit}, \
-${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B
-       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
+${c_tag}tag: ${c_reset}${c_tag}v1.0${c_reset}${c_commit}, \
+${c_reset}${c_tag}tag: ${c_reset}${c_tag}B${c_reset}${c_commit})${c_reset} B
+       ${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}\
+${c_tag}tag: ${c_reset}${c_tag}A${c_reset}${c_commit})${c_reset} A
        EOF
 
        git log --first-parent --no-abbrev --decorate --oneline --color=always HEAD >actual &&
index 2e8f5ad7b822b2c33d1262c5576706f40de52692..806b2809d405f854f1d1f8b0d7156ce2c167e38a 100755 (executable)
@@ -21,7 +21,7 @@ test_expect_success '"git log :/" should not be ambiguous' '
 test_expect_success '"git log :/a" should be ambiguous (applied both rev and worktree)' '
        : >a &&
        test_must_fail git log :/a 2>error &&
-       test_i18ngrep ambiguous error
+       test_grep ambiguous error
 '
 
 test_expect_success '"git log :/a -- " should not be ambiguous' '
@@ -65,7 +65,7 @@ test_expect_success '"git log :/in" should not be ambiguous' '
 
 test_expect_success '"git log :" should be ambiguous' '
        test_must_fail git log : 2>error &&
-       test_i18ngrep ambiguous error
+       test_grep ambiguous error
 '
 
 test_expect_success 'git log -- :' '
@@ -104,7 +104,7 @@ test_expect_success '"git log :(exclude)sub --" must resolve as an object' '
 
 test_expect_success '"git log :(unknown-magic) complains of bogus magic' '
        test_must_fail git log ":(unknown-magic)" 2>error &&
-       test_i18ngrep pathspec.magic error
+       test_grep pathspec.magic error
 '
 
 test_expect_success 'command line pathspec parsing for "git log"' '
index 7f6bb27f141fe786811302f023366e6d15a5aa0e..64e16237335dbb37e3d250f248758017df62943b 100755 (executable)
@@ -57,10 +57,10 @@ test_expect_success setup '
 
 test_expect_success 'usage' '
        test_expect_code 129 git log -S 2>err &&
-       test_i18ngrep "switch.*requires a value" err &&
+       test_grep "switch.*requires a value" err &&
 
        test_expect_code 129 git log -G 2>err &&
-       test_i18ngrep "switch.*requires a value" err &&
+       test_grep "switch.*requires a value" err &&
 
        test_expect_code 128 git log -Gregex -Sstring 2>err &&
        grep "cannot be used together" err &&
index c6540e822fbdc56f068ae1b8d991175303bff038..02d76dca284cbaf1e0a284f0f496051b2fa88f39 100755 (executable)
@@ -19,7 +19,7 @@ test_expect_success 'basic command line parsing' '
 
        # -L requires there is no pathspec
        test_must_fail git log -L1,1:b.c -- b.c 2>error &&
-       test_i18ngrep "cannot be used with pathspec" error &&
+       test_grep "cannot be used with pathspec" error &&
 
        # This would fail because --follow wants a single path, but
        # we may fail due to incompatibility between -L/--follow in
@@ -50,7 +50,7 @@ canned_test_failure () {
 test_bad_opts () {
        test_expect_success "invalid args: $1" "
                test_must_fail git log $1 2>errors &&
-               test_i18ngrep '$2' errors
+               test_grep '$2' errors
        "
 }
 
index 85e90acb0919d6bff674263aff7f2d5140bc0495..e6b59123a3725115ff2ad5eae495d114dc7df801 100755 (executable)
@@ -17,7 +17,7 @@ test_expect_success 'setup' '
 
 test_expect_success 'fsck notices broken commit' '
        test_must_fail git fsck 2>actual &&
-       test_i18ngrep invalid.author actual
+       test_grep invalid.author actual
 '
 
 test_expect_success 'git log with broken author email' '
index f70c46bbbfa2c8fc9cc5ca1b620c9a80f29e382e..79055978690962fc3b58cd754a9383a88148f0f9 100755 (executable)
@@ -5,6 +5,7 @@ test_description='git log --graph of skewed left octopus merge.'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-log-graph.sh
 
index 28d0779a8c599ee9eab9b0b31afe1a57bb558c28..b877ac723516dc710fd42c17b65877d795d874ff 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='git log --graph of skewed merges'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-log-graph.sh
 
index fa9d32facfb0ddca6c001d78c1011cf0b3568f19..2ba0324a693731412242cf9603826736a3c9279a 100755 (executable)
@@ -5,6 +5,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-chunk.sh
 
 GIT_TEST_COMMIT_GRAPH=0
 GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
@@ -404,4 +405,53 @@ test_expect_success 'Bloom generation backfills empty commits' '
        )
 '
 
+corrupt_graph () {
+       graph=.git/objects/info/commit-graph &&
+       test_when_finished "rm -rf $graph" &&
+       git commit-graph write --reachable --changed-paths &&
+       corrupt_chunk_file $graph "$@"
+}
+
+check_corrupt_graph () {
+       corrupt_graph "$@" &&
+       git -c core.commitGraph=false log -- A/B/file2 >expect.out &&
+       git -c core.commitGraph=true log -- A/B/file2 >out 2>err &&
+       test_cmp expect.out out
+}
+
+test_expect_success 'Bloom reader notices too-small data chunk' '
+       check_corrupt_graph BDAT clear 00000000 &&
+       echo "warning: ignoring too-small changed-path chunk" \
+               "(4 < 12) in commit-graph file" >expect.err &&
+       test_cmp expect.err err
+'
+
+test_expect_success 'Bloom reader notices out-of-bounds filter offsets' '
+       check_corrupt_graph BIDX 12 FFFFFFFF &&
+       # use grep to avoid depending on exact chunk size
+       grep "warning: ignoring out-of-range offset (4294967295) for changed-path filter at pos 3 of .git/objects/info/commit-graph" err
+'
+
+test_expect_success 'Bloom reader notices too-small index chunk' '
+       # replace the index with a single entry, making most
+       # lookups out-of-bounds
+       check_corrupt_graph BIDX clear 00000000 &&
+       echo "warning: commit-graph changed-path index chunk" \
+               "is too small" >expect.err &&
+       test_cmp expect.err err
+'
+
+test_expect_success 'Bloom reader notices out-of-order index offsets' '
+       # we do not know any real offsets, but we can pick
+       # something plausible; we should not get to the point of
+       # actually reading from the bogus offsets anyway.
+       corrupt_graph BIDX 4 0000000c00000005 &&
+       echo "warning: ignoring decreasing changed-path index offsets" \
+               "(12 > 5) for positions 1 and 2 of .git/objects/info/commit-graph" >expect.err &&
+       git -c core.commitGraph=false log -- A/B/file2 >expect.out &&
+       git -c core.commitGraph=true log -- A/B/file2 >out 2>err &&
+       test_cmp expect.out out &&
+       test_cmp expect.err err
+'
+
 test_done
index 6e01e2629c1b158464ab29e4086fb4eeea16bbaa..613f0710e90511c6419e843eec3cb4d11aafc437 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='git log with filter options limiting the output'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup test' '
index 1015273bc827aeeef1e75edbf6c819e04719bde6..92d8c8b651cbe6714d95bdaf9bf91f62fd3bbf91 100755 (executable)
@@ -13,7 +13,7 @@ test_expect_success 'setup' '
 
 test_expect_success 'am with format=flowed' '
        git am <"$TEST_DIRECTORY/t4256/1/patch" 2>stderr &&
-       test_i18ngrep "warning: Patch sent with format=flowed" stderr &&
+       test_grep "warning: Patch sent with format=flowed" stderr &&
        test_cmp "$TEST_DIRECTORY/t4256/1/mailinfo.c" mailinfo.c
 '
 
index 57c4f26e4613a97644ad5822b1f6a0c4572a33a4..9c197260d5bbf54d3ad578c27f54e278d88ab97b 100755 (executable)
@@ -86,6 +86,33 @@ EXPECTED
        test_cmp expected actual
 '
 
+test_expect_success '3-way merge with --attr-source' '
+       test_when_finished rm -rf 3-way &&
+       git init 3-way &&
+       (
+               cd 3-way &&
+               test_commit initial file1 foo &&
+               base=$(git rev-parse HEAD) &&
+               git checkout -b brancha &&
+               echo bar >>file1 &&
+               git commit -am "adding bar" &&
+               source=$(git rev-parse HEAD) &&
+               git checkout @{-1} &&
+               git checkout -b branchb &&
+               echo baz >>file1 &&
+               git commit -am "adding baz" &&
+               merge=$(git rev-parse HEAD) &&
+               git checkout -b gitattributes &&
+               test_commit "gitattributes" .gitattributes "file1 merge=union" &&
+               git checkout @{-1} &&
+               tree=$(git --attr-source=gitattributes merge-tree --write-tree \
+               --merge-base "$base" --end-of-options "$source" "$merge") &&
+               test_write_lines foo bar baz >expect &&
+               git cat-file -p "$tree:file1" >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_expect_success 'file change A, B (same)' '
        git reset --hard initial &&
        test_commit "change-a-b-same-A" "initial-file" "AAA" &&
index 250f721795b5bd2ecba3090b7e181c50673540aa..eea19907b550c4a97a7ca7760f1be30bea7d8db0 100755 (executable)
@@ -22,6 +22,7 @@ test_expect_success setup '
        git branch side1 &&
        git branch side2 &&
        git branch side3 &&
+       git branch side4 &&
 
        git checkout side1 &&
        test_write_lines 1 2 3 4 5 6 >numbers &&
@@ -46,6 +47,13 @@ test_expect_success setup '
        test_tick &&
        git commit -m rename-numbers &&
 
+       git checkout side4 &&
+       test_write_lines 0 1 2 3 4 5 >numbers &&
+       echo yo >greeting &&
+       git add numbers greeting &&
+       test_tick &&
+       git commit -m other-content-modifications &&
+
        git switch --orphan unrelated &&
        >something-else &&
        git add something-else &&
@@ -97,6 +105,21 @@ test_expect_success 'Content merge and a few conflicts' '
        test_cmp expect actual
 '
 
+test_expect_success 'Auto resolve conflicts by "ours" strategy option' '
+       git checkout side1^0 &&
+
+       # make sure merge conflict exists
+       test_must_fail git merge side4 &&
+       git merge --abort &&
+
+       git merge -X ours side4 &&
+       git rev-parse HEAD^{tree} >expected &&
+
+       git merge-tree -X ours side1 side4 >actual &&
+
+       test_cmp expected actual
+'
+
 test_expect_success 'Barf on misspelled option, with exit code other than 0 or 1' '
        # Mis-spell with single "s" instead of double "s"
        test_expect_code 129 git merge-tree --write-tree --mesages FOOBAR side1 side2 2>expect &&
@@ -290,7 +313,7 @@ test_expect_success 'rename/add handling' '
                # First, check that the bar that appears at stage 3 does not
                # correspond to an individual blob anywhere in history
                #
-               hash=$(cat out | tr "\0" "\n" | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
+               hash=$(tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
                git rev-list --objects --all >all_blobs &&
                ! grep $hash all_blobs &&
 
@@ -357,7 +380,7 @@ test_expect_success SYMLINKS 'rename/add, where add is a mode conflict' '
                # First, check that the bar that appears at stage 3 does not
                # correspond to an individual blob anywhere in history
                #
-               hash=$(cat out | tr "\0" "\n" | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
+               hash=$(tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " ") &&
                git rev-list --objects --all >all_blobs &&
                ! grep $hash all_blobs &&
 
@@ -607,8 +630,8 @@ test_expect_success 'mod6: chains of rename/rename(1to2) and add/add via collidi
                # conflict entries do not appear as individual blobs anywhere
                # in history.
                #
-               hash1=$(cat out | tr "\0" "\n" | head | grep 2.four | cut -f 2 -d " ") &&
-               hash2=$(cat out | tr "\0" "\n" | head | grep 3.two | cut -f 2 -d " ") &&
+               hash1=$(tr "\0" "\n" <out | head | grep 2.four | cut -f 2 -d " ") &&
+               hash2=$(tr "\0" "\n" <out | head | grep 3.two | cut -f 2 -d " ") &&
                git rev-list --objects --all >all_blobs &&
                ! grep $hash1 all_blobs &&
                ! grep $hash2 all_blobs &&
@@ -864,7 +887,7 @@ test_expect_success '--stdin with both a successful and a conflicted merge' '
 test_expect_success '--merge-base is incompatible with --stdin' '
        test_must_fail git merge-tree --merge-base=side1 --stdin 2>expect &&
 
-       grep "^fatal: --merge-base is incompatible with --stdin" expect
+       grep "^fatal: .*merge-base.*stdin.* cannot be used together" expect
 '
 
 # specify merge-base as parent of branch2
@@ -922,4 +945,49 @@ test_expect_success 'check the input format when --stdin is passed' '
        test_cmp expect actual
 '
 
+test_expect_success '--merge-base with tree OIDs' '
+       git merge-tree --merge-base=side1^ side1 side3 >with-commits &&
+       git merge-tree --merge-base=side1^^{tree} side1^{tree} side3^{tree} >with-trees &&
+       test_cmp with-commits with-trees
+'
+
+test_expect_success 'error out on missing tree objects' '
+       git init --bare missing-tree.git &&
+       git rev-list side3 >list &&
+       git rev-parse side3^: >>list &&
+       git pack-objects missing-tree.git/objects/pack/side3-tree-is-missing <list &&
+       side3=$(git rev-parse side3) &&
+       test_must_fail git --git-dir=missing-tree.git merge-tree $side3^ $side3 >actual 2>err &&
+       test_grep "Could not read $(git rev-parse $side3:)" err &&
+       test_must_be_empty actual
+'
+
+test_expect_success 'error out on missing blob objects' '
+       echo 1 | git hash-object -w --stdin >blob1 &&
+       echo 2 | git hash-object -w --stdin >blob2 &&
+       echo 3 | git hash-object -w --stdin >blob3 &&
+       printf "100644 blob $(cat blob1)\tblob\n" | git mktree >tree1 &&
+       printf "100644 blob $(cat blob2)\tblob\n" | git mktree >tree2 &&
+       printf "100644 blob $(cat blob3)\tblob\n" | git mktree >tree3 &&
+       git init --bare missing-blob.git &&
+       cat blob1 blob3 tree1 tree2 tree3 |
+       git pack-objects missing-blob.git/objects/pack/side1-whatever-is-missing &&
+       test_must_fail git --git-dir=missing-blob.git >actual 2>err \
+               merge-tree --merge-base=$(cat tree1) $(cat tree2) $(cat tree3) &&
+       test_grep "unable to read blob object $(cat blob2)" err &&
+       test_must_be_empty actual
+'
+
+test_expect_success 'error out on missing commits as well' '
+       git init --bare missing-commit.git &&
+       git rev-list --objects side1 side3 >list-including-initial &&
+       grep -v ^$(git rev-parse side1^) <list-including-initial >list &&
+       git pack-objects missing-commit.git/objects/pack/missing-initial <list &&
+       side1=$(git rev-parse side1) &&
+       side3=$(git rev-parse side3) &&
+       test_must_fail git --git-dir=missing-commit.git \
+               merge-tree --allow-unrelated-histories $side1 $side3 >actual &&
+       test_must_be_empty actual
+'
+
 test_done
index 4b4c3315d885f02fdcf2be65885ea9107f65b86d..72b8d0ff02e34be0606747c850b0815be31196d4 100755 (executable)
@@ -124,6 +124,16 @@ test_expect_success 'setup' '
        EOF
 '
 
+test_expect_success '--list notices extra parameters' '
+       test_must_fail git archive --list blah &&
+       test_must_fail git archive --remote=. --list blah
+'
+
+test_expect_success 'end-of-options is correctly eaten' '
+       git archive --list --end-of-options &&
+       git archive --remote=. --list --end-of-options
+'
+
 test_expect_success 'populate workdir' '
        mkdir a &&
        echo simple textfile >a/a &&
index 0ff47a239db905eb5c3e65de53994b0ac81cbd86..eaf959d8f63f158651609a7c5b0c2eb6592b4926 100755 (executable)
@@ -138,7 +138,7 @@ test_expect_success 'git archive with worktree attributes, bare' '
 '
 
 test_expect_missing    bare-worktree/ignored
-test_expect_exists     bare-worktree/ignored-by-tree
+test_expect_missing    bare-worktree/ignored-by-tree
 test_expect_exists     bare-worktree/ignored-by-worktree
 
 test_expect_success 'export-subst' '
index fc499cdff01d01a6079221e78b50a7924e5ecb71..961c6aac2561354f6ad57270c1362fe73c850924 100755 (executable)
@@ -239,4 +239,38 @@ check_zip with_untracked2
 check_added with_untracked2 untracked one/untracked
 check_added with_untracked2 untracked two/untracked
 
+# Test remote archive over HTTP protocol.
+#
+# Note: this should be the last part of this test suite, because
+# by including lib-httpd.sh, the test may end early if httpd tests
+# should not be run.
+#
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+test_expect_success "setup for HTTP protocol" '
+       cp -R bare.git "$HTTPD_DOCUMENT_ROOT_PATH/bare.git" &&
+       git -C "$HTTPD_DOCUMENT_ROOT_PATH/bare.git" \
+               config http.uploadpack true &&
+       set_askpass user@host pass@host
+'
+
+setup_askpass_helper
+
+test_expect_success 'remote archive does not work with protocol v1' '
+       test_must_fail git -c protocol.version=1 archive \
+               --remote="$HTTPD_URL/auth/smart/bare.git" \
+               --output=remote-http.zip HEAD >actual 2>&1 &&
+       cat >expect <<-EOF &&
+       fatal: can${SQ}t connect to subservice git-upload-archive
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'archive remote http repository' '
+       git archive --remote="$HTTPD_URL/auth/smart/bare.git" \
+               --output=remote-http.zip HEAD &&
+       test_cmp_bin d.zip remote-http.zip
+'
+
 test_done
index db11cababd310f9773dcd0a3bb7039a4df8d4f59..c8d06554541cb5d7c575b69c83bd7d3828d49924 100755 (executable)
@@ -70,7 +70,7 @@ test_expect_success 'respect NULs' '
 
        git mailsplit -d3 -o. "$DATA/nul-plain" &&
        test_cmp "$DATA/nul-plain" 001 &&
-       (cat 001 | git mailinfo msg patch) &&
+       git mailinfo msg patch <001 &&
        test_line_count = 4 patch
 
 '
@@ -268,4 +268,26 @@ test_expect_success 'mailinfo warn CR in base64 encoded email' '
        test_must_be_empty quoted-cr/0002.err
 '
 
+test_expect_success 'from line with unterminated quoted string' '
+       echo "From: bob \"unterminated string smith <bob@example.com>" >in &&
+       git mailinfo /dev/null /dev/null <in >actual &&
+       cat >expect <<-\EOF &&
+       Author: bob unterminated string smith
+       Email: bob@example.com
+
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'from line with unterminated comment' '
+       echo "From: bob (unterminated comment smith <bob@example.com>" >in &&
+       git mailinfo /dev/null /dev/null <in >actual &&
+       cat >expect <<-\EOF &&
+       Author: bob (unterminated comment smith
+       Email: bob@example.com
+
+       EOF
+       test_cmp expect actual
+'
+
 test_done
index 72281779843fb270762b5352b8dc213bd3b805e1..bd71956a474531775de56ac26757484a76025676 100644 (file)
@@ -1,4 +1,4 @@
-Author: A U Thor (this is (really) a comment (honestly))
+Author: (this is (really) a "comment" (honestly)) A U Thor
 Email: somebody@example.com
 Subject: testing comments
 Date: Sun, 25 May 2008 00:38:18 -0700
index c53a192dfeac51a32000d80f4f8052eef6e44486..0b7e903b061131b30a258d30b11cd9cc22acae5d 100644 (file)
@@ -1,5 +1,5 @@
 From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001
-From: "A U Thor" <somebody@example.com> (this is \(really\) a comment (honestly))
+From: (this is \(really\) a "comment" (honestly)) "A U Thor" <somebody@example.com>
 Date: Sun, 25 May 2008 00:38:18 -0700
 Subject: [PATCH] testing comments
 
index 745089479ca3a87e36239e196466aadb0b886848..61e2be2903d344563fe2ebea718de962e60d7b78 100755 (executable)
@@ -441,6 +441,47 @@ test_expect_success 'index-pack with --strict' '
        )
 '
 
+test_expect_success 'setup for --strict and --fsck-objects downgrading fsck msgs' '
+       git init strict &&
+       (
+               cd strict &&
+               test_commit first hello &&
+               cat >commit <<-EOF &&
+               tree $(git rev-parse HEAD^{tree})
+               parent $(git rev-parse HEAD)
+               author A U Thor
+               committer A U Thor
+
+               commit: this is a commit with bad emails
+
+               EOF
+               git hash-object --literally -t commit -w --stdin <commit >commit_list &&
+               git pack-objects test <commit_list >pack-name
+       )
+'
+
+test_with_bad_commit () {
+       must_fail_arg="$1" &&
+       must_pass_arg="$2" &&
+       (
+               cd strict &&
+               test_must_fail git index-pack "$must_fail_arg" "test-$(cat pack-name).pack" &&
+               git index-pack "$must_pass_arg" "test-$(cat pack-name).pack"
+       )
+}
+
+test_expect_success 'index-pack with --strict downgrading fsck msgs' '
+       test_with_bad_commit --strict --strict="missingEmail=ignore"
+'
+
+test_expect_success 'index-pack with --fsck-objects downgrading fsck msgs' '
+       test_with_bad_commit --fsck-objects --fsck-objects="missingEmail=ignore"
+'
+
+test_expect_success 'cleanup for --strict and --fsck-objects downgrading fsck msgs' '
+       rm -rf strict
+'
+
 test_expect_success 'honor pack.packSizeLimit' '
        git config pack.packSizeLimit 3m &&
        packname_10=$(git pack-objects test-10 <obj-list) &&
@@ -541,7 +582,7 @@ test_expect_success 'make sure index-pack detects the SHA1 collision' '
        (
                cd corrupt &&
                test_must_fail git index-pack -o ../bad.idx ../test-3.pack 2>msg &&
-               test_i18ngrep "SHA1 COLLISION FOUND" msg
+               test_grep "SHA1 COLLISION FOUND" msg
        )
 '
 
@@ -549,7 +590,7 @@ test_expect_success 'make sure index-pack detects the SHA1 collision (large blob
        (
                cd corrupt &&
                test_must_fail git -c core.bigfilethreshold=1 index-pack -o ../bad.idx ../test-3.pack 2>msg &&
-               test_i18ngrep "SHA1 COLLISION FOUND" msg
+               test_grep "SHA1 COLLISION FOUND" msg
        )
 '
 
index f89809be53cf335295e91b91af42de0c1ccf2b5b..d88e6f16910151009e9700dd7d20d0d12f333ddf 100755 (executable)
@@ -282,8 +282,8 @@ test_expect_success 'index-pack --fsck-objects also warns upon missing tagger in
 test_expect_success 'index-pack -v --stdin produces progress for both phases' '
        pack=$(git pack-objects --all pack </dev/null) &&
        GIT_PROGRESS_DELAY=0 git index-pack -v --stdin <pack-$pack.pack 2>err &&
-       test_i18ngrep "Receiving objects" err &&
-       test_i18ngrep "Resolving deltas" err
+       test_grep "Receiving objects" err &&
+       test_grep "Resolving deltas" err
 '
 
 test_expect_success 'too-large packs report the breach' '
index b4df545e5ab602a869cfde5d13090e40c6d003a5..1f1f664871ece6dba57e6bb601ba3771f490e2eb 100755 (executable)
@@ -318,10 +318,10 @@ test_expect_success 'prune: handle HEAD reflog in multiple worktrees' '
 
 test_expect_success 'prune: handle expire option correctly' '
        test_must_fail git prune --expire 2>error &&
-       test_i18ngrep "requires a value" error &&
+       test_grep "requires a value" error &&
 
        test_must_fail git prune --expire=nyah 2>error &&
-       test_i18ngrep "malformed expiration" error &&
+       test_grep "malformed expiration" error &&
 
        git prune --no-expire
 '
index 78c1c6c923d62d1047b654e680d61a2ddf4f2269..d7fd71360e17bd2368562dd7c35644442475bb60 100755 (executable)
@@ -271,7 +271,7 @@ test_bitmap_cases () {
                mv -f $bitmap.tmp $bitmap &&
                git rev-list --use-bitmap-index --count --all >actual 2>stderr &&
                test_cmp expect actual &&
-               test_i18ngrep corrupt.ewah.bitmap stderr
+               test_grep corrupt.ewah.bitmap stderr
        '
 
        test_expect_success 'truncated bitmap fails gracefully (cache)' '
@@ -284,7 +284,7 @@ test_bitmap_cases () {
                mv -f $bitmap.tmp $bitmap &&
                git rev-list --use-bitmap-index --count --all >actual 2>stderr &&
                test_cmp expect actual &&
-               test_i18ngrep corrupted.bitmap.index stderr
+               test_grep corrupted.bitmap.index stderr
        '
 
        # Create a state of history with these properties:
@@ -471,7 +471,7 @@ sane_unset GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL
 test_expect_success 'incremental repack fails when bitmaps are requested' '
        test_commit more-1 &&
        test_must_fail git repack -d 2>err &&
-       test_i18ngrep "Incremental repacks are incompatible with bitmap" err
+       test_grep "Incremental repacks are incompatible with bitmap" err
 '
 
 test_expect_success 'incremental repack can disable bitmaps' '
@@ -524,7 +524,7 @@ test_expect_success 'truncated bitmap fails gracefully (lookup table)' '
        mv -f $bitmap.tmp $bitmap &&
        git rev-list --use-bitmap-index --count --all >actual 2>stderr &&
        test_cmp expect actual &&
-       test_i18ngrep corrupted.bitmap.index stderr
+       test_grep corrupted.bitmap.index stderr
 '
 
 test_done
index 9dae60f73e3253bbb4b44355535c8cf1ebc58be8..4fe71fe8cd21ddfb0f44821c672585219278bbda 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='check bitmap operation with shallow repositories'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 # We want to create a situation where the shallow, grafted
index 230cb3871223e1f28482c841093cb7a0e6873754..d8d2e304687b2a9e6d9313d0daa8a77848410f41 100755 (executable)
@@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' '
        test_cmp expect actual
 '
 
-# we do not want to count on running pack-refs to
-# actually pack it, as it is perfectly reasonable to
-# skip processing a broken ref
-test_expect_success REFFILES 'create packed-refs file with broken ref' '
-       rm -f .git/refs/heads/main &&
-       cat >.git/packed-refs <<-EOF &&
-       $missing refs/heads/main
-       $recoverable refs/heads/other
-       EOF
-       echo $missing >expect &&
-       git rev-parse refs/heads/main >actual &&
-       test_cmp expect actual
-'
-
-test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' '
-       git pack-refs --all --prune &&
-       git rev-parse refs/heads/main >actual &&
-       test_cmp expect actual
-'
-
-test_expect_success REFFILES  'pack-refs does not drop broken refs during deletion' '
-       git update-ref -d refs/heads/other &&
-       git rev-parse refs/heads/main >actual &&
-       test_cmp expect actual
-'
-
 test_done
index b26d476c646fdb63a9569d98bc9d2792dd6f3426..79552d6ef7f69751b8cfa1bd71edfda47973257b 100755 (executable)
@@ -53,6 +53,14 @@ test_expect_success 'verify blob:none packfile has no blobs' '
        ! grep blob verify_result
 '
 
+test_expect_success 'verify blob:none packfile without --stdout' '
+       git -C r1 pack-objects --revs --filter=blob:none mypackname >packhash <<-EOF &&
+       HEAD
+       EOF
+       git -C r1 verify-pack -v "mypackname-$(cat packhash).pack" >verify_result &&
+       ! grep blob verify_result
+'
+
 test_expect_success 'verify normal and blob:none packfiles have same commits/trees' '
        git -C r1 verify-pack -v ../all.pack >verify_result &&
        grep -E "commit|tree" verify_result |
@@ -447,7 +455,7 @@ test_expect_success 'setup r1 - delete loose blobs' '
        test_parse_ls_files_stage_oids <ls_files_result |
        sort >expected &&
 
-       for id in `cat expected | sed "s|..|&/|"`
+       for id in `sed "s|..|&/|" expected`
        do
                rm r1/.git/objects/$id || return 1
        done
index 4df76173a8d774b56f60f12c7ee23372d11b7143..a2b44426609fe5c52347510e8b82c9484897dea8 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='commit graph'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-chunk.sh
 
 GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
 
@@ -47,7 +48,7 @@ test_expect_success 'exit with correct error on bad input to --stdin-packs' '
        echo doesnotexist >in &&
        test_expect_code 1 git -C full commit-graph write --stdin-packs \
                <in 2>stderr &&
-       test_i18ngrep "error adding pack" stderr
+       test_grep "error adding pack" stderr
 '
 
 test_expect_success 'create commits and repack' '
@@ -67,11 +68,11 @@ test_expect_success 'exit with correct error on bad input to --stdin-commits' '
        # invalid, non-hex OID
        echo HEAD | test_expect_code 1 git -C full commit-graph write \
                --stdin-commits 2>stderr &&
-       test_i18ngrep "unexpected non-hex object ID: HEAD" stderr &&
+       test_grep "unexpected non-hex object ID: HEAD" stderr &&
        # non-existent OID
        echo $ZERO_OID | test_expect_code 1 git -C full commit-graph write \
                --stdin-commits 2>stderr &&
-       test_i18ngrep "invalid object" stderr &&
+       test_grep "invalid object" stderr &&
        # valid commit and tree OID
        git -C full rev-parse HEAD HEAD^{tree} >in &&
        git -C full commit-graph write --stdin-commits <in &&
@@ -143,7 +144,7 @@ test_expect_success 'commit-graph write --stdin-commits force progress on for st
        git -C full rev-parse commits/5 >in &&
        GIT_PROGRESS_DELAY=0 git -C full commit-graph write --stdin-commits \
                --progress <in 2>err &&
-       test_i18ngrep "Collecting commits from input" err
+       test_grep "Collecting commits from input" err
 '
 
 test_expect_success 'commit-graph write --stdin-commits with the --no-progress option' '
@@ -383,13 +384,13 @@ test_expect_success 'warn on improper hash version' '
                cd sha1 &&
                mv ../cg-sha256 .git/objects/info/commit-graph &&
                git log -1 2>err &&
-               test_i18ngrep "commit-graph hash version 2 does not match version 1" err
+               test_grep "commit-graph hash version 2 does not match version 1" err
        ) &&
        (
                cd sha256 &&
                mv ../cg-sha1 .git/objects/info/commit-graph &&
                git log -1 2>err &&
-               test_i18ngrep "commit-graph hash version 1 does not match version 2" err
+               test_grep "commit-graph hash version 1 does not match version 2" err
        )
 '
 
@@ -450,14 +451,15 @@ GRAPH_BYTE_FANOUT2=$(($GRAPH_FANOUT_OFFSET + 4 * 255))
 GRAPH_OID_LOOKUP_OFFSET=$(($GRAPH_FANOUT_OFFSET + 4 * 256))
 GRAPH_BYTE_OID_LOOKUP_ORDER=$(($GRAPH_OID_LOOKUP_OFFSET + $HASH_LEN * 8))
 GRAPH_BYTE_OID_LOOKUP_MISSING=$(($GRAPH_OID_LOOKUP_OFFSET + $HASH_LEN * 4 + 10))
+GRAPH_COMMIT_DATA_WIDTH=$(($HASH_LEN + 16))
 GRAPH_COMMIT_DATA_OFFSET=$(($GRAPH_OID_LOOKUP_OFFSET + $HASH_LEN * $NUM_COMMITS))
 GRAPH_BYTE_COMMIT_TREE=$GRAPH_COMMIT_DATA_OFFSET
 GRAPH_BYTE_COMMIT_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN))
 GRAPH_BYTE_COMMIT_EXTRA_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 4))
 GRAPH_BYTE_COMMIT_WRONG_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 3))
 GRAPH_BYTE_COMMIT_GENERATION=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 11))
+GRAPH_BYTE_COMMIT_GENERATION_LAST=$(($GRAPH_BYTE_COMMIT_GENERATION + $(($NUM_COMMITS - 1)) * $GRAPH_COMMIT_DATA_WIDTH))
 GRAPH_BYTE_COMMIT_DATE=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 12))
-GRAPH_COMMIT_DATA_WIDTH=$(($HASH_LEN + 16))
 GRAPH_OCTOPUS_DATA_OFFSET=$(($GRAPH_COMMIT_DATA_OFFSET + \
                             $GRAPH_COMMIT_DATA_WIDTH * $NUM_COMMITS))
 GRAPH_BYTE_OCTOPUS=$(($GRAPH_OCTOPUS_DATA_OFFSET + 4))
@@ -473,7 +475,7 @@ corrupt_graph_verify() {
        grepstr=$1
        test_must_fail git -C full commit-graph verify 2>test_err &&
        grep -v "^+" test_err >err &&
-       test_i18ngrep "$grepstr" err &&
+       test_grep "$grepstr" err &&
        if test "$2" != "no-copy"
        then
                cp full/$objdir/info/commit-graph commit-graph-pre-write-test
@@ -538,17 +540,17 @@ test_expect_success 'detect low chunk count' '
 
 test_expect_success 'detect missing OID fanout chunk' '
        corrupt_graph_and_verify $GRAPH_BYTE_OID_FANOUT_ID "\0" \
-               "missing the OID Fanout chunk"
+               "commit-graph required OID fanout chunk missing or corrupted"
 '
 
 test_expect_success 'detect missing OID lookup chunk' '
        corrupt_graph_and_verify $GRAPH_BYTE_OID_LOOKUP_ID "\0" \
-               "missing the OID Lookup chunk"
+               "commit-graph required OID lookup chunk missing or corrupted"
 '
 
 test_expect_success 'detect missing commit data chunk' '
        corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_DATA_ID "\0" \
-               "missing the Commit Data chunk"
+               "commit-graph required commit data chunk missing or corrupted"
 '
 
 test_expect_success 'detect incorrect fanout' '
@@ -558,7 +560,7 @@ test_expect_success 'detect incorrect fanout' '
 
 test_expect_success 'detect incorrect fanout final value' '
        corrupt_graph_and_verify $GRAPH_BYTE_FANOUT2 "\01" \
-               "fanout value"
+               "OID lookup chunk is the wrong size"
 '
 
 test_expect_success 'detect incorrect OID order' '
@@ -596,11 +598,6 @@ test_expect_success 'detect incorrect generation number' '
                "generation for commit"
 '
 
-test_expect_success 'detect incorrect generation number' '
-       corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_GENERATION "\01" \
-               "commit-graph generation for commit"
-'
-
 test_expect_success 'detect incorrect commit date' '
        corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_DATE "\01" \
                "commit date"
@@ -622,6 +619,16 @@ test_expect_success 'detect incorrect chunk count' '
                $GRAPH_CHUNK_LOOKUP_OFFSET
 '
 
+test_expect_success 'detect mixed generation numbers (non-zero to zero)' '
+       corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_GENERATION_LAST "\0\0\0\0" \
+               "both zero and non-zero generations"
+'
+
+test_expect_success 'detect mixed generation numbers (zero to non-zero)' '
+       corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_GENERATION "\0\0\0\0" \
+               "both zero and non-zero generations"
+'
+
 test_expect_success 'git fsck (checks commit-graph when config set to true)' '
        git -C full fsck &&
        corrupt_graph_and_verify $GRAPH_BYTE_FOOTER "\00" \
@@ -714,7 +721,7 @@ test_expect_success 'corrupt commit-graph write (broken parent)' '
                git commit-tree -p "$broken" -m "good commit" "$empty" >good &&
                test_must_fail git commit-graph write --stdin-commits \
                        <good 2>test_err &&
-               test_i18ngrep "unable to parse commit" test_err
+               test_grep "unable to parse commit" test_err
        )
 '
 
@@ -735,7 +742,7 @@ test_expect_success 'corrupt commit-graph write (missing tree)' '
                git commit-tree -p "$broken" -m "good" "$tree" >good &&
                test_must_fail git commit-graph write --stdin-commits \
                        <good 2>test_err &&
-               test_i18ngrep "unable to parse commit" test_err
+               test_grep "unable to parse commit" test_err
        )
 '
 
@@ -815,4 +822,127 @@ test_expect_success 'overflow during generation version upgrade' '
        )
 '
 
+corrupt_chunk () {
+       graph=full/.git/objects/info/commit-graph &&
+       test_when_finished "rm -rf $graph" &&
+       git -C full commit-graph write --reachable &&
+       corrupt_chunk_file $graph "$@"
+}
+
+check_corrupt_chunk () {
+       corrupt_chunk "$@" &&
+       git -C full -c core.commitGraph=false log >expect.out &&
+       git -C full -c core.commitGraph=true log >out 2>err &&
+       test_cmp expect.out out
+}
+
+test_expect_success 'reader notices too-small oid fanout chunk' '
+       # make it big enough that the graph file is plausible,
+       # otherwise we hit an earlier check
+       check_corrupt_chunk OIDF clear $(printf "000000%02x" $(test_seq 250)) &&
+       cat >expect.err <<-\EOF &&
+       error: commit-graph oid fanout chunk is wrong size
+       error: commit-graph required OID fanout chunk missing or corrupted
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'reader notices fanout/lookup table mismatch' '
+       check_corrupt_chunk OIDF 1020 "FFFFFFFF" &&
+       cat >expect.err <<-\EOF &&
+       error: commit-graph OID lookup chunk is the wrong size
+       error: commit-graph required OID lookup chunk missing or corrupted
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'reader notices out-of-bounds fanout' '
+       # Rather than try to corrupt a specific hash, we will just
+       # wreck them all. But we cannot just set them all to 0xFFFFFFFF or
+       # similar, as they are used for hi/lo starts in a binary search (so if
+       # they are identical, that indicates that the search should abort
+       # immediately). Instead, we will give them high values that differ by
+       # 2^24, ensuring that any that are used would cause an out-of-bounds
+       # read.
+       check_corrupt_chunk OIDF 0 $(printf "%02x000000" $(test_seq 0 254)) &&
+       cat >expect.err <<-\EOF &&
+       error: commit-graph fanout values out of order
+       error: commit-graph required OID fanout chunk missing or corrupted
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'reader notices too-small commit data chunk' '
+       check_corrupt_chunk CDAT clear 00000000 &&
+       cat >expect.err <<-\EOF &&
+       error: commit-graph commit data chunk is wrong size
+       error: commit-graph required commit data chunk missing or corrupted
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'reader notices out-of-bounds extra edge' '
+       check_corrupt_chunk EDGE clear &&
+       cat >expect.err <<-\EOF &&
+       error: commit-graph extra-edges pointer out of bounds
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'reader notices too-small generations chunk' '
+       check_corrupt_chunk GDA2 clear 00000000 &&
+       cat >expect.err <<-\EOF &&
+       error: commit-graph generations chunk is wrong size
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'stale commit cannot be parsed when given directly' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A &&
+               test_commit B &&
+               git commit-graph write --reachable &&
+
+               oid=$(git rev-parse B) &&
+               rm .git/objects/"$(test_oid_to_path "$oid")" &&
+
+               # Verify that it is possible to read the commit from the
+               # commit graph when not being paranoid, ...
+               git rev-list B &&
+               # ... but parsing the commit when double checking that
+               # it actually exists in the object database should fail.
+               test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-list -1 B
+       )
+'
+
+test_expect_success 'stale commit cannot be parsed when traversing graph' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+
+               test_commit A &&
+               test_commit B &&
+               test_commit C &&
+               git commit-graph write --reachable &&
+
+               # Corrupt the repository by deleting the intermediate commit
+               # object. Commands should notice that this object is absent and
+               # thus that the repository is corrupt even if the commit graph
+               # exists.
+               oid=$(git rev-parse B) &&
+               rm .git/objects/"$(test_oid_to_path "$oid")" &&
+
+               # Again, we should be able to parse the commit when not
+               # being paranoid about commit graph staleness...
+               git rev-parse HEAD~2 &&
+               # ... but fail when we are paranoid.
+               test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-parse HEAD~2 2>error &&
+               grep "error: commit $oid exists in commit-graph but not in the object database" error
+       )
+'
+
 test_done
index 1bcc02004d7d1acbce8306bdeb5439f4da689ccb..dd09134db03638fd01e73d89acbac45cceaa6e46 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='multi-pack-indexes'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-chunk.sh
 
 GIT_TEST_MULTI_PACK_INDEX=0
 objdir=.git/objects
@@ -279,13 +280,13 @@ test_expect_success 'warn on improper hash version' '
                cd sha1 &&
                mv ../mpi-sha256 .git/objects/pack/multi-pack-index &&
                git log -1 2>err &&
-               test_i18ngrep "multi-pack-index hash version 2 does not match version 1" err
+               test_grep "multi-pack-index hash version 2 does not match version 1" err
        ) &&
        (
                cd sha256 &&
                mv ../mpi-sha1 .git/objects/pack/multi-pack-index &&
                git log -1 2>err &&
-               test_i18ngrep "multi-pack-index hash version 1 does not match version 2" err
+               test_grep "multi-pack-index hash version 1 does not match version 2" err
        )
 '
 
@@ -386,7 +387,7 @@ corrupt_midx_and_verify() {
        printf "$DATA" | dd of="$FILE" bs=1 seek="$POS" conv=notrunc &&
        test_must_fail $COMMAND 2>test_err &&
        grep -v "^+" test_err >err &&
-       test_i18ngrep "$GREPSTR" err
+       test_grep "$GREPSTR" err
 }
 
 test_expect_success 'verify bad signature' '
@@ -438,7 +439,7 @@ test_expect_success 'verify extended chunk count' '
 
 test_expect_success 'verify missing required chunk' '
        corrupt_midx_and_verify $MIDX_BYTE_CHUNK_ID "\01" $objdir \
-               "missing required"
+               "required pack-name chunk missing"
 '
 
 test_expect_success 'verify invalid chunk offset' '
@@ -501,7 +502,7 @@ test_expect_success 'corrupt MIDX is not reused' '
        corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\377" $objdir \
                "incorrect object offset" &&
        git multi-pack-index write 2>err &&
-       test_i18ngrep checksum.mismatch err &&
+       test_grep checksum.mismatch err &&
        git multi-pack-index verify
 '
 
@@ -1031,7 +1032,7 @@ test_expect_success 'load reverse index when missing .idx, .pack' '
 
 test_expect_success 'usage shown without sub-command' '
        test_expect_code 129 git multi-pack-index 2>err &&
-       ! test_i18ngrep "unrecognized subcommand" err
+       ! test_grep "unrecognized subcommand" err
 '
 
 test_expect_success 'complains when run outside of a repository' '
@@ -1055,4 +1056,154 @@ test_expect_success 'repack with delta islands' '
        )
 '
 
+corrupt_chunk () {
+       midx=.git/objects/pack/multi-pack-index &&
+       test_when_finished "rm -rf $midx" &&
+       git repack -ad --write-midx &&
+       corrupt_chunk_file $midx "$@"
+}
+
+test_expect_success 'reader notices too-small oid fanout chunk' '
+       corrupt_chunk OIDF clear 00000000 &&
+       test_must_fail git log 2>err &&
+       cat >expect <<-\EOF &&
+       error: multi-pack-index OID fanout is of the wrong size
+       fatal: multi-pack-index required OID fanout chunk missing or corrupted
+       EOF
+       test_cmp expect err
+'
+
+test_expect_success 'reader notices too-small oid lookup chunk' '
+       corrupt_chunk OIDL clear 00000000 &&
+       test_must_fail git log 2>err &&
+       cat >expect <<-\EOF &&
+       error: multi-pack-index OID lookup chunk is the wrong size
+       fatal: multi-pack-index required OID lookup chunk missing or corrupted
+       EOF
+       test_cmp expect err
+'
+
+test_expect_success 'reader notices too-small pack names chunk' '
+       # There is no NUL to terminate the name here, so the
+       # chunk is too short.
+       corrupt_chunk PNAM clear 70656666 &&
+       test_must_fail git log 2>err &&
+       cat >expect <<-\EOF &&
+       fatal: multi-pack-index pack-name chunk is too short
+       EOF
+       test_cmp expect err
+'
+
+test_expect_success 'reader handles unaligned chunks' '
+       # A 9-byte PNAM means all of the subsequent chunks
+       # will no longer be 4-byte aligned, but it is still
+       # a valid one-pack chunk on its own (it is "foo.pack\0").
+       corrupt_chunk PNAM clear 666f6f2e7061636b00 &&
+       git -c core.multipackindex=false log >expect.out &&
+       git -c core.multipackindex=true log >out 2>err &&
+       test_cmp expect.out out &&
+       cat >expect.err <<-\EOF &&
+       error: chunk id 4f494446 not 4-byte aligned
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'reader notices too-small object offset chunk' '
+       corrupt_chunk OOFF clear 00000000 &&
+       test_must_fail git log 2>err &&
+       cat >expect <<-\EOF &&
+       error: multi-pack-index object offset chunk is the wrong size
+       fatal: multi-pack-index required object offsets chunk missing or corrupted
+       EOF
+       test_cmp expect err
+'
+
+test_expect_success 'reader bounds-checks large offset table' '
+       # re-use the objects64 dir here to cheaply get access to a midx
+       # with large offsets.
+       git init repo &&
+       test_when_finished "rm -rf repo" &&
+       (
+               cd repo &&
+               (cd ../objects64 && pwd) >.git/objects/info/alternates &&
+               git multi-pack-index --object-dir=../objects64 write &&
+               midx=../objects64/pack/multi-pack-index &&
+               corrupt_chunk_file $midx LOFF clear &&
+               # using only %(objectsize) is important here; see the commit
+               # message for more details
+               test_must_fail git cat-file --batch-all-objects \
+                       --batch-check="%(objectsize)" 2>err &&
+               cat >expect <<-\EOF &&
+               fatal: multi-pack-index large offset out of bounds
+               EOF
+               test_cmp expect err
+       )
+'
+
+test_expect_success 'reader notices too-small revindex chunk' '
+       # We only get a revindex with bitmaps (and likewise only
+       # load it when they are asked for).
+       test_config repack.writeBitmaps true &&
+       corrupt_chunk RIDX clear 00000000 &&
+       git -c core.multipackIndex=false rev-list \
+               --all --use-bitmap-index >expect.out &&
+       git -c core.multipackIndex=true rev-list \
+               --all --use-bitmap-index >out 2>err &&
+       test_cmp expect.out out &&
+       cat >expect.err <<-\EOF &&
+       error: multi-pack-index reverse-index chunk is the wrong size
+       warning: multi-pack bitmap is missing required reverse index
+       EOF
+       test_cmp expect.err err
+'
+
+test_expect_success 'reader notices out-of-bounds fanout' '
+       # This is similar to the out-of-bounds fanout test in t5318. The values
+       # in adjacent entries should be large but not identical (they
+       # are used as hi/lo starts for a binary search, which would then abort
+       # immediately).
+       corrupt_chunk OIDF 0 $(printf "%02x000000" $(test_seq 0 254)) &&
+       test_must_fail git log 2>err &&
+       cat >expect <<-\EOF &&
+       error: oid fanout out of order: fanout[254] = fe000000 > 5c = fanout[255]
+       fatal: multi-pack-index required OID fanout chunk missing or corrupted
+       EOF
+       test_cmp expect err
+'
+
+test_expect_success 'bitmapped packs are stored via the BTMP chunk' '
+       test_when_finished "rm -fr repo" &&
+       git init repo &&
+       (
+               cd repo &&
+
+               for i in 1 2 3 4 5
+               do
+                       test_commit "$i" &&
+                       git repack -d || return 1
+               done &&
+
+               find $objdir/pack -type f -name "*.idx" | xargs -n 1 basename |
+               sort >packs &&
+
+               git multi-pack-index write --stdin-packs <packs &&
+               test_must_fail test-tool read-midx --bitmap $objdir 2>err &&
+               cat >expect <<-\EOF &&
+               error: MIDX does not contain the BTMP chunk
+               EOF
+               test_cmp expect err &&
+
+               git multi-pack-index write --stdin-packs --bitmap \
+                       --preferred-pack="$(head -n1 <packs)" <packs  &&
+               test-tool read-midx --bitmap $objdir >actual &&
+               for i in $(test_seq $(wc -l <packs))
+               do
+                       sed -ne "${i}s/\.idx$/\.pack/p" packs &&
+                       echo "  bitmap_pos: $((($i - 1) * 3))" &&
+                       echo "  bitmap_nr: 3" || return 1
+               done >expect &&
+               test_cmp expect actual
+       )
+'
+
 test_done
index 36c4141e67b8f0f5aaf87443ab0c00f2bbd67836..281266f7883b35cbc4dd2c631d645d0d5b430d0c 100755 (executable)
@@ -1,7 +1,10 @@
 #!/bin/sh
 
 test_description='split commit graph'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-chunk.sh
 
 GIT_TEST_COMMIT_GRAPH=0
 GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
@@ -281,7 +284,33 @@ test_expect_success 'verify hashes along chain, even in shallow' '
                corrupt_file "$base_file" $(test_oid shallow) "\01" &&
                test_must_fail git commit-graph verify --shallow 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "incorrect checksum" err
+               test_grep "incorrect checksum" err
+       )
+'
+
+test_expect_success 'verify notices chain slice which is bogus (base)' '
+       git clone --no-hardlinks . verify-chain-bogus-base &&
+       (
+               cd verify-chain-bogus-base &&
+               git commit-graph verify &&
+               base_file=$graphdir/graph-$(sed -n 1p $graphdir/commit-graph-chain).graph &&
+               echo "garbage" >$base_file &&
+               test_must_fail git commit-graph verify 2>test_err &&
+               grep -v "^+" test_err >err &&
+               grep "commit-graph file is too small" err
+       )
+'
+
+test_expect_success 'verify notices chain slice which is bogus (tip)' '
+       git clone --no-hardlinks . verify-chain-bogus-tip &&
+       (
+               cd verify-chain-bogus-tip &&
+               git commit-graph verify &&
+               tip_file=$graphdir/graph-$(sed -n 2p $graphdir/commit-graph-chain).graph &&
+               echo "garbage" >$tip_file &&
+               test_must_fail git commit-graph verify 2>test_err &&
+               grep -v "^+" test_err >err &&
+               grep "commit-graph file is too small" err
        )
 '
 
@@ -291,11 +320,11 @@ test_expect_success 'verify --shallow does not check base contents' '
                cd verify-shallow &&
                git commit-graph verify &&
                base_file=$graphdir/graph-$(head -n 1 $graphdir/commit-graph-chain).graph &&
-               corrupt_file "$base_file" 1000 "\01" &&
+               corrupt_file "$base_file" 1500 "\01" &&
                git commit-graph verify --shallow &&
                test_must_fail git commit-graph verify 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "incorrect checksum" err
+               test_grep "incorrect checksum" err
        )
 '
 
@@ -306,24 +335,51 @@ test_expect_success 'warn on base graph chunk incorrect' '
                git commit-graph verify &&
                base_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
                corrupt_file "$base_file" $(test_oid base) "\01" &&
-               git commit-graph verify --shallow 2>test_err &&
+               test_must_fail git commit-graph verify --shallow 2>test_err &&
+               grep -v "^+" test_err >err &&
+               test_grep "commit-graph chain does not match" err
+       )
+'
+
+test_expect_success 'verify after commit-graph-chain corruption (base)' '
+       git clone --no-hardlinks . verify-chain-base &&
+       (
+               cd verify-chain-base &&
+               corrupt_file "$graphdir/commit-graph-chain" 30 "G" &&
+               test_must_fail git commit-graph verify 2>test_err &&
+               grep -v "^+" test_err >err &&
+               test_grep "invalid commit-graph chain" err &&
+               corrupt_file "$graphdir/commit-graph-chain" 30 "A" &&
+               test_must_fail git commit-graph verify 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "commit-graph chain does not match" err
+               test_grep "unable to find all commit-graph files" err
        )
 '
 
-test_expect_success 'verify after commit-graph-chain corruption' '
-       git clone --no-hardlinks . verify-chain &&
+test_expect_success 'verify after commit-graph-chain corruption (tip)' '
+       git clone --no-hardlinks . verify-chain-tip &&
        (
-               cd verify-chain &&
-               corrupt_file "$graphdir/commit-graph-chain" 60 "G" &&
-               git commit-graph verify 2>test_err &&
+               cd verify-chain-tip &&
+               corrupt_file "$graphdir/commit-graph-chain" 70 "G" &&
+               test_must_fail git commit-graph verify 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "invalid commit-graph chain" err &&
-               corrupt_file "$graphdir/commit-graph-chain" 60 "A" &&
-               git commit-graph verify 2>test_err &&
+               test_grep "invalid commit-graph chain" err &&
+               corrupt_file "$graphdir/commit-graph-chain" 70 "A" &&
+               test_must_fail git commit-graph verify 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "unable to find all commit-graph files" err
+               test_grep "unable to find all commit-graph files" err
+       )
+'
+
+test_expect_success 'verify notices too-short chain file' '
+       git clone --no-hardlinks . verify-chain-short &&
+       (
+               cd verify-chain-short &&
+               git commit-graph verify &&
+               echo "garbage" >$graphdir/commit-graph-chain &&
+               test_must_fail git commit-graph verify 2>test_err &&
+               grep -v "^+" test_err >err &&
+               grep "commit-graph chain file too small" err
        )
 '
 
@@ -338,10 +394,23 @@ test_expect_success 'verify across alternates' '
                test_commit extra &&
                git commit-graph write --reachable --split &&
                tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
-               corrupt_file "$tip_file" 100 "\01" &&
+               corrupt_file "$tip_file" 1500 "\01" &&
                test_must_fail git commit-graph verify --shallow 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "commit-graph has incorrect fanout value" err
+               test_grep "incorrect checksum" err
+       )
+'
+
+test_expect_success 'reader bounds-checks base-graph chunk' '
+       git clone --no-hardlinks . corrupt-base-chunk &&
+       (
+               cd corrupt-base-chunk &&
+               tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
+               corrupt_chunk_file "$tip_file" BASE clear 01020304 &&
+               git -c core.commitGraph=false log >expect.out &&
+               git -c core.commitGraph=true log >out 2>err &&
+               test_cmp expect.out out &&
+               grep "commit-graph base graphs chunk is too small" err
        )
 '
 
@@ -353,7 +422,7 @@ test_expect_success 'add octopus merge' '
        git commit-graph verify --progress 2>err &&
        test_line_count = 1 err &&
        grep "Verifying commits in commit graph: 100% (18/18)" err &&
-       test_i18ngrep ! warning err &&
+       test_grep ! warning err &&
        test_line_count = 3 $graphdir/commit-graph-chain
 '
 
@@ -455,7 +524,7 @@ test_expect_success 'prevent regression for duplicate commits across layers' '
        git init dup &&
        git -C dup commit --allow-empty -m one &&
        git -C dup -c core.commitGraph=false commit-graph write --split=no-merge --reachable 2>err &&
-       test_i18ngrep "attempting to write a commit-graph" err &&
+       test_grep "attempting to write a commit-graph" err &&
        git -C dup commit-graph write --split=no-merge --reachable &&
        git -C dup commit --allow-empty -m two &&
        git -C dup commit-graph write --split=no-merge --reachable &&
index e9c521c061c3eae86619f4eb931d40f5e3127d35..fc6a242b56d88686036ff019003352ee806ef8ce 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='commit graph with 64-bit timestamps'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 if ! test_have_prereq TIME_IS_64BIT || ! test_have_prereq TIME_T_IS_64BIT
@@ -10,6 +12,7 @@ then
 fi
 
 . "$TEST_DIRECTORY"/lib-commit-graph.sh
+. "$TEST_DIRECTORY/lib-chunk.sh"
 
 UNIX_EPOCH_ZERO="@0 +0000"
 FUTURE_DATE="@4147483646 +0000"
@@ -72,4 +75,13 @@ test_expect_success 'single commit with generation data exceeding UINT32_MAX' '
        git -C repo-uint32-max commit-graph verify
 '
 
+test_expect_success 'reader notices out-of-bounds generation overflow' '
+       graph=.git/objects/info/commit-graph &&
+       test_when_finished "rm -rf $graph" &&
+       git commit-graph write --reachable &&
+       corrupt_chunk_file $graph GDO2 clear &&
+       test_must_fail git log 2>err &&
+       grep "commit-graph overflow generation data is too small" err
+'
+
 test_done
index 45667d4999a97f7ec3221a89bcba579ef3871b3d..fc5fedbe9b0c4dd5b59a429a4a877c422f46e602 100755 (executable)
@@ -573,23 +573,54 @@ test_expect_success 'cruft repack with no reachable objects' '
        )
 '
 
-test_expect_success 'cruft repack ignores --max-pack-size' '
+write_blob () {
+       test-tool genrandom "$@" >in &&
+       git hash-object -w -t blob in
+}
+
+find_pack () {
+       for idx in $(ls $packdir/pack-*.idx)
+       do
+               git show-index <$idx >out &&
+               if grep -q "$1" out
+               then
+                       echo $idx
+               fi || return 1
+       done
+}
+
+test_expect_success 'cruft repack with --max-pack-size' '
        git init max-pack-size &&
        (
                cd max-pack-size &&
                test_commit base &&
+
                # two cruft objects which exceed the maximum pack size
-               test-tool genrandom foo 1048576 | git hash-object --stdin -w &&
-               test-tool genrandom bar 1048576 | git hash-object --stdin -w &&
+               foo=$(write_blob foo 1048576) &&
+               bar=$(write_blob bar 1048576) &&
+               test-tool chmtime --get -1000 \
+                       "$objdir/$(test_oid_to_path $foo)" >foo.mtime &&
+               test-tool chmtime --get -2000 \
+                       "$objdir/$(test_oid_to_path $bar)" >bar.mtime &&
                git repack --cruft --max-pack-size=1M &&
                find $packdir -name "*.mtimes" >cruft &&
-               test_line_count = 1 cruft &&
-               test-tool pack-mtimes "$(basename "$(cat cruft)")" >objects &&
-               test_line_count = 2 objects
+               test_line_count = 2 cruft &&
+
+               foo_mtimes="$(basename $(find_pack $foo) .idx).mtimes" &&
+               bar_mtimes="$(basename $(find_pack $bar) .idx).mtimes" &&
+               test-tool pack-mtimes $foo_mtimes >foo.actual &&
+               test-tool pack-mtimes $bar_mtimes >bar.actual &&
+
+               echo "$foo $(cat foo.mtime)" >foo.expect &&
+               echo "$bar $(cat bar.mtime)" >bar.expect &&
+
+               test_cmp foo.expect foo.actual &&
+               test_cmp bar.expect bar.actual &&
+               test "$foo_mtimes" != "$bar_mtimes"
        )
 '
 
-test_expect_success 'cruft repack ignores pack.packSizeLimit' '
+test_expect_success 'cruft repack with pack.packSizeLimit' '
        (
                cd max-pack-size &&
                # repack everything back together to remove the existing cruft
@@ -599,9 +630,12 @@ test_expect_success 'cruft repack ignores pack.packSizeLimit' '
                # ensure the same post condition is met when --max-pack-size
                # would otherwise be inferred from the configuration
                find $packdir -name "*.mtimes" >cruft &&
-               test_line_count = 1 cruft &&
-               test-tool pack-mtimes "$(basename "$(cat cruft)")" >objects &&
-               test_line_count = 2 objects
+               test_line_count = 2 cruft &&
+               for pack in $(cat cruft)
+               do
+                       test-tool pack-mtimes "$(basename $pack)" >objects &&
+                       test_line_count = 1 objects || return 1
+               done
        )
 '
 
index acab31667ad314cbcce59d94032578ed8adbe5b3..2dcf1eeceeb65c4c034cb769f4b1d5fae3b79423 100755 (executable)
@@ -65,7 +65,7 @@ test_expect_success '--stdin-packs is incompatible with --filter' '
                cd stdin-packs &&
                test_must_fail git pack-objects --stdin-packs --stdout \
                        --filter=blob:none </dev/null 2>err &&
-               test_i18ngrep "cannot use --filter with --stdin-packs" err
+               test_grep "cannot use --filter with --stdin-packs" err
        )
 '
 
@@ -74,7 +74,7 @@ test_expect_success '--stdin-packs is incompatible with --revs' '
                cd stdin-packs &&
                test_must_fail git pack-objects --stdin-packs --revs out \
                        </dev/null 2>err &&
-               test_i18ngrep "cannot use internal rev list with --stdin-packs" err
+               test_grep "cannot use internal rev list with --stdin-packs" err
        )
 '
 
diff --git a/t/t5332-multi-pack-reuse.sh b/t/t5332-multi-pack-reuse.sh
new file mode 100755 (executable)
index 0000000..3c20738
--- /dev/null
@@ -0,0 +1,207 @@
+#!/bin/sh
+
+test_description='pack-objects multi-pack reuse'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-bitmap.sh
+
+objdir=.git/objects
+packdir=$objdir/pack
+
+test_pack_reused () {
+       test_trace2_data pack-objects pack-reused "$1"
+}
+
+test_packs_reused () {
+       test_trace2_data pack-objects packs-reused "$1"
+}
+
+
+# pack_position <object> </path/to/pack.idx
+pack_position () {
+       git show-index >objects &&
+       grep "$1" objects | cut -d" " -f1
+}
+
+# test_pack_objects_reused_all <pack-reused> <packs-reused>
+test_pack_objects_reused_all () {
+       : >trace2.txt &&
+       GIT_TRACE2_EVENT="$PWD/trace2.txt" \
+               git pack-objects --stdout --revs --all --delta-base-offset \
+               >/dev/null &&
+
+       test_pack_reused "$1" <trace2.txt &&
+       test_packs_reused "$2" <trace2.txt
+}
+
+# test_pack_objects_reused <pack-reused> <packs-reused>
+test_pack_objects_reused () {
+       : >trace2.txt &&
+       GIT_TRACE2_EVENT="$PWD/trace2.txt" \
+               git pack-objects --stdout --revs >/dev/null &&
+
+       test_pack_reused "$1" <trace2.txt &&
+       test_packs_reused "$2" <trace2.txt
+}
+
+test_expect_success 'preferred pack is reused for single-pack reuse' '
+       test_config pack.allowPackReuse single &&
+
+       for i in A B
+       do
+               test_commit "$i" &&
+               git repack -d || return 1
+       done &&
+
+       git multi-pack-index write --bitmap &&
+
+       test_pack_objects_reused_all 3 1
+'
+
+test_expect_success 'multi-pack reuse is disabled by default' '
+       test_pack_objects_reused_all 3 1
+'
+
+test_expect_success 'feature.experimental implies multi-pack reuse' '
+       test_config feature.experimental true &&
+
+       test_pack_objects_reused_all 6 2
+'
+
+test_expect_success 'multi-pack reuse can be disabled with feature.experimental' '
+       test_config feature.experimental true &&
+       test_config pack.allowPackReuse single &&
+
+       test_pack_objects_reused_all 3 1
+'
+
+test_expect_success 'enable multi-pack reuse' '
+       git config pack.allowPackReuse multi
+'
+
+test_expect_success 'reuse all objects from subset of bitmapped packs' '
+       test_commit C &&
+       git repack -d &&
+
+       git multi-pack-index write --bitmap &&
+
+       cat >in <<-EOF &&
+       $(git rev-parse C)
+       ^$(git rev-parse A)
+       EOF
+
+       test_pack_objects_reused 6 2 <in
+'
+
+test_expect_success 'reuse all objects from all packs' '
+       test_pack_objects_reused_all 9 3
+'
+
+test_expect_success 'reuse objects from first pack with middle gap' '
+       for i in D E F
+       do
+               test_commit "$i" || return 1
+       done &&
+
+       # Set "pack.window" to zero to ensure that we do not create any
+       # deltas, which could alter the amount of pack reuse we perform
+       # (if, for e.g., we are not sending one or more bases).
+       D="$(git -c pack.window=0 pack-objects --all --unpacked $packdir/pack)" &&
+
+       d_pos="$(pack_position $(git rev-parse D) <$packdir/pack-$D.idx)" &&
+       e_pos="$(pack_position $(git rev-parse E) <$packdir/pack-$D.idx)" &&
+       f_pos="$(pack_position $(git rev-parse F) <$packdir/pack-$D.idx)" &&
+
+       # commits F, E, and D, should appear in that order at the
+       # beginning of the pack
+       test $f_pos -lt $e_pos &&
+       test $e_pos -lt $d_pos &&
+
+       # Ensure that the pack we are constructing sorts ahead of any
+       # other packs in lexical/bitmap order by choosing it as the
+       # preferred pack.
+       git multi-pack-index write --bitmap --preferred-pack="pack-$D.idx" &&
+
+       cat >in <<-EOF &&
+       $(git rev-parse E)
+       ^$(git rev-parse D)
+       EOF
+
+       test_pack_objects_reused 3 1 <in
+'
+
+test_expect_success 'reuse objects from middle pack with middle gap' '
+       rm -fr $packdir/multi-pack-index* &&
+
+       # Ensure that the pack we are constructing sort into any
+       # position *but* the first one, by choosing a different pack as
+       # the preferred one.
+       git multi-pack-index write --bitmap --preferred-pack="pack-$A.idx" &&
+
+       cat >in <<-EOF &&
+       $(git rev-parse E)
+       ^$(git rev-parse D)
+       EOF
+
+       test_pack_objects_reused 3 1 <in
+'
+
+test_expect_success 'omit delta with uninteresting base (same pack)' '
+       git repack -adk &&
+
+       test_seq 32 >f &&
+       git add f &&
+       test_tick &&
+       git commit -m "delta" &&
+       delta="$(git rev-parse HEAD)" &&
+
+       test_seq 64 >f &&
+       test_tick &&
+       git commit -a -m "base" &&
+       base="$(git rev-parse HEAD)" &&
+
+       test_commit other &&
+
+       git repack -d &&
+
+       have_delta "$(git rev-parse $delta:f)" "$(git rev-parse $base:f)" &&
+
+       git multi-pack-index write --bitmap &&
+
+       cat >in <<-EOF &&
+       $(git rev-parse other)
+       ^$base
+       EOF
+
+       # We can only reuse the 3 objects corresponding to "other" from
+       # the latest pack.
+       #
+       # This is because even though we want "delta", we do not want
+       # "base", meaning that we have to inflate the delta/base-pair
+       # corresponding to the blob in commit "delta", which bypasses
+       # the pack-reuse mechanism.
+       #
+       # The remaining objects from the other pack are similarly not
+       # reused because their objects are on the uninteresting side of
+       # the query.
+       test_pack_objects_reused 3 1 <in
+'
+
+test_expect_success 'omit delta from uninteresting base (cross pack)' '
+       cat >in <<-EOF &&
+       $(git rev-parse $base)
+       ^$(git rev-parse $delta)
+       EOF
+
+       P="$(git pack-objects --revs $packdir/pack <in)" &&
+
+       git multi-pack-index write --bitmap --preferred-pack="pack-$P.idx" &&
+
+       packs_nr="$(find $packdir -type f -name "pack-*.pack" | wc -l)" &&
+       objects_nr="$(git rev-list --count --all --objects)" &&
+
+       test_pack_objects_reused_all $(($objects_nr - 1)) $packs_nr
+'
+
+test_done
index 001b7a17ad2bb93610198ebf134ccbedc2781f00..d8cadeec73310d36ad11a1427ec44cc9fc2d3a66 100755 (executable)
@@ -123,7 +123,7 @@ remote: STDOUT post-update
 remote: STDERR post-update
 EOF
 test_expect_success 'send-pack stderr contains hook messages' '
-       grep ^remote: send.err | sed "s/ *\$//" >actual &&
+       sed -n "/^remote:/s/ *\$//p" send.err >actual &&
        test_cmp expect actual
 '
 
@@ -133,10 +133,8 @@ test_expect_success 'pre-receive hook that forgets to read its input' '
        EOF
        rm -f victim.git/hooks/update victim.git/hooks/post-update &&
 
-       for v in $(test_seq 100 999)
-       do
-               git branch branch_$v main || return
-       done &&
+       printf "create refs/heads/branch_%d main\n" $(test_seq 100 999) >input &&
+       git update-ref --stdin <input &&
        git push ./victim.git "+refs/heads/*:refs/heads/*"
 '
 
index 5f3ff051ca2fa3bba8beabbcb1491d5e69262f34..ad7f8c6f00202c5ec844108b14a2c1301c185223 100755 (executable)
@@ -17,6 +17,12 @@ test_expect_success 'setup' '
        git checkout A^0 &&
        test_commit E bar E &&
        test_commit F foo F &&
+       git checkout B &&
+       git merge E &&
+       git tag merge-E &&
+       test_commit G G &&
+       test_commit H H &&
+       test_commit I I &&
        git checkout main &&
 
        test_hook --setup post-rewrite <<-EOF
@@ -173,6 +179,48 @@ test_fail_interactive_rebase () {
        )
 }
 
+test_expect_success 'git rebase with failed pick' '
+       clear_hook_input &&
+       cat >todo <<-\EOF &&
+       exec >bar
+       merge -C merge-E E
+       exec >G
+       pick G
+       exec >H 2>I
+       pick H
+       fixup I
+       EOF
+
+       (
+               set_replace_editor todo &&
+               test_must_fail git rebase -i D D 2>err
+       ) &&
+       grep "would be overwritten" err &&
+       rm bar &&
+
+       test_must_fail git rebase --continue 2>err &&
+       grep "would be overwritten" err &&
+       rm G &&
+
+       test_must_fail git rebase --continue 2>err &&
+       grep "would be overwritten" err &&
+       rm H &&
+
+       test_must_fail git rebase --continue 2>err &&
+       grep "would be overwritten" err &&
+       rm I &&
+
+       git rebase --continue &&
+       echo rebase >expected.args &&
+       cat >expected.data <<-EOF &&
+       $(git rev-parse merge-E) $(git rev-parse HEAD~2)
+       $(git rev-parse G) $(git rev-parse HEAD~1)
+       $(git rev-parse H) $(git rev-parse HEAD)
+       $(git rev-parse I) $(git rev-parse HEAD)
+       EOF
+       verify_hook_input
+'
+
 test_expect_success 'git rebase -i (unchanged)' '
        git reset --hard D &&
        clear_hook_input &&
index 6dfc7b1c0da421ac143c68005a90caf6a351fb76..510fff38da9cb68c31a63ef00ece3d8f21c79942 100644 (file)
@@ -18,7 +18,7 @@ test_expect_success "proc-receive: not support push options ($PROTOCOL)" '
                HEAD:refs/for/main/topic \
                >out-$test_count 2>&1 &&
        make_user_friendly_and_stable_output <out-$test_count >actual &&
-       test_i18ngrep "fatal: the receiving end does not support push options" \
+       test_grep "fatal: the receiving end does not support push options" \
                actual &&
 
        test_cmp_refs -C "$upstream" <<-EOF
index 768880b40fbdbbb072ed8b362ea638436583e066..9435457de0cd9baff4ddac0a8363b52b0aa6006d 100644 (file)
@@ -19,7 +19,7 @@ test_expect_success "proc-receive: not support push options ($PROTOCOL/porcelain
                HEAD:refs/for/main/topic \
                >out-$test_count 2>&1 &&
        make_user_friendly_and_stable_output <out-$test_count >actual &&
-       test_i18ngrep "fatal: the receiving end does not support push options" \
+       test_grep "fatal: the receiving end does not support push options" \
                actual &&
 
        test_cmp_refs -C "$upstream" <<-EOF
index d18f2823d86e8b94c5331b1087f962469fc91f2c..1bc15a3f080d3930f4f726ef7ad2bb9de38d368e 100755 (executable)
@@ -132,13 +132,18 @@ test_expect_success 'single branch object count' '
 '
 
 test_expect_success 'single given branch clone' '
-       git clone --single-branch --branch A "file://$(pwd)/." branch-a &&
-       test_must_fail git --git-dir=branch-a/.git rev-parse origin/B
+       GIT_TRACE2_EVENT="$(pwd)/branch-a/trace2_event" \
+               git clone --single-branch --branch A "file://$(pwd)/." branch-a &&
+       test_must_fail git --git-dir=branch-a/.git rev-parse origin/B &&
+       grep \"fetch-info\".*\"haves\":0 branch-a/trace2_event &&
+       grep \"fetch-info\".*\"wants\":1 branch-a/trace2_event
 '
 
 test_expect_success 'clone shallow depth 1' '
-       git clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0 &&
-       test "$(git --git-dir=shallow0/.git rev-list --count HEAD)" = 1
+       GIT_TRACE2_EVENT="$(pwd)/shallow0/trace2_event" \
+               git clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0 &&
+       test "$(git --git-dir=shallow0/.git rev-list --count HEAD)" = 1 &&
+       grep \"fetch-info\".*\"depth\":1 shallow0/trace2_event
 '
 
 test_expect_success 'clone shallow depth 1 with fsck' '
@@ -235,7 +240,10 @@ test_expect_success 'add two more (part 2)' '
 test_expect_success 'deepening pull in shallow repo' '
        (
                cd shallow &&
-               git pull --depth 4 .. B
+               GIT_TRACE2_EVENT="$(pwd)/trace2_event" \
+                       git pull --depth 4 .. B &&
+               grep \"fetch-info\".*\"depth\":4 trace2_event &&
+               grep \"fetch-info\".*\"shallows\":2 trace2_event
        )
 '
 
@@ -306,9 +314,12 @@ test_expect_success 'fetch --depth --no-shallow' '
 test_expect_success 'turn shallow to complete repository' '
        (
                cd shallow &&
-               git fetch --unshallow &&
+               GIT_TRACE2_EVENT="$(pwd)/trace2_event" \
+                       git fetch --unshallow &&
                ! test -f .git/shallow &&
-               git fsck --full
+               git fsck --full &&
+               grep \"fetch-info\".*\"shallows\":2 trace2_event &&
+               grep \"fetch-info\".*\"depth\":2147483647 trace2_event
        )
 '
 
@@ -403,7 +414,7 @@ test_expect_success 'in_vain not triggered before first ACK' '
        test_commit -C myserver bar &&
 
        git -C myclient fetch --progress origin 2>log &&
-       test_i18ngrep "remote: Total 3 " log
+       test_grep "remote: Total 3 " log
 '
 
 test_expect_success 'in_vain resetted upon ACK' '
@@ -435,7 +446,7 @@ test_expect_success 'in_vain resetted upon ACK' '
        # the client reports that first_anotherbranch_commit is common.
        GIT_TRACE2_EVENT="$(pwd)/trace2" git -C myclient fetch --progress origin main 2>log &&
        grep \"key\":\"total_rounds\",\"value\":\"6\" trace2 &&
-       test_i18ngrep "Total 3 " log
+       test_grep "Total 3 " log
 '
 
 test_expect_success 'fetch in shallow repo unreachable shallow objects' '
@@ -459,7 +470,7 @@ test_expect_success 'fetch creating new shallow root' '
                git fetch --depth=1 --progress 2>actual &&
                # This should fetch only the empty commit, no tree or
                # blob objects
-               test_i18ngrep "remote: Total 1" actual
+               test_grep "remote: Total 1" actual
        )
 '
 
@@ -694,7 +705,7 @@ test_expect_success 'fetch-pack cannot fetch a raw sha1 that is not advertised a
        # unadvertised objects, so restrict this test to v0.
        test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -C client fetch-pack ../server \
                $(git -C server rev-parse refs/heads/main^) 2>err &&
-       test_i18ngrep "Server does not allow request for unadvertised object" err
+       test_grep "Server does not allow request for unadvertised object" err
 '
 
 check_prot_path () {
@@ -826,13 +837,15 @@ test_expect_success 'clone shallow since ...' '
 '
 
 test_expect_success 'fetch shallow since ...' '
-       git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
+       GIT_TRACE2_EVENT=$(pwd)/shallow11/trace2_event \
+               git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
        git -C shallow11 log --pretty=tformat:%s origin/main >actual &&
        cat >expected <<-\EOF &&
        three
        two
        EOF
-       test_cmp expected actual
+       test_cmp expected actual &&
+       grep \"fetch-info\".*\"deepen-since\":true shallow11/trace2_event
 '
 
 test_expect_success 'clone shallow since selects no commits' '
@@ -987,13 +1000,16 @@ test_expect_success 'filtering by size' '
        test_config -C server uploadpack.allowfilter 1 &&
 
        test_create_repo client &&
-       git -C client fetch-pack --filter=blob:limit=0 ../server HEAD &&
+       GIT_TRACE2_EVENT=$(pwd)/client/trace2_event \
+               git -C client fetch-pack --filter=blob:limit=0 ../server HEAD &&
 
        # Ensure that object is not inadvertently fetched
        commit=$(git -C server rev-parse HEAD) &&
        blob=$(git hash-object server/one.t) &&
        git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
-       ! grep "$blob" oids
+       ! grep "$blob" oids &&
+
+       grep \"fetch-info\".*\"filter\":\"blob:limit\" client/trace2_event
 '
 
 test_expect_success 'filtering by size has no effect if support for it is not advertised' '
@@ -1010,7 +1026,7 @@ test_expect_success 'filtering by size has no effect if support for it is not ad
        git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
        grep "$blob" oids &&
 
-       test_i18ngrep "filtering not recognized by server" err
+       test_grep "filtering not recognized by server" err
 '
 
 fetch_filter_blob_limit_zero () {
index 0b8ab4afdbe9a0bd0aa304770b6db8f6d303ec9b..138e6778a477650ecbe2dc3e480c5fe83d4bb485 100755 (executable)
@@ -144,7 +144,7 @@ test_expect_success 'setup bogus commit' '
 
 test_expect_success 'fsck with no skipList input' '
        test_must_fail git fsck 2>err &&
-       test_i18ngrep "missingEmail" err
+       test_grep "missingEmail" err
 '
 
 test_expect_success 'setup sorted and unsorted skipLists' '
@@ -169,9 +169,9 @@ test_expect_success 'fsck with unsorted skipList' '
 test_expect_success 'fsck with invalid or bogus skipList input' '
        git -c fsck.skipList=/dev/null -c fsck.missingEmail=ignore fsck &&
        test_must_fail git -c fsck.skipList=does-not-exist -c fsck.missingEmail=ignore fsck 2>err &&
-       test_i18ngrep "could not open.*: does-not-exist" err &&
+       test_grep "could not open.*: does-not-exist" err &&
        test_must_fail git -c fsck.skipList=.git/config -c fsck.missingEmail=ignore fsck 2>err &&
-       test_i18ngrep "invalid object name: \[core\]" err
+       test_grep "invalid object name: \[core\]" err
 '
 
 test_expect_success 'fsck with other accepted skipList input (comments & empty lines)' '
@@ -180,14 +180,14 @@ test_expect_success 'fsck with other accepted skipList input (comments & empty l
        $(test_oid 001)
        EOF
        test_must_fail git -c fsck.skipList=SKIP.with-comment fsck 2>err-with-comment &&
-       test_i18ngrep "missingEmail" err-with-comment &&
+       test_grep "missingEmail" err-with-comment &&
        cat >SKIP.with-empty-line <<-EOF &&
        $(test_oid 001)
 
        $(test_oid 002)
        EOF
        test_must_fail git -c fsck.skipList=SKIP.with-empty-line fsck 2>err-with-empty-line &&
-       test_i18ngrep "missingEmail" err-with-empty-line
+       test_grep "missingEmail" err-with-empty-line
 '
 
 test_expect_success 'fsck no garbage output from comments & empty lines errors' '
@@ -198,7 +198,7 @@ test_expect_success 'fsck no garbage output from comments & empty lines errors'
 test_expect_success 'fsck with invalid abbreviated skipList input' '
        echo $commit | test_copy_bytes 20 >SKIP.abbreviated &&
        test_must_fail git -c fsck.skipList=SKIP.abbreviated fsck 2>err-abbreviated &&
-       test_i18ngrep "^fatal: invalid object name: " err-abbreviated
+       test_grep "^fatal: invalid object name: " err-abbreviated
 '
 
 test_expect_success 'fsck with exhaustive accepted skipList input (various types of comments etc.)' '
@@ -231,10 +231,10 @@ test_expect_success 'push with receive.fsck.skipList' '
        test_must_fail git push --porcelain dst bogus &&
        git --git-dir=dst/.git config receive.fsck.skipList does-not-exist &&
        test_must_fail git push --porcelain dst bogus 2>err &&
-       test_i18ngrep "could not open.*: does-not-exist" err &&
+       test_grep "could not open.*: does-not-exist" err &&
        git --git-dir=dst/.git config receive.fsck.skipList config &&
        test_must_fail git push --porcelain dst bogus 2>err &&
-       test_i18ngrep "invalid object name: \[core\]" err &&
+       test_grep "invalid object name: \[core\]" err &&
 
        git --git-dir=dst/.git config receive.fsck.skipList SKIP &&
        git push --porcelain dst bogus
@@ -260,10 +260,10 @@ test_expect_success 'fetch with fetch.fsck.skipList' '
        test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" $refspec &&
        git --git-dir=dst/.git config fetch.fsck.skipList does-not-exist &&
        test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" $refspec 2>err &&
-       test_i18ngrep "could not open.*: does-not-exist" err &&
+       test_grep "could not open.*: does-not-exist" err &&
        git --git-dir=dst/.git config fetch.fsck.skipList dst/.git/config &&
        test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" $refspec 2>err &&
-       test_i18ngrep "invalid object name: \[core\]" err &&
+       test_grep "invalid object name: \[core\]" err &&
 
        git --git-dir=dst/.git config fetch.fsck.skipList dst/.git/SKIP &&
        git --git-dir=dst/.git fetch "file://$(pwd)" $refspec
@@ -271,7 +271,7 @@ test_expect_success 'fetch with fetch.fsck.skipList' '
 
 test_expect_success 'fsck.<unknownmsg-id> dies' '
        test_must_fail git -c fsck.whatEver=ignore fsck 2>err &&
-       test_i18ngrep "Unhandled message id: whatever" err
+       test_grep "Unhandled message id: whatever" err
 '
 
 test_expect_success 'push with receive.fsck.missingEmail=warn' '
@@ -293,7 +293,7 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
                receive.fsck.missingEmail warn &&
        git push --porcelain dst bogus >act 2>&1 &&
        grep "missingEmail" act &&
-       test_i18ngrep "skipping unknown msg id.*whatever" act &&
+       test_grep "skipping unknown msg id.*whatever" act &&
        git --git-dir=dst/.git branch -D bogus &&
        git --git-dir=dst/.git config --add \
                receive.fsck.missingEmail ignore &&
@@ -321,7 +321,7 @@ test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
                fetch.fsck.missingEmail warn &&
        git --git-dir=dst/.git fetch "file://$(pwd)" $refspec >act 2>&1 &&
        grep "missingEmail" act &&
-       test_i18ngrep "Skipping unknown msg id.*whatever" act &&
+       test_grep "Skipping unknown msg id.*whatever" act &&
        rm -rf dst &&
        git init dst &&
        git --git-dir=dst/.git config fetch.fsckobjects true &&
index 43b7bcd7159c252ff7a2e68dc28fc617649bb658..7789ff12c4b8f80f8ad4385932c342c7c9ae7d00 100755 (executable)
@@ -1075,7 +1075,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
                cd eight &&
                git remote prune origin
        ) >err 2>&1 &&
-       test_i18ngrep "has become dangling" err &&
+       test_grep "has become dangling" err &&
 
        : And the dangling symref will not cause other annoying errors &&
        (
@@ -1087,7 +1087,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
                cd eight &&
                test_must_fail git branch nomore origin
        ) 2>err &&
-       test_i18ngrep "dangling symref" err
+       test_grep "dangling symref" err
 '
 
 test_expect_success 'show empty remote' '
@@ -1419,7 +1419,7 @@ test_expect_success 'extra args: setup' '
 test_extra_arg () {
        test_expect_success "extra args: $*" "
                test_must_fail git remote $* bogus_extra_arg 2>actual &&
-               test_i18ngrep '^usage:' actual
+               test_grep '^usage:' actual
        "
 }
 
@@ -1453,12 +1453,12 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' '
                                oid=$(git rev-parse some-tag^{$type})
                        fi &&
                        test_must_fail git push origin $oid:dst 2>err &&
-                       test_i18ngrep "error: The destination you" err &&
-                       test_i18ngrep "hint: Did you mean" err &&
+                       test_grep "error: The destination you" err &&
+                       test_grep "hint: Did you mean" err &&
                        test_must_fail git -c advice.pushUnqualifiedRefName=false \
                                push origin $oid:dst 2>err &&
-                       test_i18ngrep "error: The destination you" err &&
-                       test_i18ngrep ! "hint: Did you mean" err ||
+                       test_grep "error: The destination you" err &&
+                       test_grep ! "hint: Did you mean" err ||
                        exit 1
                done
        )
@@ -1479,16 +1479,16 @@ test_expect_success 'refs/remotes/* <src> refspec and unqualified <dst> DWIM and
                git fetch --no-tags two &&
 
                test_must_fail git push origin refs/remotes/two/another:dst 2>err &&
-               test_i18ngrep "error: The destination you" err &&
+               test_grep "error: The destination you" err &&
 
                test_must_fail git push origin refs/remotes/tags-from-two/my-tag:dst-tag 2>err &&
-               test_i18ngrep "error: The destination you" err &&
+               test_grep "error: The destination you" err &&
 
                test_must_fail git push origin refs/remotes/trees-from-two/my-head-tree:dst-tree 2>err &&
-               test_i18ngrep "error: The destination you" err &&
+               test_grep "error: The destination you" err &&
 
                test_must_fail git push origin refs/remotes/blobs-from-two/my-file-blob:dst-blob 2>err &&
-               test_i18ngrep "error: The destination you" err
+               test_grep "error: The destination you" err
        )
 '
 
index 4f289063ced85dc2beabde28788c191a20bf9634..33d34d5ae9e953e29f6dba8badb16922072cd76c 100755 (executable)
@@ -169,6 +169,7 @@ test_expect_success REFFILES 'fetch --prune fails to delete branches' '
        git clone . prune-fail &&
        cd prune-fail &&
        git update-ref refs/remotes/origin/extrabranch main &&
+       git pack-refs --all &&
        : this will prevent --prune from locking packed-refs for deleting refs, but adding loose refs still succeeds  &&
        >.git/packed-refs.new &&
 
@@ -415,9 +416,9 @@ test_expect_success 'fetch uses remote ref names to describe new refs' '
        (
                cd descriptive &&
                git fetch o 2>actual &&
-               test_i18ngrep "new branch.* -> refs/crazyheads/descriptive-branch$" actual &&
-               test_i18ngrep "new tag.* -> descriptive-tag$" actual &&
-               test_i18ngrep "new ref.* -> crazy$" actual
+               test_grep "new branch.* -> refs/crazyheads/descriptive-branch$" actual &&
+               test_grep "new tag.* -> descriptive-tag$" actual &&
+               test_grep "new ref.* -> crazy$" actual
        ) &&
        git checkout main
 '
@@ -802,7 +803,8 @@ test_expect_success 'fetch.writeCommitGraph with submodules' '
                cd super-clone &&
                rm -rf .git/objects/info &&
                git -c fetch.writeCommitGraph=true fetch origin &&
-               test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain
+               test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain &&
+               git -c fetch.writeCommitGraph=true fetch --recurse-submodules origin
        )
 '
 
@@ -1113,7 +1115,7 @@ test_expect_success 'fetching with auto-gc does not lock up' '
                git config gc.autoPackLimit 1 &&
                git config gc.autoDetach false &&
                GIT_ASK_YESNO="$D/askyesno" git fetch --verbose >fetch.out 2>&1 &&
-               test_i18ngrep "Auto packing the repository" fetch.out &&
+               test_grep "Auto packing the repository" fetch.out &&
                ! grep "Should I try again" fetch.out
        )
 '
@@ -1127,6 +1129,52 @@ do
        '
 done
 
+test_expect_success 'prepare source branch' '
+       echo one >onebranch &&
+       git checkout --orphan onebranch &&
+       git rm --cached -r . &&
+       git add onebranch &&
+       git commit -m onebranch &&
+       git rev-list --objects onebranch -- >actual &&
+       # 3 objects should be created, at least ...
+       test 3 -le $(wc -l <actual)
+'
+
+validate_store_type () {
+       git -C dest count-objects -v >actual &&
+       case "$store_type" in
+       packed)
+               grep "^count: 0$" actual ;;
+       loose)
+               grep "^packs: 0$" actual ;;
+       esac || {
+               echo "store_type is $store_type"
+               cat actual
+               false
+       }
+}
+
+test_unpack_limit () {
+       store_type=$1
+
+       case "$store_type" in
+       packed) fetch_limit=1 transfer_limit=10000 ;;
+       loose) fetch_limit=10000 transfer_limit=1 ;;
+       esac
+
+       test_expect_success "fetch trumps transfer limit" '
+               rm -fr dest &&
+               git --bare init dest &&
+               git -C dest config fetch.unpacklimit $fetch_limit &&
+               git -C dest config transfer.unpacklimit $transfer_limit &&
+               git -C dest fetch .. onebranch &&
+               validate_store_type
+       '
+}
+
+test_unpack_limit packed
+test_unpack_limit loose
+
 setup_negotiation_tip () {
        SERVER="$1"
        URL="$2"
index 151c76eb09b7831edd803e6cad27dddc4b5489ec..5dbe107ce88f98e75341d5ba3b25ae4f8d10d35f 100755 (executable)
@@ -320,7 +320,7 @@ test_expect_success 'ls-remote works outside repository' '
 test_expect_success 'ls-remote --sort fails gracefully outside repository' '
        # Use a sort key that requires access to the referenced objects.
        nongit test_must_fail git ls-remote --sort=authordate "$TRASH_DIRECTORY" 2>err &&
-       test_i18ngrep "^fatal: not a git repository, but the field '\''authordate'\'' requires access to object data" err
+       test_grep "^fatal: not a git repository, but the field '\''authordate'\'' requires access to object data" err
 '
 
 test_expect_success 'ls-remote patterns work with all protocol versions' '
index 98f034aa77bb243492ea1232549f7d1ec195a152..25772c85c5a9a89bf247cfa41cf9d8b127572cd8 100755 (executable)
@@ -24,6 +24,15 @@ setup_repository () {
        )
 }
 
+setup_test_clone () {
+       test_dir="$1" &&
+       git clone one "$test_dir" &&
+       for r in one two three
+       do
+               git -C "$test_dir" remote add "$r" "../$r" || return 1
+       done
+}
+
 test_expect_success setup '
        setup_repository one &&
        setup_repository two &&
@@ -200,8 +209,8 @@ test_expect_success 'parallel' '
        test_must_fail env GIT_TRACE="$PWD/trace" \
                git fetch --jobs=2 --multiple one two 2>err &&
        grep "preparing to run up to 2 tasks" trace &&
-       test_i18ngrep "could not fetch .one.*128" err &&
-       test_i18ngrep "could not fetch .two.*128" err
+       test_grep "could not fetch .one.*128" err &&
+       test_grep "could not fetch .two.*128" err
 '
 
 test_expect_success 'git fetch --multiple --jobs=0 picks a default' '
@@ -209,4 +218,156 @@ test_expect_success 'git fetch --multiple --jobs=0 picks a default' '
         git fetch --multiple --jobs=0)
 '
 
+create_fetch_all_expect () {
+       cat >expect <<-\EOF
+         one/main
+         one/side
+         origin/HEAD -> origin/main
+         origin/main
+         origin/side
+         three/another
+         three/main
+         three/side
+         two/another
+         two/main
+         two/side
+       EOF
+}
+
+for fetch_all in true false
+do
+       test_expect_success "git fetch --all (works with fetch.all = $fetch_all)" '
+               test_dir="test_fetch_all_$fetch_all" &&
+               setup_test_clone "$test_dir" &&
+               (
+                       cd "$test_dir" &&
+                       git config fetch.all $fetch_all &&
+                       git fetch --all &&
+                       create_fetch_all_expect &&
+                       git branch -r >actual &&
+                       test_cmp expect actual
+               )
+       '
+done
+
+test_expect_success 'git fetch (fetch all remotes with fetch.all = true)' '
+       setup_test_clone test9 &&
+       (
+               cd test9 &&
+               git config fetch.all true &&
+               git fetch &&
+               git branch -r >actual &&
+               create_fetch_all_expect &&
+               test_cmp expect actual
+       )
+'
+
+create_fetch_one_expect () {
+       cat >expect <<-\EOF
+         one/main
+         one/side
+         origin/HEAD -> origin/main
+         origin/main
+         origin/side
+       EOF
+}
+
+test_expect_success 'git fetch one (explicit remote overrides fetch.all)' '
+       setup_test_clone test10 &&
+       (
+               cd test10 &&
+               git config fetch.all true &&
+               git fetch one &&
+               create_fetch_one_expect &&
+               git branch -r >actual &&
+               test_cmp expect actual
+       )
+'
+
+create_fetch_two_as_origin_expect () {
+       cat >expect <<-\EOF
+         origin/HEAD -> origin/main
+         origin/another
+         origin/main
+         origin/side
+       EOF
+}
+
+test_expect_success 'git config fetch.all false (fetch only default remote)' '
+       setup_test_clone test11 &&
+       (
+               cd test11 &&
+               git config fetch.all false &&
+               git remote set-url origin ../two &&
+               git fetch &&
+               create_fetch_two_as_origin_expect &&
+               git branch -r >actual &&
+               test_cmp expect actual
+       )
+'
+
+for fetch_all in true false
+do
+       test_expect_success "git fetch --no-all (fetch only default remote with fetch.all = $fetch_all)" '
+               test_dir="test_no_all_fetch_all_$fetch_all" &&
+               setup_test_clone "$test_dir" &&
+               (
+                       cd "$test_dir" &&
+                       git config fetch.all $fetch_all &&
+                       git remote set-url origin ../two &&
+                       git fetch --no-all &&
+                       create_fetch_two_as_origin_expect &&
+                       git branch -r >actual &&
+                       test_cmp expect actual
+               )
+       '
+done
+
+test_expect_success 'git fetch --no-all (fetch only default remote without fetch.all)' '
+       setup_test_clone test12 &&
+       (
+               cd test12 &&
+               git config --unset-all fetch.all || true &&
+               git remote set-url origin ../two &&
+               git fetch --no-all &&
+               create_fetch_two_as_origin_expect &&
+               git branch -r >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'git fetch --all --no-all (fetch only default remote)' '
+       setup_test_clone test13 &&
+       (
+               cd test13 &&
+               git remote set-url origin ../two &&
+               git fetch --all --no-all &&
+               create_fetch_two_as_origin_expect &&
+               git branch -r >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'git fetch --no-all one (fetch only explicit remote)' '
+       setup_test_clone test14 &&
+       (
+               cd test14 &&
+               git fetch --no-all one &&
+               create_fetch_one_expect &&
+               git branch -r >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'git fetch --no-all --all (fetch all remotes)' '
+       setup_test_clone test15 &&
+       (
+               cd test15 &&
+               git fetch --no-all --all &&
+               create_fetch_all_expect &&
+               git branch -r >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_done
index 87163d77456e5c2738c48dcdde282e2ea7b65a4d..2e7c0e1648f7aa4b879edcbe7cf15cde7583ae65 100755 (executable)
@@ -227,7 +227,7 @@ test_expect_success 'push with negotiation proceeds anyway even if negotiation f
        GIT_TEST_PROTOCOL_VERSION=0 GIT_TRACE2_EVENT="$(pwd)/event" \
                git -c push.negotiate=1 push testrepo refs/heads/main:refs/remotes/origin/main 2>err &&
        grep_wrote 5 event && # 2 commits, 2 trees, 1 blob
-       test_i18ngrep "push negotiation failed" err
+       test_grep "push negotiation failed" err
 '
 
 test_expect_success 'push with negotiation does not attempt to fetch submodules' '
@@ -1267,7 +1267,7 @@ test_expect_success 'fetch exact SHA1' '
                # fetching the hidden object should fail by default
                test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \
                        git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err &&
-               test_i18ngrep "Server does not allow request for unadvertised object" err &&
+               test_grep "Server does not allow request for unadvertised object" err &&
                test_must_fail git rev-parse --verify refs/heads/copy &&
 
                # the server side can allow it to succeed
@@ -1369,7 +1369,7 @@ do
                                git fetch ../testrepo/.git $SHA1_3 2>err &&
                        # ideally we would insist this be on a "remote error:"
                        # line, but it is racy; see the commit message
-                       test_i18ngrep "not our ref.*$SHA1_3\$" err
+                       test_grep "not our ref.*$SHA1_3\$" err
                )
        '
 done
@@ -1407,7 +1407,7 @@ test_expect_success 'peeled advertisements are not considered ref tips' '
        oid=$(git -C testrepo rev-parse mytag^{commit}) &&
        test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \
                git fetch testrepo $oid 2>err &&
-       test_i18ngrep "Server does not allow request for unadvertised object" err
+       test_grep "Server does not allow request for unadvertised object" err
 '
 
 test_expect_success 'pushing a specific ref applies remote.$name.push as refmap' '
index 0b72112fb10759bb1d5e9de912ae1b2038df1d00..47534f1062d203a9b823d545740004e2002162ff 100755 (executable)
@@ -31,7 +31,7 @@ test_pull_autostash_fail () {
        echo dirty >new_file &&
        git add new_file &&
        test_must_fail git pull "$@" . copy 2>err &&
-       test_i18ngrep -E "uncommitted changes.|overwritten by merge:" err
+       test_grep -E "uncommitted changes.|overwritten by merge:" err
 }
 
 test_expect_success setup '
@@ -151,7 +151,7 @@ test_expect_success 'fail if wildcard spec does not match any refs' '
        echo file >expect &&
        test_cmp expect file &&
        test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err &&
-       test_i18ngrep "no candidates for merging" err &&
+       test_grep "no candidates for merging" err &&
        test_cmp expect file
 '
 
@@ -164,7 +164,7 @@ test_expect_success 'fail if no branches specified with non-default remote' '
        test_cmp expect file &&
        test_config branch.test.remote origin &&
        test_must_fail git pull test_remote 2>err &&
-       test_i18ngrep "specify a branch on the command line" err &&
+       test_grep "specify a branch on the command line" err &&
        test_cmp expect file
 '
 
@@ -176,7 +176,7 @@ test_expect_success 'fail if not on a branch' '
        echo file >expect &&
        test_cmp expect file &&
        test_must_fail git pull 2>err &&
-       test_i18ngrep "not currently on a branch" err &&
+       test_grep "not currently on a branch" err &&
        test_cmp expect file
 '
 
@@ -189,7 +189,7 @@ test_expect_success 'fail if no configuration for current branch' '
        echo file >expect &&
        test_cmp expect file &&
        test_must_fail git pull 2>err &&
-       test_i18ngrep "no tracking information" err &&
+       test_grep "no tracking information" err &&
        test_cmp expect file
 '
 
@@ -202,7 +202,7 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '
        echo file >expect &&
        test_cmp expect file &&
        test_must_fail git pull --all 2>err &&
-       test_i18ngrep "There is no tracking information" err &&
+       test_grep "There is no tracking information" err &&
        test_cmp expect file
 '
 
@@ -214,7 +214,7 @@ test_expect_success 'fail if upstream branch does not exist' '
        echo file >expect &&
        test_cmp expect file &&
        test_must_fail git pull 2>err &&
-       test_i18ngrep "no such ref was fetched" err &&
+       test_grep "no such ref was fetched" err &&
        test_cmp expect file
 '
 
@@ -248,13 +248,13 @@ test_expect_success 'fail if the index has unresolved entries' '
        test_file_not_empty unmerged &&
        cp file expected &&
        test_must_fail git pull . second 2>err &&
-       test_i18ngrep "Pulling is not possible because you have unmerged files." err &&
+       test_grep "Pulling is not possible because you have unmerged files." err &&
        test_cmp expected file &&
        git add file &&
        git ls-files -u >unmerged &&
        test_must_be_empty unmerged &&
        test_must_fail git pull . second 2>err &&
-       test_i18ngrep "You have not concluded your merge" err &&
+       test_grep "You have not concluded your merge" err &&
        test_cmp expected file
 '
 
@@ -264,7 +264,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '
        echo file >expect &&
        test_cmp expect file &&
        git pull . second:third 2>err &&
-       test_i18ngrep "fetch updated the current branch head" err &&
+       test_grep "fetch updated the current branch head" err &&
        echo modified >expect &&
        test_cmp expect file &&
        test_cmp_rev third second
@@ -277,7 +277,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '
        test_cmp expect file &&
        echo conflict >file &&
        test_must_fail git pull . second:third 2>err &&
-       test_i18ngrep "Cannot fast-forward your working tree" err &&
+       test_grep "Cannot fast-forward your working tree" err &&
        echo conflict >expect &&
        test_cmp expect file &&
        test_cmp_rev third second
@@ -375,7 +375,7 @@ test_expect_success '--rebase with conflicts shows advice' '
        test_tick &&
        git commit -m "Create conflict" seq.txt &&
        test_must_fail git pull --rebase . seq 2>err >out &&
-       test_i18ngrep "Resolve all conflicts manually" err
+       test_grep "Resolve all conflicts manually" err
 '
 
 test_expect_success 'failed --rebase shows advice' '
@@ -389,14 +389,14 @@ test_expect_success 'failed --rebase shows advice' '
        git checkout -f -b fails-to-rebase HEAD^ &&
        test_commit v2-without-cr file "2" file2-lf &&
        test_must_fail git pull --rebase . diverging 2>err >out &&
-       test_i18ngrep "Resolve all conflicts manually" err
+       test_grep "Resolve all conflicts manually" err
 '
 
 test_expect_success '--rebase fails with multiple branches' '
        git reset --hard before-rebase &&
        test_must_fail git pull --rebase . copy main 2>err &&
        test_cmp_rev HEAD before-rebase &&
-       test_i18ngrep "Cannot rebase onto multiple branches" err &&
+       test_grep "Cannot rebase onto multiple branches" err &&
        echo modified >expect &&
        git show HEAD:file >actual &&
        test_cmp expect actual
@@ -520,7 +520,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '
        echo new >expect &&
        git show HEAD:file2 >actual &&
        test_cmp expect actual &&
-       test_i18ngrep "ignoring --verify-signatures for rebase" err
+       test_grep "ignoring --verify-signatures for rebase" err
 '
 
 test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
@@ -530,7 +530,7 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
        echo new >expect &&
        git show HEAD:file2 >actual &&
        test_cmp expect actual &&
-       test_i18ngrep ! "verify-signatures" err
+       test_grep ! "verify-signatures" err
 '
 
 # add a feature branch, keep-merge, that is merged into main, so the
@@ -740,7 +740,7 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
                test_cmp expect actual &&
                git show :staged-file >actual &&
                test_cmp expect actual &&
-               test_i18ngrep "unborn branch with changes added to the index" err
+               test_grep "unborn branch with changes added to the index" err
        )
 '
 
index 264de29c35c11cbe09d31d57629aabaae0423b35..db00c4336b1671158f69b9711e247d9300b5cac8 100755 (executable)
@@ -5,6 +5,7 @@ test_description='pull options'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
@@ -93,7 +94,7 @@ test_expect_success 'git pull --no-write-fetch-head fails' '
        (cd clonedwfh && git init &&
        test_expect_code 129 git pull --no-write-fetch-head "../parent" >out 2>err &&
        test_must_be_empty out &&
-       test_i18ngrep "no-write-fetch-head" err)
+       test_grep "no-write-fetch-head" err)
 '
 
 test_expect_success 'git pull --force' '
@@ -142,7 +143,7 @@ test_expect_success 'git pull --dry-run' '
                cd clonedry &&
                git pull --dry-run ../parent &&
                test_path_is_missing .git/FETCH_HEAD &&
-               test_path_is_missing .git/refs/heads/main &&
+               test_ref_missing refs/heads/main &&
                test_path_is_missing .git/index &&
                test_path_is_missing file
        )
@@ -156,7 +157,7 @@ test_expect_success 'git pull --all --dry-run' '
                git remote add origin ../parent &&
                git pull --all --dry-run &&
                test_path_is_missing .git/FETCH_HEAD &&
-               test_path_is_missing .git/refs/remotes/origin/main &&
+               test_ref_missing refs/remotes/origin/main &&
                test_path_is_missing .git/index &&
                test_path_is_missing file
        )
index 1b8d609879504daa09bd62826f223e7eb55bf0d5..1f859ade16251d6e2c61dd84ebb14aa35bc41ca1 100755 (executable)
@@ -87,7 +87,7 @@ test_expect_success TTY 'progress messages go to tty' '
        ensure_fresh_upstream &&
 
        test_terminal git push -u upstream main >out 2>err &&
-       test_i18ngrep "Writing objects" err
+       test_grep "Writing objects" err
 '
 
 test_expect_success 'progress messages do not go to non-tty' '
@@ -95,7 +95,7 @@ test_expect_success 'progress messages do not go to non-tty' '
 
        # skip progress messages, since stderr is non-tty
        git push -u upstream main >out 2>err &&
-       test_i18ngrep ! "Writing objects" err
+       test_grep ! "Writing objects" err
 '
 
 test_expect_success 'progress messages go to non-tty (forced)' '
@@ -103,22 +103,22 @@ test_expect_success 'progress messages go to non-tty (forced)' '
 
        # force progress messages to stderr, even though it is non-tty
        git push -u --progress upstream main >out 2>err &&
-       test_i18ngrep "Writing objects" err
+       test_grep "Writing objects" err
 '
 
 test_expect_success TTY 'push -q suppresses progress' '
        ensure_fresh_upstream &&
 
        test_terminal git push -u -q upstream main >out 2>err &&
-       test_i18ngrep ! "Writing objects" err
+       test_grep ! "Writing objects" err
 '
 
 test_expect_success TTY 'push --no-progress suppresses progress' '
        ensure_fresh_upstream &&
 
        test_terminal git push -u --no-progress upstream main >out 2>err &&
-       test_i18ngrep ! "Unpacking objects" err &&
-       test_i18ngrep ! "Writing objects" err
+       test_grep ! "Unpacking objects" err &&
+       test_grep ! "Writing objects" err
 '
 
 test_expect_success TTY 'quiet push' '
index 26e933f93ae7f72261046495f25f63af8c31349d..5e566205ba4b95830bd97c97b0092cb4a3356304 100755 (executable)
@@ -771,7 +771,7 @@ test_expect_success 'fetching submodule into a broken repository' '
        git -C dst fetch --recurse-submodules &&
 
        # Break the receiving submodule
-       rm -f dst/sub/.git/HEAD &&
+       rm -r dst/sub/.git/objects &&
 
        # NOTE: without the fix the following tests will recurse forever!
        # They should terminate with an error.
index 284e20fefda861f450d79a3f849cc9ddc2afa65b..14f7eced9a0b43bf8a565e3817f2ef802389a3ba 100755 (executable)
@@ -179,7 +179,7 @@ test_expect_success 'push from/to new branch succeeds with simple if push.autoSe
 test_expect_success '"matching" fails if none match' '
        git init --bare empty &&
        test_must_fail git push empty : 2>actual &&
-       test_i18ngrep "Perhaps you should specify a branch" actual
+       test_grep "Perhaps you should specify a branch" actual
 '
 
 test_expect_success 'push ambiguously named branch with upstream, matching and simple' '
index 7c1460eaa99865306ddfb5254584eba275e17a21..7172780d5502a9768e00ed84c65f13d618ad0dc8 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='errors in upload-pack'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 D=$(pwd)
@@ -35,8 +36,8 @@ test_expect_success 'upload-pack fails due to error in pack-objects packing' '
        printf "%04xwant %s\n00000009done\n0000" \
                $(($hexsz + 10)) $head >input &&
        test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
-       test_i18ngrep "unable to read" output.err &&
-       test_i18ngrep "pack-objects died" output.err
+       test_grep "unable to read" output.err &&
+       test_grep "pack-objects died" output.err
 '
 
 test_expect_success 'corrupt repo differently' '
index 302e4cbdba6037e4bfdb165b4033849f1a228846..f3fff557447c3e2e5c46878e7f0415c38d29e970 100755 (executable)
@@ -311,7 +311,7 @@ test_expect_success 'submodule entry pointing at a tag is error' '
        git -C work commit -m "bad commit" &&
        test_when_finished "git -C work reset --hard HEAD^" &&
        test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git main 2>err &&
-       test_i18ngrep "is a tag, not a commit" err
+       test_grep "is a tag, not a commit" err
 '
 
 test_expect_success 'push fails if recurse submodules option passed as yes' '
index 7c0a148e73c9e54003ed0fbad0805fe00f31eed0..c91a62b77afcfba1bf1228c33717db77c7e45318 100755 (executable)
@@ -68,13 +68,13 @@ test_expect_success 'talking with a receiver without push certificate support' '
 test_expect_success 'push --signed fails with a receiver without push certificate support' '
        prepare_dst &&
        test_must_fail git push --signed dst noop ff +noff 2>err &&
-       test_i18ngrep "the receiving end does not support" err
+       test_grep "the receiving end does not support" err
 '
 
 test_expect_success 'push --signed=1 is accepted' '
        prepare_dst &&
        test_must_fail git push --signed=1 dst noop ff +noff 2>err &&
-       test_i18ngrep "the receiving end does not support" err
+       test_grep "the receiving end does not support" err
 '
 
 test_expect_success GPG 'no certificate for a signed push with no update' '
@@ -303,7 +303,7 @@ test_expect_success GPGSM 'fail without key and heed user.signingkey x509' '
                EOF
                sed -n -e "s/^nonce /NONCE=/p" -e "/^$/q" dst/push-cert
        ) >expect.in &&
-       key=$(cat "${GNUPGHOME}/trustlist.txt" | cut -d" " -f1 | tr -d ":") &&
+       key=$(cut -d" " -f1 <"${GNUPGHOME}/trustlist.txt" | tr -d ":") &&
        sed -e "s/^KEY=/KEY=${key}/" expect.in >expect &&
 
        noop=$(git rev-parse noop) &&
@@ -378,7 +378,7 @@ test_expect_success GPG 'failed atomic push does not execute GPG' '
                        --signed --atomic --porcelain \
                        dst noop ff noff >out 2>err &&
 
-       test_i18ngrep ! "gpg failed to sign" err &&
+       test_grep ! "gpg failed to sign" err &&
        cat >expect <<-EOF &&
        To dst
        =       refs/heads/noop:refs/heads/noop [up to date]
index 91f28c2f783df7391d22bd893e2488e56658515b..23bf69617007d7e97ff3641d3a5783a7ffe0352a 100755 (executable)
@@ -40,7 +40,7 @@ test_expect_success 'fetch conflict: config vs. config' '
                "+refs/heads/branch2:refs/remotes/origin/branch1" && (
                cd ccc &&
                test_must_fail git fetch origin 2>error &&
-               test_i18ngrep "fatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1" error
+               test_grep "fatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1" error
        )
 '
 
@@ -67,7 +67,7 @@ test_expect_success 'fetch conflict: arg vs. arg' '
                test_must_fail git fetch origin \
                        refs/heads/*:refs/remotes/origin/* \
                        refs/heads/branch2:refs/remotes/origin/branch1 2>error &&
-               test_i18ngrep "fatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1" error
+               test_grep "fatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1" error
        )
 '
 
@@ -78,8 +78,8 @@ test_expect_success 'fetch conflict: criss-cross args' '
                git fetch origin \
                        refs/heads/branch1:refs/remotes/origin/branch2 \
                        refs/heads/branch2:refs/remotes/origin/branch1 2>error &&
-               test_i18ngrep "warning: refs/remotes/origin/branch1 usually tracks refs/heads/branch1, not refs/heads/branch2" error &&
-               test_i18ngrep "warning: refs/remotes/origin/branch2 usually tracks refs/heads/branch2, not refs/heads/branch1" error
+               test_grep "warning: refs/remotes/origin/branch1 usually tracks refs/heads/branch1, not refs/heads/branch2" error &&
+               test_grep "warning: refs/remotes/origin/branch2 usually tracks refs/heads/branch2, not refs/heads/branch1" error
        )
 '
 
index d0211cd8bef450e0149dccd037b0f9e1607ef421..71428f3d5c760a9bdca7524e15cb9747e92cfd17 100755 (executable)
@@ -153,7 +153,7 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
 '
 
 test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
-       test_i18ngrep "Updates were rejected because" \
+       test_grep "Updates were rejected because" \
                output
 '
 
@@ -232,8 +232,9 @@ test_expect_success 'push --atomic fails on server-side errors' '
        test_config -C "$d" http.receivepack true &&
        up="$HTTPD_URL"/smart/atomic-branches.git &&
 
-       # break ref updates for other on the remote site
-       mkdir "$d/refs/heads/other.lock" &&
+       # Create d/f conflict to break ref updates for other on the remote site.
+       git -C "$d" update-ref -d refs/heads/other &&
+       git -C "$d" update-ref refs/heads/other/conflict HEAD &&
 
        # add the new commit to other
        git branch -f other collateral &&
@@ -241,18 +242,9 @@ test_expect_success 'push --atomic fails on server-side errors' '
        # --atomic should cause entire push to be rejected
        test_must_fail git push --atomic "$up" atomic other 2>output  &&
 
-       # the new branch should not have been created upstream
-       test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
-
-       # upstream should still reflect atomic2, the last thing we pushed
-       # successfully
-       git rev-parse atomic2 >expected &&
-       # ...to other.
-       git -C "$d" rev-parse refs/heads/other >actual &&
-       test_cmp expected actual &&
-
-       # the new branch should not have been created upstream
+       # The atomic and other branches should not be created upstream.
        test_must_fail git -C "$d" show-ref --verify refs/heads/atomic &&
+       test_must_fail git -C "$d" show-ref --verify refs/heads/other &&
 
        # the failed refs should be indicated to the user
        grep "^ ! .*rejected.* other -> other .*atomic transaction failed" output &&
@@ -297,7 +289,7 @@ test_expect_success TTY 'push shows progress when stderr is a tty' '
        cd "$ROOT_PATH"/test_repo_clone &&
        test_commit noisy &&
        test_terminal git push >output 2>&1 &&
-       test_i18ngrep "^Writing objects" output
+       test_grep "^Writing objects" output
 '
 
 test_expect_success TTY 'push --quiet silences status and progress' '
@@ -311,16 +303,16 @@ test_expect_success TTY 'push --no-progress silences progress but not status' '
        cd "$ROOT_PATH"/test_repo_clone &&
        test_commit no-progress &&
        test_terminal git push --no-progress >output 2>&1 &&
-       test_i18ngrep "^To http" output &&
-       test_i18ngrep ! "^Writing objects" output
+       test_grep "^To http" output &&
+       test_grep ! "^Writing objects" output
 '
 
 test_expect_success 'push --progress shows progress to non-tty' '
        cd "$ROOT_PATH"/test_repo_clone &&
        test_commit progress &&
        git push --progress >output 2>&1 &&
-       test_i18ngrep "^To http" output &&
-       test_i18ngrep "^Writing objects" output
+       test_grep "^To http" output &&
+       test_grep "^Writing objects" output
 '
 
 test_expect_success 'http push gives sane defaults to reflog' '
@@ -489,10 +481,10 @@ test_expect_success 'colorize errors/hints' '
                -c color.push=always \
                push origin origin/main^:main 2>act &&
        test_decode_color <act >decoded &&
-       test_i18ngrep "<RED>.*rejected.*<RESET>" decoded &&
-       test_i18ngrep "<RED>error: failed to push some refs" decoded &&
-       test_i18ngrep "<YELLOW>hint: " decoded &&
-       test_i18ngrep ! "^hint: " decoded
+       test_grep "<RED>.*rejected.*<RESET>" decoded &&
+       test_grep "<RED>error: failed to push some refs" decoded &&
+       test_grep "<YELLOW>hint: " decoded &&
+       test_grep ! "^hint: " decoded
 '
 
 test_expect_success 'report error server does not provide ref status' '
index a158e7d2c011f464c90ff69e7eda1c6ae0669ece..fb13549da7f305b88da0f0bdcf3d791907e96a08 100755 (executable)
@@ -252,7 +252,7 @@ test_expect_success 'push option denied properly by http server' '
        mk_http_pair false &&
        test_commit -C test_http_clone one &&
        test_must_fail git -C test_http_clone push --push-option=asdf origin main 2>actual &&
-       test_i18ngrep "the receiving end does not support push options" actual &&
+       test_grep "the receiving end does not support push options" actual &&
        git -C test_http_clone push origin main
 '
 
index eed3c9d81abaffa8886b44f26224111b369735ce..9fc9ba552f1db320a595dcf7b5b23c31b5c855b1 100755 (executable)
@@ -9,10 +9,26 @@ TEST_PASSES_SANITIZE_LEAK=true
 # When the limit is 1, `git receive-pack` will call `git index-pack`.
 # When the limit is 10000, `git receive-pack` will call `git unpack-objects`.
 
+validate_store_type () {
+       git -C dest count-objects -v >actual &&
+       case "$store_type" in
+       index)
+               grep "^count: 0$" actual ;;
+       unpack)
+               grep "^packs: 0$" actual ;;
+       esac || {
+               echo "store_type is $store_type"
+               cat actual
+               false;
+       }
+}
+
 test_pack_input_limit () {
-       case "$1" in
-       index) unpack_limit=1 ;;
-       unpack) unpack_limit=10000 ;;
+       store_type=$1
+
+       case "$store_type" in
+       index) unpack_limit=1 other_limit=10000 ;;
+       unpack) unpack_limit=10000 other_limit=1 ;;
        esac
 
        test_expect_success 'prepare destination repository' '
@@ -43,6 +59,19 @@ test_pack_input_limit () {
                git --git-dir=dest config receive.maxInputSize 0 &&
                git push dest HEAD
        '
+
+       test_expect_success 'prepare destination repository (once more)' '
+               rm -fr dest &&
+               git --bare init dest
+       '
+
+       test_expect_success 'receive trumps transfer' '
+               git --git-dir=dest config receive.unpacklimit "$unpack_limit" &&
+               git --git-dir=dest config transfer.unpacklimit "$other_limit" &&
+               git push dest HEAD &&
+               validate_store_type
+       '
+
 }
 
 test_expect_success "create known-size (1024 bytes) commit" '
index 8f182a3cbfe73cbcf1d61cbf96c14b78cf25a168..4c3b32785d580fb32846306df720629aee9b3a4b 100755 (executable)
@@ -66,11 +66,11 @@ test_expect_success 'create empty remote repository' '
        setup_post_update_server_info_hook "$HTTPD_DOCUMENT_ROOT_PATH/empty.git"
 '
 
-test_expect_success 'empty dumb HTTP repository has default hash algorithm' '
+test_expect_success 'empty dumb HTTP repository falls back to SHA1' '
        test_when_finished "rm -fr clone-empty" &&
        git clone $HTTPD_URL/dumb/empty.git clone-empty &&
        git -C clone-empty rev-parse --show-object-format >empty-format &&
-       test "$(cat empty-format)" = "$(test_oid algo)"
+       test "$(cat empty-format)" = sha1
 '
 
 setup_askpass_helper
@@ -376,7 +376,7 @@ test_expect_success 'git client send an empty Accept-Language' '
 
 test_expect_success 'remote-http complains cleanly about malformed urls' '
        test_must_fail git remote-http http::/example.com/repo.git 2>stderr &&
-       test_i18ngrep "url has no scheme" stderr
+       test_grep "url has no scheme" stderr
 '
 
 # NEEDSWORK: Writing commands to git-remote-curl can race against the latter
@@ -385,7 +385,7 @@ test_expect_success 'remote-http complains cleanly about malformed urls' '
 test_expect_success 'remote-http complains cleanly about empty scheme' '
        test_must_fail ok=sigpipe git ls-remote \
                http::${HTTPD_URL#http}/dumb/repo.git 2>stderr &&
-       test_i18ngrep "url has no scheme" stderr
+       test_grep "url has no scheme" stderr
 '
 
 test_expect_success 'redirects can be forbidden/allowed' '
@@ -397,7 +397,7 @@ test_expect_success 'redirects can be forbidden/allowed' '
 
 test_expect_success 'redirects are reported to stderr' '
        # just look for a snippet of the redirected-to URL
-       test_i18ngrep /dumb/ stderr
+       test_grep /dumb/ stderr
 '
 
 test_expect_success 'non-initial redirects can be forbidden' '
@@ -466,7 +466,7 @@ test_expect_success 'can redirect through non-"info/refs?service=git-upload-pack
 
 test_expect_success 'print HTTP error when any intermediate redirect throws error' '
        test_must_fail git clone "$HTTPD_URL/redir-to/502" 2> stderr &&
-       test_i18ngrep "unable to access.*/redir-to/502" stderr
+       test_grep "unable to access.*/redir-to/502" stderr
 '
 
 test_expect_success 'fetching via http alternates works' '
index 21b7767cbd313b48a13888c28f5e757e59b394db..a623a1058cd2acddcfca4b6712dcfa41e56dbb67 100755 (executable)
@@ -275,7 +275,7 @@ test_expect_success 'GIT_SMART_HTTP can disable smart http' '
 
 test_expect_success 'invalid Content-Type rejected' '
        test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual &&
-       test_i18ngrep "not valid:" actual
+       test_grep "not valid:" actual
 '
 
 test_expect_success 'create namespaced refs' '
@@ -359,7 +359,9 @@ create_tags () {
 
        # now assign tags to all the dangling commits we created above
        tag=$(perl -e "print \"bla\" x 30") &&
-       sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
+       sed -e "s|^:\([^ ]*\) \(.*\)$|create refs/tags/$tag-\1 \2|" <marks >input &&
+       git update-ref --stdin <input &&
+       rm input
 }
 
 test_expect_success 'create 2,000 tags in the repo' '
@@ -558,7 +560,7 @@ test_expect_success 'GIT_TRACE_CURL_NO_DATA prevents data from being traced' '
 
 test_expect_success 'server-side error detected' '
        test_must_fail git clone $HTTPD_URL/error_smart/repo.git 2>actual &&
-       test_i18ngrep "server-side error" actual
+       test_grep "server-side error" actual
 '
 
 test_expect_success 'http auth remembers successful credentials' '
@@ -731,4 +733,22 @@ test_expect_success 'no empty path components' '
        ! grep "//" log
 '
 
+test_expect_success 'tag following always works over v0 http' '
+       upstream=$HTTPD_DOCUMENT_ROOT_PATH/tags &&
+       git init "$upstream" &&
+       (
+               cd "$upstream" &&
+               git commit --allow-empty -m base &&
+               git tag not-annotated &&
+               git tag -m foo annotated
+       ) &&
+       git init tags &&
+       git -C tags -c protocol.version=0 \
+               fetch --depth 1 $HTTPD_URL/smart/tags \
+               refs/tags/annotated:refs/tags/annotated &&
+       git -C "$upstream" for-each-ref refs/tags >expect &&
+       git -C tags for-each-ref >actual &&
+       test_cmp expect actual
+'
+
 test_done
index b1cfe8b7dba816ddcaee85c0a3e19d0c958e6cd5..3dcb3340a36bb0e0efca1c1dfad6373dd5aeedc5 100755 (executable)
@@ -131,7 +131,6 @@ test_expect_success 'git upload-pack --advertise-refs: v2' '
        fetch=shallow wait-for-done
        server-option
        object-format=$(test_oid algo)
-       object-info
        0000
        EOF
 
index 996a08e90c9c2c5b2c37405b1b3082e82d29a7e8..1ca5f745e73bd30deb9fc2dfa79baa10d63345bf 100755 (executable)
@@ -33,6 +33,15 @@ test_expect_success 'clone with path bundle' '
        test_cmp expect actual
 '
 
+test_expect_success 'clone with path bundle and non-default hash' '
+       test_when_finished "rm -rf clone-path-non-default-hash" &&
+       GIT_DEFAULT_HASH=sha256 git clone --bundle-uri="clone-from/B.bundle" \
+               clone-from clone-path-non-default-hash &&
+       git -C clone-path-non-default-hash rev-parse refs/bundles/topic >actual &&
+       git -C clone-from rev-parse topic >expect &&
+       test_cmp expect actual
+'
+
 test_expect_success 'clone with file:// bundle' '
        git clone --bundle-uri="file://$(pwd)/clone-from/B.bundle" \
                clone-from clone-file &&
@@ -284,6 +293,15 @@ test_expect_success 'clone HTTP bundle' '
        test_config -C clone-http log.excludedecoration refs/bundle/
 '
 
+test_expect_success 'clone HTTP bundle with non-default hash' '
+       test_when_finished "rm -rf clone-http-non-default-hash" &&
+       GIT_DEFAULT_HASH=sha256 git clone --bundle-uri="$HTTPD_URL/B.bundle" \
+               "$HTTPD_URL/smart/fetch.git" clone-http-non-default-hash &&
+       git -C clone-http-non-default-hash rev-parse refs/bundles/topic >actual &&
+       git -C clone-from rev-parse topic >expect &&
+       test_cmp expect actual
+'
+
 test_expect_success 'clone bundle list (HTTP, no heuristic)' '
        test_when_finished rm -f trace*.txt &&
 
index 718dd9b49d493ec55e2503dcb14aa5ddcc26cc6f..9babb9a375e5fb2a66f216d1968312ec094a6d93 100644 (file)
@@ -1,4 +1,4 @@
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 
index 1131503b760c48cbb6f6b0d10a5027d76ec40db5..f9a9bf950328e805ffb27c743b8d85f61510eec8 100755 (executable)
@@ -10,9 +10,9 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 start_git_daemon
 
 check_verbose_connect () {
-       test_i18ngrep -F "Looking up 127.0.0.1 ..." stderr &&
-       test_i18ngrep -F "Connecting to 127.0.0.1 (port " stderr &&
-       test_i18ngrep -F "done." stderr
+       test_grep -F "Looking up 127.0.0.1 ..." stderr &&
+       test_grep -F "Connecting to 127.0.0.1 (port " stderr &&
+       test_grep -F "done." stderr
 }
 
 test_expect_success 'setup repository' '
@@ -108,7 +108,7 @@ test_expect_success 'fetch notices corrupt idx' '
 
 test_expect_success 'client refuses to ask for repo with newline' '
        test_must_fail git clone "$GIT_DAEMON_URL/repo$LF.git" dst 2>stderr &&
-       test_i18ngrep newline.is.forbidden stderr
+       test_grep newline.is.forbidden stderr
 '
 
 test_remote_error()
@@ -148,7 +148,7 @@ test_remote_error()
        fi
 
        test_must_fail git "$cmd" "$GIT_DAEMON_URL/$repo" "$@" 2>output &&
-       test_i18ngrep "fatal: remote error: $msg: /$repo" output &&
+       test_grep "fatal: remote error: $msg: /$repo" output &&
        ret=$?
        chmod +x "$GIT_DAEMON_DOCUMENT_ROOT_PATH/repo.git"
        (exit $ret)
index a11b20e378223ea30242e70d5befcfeed889a2ed..448134c4bf72bd5f3a4c2287e59f6f2a1f3f074b 100755 (executable)
@@ -4,6 +4,7 @@ test_description='check pre-push hooks'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 4e917bf87d2d4213019797ffa4d12215ffeb05f5..51744521f789b654ffbcee73afba47a0ecbe7e35 100755 (executable)
@@ -177,7 +177,7 @@ test_expect_success 'pull --rebase --recurse-submodules fails if both sides reco
        # submodule itself, but the merge strategy in submodules
        # does not support rebase:
        test_must_fail git -C super pull --rebase --recurse-submodules 2>err &&
-       test_i18ngrep "locally recorded submodule modifications" err
+       test_grep "locally recorded submodule modifications" err
 '
 
 test_expect_success 'pull --rebase --recurse-submodules (no submodule changes, no fork-point)' '
index 1221ac05978e2c5cff0675f7e46e488361908098..ab05f38a99823968a6657ac2579c404560118044 100755 (executable)
@@ -47,46 +47,46 @@ test_expect_success GPG 'create repositories with signed commits' '
 test_expect_success GPG 'pull unsigned commit with --verify-signatures' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_must_fail git pull --ff-only --verify-signatures unsigned 2>pullerror &&
-       test_i18ngrep "does not have a GPG signature" pullerror
+       test_grep "does not have a GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit with bad signature with --verify-signatures' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_must_fail git pull --ff-only --verify-signatures bad 2>pullerror &&
-       test_i18ngrep "has a bad GPG signature" pullerror
+       test_grep "has a bad GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit with untrusted signature with --verify-signatures' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_must_fail git pull --ff-only --verify-signatures untrusted 2>pullerror &&
-       test_i18ngrep "has an untrusted GPG signature" pullerror
+       test_grep "has an untrusted GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit with untrusted signature with --verify-signatures and minTrustLevel=ultimate' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config gpg.minTrustLevel ultimate &&
        test_must_fail git pull --ff-only --verify-signatures untrusted 2>pullerror &&
-       test_i18ngrep "has an untrusted GPG signature" pullerror
+       test_grep "has an untrusted GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit with untrusted signature with --verify-signatures and minTrustLevel=marginal' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config gpg.minTrustLevel marginal &&
        test_must_fail git pull --ff-only --verify-signatures untrusted 2>pullerror &&
-       test_i18ngrep "has an untrusted GPG signature" pullerror
+       test_grep "has an untrusted GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit with untrusted signature with --verify-signatures and minTrustLevel=undefined' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config gpg.minTrustLevel undefined &&
        git pull --ff-only --verify-signatures untrusted >pulloutput &&
-       test_i18ngrep "has a good GPG signature" pulloutput
+       test_grep "has a good GPG signature" pulloutput
 '
 
 test_expect_success GPG 'pull signed commit with --verify-signatures' '
        test_when_finished "git reset --hard && git checkout initial" &&
        git pull --verify-signatures signed >pulloutput &&
-       test_i18ngrep "has a good GPG signature" pulloutput
+       test_grep "has a good GPG signature" pulloutput
 '
 
 test_expect_success GPG 'pull commit with bad signature without verification' '
@@ -106,7 +106,7 @@ test_expect_success GPG 'pull unsigned commit into unborn branch' '
        git init empty-repo &&
        test_must_fail \
                git -C empty-repo pull --verify-signatures ..  2>pullerror &&
-       test_i18ngrep "does not have a GPG signature" pullerror
+       test_grep "does not have a GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit into unborn branch with bad signature and --verify-signatures' '
@@ -114,7 +114,7 @@ test_expect_success GPG 'pull commit into unborn branch with bad signature and -
        git init empty-repo &&
        test_must_fail \
                git -C empty-repo pull --ff-only --verify-signatures ../bad 2>pullerror &&
-       test_i18ngrep "has a bad GPG signature" pullerror
+       test_grep "has a bad GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures' '
@@ -122,7 +122,7 @@ test_expect_success GPG 'pull commit into unborn branch with untrusted signature
        git init empty-repo &&
        test_must_fail \
                git -C empty-repo pull --ff-only --verify-signatures ../untrusted 2>pullerror &&
-       test_i18ngrep "has an untrusted GPG signature" pullerror
+       test_grep "has an untrusted GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures and minTrustLevel=ultimate' '
@@ -131,7 +131,7 @@ test_expect_success GPG 'pull commit into unborn branch with untrusted signature
        test_config_global gpg.minTrustLevel ultimate &&
        test_must_fail \
                git -C empty-repo pull --ff-only --verify-signatures ../untrusted 2>pullerror &&
-       test_i18ngrep "has an untrusted GPG signature" pullerror
+       test_grep "has an untrusted GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures and minTrustLevel=marginal' '
@@ -140,7 +140,7 @@ test_expect_success GPG 'pull commit into unborn branch with untrusted signature
        test_config_global gpg.minTrustLevel marginal &&
        test_must_fail \
                git -C empty-repo pull --ff-only --verify-signatures ../untrusted 2>pullerror &&
-       test_i18ngrep "has an untrusted GPG signature" pullerror
+       test_grep "has an untrusted GPG signature" pullerror
 '
 
 test_expect_success GPG 'pull commit into unborn branch with untrusted signature and --verify-signatures and minTrustLevel=undefined' '
@@ -148,7 +148,7 @@ test_expect_success GPG 'pull commit into unborn branch with untrusted signature
        git init empty-repo &&
        test_config_global gpg.minTrustLevel undefined &&
        git -C empty-repo pull --ff-only --verify-signatures ../untrusted >pulloutput &&
-       test_i18ngrep "has a good GPG signature" pulloutput
+       test_grep "has a good GPG signature" pulloutput
 '
 
 test_done
index 90e6dcb9a7f22609eba39779d0a279a5e18c9799..5883839a04e991d6ab93a965698662ced064fe3d 100755 (executable)
@@ -61,11 +61,10 @@ test_expect_success 'fetch compact output' '
        test_cmp expect actual
 '
 
-test_expect_success 'fetch porcelain output' '
-       test_when_finished "rm -rf porcelain" &&
-
+test_expect_success 'setup for fetch porcelain output' '
        # Set up a bunch of references that we can use to demonstrate different
        # kinds of flag symbols in the output format.
+       test_commit commit-for-porcelain-output &&
        MAIN_OLD=$(git rev-parse HEAD) &&
        git branch "fast-forward" &&
        git branch "deleted-branch" &&
@@ -74,15 +73,10 @@ test_expect_success 'fetch porcelain output' '
        FORCE_UPDATED_OLD=$(git rev-parse HEAD) &&
        git checkout main &&
 
-       # Clone and pre-seed the repositories. We fetch references into two
-       # namespaces so that we can test that rejected and force-updated
-       # references are reported properly.
-       refspecs="refs/heads/*:refs/unforced/* +refs/heads/*:refs/forced/*" &&
-       git clone . porcelain &&
-       git -C porcelain fetch origin $refspecs &&
+       # Backup to preseed.git
+       git clone --mirror . preseed.git &&
 
-       # Now that we have set up the client repositories we can change our
-       # local references.
+       # Continue changing our local references.
        git branch new-branch &&
        git branch -d deleted-branch &&
        git checkout fast-forward &&
@@ -91,36 +85,53 @@ test_expect_success 'fetch porcelain output' '
        git checkout force-updated &&
        git reset --hard HEAD~ &&
        test_commit --no-tag force-update-new &&
-       FORCE_UPDATED_NEW=$(git rev-parse HEAD) &&
-
-       cat >expect <<-EOF &&
-       - $MAIN_OLD $ZERO_OID refs/forced/deleted-branch
-       - $MAIN_OLD $ZERO_OID refs/unforced/deleted-branch
-         $MAIN_OLD $FAST_FORWARD_NEW refs/unforced/fast-forward
-       ! $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/unforced/force-updated
-       * $ZERO_OID $MAIN_OLD refs/unforced/new-branch
-         $MAIN_OLD $FAST_FORWARD_NEW refs/forced/fast-forward
-       + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/forced/force-updated
-       * $ZERO_OID $MAIN_OLD refs/forced/new-branch
-         $MAIN_OLD $FAST_FORWARD_NEW refs/remotes/origin/fast-forward
-       + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/remotes/origin/force-updated
-       * $ZERO_OID $MAIN_OLD refs/remotes/origin/new-branch
-       EOF
-
-       # Execute a dry-run fetch first. We do this to assert that the dry-run
-       # and non-dry-run fetches produces the same output. Execution of the
-       # fetch is expected to fail as we have a rejected reference update.
-       test_must_fail git -C porcelain fetch \
-               --porcelain --dry-run --prune origin $refspecs >actual &&
-       test_cmp expect actual &&
-
-       # And now we perform a non-dry-run fetch.
-       test_must_fail git -C porcelain fetch \
-               --porcelain --prune origin $refspecs >actual 2>stderr &&
-       test_cmp expect actual &&
-       test_must_be_empty stderr
+       FORCE_UPDATED_NEW=$(git rev-parse HEAD)
 '
 
+for opt in "" "--atomic"
+do
+       test_expect_success "fetch porcelain output ${opt:+(atomic)}" '
+               test_when_finished "rm -rf porcelain" &&
+
+               # Clone and pre-seed the repositories. We fetch references into two
+               # namespaces so that we can test that rejected and force-updated
+               # references are reported properly.
+               refspecs="refs/heads/*:refs/unforced/* +refs/heads/*:refs/forced/*" &&
+               git clone preseed.git porcelain &&
+               git -C porcelain fetch origin $opt $refspecs &&
+
+               cat >expect <<-EOF &&
+               - $MAIN_OLD $ZERO_OID refs/forced/deleted-branch
+               - $MAIN_OLD $ZERO_OID refs/unforced/deleted-branch
+                 $MAIN_OLD $FAST_FORWARD_NEW refs/unforced/fast-forward
+               ! $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/unforced/force-updated
+               * $ZERO_OID $MAIN_OLD refs/unforced/new-branch
+                 $MAIN_OLD $FAST_FORWARD_NEW refs/forced/fast-forward
+               + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/forced/force-updated
+               * $ZERO_OID $MAIN_OLD refs/forced/new-branch
+                 $MAIN_OLD $FAST_FORWARD_NEW refs/remotes/origin/fast-forward
+               + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/remotes/origin/force-updated
+               * $ZERO_OID $MAIN_OLD refs/remotes/origin/new-branch
+               EOF
+
+               # Change the URL of the repository to fetch different references.
+               git -C porcelain remote set-url origin .. &&
+
+               # Execute a dry-run fetch first. We do this to assert that the dry-run
+               # and non-dry-run fetches produces the same output. Execution of the
+               # fetch is expected to fail as we have a rejected reference update.
+               test_must_fail git -C porcelain fetch $opt \
+                       --porcelain --dry-run --prune origin $refspecs >actual &&
+               test_cmp expect actual &&
+
+               # And now we perform a non-dry-run fetch.
+               test_must_fail git -C porcelain fetch $opt \
+                       --porcelain --prune origin $refspecs >actual 2>stderr &&
+               test_cmp expect actual &&
+               test_must_be_empty stderr
+       '
+done
+
 test_expect_success 'fetch porcelain with multiple remotes' '
        test_when_finished "rm -rf porcelain" &&
 
@@ -281,12 +292,12 @@ test_expect_success '--no-show-forced-updates' '
        (
                cd forced-update-clone &&
                git fetch --show-forced-updates origin 2>output &&
-               test_i18ngrep "(forced update)" output
+               test_grep "(forced update)" output
        ) &&
        (
                cd no-forced-update-clone &&
                git fetch --no-show-forced-updates origin 2>output &&
-               test_i18ngrep ! "(forced update)" output
+               test_grep ! "(forced update)" output
        )
 '
 
index cd7604fff93a55ff9bb9e4bcae905c4386f0374a..d7537a162b21fe09ac48cab3ac3d937c188ec081 100755 (executable)
@@ -75,7 +75,7 @@ test_expect_success push '
 test_expect_success MINGW 'remote nick cannot contain backslashes' '
        BACKSLASHED="$(winpwd | tr / \\\\)" &&
        git ls-remote "$BACKSLASHED" 2>err &&
-       test_i18ngrep ! "unable to access" err
+       test_grep ! "unable to access" err
 '
 
 test_expect_success 'unc alternates' '
index e7e1b6dab66fb31d065c4dc7611c824a7bc1bf5b..320f49c753f41376ad757aedf134a76bd6206a68 100755 (executable)
@@ -5,6 +5,7 @@ test_description='check the consisitency of behavior of --all and --branches'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 delete_refs() {
index b7d5551262c7b715fbeea48f0260906f35a64a10..fb1b9c686db24a30f9dbd2f6f38f29bfc4624676 100755 (executable)
@@ -157,6 +157,23 @@ test_expect_success 'clone --mirror does not repeat tags' '
 
 '
 
+test_expect_success 'clone with files ref format' '
+       test_when_finished "rm -rf ref-storage" &&
+       git clone --ref-format=files --mirror src ref-storage &&
+       echo files >expect &&
+       git -C ref-storage rev-parse --show-ref-format >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'clone with garbage ref format' '
+       cat >expect <<-EOF &&
+       fatal: unknown ref storage format ${SQ}garbage${SQ}
+       EOF
+       test_must_fail git clone --ref-format=garbage --mirror src ref-storage 2>err &&
+       test_cmp expect err &&
+       test_path_is_missing ref-storage
+'
+
 test_expect_success 'clone to destination with trailing /' '
 
        git clone src target-1/ &&
@@ -630,7 +647,7 @@ test_expect_success 'clone on case-insensitive fs' '
 test_expect_success CASE_INSENSITIVE_FS 'colliding file detection' '
        grep X icasefs/warning &&
        grep x icasefs/warning &&
-       test_i18ngrep "the following paths have collided" icasefs/warning
+       test_grep "the following paths have collided" icasefs/warning
 '
 
 test_expect_success 'clone with GIT_DEFAULT_HASH' '
@@ -696,7 +713,7 @@ test_expect_success 'partial clone: warn if server does not support object filte
 
        git clone --filter=blob:limit=0 "file://$(pwd)/server" client 2> err &&
 
-       test_i18ngrep "filtering not recognized by server" err
+       test_grep "filtering not recognized by server" err
 '
 
 test_expect_success 'batch missing blob request during checkout' '
@@ -767,7 +784,7 @@ test_expect_success 'reject cloning shallow repository using HTTP' '
        test_when_finished "rm -rf repo" &&
        git clone --bare --no-local --depth=1 src "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
        test_must_fail git -c protocol.version=2 clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err &&
-       test_i18ngrep -e "source repository is shallow, reject to clone." err &&
+       test_grep -e "source repository is shallow, reject to clone." err &&
 
        git clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo
 '
index 9845fc04d59809acc17dbe7c8a122c93b84d4f75..9b32db8478ab77ff118a1df382a97d1f4064c2a8 100755 (executable)
@@ -317,7 +317,7 @@ test_expect_success SYMLINKS 'clone repo with symlinked or unknown files at obje
        for option in --local --no-hardlinks --dissociate
        do
                test_must_fail git clone $option T T$option 2>err || return 1 &&
-               test_i18ngrep "symlink.*exists" err || return 1
+               test_grep "symlink.*exists" err || return 1
        done &&
 
        # But `--shared` clones should still work, even when specifying
index 1d7b1abda1a4870971efb8408c11a4dde2e7564e..a3055869bc7bc182e2e4af736b06785ee28bed85 100755 (executable)
@@ -65,11 +65,11 @@ test_expect_success 'Even without -l, local will make a hardlink' '
 '
 
 test_expect_success 'local clone of repo with nonexistent ref in HEAD' '
-       echo "ref: refs/heads/nonexistent" > a.git/HEAD &&
+       git -C a.git symbolic-ref HEAD refs/heads/nonexistent &&
        git clone a d &&
        (cd d &&
        git fetch &&
-       test ! -e .git/refs/remotes/origin/HEAD)
+       test_ref_missing refs/remotes/origin/HEAD)
 '
 
 test_expect_success 'bundle clone without .bundle suffix' '
@@ -157,7 +157,7 @@ test_expect_success 'cloning locally respects "-u" for fetching refs' '
        test_must_fail git clone --bare -u false a should_not_work.git
 '
 
-test_expect_success 'local clone from repo with corrupt refs fails gracefully' '
+test_expect_success REFFILES 'local clone from repo with corrupt refs fails gracefully' '
        git init corrupt &&
        test_commit -C corrupt one &&
        echo a >corrupt/.git/refs/heads/topic &&
index 5890319b97b8269ee2957315a3670a7c0cfa8caf..e93e0d0cc397a323bae99e9f92ee5d02cb026f2b 100755 (executable)
@@ -39,7 +39,7 @@ test_expect_success 'clone -o' '
 test_expect_success 'rejects invalid -o/--origin' '
 
        test_must_fail git clone -o "bad...name" parent clone-bad-name 2>err &&
-       test_i18ngrep "'\''bad...name'\'' is not a valid remote name" err
+       test_grep "'\''bad...name'\'' is not a valid remote name" err
 
 '
 
@@ -56,7 +56,7 @@ test_expect_success 'disallows --bare with --separate-git-dir' '
 
        test_must_fail git clone --bare --separate-git-dir dot-git-destiation parent clone-bare-sgd 2>err &&
        test_debug "cat err" &&
-       test_i18ngrep -e "options .--bare. and .--separate-git-dir. cannot be used together" err
+       test_grep -e "options .--bare. and .--separate-git-dir. cannot be used together" err
 
 '
 
@@ -64,14 +64,14 @@ test_expect_success 'disallows --bundle-uri with shallow options' '
        for option in --depth=1 --shallow-since=01-01-2000 --shallow-exclude=HEAD
        do
                test_must_fail git clone --bundle-uri=bundle $option from to 2>err &&
-               grep "bundle-uri is incompatible" err || return 1
+               grep "bundle-uri.* cannot be used together" err || return 1
        done
 '
 
 test_expect_success 'reject cloning shallow repository' '
        test_when_finished "rm -rf repo" &&
        test_must_fail git clone --reject-shallow shallow-repo out 2>err &&
-       test_i18ngrep -e "source repository is shallow, reject to clone." err &&
+       test_grep -e "source repository is shallow, reject to clone." err &&
 
        git clone --no-reject-shallow shallow-repo repo
 '
@@ -79,7 +79,7 @@ test_expect_success 'reject cloning shallow repository' '
 test_expect_success 'reject cloning non-local shallow repository' '
        test_when_finished "rm -rf repo" &&
        test_must_fail git clone --reject-shallow --no-local shallow-repo out 2>err &&
-       test_i18ngrep -e "source repository is shallow, reject to clone." err &&
+       test_grep -e "source repository is shallow, reject to clone." err &&
 
        git clone --no-reject-shallow --no-local shallow-repo repo
 '
@@ -120,14 +120,14 @@ test_expect_success 'prefers -c config over --template config' '
 
 '
 
-test_expect_failure 'prefers --template config even for core.bare' '
+test_expect_success 'ignore --template config for core.bare' '
 
        template="$TRASH_DIRECTORY/template-with-bare-config" &&
        mkdir "$template" &&
        git config --file "$template/config" core.bare true &&
        git clone "--template=$template" parent clone-bare-config &&
-       test "$(git -C clone-bare-config config --local core.bare)" = "true" &&
-       test_path_is_file clone-bare-config/HEAD
+       test "$(git -C clone-bare-config config --local core.bare)" = "false" &&
+       test_path_is_missing clone-bare-config/HEAD
 '
 
 test_expect_success 'prefers config "clone.defaultRemoteName" over default' '
@@ -149,7 +149,7 @@ test_expect_success 'redirected clone does not show progress' '
 
        git clone "file://$(pwd)/parent" clone-redirected >out 2>err &&
        ! grep % err &&
-       test_i18ngrep ! "Checking connectivity" err
+       test_grep ! "Checking connectivity" err
 
 '
 
index 51705aa86a172edfcdf9f41d9640f93c8667ebb9..0d1e92d9963554323a0e9a3891e43eeb263b1aff 100755 (executable)
@@ -24,7 +24,7 @@ test_expect_success 'setup' '
 test_expect_success '"verify" needs a worktree' '
        git bundle create tip.bundle -1 main &&
        nongit test_must_fail git bundle verify ../tip.bundle 2>err &&
-       test_i18ngrep "need a repository" err
+       test_grep "need a repository" err
 '
 
 test_expect_success 'annotated tags can be excluded by rev-list options' '
@@ -166,7 +166,7 @@ test_expect_success 'git bundle v3 rejects unknown capabilities' '
        @unknown=silly
        EOF
        test_must_fail git bundle verify new 2>output &&
-       test_i18ngrep "unknown capability .unknown=silly." output
+       test_grep "unknown capability .unknown=silly." output
 '
 
 test_done
index 727caff443368365ca281373ad730de8f3987ab1..298d4befab84f2c4476c46562167a0e0a09b3981 100755 (executable)
@@ -103,7 +103,7 @@ test_expect_success 'set up shallow repository' '
 test_expect_success 'clone.rejectshallow=true should reject cloning shallow repo' '
        test_when_finished "rm -rf out" &&
        test_must_fail git -c clone.rejectshallow=true clone --no-local shallow-repo out 2>err &&
-       test_i18ngrep -e "source repository is shallow, reject to clone." err &&
+       test_grep -e "source repository is shallow, reject to clone." err &&
 
        git -c clone.rejectshallow=false clone --no-local shallow-repo out
 '
@@ -111,7 +111,7 @@ test_expect_success 'clone.rejectshallow=true should reject cloning shallow repo
 test_expect_success 'option --[no-]reject-shallow override clone.rejectshallow config' '
        test_when_finished "rm -rf out" &&
        test_must_fail git -c clone.rejectshallow=false clone --reject-shallow --no-local shallow-repo out 2>err &&
-       test_i18ngrep -e "source repository is shallow, reject to clone." err &&
+       test_grep -e "source repository is shallow, reject to clone." err &&
 
        git -c clone.rejectshallow=true clone --no-reject-shallow --no-local shallow-repo out
 '
index 8759fc285337e2bbc43fc746aa7c97bdc91a5b91..2da7291e37997a8b967788ee65c628ecf343b082 100755 (executable)
@@ -353,14 +353,14 @@ test_expect_success 'upload-pack complains of bogus filter config' '
        test_must_fail git \
                -c uploadpackfilter.tree.maxdepth \
                upload-pack . >/dev/null 2>err &&
-       test_i18ngrep "unable to parse.*tree.maxdepth" err
+       test_grep "unable to parse.*tree.maxdepth" err
 '
 
 test_expect_success 'upload-pack fails banned object filters' '
        test_config -C srv.bare uploadpackfilter.blob:none.allow false &&
        test_must_fail ok=sigpipe git clone --no-checkout --filter=blob:none \
                "file://$(pwd)/srv.bare" pc3 2>err &&
-       test_i18ngrep "filter '\''blob:none'\'' not supported" err
+       test_grep "filter '\''blob:none'\'' not supported" err
 '
 
 test_expect_success 'upload-pack fails banned combine object filters' '
@@ -370,14 +370,14 @@ test_expect_success 'upload-pack fails banned combine object filters' '
        test_config -C srv.bare uploadpackfilter.blob:none.allow false &&
        test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:1 \
                --filter=blob:none "file://$(pwd)/srv.bare" pc3 2>err &&
-       test_i18ngrep "filter '\''blob:none'\'' not supported" err
+       test_grep "filter '\''blob:none'\'' not supported" err
 '
 
 test_expect_success 'upload-pack fails banned object filters with fallback' '
        test_config -C srv.bare uploadpackfilter.allow false &&
        test_must_fail ok=sigpipe git clone --no-checkout --filter=blob:none \
                "file://$(pwd)/srv.bare" pc3 2>err &&
-       test_i18ngrep "filter '\''blob:none'\'' not supported" err
+       test_grep "filter '\''blob:none'\'' not supported" err
 '
 
 test_expect_success 'upload-pack limits tree depth filters' '
@@ -386,7 +386,7 @@ test_expect_success 'upload-pack limits tree depth filters' '
        test_config -C srv.bare uploadpackfilter.tree.maxDepth 0 &&
        test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:1 \
                "file://$(pwd)/srv.bare" pc3 2>err &&
-       test_i18ngrep "tree filter allows max depth 0, but got 1" err &&
+       test_grep "tree filter allows max depth 0, but got 1" err &&
 
        git clone --no-checkout --filter=tree:0 "file://$(pwd)/srv.bare" pc4 &&
 
@@ -394,7 +394,7 @@ test_expect_success 'upload-pack limits tree depth filters' '
        git clone --no-checkout --filter=tree:5 "file://$(pwd)/srv.bare" pc5 &&
        test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:6 \
                "file://$(pwd)/srv.bare" pc6 2>err &&
-       test_i18ngrep "tree filter allows max depth 5, but got 6" err
+       test_grep "tree filter allows max depth 5, but got 6" err
 '
 
 test_expect_success 'partial clone fetches blobs pointed to by refs even if normally filtered out' '
@@ -459,11 +459,11 @@ test_expect_success 'partial clone with unresolvable sparse filter fails cleanly
        test_must_fail git clone --no-local --bare \
                                 --filter=sparse:oid=main:no-such-name \
                                 sparse-src dst.git 2>err &&
-       test_i18ngrep "unable to access sparse blob in .main:no-such-name" err &&
+       test_grep "unable to access sparse blob in .main:no-such-name" err &&
        test_must_fail git clone --no-local --bare \
                                 --filter=sparse:oid=main \
                                 sparse-src dst.git 2>err &&
-       test_i18ngrep "unable to parse sparse filter data in" err
+       test_grep "unable to parse sparse filter data in" err
 '
 
 setup_triangle () {
@@ -493,8 +493,8 @@ setup_triangle () {
        TREE_HASH=$(git -C server rev-parse HEAD~1^{tree}) &&
        git -C promisor-remote fetch --keep "file://$(pwd)/server" "$TREE_HASH" &&
        git -C promisor-remote count-objects -v >object-count &&
-       test_i18ngrep "count: 0" object-count &&
-       test_i18ngrep "in-pack: 2" object-count &&
+       test_grep "count: 0" object-count &&
+       test_grep "in-pack: 2" object-count &&
 
        # Set it as the promisor remote of client. Thus, whenever
        # the client lazy fetches, the lazy fetch will succeed only if it is
@@ -748,7 +748,7 @@ test_expect_success 'upon cloning, check that all refs point to objects' '
        test_must_fail git -c protocol.version=2 clone \
                --filter=blob:none $HTTPD_URL/one_time_perl/server repo 2>err &&
 
-       test_i18ngrep "did not send all necessary objects" err &&
+       test_grep "did not send all necessary objects" err &&
 
        # Ensure that the one-time-perl script was used.
        ! test -e "$HTTPD_ROOT_PATH/one-time-perl"
index f21e5e9d33d199368df3aeb5ebae64e6b20cc5e3..c48830de8fe20448116f7988b450fe2d52d786e3 100755 (executable)
@@ -20,7 +20,6 @@ test_expect_success 'test capability advertisement' '
        fetch=shallow wait-for-done
        server-option
        object-format=$(test_oid algo)
-       object-info
        EOF
        cat >expect.trailer <<-EOF &&
        0000
@@ -52,7 +51,7 @@ test_expect_success 'request invalid capability' '
        0000
        EOF
        test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
-       test_i18ngrep "unknown capability" err
+       test_grep "unknown capability" err
 '
 
 test_expect_success 'request with no command' '
@@ -62,7 +61,7 @@ test_expect_success 'request with no command' '
        0000
        EOF
        test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
-       test_i18ngrep "no command requested" err
+       test_grep "no command requested" err
 '
 
 test_expect_success 'request invalid command' '
@@ -73,7 +72,7 @@ test_expect_success 'request invalid command' '
        0000
        EOF
        test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
-       test_i18ngrep "invalid command" err
+       test_grep "invalid command" err
 '
 
 test_expect_success 'request capability as command' '
@@ -115,7 +114,7 @@ test_expect_success 'wrong object-format' '
        0000
        EOF
        test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
-       test_i18ngrep "mismatched object format" err
+       test_grep "mismatched object format" err
 '
 
 # Test the basics of ls-refs
@@ -323,6 +322,8 @@ test_expect_success 'unexpected lines are not allowed in fetch request' '
 # Test the basics of object-info
 #
 test_expect_success 'basics of object-info' '
+       test_config transfer.advertiseObjectInfo true &&
+
        test-tool pkt-line pack >in <<-EOF &&
        command=object-info
        object-format=$(test_oid algo)
@@ -380,4 +381,25 @@ test_expect_success 'basics of bundle-uri: dies if not enabled' '
        test_must_be_empty out
 '
 
+test_expect_success 'object-info missing from capabilities when disabled' '
+       test_config transfer.advertiseObjectInfo false &&
+
+       GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \
+               --advertise-capabilities >out &&
+       test-tool pkt-line unpack <out >actual &&
+
+       ! grep object.info actual
+'
+
+test_expect_success 'object-info commands rejected when disabled' '
+       test_config transfer.advertiseObjectInfo false &&
+
+       test-tool pkt-line pack >in <<-EOF &&
+       command=object-info
+       EOF
+
+       test_must_fail test-tool serve-v2 --stateless-rpc <in 2>err &&
+       grep invalid.command err
+'
+
 test_done
index 6af5c2062fd16cc8c5549ee888d952966d41c4a3..1ef540f73d34756673423ff77fa46567bd34b2ab 100755 (executable)
@@ -189,8 +189,8 @@ test_expect_success 'warn if using server-option with ls-remote with legacy prot
        test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -c protocol.version=0 \
                ls-remote -o hello -o world "file://$(pwd)/file_parent" main 2>err &&
 
-       test_i18ngrep "see protocol.version in" err &&
-       test_i18ngrep "server options require protocol version 2 or later" err
+       test_grep "see protocol.version in" err &&
+       test_grep "server options require protocol version 2 or later" err
 '
 
 test_expect_success 'clone with file:// using protocol v2' '
@@ -221,7 +221,9 @@ test_expect_success 'clone of empty repo propagates name of default branch' '
        GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
        git -c init.defaultBranch=main -c protocol.version=2 \
                clone "file://$(pwd)/file_empty_parent" file_empty_child &&
-       grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD
+       echo refs/heads/mydefaultbranch >expect &&
+       git -C file_empty_child symbolic-ref HEAD >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success '...but not if explicitly forbidden by config' '
@@ -234,7 +236,9 @@ test_expect_success '...but not if explicitly forbidden by config' '
        GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
        git -c init.defaultBranch=main -c protocol.version=2 \
                clone "file://$(pwd)/file_empty_parent" file_empty_child &&
-       ! grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD
+       echo refs/heads/main >expect &&
+       git -C file_empty_child symbolic-ref HEAD >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'bare clone propagates empty default branch' '
@@ -247,7 +251,9 @@ test_expect_success 'bare clone propagates empty default branch' '
        git -c init.defaultBranch=main -c protocol.version=2 \
                clone --bare \
                "file://$(pwd)/file_empty_parent" file_empty_child.git &&
-       grep "refs/heads/mydefaultbranch" file_empty_child.git/HEAD
+       echo "refs/heads/mydefaultbranch" >expect &&
+       git -C file_empty_child.git symbolic-ref HEAD >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'clone propagates unborn HEAD from non-empty repo' '
@@ -265,7 +271,9 @@ test_expect_success 'clone propagates unborn HEAD from non-empty repo' '
        git -c init.defaultBranch=main -c protocol.version=2 \
                clone "file://$(pwd)/file_unborn_parent" \
                file_unborn_child 2>stderr &&
-       grep "refs/heads/mydefaultbranch" file_unborn_child/.git/HEAD &&
+       echo "refs/heads/mydefaultbranch" >expect &&
+       git -C file_unborn_child symbolic-ref HEAD >actual &&
+       test_cmp expect actual &&
        grep "warning: remote HEAD refers to nonexistent ref" stderr
 '
 
@@ -295,7 +303,9 @@ test_expect_success 'bare clone propagates unborn HEAD from non-empty repo' '
        git -c init.defaultBranch=main -c protocol.version=2 \
                clone --bare "file://$(pwd)/file_unborn_parent" \
                file_unborn_child.git 2>stderr &&
-       grep "refs/heads/mydefaultbranch" file_unborn_child.git/HEAD &&
+       echo "refs/heads/mydefaultbranch" >expect &&
+       git -C file_unborn_child.git symbolic-ref HEAD >actual &&
+       test_cmp expect actual &&
        ! grep "warning:" stderr
 '
 
@@ -315,7 +325,9 @@ test_expect_success 'defaulted HEAD uses remote branch if available' '
        git -c init.defaultBranch=branchwithstuff -c protocol.version=2 \
                clone "file://$(pwd)/file_unborn_parent" \
                file_unborn_child 2>stderr &&
-       grep "refs/heads/branchwithstuff" file_unborn_child/.git/HEAD &&
+       echo "refs/heads/branchwithstuff" >expect &&
+       git -C file_unborn_child symbolic-ref HEAD >actual &&
+       test_cmp expect actual &&
        test_path_is_file file_unborn_child/stuff.t &&
        ! grep "warning:" stderr
 '
@@ -377,8 +389,8 @@ test_expect_success 'warn if using server-option with fetch with legacy protocol
        test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -C temp_child -c protocol.version=0 \
                fetch -o hello -o world "file://$(pwd)/file_parent" main 2>err &&
 
-       test_i18ngrep "see protocol.version in" err &&
-       test_i18ngrep "server options require protocol version 2 or later" err
+       test_grep "see protocol.version in" err &&
+       test_grep "server options require protocol version 2 or later" err
 '
 
 test_expect_success 'server-options are sent when cloning' '
@@ -399,8 +411,8 @@ test_expect_success 'warn if using server-option with clone with legacy protocol
                clone --server-option=hello --server-option=world \
                "file://$(pwd)/file_parent" myclone 2>err &&
 
-       test_i18ngrep "see protocol.version in" err &&
-       test_i18ngrep "server options require protocol version 2 or later" err
+       test_grep "see protocol.version in" err &&
+       test_grep "server options require protocol version 2 or later" err
 '
 
 test_expect_success 'upload-pack respects config using protocol v2' '
@@ -495,7 +507,7 @@ test_expect_success 'partial clone warns if filter is not advertised' '
        git -C server config uploadpack.allowfilter 0 &&
        git -c protocol.version=2 \
                clone --filter=blob:none "file://$(pwd)/server" client 2>err &&
-       test_i18ngrep "filtering not recognized by server, ignoring" err
+       test_grep "filtering not recognized by server, ignoring" err
 '
 
 test_expect_success 'even with handcrafted request, filter does not work if not advertised' '
@@ -736,7 +748,7 @@ test_expect_success 'file:// --negotiate-only with protocol v0' '
                --negotiate-only \
                --negotiation-tip=$(git -C client rev-parse HEAD) \
                origin 2>err &&
-       test_i18ngrep "negotiate-only requires protocol v2" err
+       test_grep "negotiate-only requires protocol v2" err
 '
 
 test_expect_success 'push with custom path does not request v2' '
@@ -766,6 +778,25 @@ test_expect_success 'archive with custom path does not request v2' '
        ! grep ^GIT_PROTOCOL env.trace
 '
 
+test_expect_success 'reject client packfile-uris if not advertised' '
+       {
+               packetize command=fetch &&
+               packetize object-format=$(test_oid algo) &&
+               printf 0001 &&
+               packetize packfile-uris https &&
+               packetize done &&
+               printf 0000
+       } >input &&
+       test_must_fail env GIT_PROTOCOL=version=2 \
+               git upload-pack client <input &&
+       test_must_fail env GIT_PROTOCOL=version=2 \
+               git -c uploadpack.blobpackfileuri \
+               upload-pack client <input &&
+       GIT_PROTOCOL=version=2 \
+               git -c uploadpack.blobpackfileuri=anything \
+               upload-pack client <input
+'
+
 # Test protocol v2 with 'http://' transport
 #
 . "$TEST_DIRECTORY"/lib-httpd.sh
@@ -809,7 +840,7 @@ test_expect_success 'clone repository with http:// using protocol v2 with incomp
        # Server responded using protocol v2
        grep "git< version 2" log &&
        # Client reported appropriate failure
-       test_i18ngrep "bytes of length header were received" err
+       test_grep "bytes of length header were received" err
 '
 
 test_expect_success 'clone repository with http:// using protocol v2 with incomplete pktline body' '
@@ -826,7 +857,7 @@ test_expect_success 'clone repository with http:// using protocol v2 with incomp
        # Server responded using protocol v2
        grep "git< version 2" log &&
        # Client reported appropriate failure
-       test_i18ngrep "bytes of body are still expected" err
+       test_grep "bytes of body are still expected" err
 '
 
 test_expect_success 'clone with http:// using protocol v2 and invalid parameters' '
@@ -973,7 +1004,7 @@ test_expect_success 'when server sends "ready", expect DELIM' '
 
        test_must_fail git -C http_child -c protocol.version=2 \
                fetch "$HTTPD_URL/one_time_perl/http_parent" 2> err &&
-       test_i18ngrep "expected packfile to be sent after .ready." err
+       test_grep "expected packfile to be sent after .ready." err
 '
 
 test_expect_success 'when server does not send "ready", expect FLUSH' '
@@ -1001,7 +1032,7 @@ test_expect_success 'when server does not send "ready", expect FLUSH' '
                fetch "$HTTPD_URL/one_time_perl/http_parent" 2> err &&
        grep "fetch< .*acknowledgments" log &&
        ! grep "fetch< .*ready" log &&
-       test_i18ngrep "expected no other sections to be sent after no .ready." err
+       test_grep "expected no other sections to be sent after no .ready." err
 '
 
 configure_exclusion () {
@@ -1111,7 +1142,7 @@ test_expect_success 'fetching with valid packfile URI but invalid hash fails' '
                git -c protocol.version=2 \
                -c fetch.uriprotocols=http,https \
                clone "$HTTPD_URL/smart/http_parent" http_child 2>err &&
-       test_i18ngrep "pack downloaded from.*does not match expected hash" err
+       test_grep "pack downloaded from.*does not match expected hash" err
 '
 
 test_expect_success 'packfile-uri with transfer.fsckobjects' '
@@ -1165,7 +1196,7 @@ test_expect_success 'packfile-uri with transfer.fsckobjects fails on bad object'
        test_must_fail git -c protocol.version=2 -c transfer.fsckobjects=1 \
                -c fetch.uriprotocols=http,https \
                clone "$HTTPD_URL/smart/http_parent" http_child 2>error &&
-       test_i18ngrep "invalid author/committer line - missing email" error
+       test_grep "invalid author/committer line - missing email" error
 '
 
 test_expect_success 'packfile-uri with transfer.fsckobjects succeeds when .gitmodules is separate from tree' '
@@ -1213,7 +1244,7 @@ test_expect_success 'packfile-uri with transfer.fsckobjects fails when .gitmodul
        test_must_fail git -c protocol.version=2 -c transfer.fsckobjects=1 \
                -c fetch.uriprotocols=http,https \
                clone "$HTTPD_URL/smart/http_parent" http_child 2>err &&
-       test_i18ngrep "disallowed submodule name" err
+       test_grep "disallowed submodule name" err
 '
 
 test_expect_success 'packfile-uri path redacted in trace' '
@@ -1296,7 +1327,7 @@ test_expect_success 'http:// --negotiate-only without wait-for-done support' '
                --negotiate-only \
                --negotiation-tip=$(git -C client rev-parse HEAD) \
                origin 2>err &&
-       test_i18ngrep "server does not support wait-for-done" err
+       test_grep "server does not support wait-for-done" err
 '
 
 test_expect_success 'http:// --negotiate-only with protocol v0' '
@@ -1310,7 +1341,7 @@ test_expect_success 'http:// --negotiate-only with protocol v0' '
                --negotiate-only \
                --negotiation-tip=$(git -C client rev-parse HEAD) \
                origin 2>err &&
-       test_i18ngrep "negotiate-only requires protocol v2" err
+       test_grep "negotiate-only requires protocol v2" err
 '
 
 # DO NOT add non-httpd-specific tests here, because the last part of this
index df74f80061c564b7f69961f0f3d665b1afca460f..191097171bcbd4d16f107430af4ee4bb4c14493a 100755 (executable)
@@ -484,7 +484,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
        cp -r "$LOCAL_PRISTINE" local &&
        inconsistency main $(test_oid numeric) &&
        test_must_fail git -C local fetch 2>err &&
-       test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
+       test_grep "fatal: remote error: upload-pack: not our ref" err
 '
 
 test_expect_success 'server is initially ahead - ref in want' '
@@ -530,7 +530,7 @@ test_expect_success 'server loses a ref - ref in want' '
        echo "s/main/rain/" >"$HTTPD_ROOT_PATH/one-time-perl" &&
        test_must_fail git -C local fetch 2>err &&
 
-       test_i18ngrep "fatal: remote error: unknown ref refs/heads/rain" err
+       test_grep "fatal: remote error: unknown ref refs/heads/rain" err
 '
 
 # DO NOT add non-httpd-specific tests here, because the last part of this
index ae1a00afb09e2f38b272602a9c39d51f0fa72110..11be64fc0381134ffe30aa83480d4557c89f6660 100755 (executable)
@@ -18,7 +18,7 @@ test_expect_success 'extra delim packet in v2 ls-refs args' '
        } >input &&
        test_must_fail env GIT_PROTOCOL=version=2 \
                git upload-pack . <input 2>err &&
-       test_i18ngrep "expected flush after ls-refs arguments" err
+       test_grep "expected flush after ls-refs arguments" err
 '
 
 test_expect_success 'extra delim packet in v2 fetch args' '
@@ -31,7 +31,7 @@ test_expect_success 'extra delim packet in v2 fetch args' '
        } >input &&
        test_must_fail env GIT_PROTOCOL=version=2 \
                git upload-pack . <input 2>err &&
-       test_i18ngrep "expected flush after fetch arguments" err
+       test_grep "expected flush after fetch arguments" err
 '
 
 test_expect_success 'bogus symref in v0 capabilities' '
index d386076dbd3f8db7611ab843efcbddca362fa06c..4e0a77f9859b392b06edd9f3696e804271d6f225 100755 (executable)
@@ -137,7 +137,7 @@ test_expect_success 'forced push' '
 test_expect_success 'cloning without refspec' '
        GIT_REMOTE_TESTGIT_NOREFSPEC=1 \
        git clone "testgit::${PWD}/server" local2 2>error &&
-       test_i18ngrep "this remote helper should implement refspec capability" error &&
+       test_grep "this remote helper should implement refspec capability" error &&
        compare_refs local2 HEAD server HEAD
 '
 
@@ -145,7 +145,7 @@ test_expect_success 'pulling without refspecs' '
        (cd local2 &&
        git reset --hard &&
        GIT_REMOTE_TESTGIT_NOREFSPEC=1 git pull 2>../error) &&
-       test_i18ngrep "this remote helper should implement refspec capability" error &&
+       test_grep "this remote helper should implement refspec capability" error &&
        compare_refs local2 HEAD server HEAD
 '
 
@@ -157,7 +157,7 @@ test_expect_success 'pushing without refspecs' '
        GIT_REMOTE_TESTGIT_NOREFSPEC=1 &&
        export GIT_REMOTE_TESTGIT_NOREFSPEC &&
        test_must_fail git push 2>../error) &&
-       test_i18ngrep "remote-helper doesn.t support push; refspec needed" error
+       test_grep "remote-helper doesn.t support push; refspec needed" error
 '
 
 test_expect_success 'pulling without marks' '
@@ -256,7 +256,7 @@ clean_mark () {
 test_expect_success 'proper failure checks for fetching' '
        (cd local &&
        test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error &&
-       test_i18ngrep -q "error while running fast-import" error
+       test_grep -q "error while running fast-import" error
        )
 '
 
index 1544d6dc6ba19170a1dfdb8ded299530f70be1de..bcfb358c51cc087efd75aa04488f9b16a75e7293 100755 (executable)
@@ -12,6 +12,11 @@ url=$2
 
 dir="$GIT_DIR/testgit/$alias"
 
+if ! git rev-parse --is-inside-git-dir
+then
+       exit 1
+fi
+
 h_refspec="refs/heads/*:refs/testgit/$alias/heads/*"
 t_refspec="refs/tags/*:refs/testgit/$alias/tags/*"
 
index 8ac6b2a1d0a286cac120c751e5e3038e465dc074..ed773e7432694b7ccc05a4d09084f238c9ff4b42 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='test disabling of git-over-tcp in clone/fetch'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY/lib-proto-disable.sh"
 . "$TEST_DIRECTORY/lib-git-daemon.sh"
index d8da5f58d16a149647ec35876117b1874bff61f7..769c717e88b83de123a33e9c9bc4b52d192a780a 100755 (executable)
@@ -20,7 +20,7 @@ test_expect_success 'http(s) transport respects GIT_ALLOW_PROTOCOL' '
        test_must_fail env GIT_ALLOW_PROTOCOL=http:https \
                           GIT_SMART_HTTP=0 \
                git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr &&
-       test_i18ngrep -E "(ftp.*disabled|your curl version is too old)" stderr
+       test_grep -E "(ftp.*disabled|your curl version is too old)" stderr
 '
 
 test_expect_success 'curl limits redirects' '
index 12def7bcbf91949a90066b04cb0b9fddeb3f656d..6289a2e8b03890ded5863f3472e469c28cb3034a 100755 (executable)
@@ -169,4 +169,17 @@ test_expect_success 'rev-list --count --objects' '
        test_line_count = $count actual
 '
 
+test_expect_success 'rev-list --unpacked' '
+       git repack -ad &&
+       test_commit unpacked &&
+
+       git rev-list --objects --no-object-names unpacked^.. >expect.raw &&
+       sort expect.raw >expect &&
+
+       git rev-list --all --objects --unpacked --no-object-names >actual.raw &&
+       sort actual.raw >actual &&
+
+       test_cmp expect actual
+'
+
 test_done
index 16635ecc33e5e67ab56985a5e4a071492ed22cc9..73a2465aa0eca662e69f1efd49f285786f5bd9c1 100755 (executable)
@@ -118,10 +118,10 @@ done
 
 test_expect_success 'show advice that grafts are deprecated' '
        git show HEAD 2>err &&
-       test_i18ngrep "git replace" err &&
+       test_grep "git replace" err &&
        test_config advice.graftFileDeprecated false &&
        git show HEAD 2>err &&
-       test_i18ngrep ! "git replace" err
+       test_grep ! "git replace" err
 '
 
 test_done
index 0729f800c3c95790946d68296240799c2dbbb5ad..ee0306aeec0b6e60fc9b62e7efbc5b659fbc1c72 100755 (executable)
@@ -18,20 +18,34 @@ test_expect_success 'no options' '
 '
 
 test_expect_success '--max-count' '
+       test_must_fail git rev-list --max-count=1q HEAD 2>error &&
+       grep "not an integer" error &&
+
        test_stdout_line_count = 0 git rev-list HEAD --max-count=0 &&
        test_stdout_line_count = 3 git rev-list HEAD --max-count=3 &&
        test_stdout_line_count = 5 git rev-list HEAD --max-count=5 &&
-       test_stdout_line_count = 5 git rev-list HEAD --max-count=10
+       test_stdout_line_count = 5 git rev-list HEAD --max-count=10 &&
+       test_stdout_line_count = 5 git rev-list HEAD --max-count=-1
 '
 
 test_expect_success '--max-count all forms' '
+       test_must_fail git rev-list -1q HEAD 2>error &&
+       grep "not an integer" error &&
+       test_must_fail git rev-list --1 HEAD &&
+       test_must_fail git rev-list -n 1q HEAD 2>error &&
+       grep "not an integer" error &&
+
        test_stdout_line_count = 1 git rev-list HEAD --max-count=1 &&
        test_stdout_line_count = 1 git rev-list HEAD -1 &&
        test_stdout_line_count = 1 git rev-list HEAD -n1 &&
-       test_stdout_line_count = 1 git rev-list HEAD -n 1
+       test_stdout_line_count = 1 git rev-list HEAD -n 1 &&
+       test_stdout_line_count = 5 git rev-list HEAD -n -1
 '
 
 test_expect_success '--skip' '
+       test_must_fail git rev-list --skip 1q HEAD 2>error &&
+       grep "not an integer" error &&
+
        test_stdout_line_count = 5 git rev-list HEAD --skip=0 &&
        test_stdout_line_count = 2 git rev-list HEAD --skip=3 &&
        test_stdout_line_count = 0 git rev-list HEAD --skip=5 &&
index 5a67bbc760fdc8c2b53dc7721a144e033bf8e934..91db8fafe83e3883923b71e36bbd8bc11bfde1f6 100755 (executable)
@@ -5,6 +5,7 @@ test_description='ancestor culling and limiting by parent number'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 check_revlist () {
@@ -62,6 +63,17 @@ test_expect_success 'setup roots, merges and octopuses' '
        git checkout main
 '
 
+test_expect_success 'parse --max-parents & --min-parents' '
+       test_must_fail git rev-list --max-parents=1q HEAD 2>error &&
+       grep "not an integer" error &&
+
+       test_must_fail git rev-list --min-parents=1q HEAD 2>error &&
+       grep "not an integer" error &&
+
+       git rev-list --max-parents=1 --min-parents=1 HEAD &&
+       git rev-list --max-parents=-1 --min-parents=-1 HEAD
+'
+
 test_expect_success 'rev-list roots' '
 
        check_revlist "--max-parents=0" one five
index a57f1ae2baa4a72e88183fcaa3b55802a80599ef..4821b90e7479ad8f4878ab4432ce0e9d2ce47de5 100755 (executable)
@@ -68,6 +68,7 @@ check --glob=refs/heads
 check --glob=refs/heads --
 check --glob=refs/heads -- file-1
 check --end-of-options -dashed-branch
+check --all --not refs/heads/main
 
 test_expect_success 'not only --stdin' '
        cat >expect <<-EOF &&
@@ -127,4 +128,24 @@ test_expect_success 'unknown option without --end-of-options' '
        test_cmp expect error
 '
 
+test_expect_success '--not on command line does not influence revisions read via --stdin' '
+       cat >input <<-EOF &&
+       refs/heads/main
+       EOF
+       git rev-list refs/heads/main >expect &&
+
+       git rev-list refs/heads/main --not --stdin <input >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--not via stdin does not influence revisions from command line' '
+       cat >input <<-EOF &&
+       --not
+       EOF
+       git rev-list refs/heads/main >expect &&
+
+       git rev-list refs/heads/main --stdin refs/heads/main <input >actual &&
+       test_cmp expect actual
+'
+
 test_done
index 67d523d40571b89b50cc5ca655ec77198c1a3ae3..3b181f771c25a3d8a074f7d0472bf1f0422f582b 100755 (executable)
@@ -214,15 +214,13 @@ do
        for pseudoopt in branches tags remotes
        do
                test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt" '
-                       echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
                        test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt 2>err &&
-                       test_cmp expected err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
 
                test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt=pattern" '
-                       echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
                        test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
-                       test_cmp expected err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
        done
 done
index 1a9d37e63862f03877fe3d02b94ec8428e7ea01a..51df02105d7b83c3b0b1c85f95d419ac9a4bbfe1 100755 (executable)
@@ -151,12 +151,12 @@ do
        do
                test_expect_success "$section: fails with --$pseudoopt" '
                        test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt 2>err &&
-                       test_i18ngrep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
 
                test_expect_success "$section: fails with --$pseudoopt=pattern" '
                        test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
-                       test_i18ngrep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
        done
 done
diff --git a/t/t6022-rev-list-missing.sh b/t/t6022-rev-list-missing.sh
new file mode 100755 (executable)
index 0000000..127180e
--- /dev/null
@@ -0,0 +1,149 @@
+#!/bin/sh
+
+test_description='handling of missing objects in rev-list'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+# We setup the repository with two commits, this way HEAD is always
+# available and we can hide commit 1.
+test_expect_success 'create repository and alternate directory' '
+       test_commit 1 &&
+       test_commit 2 &&
+       test_commit 3 &&
+       git tag -m "tag message" annot_tag HEAD~1 &&
+       git tag regul_tag HEAD~1 &&
+       git branch a_branch HEAD~1
+'
+
+# We manually corrupt the repository, which means that the commit-graph may
+# contain references to already-deleted objects. We thus need to enable
+# commit-graph paranoia to not returned these deleted commits from the graph.
+GIT_COMMIT_GRAPH_PARANOIA=true
+export GIT_COMMIT_GRAPH_PARANOIA
+
+for obj in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
+do
+       test_expect_success "rev-list --missing=error fails with missing object $obj" '
+               oid="$(git rev-parse $obj)" &&
+               path=".git/objects/$(test_oid_to_path $oid)" &&
+
+               mv "$path" "$path.hidden" &&
+               test_when_finished "mv $path.hidden $path" &&
+
+               test_must_fail git rev-list --missing=error --objects \
+                       --no-object-names HEAD
+       '
+done
+
+for obj in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
+do
+       for action in "allow-any" "print"
+       do
+               test_expect_success "rev-list --missing=$action with missing $obj" '
+                       oid="$(git rev-parse $obj)" &&
+                       path=".git/objects/$(test_oid_to_path $oid)" &&
+
+                       # Before the object is made missing, we use rev-list to
+                       # get the expected oids.
+                       git rev-list --objects --no-object-names \
+                               HEAD ^$obj >expect.raw &&
+
+                       # Blobs are shared by all commits, so even though a commit/tree
+                       # might be skipped, its blob must be accounted for.
+                       if test $obj != "HEAD:1.t"
+                       then
+                               echo $(git rev-parse HEAD:1.t) >>expect.raw &&
+                               echo $(git rev-parse HEAD:2.t) >>expect.raw
+                       fi &&
+
+                       mv "$path" "$path.hidden" &&
+                       test_when_finished "mv $path.hidden $path" &&
+
+                       git rev-list --missing=$action --objects --no-object-names \
+                               HEAD >actual.raw &&
+
+                       # When the action is to print, we should also add the missing
+                       # oid to the expect list.
+                       case $action in
+                       allow-any)
+                               ;;
+                       print)
+                               grep ?$oid actual.raw &&
+                               echo ?$oid >>expect.raw
+                               ;;
+                       esac &&
+
+                       sort actual.raw >actual &&
+                       sort expect.raw >expect &&
+                       test_cmp expect actual
+               '
+       done
+done
+
+for missing_tip in "annot_tag" "regul_tag" "a_branch" "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
+do
+       # We want to check that things work when both
+       #   - all the tips passed are missing (case existing_tip = ""), and
+       #   - there is one missing tip and one existing tip (case existing_tip = "HEAD")
+       for existing_tip in "" "HEAD"
+       do
+               for action in "allow-any" "print"
+               do
+                       test_expect_success "--missing=$action with tip '$missing_tip' missing and tip '$existing_tip'" '
+                               # Before the object is made missing, we use rev-list to
+                               # get the expected oids.
+                               if test "$existing_tip" = "HEAD"
+                               then
+                                       git rev-list --objects --no-object-names \
+                                               HEAD ^$missing_tip >expect.raw
+                               else
+                                       >expect.raw
+                               fi &&
+
+                               # Blobs are shared by all commits, so even though a commit/tree
+                               # might be skipped, its blob must be accounted for.
+                               if test "$existing_tip" = "HEAD" && test $missing_tip != "HEAD:1.t"
+                               then
+                                       echo $(git rev-parse HEAD:1.t) >>expect.raw &&
+                                       echo $(git rev-parse HEAD:2.t) >>expect.raw
+                               fi &&
+
+                               missing_oid="$(git rev-parse $missing_tip)" &&
+
+                               if test "$missing_tip" = "annot_tag"
+                               then
+                                       oid="$(git rev-parse $missing_tip^{commit})" &&
+                                       echo "$missing_oid" >>expect.raw
+                               else
+                                       oid="$missing_oid"
+                               fi &&
+
+                               path=".git/objects/$(test_oid_to_path $oid)" &&
+
+                               mv "$path" "$path.hidden" &&
+                               test_when_finished "mv $path.hidden $path" &&
+
+                               git rev-list --missing=$action --objects --no-object-names \
+                                    $missing_oid $existing_tip >actual.raw &&
+
+                               # When the action is to print, we should also add the missing
+                               # oid to the expect list.
+                               case $action in
+                               allow-any)
+                                       ;;
+                               print)
+                                       grep ?$oid actual.raw &&
+                                       echo ?$oid >>expect.raw
+                                       ;;
+                               esac &&
+
+                               sort actual.raw >actual &&
+                               sort expect.raw >expect &&
+                               test_cmp expect actual
+                       '
+               done
+       done
+done
+
+test_done
index fb01bd6abce2c815b6f50f75e27e2c8f567cf09c..cdc02706404b34b17b29692d72d97fab7eba58b1 100755 (executable)
@@ -170,6 +170,12 @@ test_expect_success 'bisect reset when not bisecting' '
        cmp branch.expect branch.output
 '
 
+test_expect_success 'bisect reset cleans up even when not bisecting' '
+       echo garbage >.git/BISECT_LOG &&
+       git bisect reset &&
+       test_path_is_missing .git/BISECT_LOG
+'
+
 test_expect_success 'bisect reset removes packed refs' '
        git bisect reset &&
        git bisect start &&
@@ -220,7 +226,7 @@ test_expect_success 'bisect start: existing ".git/BISECT_START" not modified if
        cp .git/BISECT_START saved &&
        test_must_fail git bisect start $HASH4 foo -- &&
        git branch > branch.output &&
-       test_i18ngrep "* (no branch, bisect started on other)" branch.output > /dev/null &&
+       test_grep "* (no branch, bisect started on other)" branch.output > /dev/null &&
        test_cmp saved .git/BISECT_START
 '
 test_expect_success 'bisect start: no ".git/BISECT_START" if mistaken rev' '
@@ -588,7 +594,7 @@ test_expect_success 'bisect starting with a detached HEAD' '
 test_expect_success 'bisect errors out if bad and good are mistaken' '
        git bisect reset &&
        test_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&
-       test_i18ngrep "mistook good and bad" rev_list_error &&
+       test_grep "mistook good and bad" rev_list_error &&
        git bisect reset
 '
 
@@ -630,7 +636,7 @@ test_expect_success 'side branch creation' '
 
 test_expect_success 'good merge base when good and bad are siblings' '
        git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
-       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
+       test_grep "merge base must be tested" my_bisect_log.txt &&
        grep $HASH4 my_bisect_log.txt &&
        git bisect good > my_bisect_log.txt &&
        ! grep "merge base must be tested" my_bisect_log.txt &&
@@ -639,7 +645,7 @@ test_expect_success 'good merge base when good and bad are siblings' '
 '
 test_expect_success 'skipped merge base when good and bad are siblings' '
        git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&
-       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
+       test_grep "merge base must be tested" my_bisect_log.txt &&
        grep $HASH4 my_bisect_log.txt &&
        git bisect skip > my_bisect_log.txt 2>&1 &&
        grep "warning" my_bisect_log.txt &&
@@ -649,11 +655,11 @@ test_expect_success 'skipped merge base when good and bad are siblings' '
 
 test_expect_success 'bad merge base when good and bad are siblings' '
        git bisect start "$HASH7" HEAD > my_bisect_log.txt &&
-       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
+       test_grep "merge base must be tested" my_bisect_log.txt &&
        grep $HASH4 my_bisect_log.txt &&
        test_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&
-       test_i18ngrep "merge base $HASH4 is bad" my_bisect_log.txt &&
-       test_i18ngrep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
+       test_grep "merge base $HASH4 is bad" my_bisect_log.txt &&
+       test_grep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
        git bisect reset
 '
 
@@ -704,9 +710,9 @@ test_expect_success '"git bisect run --first-parent" simple case' '
 
 test_expect_success 'good merge bases when good and bad are siblings' '
        git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&
-       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
+       test_grep "merge base must be tested" my_bisect_log.txt &&
        git bisect good > my_bisect_log2.txt &&
-       test_i18ngrep "merge base must be tested" my_bisect_log2.txt &&
+       test_grep "merge base must be tested" my_bisect_log2.txt &&
        {
                {
                        grep "$SIDE_HASH5" my_bisect_log.txt &&
@@ -721,14 +727,14 @@ test_expect_success 'good merge bases when good and bad are siblings' '
 
 test_expect_success 'optimized merge base checks' '
        git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
-       test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
+       test_grep "merge base must be tested" my_bisect_log.txt &&
        grep "$HASH4" my_bisect_log.txt &&
        git bisect good > my_bisect_log2.txt &&
        test -f ".git/BISECT_ANCESTORS_OK" &&
        test "$HASH6" = $(git rev-parse --verify HEAD) &&
        git bisect bad &&
        git bisect good "$A_HASH" > my_bisect_log4.txt &&
-       test_i18ngrep "merge base must be tested" my_bisect_log4.txt &&
+       test_grep "merge base must be tested" my_bisect_log4.txt &&
        test_path_is_missing ".git/BISECT_ANCESTORS_OK"
 '
 
@@ -806,7 +812,7 @@ test_expect_success 'skipping away from skipped commit' '
 
 test_expect_success 'erroring out when using bad path arguments' '
        test_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&
-       test_i18ngrep "bad path arguments" error.txt
+       test_grep "bad path arguments" error.txt
 '
 
 test_expect_success 'test bisection on bare repo - --no-checkout specified' '
@@ -872,7 +878,7 @@ test_expect_success 'broken branch creation' '
 
 echo "" > expected.ok
 cat > expected.missing-tree.default <<EOF
-fatal: unable to read tree $deleted
+fatal: unable to read tree ($deleted)
 EOF
 
 test_expect_success 'bisect fails if tree is broken on start commit' '
@@ -1176,7 +1182,7 @@ test_expect_success 'git bisect reset cleans bisection state properly' '
        git bisect bad $HASH4 &&
        git bisect reset &&
        test -z "$(git for-each-ref "refs/bisect/*")" &&
-       test_path_is_missing ".git/BISECT_EXPECTED_REV" &&
+       test_ref_missing BISECT_EXPECTED_REV &&
        test_path_is_missing ".git/BISECT_ANCESTORS_OK" &&
        test_path_is_missing ".git/BISECT_LOG" &&
        test_path_is_missing ".git/BISECT_RUN" &&
index 7ddbd96e58e71d0ef5cae0334b0ff005c7a5cb25..acc281c116815e2fbec71ca6c78fc90ed6280f73 100755 (executable)
@@ -83,13 +83,13 @@ test_expect_success 'checkout (diverged from upstream)' '
        (
                cd test && git checkout b1
        ) >actual &&
-       test_i18ngrep "have 1 and 1 different" actual
+       test_grep "have 1 and 1 different" actual
 '
 
 test_expect_success 'checkout with local tracked branch' '
        git checkout main &&
        git checkout follower >actual &&
-       test_i18ngrep "is ahead of" actual
+       test_grep "is ahead of" actual
 '
 
 test_expect_success 'checkout (upstream is gone)' '
@@ -97,14 +97,14 @@ test_expect_success 'checkout (upstream is gone)' '
                cd test &&
                git checkout b5
        ) >actual &&
-       test_i18ngrep "is based on .*, but the upstream is gone." actual
+       test_grep "is based on .*, but the upstream is gone." actual
 '
 
 test_expect_success 'checkout (up-to-date with upstream)' '
        (
                cd test && git checkout b6
        ) >actual &&
-       test_i18ngrep "Your branch is up to date with .origin/main" actual
+       test_grep "Your branch is up to date with .origin/main" actual
 '
 
 test_expect_success 'status (diverged from upstream)' '
@@ -114,7 +114,7 @@ test_expect_success 'status (diverged from upstream)' '
                # reports nothing to commit
                test_must_fail git commit --dry-run
        ) >actual &&
-       test_i18ngrep "have 1 and 1 different" actual
+       test_grep "have 1 and 1 different" actual
 '
 
 test_expect_success 'status (upstream is gone)' '
@@ -124,7 +124,7 @@ test_expect_success 'status (upstream is gone)' '
                # reports nothing to commit
                test_must_fail git commit --dry-run
        ) >actual &&
-       test_i18ngrep "is based on .*, but the upstream is gone." actual
+       test_grep "is based on .*, but the upstream is gone." actual
 '
 
 test_expect_success 'status (up-to-date with upstream)' '
@@ -134,7 +134,7 @@ test_expect_success 'status (up-to-date with upstream)' '
                # reports nothing to commit
                test_must_fail git commit --dry-run
        ) >actual &&
-       test_i18ngrep "Your branch is up to date with .origin/main" actual
+       test_grep "Your branch is up to date with .origin/main" actual
 '
 
 cat >expect <<\EOF
@@ -253,7 +253,7 @@ test_expect_success 'fail to track lightweight tags' '
        git checkout main &&
        git tag light &&
        test_must_fail git branch --track lighttrack light >actual &&
-       test_i18ngrep ! "set up to track" actual &&
+       test_grep ! "set up to track" actual &&
        test_must_fail git checkout lighttrack
 '
 
@@ -261,7 +261,7 @@ test_expect_success 'fail to track annotated tags' '
        git checkout main &&
        git tag -m heavy heavy &&
        test_must_fail git branch --track heavytrack heavy >actual &&
-       test_i18ngrep ! "set up to track" actual &&
+       test_grep ! "set up to track" actual &&
        test_must_fail git checkout heavytrack
 '
 
index c9925edf20e7b82ed286b97b9d7247f884c20a62..c6e9b33e44edf4d2d7ecefe688ca6df5fc82d112 100755 (executable)
@@ -44,7 +44,7 @@ commit_peeling_shows_parents ()
        _parent_number=$(( $_parent_number + 1 ))
     done &&
     test_must_fail git rev-parse --verify $_commit^$_parent_number 2>err &&
-    test_i18ngrep "Needed a single revision" err
+    test_grep "Needed a single revision" err
 }
 
 commit_has_parents ()
@@ -137,8 +137,8 @@ test_expect_success 'tag replaced commit' '
 
 test_expect_success '"git fsck" works' '
        git fsck main >fsck_main.out &&
-       test_i18ngrep "dangling commit $R" fsck_main.out &&
-       test_i18ngrep "dangling tag $(git show-ref -s refs/tags/mytag)" fsck_main.out &&
+       test_grep "dangling commit $R" fsck_main.out &&
+       test_grep "dangling tag $(git show-ref -s refs/tags/mytag)" fsck_main.out &&
        test -z "$(git fsck)"
 '
 
@@ -490,9 +490,9 @@ test_expect_success '--convert-graft-file' '
                $(git rev-parse HEAD^^ HEAD^ HEAD^^ HEAD^2) \
                >.git/info/grafts &&
        git status 2>stderr &&
-       test_i18ngrep "hint:.*grafts is deprecated" stderr &&
+       test_grep "hint:.*grafts is deprecated" stderr &&
        git replace --convert-graft-file 2>stderr &&
-       test_i18ngrep ! "hint:.*grafts is deprecated" stderr &&
+       test_grep ! "hint:.*grafts is deprecated" stderr &&
        test_path_is_missing .git/info/grafts &&
 
        : verify that the history is now "grafted" &&
@@ -503,8 +503,8 @@ test_expect_success '--convert-graft-file' '
        test_when_finished "rm -f .git/info/grafts" &&
        echo $EMPTY_BLOB $EMPTY_TREE >.git/info/grafts &&
        test_must_fail git replace --convert-graft-file 2>err &&
-       test_i18ngrep "$EMPTY_BLOB $EMPTY_TREE" err &&
-       test_i18ngrep "$EMPTY_BLOB $EMPTY_TREE" .git/info/grafts
+       test_grep "$EMPTY_BLOB $EMPTY_TREE" err &&
+       test_grep "$EMPTY_BLOB $EMPTY_TREE" .git/info/grafts
 '
 
 test_done
index 9350b5fd2c235604560782e0412ed8f9fee069e3..5d28507efc687b12af0de9762668ec87fd03a0fc 100755 (executable)
@@ -28,7 +28,7 @@ test_expect_success 'TODO (should fail!): traverse unexpected non-blob entry (lo
 
 test_expect_success 'traverse unexpected non-blob entry (seen)' '
        test_must_fail git rev-list --objects $tree $broken_tree >output 2>&1 &&
-       test_i18ngrep "is not a blob" output
+       test_grep "is not a blob" output
 '
 
 test_expect_success 'setup unexpected non-tree entry' '
@@ -42,7 +42,7 @@ test_expect_success 'traverse unexpected non-tree entry (lone)' '
 
 test_expect_success 'traverse unexpected non-tree entry (seen)' '
        test_must_fail git rev-list --objects $blob $broken_tree >output 2>&1 &&
-       test_i18ngrep "is not a tree" output
+       test_grep "is not a tree" output
 '
 
 test_expect_success 'setup unexpected non-commit parent' '
@@ -54,13 +54,13 @@ test_expect_success 'setup unexpected non-commit parent' '
 
 test_expect_success 'traverse unexpected non-commit parent (lone)' '
        test_must_fail git rev-list --objects $broken_commit >output 2>&1 &&
-       test_i18ngrep "not a commit" output
+       test_grep "not a commit" output
 '
 
 test_expect_success 'traverse unexpected non-commit parent (seen)' '
        test_must_fail git rev-list --objects $blob $broken_commit \
                >output 2>&1 &&
-       test_i18ngrep "not a commit" output
+       test_grep "not a commit" output
 '
 
 test_expect_success 'setup unexpected non-tree root' '
@@ -76,7 +76,7 @@ test_expect_success 'traverse unexpected non-tree root (lone)' '
 test_expect_success 'traverse unexpected non-tree root (seen)' '
        test_must_fail git rev-list --objects $blob $broken_commit \
                >output 2>&1 &&
-       test_i18ngrep "not a tree" output
+       test_grep "not a tree" output
 '
 
 test_expect_success 'setup unexpected non-commit tag' '
@@ -93,7 +93,7 @@ test_expect_success 'traverse unexpected non-commit tag (lone)' '
 
 test_expect_success 'traverse unexpected non-commit tag (seen)' '
        test_must_fail git rev-list --objects $blob $tag >output 2>&1 &&
-       test_i18ngrep "not a commit" output
+       test_grep "not a commit" output
 '
 
 test_expect_success 'setup unexpected non-tree tag' '
@@ -110,7 +110,7 @@ test_expect_success 'traverse unexpected non-tree tag (lone)' '
 
 test_expect_success 'traverse unexpected non-tree tag (seen)' '
        test_must_fail git rev-list --objects $blob $tag >output 2>&1 &&
-       test_i18ngrep "not a tree" output
+       test_grep "not a tree" output
 '
 
 test_expect_success 'setup unexpected non-blob tag' '
@@ -127,7 +127,7 @@ test_expect_success 'traverse unexpected non-blob tag (lone)' '
 
 test_expect_success 'traverse unexpected non-blob tag (seen)' '
        test_must_fail git rev-list --objects $commit $tag >output 2>&1 &&
-       test_i18ngrep "not a blob" output
+       test_grep "not a blob" output
 '
 
 test_done
index 8d9d6604f052f6645e8760d3890f1ed29384fd49..43e1afd44c9b9f0a00ed34cb4144f8bb1946b602 100755 (executable)
@@ -457,7 +457,7 @@ expect_invalid_filter_spec () {
        test_must_fail git -C r3 rev-list --objects --filter="$spec" HEAD \
                >actual 2>actual_stderr &&
        test_must_be_empty actual &&
-       test_i18ngrep "$err" actual_stderr
+       test_grep "$err" actual_stderr
 }
 
 test_expect_success 'combine:... while URL-encoding things that should not be' '
@@ -670,7 +670,7 @@ test_expect_success 'rev-list W/ --missing=print' '
        awk -f print_2.awk ls_files_result |
        sort >expected &&
 
-       for id in `cat expected | sed "s|..|&/|"`
+       for id in `sed "s|..|&/|" expected`
        do
                rm r1/.git/objects/$id || return 1
        done &&
index 4d8e09167e78d078a6c14e7d51e3a9cb0aa7bf89..a9656a1ec8a6d71814a5f17157eb0e2acbd4bf98 100755 (executable)
@@ -1,9 +1,12 @@
 #!/bin/sh
 
 test_description='rev-list combining bitmaps and filters'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-bitmap.sh
 
+
 test_expect_success 'set up bitmapped repo' '
        # one commit will have bitmaps, the other will not
        test_commit one &&
@@ -141,4 +144,17 @@ test_expect_success 'combine filter with --filter-provided-objects' '
        done <objects
 '
 
+test_expect_success 'bitmap traversal with --unpacked' '
+       git repack -adb &&
+       test_commit unpacked &&
+
+       git rev-list --objects --no-object-names unpacked^.. >expect.raw &&
+       sort expect.raw >expect &&
+
+       git rev-list --use-bitmap-index --objects --all --unpacked >actual.raw &&
+       sort actual.raw >actual &&
+
+       test_cmp expect actual
+'
+
 test_done
index d59111dedec8020a138296928649eaff4de45694..c0cfda62fa72e3581cdf596d19821c0a7941caf9 100755 (executable)
@@ -48,6 +48,13 @@ check_du HEAD
 check_du --objects HEAD
 check_du --objects HEAD^..HEAD
 
+test_expect_success 'setup for --unpacked tests' '
+       git repack -adb &&
+       test_commit unpacked
+'
+
+check_du --all --objects --unpacked
+
 # As mentioned above, don't use hardcode sizes as actual size, but use the
 # output from git cat-file.
 test_expect_success 'rev-list --disk-usage=human' '
index 0a5c4875407e5ec504831cdcb5d2c6e438d622f1..e78315d23d7d32c6db1f9405aa8788862bf37cd5 100755 (executable)
@@ -392,7 +392,7 @@ test_expect_success 'describe directly tagged blob' '
 test_expect_success 'describe tag object' '
        git tag test-blob-1 -a -m msg unique-file:file &&
        test_must_fail git describe test-blob-1 2>actual &&
-       test_i18ngrep "fatal: test-blob-1 is neither a commit nor blob" actual
+       test_grep "fatal: test-blob-1 is neither a commit nor blob" actual
 '
 
 test_expect_success ULIMIT_STACK_SIZE 'name-rev works in a deep repo' '
index 3214d9db97d9bcedf86de0cfed611517cfbf58f5..16ce4cfcc6420477b2c86718f2e68834b843de61 100755 (executable)
@@ -27,7 +27,7 @@ test_expect_success 'error message for path inside submodule' '
 
 test_expect_success 'error message for path inside submodule from within submodule' '
        test_must_fail git -C sub add . 2>actual &&
-       test_i18ngrep "in unpopulated submodule" actual
+       test_grep "in unpopulated submodule" actual
 '
 
 test_done
index f70c395e75f556d72936c78dbd9bfa9a2554a58f..120dcd74a51434303b8bd7e71d10a9cb120bf574 100755 (executable)
@@ -64,12 +64,24 @@ test_expect_success 'setup .gitattributes' '
        fileSetLabel label
        fileValue label=foo
        fileWrongLabel label☺
+       newFileA* labelA
+       newFileB* labelB
        EOF
        echo fileSetLabel label1 >sub/.gitattributes &&
        git add .gitattributes sub/.gitattributes &&
        git commit -m "add attributes"
 '
 
+test_expect_success 'setup .gitignore' '
+       cat <<-\EOF >.gitignore &&
+       actual
+       expect
+       pathspec_file
+       EOF
+       git add .gitignore &&
+       git commit -m "add gitignore"
+'
+
 test_expect_success 'check specific set attr' '
        cat <<-\EOF >expect &&
        fileSetLabel
@@ -150,6 +162,7 @@ test_expect_success 'check specific value attr (2)' '
 test_expect_success 'check unspecified attr' '
        cat <<-\EOF >expect &&
        .gitattributes
+       .gitignore
        fileA
        fileAB
        fileAC
@@ -175,6 +188,7 @@ test_expect_success 'check unspecified attr' '
 test_expect_success 'check unspecified attr (2)' '
        cat <<-\EOF >expect &&
        HEAD:.gitattributes
+       HEAD:.gitignore
        HEAD:fileA
        HEAD:fileAB
        HEAD:fileAC
@@ -200,6 +214,7 @@ test_expect_success 'check unspecified attr (2)' '
 test_expect_success 'check multiple unspecified attr' '
        cat <<-\EOF >expect &&
        .gitattributes
+       .gitignore
        fileC
        fileNoLabel
        fileWrongLabel
@@ -236,17 +251,100 @@ test_expect_success 'check label excluding other labels' '
 
 test_expect_success 'fail on multiple attr specifiers in one pathspec item' '
        test_must_fail git ls-files . ":(attr:labelB,attr:labelC)" 2>actual &&
-       test_i18ngrep "Only one" actual
+       test_grep "Only one" actual
 '
 
-test_expect_success 'fail if attr magic is used places not implemented' '
+test_expect_success 'fail if attr magic is used in places not implemented' '
        # The main purpose of this test is to check that we actually fail
        # when you attempt to use attr magic in commands that do not implement
-       # attr magic. This test does not advocate git-add to stay that way,
-       # though, but git-add is convenient as it has its own internal pathspec
-       # parsing.
-       test_must_fail git add ":(attr:labelB)" 2>actual &&
-       test_i18ngrep "magic not supported" actual
+       # attr magic. This test does not advocate check-ignore to stay that way.
+       # When you teach the command to grok the pathspec, you need to find
+       # another command to replace it for the test.
+       test_must_fail git check-ignore ":(attr:labelB)" 2>actual &&
+       test_grep "magic not supported" actual
+'
+
+test_expect_success 'check that attr magic works for git stash push' '
+       cat <<-\EOF >expect &&
+       A       sub/newFileA-foo
+       EOF
+       >sub/newFileA-foo &&
+       >sub/newFileB-foo &&
+       git stash push --include-untracked -- ":(exclude,attr:labelB)" &&
+       git stash show --include-untracked --name-status >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check that attr magic works for git add --all' '
+       cat <<-\EOF >expect &&
+       sub/newFileA-foo
+       EOF
+       >sub/newFileA-foo &&
+       >sub/newFileB-foo &&
+       git add --all ":(exclude,attr:labelB)" &&
+       git diff --name-only --cached >actual &&
+       git restore -W -S . &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check that attr magic works for git add -u' '
+       cat <<-\EOF >expect &&
+       sub/fileA
+       EOF
+       >sub/newFileA-foo &&
+       >sub/newFileB-foo &&
+       >sub/fileA &&
+       >sub/fileB &&
+       git add -u ":(exclude,attr:labelB)" &&
+       git diff --name-only --cached  >actual &&
+       git restore -S -W . && rm sub/new* &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check that attr magic works for git add <path>' '
+       cat <<-\EOF >expect &&
+       fileA
+       fileB
+       sub/fileA
+       EOF
+       >fileA &&
+       >fileB &&
+       >sub/fileA &&
+       >sub/fileB &&
+       git add ":(exclude,attr:labelB)sub/*" &&
+       git diff --name-only --cached >actual &&
+       git restore -S -W . &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check that attr magic works for git -add .' '
+       cat <<-\EOF >expect &&
+       sub/fileA
+       EOF
+       >fileA &&
+       >fileB &&
+       >sub/fileA &&
+       >sub/fileB &&
+       cd sub &&
+       git add . ":(exclude,attr:labelB)" &&
+       cd .. &&
+       git diff --name-only --cached >actual &&
+       git restore -S -W . &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check that attr magic works for git add --pathspec-from-file' '
+       cat <<-\EOF >pathspec_file &&
+       :(exclude,attr:labelB)
+       EOF
+       cat <<-\EOF >expect &&
+       sub/newFileA-foo
+       EOF
+       >sub/newFileA-foo &&
+       >sub/newFileB-foo &&
+       git add --all --pathspec-from-file=pathspec_file &&
+       git diff --name-only --cached >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'abort on giving invalid label on the command line' '
@@ -269,12 +367,12 @@ test_expect_success 'check attribute list' '
 
 test_expect_success 'backslash cannot be the last character' '
        test_must_fail git ls-files ":(attr:label=foo\\ labelA=bar)" 2>actual &&
-       test_i18ngrep "not allowed as last character in attr value" actual
+       test_grep "not allowed as last character in attr value" actual
 '
 
 test_expect_success 'backslash cannot be used as a value' '
        test_must_fail git ls-files ":(attr:label=f\\\oo)" 2>actual &&
-       test_i18ngrep "for value matching" actual
+       test_grep "for value matching" actual
 '
 
 test_expect_success 'reading from .gitattributes in a subdirectory (1)' '
@@ -295,4 +393,31 @@ test_expect_success 'reading from .gitattributes in a subdirectory (3)' '
        test_cmp expect actual
 '
 
+test_expect_success POSIXPERM 'pathspec with builtin_objectmode attr can be used' '
+       >mode_exec_file_1 &&
+
+       git status -s ":(attr:builtin_objectmode=100644)mode_exec_*" >actual &&
+       echo ?? mode_exec_file_1 >expect &&
+       test_cmp expect actual &&
+
+       git add mode_exec_file_1 &&
+       chmod +x mode_exec_file_1 &&
+       git status -s ":(attr:builtin_objectmode=100755)mode_exec_*" >actual &&
+       echo AM mode_exec_file_1 >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success POSIXPERM 'builtin_objectmode attr can be excluded' '
+       >mode_1_regular &&
+       >mode_1_exec  &&
+       chmod +x mode_1_exec &&
+       git status -s ":(exclude,attr:builtin_objectmode=100644)" "mode_1_*" >actual &&
+       echo ?? mode_1_exec >expect &&
+       test_cmp expect actual &&
+
+       git status -s ":(exclude,attr:builtin_objectmode=100755)" "mode_1_*" >actual &&
+       echo ?? mode_1_regular >expect &&
+       test_cmp expect actual
+'
+
 test_done
index ae8b5379e24d52c559e0d02da6f95fdbc40874c8..2db37a6596953532423b6c1518fee199a1f5c3de 100755 (executable)
@@ -15,11 +15,11 @@ test_expect_success 'log and ls-files in a bare repository' '
                cd bare &&
                test_must_fail git log -- .. >out 2>err &&
                test_must_be_empty out &&
-               test_i18ngrep "outside repository" err &&
+               test_grep "outside repository" err &&
 
                test_must_fail git ls-files -- .. >out 2>err &&
                test_must_be_empty out &&
-               test_i18ngrep "outside repository" err
+               test_grep "outside repository" err
        )
 '
 
@@ -28,11 +28,11 @@ test_expect_success 'log and ls-files in .git directory' '
                cd .git &&
                test_must_fail git log -- .. >out 2>err &&
                test_must_be_empty out &&
-               test_i18ngrep "outside repository" err &&
+               test_grep "outside repository" err &&
 
                test_must_fail git ls-files -- .. >out 2>err &&
                test_must_be_empty out &&
-               test_i18ngrep "outside repository" err
+               test_grep "outside repository" err
        )
 '
 
index 5b434ab451cf614752210a7e6ed6e420363f1963..eb6c8204e8bd0edd653d74102eb92db3da720202 100755 (executable)
@@ -20,11 +20,19 @@ setdate_and_increment () {
     export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
 }
 
+test_object_file_size () {
+       oid=$(git rev-parse "$1")
+       path=".git/objects/$(test_oid_to_path $oid)"
+       test_file_size "$path"
+}
+
 test_expect_success setup '
-       test_oid_cache <<-EOF &&
-       disklen sha1:138
-       disklen sha256:154
+       # setup .mailmap
+       cat >.mailmap <<-EOF &&
+       A Thor <athor@example.com> A U Thor <author@example.com>
+       C Mitter <cmitter@example.com> C O Mitter <committer@example.com>
        EOF
+
        setdate_and_increment &&
        echo "Using $datestamp" > one &&
        git add one &&
@@ -41,25 +49,29 @@ test_expect_success setup '
        git config push.default current
 '
 
-test_atom() {
+test_atom () {
        case "$1" in
                head) ref=refs/heads/main ;;
                 tag) ref=refs/tags/testtag ;;
                 sym) ref=refs/heads/sym ;;
                   *) ref=$1 ;;
        esac
+       format=$2
+       test_do=test_expect_${4:-success}
+
        printf '%s\n' "$3" >expected
-       test_expect_${4:-success} $PREREQ "basic atom: $1 $2" "
-               git for-each-ref --format='%($2)' $ref >actual &&
+       $test_do $PREREQ "basic atom: $ref $format" '
+               git for-each-ref --format="%($format)" "$ref" >actual &&
                sanitize_pgp <actual >actual.clean &&
                test_cmp expected actual.clean
-       "
+       '
+
        # Automatically test "contents:size" atom after testing "contents"
-       if test "$2" = "contents"
+       if test "$format" = "contents"
        then
                # for commit leg, $3 is changed there
                expect=$(printf '%s' "$3" | wc -c)
-               test_expect_${4:-success} $PREREQ "basic atom: $1 contents:size" '
+               $test_do $PREREQ "basic atom: $ref contents:size" '
                        type=$(git cat-file -t "$ref") &&
                        case $type in
                        tag)
@@ -83,7 +95,6 @@ test_atom() {
 }
 
 hexlen=$(test_oid hexsz)
-disklen=$(test_oid disklen)
 
 test_atom head refname refs/heads/main
 test_atom head refname: refs/heads/main
@@ -118,7 +129,7 @@ test_atom head push:strip=1 remotes/myfork/main
 test_atom head push:strip=-1 main
 test_atom head objecttype commit
 test_atom head objectsize $((131 + hexlen))
-test_atom head objectsize:disk $disklen
+test_atom head objectsize:disk $(test_object_file_size refs/heads/main)
 test_atom head deltabase $ZERO_OID
 test_atom head objectname $(git rev-parse refs/heads/main)
 test_atom head objectname:short $(git rev-parse --short refs/heads/main)
@@ -141,15 +152,31 @@ test_atom head '*objectname' ''
 test_atom head '*objecttype' ''
 test_atom head author 'A U Thor <author@example.com> 1151968724 +0200'
 test_atom head authorname 'A U Thor'
+test_atom head authorname:mailmap 'A Thor'
 test_atom head authoremail '<author@example.com>'
 test_atom head authoremail:trim 'author@example.com'
 test_atom head authoremail:localpart 'author'
+test_atom head authoremail:trim,localpart 'author'
+test_atom head authoremail:mailmap '<athor@example.com>'
+test_atom head authoremail:mailmap,trim 'athor@example.com'
+test_atom head authoremail:trim,mailmap 'athor@example.com'
+test_atom head authoremail:mailmap,localpart 'athor'
+test_atom head authoremail:localpart,mailmap 'athor'
+test_atom head authoremail:mailmap,trim,localpart,mailmap,trim 'athor'
 test_atom head authordate 'Tue Jul 4 01:18:44 2006 +0200'
 test_atom head committer 'C O Mitter <committer@example.com> 1151968723 +0200'
 test_atom head committername 'C O Mitter'
+test_atom head committername:mailmap 'C Mitter'
 test_atom head committeremail '<committer@example.com>'
 test_atom head committeremail:trim 'committer@example.com'
 test_atom head committeremail:localpart 'committer'
+test_atom head committeremail:localpart,trim 'committer'
+test_atom head committeremail:mailmap '<cmitter@example.com>'
+test_atom head committeremail:mailmap,trim 'cmitter@example.com'
+test_atom head committeremail:trim,mailmap 'cmitter@example.com'
+test_atom head committeremail:mailmap,localpart 'cmitter'
+test_atom head committeremail:localpart,mailmap 'cmitter'
+test_atom head committeremail:trim,mailmap,trim,trim,localpart 'cmitter'
 test_atom head committerdate 'Tue Jul 4 01:18:43 2006 +0200'
 test_atom head tag ''
 test_atom head tagger ''
@@ -176,8 +203,8 @@ test_atom tag upstream ''
 test_atom tag push ''
 test_atom tag objecttype tag
 test_atom tag objectsize $((114 + hexlen))
-test_atom tag objectsize:disk $disklen
-test_atom tag '*objectsize:disk' $disklen
+test_atom tag objectsize:disk $(test_object_file_size refs/tags/testtag)
+test_atom tag '*objectsize:disk' $(test_object_file_size refs/heads/main)
 test_atom tag deltabase $ZERO_OID
 test_atom tag '*deltabase' $ZERO_OID
 test_atom tag objectname $(git rev-parse refs/tags/testtag)
@@ -199,22 +226,46 @@ test_atom tag '*objectname' $(git rev-parse refs/tags/testtag^{})
 test_atom tag '*objecttype' 'commit'
 test_atom tag author ''
 test_atom tag authorname ''
+test_atom tag authorname:mailmap ''
 test_atom tag authoremail ''
 test_atom tag authoremail:trim ''
 test_atom tag authoremail:localpart ''
+test_atom tag authoremail:trim,localpart ''
+test_atom tag authoremail:mailmap ''
+test_atom tag authoremail:mailmap,trim ''
+test_atom tag authoremail:trim,mailmap ''
+test_atom tag authoremail:mailmap,localpart ''
+test_atom tag authoremail:localpart,mailmap ''
+test_atom tag authoremail:mailmap,trim,localpart,mailmap,trim ''
 test_atom tag authordate ''
 test_atom tag committer ''
 test_atom tag committername ''
+test_atom tag committername:mailmap ''
 test_atom tag committeremail ''
 test_atom tag committeremail:trim ''
 test_atom tag committeremail:localpart ''
+test_atom tag committeremail:localpart,trim ''
+test_atom tag committeremail:mailmap ''
+test_atom tag committeremail:mailmap,trim ''
+test_atom tag committeremail:trim,mailmap ''
+test_atom tag committeremail:mailmap,localpart ''
+test_atom tag committeremail:localpart,mailmap ''
+test_atom tag committeremail:trim,mailmap,trim,trim,localpart ''
 test_atom tag committerdate ''
 test_atom tag tag 'testtag'
 test_atom tag tagger 'C O Mitter <committer@example.com> 1151968725 +0200'
 test_atom tag taggername 'C O Mitter'
+test_atom tag taggername:mailmap 'C Mitter'
 test_atom tag taggeremail '<committer@example.com>'
 test_atom tag taggeremail:trim 'committer@example.com'
 test_atom tag taggeremail:localpart 'committer'
+test_atom tag taggeremail:trim,localpart 'committer'
+test_atom tag taggeremail:mailmap '<cmitter@example.com>'
+test_atom tag taggeremail:mailmap,trim 'cmitter@example.com'
+test_atom tag taggeremail:trim,mailmap 'cmitter@example.com'
+test_atom tag taggeremail:mailmap,localpart 'cmitter'
+test_atom tag taggeremail:localpart,mailmap 'cmitter'
+test_atom tag taggeremail:trim,mailmap,trim,localpart,localpart 'cmitter'
 test_atom tag taggerdate 'Tue Jul 4 01:18:45 2006 +0200'
 test_atom tag creator 'C O Mitter <committer@example.com> 1151968725 +0200'
 test_atom tag creatordate 'Tue Jul 4 01:18:45 2006 +0200'
@@ -267,6 +318,66 @@ test_expect_success 'arguments to %(objectname:short=) must be positive integers
        test_must_fail git for-each-ref --format="%(objectname:short=foo)"
 '
 
+test_bad_atom () {
+       case "$1" in
+       head) ref=refs/heads/main ;;
+        tag) ref=refs/tags/testtag ;;
+        sym) ref=refs/heads/sym ;;
+          *) ref=$1 ;;
+       esac
+       format=$2
+       test_do=test_expect_${4:-success}
+
+       printf '%s\n' "$3" >expect
+       $test_do $PREREQ "err basic atom: $ref $format" '
+               test_must_fail git for-each-ref \
+                       --format="%($format)" "$ref" 2>error &&
+               test_cmp expect error
+       '
+}
+
+test_bad_atom head 'authoremail:foo' \
+       'fatal: unrecognized %(authoremail) argument: foo'
+
+test_bad_atom head 'authoremail:mailmap,trim,bar' \
+       'fatal: unrecognized %(authoremail) argument: bar'
+
+test_bad_atom head 'authoremail:trim,' \
+       'fatal: unrecognized %(authoremail) argument: '
+
+test_bad_atom head 'authoremail:mailmaptrim' \
+       'fatal: unrecognized %(authoremail) argument: trim'
+
+test_bad_atom head 'committeremail: ' \
+       'fatal: unrecognized %(committeremail) argument:  '
+
+test_bad_atom head 'committeremail: trim,foo' \
+       'fatal: unrecognized %(committeremail) argument:  trim,foo'
+
+test_bad_atom head 'committeremail:mailmap,localpart ' \
+       'fatal: unrecognized %(committeremail) argument:  '
+
+test_bad_atom head 'committeremail:trim_localpart' \
+       'fatal: unrecognized %(committeremail) argument: _localpart'
+
+test_bad_atom head 'committeremail:localpart,,,trim' \
+       'fatal: unrecognized %(committeremail) argument: ,,trim'
+
+test_bad_atom tag 'taggeremail:mailmap,trim, foo ' \
+       'fatal: unrecognized %(taggeremail) argument:  foo '
+
+test_bad_atom tag 'taggeremail:trim,localpart,' \
+       'fatal: unrecognized %(taggeremail) argument: '
+
+test_bad_atom tag 'taggeremail:mailmap;localpart trim' \
+       'fatal: unrecognized %(taggeremail) argument: ;localpart trim'
+
+test_bad_atom tag 'taggeremail:localpart trim' \
+       'fatal: unrecognized %(taggeremail) argument:  trim'
+
+test_bad_atom tag 'taggeremail:mailmap,mailmap,trim,qux,localpart,trim' \
+       'fatal: unrecognized %(taggeremail) argument: qux,localpart,trim'
+
 test_date () {
        f=$1 &&
        committer_date=$2 &&
@@ -1017,16 +1128,16 @@ test_expect_success 'Verify sorts with raw' '
 test_expect_success 'Verify sorts with raw:size' '
        cat >expected <<-EOF &&
        refs/myblobs/blob8
-       refs/myblobs/first
        refs/myblobs/blob7
-       refs/heads/main
        refs/myblobs/blob4
        refs/myblobs/blob1
        refs/myblobs/blob2
        refs/myblobs/blob3
        refs/myblobs/blob5
        refs/myblobs/blob6
+       refs/myblobs/first
        refs/mytrees/first
+       refs/heads/main
        EOF
        git for-each-ref --format="%(refname)" --sort=raw:size \
                refs/heads/main refs/myblobs/ refs/mytrees/first >actual &&
@@ -1138,6 +1249,17 @@ test_expect_success 'for-each-ref --format compare with cat-file --batch' '
        test_cmp expected actual
 '
 
+test_expect_success 'verify sorts with contents:size' '
+       cat >expect <<-\EOF &&
+       refs/heads/main
+       refs/heads/newtag
+       refs/heads/ambiguous
+       EOF
+       git for-each-ref --format="%(refname)" \
+               --sort=contents:size refs/heads/ >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'set up multiple-sort tags' '
        for when in 100000 200000
        do
@@ -1213,6 +1335,73 @@ test_expect_success '--no-sort cancels the previous sort keys' '
        test_cmp expected actual
 '
 
+test_expect_success '--no-sort without subsequent --sort prints expected refs' '
+       cat >expected <<-\EOF &&
+       refs/tags/multi-ref1-100000-user1
+       refs/tags/multi-ref1-100000-user2
+       refs/tags/multi-ref1-200000-user1
+       refs/tags/multi-ref1-200000-user2
+       refs/tags/multi-ref2-100000-user1
+       refs/tags/multi-ref2-100000-user2
+       refs/tags/multi-ref2-200000-user1
+       refs/tags/multi-ref2-200000-user2
+       EOF
+
+       # Sort the results with `sort` for a consistent comparison against
+       # expected
+       git for-each-ref \
+               --format="%(refname)" \
+               --no-sort \
+               "refs/tags/multi-*" | sort >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'set up custom date sorting' '
+       # Dates:
+       # - Wed Feb 07 2024 21:34:20 +0000
+       # - Tue Dec 14 1999 00:05:22 +0000
+       # - Fri Jun 04 2021 11:26:51 +0000
+       # - Mon Jan 22 2007 16:44:01 GMT+0000
+       i=1 &&
+       for when in 1707341660 945129922 1622806011 1169484241
+       do
+               GIT_COMMITTER_DATE="@$when +0000" \
+               GIT_COMMITTER_EMAIL="user@example.com" \
+               git tag -m "tag $when" custom-dates-$i &&
+               i=$(($i+1)) || return 1
+       done
+'
+
+test_expect_success 'sort by date defaults to full timestamp' '
+       cat >expected <<-\EOF &&
+       945129922 refs/tags/custom-dates-2
+       1169484241 refs/tags/custom-dates-4
+       1622806011 refs/tags/custom-dates-3
+       1707341660 refs/tags/custom-dates-1
+       EOF
+
+       git for-each-ref \
+               --format="%(creatordate:unix) %(refname)" \
+               --sort=creatordate \
+               "refs/tags/custom-dates-*" >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'sort by custom date format' '
+       cat >expected <<-\EOF &&
+       00:05:22 refs/tags/custom-dates-2
+       11:26:51 refs/tags/custom-dates-3
+       16:44:01 refs/tags/custom-dates-4
+       21:34:20 refs/tags/custom-dates-1
+       EOF
+
+       git for-each-ref \
+               --format="%(creatordate:format:%H:%M:%S) %(refname)" \
+               --sort="creatordate:format:%H:%M:%S" \
+               "refs/tags/custom-dates-*" >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
        test_when_finished "git checkout main" &&
        git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
@@ -1696,6 +1885,28 @@ test_expect_success 'git for-each-ref with non-existing refs' '
        test_must_be_empty actual
 '
 
+test_expect_success 'git for-each-ref with nested tags' '
+       git tag -am "Normal tag" nested/base HEAD &&
+       git tag -am "Nested tag" nested/nest1 refs/tags/nested/base &&
+       git tag -am "Double nested tag" nested/nest2 refs/tags/nested/nest1 &&
+
+       head_oid="$(git rev-parse HEAD)" &&
+       base_tag_oid="$(git rev-parse refs/tags/nested/base)" &&
+       nest1_tag_oid="$(git rev-parse refs/tags/nested/nest1)" &&
+       nest2_tag_oid="$(git rev-parse refs/tags/nested/nest2)" &&
+
+       cat >expect <<-EOF &&
+       refs/tags/nested/base $base_tag_oid tag $head_oid commit
+       refs/tags/nested/nest1 $nest1_tag_oid tag $head_oid commit
+       refs/tags/nested/nest2 $nest2_tag_oid tag $head_oid commit
+       EOF
+
+       git for-each-ref \
+               --format="%(refname) %(objectname) %(objecttype) %(*objectname) %(*objecttype)" \
+               refs/tags/nested/ >actual &&
+       test_cmp expect actual
+'
+
 GRADE_FORMAT="%(signature:grade)%0a%(signature:key)%0a%(signature:signer)%0a%(signature:fingerprint)%0a%(signature:primarykeyfingerprint)"
 TRUSTLEVEL_FORMAT="%(signature:trustlevel)%0a%(signature:key)%0a%(signature:signer)%0a%(signature:fingerprint)%0a%(signature:primarykeyfingerprint)"
 
@@ -1763,10 +1974,7 @@ test_expect_success GPGSSH 'setup for signature atom using ssh' '
 '
 
 test_expect_success GPG2 'bare signature atom' '
-       git verify-commit first-signed 2>out.raw &&
-       grep -Ev "checking the trustdb|PGP trust model" out.raw >out &&
-       head -3 out >expect &&
-       tail -1 out >>expect &&
+       git verify-commit first-signed 2>expect &&
        echo  >>expect &&
        git for-each-ref refs/tags/first-signed \
                --format="%(signature)" >actual &&
index 2667dd13fe33893086e2bdf14a94a6f3c8648d84..83b8a19d94176dcf66d2aca1d8a4b9519ee020fe 100755 (executable)
@@ -15,7 +15,7 @@ test_expect_success setup '
        git for-each-ref --format="%(objectname) %(refname)" >brief-list
 '
 
-test_expect_success 'Broken refs are reported correctly' '
+test_expect_success REFFILES 'Broken refs are reported correctly' '
        r=refs/heads/bogus &&
        : >.git/$r &&
        test_when_finished "rm -f .git/$r" &&
@@ -25,7 +25,7 @@ test_expect_success 'Broken refs are reported correctly' '
        test_cmp broken-err err
 '
 
-test_expect_success 'NULL_SHA1 refs are reported correctly' '
+test_expect_success REFFILES 'NULL_SHA1 refs are reported correctly' '
        r=refs/heads/zeros &&
        echo $ZEROS >.git/$r &&
        test_when_finished "rm -f .git/$r" &&
@@ -39,15 +39,14 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '
 '
 
 test_expect_success 'Missing objects are reported correctly' '
-       r=refs/heads/missing &&
-       echo $MISSING >.git/$r &&
-       test_when_finished "rm -f .git/$r" &&
-       echo "fatal: missing object $MISSING for $r" >missing-err &&
+       test_when_finished "git update-ref -d refs/heads/missing" &&
+       test-tool ref-store main update-ref msg refs/heads/missing "$MISSING" "$ZERO_OID" REF_SKIP_OID_VERIFICATION &&
+       echo "fatal: missing object $MISSING for refs/heads/missing" >missing-err &&
        test_must_fail git for-each-ref 2>err &&
        test_cmp missing-err err &&
        (
                cat brief-list &&
-               echo "$MISSING $r"
+               echo "$MISSING refs/heads/missing"
        ) | sort -k 2 >missing-brief-expected &&
        git for-each-ref --format="%(objectname) %(refname)" >brief-out 2>brief-err &&
        test_cmp missing-brief-expected brief-out &&
index af223e44d679571b3148d265ebb09049275cef3a..948f1bb5f44e66b80004cce1b1ac2b9ee3bd4ac9 100755 (executable)
@@ -31,6 +31,37 @@ test_expect_success 'setup some history and refs' '
        git update-ref refs/odd/spot main
 '
 
+test_expect_success '--include-root-refs pattern prints pseudorefs' '
+       cat >expect <<-\EOF &&
+       HEAD
+       ORIG_HEAD
+       refs/heads/main
+       refs/heads/side
+       refs/odd/spot
+       refs/tags/annotated-tag
+       refs/tags/doubly-annotated-tag
+       refs/tags/doubly-signed-tag
+       refs/tags/four
+       refs/tags/one
+       refs/tags/signed-tag
+       refs/tags/three
+       refs/tags/two
+       EOF
+       git update-ref ORIG_HEAD main &&
+       git for-each-ref --format="%(refname)" --include-root-refs >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--include-root-refs with other patterns' '
+       cat >expect <<-\EOF &&
+       HEAD
+       ORIG_HEAD
+       EOF
+       git update-ref ORIG_HEAD main &&
+       git for-each-ref --format="%(refname)" --include-root-refs "*HEAD" >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'filtering with --points-at' '
        cat >expect <<-\EOF &&
        refs/heads/main
@@ -45,8 +76,8 @@ test_expect_success 'check signed tags with --points-at' '
        sed -e "s/Z$//" >expect <<-\EOF &&
        refs/heads/side Z
        refs/tags/annotated-tag four
-       refs/tags/doubly-annotated-tag An annotated tag
-       refs/tags/doubly-signed-tag A signed tag
+       refs/tags/doubly-annotated-tag four
+       refs/tags/doubly-signed-tag four
        refs/tags/four Z
        refs/tags/signed-tag four
        EOF
index 772238e582c6f11b81c12a519f81bbe48cecf635..2738b50c2a9e01aab9e3248e666ddb91be9c3bcf 100755 (executable)
@@ -311,13 +311,13 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
        git checkout -q renamed-file-has-no-conflicts^0 &&
        test_must_fail git merge --strategy=recursive dir-in-way >output &&
 
-       test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
-       test_i18ngrep "Auto-merging dir" output &&
+       test_grep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
+       test_grep "Auto-merging dir" output &&
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
        then
-               test_i18ngrep "moving it to dir~HEAD instead" output
+               test_grep "moving it to dir~HEAD instead" output
        else
-               test_i18ngrep "Adding as dir~HEAD instead" output
+               test_grep "Adding as dir~HEAD instead" output
        fi &&
 
        test_stdout_line_count = 3 git ls-files -u &&
@@ -338,13 +338,13 @@ test_expect_success 'Same as previous, but merged other way' '
        test_must_fail git merge --strategy=recursive renamed-file-has-no-conflicts >output 2>errors &&
 
        ! grep "error: refusing to lose untracked file at" errors &&
-       test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
-       test_i18ngrep "Auto-merging dir" output &&
+       test_grep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
+       test_grep "Auto-merging dir" output &&
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
        then
-               test_i18ngrep "moving it to dir~renamed-file-has-no-conflicts instead" output
+               test_grep "moving it to dir~renamed-file-has-no-conflicts instead" output
        else
-               test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output
+               test_grep "Adding as dir~renamed-file-has-no-conflicts instead" output
        fi &&
 
        test_stdout_line_count = 3 git ls-files -u &&
index 1a7082323dddfce66b2d419efe60c87314c5f8e1..fb872c5a1136fc523dacdf6f9778b37441905980 100755 (executable)
@@ -56,7 +56,67 @@ test_expect_success 'setup' '
        deduxit me super semitas jusitiae,
        EOF
 
-       printf "propter nomen suum." >>new4.txt
+       printf "propter nomen suum." >>new4.txt &&
+
+       cat >base.c <<-\EOF &&
+       int f(int x, int y)
+       {
+               if (x == 0)
+               {
+                       return y;
+               }
+               return x;
+       }
+
+       int g(size_t u)
+       {
+               while (u < 30)
+               {
+                       u++;
+               }
+               return u;
+       }
+       EOF
+
+       cat >ours.c <<-\EOF &&
+       int g(size_t u)
+       {
+               while (u < 30)
+               {
+                       u++;
+               }
+               return u;
+       }
+
+       int h(int x, int y, int z)
+       {
+               if (z == 0)
+               {
+                       return x;
+               }
+               return y;
+       }
+       EOF
+
+       cat >theirs.c <<-\EOF
+       int f(int x, int y)
+       {
+               if (x == 0)
+               {
+                       return y;
+               }
+               return x;
+       }
+
+       int g(size_t u)
+       {
+               while (u > 34)
+               {
+                       u--;
+               }
+               return u;
+       }
+       EOF
 '
 
 test_expect_success 'merge with no changes' '
@@ -65,11 +125,30 @@ test_expect_success 'merge with no changes' '
        test_cmp test.txt orig.txt
 '
 
+test_expect_success 'merge with no changes with --object-id' '
+       git add orig.txt &&
+       git merge-file -p --object-id :orig.txt :orig.txt :orig.txt >actual &&
+       test_cmp actual orig.txt
+'
+
 test_expect_success "merge without conflict" '
        cp new1.txt test.txt &&
        git merge-file test.txt orig.txt new2.txt
 '
 
+test_expect_success 'merge without conflict with --object-id' '
+       git add orig.txt new2.txt &&
+       git merge-file --object-id :orig.txt :orig.txt :new2.txt >actual &&
+       git rev-parse :new2.txt >expected &&
+       test_cmp actual expected
+'
+
+test_expect_success 'can accept object ID with --object-id' '
+       git merge-file --object-id $(test_oid empty_blob) $(test_oid empty_blob) :new2.txt >actual &&
+       git rev-parse :new2.txt >expected &&
+       test_cmp actual expected
+'
+
 test_expect_success 'works in subdirectory' '
        mkdir dir &&
        cp new1.txt dir/a.txt &&
@@ -138,6 +217,31 @@ test_expect_success "expected conflict markers" '
        test_cmp expect.txt test.txt
 '
 
+test_expect_success "merge with conflicts with --object-id" '
+       git add backup.txt orig.txt new3.txt &&
+       test_must_fail git merge-file -p --object-id :backup.txt :orig.txt :new3.txt >actual &&
+       sed -e "s/<< test.txt/<< :backup.txt/" \
+           -e "s/>> new3.txt/>> :new3.txt/" \
+           expect.txt >expect &&
+       test_cmp expect actual &&
+       test_must_fail git merge-file --object-id :backup.txt :orig.txt :new3.txt >oid &&
+       git cat-file blob "$(cat oid)" >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success "merge with conflicts with --object-id with labels" '
+       git add backup.txt orig.txt new3.txt &&
+       test_must_fail git merge-file -p --object-id \
+               -L test.txt -L orig.txt -L new3.txt \
+               :backup.txt :orig.txt :new3.txt >actual &&
+       test_cmp expect.txt actual &&
+       test_must_fail git merge-file --object-id \
+               -L test.txt -L orig.txt -L new3.txt \
+               :backup.txt :orig.txt :new3.txt >oid &&
+       git cat-file blob "$(cat oid)" >actual &&
+       test_cmp expect.txt actual
+'
+
 test_expect_success "merge conflicting with --ours" '
        cp backup.txt test.txt &&
 
@@ -256,6 +360,14 @@ test_expect_success 'binary files cannot be merged' '
        grep "Cannot merge binary files" merge.err
 '
 
+test_expect_success 'binary files cannot be merged with --object-id' '
+       cp "$TEST_DIRECTORY"/test-binary-1.png . &&
+       git add orig.txt new1.txt test-binary-1.png &&
+       test_must_fail git merge-file --object-id \
+               :orig.txt :test-binary-1.png :new1.txt 2> merge.err &&
+       grep "Cannot merge binary files" merge.err
+'
+
 test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' '
        sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" <new5.txt >new6.txt &&
        sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" <new5.txt >new7.txt &&
@@ -389,4 +501,72 @@ test_expect_success 'conflict sections match existing line endings' '
        test $(tr "\015" Q <nolf.txt | grep "^[<=>].*Q$" | wc -l) = 0
 '
 
+test_expect_success '--object-id fails without repository' '
+       empty="$(test_oid empty_blob)" &&
+       nongit test_must_fail git merge-file --object-id $empty $empty $empty 2>err &&
+       grep "not a git repository" err
+'
+
+test_expect_success 'merging C files with "myers" diff algorithm creates some spurious conflicts' '
+       cat >expect.c <<-\EOF &&
+       int g(size_t u)
+       {
+               while (u < 30)
+               {
+                       u++;
+               }
+               return u;
+       }
+
+       int h(int x, int y, int z)
+       {
+       <<<<<<< ours.c
+               if (z == 0)
+       ||||||| base.c
+               while (u < 30)
+       =======
+               while (u > 34)
+       >>>>>>> theirs.c
+               {
+       <<<<<<< ours.c
+                       return x;
+       ||||||| base.c
+                       u++;
+       =======
+                       u--;
+       >>>>>>> theirs.c
+               }
+               return y;
+       }
+       EOF
+
+       test_must_fail git merge-file -p --diff3 --diff-algorithm myers ours.c base.c theirs.c >myers_output.c &&
+       test_cmp expect.c myers_output.c
+'
+
+test_expect_success 'merging C files with "histogram" diff algorithm avoids some spurious conflicts' '
+       cat >expect.c <<-\EOF &&
+       int g(size_t u)
+       {
+               while (u > 34)
+               {
+                       u--;
+               }
+               return u;
+       }
+
+       int h(int x, int y, int z)
+       {
+               if (z == 0)
+               {
+                       return x;
+               }
+               return y;
+       }
+       EOF
+
+       git merge-file -p --diff3 --diff-algorithm histogram ours.c base.c theirs.c >histogram_output.c &&
+       test_cmp expect.c histogram_output.c
+'
+
 test_done
index 9677180a5b3392da63ab32f4462c5ec89a9958f3..156a1efacfeabcba3cff34d1044efd522183f13d 100755 (executable)
@@ -42,11 +42,15 @@ test_expect_success setup '
        #!/bin/sh
 
        orig="$1" ours="$2" theirs="$3" exit="$4" path=$5
+       orig_name="$6" our_name="$7" their_name="$8"
        (
                echo "orig is $orig"
                echo "ours is $ours"
                echo "theirs is $theirs"
                echo "path is $path"
+               echo "orig_name is $orig_name"
+               echo "our_name is $our_name"
+               echo "their_name is $their_name"
                echo "=== orig ==="
                cat "$orig"
                echo "=== ours ==="
@@ -121,7 +125,7 @@ test_expect_success 'custom merge backend' '
 
        git reset --hard anchor &&
        git config --replace-all \
-       merge.custom.driver "./custom-merge %O %A %B 0 %P" &&
+       merge.custom.driver "./custom-merge %O %A %B 0 %P %S %X %Y" &&
        git config --replace-all \
        merge.custom.name "custom merge driver for testing" &&
 
@@ -132,7 +136,8 @@ test_expect_success 'custom merge backend' '
        o=$(git unpack-file main^:text) &&
        a=$(git unpack-file side^:text) &&
        b=$(git unpack-file main:text) &&
-       sh -c "./custom-merge $o $a $b 0 text" &&
+       base_revid=$(git rev-parse --short main^) &&
+       sh -c "./custom-merge $o $a $b 0 text $base_revid HEAD main" &&
        sed -e 1,3d $a >check-2 &&
        cmp check-1 check-2 &&
        rm -f $o $a $b
@@ -142,7 +147,7 @@ test_expect_success 'custom merge backend' '
 
        git reset --hard anchor &&
        git config --replace-all \
-       merge.custom.driver "./custom-merge %O %A %B 1 %P" &&
+       merge.custom.driver "./custom-merge %O %A %B 1 %P %S %X %Y" &&
        git config --replace-all \
        merge.custom.name "custom merge driver for testing" &&
 
@@ -159,7 +164,8 @@ test_expect_success 'custom merge backend' '
        o=$(git unpack-file main^:text) &&
        a=$(git unpack-file anchor:text) &&
        b=$(git unpack-file main:text) &&
-       sh -c "./custom-merge $o $a $b 0 text" &&
+       base_revid=$(git rev-parse --short main^) &&
+       sh -c "./custom-merge $o $a $b 0 text $base_revid HEAD main" &&
        sed -e 1,3d $a >check-2 &&
        cmp check-1 check-2 &&
        sed -e 1,3d -e 4q $a >check-3 &&
@@ -173,13 +179,14 @@ test_expect_success !WINDOWS 'custom merge driver that is killed with a signal'
 
        git reset --hard anchor &&
        git config --replace-all \
-       merge.custom.driver "./custom-merge %O %A %B 0 %P" &&
+       merge.custom.driver "./custom-merge %O %A %B 0 %P %S %X %Y" &&
        git config --replace-all \
        merge.custom.name "custom merge driver for testing" &&
 
        >./please-abort &&
        echo "* merge=custom" >.gitattributes &&
-       test_must_fail git merge main &&
+       test_must_fail git merge main 2>err &&
+       grep "^error: failed to execute internal merge" err &&
        git ls-files -u >output &&
        git diff --name-only HEAD >>output &&
        test_must_be_empty output
index b4f4a313f486a583ca62268f2106948cca8d7266..647ea1e8382913887e292977502181b223136b46 100755 (executable)
@@ -34,14 +34,14 @@ test_expect_success setup '
 test_expect_success 'Check "ours" is CRLF' '
        git reset --hard initial &&
        git merge side -s ours &&
-       cat file | remove_cr | append_cr >file.temp &&
+       remove_cr <file | append_cr >file.temp &&
        test_cmp file file.temp
 '
 
 test_expect_success 'Check that conflict file is CRLF' '
        git reset --hard a &&
        test_must_fail git merge side &&
-       cat file | remove_cr | append_cr >file.temp &&
+       remove_cr <file | append_cr >file.temp &&
        test_cmp file file.temp
 '
 
index 17b54d625d0e468047377c378faae25c50633c9b..5f414abc89267d3f3729366d67f8b7d6aec52c37 100755 (executable)
@@ -5,6 +5,7 @@ test_description='recursive merge corner cases involving criss-cross merges'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-merge.sh
 
index 41288a60ceb549295699f2efd9cb8e187d3e297b..48a62cb85568bfb7f77a8c597096617dfa5fcf4c 100755 (executable)
@@ -15,6 +15,7 @@ test_description='CRLF merge conflict across text=auto change
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
index 076b6a74d5b6de28c8499f687f7517daad849cfb..80d7b5eabaf02e555cab3c4e37342a9eb2788f5f 100755 (executable)
@@ -476,7 +476,7 @@ test_expect_success 'handle rename-with-content-merge vs. add' '
                git checkout A^0 &&
 
                test_must_fail git merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (.*/add)" out &&
+               test_grep "CONFLICT (.*/add)" out &&
 
                git ls-files -s >out &&
                test_line_count = 2 out &&
@@ -522,7 +522,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way'
                git checkout B^0 &&
 
                test_must_fail git merge -s recursive A^0 >out &&
-               test_i18ngrep "CONFLICT (.*/add)" out &&
+               test_grep "CONFLICT (.*/add)" out &&
 
                git ls-files -s >out &&
                test_line_count = 2 out &&
@@ -602,7 +602,7 @@ test_expect_success 'handle rename/rename (2to1) conflict correctly' '
                git checkout B^0 &&
 
                test_must_fail git merge -s recursive C^0 >out &&
-               test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
+               test_grep "CONFLICT (\(.*\)/\1)" out &&
 
                git ls-files -s >out &&
                test_line_count = 2 out &&
@@ -914,8 +914,8 @@ test_expect_merge_algorithm failure success 'rad-check: rename/add/delete confli
                # be flexible in the type of console output message(s) reported
                # for this particular case; we will be more stringent about the
                # contents of the index and working directory.
-               test_i18ngrep "CONFLICT (.*/add)" out &&
-               test_i18ngrep "CONFLICT (rename.*/delete)" out &&
+               test_grep "CONFLICT (.*/add)" out &&
+               test_grep "CONFLICT (rename.*/delete)" out &&
                test_must_be_empty err &&
 
                git ls-files -s >file_count &&
@@ -988,8 +988,8 @@ test_expect_merge_algorithm failure success 'rrdd-check: rename/rename(2to1)/del
                # be flexible in the type of console output message(s) reported
                # for this particular case; we will be more stringent about the
                # contents of the index and working directory.
-               test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
-               test_i18ngrep "CONFLICT (rename.*delete)" out &&
+               test_grep "CONFLICT (\(.*\)/\1)" out &&
+               test_grep "CONFLICT (rename.*delete)" out &&
                test_must_be_empty err &&
 
                git ls-files -s >file_count &&
@@ -1068,7 +1068,7 @@ test_expect_merge_algorithm failure success 'mod6-check: chains of rename/rename
 
                test_must_fail git merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep "CONFLICT (rename/rename)" out &&
+               test_grep "CONFLICT (rename/rename)" out &&
                test_must_be_empty err &&
 
                git ls-files -s >file_count &&
index 944de75b80528cbd964d3a42324039dceade07f3..88d1cf2cde9dabbba74daf6debdc82b11ba12ec1 100755 (executable)
@@ -276,7 +276,7 @@ test_expect_success '1d: Directory renames cause a rename/rename(2to1) conflict'
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
+               test_grep "CONFLICT (\(.*\)/\1)" out &&
 
                git ls-files -s >out &&
                test_line_count = 8 out &&
@@ -515,7 +515,7 @@ test_expect_success '2a: Directory split into two on one side, with equal number
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT.*directory rename split" out &&
+               test_grep "CONFLICT.*directory rename split" out &&
 
                git ls-files -s >out &&
                test_line_count = 3 out &&
@@ -591,7 +591,7 @@ test_expect_success '2b: Directory split into two on one side, with equal number
                git rev-parse >expect \
                         O:z/b  O:z/c  B:x/d &&
                test_cmp expect actual &&
-               test_i18ngrep ! "CONFLICT.*directory rename split" out
+               test_grep ! "CONFLICT.*directory rename split" out
        )
 '
 
@@ -726,8 +726,8 @@ test_expect_success '3b: Avoid implicit rename if involved as source on current
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep CONFLICT.*rename/rename.*z/d.*x/d.*w/d out &&
-               test_i18ngrep ! CONFLICT.*rename/rename.*y/d out &&
+               test_grep CONFLICT.*rename/rename.*z/d.*x/d.*w/d out &&
+               test_grep ! CONFLICT.*rename/rename.*y/d out &&
 
                git ls-files -s >out &&
                test_line_count = 5 out &&
@@ -938,7 +938,7 @@ test_expect_success '5a: Merge directories, other side adds files to original an
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT.*implicit dir rename" out &&
+               test_grep "CONFLICT.*implicit dir rename" out &&
 
                git ls-files -s >out &&
                test_line_count = 6 out &&
@@ -1013,7 +1013,7 @@ test_expect_success '5b: Rename/delete in order to get add/add/add conflict' '
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (add/add).* y/d" out &&
+               test_grep "CONFLICT (add/add).* y/d" out &&
 
                git ls-files -s >out &&
                test_line_count = 5 out &&
@@ -1094,8 +1094,8 @@ test_expect_success '5c: Transitive rename would cause rename/rename/rename/add/
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (rename/rename).*x/d.*w/d.*z/d" out &&
-               test_i18ngrep "CONFLICT (add/add).* y/d" out &&
+               test_grep "CONFLICT (rename/rename).*x/d.*w/d.*z/d" out &&
+               test_grep "CONFLICT (add/add).* y/d" out &&
 
                git ls-files -s >out &&
                test_line_count = 9 out &&
@@ -1179,7 +1179,7 @@ test_expect_success '5d: Directory/file/file conflict due to directory rename' '
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (file/directory).*y/d" out &&
+               test_grep "CONFLICT (file/directory).*y/d" out &&
 
                git ls-files -s >out &&
                test_line_count = 6 out &&
@@ -1278,7 +1278,7 @@ test_expect_success '6a: Tricky rename/delete' '
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (rename/delete).*z/c.*y/c" out &&
+               test_grep "CONFLICT (rename/delete).*z/c.*y/c" out &&
 
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
@@ -1740,8 +1740,8 @@ test_expect_success '7a: rename-dir vs. rename-dir (NOT split evenly) PLUS add-o
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (rename/rename).*z/b.*y/b.*w/b" out &&
-               test_i18ngrep "CONFLICT (rename/rename).*z/c.*y/c.*x/c" out &&
+               test_grep "CONFLICT (rename/rename).*z/b.*y/b.*w/b" out &&
+               test_grep "CONFLICT (rename/rename).*z/c.*y/c.*x/c" out &&
 
                git ls-files -s >out &&
                test_line_count = 7 out &&
@@ -1813,7 +1813,7 @@ test_expect_success '7b: rename/rename(2to1), but only due to transitive rename'
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (\(.*\)/\1)" out &&
+               test_grep "CONFLICT (\(.*\)/\1)" out &&
 
                git ls-files -s >out &&
                test_line_count = 4 out &&
@@ -1900,7 +1900,7 @@ test_expect_success '7c: rename/rename(1to...2or3); transitive rename may add co
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (rename/rename).*x/d.*w/d.*y/d" out &&
+               test_grep "CONFLICT (rename/rename).*x/d.*w/d.*y/d" out &&
 
                git ls-files -s >out &&
                test_line_count = 5 out &&
@@ -1965,7 +1965,7 @@ test_expect_success '7d: transitive rename involved in rename/delete; how is it
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out &&
+               test_grep "CONFLICT (rename/delete).*x/d.*y/d" out &&
 
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
@@ -2071,7 +2071,7 @@ test_expect_success '7e: transitive rename in rename/delete AND dirs in the way'
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out &&
+               test_grep "CONFLICT (rename/delete).*x/d.*y/d" out &&
 
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
@@ -2330,7 +2330,7 @@ test_expect_success '8c: modify/delete or rename+modify/delete' '
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "CONFLICT (modify/delete).* z/d" out &&
+               test_grep "CONFLICT (modify/delete).* z/d" out &&
 
                git ls-files -s >out &&
                test_line_count = 5 out &&
@@ -2491,8 +2491,8 @@ test_expect_success '8e: Both sides rename, one side adds to original directory'
                git checkout A^0 &&
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
-               test_i18ngrep CONFLICT.*rename/rename.*z/c.*y/c.*w/c out &&
-               test_i18ngrep CONFLICT.*rename/rename.*z/b.*y/b.*w/b out &&
+               test_grep CONFLICT.*rename/rename.*z/c.*y/c.*w/c out &&
+               test_grep CONFLICT.*rename/rename.*z/b.*y/b.*w/b out &&
 
                git ls-files -s >out &&
                test_line_count = 7 out &&
@@ -2741,7 +2741,7 @@ test_expect_success '9c: Doubly transitive rename?' '
                git checkout A^0 &&
 
                git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "WARNING: Avoiding applying x -> z rename to x/f" out &&
+               test_grep "WARNING: Avoiding applying x -> z rename to x/f" out &&
 
                git ls-files -s >out &&
                test_line_count = 6 out &&
@@ -2830,10 +2830,10 @@ test_expect_success '9d: N-way transitive rename?' '
                git checkout A^0 &&
 
                git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
-               test_i18ngrep "WARNING: Avoiding applying z -> y rename to z/t" out &&
-               test_i18ngrep "WARNING: Avoiding applying y -> x rename to y/a" out &&
-               test_i18ngrep "WARNING: Avoiding applying x -> w rename to x/b" out &&
-               test_i18ngrep "WARNING: Avoiding applying w -> v rename to w/c" out &&
+               test_grep "WARNING: Avoiding applying z -> y rename to z/t" out &&
+               test_grep "WARNING: Avoiding applying y -> x rename to y/a" out &&
+               test_grep "WARNING: Avoiding applying x -> w rename to x/b" out &&
+               test_grep "WARNING: Avoiding applying w -> v rename to w/c" out &&
 
                git ls-files -s >out &&
                test_line_count = 7 out &&
@@ -3215,7 +3215,7 @@ test_expect_success '10a: Overwrite untracked with normal rename/delete' '
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
                test_path_is_missing .git/MERGE_HEAD &&
-               test_i18ngrep "The following untracked working tree files would be overwritten by merge" err &&
+               test_grep "The following untracked working tree files would be overwritten by merge" err &&
 
                git ls-files -s >out &&
                test_line_count = 1 out &&
@@ -3287,7 +3287,7 @@ test_expect_success '10b: Overwrite untracked with dir rename + delete' '
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err &&
+                       test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
 
                        git ls-files -s >out &&
                        test_line_count = 1 out &&
@@ -3296,8 +3296,8 @@ test_expect_success '10b: Overwrite untracked with dir rename + delete' '
                        git ls-files -o >out &&
                        test_line_count = 5 out
                else
-                       test_i18ngrep "CONFLICT (rename/delete).*Version B\^0 of y/d left in tree at y/d~B\^0" out &&
-                       test_i18ngrep "Error: Refusing to lose untracked file at y/e; writing to y/e~B\^0 instead" out &&
+                       test_grep "CONFLICT (rename/delete).*Version B\^0 of y/d left in tree at y/d~B\^0" out &&
+                       test_grep "Error: Refusing to lose untracked file at y/e; writing to y/e~B\^0 instead" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 3 out &&
@@ -3377,7 +3377,7 @@ test_expect_success '10c1: Overwrite untracked with dir rename/rename(1to2)' '
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err &&
+                       test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
 
                        git ls-files -s >out &&
                        test_line_count = 4 out &&
@@ -3386,8 +3386,8 @@ test_expect_success '10c1: Overwrite untracked with dir rename/rename(1to2)' '
                        git ls-files -o >out &&
                        test_line_count = 3 out
                else
-                       test_i18ngrep "CONFLICT (rename/rename)" out &&
-                       test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~B\^0 instead" out &&
+                       test_grep "CONFLICT (rename/rename)" out &&
+                       test_grep "Refusing to lose untracked file at y/c; adding as y/c~B\^0 instead" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 6 out &&
@@ -3428,7 +3428,7 @@ test_expect_success '10c2: Overwrite untracked with dir rename/rename(1to2), oth
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err &&
+                       test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
 
                        git ls-files -s >out &&
                        test_line_count = 4 out &&
@@ -3437,8 +3437,8 @@ test_expect_success '10c2: Overwrite untracked with dir rename/rename(1to2), oth
                        git ls-files -o >out &&
                        test_line_count = 3 out
                else
-                       test_i18ngrep "CONFLICT (rename/rename)" out &&
-                       test_i18ngrep "Refusing to lose untracked file at y/c; adding as y/c~HEAD instead" out &&
+                       test_grep "CONFLICT (rename/rename)" out &&
+                       test_grep "Refusing to lose untracked file at y/c; adding as y/c~HEAD instead" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 6 out &&
@@ -3517,7 +3517,7 @@ test_expect_success '10d: Delete untracked with dir rename/rename(2to1)' '
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: The following untracked working tree files would be overwritten by merge" err &&
+                       test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
 
                        git ls-files -s >out &&
                        test_line_count = 6 out &&
@@ -3526,8 +3526,8 @@ test_expect_success '10d: Delete untracked with dir rename/rename(2to1)' '
                        git ls-files -o >out &&
                        test_line_count = 3 out
                else
-                       test_i18ngrep "CONFLICT (rename/rename)" out &&
-                       test_i18ngrep "Refusing to lose untracked file at y/wham" out &&
+                       test_grep "CONFLICT (rename/rename)" out &&
+                       test_grep "Refusing to lose untracked file at y/wham" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 6 out &&
@@ -3606,7 +3606,7 @@ test_expect_merge_algorithm failure success '10e: Does git complain about untrac
                echo random >z/c &&
 
                git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
-               test_i18ngrep ! "following untracked working tree files would be overwritten by merge" err &&
+               test_grep ! "following untracked working tree files would be overwritten by merge" err &&
 
                git ls-files -s >out &&
                test_line_count = 3 out &&
@@ -3690,9 +3690,9 @@ test_expect_success '11a: Avoid losing dirty contents with simple rename' '
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err
+                       test_grep "error: Your local changes to the following files would be overwritten by merge" err
                else
-                       test_i18ngrep "Refusing to lose dirty file at z/c" out &&
+                       test_grep "Refusing to lose dirty file at z/c" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 2 out &&
@@ -3770,10 +3770,10 @@ test_expect_success '11b: Avoid losing dirty file involved in directory rename'
                then
                        test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err
+                       test_grep "error: Your local changes to the following files would be overwritten by merge" err
                else
                        git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
-                       test_i18ngrep "Refusing to lose dirty file at z/c" out &&
+                       test_grep "Refusing to lose dirty file at z/c" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 3 out &&
@@ -3853,9 +3853,9 @@ test_expect_success '11c: Avoid losing not-uptodate with rename + D/F conflict'
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err
+                       test_grep "error: Your local changes to the following files would be overwritten by merge" err
                else
-                       test_i18ngrep "following files would be overwritten by merge" err
+                       test_grep "following files would be overwritten by merge" err
                fi &&
 
                grep -q stuff y/c &&
@@ -3927,9 +3927,9 @@ test_expect_success '11d: Avoid losing not-uptodate with rename + D/F conflict'
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err
+                       test_grep "error: Your local changes to the following files would be overwritten by merge" err
                else
-                       test_i18ngrep "Refusing to lose dirty file at z/c" out &&
+                       test_grep "Refusing to lose dirty file at z/c" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 4 out &&
@@ -4013,10 +4013,10 @@ test_expect_success '11e: Avoid deleting not-uptodate with dir rename/rename(1to
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err
+                       test_grep "error: Your local changes to the following files would be overwritten by merge" err
                else
-                       test_i18ngrep "CONFLICT (rename/rename)" out &&
-                       test_i18ngrep "Refusing to lose dirty file at y/c" out &&
+                       test_grep "CONFLICT (rename/rename)" out &&
+                       test_grep "Refusing to lose dirty file at y/c" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 7 out &&
@@ -4102,10 +4102,10 @@ test_expect_success '11f: Avoid deleting not-uptodate with dir rename/rename(2to
                if test "$GIT_TEST_MERGE_ALGORITHM" = ort
                then
                        test_path_is_missing .git/MERGE_HEAD &&
-                       test_i18ngrep "error: Your local changes to the following files would be overwritten by merge" err
+                       test_grep "error: Your local changes to the following files would be overwritten by merge" err
                else
-                       test_i18ngrep "CONFLICT (rename/rename)" out &&
-                       test_i18ngrep "Refusing to lose dirty file at y/wham" out &&
+                       test_grep "CONFLICT (rename/rename)" out &&
+                       test_grep "Refusing to lose dirty file at y/wham" out &&
 
                        git ls-files -s >out &&
                        test_line_count = 4 out &&
@@ -5417,8 +5417,8 @@ test_expect_success '13a(conflict): messages for newly added files' '
 
                test_must_fail git merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep CONFLICT..file.location.*z/e/f.added.in.B^0.*y/e/f out &&
-               test_i18ngrep CONFLICT..file.location.*z/d.added.in.B^0.*y/d out &&
+               test_grep CONFLICT..file.location.*z/e/f.added.in.B^0.*y/e/f out &&
+               test_grep CONFLICT..file.location.*z/d.added.in.B^0.*y/d out &&
 
                git ls-files >paths &&
                ! grep z/ paths &&
@@ -5441,8 +5441,8 @@ test_expect_success '13a(info): messages for newly added files' '
 
                git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep Path.updated:.*z/e/f.added.in.B^0.*y/e/f out &&
-               test_i18ngrep Path.updated:.*z/d.added.in.B^0.*y/d out &&
+               test_grep Path.updated:.*z/e/f.added.in.B^0.*y/e/f out &&
+               test_grep Path.updated:.*z/d.added.in.B^0.*y/d out &&
 
                git ls-files >paths &&
                ! grep z/ paths &&
@@ -5507,8 +5507,8 @@ test_expect_success '13b(conflict): messages for transitive rename with conflict
 
                test_must_fail git merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep CONFLICT.*content.*Merge.conflict.in.y/d out &&
-               test_i18ngrep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
+               test_grep CONFLICT.*content.*Merge.conflict.in.y/d out &&
+               test_grep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
 
                git ls-files >paths &&
                ! grep z/ paths &&
@@ -5529,8 +5529,8 @@ test_expect_success '13b(info): messages for transitive rename with conflicted c
 
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep CONFLICT.*content.*Merge.conflict.in.y/d out &&
-               test_i18ngrep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
+               test_grep CONFLICT.*content.*Merge.conflict.in.y/d out &&
+               test_grep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
 
                git ls-files >paths &&
                ! grep z/ paths &&
@@ -5593,7 +5593,7 @@ test_expect_success '13c(conflict): messages for rename/rename(1to1) via transit
 
                test_must_fail git merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
+               test_grep CONFLICT..file.location.*x/d.renamed.to.z/d.*moved.to.y/d out &&
 
                git ls-files >paths &&
                ! grep z/ paths &&
@@ -5614,7 +5614,7 @@ test_expect_success '13c(info): messages for rename/rename(1to1) via transitive
 
                git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
+               test_grep Path.updated:.*x/d.renamed.to.z/d.in.B^0.*moving.it.to.y/d out &&
 
                git ls-files >paths &&
                ! grep z/ paths &&
@@ -5682,8 +5682,8 @@ test_expect_success '13d(conflict): messages for rename/rename(1to1) via dual tr
 
                test_must_fail git merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep CONFLICT..file.location.*a/y.renamed.to.b/y.*moved.to.d/y out &&
-               test_i18ngrep CONFLICT..file.location.*a/y.renamed.to.c/y.*moved.to.d/y out &&
+               test_grep CONFLICT..file.location.*a/y.renamed.to.b/y.*moved.to.d/y out &&
+               test_grep CONFLICT..file.location.*a/y.renamed.to.c/y.*moved.to.d/y out &&
 
                git ls-files >paths &&
                ! grep b/ paths &&
@@ -5706,8 +5706,8 @@ test_expect_success '13d(info): messages for rename/rename(1to1) via dual transi
 
                git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep Path.updated.*a/y.renamed.to.b/y.*moving.it.to.d/y out &&
-               test_i18ngrep Path.updated.*a/y.renamed.to.c/y.*moving.it.to.d/y out &&
+               test_grep Path.updated.*a/y.renamed.to.b/y.*moving.it.to.d/y out &&
+               test_grep Path.updated.*a/y.renamed.to.c/y.*moving.it.to.d/y out &&
 
                git ls-files >paths &&
                ! grep b/ paths &&
@@ -5821,9 +5821,9 @@ test_expect_success '13e: directory rename detection in recursive case' '
 
                git -c merge.directoryRenames=conflict merge -s recursive C^0 >out 2>err &&
 
-               test_i18ngrep ! CONFLICT out &&
-               test_i18ngrep ! BUG: err &&
-               test_i18ngrep ! core.dumped err &&
+               test_grep ! CONFLICT out &&
+               test_grep ! BUG: err &&
+               test_grep ! core.dumped err &&
                test_must_be_empty err &&
 
                git ls-files >paths &&
index a61f20c22fe62031da12af45bd8ca427782043bf..7677c5f08d0e8fb66dd243c05e9a9b892b6114df 100755 (executable)
@@ -178,7 +178,7 @@ test_expect_success 'merge-recursive, when index==head but head!=HEAD' '
        test_when_finished "git clean -fd" &&  # Do not leave untracked around
        # Merge B & F, with B as "head"
        git merge-recursive A -- B F > out &&
-       test_i18ngrep "Already up to date" out
+       test_grep "Already up to date" out
 '
 
 test_expect_success 'recursive, when file has staged changes not matching HEAD nor what a merge would give' '
@@ -194,7 +194,7 @@ test_expect_success 'recursive, when file has staged changes not matching HEAD n
        test_must_fail git merge -s recursive E^0 2>err &&
        git rev-parse --verify :subdir/a >actual &&
        test_cmp expect actual &&
-       test_i18ngrep "changes to the following files would be overwritten" err
+       test_grep "changes to the following files would be overwritten" err
 '
 
 test_expect_success 'recursive, when file has staged changes matching what a merge would give' '
@@ -210,7 +210,7 @@ test_expect_success 'recursive, when file has staged changes matching what a mer
        test_must_fail git merge -s recursive E^0 2>err &&
        git rev-parse --verify :subdir/a >actual &&
        test_cmp expect actual &&
-       test_i18ngrep "changes to the following files would be overwritten" err
+       test_grep "changes to the following files would be overwritten" err
 '
 
 test_expect_success 'octopus, unrelated file touched' '
index 93cd2869b12897b5246a3a977f0cdaf1b2911663..b95b064311b6762da86c6239a93651edd9dede78 100755 (executable)
@@ -21,8 +21,8 @@ test_expect_success 'rename/delete' '
        git commit -m "delete" &&
 
        test_must_fail git merge --strategy=recursive rename >output &&
-       test_i18ngrep "CONFLICT (rename/delete): A.* renamed .*to B.* in rename" output &&
-       test_i18ngrep "CONFLICT (rename/delete): A.*deleted in HEAD." output
+       test_grep "CONFLICT (rename/delete): A.* renamed .*to B.* in rename" output &&
+       test_grep "CONFLICT (rename/delete): A.*deleted in HEAD." output
 '
 
 test_done
index fd21c1a48639bfc176986bfcd5a65c0aa82fd392..b059475ed033440bad42a059341b63176314e642 100755 (executable)
@@ -375,7 +375,7 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
                export GIT_MERGE_VERBOSITY &&
                test_must_fail git merge -s recursive B^0 >out 2>err &&
 
-               test_i18ngrep "CONFLICT (.*/add):" out &&
+               test_grep "CONFLICT (.*/add):" out &&
                test_must_be_empty err &&
 
                git ls-files -s >index_files &&
index d02fa16614e0622585a7732942ee9d5b515e6afa..0f39ed0d08a34230c7c42f307992c20cc8b06d02 100755 (executable)
@@ -71,8 +71,9 @@ test_expect_success 'caching renames does not preclude finding new ones' '
 
                git switch upstream &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream~1..topic
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                git ls-files >tracked-files &&
                test_line_count = 2 tracked-files &&
@@ -140,8 +141,9 @@ test_expect_success 'cherry-pick both a commit and its immediate revert' '
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream~1..topic &&
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                grep region_enter.*diffcore_rename trace.output >calls &&
                test_line_count = 1 calls
@@ -199,8 +201,9 @@ test_expect_success 'rename same file identically, then reintroduce it' '
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream~1..topic &&
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                git ls-files >tracked &&
                test_line_count = 2 tracked &&
@@ -276,8 +279,9 @@ test_expect_success 'rename same file identically, then add file to old dir' '
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream~1..topic &&
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                git ls-files >tracked &&
                test_line_count = 4 tracked &&
@@ -353,10 +357,7 @@ test_expect_success 'cached dir rename does not prevent noticing later conflict'
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test_must_fail test-tool fast-rebase --onto HEAD upstream~1 topic >output &&
-               #git cherry-pick upstream..topic &&
-
-               grep CONFLICT..rename/rename output &&
+               test_must_fail git replay --onto HEAD upstream~1..topic >output &&
 
                grep region_enter.*diffcore_rename trace.output >calls &&
                test_line_count = 2 calls
@@ -455,8 +456,9 @@ test_expect_success 'dir rename unneeded, then add new file to old dir' '
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream..topic &&
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                grep region_enter.*diffcore_rename trace.output >calls &&
                test_line_count = 2 calls &&
@@ -521,8 +523,9 @@ test_expect_success 'dir rename unneeded, then rename existing file into old dir
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream..topic &&
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                grep region_enter.*diffcore_rename trace.output >calls &&
                test_line_count = 3 calls &&
@@ -623,8 +626,9 @@ test_expect_success 'caching renames only on upstream side, part 1' '
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream..topic &&
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                grep region_enter.*diffcore_rename trace.output >calls &&
                test_line_count = 1 calls &&
@@ -681,8 +685,9 @@ test_expect_success 'caching renames only on upstream side, part 2' '
                GIT_TRACE2_PERF="$(pwd)/trace.output" &&
                export GIT_TRACE2_PERF &&
 
-               test-tool fast-rebase --onto HEAD upstream~1 topic &&
-               #git cherry-pick upstream..topic &&
+               git replay --onto HEAD upstream~1..topic >out &&
+               git update-ref --stdin <out &&
+               git checkout topic &&
 
                grep region_enter.*diffcore_rename trace.output >calls &&
                test_line_count = 2 calls &&
index 07067bb347955b146b9654b353e9db2b8b2cd323..ca15e6dd6da94bc1bac8286e9e36a196cde7a797 100755 (executable)
@@ -308,13 +308,13 @@ test_expect_success 'fail if the index has unresolved entries' '
 
        test_must_fail git merge "$c5" &&
        test_must_fail git merge "$c5" 2> out &&
-       test_i18ngrep "not possible because you have unmerged files" out &&
+       test_grep "not possible because you have unmerged files" out &&
        git add -u &&
        test_must_fail git merge "$c5" 2> out &&
-       test_i18ngrep "You have not concluded your merge" out &&
+       test_grep "You have not concluded your merge" out &&
        rm -f .git/MERGE_HEAD &&
        test_must_fail git merge "$c5" 2> out &&
-       test_i18ngrep "Your local changes to the following files would be overwritten by merge:" out
+       test_grep "Your local changes to the following files would be overwritten by merge:" out
 '
 
 test_expect_success 'merge-recursive remove conflict' '
@@ -713,7 +713,7 @@ test_expect_success 'merge-recursive remembers the names of all base trees' '
        test_must_fail git -c merge.verbosity=5 merge-recursive $(cat trees) -- $c1 $c3 >out &&
 
        # ...but make sure it fails in the expected way
-       test_i18ngrep CONFLICT.*rename/rename out &&
+       test_grep CONFLICT.*rename/rename out &&
 
        # merge-recursive prints in reverse order, but we do not care
        sort <trees >expect &&
index b16031465f34b20600cadd51c2f620ec64ae0e54..ed7866d3e955a3d093b6428b750f4d8d7ec1ae63 100755 (executable)
@@ -5,6 +5,7 @@ test_description='"git merge" top-level frontend'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 t3033_reset () {
@@ -151,7 +152,7 @@ test_expect_success 'refuse two-project merge by default, quit before --autostas
        echo change >>one.t &&
        git diff >expect &&
        test_must_fail git merge --autostash five 2>err &&
-       test_i18ngrep ! "stash" err &&
+       test_grep ! "stash" err &&
        git diff >actual &&
        test_cmp expect actual
 '
@@ -169,7 +170,7 @@ test_expect_success 'two-project merge with --allow-unrelated-histories with --a
        echo change >>one.t &&
        git diff one.t >expect &&
        git merge --allow-unrelated-histories --autostash five 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        git diff one.t >actual &&
        test_cmp expect actual
 '
index c0b7bd7c3fe55303d62caed5f4c02368d2e3fd3c..4f4376421e7da28e22f58258061bf58f3a8bc0c8 100755 (executable)
@@ -104,12 +104,12 @@ test_expect_success 'will not overwrite unstaged changes in renamed file' '
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
        then
                test_must_fail git merge c1a >out 2>err &&
-               test_i18ngrep "would be overwritten by merge" err &&
+               test_grep "would be overwritten by merge" err &&
                test_cmp important other.c &&
                test_path_is_missing .git/MERGE_HEAD
        else
                test_must_fail git merge c1a >out &&
-               test_i18ngrep "Refusing to lose dirty file at other.c" out &&
+               test_grep "Refusing to lose dirty file at other.c" out &&
                test_path_is_file other.c~HEAD &&
                test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) &&
                test_cmp important other.c
index c9a86f2e947e4a2943438cc5adcaaeab39a465d9..7a3f1cb27c12b468cb8a97e80c75a86070c7c4a8 100755 (executable)
@@ -8,6 +8,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
 export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-merge.sh
 
@@ -112,7 +113,7 @@ test_expect_success 'merging should conflict for non fast-forward' '
         git checkout -b test-nonforward-a b &&
          if test "$GIT_TEST_MERGE_ALGORITHM" = ort
          then
-               test_must_fail git merge c >actual &&
+               test_must_fail git merge c 2>actual &&
                sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
                grep "$sub_expect" actual
          else
@@ -153,9 +154,9 @@ test_expect_success 'merging should conflict for non fast-forward (resolution ex
          git rev-parse --short sub-d > ../expect) &&
          if test "$GIT_TEST_MERGE_ALGORITHM" = ort
          then
-               test_must_fail git merge c >actual &&
+               test_must_fail git merge c >actual 2>sub-actual &&
                sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
-               grep "$sub_expect" actual
+               grep "$sub_expect" sub-actual
          else
                test_must_fail git merge c 2> actual
          fi &&
@@ -180,9 +181,9 @@ test_expect_success 'merging should fail for ambiguous common parent' '
         ) &&
         if test "$GIT_TEST_MERGE_ALGORITHM" = ort
         then
-               test_must_fail git merge c >actual &&
+               test_must_fail git merge c >actual 2>sub-actual &&
                sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
-               grep "$sub_expect" actual
+               grep "$sub_expect" sub-actual
         else
                test_must_fail git merge c 2> actual
         fi &&
@@ -226,7 +227,7 @@ test_expect_success 'merging should fail for changes that are backwards' '
        git commit -a -m "f" &&
 
        git checkout -b test-backward e &&
-       test_must_fail git merge f >actual &&
+       test_must_fail git merge f 2>actual &&
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
     then
                sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-d)" &&
@@ -479,7 +480,7 @@ test_expect_merge_algorithm failure success !FAIL_PREREQS 'directory/submodule c
                # We do not want files within the submodule to prevent the
                # merge from starting; we should not be writing to such paths
                # anyway.
-               test_i18ngrep ! "refusing to lose untracked file at" err
+               test_grep ! "refusing to lose untracked file at" err
        )
 '
 
@@ -534,7 +535,7 @@ test_expect_success 'merging should fail with no merge base' '
        git checkout -b b init &&
        git add sub &&
        git commit -m "b" &&
-       test_must_fail git merge a >actual &&
+       test_must_fail git merge a 2>actual &&
        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
     then
                sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short HEAD^1)" &&
index 69509d0c11db655a12fc6ed20215ed25976c46eb..18fe1c25e6a04b75d2fcdf9ac0c60da04c618ba8 100755 (executable)
@@ -41,7 +41,7 @@ test_expect_success 'gc does not leave behind pid file' '
 
 test_expect_success 'gc --gobbledegook' '
        test_expect_code 129 git gc --nonsense 2>err &&
-       test_i18ngrep "[Uu]sage: git gc" err
+       test_grep "[Uu]sage: git gc" err
 '
 
 test_expect_success 'gc -h with invalid configuration' '
@@ -52,7 +52,7 @@ test_expect_success 'gc -h with invalid configuration' '
                echo "[gc] pruneexpire = CORRUPT" >>.git/config &&
                test_expect_code 129 git gc -h >usage 2>&1
        ) &&
-       test_i18ngrep "[Uu]sage" broken/usage
+       test_grep "[Uu]sage" broken/usage
 '
 
 test_expect_success 'gc is not aborted due to a stale symref' '
@@ -155,7 +155,7 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
        test_commit "$(test_oid obj4)" &&
 
        git gc --auto 2>err &&
-       test_i18ngrep ! "^warning:" err &&
+       test_grep ! "^warning:" err &&
        ls .git/objects/pack/pack-*.pack | sort >post_packs &&
        comm -1 -3 existing_packs post_packs >new &&
        comm -2 -3 existing_packs post_packs >del &&
@@ -166,15 +166,15 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
 test_expect_success 'gc --no-quiet' '
        GIT_PROGRESS_DELAY=0 git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr &&
        test_must_be_empty stdout &&
-       test_i18ngrep "Computing commit graph generation numbers" stderr
+       test_grep "Computing commit graph generation numbers" stderr
 '
 
 test_expect_success TTY 'with TTY: gc --no-quiet' '
        test_terminal env GIT_PROGRESS_DELAY=0 \
                git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr &&
        test_must_be_empty stdout &&
-       test_i18ngrep "Enumerating objects" stderr &&
-       test_i18ngrep "Computing commit graph generation numbers" stderr
+       test_grep "Enumerating objects" stderr &&
+       test_grep "Computing commit graph generation numbers" stderr
 '
 
 test_expect_success 'gc --quiet' '
@@ -202,6 +202,30 @@ test_expect_success 'one of gc.reflogExpire{Unreachable,}=never does not skip "e
        grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out
 '
 
+test_expect_success 'gc.repackFilter launches repack with a filter' '
+       git clone --no-local --bare . bare.git &&
+
+       git -C bare.git -c gc.cruftPacks=false gc &&
+       test_stdout_line_count = 1 ls bare.git/objects/pack/*.pack &&
+
+       GIT_TRACE=$(pwd)/trace.out git -C bare.git -c gc.repackFilter=blob:none \
+               -c repack.writeBitmaps=false -c gc.cruftPacks=false gc &&
+       test_stdout_line_count = 2 ls bare.git/objects/pack/*.pack &&
+       grep -E "^trace: (built-in|exec|run_command): git repack .* --filter=blob:none ?.*" trace.out
+'
+
+test_expect_success 'gc.repackFilterTo store filtered out objects' '
+       test_when_finished "rm -rf bare.git filtered.git" &&
+
+       git init --bare filtered.git &&
+       git -C bare.git -c gc.repackFilter=blob:none \
+               -c gc.repackFilterTo=../filtered.git/objects/pack/pack \
+               -c repack.writeBitmaps=false -c gc.cruftPacks=false gc &&
+
+       test_stdout_line_count = 1 ls bare.git/objects/pack/*.pack &&
+       test_stdout_line_count = 1 ls filtered.git/objects/pack/*.pack
+'
+
 prepare_cruft_history () {
        test_commit base &&
 
@@ -303,6 +327,33 @@ test_expect_success 'gc.bigPackThreshold ignores cruft packs' '
        )
 '
 
+cruft_max_size_opts="git repack -d -l --cruft --cruft-expiration=2.weeks.ago"
+
+test_expect_success 'setup for --max-cruft-size tests' '
+       git init cruft--max-size &&
+       (
+               cd cruft--max-size &&
+               prepare_cruft_history
+       )
+'
+
+test_expect_success '--max-cruft-size sets appropriate repack options' '
+       GIT_TRACE2_EVENT=$(pwd)/trace2.txt git -C cruft--max-size \
+               gc --cruft --max-cruft-size=1M &&
+       test_subcommand $cruft_max_size_opts --max-cruft-size=1048576 <trace2.txt
+'
+
+test_expect_success 'gc.maxCruftSize sets appropriate repack options' '
+       GIT_TRACE2_EVENT=$(pwd)/trace2.txt \
+               git -C cruft--max-size -c gc.maxCruftSize=2M gc --cruft &&
+       test_subcommand $cruft_max_size_opts --max-cruft-size=2097152 <trace2.txt &&
+
+       GIT_TRACE2_EVENT=$(pwd)/trace2.txt \
+               git -C cruft--max-size -c gc.maxCruftSize=2M gc --cruft \
+               --max-cruft-size=3M &&
+       test_subcommand $cruft_max_size_opts --max-cruft-size=3145728 <trace2.txt
+'
+
 run_and_wait_for_auto_gc () {
        # We read stdout from gc for the side effect of waiting until the
        # background gc process exits, closing its fd 9.  Furthermore, the
@@ -321,7 +372,7 @@ test_expect_success 'background auto gc does not run if gc.log is present and re
        test_config gc.autodetach true &&
        echo fleem >.git/gc.log &&
        git gc --auto 2>err &&
-       test_i18ngrep "^warning:" err &&
+       test_grep "^warning:" err &&
        test_config gc.logexpiry 5.days &&
        test-tool chmtime =-345600 .git/gc.log &&
        git gc --auto &&
diff --git a/t/t6700-tree-depth.sh b/t/t6700-tree-depth.sh
new file mode 100755 (executable)
index 0000000..9e70a7c
--- /dev/null
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+test_description='handling of deep trees in various commands'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+# We'll test against two depths here: a small one that will let us check the
+# behavior of the config setting easily, and a large one that should be
+# forbidden by default. Testing the default depth will let us know whether our
+# default is enough to prevent segfaults on systems that run the tests.
+small_depth=50
+big_depth=4100
+
+small_ok="-c core.maxtreedepth=$small_depth"
+small_no="-c core.maxtreedepth=$((small_depth-1))"
+
+# usage: mkdeep <name> <depth>
+#   Create a tag <name> containing a file whose path has depth <depth>.
+#
+# We'll use fast-import here for two reasons:
+#
+#   1. It's faster than creating $big_depth tree objects.
+#
+#   2. As we tighten tree limits, it's more likely to allow large sizes
+#      than trying to stuff a deep path into the index.
+mkdeep () {
+       {
+               echo "commit refs/tags/$1" &&
+               echo "committer foo <foo@example.com> 1234 -0000" &&
+               echo "data <<EOF" &&
+               echo "the commit message" &&
+               echo "EOF" &&
+
+               printf 'M 100644 inline ' &&
+               i=0 &&
+               while test $i -lt $2
+               do
+                       printf 'a/'
+                       i=$((i+1))
+               done &&
+               echo "file" &&
+
+               echo "data <<EOF" &&
+               echo "the file contents" &&
+               echo "EOF" &&
+               echo
+       } | git fast-import
+}
+
+test_expect_success 'create small tree' '
+       mkdeep small $small_depth
+'
+
+test_expect_success 'create big tree' '
+       mkdeep big $big_depth
+'
+
+test_expect_success 'limit recursion of git-archive' '
+       git $small_ok archive small >/dev/null &&
+       test_must_fail git $small_no archive small >/dev/null
+'
+
+test_expect_success 'default limit for git-archive fails gracefully' '
+       test_must_fail git archive big >/dev/null
+'
+
+test_expect_success 'limit recursion of ls-tree -r' '
+       git $small_ok ls-tree -r small &&
+       test_must_fail git $small_no ls-tree -r small
+'
+
+test_expect_success 'default limit for ls-tree fails gracefully' '
+       test_must_fail git ls-tree -r big >/dev/null
+'
+
+test_expect_success 'limit recursion of rev-list --objects' '
+       git $small_ok rev-list --objects small >/dev/null &&
+       test_must_fail git $small_no rev-list --objects small >/dev/null
+'
+
+test_expect_success 'default limit for rev-list fails gracefully' '
+       test_must_fail git rev-list --objects big >/dev/null
+'
+
+test_expect_success 'limit recursion of diff-tree -r' '
+       git $small_ok diff-tree -r $EMPTY_TREE small &&
+       test_must_fail git $small_no diff-tree -r $EMPTY_TREE small
+'
+
+test_expect_success 'default limit for diff-tree fails gracefully' '
+       test_must_fail git diff-tree -r $EMPTY_TREE big
+'
+
+test_done
index f136ea76f7f8a04c7b2b9c5dbf38ca1a50260819..879a6dce601110ac4bf8c59a51b32654e8726dcf 100755 (executable)
@@ -296,7 +296,7 @@ test_expect_success 'git mv error on conflicted file' '
        EOF
 
        test_must_fail git mv conflict newname 2>actual &&
-       test_i18ngrep "conflicted" actual
+       test_grep "conflicted" actual
 '
 
 test_expect_success 'git mv should overwrite symlink to a file' '
@@ -482,7 +482,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
        git mv sub sub2 &&
        git commit -m "moved sub to sub2" &&
        git checkout -q HEAD^ 2>actual &&
-       test_i18ngrep "^warning: unable to rmdir '\''sub2'\'':" actual &&
+       test_grep "^warning: unable to rmdir '\''sub2'\'':" actual &&
        git status -s sub2 >actual &&
        echo "?? sub2/" >expected &&
        test_cmp expected actual &&
index f6aebe92ff9d94b20670f7436c57f8107bb3404a..5ab4d41ee7c6b122b8601bf8059eecafdf081c39 100755 (executable)
@@ -396,10 +396,7 @@ test_expect_success '--prune-empty is able to prune entire branch' '
        git branch prune-entire B &&
        git filter-branch -f --prune-empty --index-filter "git update-index --remove A.t B.t" prune-entire &&
        test_must_fail git rev-parse refs/heads/prune-entire &&
-       if test_have_prereq REFFILES
-       then
-               test_must_fail git reflog exists refs/heads/prune-entire
-       fi
+       test_must_fail git reflog exists refs/heads/prune-entire
 '
 
 test_expect_success '--remap-to-ancestor with filename filters' '
index e689db429292e60162d4f8f89905cc8489d7a3e0..b41a47eb943a03b1588bdc87802b0645944ce2ec 100755 (executable)
@@ -1862,6 +1862,51 @@ test_expect_success 'option override configured sort' '
        test_cmp expect actual
 '
 
+test_expect_success '--no-sort cancels config sort keys' '
+       test_config tag.sort "-refname" &&
+
+       # objecttype is identical for all of them, so sort falls back on
+       # default (ascending refname)
+       git tag -l \
+               --no-sort \
+               --sort="objecttype" \
+               "foo*" >actual &&
+       cat >expect <<-\EOF &&
+       foo1.10
+       foo1.3
+       foo1.6
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success '--no-sort cancels command line sort keys' '
+       # objecttype is identical for all of them, so sort falls back on
+       # default (ascending refname)
+       git tag -l \
+               --sort="-refname" \
+               --no-sort \
+               --sort="objecttype" \
+               "foo*" >actual &&
+       cat >expect <<-\EOF &&
+       foo1.10
+       foo1.3
+       foo1.6
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success '--no-sort without subsequent --sort prints expected tags' '
+       # Sort the results with `sort` for a consistent comparison against
+       # expected
+       git tag -l --no-sort "foo*" | sort >actual &&
+       cat >expect <<-\EOF &&
+       foo1.10
+       foo1.3
+       foo1.6
+       EOF
+       test_cmp expect actual
+'
+
 test_expect_success 'invalid sort parameter on command line' '
        test_must_fail git tag -l --sort=notvalid "foo*" >actual
 '
index 4287863ae6cab9a67564c9328effd68d2c186ab6..62d9f846ce86c54745eb87619d14fefc005d6fe3 100755 (executable)
@@ -616,4 +616,12 @@ test_expect_success 'reset --mixed sets up work tree' '
        test_must_be_empty actual
 '
 
+test_expect_success 'reset handles --end-of-options' '
+       git update-ref refs/heads/--foo HEAD^ &&
+       git log -1 --format=%s refs/heads/--foo >expect &&
+       git reset --hard --end-of-options --foo &&
+       git log -1 --format=%s HEAD >actual &&
+       test_cmp expect actual
+'
+
 test_done
index 9b46da7aaa7e59c08bf799262a21056fe7417d86..f4f3b7a677aa16539f8277ce3d4132ade0b17168 100755 (executable)
@@ -5,7 +5,7 @@ test_description='git reset --patch'
 TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-patch-mode.sh
 
-test_expect_success PERL 'setup' '
+test_expect_success 'setup' '
        mkdir dir &&
        echo parent > dir/foo &&
        echo dummy > bar &&
@@ -19,42 +19,46 @@ test_expect_success PERL 'setup' '
 
 # note: bar sorts before foo, so the first 'n' is always to skip 'bar'
 
-test_expect_success PERL 'saying "n" does nothing' '
+test_expect_success 'saying "n" does nothing' '
        set_and_save_state dir/foo work work &&
        test_write_lines n n | git reset -p &&
        verify_saved_state dir/foo &&
        verify_saved_state bar
 '
 
-test_expect_success PERL 'git reset -p' '
-       test_write_lines n y | git reset -p >output &&
-       verify_state dir/foo work head &&
-       verify_saved_state bar &&
-       test_i18ngrep "Unstage" output
-'
-
-test_expect_success PERL 'git reset -p HEAD^' '
+for opt in "HEAD" "@" ""
+do
+       test_expect_success "git reset -p $opt" '
+               set_and_save_state dir/foo work work &&
+               test_write_lines n y | git reset -p $opt >output &&
+               verify_state dir/foo work head &&
+               verify_saved_state bar &&
+               test_grep "Unstage" output
+       '
+done
+
+test_expect_success 'git reset -p HEAD^' '
        test_write_lines n y | git reset -p HEAD^ >output &&
        verify_state dir/foo work parent &&
        verify_saved_state bar &&
-       test_i18ngrep "Apply" output
+       test_grep "Apply" output
 '
 
-test_expect_success PERL 'git reset -p HEAD^^{tree}' '
+test_expect_success 'git reset -p HEAD^^{tree}' '
        test_write_lines n y | git reset -p HEAD^^{tree} >output &&
        verify_state dir/foo work parent &&
        verify_saved_state bar &&
-       test_i18ngrep "Apply" output
+       test_grep "Apply" output
 '
 
-test_expect_success PERL 'git reset -p HEAD^:dir/foo (blob fails)' '
+test_expect_success 'git reset -p HEAD^:dir/foo (blob fails)' '
        set_and_save_state dir/foo work work &&
        test_must_fail git reset -p HEAD^:dir/foo &&
        verify_saved_state dir/foo &&
        verify_saved_state bar
 '
 
-test_expect_success PERL 'git reset -p aaaaaaaa (unknown fails)' '
+test_expect_success 'git reset -p aaaaaaaa (unknown fails)' '
        set_and_save_state dir/foo work work &&
        test_must_fail git reset -p aaaaaaaa &&
        verify_saved_state dir/foo &&
@@ -66,27 +70,27 @@ test_expect_success PERL 'git reset -p aaaaaaaa (unknown fails)' '
 # dir/foo.  There's always an extra 'n' to reject edits to dir/foo in
 # the failure case (and thus get out of the loop).
 
-test_expect_success PERL 'git reset -p dir' '
+test_expect_success 'git reset -p dir' '
        set_state dir/foo work work &&
        test_write_lines y n | git reset -p dir &&
        verify_state dir/foo work head &&
        verify_saved_state bar
 '
 
-test_expect_success PERL 'git reset -p -- foo (inside dir)' '
+test_expect_success 'git reset -p -- foo (inside dir)' '
        set_state dir/foo work work &&
        test_write_lines y n | (cd dir && git reset -p -- foo) &&
        verify_state dir/foo work head &&
        verify_saved_state bar
 '
 
-test_expect_success PERL 'git reset -p HEAD^ -- dir' '
+test_expect_success 'git reset -p HEAD^ -- dir' '
        test_write_lines y n | git reset -p HEAD^ -- dir &&
        verify_state dir/foo work parent &&
        verify_saved_state bar
 '
 
-test_expect_success PERL 'none of this moved HEAD' '
+test_expect_success 'none of this moved HEAD' '
        verify_saved_head
 '
 
index a0b67a0b843b3411de060ca9f4e507e59d516dd2..88d1c8adf42eec1c219f50b9765d5b3c10d706fa 100755 (executable)
@@ -34,7 +34,7 @@ test_expect_success 'reset $file' '
        test_cmp expect actual
 '
 
-test_expect_success PERL 'reset -p' '
+test_expect_success 'reset -p' '
        rm .git/index &&
        git add a &&
        echo y >yes &&
@@ -42,7 +42,7 @@ test_expect_success PERL 'reset -p' '
 
        git ls-files >actual &&
        test_must_be_empty actual &&
-       test_i18ngrep "Unstage" output
+       test_grep "Unstage" output
 '
 
 test_expect_success 'reset --soft is a no-op' '
index af5ea406db3bf5748d3cf1a1ae16abd3b6fd9363..020db201d57c3c38e75a0e2b9a38c2b3455a9309 100755 (executable)
@@ -161,19 +161,19 @@ test_expect_success 'error conditions' '
        git rm fileA.t &&
 
        test_must_fail git reset --pathspec-from-file=list --patch 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git reset --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
+       test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git reset --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
+       test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        test_must_fail git reset --soft --pathspec-from-file=list 2>err &&
-       test_i18ngrep -e "fatal: Cannot do soft reset with paths" err &&
+       test_grep -e "fatal: Cannot do soft reset with paths" err &&
 
        test_must_fail git reset --hard --pathspec-from-file=list 2>err &&
-       test_i18ngrep -e "fatal: Cannot do hard reset with paths" err
+       test_grep -e "fatal: Cannot do hard reset with paths" err
 '
 
 test_done
index 772480a345ffa0703432e070e5e85ec56a322c00..7ee180f81da4f9e0ae312f73a87ab9775ef18e1d 100755 (executable)
@@ -238,7 +238,7 @@ test_expect_success '"reset --keep HEAD^" fails with pending merge' '
        git reset --hard third &&
        test_must_fail git merge branch1 &&
        test_must_fail git reset --keep HEAD^ 2>err.log &&
-       test_i18ngrep "middle of a merge" err.log
+       test_grep "middle of a merge" err.log
 '
 
 # The next test will test the following:
@@ -264,7 +264,7 @@ test_expect_success '"reset --keep HEAD" fails with pending merge' '
        git reset --hard third &&
        test_must_fail git merge branch1 &&
        test_must_fail git reset --keep HEAD 2>err.log &&
-       test_i18ngrep "middle of a merge" err.log
+       test_grep "middle of a merge" err.log
 '
 
 test_expect_success '--merge is ok with added/deleted merge' '
@@ -290,7 +290,7 @@ test_expect_success '--keep fails with added/deleted merge' '
        git diff --exit-code file3 &&
        git diff --exit-code branch3 file3 &&
        test_must_fail git reset --keep HEAD 2>err.log &&
-       test_i18ngrep "middle of a merge" err.log
+       test_grep "middle of a merge" err.log
 '
 
 test_done
index 35b9e6ed6b5ba337d9fb4603281500656313ed1d..10cc6c46051e95e8e8d52fae23396574f319b802 100755 (executable)
@@ -217,7 +217,7 @@ test_expect_success 'switch to another branch while carrying a deletion' '
        git rm two &&
 
        test_must_fail git checkout simple 2>errs &&
-       test_i18ngrep overwritten errs &&
+       test_grep overwritten errs &&
 
        test_must_fail git read-tree --quiet -m -u HEAD simple 2>errs &&
        test_must_be_empty errs
@@ -229,7 +229,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '
        git checkout -f renamer &&
        git clean -f &&
        git checkout renamer^ 2>messages &&
-       test_i18ngrep "HEAD is now at $rev" messages &&
+       test_grep "HEAD is now at $rev" messages &&
        test_line_count = 1 messages &&
        H=$(git rev-parse --verify HEAD) &&
        M=$(git show-ref -s --verify refs/heads/main) &&
@@ -497,6 +497,11 @@ test_expect_success 'checkout unmerged stage' '
        test ztheirside = "z$(cat file)"
 '
 
+test_expect_success 'checkout path with --merge from tree-ish is a no-no' '
+       setup_conflicting_index &&
+       test_must_fail git checkout -m HEAD -- file
+'
+
 test_expect_success 'checkout with --merge' '
        setup_conflicting_index &&
        echo "none of the above" >sample &&
@@ -517,6 +522,48 @@ test_expect_success 'checkout with --merge' '
        test_cmp merged file
 '
 
+test_expect_success 'checkout -m works after (mistaken) resolution' '
+       setup_conflicting_index &&
+       echo "none of the above" >sample &&
+       cat sample >fild &&
+       cat sample >file &&
+       cat sample >filf &&
+       # resolve to something
+       git add file &&
+       git checkout --merge -- fild file filf &&
+       {
+               echo "<<<<<<< ours" &&
+               echo ourside &&
+               echo "=======" &&
+               echo theirside &&
+               echo ">>>>>>> theirs"
+       } >merged &&
+       test_cmp expect fild &&
+       test_cmp expect filf &&
+       test_cmp merged file
+'
+
+test_expect_success 'checkout -m works after (mistaken) resolution to remove' '
+       setup_conflicting_index &&
+       echo "none of the above" >sample &&
+       cat sample >fild &&
+       cat sample >file &&
+       cat sample >filf &&
+       # resolve to remove
+       git rm file &&
+       git checkout --merge -- fild file filf &&
+       {
+               echo "<<<<<<< ours" &&
+               echo ourside &&
+               echo "=======" &&
+               echo theirside &&
+               echo ">>>>>>> theirs"
+       } >merged &&
+       test_cmp expect fild &&
+       test_cmp expect filf &&
+       test_cmp merged file
+'
+
 test_expect_success 'checkout with --merge, in diff3 -m style' '
        git config merge.conflictstyle diff3 &&
        setup_conflicting_index &&
index 0ef7b78457368fd8f0e403907e7d582e97e62248..1f7201eb60caf9b31fd3db1a83dc834bb145157c 100755 (executable)
@@ -407,6 +407,12 @@ test_expect_success 'clean.requireForce and -f' '
 
 '
 
+test_expect_success 'clean.requireForce and --interactive' '
+       git clean --interactive </dev/null >output 2>error &&
+       test_grep ! "requireForce is true and" error &&
+       test_grep "\*\*\* Commands \*\*\*" output
+'
+
 test_expect_success 'core.excludesfile' '
 
        echo excludes >excludes &&
@@ -517,8 +523,12 @@ test_expect_success 'nested (empty) git should be kept' '
        git init empty_repo &&
        mkdir to_clean &&
        >to_clean/should_clean.this &&
+       # Note that we put the expect file in the .git directory so that it
+       # does not get cleaned.
+       find empty_repo | sort >.git/expect &&
        git clean -f -d &&
-       test_path_is_file empty_repo/.git/HEAD &&
+       find empty_repo | sort >actual &&
+       test_cmp .git/expect actual &&
        test_path_is_missing to_clean
 '
 
@@ -559,10 +569,10 @@ test_expect_success 'giving path in nested git work tree will NOT remove it' '
                mkdir -p bar/baz &&
                test_commit msg bar/baz/hello.world
        ) &&
+       find repo | sort >expect &&
        git clean -f -d repo/bar/baz &&
-       test_path_is_file repo/.git/HEAD &&
-       test_path_is_dir repo/bar/ &&
-       test_path_is_file repo/bar/baz/hello.world
+       find repo | sort >actual &&
+       test_cmp expect actual
 '
 
 test_expect_success 'giving path to nested .git will not remove it' '
@@ -573,10 +583,10 @@ test_expect_success 'giving path to nested .git will not remove it' '
                git init &&
                test_commit msg hello.world
        ) &&
+       find repo | sort >expect &&
        git clean -f -d repo/.git &&
-       test_path_is_file repo/.git/HEAD &&
-       test_path_is_dir repo/.git/refs &&
-       test_path_is_dir repo/.git/objects &&
+       find repo | sort >actual &&
+       test_cmp expect actual &&
        test_path_is_dir untracked/
 '
 
@@ -588,9 +598,10 @@ test_expect_success 'giving path to nested .git/ will NOT remove contents' '
                git init &&
                test_commit msg hello.world
        ) &&
+       find repo | sort >expect &&
        git clean -f -d repo/.git/ &&
-       test_path_is_dir repo/.git &&
-       test_path_is_file repo/.git/HEAD &&
+       find repo | sort >actual &&
+       test_cmp expect actual &&
        test_path_is_dir untracked/
 '
 
@@ -735,7 +746,7 @@ test_expect_success MINGW 'handle clean & core.longpaths = false nicely' '
        test_must_fail git clean -xdf 2>.git/err &&
        # grepping for a strerror string is unportable but it is OK here with
        # MINGW prereq
-       test_i18ngrep "too long" .git/err
+       test_grep "too long" .git/err
 '
 
 test_expect_success 'clean untracked paths by pathspec' '
index d82a3210a1db48288c54ce3c06d430546da70f48..4afe53c66ae57acdadc7177b98fd0aacefdd576c 100755 (executable)
@@ -25,18 +25,18 @@ test_expect_success 'git clean -i (c: clean hotkey)' '
        touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
        docs/manual.txt obj.o build/lib.so &&
        echo c | git clean -i &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test ! -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_missing src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -46,18 +46,18 @@ test_expect_success 'git clean -i (cl: clean prefix)' '
        touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
        docs/manual.txt obj.o build/lib.so &&
        echo cl | git clean -i &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test ! -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_missing src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -67,18 +67,18 @@ test_expect_success 'git clean -i (quit)' '
        touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
        docs/manual.txt obj.o build/lib.so &&
        echo quit | git clean -i &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -88,18 +88,18 @@ test_expect_success 'git clean -i (Ctrl+D)' '
        touch a.out src/part3.c src/part3.h src/part4.c src/part4.h \
        docs/manual.txt obj.o build/lib.so &&
        echo "\04" | git clean -i &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -110,18 +110,18 @@ test_expect_success 'git clean -id (filter all)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines f "*" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -132,18 +132,18 @@ test_expect_success 'git clean -id (filter patterns)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines f "part3.* *.out" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test ! -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test ! -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_missing docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_missing src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -154,18 +154,18 @@ test_expect_success 'git clean -id (filter patterns 2)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines f "* !*.out" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -176,18 +176,18 @@ test_expect_success 'git clean -id (select - all)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s "*" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test ! -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test ! -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_missing docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_missing src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -198,18 +198,18 @@ test_expect_success 'git clean -id (select - none)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -220,18 +220,18 @@ test_expect_success 'git clean -id (select - number)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s 3 "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -242,18 +242,18 @@ test_expect_success 'git clean -id (select - number 2)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s "2 3" 5 "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test ! -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_missing docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -264,18 +264,18 @@ test_expect_success 'git clean -id (select - number 3)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s "3,4 5" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -285,11 +285,11 @@ test_expect_success 'git clean -id (select - filenames)' '
        touch a.out foo.txt bar.txt baz.txt &&
        test_write_lines s "a.out fo ba bar" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test ! -f a.out &&
-       test ! -f foo.txt &&
-       test ! -f bar.txt &&
-       test -f baz.txt &&
+       test_path_is_file Makefile &&
+       test_path_is_missing a.out &&
+       test_path_is_missing foo.txt &&
+       test_path_is_missing bar.txt &&
+       test_path_is_file baz.txt &&
        rm baz.txt
 
 '
@@ -301,18 +301,18 @@ test_expect_success 'git clean -id (select - range)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s "1,3-4" 2 "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test ! -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test ! -f docs/manual.txt &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_missing docs/manual.txt &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -323,18 +323,18 @@ test_expect_success 'git clean -id (select - range 2)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s "4- 1" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test ! -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_missing src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -345,18 +345,18 @@ test_expect_success 'git clean -id (inverse select)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines s "*" "-5- 1 -2" "" c |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -367,18 +367,18 @@ test_expect_success 'git clean -id (ask)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines a Y y no yes bad "" |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test ! -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_missing docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -389,18 +389,18 @@ test_expect_success 'git clean -id (ask - Ctrl+D)' '
        docs/manual.txt obj.o build/lib.so &&
        test_write_lines a Y no yes "\04" |
        git clean -id &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -412,18 +412,18 @@ test_expect_success 'git clean -id with prefix and path (filter)' '
        (cd build/ &&
         test_write_lines f docs "*.h" "" c |
         git clean -id ..) &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_file docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -435,18 +435,18 @@ test_expect_success 'git clean -id with prefix and path (select by name)' '
        (cd build/ &&
         test_write_lines s ../docs/ ../src/part3.c ../src/part4.c "" c |
         git clean -id ..) &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test -f a.out &&
-       test ! -f docs/manual.txt &&
-       test ! -f src/part3.c &&
-       test -f src/part3.h &&
-       test ! -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_file a.out &&
+       test_path_is_missing docs/manual.txt &&
+       test_path_is_missing src/part3.c &&
+       test_path_is_file src/part3.h &&
+       test_path_is_missing src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
@@ -458,18 +458,18 @@ test_expect_success 'git clean -id with prefix and path (ask)' '
        (cd build/ &&
         test_write_lines a Y y no yes bad "" |
         git clean -id ..) &&
-       test -f Makefile &&
-       test -f README &&
-       test -f src/part1.c &&
-       test -f src/part2.c &&
-       test ! -f a.out &&
-       test ! -f docs/manual.txt &&
-       test -f src/part3.c &&
-       test ! -f src/part3.h &&
-       test -f src/part4.c &&
-       test -f src/part4.h &&
-       test -f obj.o &&
-       test -f build/lib.so
+       test_path_is_file Makefile &&
+       test_path_is_file README &&
+       test_path_is_file src/part1.c &&
+       test_path_is_file src/part2.c &&
+       test_path_is_missing a.out &&
+       test_path_is_missing docs/manual.txt &&
+       test_path_is_file src/part3.c &&
+       test_path_is_missing src/part3.h &&
+       test_path_is_file src/part4.c &&
+       test_path_is_file src/part4.h &&
+       test_path_is_file obj.o &&
+       test_path_is_file build/lib.so
 
 '
 
index d9fbabb2b9d810d0c39cd504d105bcb8ba3e568c..00c1f1aab1304c127a5dccdaeff62d7213b7a9e5 100755 (executable)
@@ -60,7 +60,7 @@ test_expect_success 'submodule init aborts on missing .gitmodules file' '
        git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
        # missing the .gitmodules file here
        test_must_fail git submodule init 2>actual &&
-       test_i18ngrep "No url found for submodule path" actual
+       test_grep "No url found for submodule path" actual
 '
 
 test_expect_success 'submodule update aborts on missing .gitmodules file' '
@@ -68,7 +68,7 @@ test_expect_success 'submodule update aborts on missing .gitmodules file' '
        git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
        # missing the .gitmodules file here
        git submodule update sub 2>actual &&
-       test_i18ngrep "Submodule path .sub. not initialized" actual
+       test_grep "Submodule path .sub. not initialized" actual
 '
 
 test_expect_success 'submodule update aborts on missing gitmodules url' '
@@ -100,7 +100,7 @@ test_expect_success 'status should ignore inner git repo when not added' '
        ) &&
        test_must_fail git submodule status inner 2>output.err &&
        rm -fr inner &&
-       test_i18ngrep "^error: .*did not match any file(s) known to git" output.err
+       test_grep "^error: .*did not match any file(s) known to git" output.err
 '
 
 test_expect_success 'setup - repository in init subdirectory' '
@@ -196,7 +196,7 @@ test_expect_success 'redirected submodule add does not show progress' '
        git -C addtest submodule add "file://$submodurl/parent" submod-redirected \
                2>err &&
        ! grep % err &&
-       test_i18ngrep ! "Checking connectivity" err
+       test_grep ! "Checking connectivity" err
 '
 
 test_expect_success 'redirected submodule add --progress does show progress' '
@@ -263,7 +263,7 @@ test_expect_success 'submodule add relays add --dry-run stderr' '
                cd addtest &&
                : >.git/index.lock &&
                ! git submodule add "$submodurl" sub-while-locked 2>output.err &&
-               test_i18ngrep "^fatal: .*index\.lock" output.err &&
+               test_grep "^fatal: .*index\.lock" output.err &&
                test_path_is_missing sub-while-locked
        )
 '
@@ -405,7 +405,7 @@ test_expect_success 'submodule add in subdirectory with relative path should fai
                cd addtest/sub &&
                test_must_fail git submodule add ../../ submod3 2>../../output.err
        ) &&
-       test_i18ngrep toplevel output.err
+       test_grep toplevel output.err
 '
 
 test_expect_success 'setup - add an example entry to .gitmodules' '
@@ -486,7 +486,7 @@ test_expect_success 'status should still be "missing" after initializing' '
 
 test_failure_with_unknown_submodule () {
        test_must_fail git submodule $1 no-such-submodule 2>output.err &&
-       test_i18ngrep "^error: .*no-such-submodule" output.err
+       test_grep "^error: .*no-such-submodule" output.err
 }
 
 test_expect_success 'init should fail with unknown submodule' '
@@ -644,7 +644,7 @@ test_expect_success 'update --init' '
        test_must_fail git config submodule.example.url &&
 
        git submodule update init 2> update.out &&
-       test_i18ngrep "not initialized" update.out &&
+       test_grep "not initialized" update.out &&
        test_must_fail git rev-parse --resolve-git-dir init/.git &&
 
        git submodule update --init init &&
@@ -661,7 +661,7 @@ test_expect_success 'update --init from subdirectory' '
        (
                cd sub &&
                git submodule update ../init 2>update.out &&
-               test_i18ngrep "not initialized" update.out &&
+               test_grep "not initialized" update.out &&
                test_must_fail git rev-parse --resolve-git-dir ../init/.git &&
 
                git submodule update --init ../init
@@ -1121,7 +1121,7 @@ test_expect_success 'submodule deinit from subdirectory' '
                cd sub &&
                git submodule deinit ../init >../output
        ) &&
-       test_i18ngrep "\\.\\./init" output &&
+       test_grep "\\.\\./init" output &&
        test -z "$(git config --get-regexp "submodule\.example\.")" &&
        test -n "$(git config --get-regexp "submodule\.example2\.")" &&
        test -f example2/.git &&
@@ -1136,8 +1136,8 @@ test_expect_success 'submodule deinit . deinits all initialized submodules' '
        git submodule deinit . >actual &&
        test -z "$(git config --get-regexp "submodule\.example\.")" &&
        test -z "$(git config --get-regexp "submodule\.example2\.")" &&
-       test_i18ngrep "Cleared directory .init" actual &&
-       test_i18ngrep "Cleared directory .example2" actual &&
+       test_grep "Cleared directory .init" actual &&
+       test_grep "Cleared directory .example2" actual &&
        rmdir init example2
 '
 
@@ -1149,8 +1149,8 @@ test_expect_success 'submodule deinit --all deinits all initialized submodules'
        git submodule deinit --all >actual &&
        test -z "$(git config --get-regexp "submodule\.example\.")" &&
        test -z "$(git config --get-regexp "submodule\.example2\.")" &&
-       test_i18ngrep "Cleared directory .init" actual &&
-       test_i18ngrep "Cleared directory .example2" actual &&
+       test_grep "Cleared directory .init" actual &&
+       test_grep "Cleared directory .example2" actual &&
        rmdir init example2
 '
 
@@ -1160,8 +1160,8 @@ test_expect_success 'submodule deinit deinits a submodule when its work tree is
        git submodule deinit init example2 >actual &&
        test -z "$(git config --get-regexp "submodule\.example\.")" &&
        test -z "$(git config --get-regexp "submodule\.example2\.")" &&
-       test_i18ngrep ! "Cleared directory .init" actual &&
-       test_i18ngrep "Cleared directory .example2" actual &&
+       test_grep ! "Cleared directory .init" actual &&
+       test_grep "Cleared directory .example2" actual &&
        rmdir init
 '
 
@@ -1173,7 +1173,7 @@ test_expect_success 'submodule deinit fails when the submodule contains modifica
        test -f example2/.git &&
        git submodule deinit -f init >actual &&
        test -z "$(git config --get-regexp "submodule\.example\.")" &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep "Cleared directory .init" actual &&
        rmdir init
 '
 
@@ -1185,7 +1185,7 @@ test_expect_success 'submodule deinit fails when the submodule contains untracke
        test -f example2/.git &&
        git submodule deinit -f init >actual &&
        test -z "$(git config --get-regexp "submodule\.example\.")" &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep "Cleared directory .init" actual &&
        rmdir init
 '
 
@@ -1200,30 +1200,30 @@ test_expect_success 'submodule deinit fails when the submodule HEAD does not mat
        test -f example2/.git &&
        git submodule deinit -f init >actual &&
        test -z "$(git config --get-regexp "submodule\.example\.")" &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep "Cleared directory .init" actual &&
        rmdir init
 '
 
 test_expect_success 'submodule deinit is silent when used on an uninitialized submodule' '
        git submodule update --init &&
        git submodule deinit init >actual &&
-       test_i18ngrep "Submodule .example. (.*) unregistered for path .init" actual &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep "Submodule .example. (.*) unregistered for path .init" actual &&
+       test_grep "Cleared directory .init" actual &&
        git submodule deinit init >actual &&
-       test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep ! "Submodule .example. (.*) unregistered for path .init" actual &&
+       test_grep "Cleared directory .init" actual &&
        git submodule deinit . >actual &&
-       test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
-       test_i18ngrep "Submodule .example2. (.*) unregistered for path .example2" actual &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep ! "Submodule .example. (.*) unregistered for path .init" actual &&
+       test_grep "Submodule .example2. (.*) unregistered for path .example2" actual &&
+       test_grep "Cleared directory .init" actual &&
        git submodule deinit . >actual &&
-       test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
-       test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep ! "Submodule .example. (.*) unregistered for path .init" actual &&
+       test_grep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
+       test_grep "Cleared directory .init" actual &&
        git submodule deinit --all >actual &&
-       test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
-       test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
-       test_i18ngrep "Cleared directory .init" actual &&
+       test_grep ! "Submodule .example. (.*) unregistered for path .init" actual &&
+       test_grep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
+       test_grep "Cleared directory .init" actual &&
        rmdir init example2
 '
 
index 2b3c363078bc06219c8b5c16b02f331b447f5102..aa2fdc31d1a672cb229457b05adcce90bd204aa6 100755 (executable)
@@ -116,7 +116,7 @@ test_expect_success 'rebasing submodule that should conflict' '
        test_tick &&
        git commit -m fourth &&
 
-       test_must_fail git rebase --onto HEAD^^ HEAD^ HEAD^0 >actual_output &&
+       test_must_fail git rebase --onto HEAD^^ HEAD^ HEAD^0 2>actual_output &&
        git ls-files -s submodule >actual &&
        (
                cd submodule &&
index ff09443a0a4b0a5a4fdf1e14adc7e5d964a14dd6..19b6135d11744031c8777c3bd66c752d6ab9ba75 100755 (executable)
@@ -163,7 +163,7 @@ test_expect_success '"git submodule sync" should update submodule URLs - subdire
                cd sub &&
                git submodule sync >../../output
        ) &&
-       test_i18ngrep "\\.\\./submodule" output &&
+       test_grep "\\.\\./submodule" output &&
        test -d "$(
                cd super-clone/submodule &&
                git config remote.origin.url
@@ -194,7 +194,7 @@ test_expect_success '"git submodule sync --recursive" should update all submodul
                cd sub &&
                git submodule sync --recursive >../../output
        ) &&
-       test_i18ngrep "\\.\\./submodule/sub-submodule" output &&
+       test_grep "\\.\\./submodule/sub-submodule" output &&
        test -d "$(
                cd super-clone/submodule &&
                git config remote.origin.url
index 00651c25cb4089a4d7334ad00f6ebc8e51bafb0f..8491b8c58b97f0597a5fcc27448b3d99abdbe9c9 100755 (executable)
@@ -945,7 +945,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
        git clone super_update_r super_update_r2 &&
        (cd super_update_r2 &&
         git submodule update --init --recursive >actual &&
-        test_i18ngrep "Submodule path .submodule/subsubmodule.: checked out" actual &&
+        test_grep "Submodule path .submodule/subsubmodule.: checked out" actual &&
         (cd submodule/subsubmodule &&
          git log > ../../expected
         ) &&
@@ -1025,7 +1025,7 @@ test_expect_success 'submodule update clone shallow submodule outside of depth'
                # unadvertised objects, so restrict this test to v0.
                test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \
                        git submodule update --init --depth=1 2>actual &&
-               test_i18ngrep "Direct fetching of that commit failed." actual &&
+               test_grep "Direct fetching of that commit failed." actual &&
                git -C ../submodule config uploadpack.allowReachableSHA1InWant true &&
                git submodule update --init --depth=1 >actual &&
                git -C submodule log --oneline >out &&
@@ -1039,7 +1039,7 @@ test_expect_success 'submodule update --recursive drops module name before recur
          git checkout HEAD^
         ) &&
         git submodule update --recursive deeper/submodule >actual &&
-        test_i18ngrep "Submodule path .deeper/submodule/subsubmodule.: checked out" actual
+        test_grep "Submodule path .deeper/submodule/subsubmodule.: checked out" actual
        )
 '
 
index c0167944abdad3f3bd34c4c5fe29f9e7ec1afcf2..31271f8e0a61f7b071c770f9efad0e235920f37f 100755 (executable)
@@ -45,7 +45,7 @@ test_expect_success 'configuration parsing with error' '
        (
                cd repo &&
                test_must_fail test-tool submodule-config "" s 2>actual &&
-               test_i18ngrep "bad config" actual
+               test_grep "bad config" actual
        )
 '
 
@@ -101,7 +101,7 @@ test_expect_success 'error in history of one submodule config lets continue, std
                                >actual \
                                2>actual_stderr &&
                test_cmp expect_error actual &&
-               test_i18ngrep "submodule-blob $sha1:.gitmodules" actual_stderr >/dev/null
+               test_grep "submodule-blob $sha1:.gitmodules" actual_stderr >/dev/null
        )
 '
 
index 101afff30f67683ec03e92e4a89cead6badac521..24f30e3bf9c6440eca92838b42ae330a856f3fb6 100755 (executable)
@@ -13,13 +13,13 @@ test_expect_success 'create embedded repository' '
 test_expect_success 'git-add on embedded repository warns' '
        test_when_finished "git rm --cached -f embed" &&
        git add embed 2>stderr &&
-       test_i18ngrep warning stderr
+       test_grep warning stderr
 '
 
 test_expect_success '--no-warn-embedded-repo suppresses warning' '
        test_when_finished "git rm --cached -f embed" &&
        git add --no-warn-embedded-repo embed 2>stderr &&
-       test_i18ngrep ! warning stderr
+       test_grep ! warning stderr
 '
 
 test_expect_success 'no warning when updating entry' '
@@ -27,14 +27,14 @@ test_expect_success 'no warning when updating entry' '
        git add embed &&
        git -C embed commit --allow-empty -m two &&
        git add embed 2>stderr &&
-       test_i18ngrep ! warning stderr
+       test_grep ! warning stderr
 '
 
 test_expect_success 'submodule add does not warn' '
        test_when_finished "git rm -rf submodule .gitmodules" &&
        git -c protocol.file.allow=always \
                submodule add ./embed submodule 2>stderr &&
-       test_i18ngrep ! warning stderr
+       test_grep ! warning stderr
 '
 
 test_done
index 7cf72b9a07671c671c5ed7bbe275125ee7c142e6..2ab566e71787ab6f1f77eb97b6b476c5f3fbacbc 100755 (executable)
@@ -41,7 +41,7 @@ test_expect_success 'remove ./ protection from .gitmodules url' '
 test_expect_success 'clone rejects unprotected dash' '
        test_when_finished "rm -rf dst" &&
        test_must_fail git clone --recurse-submodules . dst 2>err &&
-       test_i18ngrep ignoring err
+       test_grep ignoring err
 '
 
 test_expect_success 'fsck rejects unprotected dash' '
@@ -63,7 +63,7 @@ test_expect_success 'trailing backslash is handled correctly' '
        mv .new .gitmodules &&
        git commit -am "Add testmodule" &&
        test_must_fail git clone --verbose --recurse-submodules . dolly 2>err &&
-       test_i18ngrep ! "unknown option" err
+       test_grep ! "unknown option" err
 '
 
 test_expect_success 'fsck rejects missing URL scheme' '
index 2f4b25dfd7e3860e47c0acdd3a9eeabff7f5504e..5e3051da8bb362fe01b80f5bc20ef0d736886a22 100755 (executable)
@@ -21,7 +21,7 @@ test_expect_success 'create submodule with dash in path' '
 test_expect_success 'clone rejects unprotected dash' '
        test_when_finished "rm -rf dst" &&
        git clone --recurse-submodules . dst 2>err &&
-       test_i18ngrep ignoring err
+       test_grep ignoring err
 '
 
 test_expect_success 'fsck rejects unprotected dash' '
@@ -46,7 +46,7 @@ test_expect_success MINGW 'submodule paths disallows trailing spaces' '
        git -C super update-ref refs/heads/main $commit &&
 
        test_must_fail git clone --recurse-submodules super dst 2>err &&
-       test_i18ngrep "sub " err
+       test_grep "sub " err
 '
 
 test_done
index 232065504cbfdcba60d3f5f69ffb4536b5ae99e8..a5d1bc5c54ae095f79bf9b3ee420ba004bb18a88 100755 (executable)
@@ -11,6 +11,10 @@ as expected.
 
 TEST_PASSES_SANITIZE_LEAK=true
 TEST_NO_CREATE_REPO=1
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
 . ./test-lib.sh
 
 test_expect_success 'setup' '
@@ -27,26 +31,28 @@ test_expect_success 'submodule config cache setup' '
                git checkout -b topic &&
                echo b >a &&
                git add . &&
-               git commit -mb
+               git commit -mb &&
+               git checkout main
        ) &&
        mkdir super &&
        (cd super &&
                git init &&
                git submodule add ../submodule &&
-               git commit -m "add submodule"
+               git submodule add --name thename ../submodule thepath &&
+               git commit -m "add submodules"
        )
 '
 
 test_expect_success 'ensure submodule branch is unset' '
        (cd super &&
-               ! grep branch .gitmodules
+               test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch
        )
 '
 
 test_expect_success 'test submodule set-branch --branch' '
        (cd super &&
                git submodule set-branch --branch topic submodule &&
-               grep "branch = topic" .gitmodules &&
+               test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
                git submodule update --remote &&
                cat <<-\EOF >expect &&
                b
@@ -57,13 +63,12 @@ test_expect_success 'test submodule set-branch --branch' '
 '
 
 test_expect_success 'test submodule set-branch --default' '
-       test_commit -C submodule c &&
        (cd super &&
                git submodule set-branch --default submodule &&
-               ! grep branch .gitmodules &&
+               test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
                git submodule update --remote &&
                cat <<-\EOF >expect &&
-               c
+               a
                EOF
                git -C submodule show -s --pretty=%s >actual &&
                test_cmp expect actual
@@ -71,10 +76,9 @@ test_expect_success 'test submodule set-branch --default' '
 '
 
 test_expect_success 'test submodule set-branch -b' '
-       test_commit -C submodule b &&
        (cd super &&
                git submodule set-branch -b topic submodule &&
-               grep "branch = topic" .gitmodules &&
+               test_cmp_config topic -f .gitmodules submodule.submodule.branch &&
                git submodule update --remote &&
                cat <<-\EOF >expect &&
                b
@@ -85,17 +89,43 @@ test_expect_success 'test submodule set-branch -b' '
 '
 
 test_expect_success 'test submodule set-branch -d' '
-       test_commit -C submodule d &&
        (cd super &&
                git submodule set-branch -d submodule &&
-               ! grep branch .gitmodules &&
+               test_cmp_config "" -f .gitmodules --default "" submodule.submodule.branch &&
                git submodule update --remote &&
                cat <<-\EOF >expect &&
-               d
+               a
                EOF
                git -C submodule show -s --pretty=%s >actual &&
                test_cmp expect actual
        )
 '
 
+test_expect_success 'test submodule set-branch --branch with named submodule' '
+       (cd super &&
+               git submodule set-branch --branch topic thepath &&
+               test_cmp_config topic -f .gitmodules submodule.thename.branch &&
+               test_cmp_config "" -f .gitmodules --default "" submodule.thepath.branch &&
+               git submodule update --remote &&
+               cat <<-\EOF >expect &&
+               b
+               EOF
+               git -C thepath show -s --pretty=%s >actual &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'test submodule set-branch --default with named submodule' '
+       (cd super &&
+               git submodule set-branch --default thepath &&
+               test_cmp_config "" -f .gitmodules --default "" submodule.thename.branch &&
+               git submodule update --remote &&
+               cat <<-\EOF >expect &&
+               a
+               EOF
+               git -C thepath show -s --pretty=%s >actual &&
+               test_cmp expect actual
+       )
+'
+
 test_done
index d6bf62b3ac670fc0be8167150cdf79cbd9000a45..bf7f15ee7973958970dfe0d1b34cea9d25e635a9 100755 (executable)
@@ -25,17 +25,26 @@ test_expect_success 'submodule config cache setup' '
                git add file &&
                git commit -ma
        ) &&
+       mkdir namedsubmodule &&
+       (
+               cd namedsubmodule &&
+               git init &&
+               echo 1 >file &&
+               git add file &&
+               git commit -m1
+       ) &&
        mkdir super &&
        (
                cd super &&
                git init &&
                git submodule add ../submodule &&
-               git commit -m "add submodule"
+               git submodule add --name thename ../namedsubmodule thepath &&
+               git commit -m "add submodules"
        )
 '
 
 test_expect_success 'test submodule set-url' '
-       # add a commit and move the submodule (change the url)
+       # add commits and move the submodules (change the urls)
        (
                cd submodule &&
                echo b >>file &&
@@ -44,15 +53,28 @@ test_expect_success 'test submodule set-url' '
        ) &&
        mv submodule newsubmodule &&
 
+       (
+               cd namedsubmodule &&
+               echo 2 >>file &&
+               git add file &&
+               git commit -m2
+       ) &&
+       mv namedsubmodule newnamedsubmodule &&
+
        git -C newsubmodule show >expect &&
+       git -C newnamedsubmodule show >>expect &&
        (
                cd super &&
                test_must_fail git submodule update --remote &&
                git submodule set-url submodule ../newsubmodule &&
-               grep -F "url = ../newsubmodule" .gitmodules &&
+               test_cmp_config ../newsubmodule -f .gitmodules submodule.submodule.url &&
+               git submodule set-url thepath ../newnamedsubmodule &&
+               test_cmp_config ../newnamedsubmodule -f .gitmodules submodule.thename.url &&
+               test_cmp_config "" -f .gitmodules --default "" submodule.thepath.url &&
                git submodule update --remote
        ) &&
        git -C super/submodule show >actual &&
+       git -C super/thepath show >>actual &&
        test_cmp expect actual
 '
 
index 0d0c3f2c683122dbf611cd0ac57bce86166acab3..46d4fb0354b13d585260587d78d27d1e9c545f1c 100755 (executable)
@@ -45,6 +45,32 @@ test_expect_success 'check names' '
        test_cmp expect actual
 '
 
+test_expect_success 'check urls' '
+       cat >expect <<-\EOF &&
+       ./bar/baz/foo.git
+       https://example.com/foo.git
+       http://example.com:80/deeper/foo.git
+       EOF
+
+       test-tool submodule check-url >actual <<-\EOF &&
+       ./bar/baz/foo.git
+       https://example.com/foo.git
+       http://example.com:80/deeper/foo.git
+       -a./foo
+       ../../..//test/foo.git
+       ../../../../../:localhost:8080/foo.git
+       ..\../.\../:example.com/foo.git
+       ./%0ahost=example.com/foo.git
+       https://one.example.com/evil?%0ahost=two.example.com
+       https:///example.com/foo.git
+       http://example.com:test/foo.git
+       https::example.com/foo.git
+       http:::example.com/foo.git
+       EOF
+
+       test_cmp expect actual
+'
+
 test_expect_success 'create innocent subrepo' '
        git init innocent &&
        git -C innocent commit --allow-empty -m foo
@@ -238,7 +264,7 @@ test_expect_success 'fsck detects non-blob .gitmodules' '
                git ls-tree HEAD | sed s/subdir/.gitmodules/ | git mktree &&
 
                test_must_fail git fsck 2>output &&
-               test_i18ngrep gitmodulesBlob output
+               test_grep gitmodulesBlob output
        )
 '
 
@@ -252,8 +278,8 @@ test_expect_success 'fsck detects corrupt .gitmodules' '
                git commit -m "broken gitmodules" &&
 
                git fsck 2>output &&
-               test_i18ngrep gitmodulesParse output &&
-               test_i18ngrep ! "bad config" output
+               test_grep gitmodulesParse output &&
+               test_grep ! "bad config" output
        )
 '
 
@@ -275,7 +301,7 @@ test_expect_success WINDOWS 'prevent git~1 squatting on Windows' '
                hash="$(echo x | git hash-object -w --stdin)" &&
                test_must_fail git update-index --add \
                        --cacheinfo 160000,$rev,d\\a 2>err &&
-               test_i18ngrep "Invalid path" err &&
+               test_grep "Invalid path" err &&
                git -c core.protectNTFS=false update-index --add \
                        --cacheinfo 100644,$modules,.gitmodules \
                        --cacheinfo 160000,$rev,c \
@@ -289,7 +315,7 @@ test_expect_success WINDOWS 'prevent git~1 squatting on Windows' '
        then
                test_must_fail git -c core.protectNTFS=false \
                        clone --recurse-submodules squatting squatting-clone 2>err &&
-               test_i18ngrep -e "directory not empty" -e "not an empty directory" err &&
+               test_grep -e "directory not empty" -e "not an empty directory" err &&
                ! grep gitdir squatting-clone/d/a/git~2
        fi
 '
@@ -314,7 +340,7 @@ test_expect_success 'git dirs of sibling submodules must not be nested' '
                git commit -m nested
        ) &&
        test_must_fail git clone --recurse-submodules nested clone 2>err &&
-       test_i18ngrep "is inside git dir" err
+       test_grep "is inside git dir" err
 '
 
 test_done
index 5fcaa0b4f2aa5e7b533f0dc0beb5426f2997645a..4dca8d97a772d63566a9ea19121d8019cafb766c 100755 (executable)
@@ -555,7 +555,7 @@ test_expect_success 'commit without staging files fails and displays hints' '
        git commit -m initial &&
        echo "changes" >>file &&
        test_must_fail git commit -m update >actual &&
-       test_i18ngrep "no changes added to commit (use \"git add\" and/or \"git commit -a\")" actual
+       test_grep "no changes added to commit (use \"git add\" and/or \"git commit -a\")" actual
 '
 
 test_done
index fb5417d5e7e044f5bfbbe1b4ef8f6b42857c4e73..bced44a0fc915f430ccc41d54fbd8bc48df2cef8 100755 (executable)
@@ -3,8 +3,7 @@
 # Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com>
 #
 
-# FIXME: Test the various index usages, -i and -o, test reflog,
-# signoff
+# FIXME: Test the various index usages, test reflog
 
 test_description='git commit'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
@@ -21,7 +20,7 @@ test_expect_success 'initial status' '
        echo bongo bongo >file &&
        git add file &&
        git status >actual &&
-       test_i18ngrep "No commits yet" actual
+       test_grep "No commits yet" actual
 '
 
 test_expect_success 'fail initial amend' '
@@ -92,6 +91,34 @@ test_expect_success '--long fails with nothing to commit' '
        test_must_fail git commit -m initial --long
 '
 
+test_expect_success 'fail to commit untracked file (even with --include/--only)' '
+       echo content >baz &&
+       error="error: pathspec .baz. did not match any file(s) known to git" &&
+
+       test_must_fail git commit -m "baz" baz 2>err &&
+       test_grep -e "$error" err &&
+
+       test_must_fail git commit --only -m "baz" baz 2>err &&
+       test_grep -e "$error" err &&
+
+       # TODO: as for --include, the below command will fail because
+       # nothing is staged. If something was staged, it would not fail
+       # even though the provided pathspec does not match any tracked
+       # path. (However, the untracked paths that match the pathspec are
+       # not committed and only the staged changes get committed.)
+       # In either cases, no error is returned to stderr like in (--only
+       # and without --only/--include) cases. In a similar manner,
+       # "git add -u baz" also does not error out.
+       #
+       # Therefore, the below test is just to document the current behavior
+       # and is not an endorsement to the current behavior, and we may
+       # want to fix this. And when that happens, this test should be
+       # updated accordingly.
+
+       test_must_fail git commit --include -m "baz" baz 2>err &&
+       test_must_be_empty err
+'
+
 test_expect_success 'setup: non-initial commit' '
        echo bongo bongo bongo >file &&
        git commit -m next -a
@@ -117,6 +144,51 @@ test_expect_success '--long with stuff to commit returns ok' '
        git commit -m next -a --long
 '
 
+for opt in "" "-o" "--only"
+do
+       test_expect_success 'exclude additional staged changes when given pathspec' '
+               echo content >>file &&
+               echo content >>baz &&
+               git add baz &&
+               git commit $opt -m "file" file &&
+
+               git diff --name-only >actual &&
+               test_must_be_empty actual &&
+
+               test_write_lines baz >expect &&
+               git diff --name-only --cached >actual &&
+               test_cmp expect actual &&
+
+               test_write_lines file >expect &&
+               git diff --name-only HEAD^ HEAD >actual &&
+               test_cmp expect actual
+       '
+done
+
+test_expect_success '-i/--include includes staged changes' '
+       echo content >>file &&
+       echo content >>baz &&
+       git add file &&
+
+       # baz is in the index, therefore, it will be committed
+       git commit --include -m "file and baz" baz  &&
+
+       git diff --name-only HEAD >remaining &&
+       test_must_be_empty remaining &&
+
+       test_write_lines baz file >expect &&
+       git diff --name-only HEAD^ HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--include and --only do not mix' '
+       test_when_finished "git reset --hard" &&
+       echo content >>file &&
+       echo content >>baz &&
+       test_must_fail git commit --include --only -m "file baz" file baz 2>actual &&
+       test_grep -e "fatal: options .-i/--include. and .-o/--only. cannot be used together" actual
+'
+
 test_expect_success 'commit message from non-existing file' '
        echo more bongo: bongo bongo bongo bongo >file &&
        test_must_fail git commit -F gah -a
@@ -141,7 +213,7 @@ test_expect_success 'template "emptyness" check does not kick in with -F' '
 test_expect_success 'template "emptyness" check' '
        git checkout HEAD file && echo >>file && git add file &&
        test_must_fail git commit -t file 2>err &&
-       test_i18ngrep "did not edit" err
+       test_grep "did not edit" err
 '
 
 test_expect_success 'setup: commit message from file' '
@@ -389,6 +461,28 @@ test_expect_success 'amend commit to fix date' '
 
 '
 
+test_expect_success 'amend commit to add signoff' '
+
+       test_commit "msg" file content &&
+       git commit --amend --signoff &&
+       test_commit_message HEAD <<-EOF
+       msg
+
+       Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
+       EOF
+'
+
+test_expect_success 'amend does not add signoff if it already exists' '
+
+       test_commit --signoff "tenor" file newcontent &&
+       git commit --amend --signoff &&
+       test_commit_message HEAD <<-EOF
+       tenor
+
+       Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
+       EOF
+'
+
 test_expect_success 'commit mentions forced date in output' '
        git commit --amend --date=2010-01-02T03:04:05 >output &&
        grep "Date: *Sat Jan 2 03:04:05 2010" output
@@ -671,7 +765,7 @@ test_expect_success 'commit a file whose name is a dash' '
        git add ./- &&
        test_tick &&
        git commit -m "add dash" >output </dev/null &&
-       test_i18ngrep " changed, 5 insertions" output
+       test_grep " changed, 5 insertions" output
 '
 
 test_expect_success '--only works on to-be-born branch' '
index b5bf7de7cd66c781657173bac3074cacb1107bf1..b37e2018a74a7b28725fa277a95cca516daf5cbe 100755 (executable)
@@ -485,6 +485,24 @@ test_expect_success 'commit --trailer not confused by --- separator' '
        test_cmp expected actual
 '
 
+test_expect_success 'commit --trailer with --verbose' '
+       cat >msg <<-\EOF &&
+       subject
+
+       body
+       EOF
+       GIT_EDITOR=: git commit --edit -F msg --allow-empty \
+               --trailer="my-trailer: value" --verbose &&
+       {
+               cat msg &&
+               echo &&
+               echo "my-trailer: value"
+       } >expected &&
+       git cat-file commit HEAD >commit.msg &&
+       sed -e "1,/^\$/d" commit.msg >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success 'multiple -m' '
 
        >negative &&
@@ -706,18 +724,23 @@ test_expect_success 'cleanup commit message (whitespace config, -m)' '
 test_expect_success 'message shows author when it is not equal to committer' '
        echo >>negative &&
        git commit -e -m "sample" -a &&
-       test_i18ngrep \
+       test_grep \
          "^# Author: *A U Thor <author@example.com>\$" \
          .git/COMMIT_EDITMSG
 '
 
 test_expect_success 'message shows date when it is explicitly set' '
        git commit --allow-empty -e -m foo --date="2010-01-02T03:04:05" &&
-       test_i18ngrep \
+       test_grep \
          "^# Date: *Sat Jan 2 03:04:05 2010 +0000" \
          .git/COMMIT_EDITMSG
 '
 
+test_expect_success 'message does not have multiple scissors lines' '
+       git commit --cleanup=scissors -v --allow-empty -e -m foo &&
+       test $(grep -c -e "--- >8 ---" .git/COMMIT_EDITMSG) -eq 1
+'
+
 test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
 
        echo >>negative &&
@@ -728,7 +751,7 @@ test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
        ) &&
        # the ident is calculated from the system, so we cannot
        # check the actual value, only that it is there
-       test_i18ngrep "^# Committer: " .git/COMMIT_EDITMSG
+       test_grep "^# Committer: " .git/COMMIT_EDITMSG
 '
 
 write_script .git/FAKE_EDITOR <<EOF
@@ -860,9 +883,9 @@ try_commit () {
        GIT_EDITOR=.git/FAKE_EDITOR git commit -a $* $use_template &&
        case "$use_template" in
        '')
-               test_i18ngrep ! "^## Custom template" .git/COMMIT_EDITMSG ;;
+               test_grep ! "^## Custom template" .git/COMMIT_EDITMSG ;;
        *)
-               test_i18ngrep "^## Custom template" .git/COMMIT_EDITMSG ;;
+               test_grep "^## Custom template" .git/COMMIT_EDITMSG ;;
        esac
 }
 
@@ -870,53 +893,53 @@ try_commit_status_combo () {
 
        test_expect_success 'commit' '
                try_commit "" &&
-               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --status' '
                try_commit --status &&
-               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --no-status' '
                try_commit --no-status &&
-               test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit with commit.status = yes' '
                test_config commit.status yes &&
                try_commit "" &&
-               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit with commit.status = no' '
                test_config commit.status no &&
                try_commit "" &&
-               test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --status with commit.status = yes' '
                test_config commit.status yes &&
                try_commit --status &&
-               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --no-status with commit.status = yes' '
                test_config commit.status yes &&
                try_commit --no-status &&
-               test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --status with commit.status = no' '
                test_config commit.status no &&
                try_commit --status &&
-               test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
        test_expect_success 'commit --no-status with commit.status = no' '
                test_config commit.status no &&
                try_commit --no-status &&
-               test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
+               test_grep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
 }
@@ -930,13 +953,13 @@ try_commit_status_combo
 test_expect_success 'commit --status with custom comment character' '
        test_config core.commentchar ";" &&
        try_commit --status &&
-       test_i18ngrep "^; Changes to be committed:" .git/COMMIT_EDITMSG
+       test_grep "^; Changes to be committed:" .git/COMMIT_EDITMSG
 '
 
 test_expect_success 'switch core.commentchar' '
        test_commit "#foo" foo &&
        GIT_EDITOR=.git/FAKE_EDITOR git -c core.commentChar=auto commit --amend &&
-       test_i18ngrep "^; Changes to be committed:" .git/COMMIT_EDITMSG
+       test_grep "^; Changes to be committed:" .git/COMMIT_EDITMSG
 '
 
 test_expect_success 'switch core.commentchar but out of options' '
index d050091345b3929dc8e578409d45069b932c9733..46566d529e8725fb3b26e7664f2f8d44c2458a1c 100755 (executable)
@@ -37,19 +37,19 @@ test_expect_success 'setup' '
 
 test_expect_success 'status clean' '
        git status >output &&
-       test_i18ngrep "nothing to commit" output
+       test_grep "nothing to commit" output
 '
 
 test_expect_success 'commit --dry-run -a clean' '
        test_must_fail git commit --dry-run -a >output &&
-       test_i18ngrep "nothing to commit" output
+       test_grep "nothing to commit" output
 '
 
 test_expect_success 'status with modified file in submodule' '
        (cd sub && git reset --hard) &&
        echo "changed" >sub/foo &&
        git status >output &&
-       test_i18ngrep "modified:   sub (modified content)" output
+       test_grep "modified:   sub (modified content)" output
 '
 
 test_expect_success 'status with modified file in submodule (porcelain)' '
@@ -73,7 +73,7 @@ test_expect_success 'status with modified file in submodule (short)' '
 test_expect_success 'status with added file in submodule' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        git status >output &&
-       test_i18ngrep "modified:   sub (modified content)" output
+       test_grep "modified:   sub (modified content)" output
 '
 
 test_expect_success 'status with added file in submodule (porcelain)' '
@@ -96,12 +96,12 @@ test_expect_success 'status with untracked file in submodule' '
        (cd sub && git reset --hard) &&
        echo "content" >sub/new-file &&
        git status >output &&
-       test_i18ngrep "modified:   sub (untracked content)" output
+       test_grep "modified:   sub (untracked content)" output
 '
 
 test_expect_success 'status -uno with untracked file in submodule' '
        git status -uno >output &&
-       test_i18ngrep "^nothing to commit" output
+       test_grep "^nothing to commit" output
 '
 
 test_expect_success 'status with untracked file in submodule (porcelain)' '
@@ -122,7 +122,7 @@ test_expect_success 'status with added and untracked file in submodule' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        echo "content" >sub/new-file &&
        git status >output &&
-       test_i18ngrep "modified:   sub (modified content, untracked content)" output
+       test_grep "modified:   sub (modified content, untracked content)" output
 '
 
 test_expect_success 'status with added and untracked file in submodule (porcelain)' '
@@ -140,7 +140,7 @@ test_expect_success 'status with modified file in modified submodule' '
        (cd sub && echo "next change" >foo && git commit -m "next change" foo) &&
        echo "changed" >sub/foo &&
        git status >output &&
-       test_i18ngrep "modified:   sub (new commits, modified content)" output
+       test_grep "modified:   sub (new commits, modified content)" output
 '
 
 test_expect_success 'status with modified file in modified submodule (porcelain)' '
@@ -155,7 +155,7 @@ test_expect_success 'status with modified file in modified submodule (porcelain)
 test_expect_success 'status with added file in modified submodule' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        git status >output &&
-       test_i18ngrep "modified:   sub (new commits, modified content)" output
+       test_grep "modified:   sub (new commits, modified content)" output
 '
 
 test_expect_success 'status with added file in modified submodule (porcelain)' '
@@ -170,7 +170,7 @@ test_expect_success 'status with untracked file in modified submodule' '
        (cd sub && git reset --hard) &&
        echo "content" >sub/new-file &&
        git status >output &&
-       test_i18ngrep "modified:   sub (new commits, untracked content)" output
+       test_grep "modified:   sub (new commits, untracked content)" output
 '
 
 test_expect_success 'status with untracked file in modified submodule (porcelain)' '
@@ -184,7 +184,7 @@ test_expect_success 'status with added and untracked file in modified submodule'
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        echo "content" >sub/new-file &&
        git status >output &&
-       test_i18ngrep "modified:   sub (new commits, modified content, untracked content)" output
+       test_grep "modified:   sub (new commits, modified content, untracked content)" output
 '
 
 test_expect_success 'status with added and untracked file in modified submodule (porcelain)' '
@@ -209,7 +209,7 @@ test_expect_success 'setup .git file for sub' '
 test_expect_success 'status with added file in modified submodule with .git file' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        git status >output &&
-       test_i18ngrep "modified:   sub (new commits, modified content)" output
+       test_grep "modified:   sub (new commits, modified content)" output
 '
 
 test_expect_success 'status with a lot of untracked files in the submodule' '
@@ -234,12 +234,12 @@ test_expect_success 'rm submodule contents' '
 
 test_expect_success 'status clean (empty submodule dir)' '
        git status >output &&
-       test_i18ngrep "nothing to commit" output
+       test_grep "nothing to commit" output
 '
 
 test_expect_success 'status -a clean (empty submodule dir)' '
        test_must_fail git commit --dry-run -a >output &&
-       test_i18ngrep "nothing to commit" output
+       test_grep "nothing to commit" output
 '
 
 cat >status_expect <<\EOF
index 916470c48bd69cb245eaf0e9045cd3f1519b7ba6..c3281b192e49ce130d3babc4f9fda39acd3d69b8 100755 (executable)
@@ -89,7 +89,7 @@ test_expect_success 'submodule log is stripped out too with -v' '
                export GIT_EDITOR &&
                test_must_fail git commit -a -v 2>err
        ) &&
-       test_i18ngrep "Aborting commit due to empty commit message." err
+       test_grep "Aborting commit due to empty commit message." err
 '
 
 test_expect_success 'verbose diff is stripped out with set core.commentChar' '
@@ -98,7 +98,7 @@ test_expect_success 'verbose diff is stripped out with set core.commentChar' '
                export GIT_EDITOR &&
                test_must_fail git -c core.commentchar=";" commit -a -v 2>err
        ) &&
-       test_i18ngrep "Aborting commit due to empty commit message." err
+       test_grep "Aborting commit due to empty commit message." err
 '
 
 test_expect_success 'status does not verbose without --verbose' '
index 6928fd89f5d887b2f7a3feb9263b39d77affe9aa..a3c18a4fc2764aa669556fe56961d254727bdab5 100755 (executable)
@@ -19,7 +19,7 @@ test_expect_success 'status -h in broken repository' '
                echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
                test_expect_code 129 git status -h >usage 2>&1
        ) &&
-       test_i18ngrep "[Uu]sage" broken/usage
+       test_grep "[Uu]sage" broken/usage
 '
 
 test_expect_success 'commit -h in broken repository' '
@@ -31,7 +31,7 @@ test_expect_success 'commit -h in broken repository' '
                echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
                test_expect_code 129 git commit -h >usage 2>&1
        ) &&
-       test_i18ngrep "[Uu]sage" broken/usage
+       test_grep "[Uu]sage" broken/usage
 '
 
 test_expect_success 'create upstream branch' '
@@ -72,7 +72,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'status (1)' '
-       test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
+       test_grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
 '
 
 strip_comments () {
@@ -1542,12 +1542,12 @@ test_expect_success 'git commit will commit a staged but ignored submodule' '
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore all &&
        git status -s --ignore-submodules=dirty >output &&
-       test_i18ngrep "^M. sm" output &&
+       test_grep "^M. sm" output &&
        GIT_EDITOR="echo hello >>\"\$1\"" &&
        export GIT_EDITOR &&
        git commit -uno &&
        git status -s --ignore-submodules=dirty >output &&
-       test_i18ngrep ! "^M. sm" output
+       test_grep ! "^M. sm" output
 '
 
 test_expect_success 'git commit --dry-run will show a staged but ignored submodule' '
@@ -1572,13 +1572,13 @@ EOF
        git commit -uno --dry-run >output &&
        test_cmp expect output &&
        git status -s --ignore-submodules=dirty >output &&
-       test_i18ngrep "^M. sm" output
+       test_grep "^M. sm" output
 '
 
 test_expect_success 'git commit -m will commit a staged but ignored submodule' '
        git commit -uno -m message &&
        git status -s --ignore-submodules=dirty >output &&
-       test_i18ngrep ! "^M. sm" output &&
+       test_grep ! "^M. sm" output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
 '
@@ -1591,7 +1591,7 @@ test_expect_success 'show stash info with "--show-stash"' '
        git stash &&
        git status >expected_default &&
        git status --show-stash >expected_with_stash &&
-       test_i18ngrep "^Your stash currently has 1 entry$" expected_with_stash
+       test_grep "^Your stash currently has 1 entry$" expected_with_stash
 '
 
 test_expect_success 'no stash info with "--show-stash --no-show-stash"' '
@@ -1618,14 +1618,14 @@ test_expect_success 'no additional info if no stash entries' '
 test_expect_success '"No commits yet" should be noted in status output' '
        git checkout --orphan empty-branch-1 &&
        git status >output &&
-       test_i18ngrep "No commits yet" output
+       test_grep "No commits yet" output
 '
 
 test_expect_success '"No commits yet" should not be noted in status output' '
        git checkout --orphan empty-branch-2 &&
        test_commit test-commit-1 &&
        git status >output &&
-       test_i18ngrep ! "No commits yet" output
+       test_grep ! "No commits yet" output
 '
 
 test_expect_success '"Initial commit" should be noted in commit template' '
@@ -1633,7 +1633,7 @@ test_expect_success '"Initial commit" should be noted in commit template' '
        touch to_be_committed_1 &&
        git add to_be_committed_1 &&
        git commit --dry-run >output &&
-       test_i18ngrep "Initial commit" output
+       test_grep "Initial commit" output
 '
 
 test_expect_success '"Initial commit" should not be noted in commit template' '
@@ -1642,7 +1642,7 @@ test_expect_success '"Initial commit" should not be noted in commit template' '
        touch to_be_committed_2 &&
        git add to_be_committed_2 &&
        git commit --dry-run >output &&
-       test_i18ngrep ! "Initial commit" output
+       test_grep ! "Initial commit" output
 '
 
 test_expect_success '--no-optional-locks prevents index update' '
@@ -1745,4 +1745,20 @@ test_expect_success 'slow status advice when core.untrackedCache true, and fsmon
        )
 '
 
+test_expect_success EXPENSIVE 'status does not re-read unchanged 4 or 8 GiB file' '
+       (
+               mkdir large-file &&
+               cd large-file &&
+               # Files are 2 GiB, 4 GiB, and 8 GiB sparse files.
+               test-tool truncate file-a 0x080000000 &&
+               test-tool truncate file-b 0x100000000 &&
+               test-tool truncate file-c 0x200000000 &&
+               # This will be slow.
+               git add file-a file-b file-c &&
+               git commit -m "add large files" &&
+               git diff-index HEAD file-a file-b file-c >actual &&
+               test_must_be_empty actual
+       )
+'
+
 test_done
index 5d890949f75b5acb4ef9334a41c080ece60c1653..fd8c8f8f0bccf81eed7711e178912753ac200d72 100755 (executable)
@@ -99,7 +99,7 @@ test_expect_success '--amend option with empty author' '
        echo "Empty author test" >>foo &&
        test_tick &&
        test_must_fail git commit -a -m "empty author" --amend 2>err &&
-       test_i18ngrep "empty ident" err
+       test_grep "empty ident" err
 '
 
 test_expect_success '--amend option with missing author' '
@@ -112,7 +112,7 @@ test_expect_success '--amend option with missing author' '
        echo "Missing author test" >>foo &&
        test_tick &&
        test_must_fail git commit -a -m "malformed author" --amend 2>err &&
-       test_i18ngrep "empty ident" err
+       test_grep "empty ident" err
 '
 
 test_expect_success '--reset-author makes the commit ours even with --amend option' '
index c2ab8a444a832513b9365a2a6eca11535e2ec8fe..802f8f704c62eb11192bcc82ecd35f0ae53b5a6a 100755 (executable)
@@ -692,6 +692,34 @@ EOF
 '
 
 
+test_expect_success 'status when bisecting while rebasing' '
+       git reset --hard main &&
+       test_when_finished "git rebase --abort" &&
+       ONTO=$(git rev-parse --short HEAD^) &&
+       FAKE_LINES="break" git rebase -i HEAD^ &&
+       test_when_finished "git checkout -" &&
+       git checkout -b bisect_while_rebasing &&
+       test_when_finished "git bisect reset" &&
+       git bisect start &&
+       cat >expected <<EOF &&
+On branch bisect_while_rebasing
+Last command done (1 command done):
+   break
+No commands remaining.
+You are currently editing a commit while rebasing branch '\''bisect'\'' on '\''$ONTO'\''.
+  (use "git commit --amend" to amend the current commit)
+  (use "git rebase --continue" once you are satisfied with your changes)
+
+You are currently bisecting, started from branch '\''bisect_while_rebasing'\''.
+  (use "git bisect reset" to get back to the original branch)
+
+nothing to commit (use -u to show untracked files)
+EOF
+       git status --untracked-files=no >actual &&
+       test_cmp expected actual
+'
+
+
 test_expect_success 'status when rebase --apply conflicts with statushints disabled' '
        git reset --hard main &&
        git checkout -b statushints_disabled &&
index 97f10905d23fd3077aa9dd253fa079eb9c5be73d..3d3e13ccf87215adc1f8dcc8cc674e13d0f4bc91 100755 (executable)
@@ -489,7 +489,7 @@ test_expect_success 'multiline field treated as atomic for neighbor check' '
 '
 
 test_expect_success 'with config setup' '
-       git config trailer.ack.key "Acked-by: " &&
+       test_config trailer.ack.key "Acked-by: " &&
        cat >expected <<-\EOF &&
 
                Acked-by: Peff
@@ -503,8 +503,8 @@ test_expect_success 'with config setup' '
 '
 
 test_expect_success 'with config setup and ":=" as separators' '
-       git config trailer.separators ":=" &&
-       git config trailer.ack.key "Acked-by= " &&
+       test_config trailer.separators ":=" &&
+       test_config trailer.ack.key "Acked-by= " &&
        cat >expected <<-\EOF &&
 
                Acked-by= Peff
@@ -518,7 +518,7 @@ test_expect_success 'with config setup and ":=" as separators' '
 '
 
 test_expect_success 'with config setup and "%" as separators' '
-       git config trailer.separators "%" &&
+       test_config trailer.separators "%" &&
        cat >expected <<-\EOF &&
 
                bug% 42
@@ -532,6 +532,7 @@ test_expect_success 'with config setup and "%" as separators' '
 '
 
 test_expect_success 'with "%" as separators and a message with trailers' '
+       test_config trailer.separators "%" &&
        cat >special_message <<-\EOF &&
                Special Message
 
@@ -553,8 +554,8 @@ test_expect_success 'with "%" as separators and a message with trailers' '
 '
 
 test_expect_success 'with config setup and ":=#" as separators' '
-       git config trailer.separators ":=#" &&
-       git config trailer.bug.key "Bug #" &&
+       test_config trailer.separators ":=#" &&
+       test_config trailer.bug.key "Bug #" &&
        cat >expected <<-\EOF &&
 
                Bug #42
@@ -581,6 +582,8 @@ test_expect_success 'with basic patch' '
 '
 
 test_expect_success 'with commit complex message as argument' '
+       test_config trailer.separators ":=" &&
+       test_config trailer.ack.key "Acked-by= " &&
        cat complex_message_body complex_message_trailers >complex_message &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
@@ -594,6 +597,8 @@ test_expect_success 'with commit complex message as argument' '
 '
 
 test_expect_success 'with 2 files arguments' '
+       test_config trailer.separators ":=" &&
+       test_config trailer.ack.key "Acked-by= " &&
        cat basic_message >>expected &&
        echo >>expected &&
        cat basic_patch >>expected &&
@@ -677,6 +682,9 @@ test_expect_success 'with message that has an old style conflict block' '
 '
 
 test_expect_success 'with commit complex message and trailer args' '
+       test_config trailer.separators ":=#" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.bug.key "Bug #" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -692,6 +700,9 @@ test_expect_success 'with commit complex message and trailer args' '
 '
 
 test_expect_success 'with complex patch, args and --trim-empty' '
+       test_config trailer.separators ":=#" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.bug.key "Bug #" &&
        cat complex_message >complex_patch &&
        cat basic_patch >>complex_patch &&
        cat complex_message_body >expected &&
@@ -746,7 +757,10 @@ test_expect_success POSIXPERM,SANITY "in-place editing doesn't clobber original
 '
 
 test_expect_success 'using "where = before"' '
-       git config trailer.bug.where "before" &&
+       test_config trailer.separators ":=#" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -762,7 +776,9 @@ test_expect_success 'using "where = before"' '
 '
 
 test_expect_success 'overriding configuration with "--where after"' '
-       git config trailer.ack.where "before" &&
+       test_config trailer.separators ":=" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "before" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -776,7 +792,12 @@ test_expect_success 'overriding configuration with "--where after"' '
        test_cmp expected actual
 '
 
-test_expect_success 'using "where = before" with "--no-where"' '
+test_expect_success 'using "--where after" with "--no-where"' '
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "before" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -791,8 +812,59 @@ test_expect_success 'using "where = before" with "--no-where"' '
        test_cmp expected actual
 '
 
+# Check whether using "--no-where" clears out only the "--where after", such
+# that we still use the configuration in trailer.where (which is different from
+# the hardcoded default (in WHERE_END) assuming the absence of .gitconfig).
+# Here, the "start" setting of trailer.where is respected, so the new "Acked-by"
+# and "Bug" trailers are placed at the beginning, and not at the end which is
+# the harcoded default.
+test_expect_success 'using "--where after" with "--no-where" defaults to configuration' '
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.separators ":=#" &&
+       test_config trailer.where "start" &&
+       cat complex_message_body >expected &&
+       sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+               Bug #42
+               Acked-by= Peff
+               Fixes: Z
+               Acked-by= Z
+               Reviewed-by: Z
+               Signed-off-by: Z
+       EOF
+       git interpret-trailers --where after --no-where --trailer "ack: Peff" \
+               --trailer "bug: 42" complex_message >actual &&
+       test_cmp expected actual
+'
+
+# The "--where after" will only get respected for the trailer that came
+# immediately after it. For the next trailer (Bug #42), we default to using the
+# hardcoded WHERE_END because we don't have any "trailer.where" or
+# "trailer.bug.where" configured.
+test_expect_success 'using "--no-where" defaults to harcoded default if nothing configured' '
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.separators ":=#" &&
+       cat complex_message_body >expected &&
+       sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+               Fixes: Z
+               Acked-by= Z
+               Acked-by= Peff
+               Reviewed-by: Z
+               Signed-off-by: Z
+               Bug #42
+       EOF
+       git interpret-trailers --where after --trailer "ack: Peff" --no-where \
+               --trailer "bug: 42" complex_message >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success 'using "where = after"' '
-       git config trailer.ack.where "after" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -808,8 +880,11 @@ test_expect_success 'using "where = after"' '
 '
 
 test_expect_success 'using "where = end"' '
-       git config trailer.review.key "Reviewed-by" &&
-       git config trailer.review.where "end" &&
+       test_config trailer.review.key "Reviewed-by" &&
+       test_config trailer.review.where "end" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -827,8 +902,11 @@ test_expect_success 'using "where = end"' '
 '
 
 test_expect_success 'using "where = start"' '
-       git config trailer.review.key "Reviewed-by" &&
-       git config trailer.review.where "start" &&
+       test_config trailer.review.key "Reviewed-by" &&
+       test_config trailer.review.where "start" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Reviewed-by: Johannes
@@ -846,8 +924,13 @@ test_expect_success 'using "where = start"' '
 '
 
 test_expect_success 'using "where = before" for a token in the middle of the message' '
-       git config trailer.review.key "Reviewed-by:" &&
-       git config trailer.review.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.review.where "before" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -864,6 +947,12 @@ test_expect_success 'using "where = before" for a token in the middle of the mes
 '
 
 test_expect_success 'using "where = before" and --trim-empty' '
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        cat >>expected <<-\EOF &&
                Bug #46
@@ -878,6 +967,13 @@ test_expect_success 'using "where = before" and --trim-empty' '
 '
 
 test_expect_success 'the default is "ifExists = addIfDifferentNeighbor"' '
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.review.where "before" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -896,7 +992,13 @@ test_expect_success 'the default is "ifExists = addIfDifferentNeighbor"' '
 '
 
 test_expect_success 'default "ifExists" is now "addIfDifferent"' '
-       git config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -914,8 +1016,14 @@ test_expect_success 'default "ifExists" is now "addIfDifferent"' '
 '
 
 test_expect_success 'using "ifExists = addIfDifferent" with "where = end"' '
-       git config trailer.ack.ifExists "addIfDifferent" &&
-       git config trailer.ack.where "end" &&
+       test_config trailer.ack.ifExists "addIfDifferent" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "end" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -932,8 +1040,14 @@ test_expect_success 'using "ifExists = addIfDifferent" with "where = end"' '
 '
 
 test_expect_success 'using "ifExists = addIfDifferent" with "where = before"' '
-       git config trailer.ack.ifExists "addIfDifferent" &&
-       git config trailer.ack.where "before" &&
+       test_config trailer.ack.ifExists "addIfDifferent" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "before" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -950,8 +1064,14 @@ test_expect_success 'using "ifExists = addIfDifferent" with "where = before"' '
 '
 
 test_expect_success 'using "ifExists = addIfDifferentNeighbor" with "where = end"' '
-       git config trailer.ack.ifExists "addIfDifferentNeighbor" &&
-       git config trailer.ack.where "end" &&
+       test_config trailer.ack.ifExists "addIfDifferentNeighbor" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "end" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -973,8 +1093,14 @@ test_expect_success 'using "ifExists = addIfDifferentNeighbor" with "where = end
 '
 
 test_expect_success 'using "ifExists = addIfDifferentNeighbor"  with "where = after"' '
-       git config trailer.ack.ifExists "addIfDifferentNeighbor" &&
-       git config trailer.ack.where "after" &&
+       test_config trailer.ack.ifExists "addIfDifferentNeighbor" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -995,7 +1121,11 @@ test_expect_success 'using "ifExists = addIfDifferentNeighbor"  with "where = af
 '
 
 test_expect_success 'using "ifExists = addIfDifferentNeighbor" and --trim-empty' '
-       git config trailer.ack.ifExists "addIfDifferentNeighbor" &&
+       test_config trailer.ack.ifExists "addIfDifferentNeighbor" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        cat >>expected <<-\EOF &&
                Bug #42
@@ -1011,8 +1141,14 @@ test_expect_success 'using "ifExists = addIfDifferentNeighbor" and --trim-empty'
 '
 
 test_expect_success 'using "ifExists = add" with "where = end"' '
-       git config trailer.ack.ifExists "add" &&
-       git config trailer.ack.where "end" &&
+       test_config trailer.ack.ifExists "add" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "end" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1036,8 +1172,14 @@ test_expect_success 'using "ifExists = add" with "where = end"' '
 '
 
 test_expect_success 'using "ifExists = add" with "where = after"' '
-       git config trailer.ack.ifExists "add" &&
-       git config trailer.ack.where "after" &&
+       test_config trailer.ack.ifExists "add" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1058,8 +1200,15 @@ test_expect_success 'using "ifExists = add" with "where = after"' '
 '
 
 test_expect_success 'overriding configuration with "--if-exists replace"' '
-       git config trailer.fix.key "Fixes: " &&
-       git config trailer.fix.ifExists "add" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "add" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.review.where "before" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1074,9 +1223,66 @@ test_expect_success 'overriding configuration with "--if-exists replace"' '
        test_cmp expected actual
 '
 
+# "trailer.ifexists" is set to "doNothing", so using "--no-if-exists" defaults
+# to this "doNothing" behavior. So the "Fixes: 53" trailer does not get added.
+test_expect_success 'using "--if-exists replace" with "--no-if-exists" defaults to configuration' '
+       test_config trailer.ifexists "doNothing" &&
+       cat complex_message_body >expected &&
+       sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+               Fixes: Z
+               Acked-by: Z
+               Reviewed-by: Z
+               Signed-off-by: Z
+       EOF
+       git interpret-trailers --if-exists replace --no-if-exists --trailer "Fixes: 53" \
+               <complex_message >actual &&
+       test_cmp expected actual
+'
+
+# No "ifexists" configuration is set, so using "--no-if-exists" makes it default
+# to addIfDifferentNeighbor. Because we do have a different neighbor "Fixes: 53"
+# (because it got added by overriding with "--if-exists replace" earlier in the
+# arguments list), we add "Signed-off-by: addme".
+test_expect_success 'using "--no-if-exists" defaults to hardcoded default if nothing configured' '
+       cat complex_message_body >expected &&
+       sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+               Acked-by: Z
+               Reviewed-by: Z
+               Signed-off-by: Z
+               Fixes: 53
+               Signed-off-by: addme
+       EOF
+       git interpret-trailers --if-exists replace --trailer "Fixes: 53" --no-if-exists \
+               --trailer "Signed-off-by: addme" <complex_message >actual &&
+       test_cmp expected actual
+'
+
+# The second "Fixes: 53" trailer is discarded, because the "--no-if-exists" here
+# makes us default to addIfDifferentNeighbor, and we already added the "Fixes:
+# 53" trailer earlier in the argument list.
+test_expect_success 'using "--no-if-exists" defaults to hardcoded default if nothing configured (no addition)' '
+       cat complex_message_body >expected &&
+       sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+               Acked-by: Z
+               Reviewed-by: Z
+               Signed-off-by: Z
+               Fixes: 53
+       EOF
+       git interpret-trailers --if-exists replace --trailer "Fixes: 53" --no-if-exists \
+               --trailer "Fixes: 53" <complex_message >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success 'using "ifExists = replace"' '
-       git config trailer.fix.key "Fixes: " &&
-       git config trailer.fix.ifExists "replace" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "replace" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1095,7 +1301,16 @@ test_expect_success 'using "ifExists = replace"' '
 '
 
 test_expect_success 'using "ifExists = replace" with "where = after"' '
-       git config trailer.fix.where "after" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "replace" &&
+       test_config trailer.fix.where "after" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1114,7 +1329,15 @@ test_expect_success 'using "ifExists = replace" with "where = after"' '
 '
 
 test_expect_success 'using "ifExists = doNothing"' '
-       git config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1133,8 +1356,17 @@ test_expect_success 'using "ifExists = doNothing"' '
 '
 
 test_expect_success 'the default is "ifMissing = add"' '
-       git config trailer.cc.key "Cc: " &&
-       git config trailer.cc.where "before" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.cc.key "Cc: " &&
+       test_config trailer.cc.where "before" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1154,7 +1386,14 @@ test_expect_success 'the default is "ifMissing = add"' '
 '
 
 test_expect_success 'overriding configuration with "--if-missing doNothing"' '
-       git config trailer.ifmissing "add" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.ifmissing "add" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -1173,7 +1412,13 @@ test_expect_success 'overriding configuration with "--if-missing doNothing"' '
 '
 
 test_expect_success 'when default "ifMissing" is "doNothing"' '
-       git config trailer.ifmissing "doNothing" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.ifmissing "doNothing" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -1187,14 +1432,21 @@ test_expect_success 'when default "ifMissing" is "doNothing"' '
                --trailer "cc=Linus" --trailer "ack: Junio" \
                --trailer "fix=22" --trailer "bug: 42" --trailer "ack: Peff" \
                <complex_message >actual &&
-       test_cmp expected actual &&
-       git config trailer.ifmissing "add"
+       test_cmp expected actual
 '
 
 test_expect_success 'using "ifMissing = add" with "where = end"' '
-       git config trailer.cc.key "Cc: " &&
-       git config trailer.cc.where "end" &&
-       git config trailer.cc.ifMissing "add" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.cc.key "Cc: " &&
+       test_config trailer.cc.ifMissing "add" &&
+       test_config trailer.cc.where "end" &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1214,9 +1466,17 @@ test_expect_success 'using "ifMissing = add" with "where = end"' '
 '
 
 test_expect_success 'using "ifMissing = add" with "where = before"' '
-       git config trailer.cc.key "Cc: " &&
-       git config trailer.cc.where "before" &&
-       git config trailer.cc.ifMissing "add" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.cc.key "Cc: " &&
+       test_config trailer.cc.ifMissing "add" &&
+       test_config trailer.cc.where "before" &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Cc: Linus
@@ -1236,7 +1496,15 @@ test_expect_success 'using "ifMissing = add" with "where = before"' '
 '
 
 test_expect_success 'using "ifMissing = doNothing"' '
-       git config trailer.cc.ifMissing "doNothing" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.cc.ifMissing "doNothing" &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1254,9 +1522,50 @@ test_expect_success 'using "ifMissing = doNothing"' '
        test_cmp expected actual
 '
 
+# Ignore the "IgnoredTrailer" because of "--if-missing doNothing", but also
+# ignore the "StillIgnoredTrailer" because we set "trailer.ifMissing" to
+# "doNothing" in configuration.
+test_expect_success 'using "--no-if-missing" defaults to configuration' '
+       test_config trailer.ifMissing "doNothing" &&
+       cat complex_message_body >expected &&
+       sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+                       Fixes: Z
+                       Acked-by: Z
+                       Reviewed-by: Z
+                       Signed-off-by: Z
+       EOF
+       git interpret-trailers --if-missing doNothing --trailer "IgnoredTrailer: ignoreme" --no-if-missing \
+                       --trailer "StillIgnoredTrailer: ignoreme" <complex_message >actual &&
+       test_cmp expected actual
+'
+
+# Add the "AddedTrailer" because the "--no-if-missing" clears the "--if-missing
+# doNothing" from earlier in the argument list.
+test_expect_success 'using "--no-if-missing" defaults to hardcoded default if nothing configured' '
+       cat complex_message_body >expected &&
+       sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+                       Fixes: Z
+                       Acked-by: Z
+                       Reviewed-by: Z
+                       Signed-off-by: Z
+                       AddedTrailer: addme
+       EOF
+       git interpret-trailers --if-missing doNothing --trailer "IgnoredTrailer: ignoreme" --no-if-missing \
+                       --trailer "AddedTrailer: addme" <complex_message >actual &&
+       test_cmp expected actual
+'
+
 test_expect_success 'default "where" is now "after"' '
        git config trailer.where "after" &&
-       git config --unset trailer.ack.where &&
+       test_config trailer.ack.ifExists "add" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.ack.where "after" &&
+       test_config trailer.bug.key "Bug #" &&
+       test_config trailer.bug.where "before" &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=#" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Bug #42
@@ -1280,10 +1589,15 @@ test_expect_success 'default "where" is now "after"' '
 '
 
 test_expect_success 'with simple command' '
-       git config trailer.sign.key "Signed-off-by: " &&
-       git config trailer.sign.where "after" &&
-       git config trailer.sign.ifExists "addIfDifferentNeighbor" &&
-       git config trailer.sign.command "echo \"A U Thor <author@example.com>\"" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.sign.command "echo \"A U Thor <author@example.com>\"" &&
+       test_config trailer.sign.key "Signed-off-by: " &&
+       test_config trailer.sign.ifExists "addIfDifferentNeighbor" &&
+       test_config trailer.sign.where "after" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -1298,8 +1612,14 @@ test_expect_success 'with simple command' '
 '
 
 test_expect_success 'with command using committer information' '
-       git config trailer.sign.ifExists "addIfDifferent" &&
-       git config trailer.sign.command "echo \"\$GIT_COMMITTER_NAME <\$GIT_COMMITTER_EMAIL>\"" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.sign.command "echo \"\$GIT_COMMITTER_NAME <\$GIT_COMMITTER_EMAIL>\"" &&
+       test_config trailer.sign.key "Signed-off-by: " &&
+       test_config trailer.sign.ifExists "addIfDifferent" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -1314,10 +1634,15 @@ test_expect_success 'with command using committer information' '
 '
 
 test_expect_success 'with command using author information' '
-       git config trailer.sign.key "Signed-off-by: " &&
-       git config trailer.sign.where "after" &&
-       git config trailer.sign.ifExists "addIfDifferentNeighbor" &&
-       git config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.fix.ifExists "doNothing" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.sign.key "Signed-off-by: " &&
+       test_config trailer.sign.ifExists "addIfDifferentNeighbor" &&
+       test_config trailer.sign.where "after" &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
                Fixes: Z
@@ -1338,12 +1663,19 @@ test_expect_success 'setup a commit' '
 '
 
 test_expect_success 'cmd takes precedence over command' '
-       test_when_finished "git config --unset trailer.fix.cmd" &&
-       git config trailer.fix.ifExists "replace" &&
-       git config trailer.fix.cmd "test -n \"\$1\" && git log -1 --oneline --format=\"%h (%aN)\" \
-       --abbrev-commit --abbrev=14 \"\$1\" || true" &&
-       git config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" \
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" \
                --abbrev-commit --abbrev=14 \$ARG" &&
+       test_config trailer.fix.cmd "test -n \"\$1\" && git log -1 --oneline --format=\"%h (%aN)\" \
+       --abbrev-commit --abbrev=14 \"\$1\" || true" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "replace" &&
+       test_config trailer.fix.where "after" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.sign.key "Signed-off-by: " &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=" &&
        FIXED=$(git log -1 --oneline --format="%h (%aN)" --abbrev-commit --abbrev=14 HEAD) &&
        cat complex_message_body >expected2 &&
        sed -e "s/ Z\$/ /" >>expected2 <<-EOF &&
@@ -1359,8 +1691,16 @@ test_expect_success 'cmd takes precedence over command' '
 '
 
 test_expect_success 'with command using $ARG' '
-       git config trailer.fix.ifExists "replace" &&
-       git config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "replace" &&
+       test_config trailer.fix.where "after" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.sign.key "Signed-off-by: " &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=" &&
        FIXED=$(git log -1 --oneline --format="%h (%s)" --abbrev-commit --abbrev=14 HEAD) &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-EOF &&
@@ -1376,8 +1716,16 @@ test_expect_success 'with command using $ARG' '
 '
 
 test_expect_success 'with failing command using $ARG' '
-       git config trailer.fix.ifExists "replace" &&
-       git config trailer.fix.command "false \$ARG" &&
+       test_config trailer.ack.key "Acked-by= " &&
+       test_config trailer.fix.command "false \$ARG" &&
+       test_config trailer.fix.key "Fixes: " &&
+       test_config trailer.fix.ifExists "replace" &&
+       test_config trailer.fix.where "after" &&
+       test_config trailer.review.key "Reviewed-by:" &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.sign.key "Signed-off-by: " &&
+       test_config trailer.ifexists "addIfDifferent" &&
+       test_config trailer.separators ":=" &&
        cat complex_message_body >expected &&
        sed -e "s/ Z\$/ /" >>expected <<-EOF &&
                Fixes: Z
@@ -1392,7 +1740,9 @@ test_expect_success 'with failing command using $ARG' '
 '
 
 test_expect_success 'with empty tokens' '
-       git config --unset trailer.fix.command &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.sign.key "Signed-off-by: " &&
+       test_config trailer.ifexists "addIfDifferent" &&
        cat >expected <<-EOF &&
 
                Signed-off-by: A U Thor <author@example.com>
@@ -1403,7 +1753,8 @@ test_expect_success 'with empty tokens' '
 '
 
 test_expect_success 'with command but no key' '
-       git config --unset trailer.sign.key &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.ifexists "addIfDifferent" &&
        cat >expected <<-EOF &&
 
                sign: A U Thor <author@example.com>
@@ -1414,7 +1765,9 @@ test_expect_success 'with command but no key' '
 '
 
 test_expect_success 'with no command and no key' '
-       git config --unset trailer.review.key &&
+       test_config trailer.review.where "before" &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
+       test_config trailer.ifexists "addIfDifferent" &&
        cat >expected <<-EOF &&
 
                review: Junio
@@ -1426,6 +1779,8 @@ test_expect_success 'with no command and no key' '
 '
 
 test_expect_success 'with cut line' '
+       test_config trailer.review.where "before" &&
+       test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" &&
        cat >expected <<-\EOF &&
                my subject
 
@@ -1443,7 +1798,8 @@ test_expect_success 'with cut line' '
 '
 
 test_expect_success 'only trailers' '
-       git config trailer.sign.command "echo config-value" &&
+       test_config trailer.sign.command "echo config-value" &&
+       test_config trailer.ifexists "addIfDifferent" &&
        cat >expected <<-\EOF &&
                existing: existing-value
                sign: config-value
@@ -1462,7 +1818,7 @@ test_expect_success 'only trailers' '
 '
 
 test_expect_success 'only-trailers omits non-trailer in middle of block' '
-       git config trailer.sign.command "echo config-value" &&
+       test_config trailer.sign.command "echo config-value" &&
        cat >expected <<-\EOF &&
                Signed-off-by: nobody <nobody@nowhere>
                Signed-off-by: somebody <somebody@somewhere>
@@ -1482,7 +1838,7 @@ test_expect_success 'only-trailers omits non-trailer in middle of block' '
 '
 
 test_expect_success 'only input' '
-       git config trailer.sign.command "echo config-value" &&
+       test_config trailer.sign.command "echo config-value" &&
        cat >expected <<-\EOF &&
                existing: existing-value
        EOF
@@ -1560,4 +1916,37 @@ test_expect_success 'suppress --- handling' '
        test_cmp expected actual
 '
 
+test_expect_success 'suppressing --- does not disable cut-line handling' '
+       echo "real-trailer: before the cut" >expected &&
+
+       git interpret-trailers --parse --no-divider >actual <<-\EOF &&
+       subject
+
+       This input has a cut-line in it; we should stop parsing when we see it
+       and consider only trailers before that line.
+
+       real-trailer: before the cut
+
+       # ------------------------ >8 ------------------------
+       # Nothing below this line counts as part of the commit message.
+       not-a-trailer: too late
+       EOF
+
+       test_cmp expected actual
+'
+
+test_expect_success 'handling of --- lines in conjunction with cut-lines' '
+       echo "my-trailer: here" >expected &&
+
+       git interpret-trailers --parse >actual <<-\EOF &&
+       subject
+
+       my-trailer: here
+       ---
+       # ------------------------ >8 ------------------------
+       EOF
+
+       test_cmp expected actual
+'
+
 test_done
index 998a2103c7440f00788ec4c0ef607f8c48781660..b4de10a5ddac0a2a890adaeb559f1b2afea15bb3 100755 (executable)
@@ -3,12 +3,6 @@
 test_description='hunk edit with "commit -p -m"'
 . ./test-lib.sh
 
-if ! test_have_prereq PERL
-then
-       skip_all="skipping '$test_description' tests, perl not available"
-       test_done
-fi
-
 test_expect_success 'setup (initial)' '
        echo line1 >file &&
        git add file &&
index 2d38a16480e82c0441075e0e54ffe8454b413cb2..bb95f09810b704b552352d90b6ec2a046c7d0fc1 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='git commit races'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'race to create orphan commit' '
index 9ab2ae2f3b23807b4ee1eb3fcfaf62d9c1fe7bc3..b37de0af49ff400e89b86271dd9b63b894dad56e 100755 (executable)
@@ -15,7 +15,7 @@ test_expect_success 'empty name and missing email' '
                sane_unset GIT_AUTHOR_EMAIL &&
                GIT_AUTHOR_NAME= &&
                test_must_fail git commit --allow-empty -m foo 2>err &&
-               test_i18ngrep ! "(null)" err
+               test_grep ! "(null)" err
        )
 '
 
@@ -40,8 +40,8 @@ test_expect_success 'empty configured name does not auto-detect' '
                sane_unset GIT_AUTHOR_NAME &&
                test_must_fail \
                        git -c user.name= commit --allow-empty -m foo 2>err &&
-               test_i18ngrep "empty ident name" err &&
-               test_i18ngrep "Author identity unknown" err
+               test_grep "empty ident name" err &&
+               test_grep "Author identity unknown" err
        )
 '
 
@@ -50,8 +50,8 @@ test_expect_success 'empty configured name does not auto-detect for committer' '
                sane_unset GIT_COMMITTER_NAME &&
                test_must_fail \
                        git -c user.name= commit --allow-empty -m foo 2>err &&
-               test_i18ngrep "empty ident name" err &&
-               test_i18ngrep "Committer identity unknown" err
+               test_grep "empty ident name" err &&
+               test_grep "Committer identity unknown" err
        )
 '
 
index 8348e3ae7db70d9c6a65606c3b400c485a3a8719..7ee69ecdd4aa2c15dbde3ba0a976d986bff17fb3 100755 (executable)
@@ -322,14 +322,14 @@ do
                        rm -f marker &&
                        git status >actual &&
                        test_path_is_file marker &&
-                       test_i18ngrep ! "Changes not staged for commit:" actual &&
+                       test_grep ! "Changes not staged for commit:" actual &&
                        if test $uc_val = true
                        then
-                               test_i18ngrep ! "Untracked files:" actual
+                               test_grep ! "Untracked files:" actual
                        fi &&
                        if test $uc_val = false
                        then
-                               test_i18ngrep "Untracked files:" actual
+                               test_grep "Untracked files:" actual
                        fi &&
                        rm -f marker
                '
index 184b2589893b78ef1e77521a6a9e7f0e5b514de9..3b63c34a309de5e13a0c52c365d02289c6aa87f3 100755 (executable)
@@ -13,27 +13,27 @@ test_expect_success setup '
 
 test_expect_success 'no warning if hook is not ignored' '
        git commit --allow-empty -m "more" 2>message &&
-       test_i18ngrep ! -e "hook was ignored" message
+       test_grep ! -e "hook was ignored" message
 '
 
 test_expect_success POSIXPERM 'warning if hook is ignored' '
        test_hook --disable pre-commit &&
        git commit --allow-empty -m "even more" 2>message &&
-       test_i18ngrep -e "hook was ignored" message
+       test_grep -e "hook was ignored" message
 '
 
 test_expect_success POSIXPERM 'no warning if advice.ignoredHook set to false' '
        test_config advice.ignoredHook false &&
        test_hook --disable pre-commit &&
        git commit --allow-empty -m "even more" 2>message &&
-       test_i18ngrep ! -e "hook was ignored" message
+       test_grep ! -e "hook was ignored" message
 '
 
 test_expect_success 'no warning if unset advice.ignoredHook and hook removed' '
        test_hook --remove pre-commit &&
        test_unconfig advice.ignoredHook &&
        git commit --allow-empty -m "even more" 2>message &&
-       test_i18ngrep ! -e "hook was ignored" message
+       test_grep ! -e "hook was ignored" message
 '
 
 test_done
index 22bf5c7e5dc108fabfc165e948733d6221855785..a9210d3a3a92213728a32599defe664e1def0ffe 100755 (executable)
@@ -21,81 +21,81 @@ test_expect_success 'setup' '
 
 test_expect_success 'status no-options' '
        git status >actual &&
-       test_i18ngrep "renamed:" actual
+       test_grep "renamed:" actual
 '
 
 test_expect_success 'status --no-renames' '
        git status --no-renames >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual
 '
 
 test_expect_success 'status.renames inherits from diff.renames false' '
        git -c diff.renames=false status >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual
 '
 
 test_expect_success 'status.renames inherits from diff.renames true' '
        git -c diff.renames=true status >actual &&
-       test_i18ngrep "renamed:" actual
+       test_grep "renamed:" actual
 '
 
 test_expect_success 'status.renames overrides diff.renames false' '
        git -c diff.renames=true -c status.renames=false status >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual
 '
 
 test_expect_success 'status.renames overrides from diff.renames true' '
        git -c diff.renames=false -c status.renames=true status >actual &&
-       test_i18ngrep "renamed:" actual
+       test_grep "renamed:" actual
 '
 
 test_expect_success 'status status.renames=false' '
        git -c status.renames=false status >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual
 '
 
 test_expect_success 'status status.renames=true' '
        git -c status.renames=true status >actual &&
-       test_i18ngrep "renamed:" actual
+       test_grep "renamed:" actual
 '
 
 test_expect_success 'commit honors status.renames=false' '
        git -c status.renames=false commit --dry-run >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual
 '
 
 test_expect_success 'commit honors status.renames=true' '
        git -c status.renames=true commit --dry-run >actual &&
-       test_i18ngrep "renamed:" actual
+       test_grep "renamed:" actual
 '
 
 test_expect_success 'status config overridden' '
        git -c status.renames=true status --no-renames >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual
 '
 
 test_expect_success 'status score=100%' '
        git status -M=100% >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual &&
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual &&
 
        git status --find-renames=100% >actual &&
-       test_i18ngrep "deleted:" actual &&
-       test_i18ngrep "new file:" actual
+       test_grep "deleted:" actual &&
+       test_grep "new file:" actual
 '
 
 test_expect_success 'status score=01%' '
        git status -M=01% >actual &&
-       test_i18ngrep "renamed:" actual &&
+       test_grep "renamed:" actual &&
 
        git status --find-renames=01% >actual &&
-       test_i18ngrep "renamed:" actual
+       test_grep "renamed:" actual
 '
 
 test_expect_success 'copies not overridden by find-renames' '
@@ -103,12 +103,12 @@ test_expect_success 'copies not overridden by find-renames' '
        git add copy &&
 
        git -c status.renames=copies status -M=01% >actual &&
-       test_i18ngrep "copied:" actual &&
-       test_i18ngrep "renamed:" actual &&
+       test_grep "copied:" actual &&
+       test_grep "renamed:" actual &&
 
        git -c status.renames=copies status --find-renames=01% >actual &&
-       test_i18ngrep "copied:" actual &&
-       test_i18ngrep "renamed:" actual
+       test_grep "copied:" actual &&
+       test_grep "renamed:" actual
 '
 
 test_done
index ad011bb9f158034171c04e76722b183eece45576..c97c550021e837a6fd6e59f260352673d92e85da 100755 (executable)
@@ -141,25 +141,25 @@ test_expect_success 'error conditions' '
        >empty_list &&
 
        test_must_fail git commit --pathspec-from-file=list --interactive -m "Commit" 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
 
        test_must_fail git commit --pathspec-from-file=list --patch -m "Commit" 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err &&
 
        test_must_fail git commit --pathspec-from-file=list --all -m "Commit" 2>err &&
-       test_i18ngrep -e "options .--pathspec-from-file. and .-a. cannot be used together" err &&
+       test_grep -e "options .--pathspec-from-file. and .-a. cannot be used together" err &&
 
        test_must_fail git commit --pathspec-from-file=list -m "Commit" -- fileA.t 2>err &&
-       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
+       test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err &&
-       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
+       test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        test_must_fail git commit --pathspec-from-file=empty_list --include -m "Commit" 2>err &&
-       test_i18ngrep -e "No paths with --include/--only does not make sense." err &&
+       test_grep -e "No paths with --include/--only does not make sense." err &&
 
        test_must_fail git commit --pathspec-from-file=empty_list --only -m "Commit" 2>err &&
-       test_i18ngrep -e "No paths with --include/--only does not make sense." err
+       test_grep -e "No paths with --include/--only does not make sense." err
 '
 
 test_done
index 0c241d6c148d7b5ebc9a9b3aaf44723fb1028e8b..730f3c7f81090e9d08d02b1ca0e370b05b3dd746 100755 (executable)
@@ -809,6 +809,11 @@ my_match_and_clean () {
                status --porcelain=v2 >actual.without &&
        test_cmp actual.with actual.without &&
 
+       git -C super --no-optional-locks diff-index --name-status HEAD >actual.with &&
+       git -C super --no-optional-locks -c core.fsmonitor=false \
+               diff-index --name-status HEAD >actual.without &&
+       test_cmp actual.with actual.without &&
+
        git -C super/dir_1/dir_2/sub reset --hard &&
        git -C super/dir_1/dir_2/sub clean -d -f
 }
@@ -973,7 +978,7 @@ test_expect_success !UNICODE_COMPOSITION_SENSITIVE 'Unicode nfc/nfd' '
        mkdir test_unicode/nfd &&
        mkdir test_unicode/nfd/d_${utf8_nfd} &&
 
-       git -C test_unicode fsmonitor--daemon stop &&
+       test-tool -C test_unicode fsmonitor-client query --token 0 &&
 
        if test_have_prereq UNICODE_NFC_PRESERVED
        then
@@ -1032,4 +1037,227 @@ test_expect_success 'split-index and FSMonitor work well together' '
        )
 '
 
+# The FSMonitor daemon reports the OBSERVED pathname of modified files
+# and thus contains the OBSERVED spelling on case-insensitive file
+# systems.  The daemon does not (and should not) load the .git/index
+# file and therefore does not know the expected case-spelling.  Since
+# it is possible for the user to create files/subdirectories with the
+# incorrect case, a modified file event for a tracked will not have
+# the EXPECTED case. This can cause `index_name_pos()` to incorrectly
+# report that the file is untracked. This causes the client to fail to
+# mark the file as possibly dirty (keeping the CE_FSMONITOR_VALID bit
+# set) so that `git status` will avoid inspecting it and thus not
+# present in the status output.
+#
+# The setup is a little contrived.
+#
+test_expect_success CASE_INSENSITIVE_FS 'fsmonitor subdir case wrong on disk' '
+       test_when_finished "stop_daemon_delete_repo subdir_case_wrong" &&
+
+       git init subdir_case_wrong &&
+       (
+               cd subdir_case_wrong &&
+               echo x >AAA &&
+               echo x >BBB &&
+
+               mkdir dir1 &&
+               echo x >dir1/file1 &&
+               mkdir dir1/dir2 &&
+               echo x >dir1/dir2/file2 &&
+               mkdir dir1/dir2/dir3 &&
+               echo x >dir1/dir2/dir3/file3 &&
+
+               echo x >yyy &&
+               echo x >zzz &&
+               git add . &&
+               git commit -m "data" &&
+
+               # This will cause "dir1/" and everything under it
+               # to be deleted.
+               git sparse-checkout set --cone --sparse-index &&
+
+               # Create dir2 with the wrong case and then let Git
+               # repopulate dir3 -- it will not correct the spelling
+               # of dir2.
+               mkdir dir1 &&
+               mkdir dir1/DIR2 &&
+               git sparse-checkout add dir1/dir2/dir3
+       ) &&
+
+       start_daemon -C subdir_case_wrong --tf "$PWD/subdir_case_wrong.trace" &&
+
+       # Enable FSMonitor in the client. Run enough commands for
+       # the .git/index to sync up with the daemon with everything
+       # marked clean.
+       git -C subdir_case_wrong config core.fsmonitor true &&
+       git -C subdir_case_wrong update-index --fsmonitor &&
+       git -C subdir_case_wrong status &&
+
+       # Make some files dirty so that FSMonitor gets FSEvents for
+       # each of them.
+       echo xx >>subdir_case_wrong/AAA &&
+       echo xx >>subdir_case_wrong/dir1/DIR2/dir3/file3 &&
+       echo xx >>subdir_case_wrong/zzz &&
+
+       GIT_TRACE_FSMONITOR="$PWD/subdir_case_wrong.log" \
+               git -C subdir_case_wrong --no-optional-locks status --short \
+                       >"$PWD/subdir_case_wrong.out" &&
+
+       # "git status" should have gotten file events for each of
+       # the 3 files.
+       #
+       # "dir2" should be in the observed case on disk.
+       grep "fsmonitor_refresh_callback" \
+               <"$PWD/subdir_case_wrong.log" \
+               >"$PWD/subdir_case_wrong.log1" &&
+
+       grep -q "AAA.*pos 0" "$PWD/subdir_case_wrong.log1" &&
+       grep -q "zzz.*pos 6" "$PWD/subdir_case_wrong.log1" &&
+
+       grep -q "dir1/DIR2/dir3/file3.*pos -3" "$PWD/subdir_case_wrong.log1" &&
+
+       # Verify that we get a mapping event to correct the case.
+       grep -q "MAP:.*dir1/DIR2/dir3/file3.*dir1/dir2/dir3/file3" \
+               "$PWD/subdir_case_wrong.log1" &&
+
+       # The refresh-callbacks should have caused "git status" to clear
+       # the CE_FSMONITOR_VALID bit on each of those files and caused
+       # the worktree scan to visit them and mark them as modified.
+       grep -q " M AAA" "$PWD/subdir_case_wrong.out" &&
+       grep -q " M zzz" "$PWD/subdir_case_wrong.out" &&
+       grep -q " M dir1/dir2/dir3/file3" "$PWD/subdir_case_wrong.out"
+'
+
+test_expect_success CASE_INSENSITIVE_FS 'fsmonitor file case wrong on disk' '
+       test_when_finished "stop_daemon_delete_repo file_case_wrong" &&
+
+       git init file_case_wrong &&
+       (
+               cd file_case_wrong &&
+               echo x >AAA &&
+               echo x >BBB &&
+
+               mkdir dir1 &&
+               mkdir dir1/dir2 &&
+               mkdir dir1/dir2/dir3 &&
+               echo x >dir1/dir2/dir3/FILE-3-B &&
+               echo x >dir1/dir2/dir3/XXXX-3-X &&
+               echo x >dir1/dir2/dir3/file-3-a &&
+               echo x >dir1/dir2/dir3/yyyy-3-y &&
+               mkdir dir1/dir2/dir4 &&
+               echo x >dir1/dir2/dir4/FILE-4-A &&
+               echo x >dir1/dir2/dir4/XXXX-4-X &&
+               echo x >dir1/dir2/dir4/file-4-b &&
+               echo x >dir1/dir2/dir4/yyyy-4-y &&
+
+               echo x >yyy &&
+               echo x >zzz &&
+               git add . &&
+               git commit -m "data"
+       ) &&
+
+       start_daemon -C file_case_wrong --tf "$PWD/file_case_wrong.trace" &&
+
+       # Enable FSMonitor in the client. Run enough commands for
+       # the .git/index to sync up with the daemon with everything
+       # marked clean.
+       git -C file_case_wrong config core.fsmonitor true &&
+       git -C file_case_wrong update-index --fsmonitor &&
+       git -C file_case_wrong status &&
+
+       # Make some files dirty so that FSMonitor gets FSEvents for
+       # each of them.
+       echo xx >>file_case_wrong/AAA &&
+       echo xx >>file_case_wrong/zzz &&
+
+       # Rename some files so that FSMonitor sees a create and delete
+       # FSEvent for each.  (A simple "mv foo FOO" is not portable
+       # between macOS and Windows. It works on both platforms, but makes
+       # the test messy, since (1) one platform updates "ctime" on the
+       # moved file and one does not and (2) it causes a directory event
+       # on one platform and not on the other which causes additional
+       # scanning during "git status" which causes a "H" vs "h" discrepancy
+       # in "git ls-files -f".)  So old-school it and move it out of the
+       # way and copy it to the case-incorrect name so that we get fresh
+       # "ctime" and "mtime" values.
+
+       mv file_case_wrong/dir1/dir2/dir3/file-3-a file_case_wrong/dir1/dir2/dir3/ORIG &&
+       cp file_case_wrong/dir1/dir2/dir3/ORIG     file_case_wrong/dir1/dir2/dir3/FILE-3-A &&
+       rm file_case_wrong/dir1/dir2/dir3/ORIG &&
+       mv file_case_wrong/dir1/dir2/dir4/FILE-4-A file_case_wrong/dir1/dir2/dir4/ORIG &&
+       cp file_case_wrong/dir1/dir2/dir4/ORIG     file_case_wrong/dir1/dir2/dir4/file-4-a &&
+       rm file_case_wrong/dir1/dir2/dir4/ORIG &&
+
+       # Run status enough times to fully sync.
+       #
+       # The first instance should get the create and delete FSEvents
+       # for each pair.  Status should update the index with a new FSM
+       # token (so the next invocation will not see data for these
+       # events).
+
+       GIT_TRACE_FSMONITOR="$PWD/file_case_wrong-try1.log" \
+               git -C file_case_wrong status --short \
+                       >"$PWD/file_case_wrong-try1.out" &&
+       grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos -3" "$PWD/file_case_wrong-try1.log" &&
+       grep -q "fsmonitor_refresh_callback.*file-3-a.*pos 4"  "$PWD/file_case_wrong-try1.log" &&
+       grep -q "fsmonitor_refresh_callback.*FILE-4-A.*pos 6"  "$PWD/file_case_wrong-try1.log" &&
+       grep -q "fsmonitor_refresh_callback.*file-4-a.*pos -9" "$PWD/file_case_wrong-try1.log" &&
+
+       # FSM refresh will have invalidated the FSM bit and cause a regular
+       # (real) scan of these tracked files, so they should have "H" status.
+       # (We will not see a "h" status until the next refresh (on the next
+       # command).)
+
+       git -C file_case_wrong ls-files -f >"$PWD/file_case_wrong-lsf1.out" &&
+       grep -q "H dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-lsf1.out" &&
+       grep -q "H dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-lsf1.out" &&
+
+
+       # Try the status again. We assume that the above status command
+       # advanced the token so that the next one will not see those events.
+
+       GIT_TRACE_FSMONITOR="$PWD/file_case_wrong-try2.log" \
+               git -C file_case_wrong status --short \
+                       >"$PWD/file_case_wrong-try2.out" &&
+       ! grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos" "$PWD/file_case_wrong-try2.log" &&
+       ! grep -q "fsmonitor_refresh_callback.*file-3-a.*pos" "$PWD/file_case_wrong-try2.log" &&
+       ! grep -q "fsmonitor_refresh_callback.*FILE-4-A.*pos" "$PWD/file_case_wrong-try2.log" &&
+       ! grep -q "fsmonitor_refresh_callback.*file-4-a.*pos" "$PWD/file_case_wrong-try2.log" &&
+
+       # FSM refresh saw nothing, so it will mark all files as valid,
+       # so they should now have "h" status.
+
+       git -C file_case_wrong ls-files -f >"$PWD/file_case_wrong-lsf2.out" &&
+       grep -q "h dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-lsf2.out" &&
+       grep -q "h dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-lsf2.out" &&
+
+
+       # We now have files with clean content, but with case-incorrect
+       # file names.  Modify them to see if status properly reports
+       # them.
+
+       echo xx >>file_case_wrong/dir1/dir2/dir3/FILE-3-A &&
+       echo xx >>file_case_wrong/dir1/dir2/dir4/file-4-a &&
+
+       GIT_TRACE_FSMONITOR="$PWD/file_case_wrong-try3.log" \
+               git -C file_case_wrong --no-optional-locks status --short \
+                       >"$PWD/file_case_wrong-try3.out" &&
+
+       # Verify that we get a mapping event to correct the case.
+       grep -q "fsmonitor_refresh_callback MAP:.*dir1/dir2/dir3/FILE-3-A.*dir1/dir2/dir3/file-3-a" \
+               "$PWD/file_case_wrong-try3.log" &&
+       grep -q "fsmonitor_refresh_callback MAP:.*dir1/dir2/dir4/file-4-a.*dir1/dir2/dir4/FILE-4-A" \
+               "$PWD/file_case_wrong-try3.log" &&
+
+       # FSEvents are in observed case.
+       grep -q "fsmonitor_refresh_callback.*FILE-3-A.*pos -3" "$PWD/file_case_wrong-try3.log" &&
+       grep -q "fsmonitor_refresh_callback.*file-4-a.*pos -9" "$PWD/file_case_wrong-try3.log" &&
+
+       # The refresh-callbacks should have caused "git status" to clear
+       # the CE_FSMONITOR_VALID bit on each of those files and caused
+       # the worktree scan to visit them and mark them as modified.
+       grep -q " M dir1/dir2/dir3/file-3-a" "$PWD/file_case_wrong-try3.out" &&
+       grep -q " M dir1/dir2/dir4/FILE-4-A" "$PWD/file_case_wrong-try3.out"
+'
+
 test_done
index fdc607277c2fca64a573959b2f3ea7f35a8beaae..e5ff073099a983d0da7205d3a3325af28caf8a9b 100755 (executable)
@@ -175,7 +175,7 @@ test_expect_success 'merge -h with invalid index' '
                >.git/index &&
                test_expect_code 129 git merge -h 2>usage
        ) &&
-       test_i18ngrep "[Uu]sage: git merge" broken/usage
+       test_grep "[Uu]sage: git merge" broken/usage
 '
 
 test_expect_success 'reject non-strategy with a git-merge-foo name' '
@@ -681,7 +681,7 @@ test_debug 'git log --graph --decorate --oneline --all'
 test_expect_success 'in-index merge' '
        git reset --hard c0 &&
        git merge --no-ff -s resolve c1 >out &&
-       test_i18ngrep "Wonderful." out &&
+       test_grep "Wonderful." out &&
        verify_parents $c0 $c1
 '
 
@@ -697,7 +697,7 @@ test_expect_success 'merge with --autostash' '
        git reset --hard c1 &&
        git merge-file file file.orig file.9 &&
        git merge --autostash c2 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        git show HEAD:file >merge-result &&
        test_cmp result.1-5 merge-result &&
        test_cmp result.1-5-9 file
@@ -708,7 +708,7 @@ test_expect_success 'merge with merge.autoStash' '
        git reset --hard c1 &&
        git merge-file file file.orig file.9 &&
        git merge c2 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        git show HEAD:file >merge-result &&
        test_cmp result.1-5 merge-result &&
        test_cmp result.1-5-9 file
@@ -718,7 +718,7 @@ test_expect_success 'fast-forward merge with --autostash' '
        git reset --hard c0 &&
        git merge-file file file.orig file.5 &&
        git merge --autostash c1 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        test_cmp result.1-5 file
 '
 
@@ -728,7 +728,7 @@ test_expect_success 'failed fast-forward merge with --autostash' '
        cp file.5 other &&
        test_when_finished "rm other" &&
        test_must_fail git merge --autostash c1 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        test_cmp file.5 file
 '
 
@@ -736,7 +736,7 @@ test_expect_success 'octopus merge with --autostash' '
        git reset --hard c1 &&
        git merge-file file file.orig file.3 &&
        git merge --autostash c2 c3 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        git show HEAD:file >merge-result &&
        test_cmp result.1-5-9 merge-result &&
        test_cmp result.1-3-5-9 file
@@ -746,7 +746,7 @@ test_expect_success 'failed merge (exit 2) with --autostash' '
        git reset --hard c1 &&
        git merge-file file file.orig file.5 &&
        test_must_fail git merge -s recursive --autostash c2 c3 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        test_cmp result.1-5 file
 '
 
@@ -755,7 +755,7 @@ test_expect_success 'conflicted merge with --autostash, --abort restores stash'
        cp file.1 file &&
        test_must_fail git merge --autostash c7 &&
        git merge --abort 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        test_cmp file.1 file
 '
 
@@ -767,7 +767,7 @@ test_expect_success 'completed merge (git commit) with --no-commit and --autosta
        git stash show -p MERGE_AUTOSTASH >actual &&
        test_cmp expect actual &&
        git commit 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        git show HEAD:file >merge-result &&
        test_cmp result.1-5 merge-result &&
        test_cmp result.1-5-9 file
@@ -781,7 +781,7 @@ test_expect_success 'completed merge (git merge --continue) with --no-commit and
        git stash show -p MERGE_AUTOSTASH >actual &&
        test_cmp expect actual &&
        git merge --continue 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        git show HEAD:file >merge-result &&
        test_cmp result.1-5 merge-result &&
        test_cmp result.1-5-9 file
@@ -795,7 +795,7 @@ test_expect_success 'aborted merge (merge --abort) with --no-commit and --autost
        git stash show -p MERGE_AUTOSTASH >actual &&
        test_cmp expect actual &&
        git merge --abort 2>err &&
-       test_i18ngrep "Applied autostash." err &&
+       test_grep "Applied autostash." err &&
        git diff >actual &&
        test_cmp expect actual
 '
@@ -808,7 +808,7 @@ test_expect_success 'aborted merge (reset --hard) with --no-commit and --autosta
        git stash show -p MERGE_AUTOSTASH >actual &&
        test_cmp expect actual &&
        git reset --hard 2>err &&
-       test_i18ngrep "Autostash exists; creating a new stash entry." err &&
+       test_grep "Autostash exists; creating a new stash entry." err &&
        git diff --exit-code
 '
 
@@ -821,7 +821,7 @@ test_expect_success 'quit merge with --no-commit and --autostash' '
        test_cmp expect actual &&
        git diff HEAD >expect &&
        git merge --quit 2>err &&
-       test_i18ngrep "Autostash exists; creating a new stash entry." err &&
+       test_grep "Autostash exists; creating a new stash entry." err &&
        git diff HEAD >actual &&
        test_cmp expect actual
 '
@@ -832,7 +832,7 @@ test_expect_success 'merge with conflicted --autostash changes' '
        git diff >expect &&
        test_when_finished "test_might_fail git stash drop" &&
        git merge --autostash c3 2>err &&
-       test_i18ngrep "Applying autostash resulted in conflicts." err &&
+       test_grep "Applying autostash resulted in conflicts." err &&
        git show HEAD:file >merge-result &&
        test_cmp result.1-9 merge-result &&
        git stash show -p >actual &&
index bd238d89b0cb07ed6a92707dcfd80ac277b75524..a94387a75f2f488ba6b48ddf4658822d08fc7908 100755 (executable)
@@ -30,117 +30,117 @@ test_expect_success 'setup' '
 test_expect_success 'pull.rebase not set, ff possible' '
        git reset --hard c0 &&
        git pull . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and pull.ff=true' '
        git reset --hard c0 &&
        test_config pull.ff true &&
        git pull . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and pull.ff=false' '
        git reset --hard c0 &&
        test_config pull.ff false &&
        git pull . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and pull.ff=only' '
        git reset --hard c0 &&
        test_config pull.ff only &&
        git pull . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --rebase given' '
        git reset --hard c0 &&
        git pull --rebase . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --no-rebase given' '
        git reset --hard c0 &&
        git pull --no-rebase . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --ff given' '
        git reset --hard c0 &&
        git pull --ff . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --no-ff given' '
        git reset --hard c0 &&
        git pull --no-ff . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --ff-only given' '
        git reset --hard c0 &&
        git pull --ff-only . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set (not-fast-forward)' '
        git reset --hard c2 &&
        test_must_fail git -c color.advice=always pull . c1 2>err &&
        test_decode_color <err >decoded &&
-       test_i18ngrep "<YELLOW>hint: " decoded &&
-       test_i18ngrep "You have divergent branches" decoded
+       test_grep "<YELLOW>hint: " decoded &&
+       test_grep "You have divergent branches" decoded
 '
 
 test_expect_success 'pull.rebase not set and pull.ff=true (not-fast-forward)' '
        git reset --hard c2 &&
        test_config pull.ff true &&
        git pull . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and pull.ff=false (not-fast-forward)' '
        git reset --hard c2 &&
        test_config pull.ff false &&
        git pull . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and pull.ff=only (not-fast-forward)' '
        git reset --hard c2 &&
        test_config pull.ff only &&
        test_must_fail git pull . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --rebase given (not-fast-forward)' '
        git reset --hard c2 &&
        git pull --rebase . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --no-rebase given (not-fast-forward)' '
        git reset --hard c2 &&
        git pull --no-rebase . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --ff given (not-fast-forward)' '
        git reset --hard c2 &&
        git pull --ff . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --no-ff given (not-fast-forward)' '
        git reset --hard c2 &&
        git pull --no-ff . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_expect_success 'pull.rebase not set and --ff-only given (not-fast-forward)' '
        git reset --hard c2 &&
        test_must_fail git pull --ff-only . c1 2>err &&
-       test_i18ngrep ! "You have divergent branches" err
+       test_grep ! "You have divergent branches" err
 '
 
 test_does_rebase () {
@@ -202,7 +202,7 @@ test_falls_back_to_full_merge () {
 test_attempts_fast_forward () {
        git reset --hard c2 &&
        test_must_fail git "$@" . c1 2>err &&
-       test_i18ngrep "Not possible to fast-forward, aborting" err
+       test_grep "Not possible to fast-forward, aborting" err
 }
 
 #
@@ -328,34 +328,34 @@ test_expect_success 'pull.rebase=false and --ff, ff not possible' '
 test_expect_success 'Multiple heads warns about inability to fast forward' '
        git reset --hard c1 &&
        test_must_fail git pull . c2 c3 2>err &&
-       test_i18ngrep "You have divergent branches" err
+       test_grep "You have divergent branches" err
 '
 
 test_expect_success 'Multiple can never be fast forwarded' '
        git reset --hard c0 &&
        test_must_fail git -c pull.ff=only pull . c1 c2 c3 2>err &&
-       test_i18ngrep ! "You have divergent branches" err &&
+       test_grep ! "You have divergent branches" err &&
        # In addition to calling out "cannot fast-forward", we very much
        # want the "multiple branches" piece to be called out to users.
-       test_i18ngrep "Cannot fast-forward to multiple branches" err
+       test_grep "Cannot fast-forward to multiple branches" err
 '
 
 test_expect_success 'Cannot rebase with multiple heads' '
        git reset --hard c0 &&
        test_must_fail git -c pull.rebase=true pull . c1 c2 c3 2>err &&
-       test_i18ngrep ! "You have divergent branches" err &&
-       test_i18ngrep "Cannot rebase onto multiple branches." err
+       test_grep ! "You have divergent branches" err &&
+       test_grep "Cannot rebase onto multiple branches." err
 '
 
 test_expect_success 'merge c1 with c2' '
        git reset --hard c1 &&
-       test -f c0.c &&
-       test -f c1.c &&
-       test ! -f c2.c &&
-       test ! -f c3.c &&
+       test_path_is_file c0.c &&
+       test_path_is_file c1.c &&
+       test_path_is_missing c2.c &&
+       test_path_is_missing c3.c &&
        git merge c2 &&
-       test -f c1.c &&
-       test -f c2.c
+       test_path_is_file c1.c &&
+       test_path_is_file c2.c
 '
 
 test_expect_success 'fast-forward pull succeeds with "true" in pull.ff' '
@@ -411,8 +411,8 @@ test_expect_success 'merge c1 with c2 (ours in pull.twohead)' '
        git reset --hard c1 &&
        git config pull.twohead ours &&
        git merge c2 &&
-       test -f c1.c &&
-       ! test -f c2.c
+       test_path_is_file c1.c &&
+       test_path_is_missing c2.c
 '
 
 test_expect_success 'merge c1 with c2 and c3 (recursive in pull.octopus)' '
@@ -431,10 +431,10 @@ test_expect_success 'merge c1 with c2 and c3 (recursive and octopus in pull.octo
        test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
        test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
        git diff --exit-code &&
-       test -f c0.c &&
-       test -f c1.c &&
-       test -f c2.c &&
-       test -f c3.c
+       test_path_is_file c0.c &&
+       test_path_is_file c1.c &&
+       test_path_is_file c2.c &&
+       test_path_is_file c3.c
 '
 
 conflict_count()
index ff085b086cc38f36a180e22ab02bbea12a29cc0c..3669d33bd5a15fc19fbfd2cbea14507c8e273642 100755 (executable)
@@ -4,6 +4,7 @@ test_description='git merge
 
 Testing octopus merge with more than 25 refs.'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 4887ca705b330e8cbf6f25595cbcadfdfd67f9f2..0e85b21ec82cc64e7d1e519c269a9bdcb189e01b 100755 (executable)
@@ -4,6 +4,7 @@ test_description='git merge
 
 Testing octopus merge when reducing parents to independent branches.'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 # 0 - 1
index 89a62ac53b3d6012d13b3b1ce0dfa97d494060f2..9001674f2ea2201836613e4909d9442062f609f4 100755 (executable)
@@ -4,6 +4,7 @@ test_description="Test that merge state is as expected after failed merge"
 
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'Ensure we restore original state if no merge strategy handles it' '
index 0b908ab2e7128052a0513e740b54ba308b9feadc..2179938c437e47552eccb7af85fa3e4669ccc1bf 100755 (executable)
@@ -4,6 +4,7 @@ test_description='test auto-generated merge messages'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 check_oneline() {
index c0e9425115f8041d615e454018150cd300eb47d3..d6975ca48df3d4710940a4b5a040c0598b0d0628 100755 (executable)
@@ -50,7 +50,7 @@ pre_merge_head="$(git rev-parse HEAD)"
 
 test_expect_success 'fails without MERGE_HEAD (unstarted merge)' '
        test_must_fail git merge --abort 2>output &&
-       test_i18ngrep MERGE_HEAD output
+       test_grep MERGE_HEAD output
 '
 
 test_expect_success 'fails without MERGE_HEAD (unstarted merge): .git/MERGE_HEAD sanity' '
@@ -64,7 +64,7 @@ test_expect_success 'fails without MERGE_HEAD (completed merge)' '
        # Merge successfully completed
        post_merge_head="$(git rev-parse HEAD)" &&
        test_must_fail git merge --abort 2>output &&
-       test_i18ngrep MERGE_HEAD output
+       test_grep MERGE_HEAD output
 '
 
 test_expect_success 'fails without MERGE_HEAD (completed merge): .git/MERGE_HEAD sanity' '
index f5c90cc22a1bba33368634c3679d2ea26cbc36bf..84ddb568517cee76f519f6faaac3e3a89e3e68ad 100755 (executable)
@@ -41,54 +41,54 @@ test_expect_success GPG 'create signed commits' '
 test_expect_success GPG 'merge unsigned commit with verification' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_must_fail git merge --ff-only --verify-signatures side-unsigned 2>mergeerror &&
-       test_i18ngrep "does not have a GPG signature" mergeerror
+       test_grep "does not have a GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge unsigned commit with merge.verifySignatures=true' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config merge.verifySignatures true &&
        test_must_fail git merge --ff-only side-unsigned 2>mergeerror &&
-       test_i18ngrep "does not have a GPG signature" mergeerror
+       test_grep "does not have a GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge commit with bad signature with verification' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_must_fail git merge --ff-only --verify-signatures $(cat forged.commit) 2>mergeerror &&
-       test_i18ngrep "has a bad GPG signature" mergeerror
+       test_grep "has a bad GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge commit with bad signature with merge.verifySignatures=true' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config merge.verifySignatures true &&
        test_must_fail git merge --ff-only $(cat forged.commit) 2>mergeerror &&
-       test_i18ngrep "has a bad GPG signature" mergeerror
+       test_grep "has a bad GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge commit with untrusted signature with verification' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_must_fail git merge --ff-only --verify-signatures side-untrusted 2>mergeerror &&
-       test_i18ngrep "has an untrusted GPG signature" mergeerror
+       test_grep "has an untrusted GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge commit with untrusted signature with verification and high minTrustLevel' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config gpg.minTrustLevel marginal &&
        test_must_fail git merge --ff-only --verify-signatures side-untrusted 2>mergeerror &&
-       test_i18ngrep "has an untrusted GPG signature" mergeerror
+       test_grep "has an untrusted GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge commit with untrusted signature with verification and low minTrustLevel' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config gpg.minTrustLevel undefined &&
        git merge --ff-only --verify-signatures side-untrusted >mergeoutput &&
-       test_i18ngrep "has a good GPG signature" mergeoutput
+       test_grep "has a good GPG signature" mergeoutput
 '
 
 test_expect_success GPG 'merge commit with untrusted signature with merge.verifySignatures=true' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config merge.verifySignatures true &&
        test_must_fail git merge --ff-only side-untrusted 2>mergeerror &&
-       test_i18ngrep "has an untrusted GPG signature" mergeerror
+       test_grep "has an untrusted GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge commit with untrusted signature with merge.verifySignatures=true and minTrustLevel' '
@@ -96,20 +96,20 @@ test_expect_success GPG 'merge commit with untrusted signature with merge.verify
        test_config merge.verifySignatures true &&
        test_config gpg.minTrustLevel marginal &&
        test_must_fail git merge --ff-only side-untrusted 2>mergeerror &&
-       test_i18ngrep "has an untrusted GPG signature" mergeerror
+       test_grep "has an untrusted GPG signature" mergeerror
 '
 
 test_expect_success GPG 'merge signed commit with verification' '
        test_when_finished "git reset --hard && git checkout initial" &&
        git merge --verbose --ff-only --verify-signatures side-signed >mergeoutput &&
-       test_i18ngrep "has a good GPG signature" mergeoutput
+       test_grep "has a good GPG signature" mergeoutput
 '
 
 test_expect_success GPG 'merge signed commit with merge.verifySignatures=true' '
        test_when_finished "git reset --hard && git checkout initial" &&
        test_config merge.verifySignatures true &&
        git merge --verbose --ff-only side-signed >mergeoutput &&
-       test_i18ngrep "has a good GPG signature" mergeoutput
+       test_grep "has a good GPG signature" mergeoutput
 '
 
 test_expect_success GPG 'merge commit with bad signature without verification' '
@@ -133,7 +133,7 @@ test_expect_success GPG 'merge unsigned commit into unborn branch' '
        test_when_finished "git checkout initial" &&
        git checkout --orphan unborn &&
        test_must_fail git merge --verify-signatures side-unsigned 2>mergeerror &&
-       test_i18ngrep "does not have a GPG signature" mergeerror
+       test_grep "does not have a GPG signature" mergeerror
 '
 
 test_done
index 27b66807cd82cbb93c4985905a8de7945cc17cbc..94f9f4a1dac5621fbd340b6425d2f2ea7f042016 100755 (executable)
@@ -271,7 +271,7 @@ test_expect_success 'repacking fails when missing .pack actually means missing o
                ls .git/objects/pack/*.pack >before-pack-dir &&
 
                test_must_fail git fsck &&
-               test_must_fail git repack --cruft -d 2>err &&
+               test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git repack --cruft -d 2>err &&
                grep "bad object" err &&
 
                # Before failing, the repack did not modify the
@@ -327,6 +327,203 @@ test_expect_success 'auto-bitmaps do not complain if unavailable' '
        test_must_be_empty actual
 '
 
+test_expect_success 'repacking with a filter works' '
+       git -C bare.git repack -a -d &&
+       test_stdout_line_count = 1 ls bare.git/objects/pack/*.pack &&
+       git -C bare.git -c repack.writebitmaps=false repack -a -d --filter=blob:none &&
+       test_stdout_line_count = 2 ls bare.git/objects/pack/*.pack &&
+       commit_pack=$(test-tool -C bare.git find-pack -c 1 HEAD) &&
+       blob_pack=$(test-tool -C bare.git find-pack -c 1 HEAD:file1) &&
+       test "$commit_pack" != "$blob_pack" &&
+       tree_pack=$(test-tool -C bare.git find-pack -c 1 HEAD^{tree}) &&
+       test "$tree_pack" = "$commit_pack" &&
+       blob_pack2=$(test-tool -C bare.git find-pack -c 1 HEAD:file2) &&
+       test "$blob_pack2" = "$blob_pack"
+'
+
+test_expect_success '--filter fails with --write-bitmap-index' '
+       test_must_fail \
+               env GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0 \
+               git -C bare.git repack -a -d --write-bitmap-index --filter=blob:none
+'
+
+test_expect_success 'repacking with two filters works' '
+       git init two-filters &&
+       (
+               cd two-filters &&
+               mkdir subdir &&
+               test_commit foo &&
+               test_commit subdir_bar subdir/bar &&
+               test_commit subdir_baz subdir/baz
+       ) &&
+       git clone --no-local --bare two-filters two-filters.git &&
+       (
+               cd two-filters.git &&
+               test_stdout_line_count = 1 ls objects/pack/*.pack &&
+               git -c repack.writebitmaps=false repack -a -d \
+                       --filter=blob:none --filter=tree:1 &&
+               test_stdout_line_count = 2 ls objects/pack/*.pack &&
+               commit_pack=$(test-tool find-pack -c 1 HEAD) &&
+               blob_pack=$(test-tool find-pack -c 1 HEAD:foo.t) &&
+               root_tree_pack=$(test-tool find-pack -c 1 HEAD^{tree}) &&
+               subdir_tree_hash=$(git ls-tree --object-only HEAD -- subdir) &&
+               subdir_tree_pack=$(test-tool find-pack -c 1 "$subdir_tree_hash") &&
+
+               # Root tree and subdir tree are not in the same packfiles
+               test "$commit_pack" != "$blob_pack" &&
+               test "$commit_pack" = "$root_tree_pack" &&
+               test "$blob_pack" = "$subdir_tree_pack"
+       )
+'
+
+prepare_for_keep_packs () {
+       git init keep-packs &&
+       (
+               cd keep-packs &&
+               test_commit foo &&
+               test_commit bar
+       ) &&
+       git clone --no-local --bare keep-packs keep-packs.git &&
+       (
+               cd keep-packs.git &&
+
+               # Create two packs
+               # The first pack will contain all of the objects except one blob
+               git rev-list --objects --all >objs &&
+               grep -v "bar.t" objs | git pack-objects pack &&
+               # The second pack will contain the excluded object and be kept
+               packid=$(grep "bar.t" objs | git pack-objects pack) &&
+               >pack-$packid.keep &&
+
+               # Replace the existing pack with the 2 new ones
+               rm -f objects/pack/pack* &&
+               mv pack-* objects/pack/
+       )
+}
+
+test_expect_success '--filter works with .keep packs' '
+       prepare_for_keep_packs &&
+       (
+               cd keep-packs.git &&
+
+               foo_pack=$(test-tool find-pack -c 1 HEAD:foo.t) &&
+               bar_pack=$(test-tool find-pack -c 1 HEAD:bar.t) &&
+               head_pack=$(test-tool find-pack -c 1 HEAD) &&
+
+               test "$foo_pack" != "$bar_pack" &&
+               test "$foo_pack" = "$head_pack" &&
+
+               git -c repack.writebitmaps=false repack -a -d --filter=blob:none &&
+
+               foo_pack_1=$(test-tool find-pack -c 1 HEAD:foo.t) &&
+               bar_pack_1=$(test-tool find-pack -c 1 HEAD:bar.t) &&
+               head_pack_1=$(test-tool find-pack -c 1 HEAD) &&
+
+               # Object bar is still only in the old .keep pack
+               test "$foo_pack_1" != "$foo_pack" &&
+               test "$bar_pack_1" = "$bar_pack" &&
+               test "$head_pack_1" != "$head_pack" &&
+
+               test "$foo_pack_1" != "$bar_pack_1" &&
+               test "$foo_pack_1" != "$head_pack_1" &&
+               test "$bar_pack_1" != "$head_pack_1"
+       )
+'
+
+test_expect_success '--filter works with --pack-kept-objects and .keep packs' '
+       rm -rf keep-packs keep-packs.git &&
+       prepare_for_keep_packs &&
+       (
+               cd keep-packs.git &&
+
+               foo_pack=$(test-tool find-pack -c 1 HEAD:foo.t) &&
+               bar_pack=$(test-tool find-pack -c 1 HEAD:bar.t) &&
+               head_pack=$(test-tool find-pack -c 1 HEAD) &&
+
+               test "$foo_pack" != "$bar_pack" &&
+               test "$foo_pack" = "$head_pack" &&
+
+               git -c repack.writebitmaps=false repack -a -d --filter=blob:none \
+                       --pack-kept-objects &&
+
+               foo_pack_1=$(test-tool find-pack -c 1 HEAD:foo.t) &&
+               test-tool find-pack -c 2 HEAD:bar.t >bar_pack_1 &&
+               head_pack_1=$(test-tool find-pack -c 1 HEAD) &&
+
+               test "$foo_pack_1" != "$foo_pack" &&
+               test "$foo_pack_1" != "$bar_pack" &&
+               test "$head_pack_1" != "$head_pack" &&
+
+               # Object bar is in both the old .keep pack and the new
+               # pack that contained the filtered out objects
+               grep "$bar_pack" bar_pack_1 &&
+               grep "$foo_pack_1" bar_pack_1 &&
+               test "$foo_pack_1" != "$head_pack_1"
+       )
+'
+
+test_expect_success '--filter-to stores filtered out objects' '
+       git -C bare.git repack -a -d &&
+       test_stdout_line_count = 1 ls bare.git/objects/pack/*.pack &&
+
+       git init --bare filtered.git &&
+       git -C bare.git -c repack.writebitmaps=false repack -a -d \
+               --filter=blob:none \
+               --filter-to=../filtered.git/objects/pack/pack &&
+       test_stdout_line_count = 1 ls bare.git/objects/pack/pack-*.pack &&
+       test_stdout_line_count = 1 ls filtered.git/objects/pack/pack-*.pack &&
+
+       commit_pack=$(test-tool -C bare.git find-pack -c 1 HEAD) &&
+       blob_pack=$(test-tool -C bare.git find-pack -c 0 HEAD:file1) &&
+       blob_hash=$(git -C bare.git rev-parse HEAD:file1) &&
+       test -n "$blob_hash" &&
+       blob_pack=$(test-tool -C filtered.git find-pack -c 1 $blob_hash) &&
+
+       echo $(pwd)/filtered.git/objects >bare.git/objects/info/alternates &&
+       blob_pack=$(test-tool -C bare.git find-pack -c 1 HEAD:file1) &&
+       blob_content=$(git -C bare.git show $blob_hash) &&
+       test "$blob_content" = "content1"
+'
+
+test_expect_success '--filter works with --max-pack-size' '
+       rm -rf filtered.git &&
+       git init --bare filtered.git &&
+       git init max-pack-size &&
+       (
+               cd max-pack-size &&
+               test_commit base &&
+               # two blobs which exceed the maximum pack size
+               test-tool genrandom foo 1048576 >foo &&
+               git hash-object -w foo &&
+               test-tool genrandom bar 1048576 >bar &&
+               git hash-object -w bar &&
+               git add foo bar &&
+               git commit -m "adding foo and bar"
+       ) &&
+       git clone --no-local --bare max-pack-size max-pack-size.git &&
+       (
+               cd max-pack-size.git &&
+               git -c repack.writebitmaps=false repack -a -d --filter=blob:none \
+                       --max-pack-size=1M \
+                       --filter-to=../filtered.git/objects/pack/pack &&
+               echo $(cd .. && pwd)/filtered.git/objects >objects/info/alternates &&
+
+               # Check that the 3 blobs are in different packfiles in filtered.git
+               test_stdout_line_count = 3 ls ../filtered.git/objects/pack/pack-*.pack &&
+               test_stdout_line_count = 1 ls objects/pack/pack-*.pack &&
+               foo_pack=$(test-tool find-pack -c 1 HEAD:foo) &&
+               bar_pack=$(test-tool find-pack -c 1 HEAD:bar) &&
+               base_pack=$(test-tool find-pack -c 1 HEAD:base.t) &&
+               test "$foo_pack" != "$bar_pack" &&
+               test "$foo_pack" != "$base_pack" &&
+               test "$bar_pack" != "$base_pack" &&
+               for pack in "$foo_pack" "$bar_pack" "$base_pack"
+               do
+                       case "$foo_pack" in */filtered.git/objects/pack/*) true ;; *) return 1 ;; esac
+               done
+       )
+'
+
 objdir=.git/objects
 midx=$objdir/pack/multi-pack-index
 
@@ -633,125 +830,4 @@ test_expect_success '-n overrides repack.updateServerInfo=true' '
        test_server_info_missing
 '
 
-test_expect_success '--expire-to stores pruned objects (now)' '
-       git init expire-to-now &&
-       (
-               cd expire-to-now &&
-
-               git branch -M main &&
-
-               test_commit base &&
-
-               git checkout -b cruft &&
-               test_commit --no-tag cruft &&
-
-               git rev-list --objects --no-object-names main..cruft >moved.raw &&
-               sort moved.raw >moved.want &&
-
-               git rev-list --all --objects --no-object-names >expect.raw &&
-               sort expect.raw >expect &&
-
-               git checkout main &&
-               git branch -D cruft &&
-               git reflog expire --all --expire=all &&
-
-               git init --bare expired.git &&
-               git repack -d \
-                       --cruft --cruft-expiration="now" \
-                       --expire-to="expired.git/objects/pack/pack" &&
-
-               expired="$(ls expired.git/objects/pack/pack-*.idx)" &&
-               test_path_is_file "${expired%.idx}.mtimes" &&
-
-               # Since the `--cruft-expiration` is "now", the effective
-               # behavior is to move _all_ unreachable objects out to
-               # the location in `--expire-to`.
-               git show-index <$expired >expired.raw &&
-               cut -d" " -f2 expired.raw | sort >expired.objects &&
-               git rev-list --all --objects --no-object-names \
-                       >remaining.objects &&
-
-               # ...in other words, the combined contents of this
-               # repository and expired.git should be the same as the
-               # set of objects we started with.
-               cat expired.objects remaining.objects | sort >actual &&
-               test_cmp expect actual &&
-
-               # The "moved" objects (i.e., those in expired.git)
-               # should be the same as the cruft objects which were
-               # expired in the previous step.
-               test_cmp moved.want expired.objects
-       )
-'
-
-test_expect_success '--expire-to stores pruned objects (5.minutes.ago)' '
-       git init expire-to-5.minutes.ago &&
-       (
-               cd expire-to-5.minutes.ago &&
-
-               git branch -M main &&
-
-               test_commit base &&
-
-               # Create two classes of unreachable objects, one which
-               # is older than 5 minutes (stale), and another which is
-               # newer (recent).
-               for kind in stale recent
-               do
-                       git checkout -b $kind main &&
-                       test_commit --no-tag $kind || return 1
-               done &&
-
-               git rev-list --objects --no-object-names main..stale >in &&
-               stale="$(git pack-objects $objdir/pack/pack <in)" &&
-               mtime="$(test-tool chmtime --get =-600 $objdir/pack/pack-$stale.pack)" &&
-
-               # expect holds the set of objects we expect to find in
-               # this repository after repacking
-               git rev-list --objects --no-object-names recent >expect.raw &&
-               sort expect.raw >expect &&
-
-               # moved.want holds the set of objects we expect to find
-               # in expired.git
-               git rev-list --objects --no-object-names main..stale >out &&
-               sort out >moved.want &&
-
-               git checkout main &&
-               git branch -D stale recent &&
-               git reflog expire --all --expire=all &&
-               git prune-packed &&
-
-               git init --bare expired.git &&
-               git repack -d \
-                       --cruft --cruft-expiration=5.minutes.ago \
-                       --expire-to="expired.git/objects/pack/pack" &&
-
-               # Some of the remaining objects in this repository are
-               # unreachable, so use `cat-file --batch-all-objects`
-               # instead of `rev-list` to get their names
-               git cat-file --batch-all-objects --batch-check="%(objectname)" \
-                       >remaining.objects &&
-               sort remaining.objects >actual &&
-               test_cmp expect actual &&
-
-               (
-                       cd expired.git &&
-
-                       expired="$(ls objects/pack/pack-*.mtimes)" &&
-                       test-tool pack-mtimes $(basename $expired) >out &&
-                       cut -d" " -f1 out | sort >../moved.got &&
-
-                       # Ensure that there are as many objects with the
-                       # expected mtime as were moved to expired.git.
-                       #
-                       # In other words, ensure that the recorded
-                       # mtimes of any moved objects was written
-                       # correctly.
-                       grep " $mtime$" out >matching &&
-                       test_line_count = $(wc -l <../moved.want) matching
-               ) &&
-               test_cmp moved.want moved.got
-       )
-'
-
 test_done
index 00f28fb558ced5cbb4c7667f9b6ce597ee7fb782..9fc1626fbfde8989348537903a266eb6cae8600d 100755 (executable)
@@ -23,7 +23,7 @@ test_expect_success '--geometric with no packs' '
                cd geometric &&
 
                git repack --write-midx --geometric 2 >out &&
-               test_i18ngrep "Nothing new to pack" out
+               test_grep "Nothing new to pack" out
        )
 '
 
@@ -38,7 +38,7 @@ test_expect_success '--geometric with one pack' '
 
                git repack --geometric 2 >out &&
 
-               test_i18ngrep "Nothing new to pack" out
+               test_grep "Nothing new to pack" out
        )
 '
 
diff --git a/t/t7704-repack-cruft.sh b/t/t7704-repack-cruft.sh
new file mode 100755 (executable)
index 0000000..71e1ef3
--- /dev/null
@@ -0,0 +1,414 @@
+#!/bin/sh
+
+test_description='git repack works correctly'
+
+. ./test-lib.sh
+
+objdir=.git/objects
+packdir=$objdir/pack
+
+test_expect_success '--expire-to stores pruned objects (now)' '
+       git init expire-to-now &&
+       (
+               cd expire-to-now &&
+
+               git branch -M main &&
+
+               test_commit base &&
+
+               git checkout -b cruft &&
+               test_commit --no-tag cruft &&
+
+               git rev-list --objects --no-object-names main..cruft >moved.raw &&
+               sort moved.raw >moved.want &&
+
+               git rev-list --all --objects --no-object-names >expect.raw &&
+               sort expect.raw >expect &&
+
+               git checkout main &&
+               git branch -D cruft &&
+               git reflog expire --all --expire=all &&
+
+               git init --bare expired.git &&
+               git repack -d \
+                       --cruft --cruft-expiration="now" \
+                       --expire-to="expired.git/objects/pack/pack" &&
+
+               expired="$(ls expired.git/objects/pack/pack-*.idx)" &&
+               test_path_is_file "${expired%.idx}.mtimes" &&
+
+               # Since the `--cruft-expiration` is "now", the effective
+               # behavior is to move _all_ unreachable objects out to
+               # the location in `--expire-to`.
+               git show-index <$expired >expired.raw &&
+               cut -d" " -f2 expired.raw | sort >expired.objects &&
+               git rev-list --all --objects --no-object-names \
+                       >remaining.objects &&
+
+               # ...in other words, the combined contents of this
+               # repository and expired.git should be the same as the
+               # set of objects we started with.
+               sort expired.objects remaining.objects >actual &&
+               test_cmp expect actual &&
+
+               # The "moved" objects (i.e., those in expired.git)
+               # should be the same as the cruft objects which were
+               # expired in the previous step.
+               test_cmp moved.want expired.objects
+       )
+'
+
+test_expect_success '--expire-to stores pruned objects (5.minutes.ago)' '
+       git init expire-to-5.minutes.ago &&
+       (
+               cd expire-to-5.minutes.ago &&
+
+               git branch -M main &&
+
+               test_commit base &&
+
+               # Create two classes of unreachable objects, one which
+               # is older than 5 minutes (stale), and another which is
+               # newer (recent).
+               for kind in stale recent
+               do
+                       git checkout -b $kind main &&
+                       test_commit --no-tag $kind || return 1
+               done &&
+
+               git rev-list --objects --no-object-names main..stale >in &&
+               stale="$(git pack-objects $objdir/pack/pack <in)" &&
+               mtime="$(test-tool chmtime --get =-600 $objdir/pack/pack-$stale.pack)" &&
+
+               # expect holds the set of objects we expect to find in
+               # this repository after repacking
+               git rev-list --objects --no-object-names recent >expect.raw &&
+               sort expect.raw >expect &&
+
+               # moved.want holds the set of objects we expect to find
+               # in expired.git
+               git rev-list --objects --no-object-names main..stale >out &&
+               sort out >moved.want &&
+
+               git checkout main &&
+               git branch -D stale recent &&
+               git reflog expire --all --expire=all &&
+               git prune-packed &&
+
+               git init --bare expired.git &&
+               git repack -d \
+                       --cruft --cruft-expiration=5.minutes.ago \
+                       --expire-to="expired.git/objects/pack/pack" &&
+
+               # Some of the remaining objects in this repository are
+               # unreachable, so use `cat-file --batch-all-objects`
+               # instead of `rev-list` to get their names
+               git cat-file --batch-all-objects --batch-check="%(objectname)" \
+                       >remaining.objects &&
+               sort remaining.objects >actual &&
+               test_cmp expect actual &&
+
+               (
+                       cd expired.git &&
+
+                       expired="$(ls objects/pack/pack-*.mtimes)" &&
+                       test-tool pack-mtimes $(basename $expired) >out &&
+                       cut -d" " -f1 out | sort >../moved.got &&
+
+                       # Ensure that there are as many objects with the
+                       # expected mtime as were moved to expired.git.
+                       #
+                       # In other words, ensure that the recorded
+                       # mtimes of any moved objects was written
+                       # correctly.
+                       grep " $mtime$" out >matching &&
+                       test_line_count = $(wc -l <../moved.want) matching
+               ) &&
+               test_cmp moved.want moved.got
+       )
+'
+
+generate_random_blob() {
+       test-tool genrandom "$@" >blob &&
+       git hash-object -w -t blob blob &&
+       rm blob
+}
+
+pack_random_blob () {
+       generate_random_blob "$@" &&
+       git repack -d -q >/dev/null
+}
+
+generate_cruft_pack () {
+       pack_random_blob "$@" >/dev/null &&
+
+       ls $packdir/pack-*.pack | xargs -n 1 basename >in &&
+       pack="$(git pack-objects --cruft $packdir/pack <in)" &&
+       git prune-packed &&
+
+       echo "$packdir/pack-$pack.mtimes"
+}
+
+test_expect_success '--max-cruft-size creates new packs when above threshold' '
+       git init max-cruft-size-large &&
+       (
+               cd max-cruft-size-large &&
+               test_commit base &&
+
+               foo="$(pack_random_blob foo $((1*1024*1024)))" &&
+               git repack --cruft -d &&
+               cruft_foo="$(ls $packdir/pack-*.mtimes)" &&
+
+               bar="$(pack_random_blob bar $((1*1024*1024)))" &&
+               git repack --cruft -d --max-cruft-size=1M &&
+               cruft_bar="$(ls $packdir/pack-*.mtimes | grep -v $cruft_foo)" &&
+
+               test-tool pack-mtimes $(basename "$cruft_foo") >foo.objects &&
+               test-tool pack-mtimes $(basename "$cruft_bar") >bar.objects &&
+
+               grep "^$foo" foo.objects &&
+               test_line_count = 1 foo.objects &&
+               grep "^$bar" bar.objects &&
+               test_line_count = 1 bar.objects
+       )
+'
+
+test_expect_success '--max-cruft-size combines existing packs when below threshold' '
+       git init max-cruft-size-small &&
+       (
+               cd max-cruft-size-small &&
+               test_commit base &&
+
+               foo="$(pack_random_blob foo $((1*1024*1024)))" &&
+               git repack --cruft -d &&
+
+               bar="$(pack_random_blob bar $((1*1024*1024)))" &&
+               git repack --cruft -d --max-cruft-size=10M &&
+
+               cruft=$(ls $packdir/pack-*.mtimes) &&
+               test-tool pack-mtimes $(basename "$cruft") >cruft.objects &&
+
+               grep "^$foo" cruft.objects &&
+               grep "^$bar" cruft.objects &&
+               test_line_count = 2 cruft.objects
+       )
+'
+
+test_expect_success '--max-cruft-size combines smaller packs first' '
+       git init max-cruft-size-consume-small &&
+       (
+               cd max-cruft-size-consume-small &&
+
+               test_commit base &&
+               git repack -ad &&
+
+               cruft_foo="$(generate_cruft_pack foo 524288)" &&    # 0.5 MiB
+               cruft_bar="$(generate_cruft_pack bar 524288)" &&    # 0.5 MiB
+               cruft_baz="$(generate_cruft_pack baz 1048576)" &&   # 1.0 MiB
+               cruft_quux="$(generate_cruft_pack quux 1572864)" && # 1.5 MiB
+
+               test-tool pack-mtimes "$(basename $cruft_foo)" >expect.raw &&
+               test-tool pack-mtimes "$(basename $cruft_bar)" >>expect.raw &&
+               sort expect.raw >expect.objects &&
+
+               # repacking with `--max-cruft-size=2M` should combine
+               # both 0.5 MiB packs together, instead of, say, one of
+               # the 0.5 MiB packs with the 1.0 MiB pack
+               ls $packdir/pack-*.mtimes | sort >cruft.before &&
+               git repack -d --cruft --max-cruft-size=2M &&
+               ls $packdir/pack-*.mtimes | sort >cruft.after &&
+
+               comm -13 cruft.before cruft.after >cruft.new &&
+               comm -23 cruft.before cruft.after >cruft.removed &&
+
+               test_line_count = 1 cruft.new &&
+               test_line_count = 2 cruft.removed &&
+
+               # the two smaller packs should be rolled up first
+               printf "%s\n" $cruft_foo $cruft_bar | sort >expect.removed &&
+               test_cmp expect.removed cruft.removed &&
+
+               # ...and contain the set of objects rolled up
+               test-tool pack-mtimes "$(basename $(cat cruft.new))" >actual.raw &&
+               sort actual.raw >actual.objects &&
+
+               test_cmp expect.objects actual.objects
+       )
+'
+
+test_expect_success 'setup --max-cruft-size with freshened objects' '
+       git init max-cruft-size-freshen &&
+       (
+               cd max-cruft-size-freshen &&
+
+               test_commit base &&
+               git repack -ad &&
+
+               foo="$(generate_random_blob foo 64)" &&
+               test-tool chmtime --get -10000 \
+                       "$objdir/$(test_oid_to_path "$foo")" >foo.mtime &&
+
+               git repack --cruft -d &&
+
+               cruft="$(ls $packdir/pack-*.mtimes)" &&
+               test-tool pack-mtimes "$(basename $cruft)" >actual &&
+               echo "$foo $(cat foo.mtime)" >expect &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success '--max-cruft-size with freshened objects (loose)' '
+       (
+               cd max-cruft-size-freshen &&
+
+               # regenerate the object, setting its mtime to be more recent
+               foo="$(generate_random_blob foo 64)" &&
+               test-tool chmtime --get -100 \
+                       "$objdir/$(test_oid_to_path "$foo")" >foo.mtime &&
+
+               git repack --cruft -d &&
+
+               cruft="$(ls $packdir/pack-*.mtimes)" &&
+               test-tool pack-mtimes "$(basename $cruft)" >actual &&
+               echo "$foo $(cat foo.mtime)" >expect &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success '--max-cruft-size with freshened objects (packed)' '
+       (
+               cd max-cruft-size-freshen &&
+
+               # regenerate the object and store it in a packfile,
+               # setting its mtime to be more recent
+               #
+               # store it alongside another cruft object so that we
+               # do not create an identical copy of the existing
+               # cruft pack (which contains $foo).
+               foo="$(generate_random_blob foo 64)" &&
+               bar="$(generate_random_blob bar 64)" &&
+               foo_pack="$(printf "%s\n" $foo $bar | git pack-objects $packdir/pack)" &&
+               git prune-packed &&
+
+               test-tool chmtime --get -10 \
+                       "$packdir/pack-$foo_pack.pack" >foo.mtime &&
+
+               git repack --cruft -d &&
+
+               cruft="$(ls $packdir/pack-*.mtimes)" &&
+               test-tool pack-mtimes "$(basename $cruft)" >actual &&
+               echo "$foo $(cat foo.mtime)" >expect.raw &&
+               echo "$bar $(cat foo.mtime)" >>expect.raw &&
+               sort expect.raw >expect &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success '--max-cruft-size with pruning' '
+       git init max-cruft-size-prune &&
+       (
+               cd max-cruft-size-prune &&
+
+               test_commit base &&
+               foo="$(generate_random_blob foo $((1024*1024)))" &&
+               bar="$(generate_random_blob bar $((1024*1024)))" &&
+               baz="$(generate_random_blob baz $((1024*1024)))" &&
+
+               test-tool chmtime -10000 "$objdir/$(test_oid_to_path "$foo")" &&
+
+               git repack -d --cruft --max-cruft-size=1M &&
+
+               # backdate the mtimes of all cruft packs to validate
+               # that they were rewritten as a result of pruning
+               ls $packdir/pack-*.mtimes | sort >cruft.before &&
+               for cruft in $(cat cruft.before)
+               do
+                       mtime="$(test-tool chmtime --get -10000 "$cruft")" &&
+                       echo $cruft $mtime >>mtimes || return 1
+               done &&
+
+               # repack (and prune) with a --max-cruft-size to ensure
+               # that we appropriately split the resulting set of packs
+               git repack -d --cruft --max-cruft-size=1M \
+                       --cruft-expiration=10.seconds.ago &&
+               ls $packdir/pack-*.mtimes | sort >cruft.after &&
+
+               for cruft in $(cat cruft.after)
+               do
+                       old_mtime="$(grep $cruft mtimes | cut -d" " -f2)" &&
+                       new_mtime="$(test-tool chmtime --get $cruft)" &&
+                       test $old_mtime -lt $new_mtime || return 1
+               done &&
+
+               test_line_count = 3 cruft.before &&
+               test_line_count = 2 cruft.after &&
+               test_must_fail git cat-file -e $foo &&
+               git cat-file -e $bar &&
+               git cat-file -e $baz
+       )
+'
+
+test_expect_success '--max-cruft-size ignores non-local packs' '
+       repo="max-cruft-size-non-local" &&
+       git init $repo &&
+       (
+               cd $repo &&
+               test_commit base &&
+               generate_random_blob foo 64 &&
+               git repack --cruft -d
+       ) &&
+
+       git clone --reference=$repo $repo $repo-alt &&
+       (
+               cd $repo-alt &&
+
+               test_commit other &&
+               generate_random_blob bar 64 &&
+
+               # ensure that we do not attempt to pick up packs from
+               # the non-alternated repository, which would result in a
+               # crash
+               git repack --cruft --max-cruft-size=1M -d
+       )
+'
+
+test_expect_success 'reachable packs are preferred over cruft ones' '
+       repo="cruft-preferred-packs" &&
+       git init "$repo" &&
+       (
+               cd "$repo" &&
+
+               # This test needs to exercise careful control over when a MIDX
+               # is and is not written. Unset the corresponding TEST variable
+               # accordingly.
+               sane_unset GIT_TEST_MULTI_PACK_INDEX &&
+
+               test_commit base &&
+               test_commit --no-tag cruft &&
+
+               non_cruft="$(echo base | git pack-objects --revs $packdir/pack)" &&
+               # Write a cruft pack which both (a) sorts ahead of the non-cruft
+               # pack in lexical order, and (b) has an older mtime to appease
+               # the MIDX preferred pack selection routine.
+               cruft="$(echo pack-$non_cruft.pack | git pack-objects --cruft $packdir/pack-A)" &&
+               test-tool chmtime -1000 $packdir/pack-A-$cruft.pack &&
+
+               test_commit other &&
+               git repack -d &&
+
+               git repack --geometric 2 -d --write-midx --write-bitmap-index &&
+
+               # After repacking, there are two packs left: one reachable one
+               # (which is the result of combining both of the existing two
+               # non-cruft packs), and one cruft pack.
+               find .git/objects/pack -type f -name "*.pack" >packs &&
+               test_line_count = 2 packs &&
+
+               # Make sure that the pack we just wrote is marked as preferred,
+               # not the cruft one.
+               pack="$(test-tool read-midx --preferred-pack $objdir)" &&
+               test_path_is_missing "$packdir/$(basename "$pack" ".idx").mtimes"
+       )
+'
+
+test_done
index 59d3847bf87eab5d94fffbc48451665268b2832e..96ae5d5880d6a597d0c553c4535081c2e51356df 100755 (executable)
@@ -28,14 +28,14 @@ prompt_given ()
 
 test_expect_success 'basic usage requires no repo' '
        test_expect_code 129 git difftool -h >output &&
-       test_i18ngrep ^usage: output &&
+       test_grep ^usage: output &&
        # create a ceiling directory to prevent Git from finding a repo
        mkdir -p not/repo &&
        test_when_finished rm -r not &&
        test_expect_code 129 \
        env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
        git -C not/repo difftool -h >output &&
-       test_i18ngrep ^usage: output
+       test_grep ^usage: output
 '
 
 # Create a file on main and change it on branch
@@ -91,58 +91,67 @@ test_expect_success 'difftool forwards arguments to diff' '
        rm for-diff
 '
 
-test_expect_success 'difftool ignores exit code' '
-       test_config difftool.error.cmd false &&
-       git difftool -y -t error branch
-'
+for opt in '' '--dir-diff'
+do
+       test_expect_success "difftool ${opt} ignores exit code" "
+               test_config difftool.error.cmd false &&
+               git difftool ${opt} -y -t error branch
+       "
 
-test_expect_success 'difftool forwards exit code with --trust-exit-code' '
-       test_config difftool.error.cmd false &&
-       test_must_fail git difftool -y --trust-exit-code -t error branch
-'
+       test_expect_success "difftool ${opt} forwards exit code with --trust-exit-code" "
+               test_config difftool.error.cmd false &&
+               test_must_fail git difftool ${opt} -y --trust-exit-code -t error branch
+       "
 
-test_expect_success 'difftool forwards exit code with --trust-exit-code for built-ins' '
-       test_config difftool.vimdiff.path false &&
-       test_must_fail git difftool -y --trust-exit-code -t vimdiff branch
-'
+       test_expect_success "difftool ${opt} forwards exit code with --trust-exit-code for built-ins" "
+               test_config difftool.vimdiff.path false &&
+               test_must_fail git difftool ${opt} -y --trust-exit-code -t vimdiff branch
+       "
 
-test_expect_success 'difftool honors difftool.trustExitCode = true' '
-       test_config difftool.error.cmd false &&
-       test_config difftool.trustExitCode true &&
-       test_must_fail git difftool -y -t error branch
-'
+       test_expect_success "difftool ${opt} honors difftool.trustExitCode = true" "
+               test_config difftool.error.cmd false &&
+               test_config difftool.trustExitCode true &&
+               test_must_fail git difftool ${opt} -y -t error branch
+       "
 
-test_expect_success 'difftool honors difftool.trustExitCode = false' '
-       test_config difftool.error.cmd false &&
-       test_config difftool.trustExitCode false &&
-       git difftool -y -t error branch
-'
+       test_expect_success "difftool ${opt} honors difftool.trustExitCode = false" "
+               test_config difftool.error.cmd false &&
+               test_config difftool.trustExitCode false &&
+               git difftool ${opt} -y -t error branch
+       "
 
-test_expect_success 'difftool ignores exit code with --no-trust-exit-code' '
-       test_config difftool.error.cmd false &&
-       test_config difftool.trustExitCode true &&
-       git difftool -y --no-trust-exit-code -t error branch
-'
+       test_expect_success "difftool ${opt} ignores exit code with --no-trust-exit-code" "
+               test_config difftool.error.cmd false &&
+               test_config difftool.trustExitCode true &&
+               git difftool ${opt} -y --no-trust-exit-code -t error branch
+       "
 
-test_expect_success 'difftool stops on error with --trust-exit-code' '
-       test_when_finished "rm -f for-diff .git/fail-right-file" &&
-       test_when_finished "git reset -- for-diff" &&
-       write_script .git/fail-right-file <<-\EOF &&
-       echo failed
-       exit 1
-       EOF
-       >for-diff &&
-       git add for-diff &&
-       test_must_fail git difftool -y --trust-exit-code \
-               --extcmd .git/fail-right-file branch >actual &&
-       test_line_count = 1 actual
-'
+       test_expect_success "difftool ${opt} stops on error with --trust-exit-code" "
+               test_when_finished 'rm -f for-diff .git/fail-right-file' &&
+               test_when_finished 'git reset -- for-diff' &&
+               write_script .git/fail-right-file <<-\EOF &&
+               echo failed
+               exit 1
+               EOF
+               >for-diff &&
+               git add for-diff &&
+               test_must_fail git difftool ${opt} -y --trust-exit-code \
+                       --extcmd .git/fail-right-file branch >actual &&
+               test_line_count = 1 actual
+       "
 
-test_expect_success 'difftool honors exit status if command not found' '
-       test_config difftool.nonexistent.cmd i-dont-exist &&
-       test_config difftool.trustExitCode false &&
-       test_must_fail git difftool -y -t nonexistent branch
-'
+       test_expect_success "difftool ${opt} honors exit status if command not found" "
+               test_config difftool.nonexistent.cmd i-dont-exist &&
+               test_config difftool.trustExitCode false &&
+               if test "${opt}" = '--dir-diff'
+               then
+                       expected_code=127
+               else
+                       expected_code=128
+               fi &&
+               test_expect_code \${expected_code} git difftool ${opt} -y -t nonexistent branch
+       "
+done
 
 test_expect_success 'difftool honors --gui' '
        difftool_test_setup &&
index 39d6d713ecbe05e9638f8f6ee3f79ff49628b2cf..875dcfd98f3a0eb5e47b7f32b15da43b27a50577 100755 (executable)
@@ -808,6 +808,19 @@ test_expect_success 'grep -f, ignore empty lines, read patterns from stdin' '
        test_cmp expected actual
 '
 
+test_expect_success 'grep -f, use cwd relative file' '
+       test_when_finished "git rm -f sub/dir/file" &&
+       mkdir -p sub/dir &&
+       echo hit >sub/dir/file &&
+       git add sub/dir/file &&
+       echo hit >sub/dir/pattern &&
+       echo miss >pattern &&
+       (
+               cd sub/dir && git grep -f pattern file
+       ) &&
+       git -C sub/dir grep -f pattern file
+'
+
 cat >expected <<EOF
 y:y yy
 --
@@ -1234,6 +1247,33 @@ test_expect_success 'outside of git repository with fallbackToNoIndex' '
        )
 '
 
+test_expect_success 'no repository with path outside $cwd' '
+       test_when_finished rm -fr non &&
+       rm -fr non &&
+       mkdir -p non/git/sub non/tig &&
+       (
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non/git &&
+               test_expect_code 128 git grep --no-index search .. 2>error &&
+               grep "is outside the directory tree" error
+       ) &&
+       (
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non/git &&
+               test_expect_code 128 git grep --no-index search ../tig 2>error &&
+               grep "is outside the directory tree" error
+       ) &&
+       (
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non/git &&
+               test_expect_code 128 git grep --no-index search ../non 2>error &&
+               grep "no such path in the working tree" error
+       )
+'
+
 test_expect_success 'inside git repository but with --no-index' '
        rm -fr is &&
        mkdir -p is/git/sub &&
@@ -1386,7 +1426,7 @@ test_expect_success 'grep --no-index pattern -- path' '
 
 test_expect_success 'grep --no-index complains of revs' '
        test_must_fail git grep --no-index o main -- 2>err &&
-       test_i18ngrep "cannot be used with revs" err
+       test_grep "cannot be used with revs" err
 '
 
 test_expect_success 'grep --no-index prefers paths to revs' '
@@ -1399,7 +1439,7 @@ test_expect_success 'grep --no-index prefers paths to revs' '
 
 test_expect_success 'grep --no-index does not "diagnose" revs' '
        test_must_fail git grep --no-index o :1:hello.c 2>err &&
-       test_i18ngrep ! -i "did you mean" err
+       test_grep ! -i "did you mean" err
 '
 
 cat >expected <<EOF
index 1dd07141a7df9f9666ac01a611c6c6a81ddc6424..fe38d88a1a6ab151cb318429ec64c1c49ff24fb3 100755 (executable)
@@ -63,7 +63,7 @@ test_expect_success SIMPLEPAGER 'git grep -O' '
 
 test_expect_success 'git grep -O --cached' '
        test_must_fail git grep --cached -O GREP_PATTERN >out 2>msg &&
-       test_i18ngrep open-files-in-pager msg
+       test_grep open-files-in-pager msg
 '
 
 test_expect_success 'git grep -O --no-index' '
index d37c83b4640c31b9f5b4d04251ecafbf08636aa7..167fe661504a2b609583750884bb40a902408e04 100755 (executable)
@@ -348,7 +348,7 @@ test_incompatible_with_recurse_submodules ()
 {
        test_expect_success "--recurse-submodules and $1 are incompatible" "
                test_must_fail git grep -e. --recurse-submodules $1 2>actual &&
-               test_i18ngrep 'not supported with --recurse-submodules' actual
+               test_grep 'not supported with --recurse-submodules' actual
        "
 }
 
index fdb2355649e31a8153f3ff60fe3ffbb531a2a7aa..4353be5adb7b0605e5bc3db9b1b29ecf0251fbf2 100755 (executable)
@@ -26,7 +26,7 @@ nul_match_internal () {
                        >stderr &&
                        printf '$pattern' | q_to_nul >f &&
                        test_must_fail env LC_ALL=\"$lc_all\" git grep $extra_flags -f f $flags a 2>stderr &&
-                       test_i18ngrep ! 'This is only supported with -P under PCRE v2' stderr
+                       test_grep ! 'This is only supported with -P under PCRE v2' stderr
                "
        elif test "$matches" = P
        then
@@ -34,7 +34,7 @@ nul_match_internal () {
                        >stderr &&
                        printf '$pattern' | q_to_nul >f &&
                        test_must_fail env LC_ALL=\"$lc_all\" git grep -f f $flags a 2>stderr &&
-                       test_i18ngrep 'This is only supported with -P under PCRE v2' stderr
+                       test_grep 'This is only supported with -P under PCRE v2' stderr
                "
        else
                test_expect_success "PANIC: Test framework error. Unknown matches value $matches" 'false'
index 487e326b3fac126fb611e50851465d7d8b963888..0943dfa18a3f97b7e351346d089efdd878f6ca68 100755 (executable)
@@ -33,13 +33,13 @@ test_systemd_analyze_verify () {
 
 test_expect_success 'help text' '
        test_expect_code 129 git maintenance -h >actual &&
-       test_i18ngrep "usage: git maintenance <subcommand>" actual &&
+       test_grep "usage: git maintenance <subcommand>" actual &&
        test_expect_code 129 git maintenance barf 2>err &&
-       test_i18ngrep "unknown subcommand: \`barf'\''" err &&
-       test_i18ngrep "usage: git maintenance" err &&
+       test_grep "unknown subcommand: \`barf'\''" err &&
+       test_grep "usage: git maintenance" err &&
        test_expect_code 129 git maintenance 2>err &&
-       test_i18ngrep "error: need a subcommand" err &&
-       test_i18ngrep "usage: git maintenance" err
+       test_grep "error: need a subcommand" err &&
+       test_grep "usage: git maintenance" err
 '
 
 test_expect_success 'run [--auto|--quiet]' '
@@ -67,6 +67,51 @@ test_expect_success 'maintenance.auto config option' '
        test_subcommand ! git maintenance run --auto --quiet  <false
 '
 
+test_expect_success 'register uses XDG_CONFIG_HOME config if it exists' '
+       test_when_finished rm -r .config/git/config &&
+       (
+               XDG_CONFIG_HOME=.config &&
+               export XDG_CONFIG_HOME &&
+               mkdir -p $XDG_CONFIG_HOME/git &&
+               >$XDG_CONFIG_HOME/git/config &&
+               git maintenance register &&
+               git config --file=$XDG_CONFIG_HOME/git/config --get maintenance.repo >actual &&
+               pwd >expect &&
+               test_cmp expect actual
+       )
+'
+
+test_expect_success 'register does not need XDG_CONFIG_HOME config to exist' '
+       test_when_finished git maintenance unregister &&
+       test_path_is_missing $XDG_CONFIG_HOME/git/config &&
+       git maintenance register &&
+       git config --global --get maintenance.repo >actual &&
+       pwd >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'unregister uses XDG_CONFIG_HOME config if it exists' '
+       test_when_finished rm -r .config/git/config &&
+       (
+               XDG_CONFIG_HOME=.config &&
+               export XDG_CONFIG_HOME &&
+               mkdir -p $XDG_CONFIG_HOME/git &&
+               >$XDG_CONFIG_HOME/git/config &&
+               git maintenance register &&
+               git maintenance unregister &&
+               test_must_fail git config --file=$XDG_CONFIG_HOME/git/config --get maintenance.repo >actual &&
+               test_must_be_empty actual
+       )
+'
+
+test_expect_success 'unregister does not need XDG_CONFIG_HOME config to exist' '
+       test_path_is_missing $XDG_CONFIG_HOME/git/config &&
+       git maintenance register &&
+       git maintenance unregister &&
+       test_must_fail git config --global --get maintenance.repo >actual &&
+       test_must_be_empty actual
+'
+
 test_expect_success 'maintenance.<task>.enabled' '
        git config maintenance.gc.enabled false &&
        git config maintenance.commit-graph.enabled true &&
@@ -131,12 +176,12 @@ test_expect_success 'commit-graph auto condition' '
 
 test_expect_success 'run --task=bogus' '
        test_must_fail git maintenance run --task=bogus 2>err &&
-       test_i18ngrep "is not a valid task" err
+       test_grep "is not a valid task" err
 '
 
 test_expect_success 'run --task duplicate' '
        test_must_fail git maintenance run --task=gc --task=gc 2>err &&
-       test_i18ngrep "cannot be selected multiple times" err
+       test_grep "cannot be selected multiple times" err
 '
 
 test_expect_success 'run --task=prefetch with no remotes' '
@@ -157,7 +202,8 @@ test_expect_success 'prefetch multiple remotes' '
        fetchargs="--prefetch --prune --no-tags --no-write-fetch-head --recurse-submodules=no --quiet" &&
        test_subcommand git fetch remote1 $fetchargs <run-prefetch.txt &&
        test_subcommand git fetch remote2 $fetchargs <run-prefetch.txt &&
-       test_path_is_missing .git/refs/remotes &&
+       git for-each-ref refs/remotes >actual &&
+       test_must_be_empty actual &&
        git log prefetch/remotes/remote1/one &&
        git log prefetch/remotes/remote2/two &&
        git fetch --all &&
@@ -377,12 +423,12 @@ test_expect_success 'pack-refs task' '
 
 test_expect_success '--auto and --schedule incompatible' '
        test_must_fail git maintenance run --auto --schedule=daily 2>err &&
-       test_i18ngrep "at most one" err
+       test_grep "at most one" err
 '
 
 test_expect_success 'invalid --schedule value' '
        test_must_fail git maintenance run --schedule=annually 2>err &&
-       test_i18ngrep "unrecognized --schedule" err
+       test_grep "unrecognized --schedule" err
 '
 
 test_expect_success '--schedule inheritance weekly -> daily -> hourly' '
@@ -576,15 +622,15 @@ test_expect_success !MINGW 'register and unregister with regex metacharacters' '
 
 test_expect_success 'start --scheduler=<scheduler>' '
        test_expect_code 129 git maintenance start --scheduler=foo 2>err &&
-       test_i18ngrep "unrecognized --scheduler argument" err &&
+       test_grep "unrecognized --scheduler argument" err &&
 
        test_expect_code 129 git maintenance start --no-scheduler 2>err &&
-       test_i18ngrep "unknown option" err &&
+       test_grep "unknown option" err &&
 
        test_expect_code 128 \
                env GIT_TEST_MAINT_SCHEDULER="launchctl:true,schtasks:true" \
                git maintenance start --scheduler=crontab 2>err &&
-       test_i18ngrep "fatal: crontab scheduler is not available" err
+       test_grep "fatal: crontab scheduler is not available" err
 '
 
 test_expect_success 'start from empty cron table' '
@@ -744,7 +790,15 @@ test_expect_success 'start and stop Linux/systemd maintenance' '
        # start registers the repo
        git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
 
-       test_systemd_analyze_verify "systemd/user/git-maintenance@.service" &&
+       for schedule in hourly daily weekly
+       do
+               test_path_is_file "systemd/user/git-maintenance@$schedule.timer" || return 1
+       done &&
+       test_path_is_file "systemd/user/git-maintenance@.service" &&
+
+       test_systemd_analyze_verify "systemd/user/git-maintenance@hourly.service" &&
+       test_systemd_analyze_verify "systemd/user/git-maintenance@daily.service" &&
+       test_systemd_analyze_verify "systemd/user/git-maintenance@weekly.service" &&
 
        printf -- "--user enable --now git-maintenance@%s.timer\n" hourly daily weekly >expect &&
        test_cmp expect args &&
@@ -755,7 +809,10 @@ test_expect_success 'start and stop Linux/systemd maintenance' '
        # stop does not unregister the repo
        git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
 
-       test_path_is_missing "systemd/user/git-maintenance@.timer" &&
+       for schedule in hourly daily weekly
+       do
+               test_path_is_missing "systemd/user/git-maintenance@$schedule.timer" || return 1
+       done &&
        test_path_is_missing "systemd/user/git-maintenance@.service" &&
 
        printf -- "--user disable --now git-maintenance@%s.timer\n" hourly daily weekly >expect &&
@@ -838,4 +895,17 @@ test_expect_success 'register and unregister bare repo' '
        )
 '
 
+test_expect_success 'failed schedule prevents config change' '
+       git init --bare failcase &&
+
+       for scheduler in crontab launchctl schtasks systemctl
+       do
+               GIT_TEST_MAINT_SCHEDULER="$scheduler:false" &&
+               export GIT_TEST_MAINT_SCHEDULER &&
+               test_must_fail \
+                       git -C failcase maintenance start &&
+               test_must_fail git -C failcase config maintenance.auto || return 1
+       done
+'
+
 test_done
index 8bcd39e81bfb7f28768c988caf16f27773460b4e..731265541acf9fb0ed4dcc216b662daa897f814d 100755 (executable)
@@ -207,7 +207,7 @@ EOF
 
 test_expect_success 'blame -L with invalid start' '
        test_must_fail git blame -L5 tres 2>errors &&
-       test_i18ngrep "has only 2 lines" errors
+       test_grep "has only 2 lines" errors
 '
 
 test_expect_success 'blame -L with invalid end' '
index ca04242ca016368a5644ef7d04c8b3dab0569260..eb64b766bdfa24ee6fa3e8578188844b10e1ef66 100755 (executable)
@@ -43,7 +43,7 @@ test_expect_success 'cat-file --textconv --path=<path> works' '
        sha1=$(git rev-parse -q --verify HEAD:world.txt) &&
        test_config diff.txt.textconv "tr A-Za-z N-ZA-Mn-za-m <" &&
        git cat-file --textconv --path=hello.txt $sha1 >rot13 &&
-       test uryyb = "$(cat rot13 | remove_cr)"
+       test uryyb = "$(remove_cr <rot13)"
 '
 
 test_expect_success '--path=<path> complains without --textconv/--filters' '
index b18633dee1bfb2339033f1d0ab708979e98da018..dbfbd86e83a756b1155925d3b739a6396d86af3c 100755 (executable)
@@ -25,11 +25,11 @@ test_expect_success setup '
 
        git blame --line-porcelain file >blame_raw &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 1" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 1/s/ .*//p" blame_raw >actual &&
        git rev-parse X >expect &&
        test_cmp expect actual &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 2" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 2/s/ .*//p" blame_raw >actual &&
        git rev-parse X >expect &&
        test_cmp expect actual
 '
@@ -53,11 +53,11 @@ do
        test_expect_success "ignore_rev_changing_lines ($I)" '
                git blame --line-porcelain --ignore-rev $I file >blame_raw &&
 
-               grep -E "^[0-9a-f]+ [0-9]+ 1" blame_raw | sed -e "s/ .*//" >actual &&
+               sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 1/s/ .*//p" blame_raw >actual &&
                git rev-parse A >expect &&
                test_cmp expect actual &&
 
-               grep -E "^[0-9a-f]+ [0-9]+ 2" blame_raw | sed -e "s/ .*//" >actual &&
+               sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 2/s/ .*//p" blame_raw >actual &&
                git rev-parse B >expect &&
                test_cmp expect actual
        '
@@ -79,10 +79,10 @@ test_expect_success ignore_rev_adding_unblamable_lines '
        git rev-parse Y >expect &&
        git blame --line-porcelain file --ignore-rev Y >blame_raw &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 3" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 3/s/ .*//p" blame_raw >actual &&
        test_cmp expect actual &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 4" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 4/s/ .*//p" blame_raw >actual &&
        test_cmp expect actual
 '
 
@@ -92,11 +92,11 @@ test_expect_success ignore_revs_from_files '
        git rev-parse Y >ignore_y &&
        git blame --line-porcelain file --ignore-revs-file ignore_x --ignore-revs-file ignore_y >blame_raw &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 1" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 1/s/ .*//p" blame_raw >actual &&
        git rev-parse A >expect &&
        test_cmp expect actual &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 2" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 2/s/ .*//p" blame_raw >actual &&
        git rev-parse B >expect &&
        test_cmp expect actual
 '
@@ -106,11 +106,11 @@ test_expect_success ignore_revs_from_configs_and_files '
        git config --add blame.ignoreRevsFile ignore_x &&
        git blame --line-porcelain file --ignore-revs-file ignore_y >blame_raw &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 1" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 1/s/ .*//p" blame_raw >actual &&
        git rev-parse A >expect &&
        test_cmp expect actual &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 2" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 2/s/ .*//p" blame_raw >actual &&
        git rev-parse B >expect &&
        test_cmp expect actual
 '
@@ -121,22 +121,22 @@ test_expect_success override_ignore_revs_file '
        git blame --line-porcelain file --ignore-revs-file "" --ignore-revs-file ignore_y >blame_raw &&
        git rev-parse X >expect &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 1" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 1/s/ .*//p" blame_raw >actual &&
        test_cmp expect actual &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 2" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 2/s/ .*//p" blame_raw >actual &&
        test_cmp expect actual
        '
 test_expect_success bad_files_and_revs '
        test_must_fail git blame file --ignore-rev NOREV 2>err &&
-       test_i18ngrep "cannot find revision NOREV to ignore" err &&
+       test_grep "cannot find revision NOREV to ignore" err &&
 
        test_must_fail git blame file --ignore-revs-file NOFILE 2>err &&
-       test_i18ngrep "could not open.*: NOFILE" err &&
+       test_grep "could not open.*: NOFILE" err &&
 
        echo NOREV >ignore_norev &&
        test_must_fail git blame file --ignore-revs-file ignore_norev 2>err &&
-       test_i18ngrep "invalid object name: NOREV" err
+       test_grep "invalid object name: NOREV" err
 '
 
 # For ignored revs that have added 'unblamable' lines, mark those lines with a
@@ -279,11 +279,11 @@ test_expect_success ignore_merge '
        test_merge M B &&
        git blame --line-porcelain file --ignore-rev M >blame_raw &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 1" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 1/s/ .*//p" blame_raw >actual &&
        git rev-parse B >expect &&
        test_cmp expect actual &&
 
-       grep -E "^[0-9a-f]+ [0-9]+ 9" blame_raw | sed -e "s/ .*//" >actual &&
+       sed -ne "/^[0-9a-f][0-9a-f]* [0-9][0-9]* 9/s/ .*//p" blame_raw >actual &&
        git rev-parse C >expect &&
        test_cmp expect actual
 '
index a60b05ad3f09f03433e2b7fe96e095966ddb104a..5a771000c9ca0de56bf21e4d8212a6581727b189 100755 (executable)
@@ -61,8 +61,8 @@ test_no_confirm () {
                --smtp-server="$(pwd)/fake.sendmail" \
                $@ \
                $patches >stdout &&
-               ! grep "Send this email" stdout &&
-               >no_confirm_okay
+       ! grep "Send this email" stdout &&
+       >no_confirm_okay
 }
 
 # Exit immediately to prevent hang if a no-confirm test fails
@@ -371,7 +371,7 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email'
                --smtp-server="$(pwd)/fake.sendmail" \
                --to=to@example.com \
                $patches </dev/null 2>errors &&
-       test_i18ngrep "tell me who you are" errors
+       test_grep "tell me who you are" errors
        )
 '
 
@@ -633,6 +633,25 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
        test_cmp expect actual
 '
 
+test_expect_success $PREREQ "--validate hook supports multiple addresses in arguments" '
+       hooks_path="$(pwd)/my-hooks" &&
+       test_config core.hooksPath "$hooks_path" &&
+       test_when_finished "rm my-hooks.ran" &&
+       test_must_fail git send-email \
+               --from="Example <nobody@example.com>" \
+               --to=nobody@example.com,abc@example.com \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               --validate \
+               longline.patch 2>actual &&
+       test_path_is_file my-hooks.ran &&
+       cat >expect <<-EOF &&
+       fatal: longline.patch: rejected by sendemail-validate hook
+       fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
+       warning: no patches were sent
+       EOF
+       test_cmp expect actual
+'
+
 test_expect_success $PREREQ "--validate hook supports header argument" '
        write_script my-hooks/sendemail-validate <<-\EOF &&
        if test "$#" -ge 2
@@ -2062,7 +2081,7 @@ test_expect_success $PREREQ 'aliases and sendemail.identity' '
                -c sendemail.aliasesfile=default-aliases \
                -c sendemail.cloud.aliasesfile=cloud-aliases \
                send-email -1 2>stderr &&
-       test_i18ngrep "cloud-aliases" stderr
+       test_grep "cloud-aliases" stderr
 '
 
 test_sendmail_aliases () {
@@ -2427,7 +2446,7 @@ test_expect_success $PREREQ 'invoke hook' '
                        --to=nobody@example.com \
                        --smtp-server="$(pwd)/../fake.sendmail" \
                        ../another.patch 2>err &&
-               test_i18ngrep "rejected by sendemail-validate hook" err
+               test_grep "rejected by sendemail-validate hook" err
        )
 '
 
@@ -2483,7 +2502,7 @@ test_expect_success $PREREQ 'test that sendmail config is rejected' '
                --to=nobody@example.com \
                --smtp-server="$(pwd)/fake.sendmail" \
                HEAD^ 2>err &&
-       test_i18ngrep "found configuration options for '"'"sendmail"'"'" err
+       test_grep "found configuration options for '"'"sendmail"'"'" err
 '
 
 test_expect_success $PREREQ 'test that sendmail config rejection is specific' '
@@ -2505,4 +2524,45 @@ test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' '
                HEAD^
 '
 
+test_expect_success $PREREQ '--compose handles lowercase headers' '
+       write_script fake-editor <<-\EOF &&
+       sed "s/^From:.*/from: edited-from@example.com/i" "$1" >"$1.tmp" &&
+       mv "$1.tmp" "$1"
+       EOF
+       clean_fake_sendmail &&
+       git send-email \
+               --compose \
+               --from="Example <from@example.com>" \
+               --to=nobody@example.com \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               HEAD^ &&
+       grep "From: edited-from@example.com" msgtxt1
+'
+
+test_expect_success $PREREQ '--compose handles to headers' '
+       write_script fake-editor <<-\EOF &&
+       sed "s/^To: .*/&, edited-to@example.com/" <"$1" >"$1.tmp" &&
+       echo this is the body >>"$1.tmp" &&
+       mv "$1.tmp" "$1"
+       EOF
+       clean_fake_sendmail &&
+       GIT_SEND_EMAIL_NOTTY=1 \
+       git send-email \
+               --compose \
+               --from="Example <from@example.com>" \
+               --to=nobody@example.com \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               HEAD^ &&
+       # Check both that the cover letter used our modified "to" line,
+       # but also that it was picked up for the patch.
+       q_to_tab >expect <<-\EOF &&
+       To: nobody@example.com,
+       Qedited-to@example.com
+       EOF
+       grep -A1 "^To:" msgtxt1 >msgtxt1.to &&
+       test_cmp expect msgtxt1.to &&
+       grep -A1 "^To:" msgtxt2 >msgtxt2.to &&
+       test_cmp expect msgtxt2.to
+'
+
 test_done
index 6d3dbde3feb9a41dc59a42f75ef578b1ebc5b183..d5b98e615bca6647761e0e6f046d474ea8275015 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='git column'
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
@@ -195,4 +196,15 @@ EOF
        test_cmp expected actual
 '
 
+test_expect_success 'padding must be non-negative' '
+       cat >input <<\EOF &&
+1 2 3 4 5 6
+EOF
+       cat >expected <<\EOF &&
+fatal: --padding must be non-negative
+EOF
+       test_must_fail git column --mode=column --padding=-1 <input >actual 2>&1 &&
+       test_cmp expected actual
+'
+
 test_done
index 7e8894a4a70648fd12d3ab4425f1beac2c3e4641..590aab0304c679b6559df0e840ddce6dacc684af 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='check that example code compiles and runs'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'decorate' '
index 32317d6bca5f45314a46082ecd9aa68061853904..e06538b1c854815c40aa43915d844089671cb2bd 100755 (executable)
@@ -27,7 +27,7 @@ cat << EOF
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
 #
 EOF
 }
index 62de819a44e40c8fae821789e1d11753054a2258..3b038c338f2154e4470d3f472a448d5881adf54d 100755 (executable)
@@ -17,32 +17,32 @@ test_expect_success 'setup svnrepo' '
 test_expect_success 'basic clone' '
        test ! -d trunk &&
        git svn clone "$svnrepo"/project/trunk &&
-       test -d trunk/.git/svn &&
-       test -e trunk/foo &&
+       test_path_is_dir trunk/.git/svn &&
+       test_path_exists trunk/foo &&
        rm -rf trunk
        '
 
 test_expect_success 'clone to target directory' '
        test ! -d target &&
        git svn clone "$svnrepo"/project/trunk target &&
-       test -d target/.git/svn &&
-       test -e target/foo &&
+       test_path_is_dir target/.git/svn &&
+       test_path_exists target/foo &&
        rm -rf target
        '
 
 test_expect_success 'clone with --stdlayout' '
        test ! -d project &&
        git svn clone -s "$svnrepo"/project &&
-       test -d project/.git/svn &&
-       test -e project/foo &&
+       test_path_is_dir project/.git/svn &&
+       test_path_exists project/foo &&
        rm -rf project
        '
 
 test_expect_success 'clone to target directory with --stdlayout' '
        test ! -d target &&
        git svn clone -s "$svnrepo"/project target &&
-       test -d target/.git/svn &&
-       test -e target/foo &&
+       test_path_is_dir target/.git/svn &&
+       test_path_exists target/foo &&
        rm -rf target
        '
 
index a159ff96b71882362eaa7d7856289561601674cf..d3261e35b818400f0242a18a4b024877b1307823 100755 (executable)
@@ -38,7 +38,7 @@ test_expect_success 'setup svnrepo' '
 # SVN 1.7 will truncate "not-a%40{0]" to just "not-a".
 # Look at what SVN wound up naming the branch and use that.
 # Be sure to escape the @ if it shows up.
-non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | grep not-a | sed 's/\///' | sed 's/@/%40/')
+non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | sed -ne '/not-a/ { s/\///; s/@/%40/; p }')
 
 test_expect_success 'test clone with funky branch names' '
        git svn clone -s "$svnrepo/pr ject" project &&
index d8d536269cf73d64d9d2df593667c17c826479c5..8ca24670acb5a9280a163b11682e9a0dd52eaaa5 100755 (executable)
@@ -11,7 +11,7 @@ test_expect_success 'setup repo with a git repo inside it' '
        (
                cd s &&
                git init &&
-               test -f .git/HEAD &&
+               git symbolic-ref HEAD &&
                > .git/a &&
                echo a > a &&
                svn_cmd add .git a &&
index 09606f1b3cfeb4244de4fbc12e4e96ddb7fd7de5..926ac8143943c91493eb9be0e42ca365fae56971 100755 (executable)
@@ -20,11 +20,7 @@ test_expect_success 'empty directories exist' '
                cd cloned &&
                for i in a b c d d/e d/e/f "weird file name"
                do
-                       if ! test -d "$i"
-                       then
-                               echo >&2 "$i does not exist" &&
-                               exit 1
-                       fi
+                       test_path_is_dir "$i" || exit 1
                done
        )
 '
@@ -37,11 +33,7 @@ test_expect_success 'option automkdirs set to false' '
                git svn fetch &&
                for i in a b c d d/e d/e/f "weird file name"
                do
-                       if test -d "$i"
-                       then
-                               echo >&2 "$i exists" &&
-                               exit 1
-                       fi
+                       test_path_is_missing "$i" || exit 1
                done
        )
 '
@@ -52,7 +44,7 @@ test_expect_success 'more emptiness' '
 
 test_expect_success 'git svn rebase creates empty directory' '
        ( cd cloned && git svn rebase ) &&
-       test -d cloned/"! !"
+       test_path_is_dir cloned/"! !"
 '
 
 test_expect_success 'git svn mkdirs recreates empty directories' '
@@ -62,11 +54,7 @@ test_expect_success 'git svn mkdirs recreates empty directories' '
                git svn mkdirs &&
                for i in a b c d d/e d/e/f "weird file name" "! !"
                do
-                       if ! test -d "$i"
-                       then
-                               echo >&2 "$i does not exist" &&
-                               exit 1
-                       fi
+                       test_path_is_dir "$i" || exit 1
                done
        )
 '
@@ -78,25 +66,13 @@ test_expect_success 'git svn mkdirs -r works' '
                git svn mkdirs -r7 &&
                for i in a b c d d/e d/e/f "weird file name"
                do
-                       if ! test -d "$i"
-                       then
-                               echo >&2 "$i does not exist" &&
-                               exit 1
-                       fi
+                       test_path_is_dir "$i" || exit 1
                done &&
 
-               if test -d "! !"
-               then
-                       echo >&2 "$i should not exist" &&
-                       exit 1
-               fi &&
+               test_path_is_missing "! !" || exit 1 &&
 
                git svn mkdirs -r8 &&
-               if ! test -d "! !"
-               then
-                       echo >&2 "$i not exist" &&
-                       exit 1
-               fi
+               test_path_is_dir "! !" || exit 1
        )
 '
 
@@ -114,11 +90,7 @@ test_expect_success 'empty directories in trunk exist' '
                cd trunk &&
                for i in a "weird file name"
                do
-                       if ! test -d "$i"
-                       then
-                               echo >&2 "$i does not exist" &&
-                               exit 1
-                       fi
+                       test_path_is_dir "$i" || exit 1
                done
        )
 '
@@ -129,7 +101,7 @@ test_expect_success 'remove a top-level directory from svn' '
 
 test_expect_success 'removed top-level directory does not exist' '
        git svn clone "$svnrepo" removed &&
-       test ! -e removed/d
+       test_path_is_missing removed/d
 
 '
 unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
@@ -143,15 +115,11 @@ test_expect_success 'git svn gc-ed files work' '
                        svn_cmd mkdir -m gz "$svnrepo"/gz &&
                        git reset --hard $(git rev-list HEAD | tail -1) &&
                        git svn rebase &&
-                       test -f "$unhandled".gz &&
-                       test -f "$unhandled" &&
+                       test_path_is_file "$unhandled".gz &&
+                       test_path_is_file "$unhandled" &&
                        for i in a b c "weird file name" gz "! !"
                        do
-                               if ! test -d "$i"
-                               then
-                                       echo >&2 "$i does not exist" &&
-                                       exit 1
-                               fi
+                               test_path_is_dir "$i" || exit 1
                        done
                fi
        )
index c8e6c0733f41cf90a41941a3ad3550efb7ea56f1..d1dec89c3b7f6c46f18a2838c3d8cdba640146ea 100755 (executable)
@@ -46,6 +46,14 @@ setup_hook()
                        "passed to setup_hook" >&2 ; return 1; }
        echo "cnt=$skip_revs" > "$hook_type-counter"
        rm -f "$rawsvnrepo/hooks/"*-commit # drop previous hooks
+
+       # Subversion hooks run with an empty environment by default. We thus
+       # need to propagate PATH so that we can find executables.
+       cat >"$rawsvnrepo/conf/hooks-env" <<-EOF
+       [default]
+       PATH = ${PATH}
+       EOF
+
        hook="$rawsvnrepo/hooks/$hook_type"
        cat > "$hook" <<- 'EOF1'
                #!/bin/sh
@@ -63,7 +71,6 @@ EOF1
        if [ "$hook_type" = "pre-commit" ]; then
                echo "echo 'commit disallowed' >&2; exit 1" >>"$hook"
        else
-               echo "PATH=\"$PATH\"; export PATH" >>"$hook"
                echo "svnconf=\"$svnconf\"" >>"$hook"
                cat >>"$hook" <<- 'EOF2'
                        cd work-auto-commits.svn
index 4432a30d10b69a168ca477f222bfa52d36447006..428339e342751e02e3c9fe5b8053c0ccc6fee4b8 100755 (executable)
@@ -154,7 +154,14 @@ test_expect_success 'scalar clone' '
                test_cmp expect actual &&
 
                test_path_is_missing 1/2 &&
-               test_must_fail git rev-list --missing=print $second &&
+
+               # This relies on the fact that the presence of "--missing"
+               # on the command line forces lazy fetching off before
+               # "$second^{blob}" gets parsed.  Without "^{blob}", a
+               # bare object name "$second" is taken into the queue and
+               # the command may not fail with a fixed "rev-list --missing".
+               test_must_fail git rev-list --missing=print "$second^{blob}" -- &&
+
                git rev-list $second &&
                git cat-file blob $second >actual &&
                echo "second" >expect &&
index 872ad1c9c2b156bf25797b2651c69e9749cf391e..7869f45ee646dd511b16e404a8b165200f9c8608 100755 (executable)
@@ -180,4 +180,16 @@ test_expect_success 'scalar clone warns when background maintenance fails' '
        grep "could not turn on maintenance" err
 '
 
+test_expect_success '`scalar clone --no-src`' '
+       scalar clone --src "file://$(pwd)/to-clone" with-src &&
+       scalar clone --no-src "file://$(pwd)/to-clone" without-src &&
+
+       test_path_is_dir with-src/src &&
+       test_path_is_missing without-src/src &&
+
+       (cd with-src/src && ls ?*) >with &&
+       (cd without-src && ls ?*) >without &&
+       test_cmp with without
+'
+
 test_done
index ac237a1f906b2a05226c4cc7002763813dc543b7..60e30fed3c2cfc22b2b4190655685a428ce36289 100755 (executable)
@@ -986,7 +986,7 @@ test_expect_success 'L: nested tree copy does not corrupt deltas' '
        test_when_finished "git update-ref -d refs/heads/L2" &&
        git fast-import <input &&
        git ls-tree L2 g/b/ >tmp &&
-       cat tmp | cut -f 2 >actual &&
+       cut -f 2 <tmp >actual &&
        test_cmp expect actual &&
        git fsck $(git rev-parse L2)
 '
@@ -2007,12 +2007,11 @@ test_expect_success 'Q: verify first notes commit' '
 '
 
 test_expect_success 'Q: verify first notes tree' '
-       cat >expect.unsorted <<-EOF &&
+       sort >expect <<-EOF &&
        100644 blob $commit1
        100644 blob $commit2
        100644 blob $commit3
        EOF
-       cat expect.unsorted | sort >expect &&
        git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]*  / /" >actual &&
        test_cmp expect actual
 '
@@ -2048,12 +2047,11 @@ test_expect_success 'Q: verify second notes commit' '
 '
 
 test_expect_success 'Q: verify second notes tree' '
-       cat >expect.unsorted <<-EOF &&
+       sort >expect <<-EOF &&
        100644 blob $commit1
        100644 blob $commit2
        100644 blob $commit3
        EOF
-       cat expect.unsorted | sort >expect &&
        git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]*   / /" >actual &&
        test_cmp expect actual
 '
@@ -2088,10 +2086,9 @@ test_expect_success 'Q: verify third notes commit' '
 '
 
 test_expect_success 'Q: verify third notes tree' '
-       cat >expect.unsorted <<-EOF &&
+       sort >expect <<-EOF &&
        100644 blob $commit1
        EOF
-       cat expect.unsorted | sort >expect &&
        git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]*   / /" >actual &&
        test_cmp expect actual
 '
@@ -2115,10 +2112,9 @@ test_expect_success 'Q: verify fourth notes commit' '
 '
 
 test_expect_success 'Q: verify fourth notes tree' '
-       cat >expect.unsorted <<-EOF &&
+       sort >expect <<-EOF &&
        100644 blob $commit2
        EOF
-       cat expect.unsorted | sort >expect &&
        git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]*    / /" >actual &&
        test_cmp expect actual
 '
@@ -2879,7 +2875,7 @@ test_expect_success 'S: filemodify with garbage after mark must fail' '
        COMMIT
        M 100644 :403x hello.c
        EOF
-       test_i18ngrep "space after mark" err
+       test_grep "space after mark" err
 '
 
 # inline is misspelled; fast-import thinks it is some unknown dataref
@@ -2895,7 +2891,7 @@ test_expect_success 'S: filemodify with garbage after inline must fail' '
        inline
        BLOB
        EOF
-       test_i18ngrep "nvalid dataref" err
+       test_grep "nvalid dataref" err
 '
 
 test_expect_success 'S: filemodify with garbage after sha1 must fail' '
@@ -2908,7 +2904,7 @@ test_expect_success 'S: filemodify with garbage after sha1 must fail' '
        COMMIT
        M 100644 ${sha1}x hello.c
        EOF
-       test_i18ngrep "space after SHA1" err
+       test_grep "space after SHA1" err
 '
 
 #
@@ -2923,7 +2919,7 @@ test_expect_success 'S: notemodify with garbage after mark dataref must fail' '
        COMMIT
        N :202x :302
        EOF
-       test_i18ngrep "space after mark" err
+       test_grep "space after mark" err
 '
 
 test_expect_success 'S: notemodify with garbage after inline dataref must fail' '
@@ -2938,7 +2934,7 @@ test_expect_success 'S: notemodify with garbage after inline dataref must fail'
        note blob
        BLOB
        EOF
-       test_i18ngrep "nvalid dataref" err
+       test_grep "nvalid dataref" err
 '
 
 test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '
@@ -2951,7 +2947,7 @@ test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '
        COMMIT
        N ${sha1}x :302
        EOF
-       test_i18ngrep "space after SHA1" err
+       test_grep "space after SHA1" err
 '
 
 #
@@ -2966,7 +2962,7 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'
        COMMIT
        N :202 :302x
        EOF
-       test_i18ngrep "after mark" err
+       test_grep "after mark" err
 '
 
 #
@@ -2999,7 +2995,7 @@ test_expect_success 'S: from with garbage after mark must fail' '
        EOF
 
        # now evaluate the error
-       test_i18ngrep "after mark" err
+       test_grep "after mark" err
 '
 
 
@@ -3018,7 +3014,7 @@ test_expect_success 'S: merge with garbage after mark must fail' '
        merge :303x
        M 100644 :403 hello.c
        EOF
-       test_i18ngrep "after mark" err
+       test_grep "after mark" err
 '
 
 #
@@ -3033,7 +3029,7 @@ test_expect_success 'S: tag with garbage after mark must fail' '
        tag S
        TAG
        EOF
-       test_i18ngrep "after mark" err
+       test_grep "after mark" err
 '
 
 #
@@ -3043,7 +3039,7 @@ test_expect_success 'S: cat-blob with garbage after mark must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        cat-blob :403x
        EOF
-       test_i18ngrep "after mark" err
+       test_grep "after mark" err
 '
 
 #
@@ -3053,7 +3049,7 @@ test_expect_success 'S: ls with garbage after mark must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        ls :302x hello.c
        EOF
-       test_i18ngrep "space after mark" err
+       test_grep "space after mark" err
 '
 
 test_expect_success 'S: ls with garbage after sha1 must fail' '
@@ -3061,7 +3057,7 @@ test_expect_success 'S: ls with garbage after sha1 must fail' '
        test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
        ls ${sha1}x hello.c
        EOF
-       test_i18ngrep "space after tree-ish" err
+       test_grep "space after tree-ish" err
 '
 
 ###
index 26c25c0eb2ba57fa90c682950fda4899329474f8..1eb035ee4ce547d059e07c43f04102e66ebcb000 100755 (executable)
@@ -236,7 +236,7 @@ EOF
 
 test_expect_success 'set up faked signed tag' '
 
-       cat signed-tag-import | git fast-import
+       git fast-import <signed-tag-import
 
 '
 
@@ -537,7 +537,7 @@ test_expect_success 'full-tree re-shows unmodified files'        '
 
 test_expect_success 'set-up a few more tags for tag export tests' '
        git checkout -f main &&
-       HEAD_TREE=$(git show -s --pretty=raw HEAD | grep tree | sed "s/tree //") &&
+       HEAD_TREE=$(git show -s --pretty=raw HEAD | sed -n "/tree/s/tree //p") &&
        git tag    tree_tag        -m "tagging a tree" $HEAD_TREE &&
        git tag -a tree_tag-obj    -m "tagging a tree" $HEAD_TREE &&
        git tag    tag-obj_tag     -m "tagging a tag" tree_tag-obj &&
@@ -791,4 +791,14 @@ test_expect_success 'fast-export --first-parent outputs all revisions output by
        )
 '
 
+test_expect_success 'fast-export handles --end-of-options' '
+       git update-ref refs/heads/nodash HEAD &&
+       git update-ref refs/heads/--dashes HEAD &&
+       git fast-export --end-of-options nodash >expect &&
+       git fast-export --end-of-options --dashes >actual.raw &&
+       # fix up lines which mention the ref for comparison
+       sed s/--dashes/nodash/ <actual.raw >actual &&
+       test_cmp expect actual
+'
+
 test_done
index 003c0b61d0ff45864630782a509a018ff4079116..e499c7f955125eb25ce0dfdcd78012adf8cf4d7a 100755 (executable)
@@ -117,12 +117,12 @@ END VERIFICATION REQUEST
 EOF
 
 test_expect_success 'pserver authentication' '
-       cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
+       git-cvsserver pserver <request-anonymous >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
 test_expect_success 'pserver authentication failure (non-anonymous user)' '
-       if cat request-git | git-cvsserver pserver >log 2>&1
+       if git-cvsserver pserver <request-git >log 2>&1
        then
            false
        else
@@ -132,17 +132,17 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' '
 '
 
 test_expect_success 'pserver authentication success (non-anonymous user with password)' '
-       cat login-git-ok | git-cvsserver pserver >log 2>&1 &&
+       git-cvsserver pserver <login-git-ok >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
 test_expect_success 'pserver authentication (login)' '
-       cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
+       git-cvsserver pserver <login-anonymous >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
 test_expect_success 'pserver authentication failure (login/non-anonymous user)' '
-       if cat login-git | git-cvsserver pserver >log 2>&1
+       if git-cvsserver pserver <login-git >log 2>&1
        then
            false
        else
@@ -172,7 +172,7 @@ Root $WORKDIR
 EOF
 
 test_expect_success 'req_Root failure (relative pathname)' '
-       if cat request-relative | git-cvsserver pserver >log 2>&1
+       if git-cvsserver pserver <request-relative >log 2>&1
        then
                echo unexpected success
                false
@@ -183,28 +183,26 @@ test_expect_success 'req_Root failure (relative pathname)' '
 '
 
 test_expect_success 'req_Root failure (conflicting roots)' '
-       cat request-conflict | git-cvsserver pserver >log 2>&1 &&
+       git-cvsserver pserver <request-conflict >log 2>&1 &&
        tail log | grep "^error 1 Conflicting roots specified$"
 '
 
 test_expect_success 'req_Root (strict paths)' '
-       cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
+       git-cvsserver --strict-paths pserver "$SERVERDIR" <request-anonymous >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
 test_expect_success 'req_Root failure (strict-paths)' '
-       ! cat request-anonymous |
-       git-cvsserver --strict-paths pserver "$WORKDIR" >log 2>&1
+       ! git-cvsserver --strict-paths pserver "$WORKDIR" <request-anonymous >log 2>&1
 '
 
 test_expect_success 'req_Root (w/o strict-paths)' '
-       cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
+       git-cvsserver pserver "$WORKDIR/" <request-anonymous >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
 test_expect_success 'req_Root failure (w/o strict-paths)' '
-       ! cat request-anonymous |
-       git-cvsserver pserver "$WORKDIR/gitcvs" >log 2>&1
+       ! git-cvsserver pserver "$WORKDIR/gitcvs" <request-anonymous >log 2>&1
 '
 
 cat >request-base  <<EOF
@@ -217,27 +215,26 @@ Root /gitcvs.git
 EOF
 
 test_expect_success 'req_Root (base-path)' '
-       cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
+       git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" <request-base >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
 test_expect_success 'req_Root failure (base-path)' '
-       ! cat request-anonymous |
-       git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" >log 2>&1
+       ! git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" <request-anonymous >log 2>&1
 '
 
 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
 
 test_expect_success 'req_Root (export-all)' '
-       cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
+       git-cvsserver --export-all pserver "$WORKDIR" <request-anonymous >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
 test_expect_success 'req_Root failure (export-all w/o directory list)' '
-       ! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
+       ! (git-cvsserver --export-all pserver <request-anonymous >log 2>&1 || false)'
 
 test_expect_success 'req_Root (everything together)' '
-       cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
+       git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" <request-base >log 2>&1 &&
        sed -ne \$p log | grep "^I LOVE YOU\$"
 '
 
index 0333065d4d60a0113cb5ac1de391a4a997d2eaa8..7679780fb87b4f14e9c0f5a22708b1e8925a4d53 100755 (executable)
@@ -627,6 +627,7 @@ test_expect_success \
 test_expect_success 'setup' '
        version=$(git config core.repositoryformatversion) &&
        algo=$(test_might_fail git config extensions.objectformat) &&
+       refstorage=$(test_might_fail git config extensions.refstorage) &&
        cat >.git/config <<-\EOF &&
        # testing noval and alternate separator
        [gitweb]
@@ -637,6 +638,10 @@ test_expect_success 'setup' '
        if test -n "$algo"
        then
                git config extensions.objectformat "$algo"
+       fi &&
+       if test -n "$refstorage"
+       then
+               git config extensions.refstorage "$refstorage"
        fi
 '
 
index 6d753708d2acb6c7bcf47e5a057d99845c1006a3..d8e85482ab2ba7b28cb1e899f07dc1379969d1c1 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use lib (split(/:/, $ENV{GITPERLLIB}));
 
-use 5.008;
+use 5.008001;
 use warnings;
 use strict;
 
index a4b3cb94929c9cddfdb5a751f39b42acdb2529ab..53af8e34ac1c40a31dee6e6f4449f8c52dcf6f59 100755 (executable)
@@ -54,7 +54,7 @@ test_expect_success 'git p4 sync uninitialized repo' '
        (
                cd "$git" &&
                test_must_fail git p4 sync 2>errs &&
-               test_i18ngrep "Perhaps you never did" errs
+               test_grep "Perhaps you never did" errs
        )
 '
 
@@ -86,7 +86,7 @@ test_expect_success 'git p4 sync existing branch without changes' '
                test_commit head &&
                git p4 sync --branch=depot //depot@all &&
                git p4 sync --branch=refs/remotes/p4/depot >out &&
-               test_i18ngrep "No changes to import!" out
+               test_grep "No changes to import!" out
        )
 '
 
@@ -101,7 +101,7 @@ test_expect_success 'git p4 sync existing branch with relative name' '
                test_commit head &&
                git p4 sync --branch=branch1 //depot@all &&
                git p4 sync --branch=p4/branch1 >out &&
-               test_i18ngrep "No changes to import!" out
+               test_grep "No changes to import!" out
        )
 '
 
@@ -116,7 +116,7 @@ test_expect_success 'git p4 sync existing branch with nested path' '
                test_commit head &&
                git p4 sync --branch=p4/some/path //depot@all &&
                git p4 sync --branch=some/path >out &&
-               test_i18ngrep "No changes to import!" out
+               test_grep "No changes to import!" out
        )
 '
 
@@ -131,7 +131,7 @@ test_expect_success 'git p4 sync branch explicit ref without p4 in path' '
                test_commit head &&
                git p4 sync --branch=refs/remotes/someremote/depot //depot@all &&
                git p4 sync --branch=refs/remotes/someremote/depot >out &&
-               test_i18ngrep "No changes to import!" out
+               test_grep "No changes to import!" out
        )
 '
 
@@ -143,7 +143,7 @@ test_expect_success 'git p4 sync nonexistent ref' '
                test_commit head &&
                git p4 sync --branch=depot //depot@all &&
                test_must_fail git p4 sync --branch=depot2 2>errs &&
-               test_i18ngrep "Perhaps you never did" errs
+               test_grep "Perhaps you never did" errs
        )
 '
 
@@ -155,7 +155,7 @@ test_expect_success 'git p4 sync existing non-p4-imported ref' '
                test_commit head &&
                git p4 sync --branch=depot //depot@all &&
                test_must_fail git p4 sync --branch=refs/heads/master 2>errs &&
-               test_i18ngrep "Perhaps you never did" errs
+               test_grep "Perhaps you never did" errs
        )
 '
 
@@ -290,7 +290,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
                export PATH &&
                test_expect_code 1 git p4 clone --dest="$git" //depot >errs 2>&1
        ) &&
-       test_i18ngrep ! Traceback errs
+       test_grep ! Traceback errs
 '
 
 # Hide a file from p4d, make sure we catch its complaint.  This won't fail in
@@ -301,7 +301,7 @@ test_expect_success 'exit gracefully for p4 server errors' '
        mv "$db"/depot/file1,v "$db"/depot/file1,v,hidden &&
        test_when_finished cleanup_git &&
        test_expect_code 1 git p4 clone --dest="$git" //depot@1 >out 2>err &&
-       test_i18ngrep "Error from p4 print" err
+       test_grep "Error from p4 print" err
 '
 
 test_expect_success 'clone --bare should make a bare repository' '
index 759a14fa87ce6ae540b2c98cfd3b83a7bf6928f2..c598011635ac2f44d0764acaf1ba7c53f569514c 100755 (executable)
@@ -135,7 +135,7 @@ test_expect_success 'sync specific detected branch' '
        (
                cd "$git" &&
                git p4 sync --branch=depot/branch2 >out &&
-               test_i18ngrep "No changes to import!" out
+               test_grep "No changes to import!" out
        )
 '
 
@@ -466,7 +466,7 @@ test_expect_success 'git p4 clone complex branches with excluded files' '
        )
 '
 
-# From a report in http://stackoverflow.com/questions/11893688
+# From a report in https://stackoverflow.com/questions/11893688
 # where --use-client-spec caused branch prefixes not to be removed;
 # every file in git appeared into a subdirectory of the branch name.
 test_expect_success 'use-client-spec detect-branches setup' '
index 2a6ee2a46787f07c763c6d7608628c65d8181526..bb236cd2b57a3c21885237c5698dfa04ede92b55 100755 (executable)
@@ -175,7 +175,7 @@ test_expect_success 'keyword file create' '
                cp k-text-k k-text-ko &&
                p4 add -t text+ko k-text-ko &&
 
-               cat k-text-k | iconv -f ascii -t utf-16 >k-utf16-k &&
+               iconv -f ascii -t utf-16 <k-text-k >k-utf16-k &&
                p4 add -t utf16+k k-utf16-k &&
 
                cp k-utf16-k k-utf16-ko &&
index 7d4109f29d5e3b5751a9fba8b15c5a6d5d3e0fa6..6ae7ced51be1d4e0d649cea05f2373e592be73ef 100755 (executable)
@@ -75,7 +75,7 @@ test_expect_success 'submit --dry-run' '
                test_commit "dry-run1" &&
                test_commit "dry-run2" &&
                git p4 submit --dry-run >out &&
-               test_i18ngrep "Would apply" out
+               test_grep "Would apply" out
        ) &&
        (
                cd "$cli" &&
@@ -99,7 +99,7 @@ test_expect_success 'submit --dry-run --export-labels' '
                git commit -m "dry-run2" dry-run2 &&
                git tag -m "dry-run-tag1" dry-run-tag1 HEAD^ &&
                git p4 submit --dry-run --export-labels >out &&
-               test_i18ngrep "Would create p4 label" out
+               test_grep "Would create p4 label" out
        ) &&
        (
                cd "$cli" &&
@@ -418,7 +418,7 @@ test_expect_success 'description with Jobs and values on separate lines' '
                        marshal_dump job0 <change &&
                        marshal_dump job1 <change
                ) | sort >jobs &&
-               cat jobname1 jobname2 | sort >expected &&
+               sort jobname1 jobname2 >expected &&
                test_cmp expected jobs
        )
 '
@@ -443,7 +443,7 @@ test_expect_success 'description with Jobs section and bogus following text' '
                # build a job
                make_job $(cat jobname) &&
                test_must_fail git p4 submit 2>err &&
-               test_i18ngrep "Unknown field name" err
+               test_grep "Unknown field name" err
        ) &&
        (
                cd "$cli" &&
@@ -461,9 +461,9 @@ test_expect_success 'submit --prepare-p4-only' '
                git add prep-only-add &&
                git commit -m "prep only add" &&
                git p4 submit --prepare-p4-only >out &&
-               test_i18ngrep "prepared for submission" out &&
-               test_i18ngrep "must be deleted" out &&
-               test_i18ngrep ! "everything below this line is just the diff" out
+               test_grep "prepared for submission" out &&
+               test_grep "must be deleted" out &&
+               test_grep ! "everything below this line is just the diff" out
        ) &&
        (
                cd "$cli" &&
index 0ca9937de6cfcee5c762ab47dffdc6bd5e2195f5..c766fd159f14b69eb46f9dc9bfb4357fdd7a5e34 100755 (executable)
@@ -35,7 +35,7 @@ test_expect_success 'conflict on one commit' '
                git add file1 &&
                git commit -m "line3 in file1 will conflict" &&
                test_expect_code 1 git p4 submit >out &&
-               test_i18ngrep "No commits applied" out
+               test_grep "No commits applied" out
        )
 '
 
@@ -58,7 +58,7 @@ test_expect_success 'conflict on second of two commits' '
                git add file1 &&
                git commit -m "line4 in file1 will conflict" &&
                test_expect_code 1 git p4 submit >out &&
-               test_i18ngrep "Applied only the commits" out
+               test_grep "Applied only the commits" out
        )
 '
 
@@ -81,7 +81,7 @@ test_expect_success 'conflict on first of two commits, skip' '
                # but this commit is okay
                test_commit "okay_commit_after_skip" &&
                echo s | test_expect_code 1 git p4 submit >out &&
-               test_i18ngrep "Applied only the commits" out
+               test_grep "Applied only the commits" out
        )
 '
 
@@ -104,7 +104,7 @@ test_expect_success 'conflict on first of two commits, quit' '
                # but this commit is okay
                test_commit "okay_commit_after_quit" &&
                echo q | test_expect_code 1 git p4 submit >out &&
-               test_i18ngrep "No commits applied" out
+               test_grep "No commits applied" out
        )
 '
 
@@ -144,7 +144,7 @@ test_expect_success 'conflict on first of two commits, --conflict=skip' '
                # but this commit is okay
                test_commit "okay_commit_after_auto_skip" &&
                test_expect_code 1 git p4 submit --conflict=skip >out &&
-               test_i18ngrep "Applied only the commits" out
+               test_grep "Applied only the commits" out
        )
 '
 
@@ -167,7 +167,7 @@ test_expect_success 'conflict on first of two commits, --conflict=quit' '
                # but this commit is okay
                test_commit "okay_commit_after_auto_quit" &&
                test_expect_code 1 git p4 submit --conflict=quit >out &&
-               test_i18ngrep "No commits applied" out
+               test_grep "No commits applied" out
        )
 '
 
index 932841003cfc4e3f6273087f8567d6c6a660bb0b..5e904ac80d85226a74296774ef4279369da15d4a 100755 (executable)
@@ -9,7 +9,7 @@ test_expect_success 'start p4d' '
 '
 
 # See
-# http://www.perforce.com/perforce/doc.current/manuals/p4sag/03_superuser.html#1088563
+# https://web.archive.org/web/20150602090517/http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html#superuser.basic.typemap_locking
 # for suggestions on how to configure "sitewide pessimistic locking"
 # where only one person can have a file open for edit at a time.
 test_expect_success 'init depot' '
index a28dbbdd566ca69212f23958056d95b735a0127c..80c8c31e320fd5bbf0912d093682dcad3f287fc3 100755 (executable)
@@ -17,8 +17,8 @@ test_file_in_lfs () {
        sed -n '2,2 p' "$FILE" | grep "^oid " &&
        sed -n '3,3 p' "$FILE" | grep "^size " &&
        test_line_count = 3 "$FILE" &&
-       cat "$FILE" | grep "size $SIZE" &&
-       HASH=$(cat "$FILE" | grep "oid sha256:" | sed -e "s/oid sha256://g") &&
+       grep "size $SIZE" "$FILE" &&
+       HASH=$(sed -ne "/oid sha256:/s/oid sha256://gp" "$FILE") &&
        LFS_FILE=".git/lfs/objects/$(echo "$HASH" | cut -c1-2)/$(echo "$HASH" | cut -c3-4)/$HASH" &&
        echo $EXPECTED_CONTENT >expect &&
        test_path_is_file "$FILE" &&
index 8835e16e8110f458885c977d4002685a2fc16662..569cf2310434358d268028ea8d26361727bf8652 100755 (executable)
@@ -5,6 +5,17 @@
 
 test_description='test bash completion'
 
+# The Bash completion scripts must not print anything to either stdout or
+# stderr, which we try to verify. When tracing is enabled without support for
+# BASH_XTRACEFD this assertion will fail, so we have to mark the test as
+# untraceable with such ancient Bash versions.
+test_untraceable=UnfortunatelyYes
+
+# Override environment and always use master for the default initial branch
+# name for these tests, so that rev completion candidates are as expected.
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
 . ./lib-bash.sh
 
 complete ()
@@ -87,9 +98,11 @@ test_completion ()
        else
                sed -e 's/Z$//' |sort >expected
        fi &&
-       run_completion "$1" &&
+       run_completion "$1" >"$TRASH_DIRECTORY"/bash-completion-output 2>&1 &&
        sort out >out_sorted &&
-       test_cmp expected out_sorted
+       test_cmp expected out_sorted &&
+       test_must_be_empty "$TRASH_DIRECTORY"/bash-completion-output &&
+       rm "$TRASH_DIRECTORY"/bash-completion-output
 }
 
 # Test __gitcomp.
@@ -1250,6 +1263,29 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' '
        test_cmp expected out
 '
 
+test_expect_success '__git_complete_worktree_paths' '
+       test_when_finished "git worktree remove other_wt" &&
+       git worktree add --orphan other_wt &&
+       run_completion "git worktree remove " &&
+       grep other_wt out
+'
+
+test_expect_success '__git_complete_worktree_paths - not a git repository' '
+       (
+               cd non-repo &&
+               GIT_CEILING_DIRECTORIES="$ROOT" &&
+               export GIT_CEILING_DIRECTORIES &&
+               test_completion "git worktree remove " ""
+       )
+'
+
+test_expect_success '__git_complete_worktree_paths with -C' '
+       test_when_finished "git -C otherrepo worktree remove otherrepo_wt" &&
+       git -C otherrepo worktree add --orphan otherrepo_wt &&
+       run_completion "git -C otherrepo worktree remove " &&
+       grep otherrepo_wt out
+'
+
 test_expect_success 'git switch - with no options, complete local branches and unique remote branch names for DWIM logic' '
        test_completion "git switch " <<-\EOF
        branch-in-other Z
@@ -1259,6 +1295,142 @@ test_expect_success 'git switch - with no options, complete local branches and u
        EOF
 '
 
+test_expect_success 'git bisect - when not bisecting, complete only replay and start subcommands' '
+       test_completion "git bisect " <<-\EOF
+       replay Z
+       start Z
+       EOF
+'
+
+test_expect_success 'git bisect - complete options to start subcommand' '
+       test_completion "git bisect start --" <<-\EOF
+       --term-new Z
+       --term-bad Z
+       --term-old Z
+       --term-good Z
+       --no-checkout Z
+       --first-parent Z
+       EOF
+'
+
+test_expect_success 'setup for git-bisect tests requiring a repo' '
+       git init git-bisect &&
+       (
+               cd git-bisect &&
+               echo "initial contents" >file &&
+               git add file &&
+               git commit -am "Initial commit" &&
+               git tag initial &&
+               echo "new line" >>file &&
+               git commit -am "First change" &&
+               echo "another new line" >>file &&
+               git commit -am "Second change" &&
+               git tag final
+       )
+'
+
+test_expect_success 'git bisect - start subcommand arguments before double-dash are completed as revs' '
+       (
+               cd git-bisect &&
+               test_completion "git bisect start " <<-\EOF
+               HEAD Z
+               final Z
+               initial Z
+               master Z
+               EOF
+       )
+'
+
+# Note that these arguments are <pathspec>s, which in practice the fallback
+# completion (not the git completion) later ends up completing as paths.
+test_expect_success 'git bisect - start subcommand arguments after double-dash are not completed' '
+       (
+               cd git-bisect &&
+               test_completion "git bisect start final initial -- " ""
+       )
+'
+
+test_expect_success 'setup for git-bisect tests requiring ongoing bisection' '
+       (
+               cd git-bisect &&
+               git bisect start --term-new=custom_new --term-old=custom_old final initial
+       )
+'
+
+test_expect_success 'git-bisect - when bisecting all subcommands are candidates' '
+       (
+               cd git-bisect &&
+               test_completion "git bisect " <<-\EOF
+               start Z
+               bad Z
+               custom_new Z
+               custom_old Z
+               new Z
+               good Z
+               old Z
+               terms Z
+               skip Z
+               reset Z
+               visualize Z
+               replay Z
+               log Z
+               run Z
+               help Z
+               EOF
+       )
+'
+
+test_expect_success 'git-bisect - options to terms subcommand are candidates' '
+       (
+               cd git-bisect &&
+               test_completion "git bisect terms --" <<-\EOF
+               --term-bad Z
+               --term-good Z
+               --term-new Z
+               --term-old Z
+               EOF
+       )
+'
+
+test_expect_success 'git-bisect - git-log options to visualize subcommand are candidates' '
+       (
+               cd git-bisect &&
+               # The completion used for git-log and here does not complete
+               # every git-log option, so rather than hope to stay in sync
+               # with exactly what it does we will just spot-test here.
+               test_completion "git bisect visualize --sta" <<-\EOF &&
+               --stat Z
+               EOF
+               test_completion "git bisect visualize --summar" <<-\EOF
+               --summary Z
+               EOF
+       )
+'
+
+test_expect_success 'git-bisect - view subcommand is not a candidate' '
+       (
+               cd git-bisect &&
+               test_completion "git bisect vi" <<-\EOF
+               visualize Z
+               EOF
+       )
+'
+
+test_expect_success 'git-bisect - existing view subcommand is recognized and enables completion of git-log options' '
+       (
+               cd git-bisect &&
+               # The completion used for git-log and here does not complete
+               # every git-log option, so rather than hope to stay in sync
+               # with exactly what it does we will just spot-test here.
+               test_completion "git bisect view --sta" <<-\EOF &&
+               --stat Z
+               EOF
+               test_completion "git bisect view --summar" <<-\EOF
+               --summary Z
+               EOF
+       )
+'
+
 test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' '
        test_completion "git checkout " <<-\EOF
        HEAD Z
@@ -1571,7 +1743,7 @@ test_expect_success FUNNYNAMES,!CYGWIN 'cone mode sparse-checkout completes dire
        )
 '
 
-test_expect_success 'non-cone mode sparse-checkout uses bash completion' '
+test_expect_success 'non-cone mode sparse-checkout gives rooted paths' '
        # reset sparse-checkout repo to non-cone mode
        git -C sparse-checkout sparse-checkout disable &&
        git -C sparse-checkout sparse-checkout set --no-cone &&
@@ -1581,7 +1753,12 @@ test_expect_success 'non-cone mode sparse-checkout uses bash completion' '
                # expected to be empty since we have not configured
                # custom completion for non-cone mode
                test_completion "git sparse-checkout set f" <<-\EOF
-
+               /folder1/0/1/t.txt Z
+               /folder1/expected Z
+               /folder1/out Z
+               /folder1/out_sorted Z
+               /folder2/0/t.txt Z
+               /folder3/t.txt Z
                EOF
        )
 '
@@ -1622,14 +1799,22 @@ test_expect_success 'git checkout - with -d, complete only references' '
 '
 
 test_expect_success 'git switch - with --track, complete only remote branches' '
-       test_completion "git switch --track " <<-\EOF
+       test_completion "git switch --track " <<-\EOF &&
+       other/branch-in-other Z
+       other/main-in-other Z
+       EOF
+       test_completion "git switch -t " <<-\EOF
        other/branch-in-other Z
        other/main-in-other Z
        EOF
 '
 
 test_expect_success 'git checkout - with --track, complete only remote branches' '
-       test_completion "git checkout --track " <<-\EOF
+       test_completion "git checkout --track " <<-\EOF &&
+       other/branch-in-other Z
+       other/main-in-other Z
+       EOF
+       test_completion "git checkout -t " <<-\EOF
        other/branch-in-other Z
        other/main-in-other Z
        EOF
@@ -1912,6 +2097,14 @@ test_expect_success 'git checkout - --orphan with branch already provided comple
        EOF
 '
 
+test_expect_success 'git restore completes modified files' '
+       test_commit A a.file &&
+       echo B >a.file &&
+       test_completion "git restore a." <<-\EOF
+       a.file
+       EOF
+'
+
 test_expect_success 'teardown after ref completion' '
        git branch -d matching-branch &&
        git tag -d matching-tag &&
@@ -2456,6 +2649,24 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c
        EOF
 '
 
+test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd> ; ... }' '
+       test_config alias.co "!f() { : checkout ; if ... } f" &&
+       test_completion "git co m" <<-\EOF
+       main Z
+       mybranch Z
+       mytag Z
+       EOF
+'
+
+test_expect_success 'completion used <cmd> completion for alias: !f() { : <cmd>; ... }' '
+       test_config alias.co "!f() { : checkout; if ... } f" &&
+       test_completion "git co m" <<-\EOF
+       main Z
+       mybranch Z
+       mytag Z
+       EOF
+'
+
 test_expect_success 'completion without explicit _git_xxx function' '
        test_completion "git version --" <<-\EOF
        --build-options Z
@@ -2536,6 +2747,35 @@ test_expect_success 'git config - variable name include' '
        EOF
 '
 
+test_expect_success 'setup for git config submodule tests' '
+       test_create_repo sub &&
+       test_commit -C sub initial &&
+       git submodule add ./sub
+'
+
+test_expect_success 'git config - variable name - submodule and __git_compute_first_level_config_vars_for_section' '
+       test_completion "git config submodule." <<-\EOF
+       submodule.active Z
+       submodule.alternateErrorStrategy Z
+       submodule.alternateLocation Z
+       submodule.fetchJobs Z
+       submodule.propagateBranches Z
+       submodule.recurse Z
+       submodule.sub.Z
+       EOF
+'
+
+test_expect_success 'git config - variable name - __git_compute_second_level_config_vars_for_section' '
+       test_completion "git config submodule.sub." <<-\EOF
+       submodule.sub.url Z
+       submodule.sub.update Z
+       submodule.sub.branch Z
+       submodule.sub.fetchRecurseSubmodules Z
+       submodule.sub.ignore Z
+       submodule.sub.active Z
+       EOF
+'
+
 test_expect_success 'git config - value' '
        test_completion "git config color.pager " <<-\EOF
        false Z
@@ -2587,6 +2827,20 @@ test_expect_success 'git clone --config= - value' '
        EOF
 '
 
+test_expect_success 'git reflog show' '
+       test_when_finished "git checkout - && git branch -d shown" &&
+       git checkout -b shown &&
+       test_completion "git reflog sho" <<-\EOF &&
+       show Z
+       shown Z
+       EOF
+       test_completion "git reflog show sho" "shown " &&
+       test_completion "git reflog shown sho" "shown " &&
+       test_completion "git reflog --unt" "--until=" &&
+       test_completion "git reflog show --unt" "--until=" &&
+       test_completion "git reflog shown --unt" "--until="
+'
+
 test_expect_success 'options with value' '
        test_completion "git merge -X diff-algorithm=" <<-\EOF
 
@@ -2689,4 +2943,31 @@ test_expect_success '__git_complete' '
        test_must_fail __git_complete ga missing
 '
 
+test_expect_success '__git_pseudoref_exists' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               sane_unset __git_repo_path &&
+
+               # HEAD should exist, even if it points to an unborn branch.
+               __git_pseudoref_exists HEAD >output 2>&1 &&
+               test_must_be_empty output &&
+
+               # HEAD points to an existing branch, so it should exist.
+               test_commit A &&
+               __git_pseudoref_exists HEAD >output 2>&1 &&
+               test_must_be_empty output &&
+
+               # CHERRY_PICK_HEAD does not exist, so the existence check should fail.
+               ! __git_pseudoref_exists CHERRY_PICK_HEAD >output 2>&1 &&
+               test_must_be_empty output &&
+
+               # CHERRY_PICK_HEAD points to a commit, so it should exist.
+               git update-ref CHERRY_PICK_HEAD A &&
+               __git_pseudoref_exists CHERRY_PICK_HEAD >output 2>&1 &&
+               test_must_be_empty output
+       )
+'
+
 test_done
index 92b462e2e7111ff9e0dea762ed32f43eb4249a30..2eccf100c024e21363ac799a1d032470ede16ae9 100644 (file)
@@ -14,7 +14,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 
 # The semantics of the editor variables are that of invoking
 # sh -c "$EDITOR \"$@\"" files ...
@@ -251,6 +251,61 @@ debug () {
        done
 }
 
+# Usage: test_ref_exists [options] <ref>
+#
+#   -C <dir>:
+#      Run all git commands in directory <dir>
+#
+# This helper function checks whether a reference exists. Symrefs or object IDs
+# will not be resolved. Can be used to check references with bad names.
+test_ref_exists () {
+       local indir=
+
+       while test $# != 0
+       do
+               case "$1" in
+               -C)
+                       indir="$2"
+                       shift
+                       ;;
+               *)
+                       break
+                       ;;
+               esac
+               shift
+       done &&
+
+       indir=${indir:+"$indir"/} &&
+
+       if test "$#" != 1
+       then
+               BUG "expected exactly one reference"
+       fi &&
+
+       git ${indir:+ -C "$indir"} show-ref --exists "$1"
+}
+
+# Behaves the same as test_ref_exists, except that it checks for the absence of
+# a reference. This is preferable to `! test_ref_exists` as this function is
+# able to distinguish actually-missing references from other, generic errors.
+test_ref_missing () {
+       test_ref_exists "$@"
+       case "$?" in
+       2)
+               # This is the good case.
+               return 0
+               ;;
+       0)
+               echo >&4 "test_ref_missing: reference exists"
+               return 1
+               ;;
+       *)
+               echo >&4 "test_ref_missing: generic error"
+               return 1
+               ;;
+       esac
+}
+
 # Usage: test_commit [options] <message> [<file> [<contents> [<tag>]]]
 #   -C <dir>:
 #      Run all git commands in directory <dir>
@@ -1208,19 +1263,20 @@ test_cmp_bin () {
        cmp "$@"
 }
 
-# Wrapper for grep which used to be used for
-# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other
-# in-flight changes. Should not be used and will be removed soon.
 test_i18ngrep () {
+       BUG "do not use test_i18ngrep---use test_grep instead"
+}
+
+test_grep () {
        eval "last_arg=\${$#}"
 
        test -f "$last_arg" ||
-       BUG "test_i18ngrep requires a file to read as the last parameter"
+       BUG "test_grep requires a file to read as the last parameter"
 
        if test $# -lt 2 ||
           { test "x!" = "x$1" && test $# -lt 3 ; }
        then
-               BUG "too few parameters to test_i18ngrep"
+               BUG "too few parameters to test_grep"
        fi
 
        if test "x!" = "x$1"
@@ -1611,6 +1667,11 @@ test_detect_hash () {
        esac
 }
 
+# Detect the hash algorithm in use.
+test_detect_ref_format () {
+       echo "${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
+}
+
 # Load common hash metadata and common placeholder object IDs for use with
 # test_oid.
 test_oid_init () {
@@ -1832,6 +1893,20 @@ test_region () {
        return 0
 }
 
+# Check that the given data fragment was included as part of the
+# trace2-format trace on stdin.
+#
+#      test_trace2_data <category> <key> <value>
+#
+# For example, to look for trace2_data_intmax("pack-objects", repo,
+# "reused", N) in an invocation of "git pack-objects", run:
+#
+#      GIT_TRACE2_EVENT="$(pwd)/trace.txt" git pack-objects ... &&
+#      test_trace2_data pack-objects reused N <trace2.txt
+test_trace2_data () {
+       grep -e '"category":"'"$1"'","key":"'"$2"'","value":"'"$3"'"'
+}
+
 # Given a GIT_TRACE2_EVENT log over stdin, writes to stdout a list of URLs
 # sent to git-remote-https child processes.
 test_remote_https_urls() {
index 9c5339c577ac3fd50090baf0d84caf6d62df0697..33405c90d740d4c4e4fac93cfa8a713939a39348 100644 (file)
@@ -14,7 +14,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 #
 # The idea is for `test-lib.sh` to source this file when run in GitHub
 # workflows; these functions will then override (empty) functions
@@ -42,8 +42,8 @@ finalize_test_case_output () {
        fixed)
                echo >>$github_markup_output "::notice::fixed: $this_test.$test_count $1"
                ;;
-       ok)
-               # Exit without printing the "ok" tests
+       ok|broken)
+               # Exit without printing the "ok" or ""broken" tests
                return
                ;;
        esac
index 79c31c788b921baa3118c918f731ed46b450393b..76cbbd3299d64a82276c0aa30241479388014af8 100644 (file)
@@ -15,7 +15,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 #
 # The idea is for `test-lib.sh` to source this file when the user asks
 # for JUnit XML; these functions will then override (empty) functions
index 293caf0f20e67a366b347064875c60061ecabf89..c8af8dab795604998475e5fdff21137534c7f39b 100644 (file)
@@ -13,7 +13,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 
 # Test the binaries we have just built.  The tests are kept in
 # t/ subdirectory and are run in 'trash directory' subdirectory.
@@ -89,6 +89,9 @@ prepend_var LSAN_OPTIONS : $GIT_SAN_OPTIONS
 prepend_var LSAN_OPTIONS : fast_unwind_on_malloc=0
 export LSAN_OPTIONS
 
+prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
+export UBSAN_OPTIONS
+
 if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 then
        echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ -334,6 +337,7 @@ nr_san_dir_leaks_ () {
        find "$TEST_RESULTS_SAN_DIR" \
                -type f \
                -name "$TEST_RESULTS_SAN_FILE_PFX.*" 2>/dev/null |
+       xargs grep -lv "Unable to get registers from thread" |
        wc -l
 }
 
@@ -538,6 +542,8 @@ export EDITOR
 
 GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-sha1}"
 export GIT_DEFAULT_HASH
+GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
+export GIT_DEFAULT_REF_FORMAT
 GIT_TEST_MERGE_ALGORITHM="${GIT_TEST_MERGE_ALGORITHM:-ort}"
 export GIT_TEST_MERGE_ALGORITHM
 
@@ -1291,6 +1297,11 @@ test_done () {
                EOF
        fi
 
+       if test -z "$passes_sanitize_leak" && test_bool_env TEST_PASSES_SANITIZE_LEAK false
+       then
+               BAIL_OUT "Please, set TEST_PASSES_SANITIZE_LEAK before sourcing test-lib.sh"
+       fi
+
        if test "$test_fixed" != 0
        then
                say_color error "# $test_fixed known breakage(s) vanished; please update test(s)"
@@ -1741,7 +1752,16 @@ parisc* | hppa*)
        ;;
 esac
 
-test_set_prereq REFFILES
+case "$GIT_DEFAULT_REF_FORMAT" in
+files)
+       test_set_prereq REFFILES;;
+reftable)
+       test_set_prereq REFTABLE;;
+*)
+       echo 2>&1 "error: unknown ref format $GIT_DEFAULT_REF_FORMAT"
+       exit 1
+       ;;
+esac
 
 ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
 test -z "$NO_CURL" && test_set_prereq LIBCURL
@@ -1932,6 +1952,10 @@ test_lazy_prereq SHA1 '
        esac
 '
 
+test_lazy_prereq DEFAULT_REPO_FORMAT '
+       test_have_prereq SHA1,REFFILES
+'
+
 # Ensure that no test accidentally triggers a Git command
 # that runs the actual maintenance scheduler, affecting a user's
 # system permanently.
index 1bcf01a9a42a6147a85db9bb4d82523740a95ad7..3810e9bb43190322cd932d520ace6ab1e874be82 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use IO::Pty;
diff --git a/t/unit-tests/.gitignore b/t/unit-tests/.gitignore
new file mode 100644 (file)
index 0000000..5e56e04
--- /dev/null
@@ -0,0 +1 @@
+/bin
diff --git a/t/unit-tests/t-basic.c b/t/unit-tests/t-basic.c
new file mode 100644 (file)
index 0000000..fda1ae5
--- /dev/null
@@ -0,0 +1,95 @@
+#include "test-lib.h"
+
+/*
+ * The purpose of this "unit test" is to verify a few invariants of the unit
+ * test framework itself, as well as to provide examples of output from actually
+ * failing tests. As such, it is intended that this test fails, and thus it
+ * should not be run as part of `make unit-tests`. Instead, we verify it behaves
+ * as expected in the integration test t0080-unit-test-output.sh
+ */
+
+/* Used to store the return value of check_int(). */
+static int check_res;
+
+/* Used to store the return value of TEST(). */
+static int test_res;
+
+static void t_res(int expect)
+{
+       check_int(check_res, ==, expect);
+       check_int(test_res, ==, expect);
+}
+
+static void t_todo(int x)
+{
+       check_res = TEST_TODO(check(x));
+}
+
+static void t_skip(void)
+{
+       check(0);
+       test_skip("missing prerequisite");
+       check(1);
+}
+
+static int do_skip(void)
+{
+       test_skip("missing prerequisite");
+       return 1;
+}
+
+static void t_skip_todo(void)
+{
+       check_res = TEST_TODO(do_skip());
+}
+
+static void t_todo_after_fail(void)
+{
+       check(0);
+       TEST_TODO(check(0));
+}
+
+static void t_fail_after_todo(void)
+{
+       check(1);
+       TEST_TODO(check(0));
+       check(0);
+}
+
+static void t_messages(void)
+{
+       check_str("\thello\\", "there\"\n");
+       check_str("NULL", NULL);
+       check_char('a', ==, '\n');
+       check_char('\\', ==, '\'');
+}
+
+static void t_empty(void)
+{
+       ; /* empty */
+}
+
+int cmd_main(int argc, const char **argv)
+{
+       test_res = TEST(check_res = check_int(1, ==, 1), "passing test");
+       TEST(t_res(1), "passing test and assertion return 1");
+       test_res = TEST(check_res = check_int(1, ==, 2), "failing test");
+       TEST(t_res(0), "failing test and assertion return 0");
+       test_res = TEST(t_todo(0), "passing TEST_TODO()");
+       TEST(t_res(1), "passing TEST_TODO() returns 1");
+       test_res = TEST(t_todo(1), "failing TEST_TODO()");
+       TEST(t_res(0), "failing TEST_TODO() returns 0");
+       test_res = TEST(t_skip(), "test_skip()");
+       TEST(check_int(test_res, ==, 1), "skipped test returns 1");
+       test_res = TEST(t_skip_todo(), "test_skip() inside TEST_TODO()");
+       TEST(t_res(1), "test_skip() inside TEST_TODO() returns 1");
+       test_res = TEST(t_todo_after_fail(), "TEST_TODO() after failing check");
+       TEST(check_int(test_res, ==, 0), "TEST_TODO() after failing check returns 0");
+       test_res = TEST(t_fail_after_todo(), "failing check after TEST_TODO()");
+       TEST(check_int(test_res, ==, 0), "failing check after TEST_TODO() returns 0");
+       TEST(t_messages(), "messages from failing string and char comparison");
+       test_res = TEST(t_empty(), "test with no checks");
+       TEST(check_int(test_res, ==, 0), "test with no checks returns 0");
+
+       return test_done();
+}
diff --git a/t/unit-tests/t-ctype.c b/t/unit-tests/t-ctype.c
new file mode 100644 (file)
index 0000000..d6ac1fe
--- /dev/null
@@ -0,0 +1,53 @@
+#include "test-lib.h"
+
+#define TEST_CHAR_CLASS(class, string) do { \
+       size_t len = ARRAY_SIZE(string) - 1 + \
+               BUILD_ASSERT_OR_ZERO(ARRAY_SIZE(string) > 0) + \
+               BUILD_ASSERT_OR_ZERO(sizeof(string[0]) == sizeof(char)); \
+       int skip = test__run_begin(); \
+       if (!skip) { \
+               for (int i = 0; i < 256; i++) { \
+                       if (!check_int(class(i), ==, !!memchr(string, i, len)))\
+                               test_msg("      i: 0x%02x", i); \
+               } \
+               check(!class(EOF)); \
+       } \
+       test__run_end(!skip, TEST_LOCATION(), #class " works"); \
+} while (0)
+
+#define DIGIT "0123456789"
+#define LOWER "abcdefghijklmnopqrstuvwxyz"
+#define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define PUNCT "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
+#define ASCII \
+       "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
+       "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
+       "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" \
+       "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" \
+       "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" \
+       "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" \
+       "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
+       "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+#define CNTRL \
+       "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
+       "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
+       "\x7f"
+
+int cmd_main(int argc, const char **argv) {
+       TEST_CHAR_CLASS(isspace, " \n\r\t");
+       TEST_CHAR_CLASS(isdigit, DIGIT);
+       TEST_CHAR_CLASS(isalpha, LOWER UPPER);
+       TEST_CHAR_CLASS(isalnum, LOWER UPPER DIGIT);
+       TEST_CHAR_CLASS(is_glob_special, "*?[\\");
+       TEST_CHAR_CLASS(is_regex_special, "$()*+.?[\\^{|");
+       TEST_CHAR_CLASS(is_pathspec_magic, "!\"#%&',-/:;<=>@_`~");
+       TEST_CHAR_CLASS(isascii, ASCII);
+       TEST_CHAR_CLASS(islower, LOWER);
+       TEST_CHAR_CLASS(isupper, UPPER);
+       TEST_CHAR_CLASS(iscntrl, CNTRL);
+       TEST_CHAR_CLASS(ispunct, PUNCT);
+       TEST_CHAR_CLASS(isxdigit, DIGIT "abcdefABCDEF");
+       TEST_CHAR_CLASS(isprint, LOWER UPPER DIGIT PUNCT " ");
+
+       return test_done();
+}
diff --git a/t/unit-tests/t-mem-pool.c b/t/unit-tests/t-mem-pool.c
new file mode 100644 (file)
index 0000000..a0d57df
--- /dev/null
@@ -0,0 +1,31 @@
+#include "test-lib.h"
+#include "mem-pool.h"
+
+static void setup_static(void (*f)(struct mem_pool *), size_t block_alloc)
+{
+       struct mem_pool pool = { .block_alloc = block_alloc };
+       f(&pool);
+       mem_pool_discard(&pool, 0);
+}
+
+static void t_calloc_100(struct mem_pool *pool)
+{
+       size_t size = 100;
+       char *buffer = mem_pool_calloc(pool, 1, size);
+       for (size_t i = 0; i < size; i++)
+               check_int(buffer[i], ==, 0);
+       if (!check(pool->mp_block != NULL))
+               return;
+       check(pool->mp_block->next_free != NULL);
+       check(pool->mp_block->end != NULL);
+}
+
+int cmd_main(int argc, const char **argv)
+{
+       TEST(setup_static(t_calloc_100, 1024 * 1024),
+            "mem_pool_calloc returns 100 zeroed bytes with big block");
+       TEST(setup_static(t_calloc_100, 1),
+            "mem_pool_calloc returns 100 zeroed bytes with tiny block");
+
+       return test_done();
+}
diff --git a/t/unit-tests/t-prio-queue.c b/t/unit-tests/t-prio-queue.c
new file mode 100644 (file)
index 0000000..d78b002
--- /dev/null
@@ -0,0 +1,98 @@
+#include "test-lib.h"
+#include "prio-queue.h"
+
+static int intcmp(const void *va, const void *vb, void *data UNUSED)
+{
+       const int *a = va, *b = vb;
+       return *a - *b;
+}
+
+
+#define MISSING  -1
+#define DUMP    -2
+#define STACK   -3
+#define GET     -4
+#define REVERSE  -5
+
+static int show(int *v)
+{
+       return v ? *v : MISSING;
+}
+
+static void test_prio_queue(int *input, int *result, size_t input_size)
+{
+       struct prio_queue pq = { intcmp };
+
+       for (int i = 0, j = 0; i < input_size; i++) {
+               void *peek, *get;
+               switch(input[i]) {
+               case GET:
+                       peek = prio_queue_peek(&pq);
+                       get = prio_queue_get(&pq);
+                       if (!check(peek == get))
+                               return;
+                       if(!check_int(result[j++], ==, show(get)))
+                               test_msg("failed at result[] index %d", j-1);
+                       break;
+               case DUMP:
+                       while ((peek = prio_queue_peek(&pq))) {
+                               get = prio_queue_get(&pq);
+                               if (!check(peek == get))
+                                       return;
+                               if(!check_int(result[j++], ==, show(get)))
+                                       test_msg("failed at result[] index %d", j-1);
+                       }
+                       break;
+               case STACK:
+                       pq.compare = NULL;
+                       break;
+               case REVERSE:
+                       prio_queue_reverse(&pq);
+                       break;
+               default:
+                       prio_queue_put(&pq, &input[i]);
+                       break;
+               }
+       }
+       clear_prio_queue(&pq);
+}
+
+#define BASIC_INPUT 2, 6, 3, 10, 9, 5, 7, 4, 5, 8, 1, DUMP
+#define BASIC_RESULT 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10
+
+#define MIXED_PUT_GET_INPUT 6, 2, 4, GET, 5, 3, GET, GET, 1, DUMP
+#define MIXED_PUT_GET_RESULT 2, 3, 4, 1, 5, 6
+
+#define EMPTY_QUEUE_INPUT 1, 2, GET, GET, GET, 1, 2, GET, GET, GET
+#define EMPTY_QUEUE_RESULT 1, 2, MISSING, 1, 2, MISSING
+
+#define STACK_INPUT STACK, 8, 1, 5, 4, 6, 2, 3, DUMP
+#define STACK_RESULT 3, 2, 6, 4, 5, 1, 8
+
+#define REVERSE_STACK_INPUT STACK, 1, 2, 3, 4, 5, 6, REVERSE, DUMP
+#define REVERSE_STACK_RESULT 1, 2, 3, 4, 5, 6
+
+#define TEST_INPUT(INPUT, RESULT, name)                        \
+  static void test_##name(void)                                \
+{                                                              \
+       int input[] = {INPUT};                                  \
+       int result[] = {RESULT};                                \
+       test_prio_queue(input, result, ARRAY_SIZE(input));      \
+}
+
+TEST_INPUT(BASIC_INPUT, BASIC_RESULT, basic)
+TEST_INPUT(MIXED_PUT_GET_INPUT, MIXED_PUT_GET_RESULT, mixed)
+TEST_INPUT(EMPTY_QUEUE_INPUT, EMPTY_QUEUE_RESULT, empty)
+TEST_INPUT(STACK_INPUT, STACK_RESULT, stack)
+TEST_INPUT(REVERSE_STACK_INPUT, REVERSE_STACK_RESULT, reverse)
+
+int cmd_main(int argc, const char **argv)
+{
+       TEST(test_basic(), "prio-queue works for basic input");
+       TEST(test_mixed(), "prio-queue works for mixed put & get commands");
+       TEST(test_empty(), "prio-queue works when queue is empty");
+       TEST(test_stack(), "prio-queue works when used as a LIFO stack");
+       TEST(test_reverse(), "prio-queue works when LIFO stack is reversed");
+
+       return test_done();
+}
diff --git a/t/unit-tests/t-strbuf.c b/t/unit-tests/t-strbuf.c
new file mode 100644 (file)
index 0000000..de434a4
--- /dev/null
@@ -0,0 +1,120 @@
+#include "test-lib.h"
+#include "strbuf.h"
+
+/* wrapper that supplies tests with an empty, initialized strbuf */
+static void setup(void (*f)(struct strbuf*, void*), void *data)
+{
+       struct strbuf buf = STRBUF_INIT;
+
+       f(&buf, data);
+       strbuf_release(&buf);
+       check_uint(buf.len, ==, 0);
+       check_uint(buf.alloc, ==, 0);
+}
+
+/* wrapper that supplies tests with a populated, initialized strbuf */
+static void setup_populated(void (*f)(struct strbuf*, void*), char *init_str, void *data)
+{
+       struct strbuf buf = STRBUF_INIT;
+
+       strbuf_addstr(&buf, init_str);
+       check_uint(buf.len, ==, strlen(init_str));
+       f(&buf, data);
+       strbuf_release(&buf);
+       check_uint(buf.len, ==, 0);
+       check_uint(buf.alloc, ==, 0);
+}
+
+static int assert_sane_strbuf(struct strbuf *buf)
+{
+       /* Initialized strbufs should always have a non-NULL buffer */
+       if (!check(!!buf->buf))
+               return 0;
+       /* Buffers should always be NUL-terminated */
+       if (!check_char(buf->buf[buf->len], ==, '\0'))
+               return 0;
+       /*
+        * Freshly-initialized strbufs may not have a dynamically allocated
+        * buffer
+        */
+       if (buf->len == 0 && buf->alloc == 0)
+               return 1;
+       /* alloc must be at least one byte larger than len */
+       return check_uint(buf->len, <, buf->alloc);
+}
+
+static void t_static_init(void)
+{
+       struct strbuf buf = STRBUF_INIT;
+
+       check_uint(buf.len, ==, 0);
+       check_uint(buf.alloc, ==, 0);
+       check_char(buf.buf[0], ==, '\0');
+}
+
+static void t_dynamic_init(void)
+{
+       struct strbuf buf;
+
+       strbuf_init(&buf, 1024);
+       check(assert_sane_strbuf(&buf));
+       check_uint(buf.len, ==, 0);
+       check_uint(buf.alloc, >=, 1024);
+       check_char(buf.buf[0], ==, '\0');
+       strbuf_release(&buf);
+}
+
+static void t_addch(struct strbuf *buf, void *data)
+{
+       const char *p_ch = data;
+       const char ch = *p_ch;
+       size_t orig_alloc = buf->alloc;
+       size_t orig_len = buf->len;
+
+       if (!check(assert_sane_strbuf(buf)))
+               return;
+       strbuf_addch(buf, ch);
+       if (!check(assert_sane_strbuf(buf)))
+               return;
+       if (!(check_uint(buf->len, ==, orig_len + 1) &&
+             check_uint(buf->alloc, >=, orig_alloc)))
+               return; /* avoid de-referencing buf->buf */
+       check_char(buf->buf[buf->len - 1], ==, ch);
+       check_char(buf->buf[buf->len], ==, '\0');
+}
+
+static void t_addstr(struct strbuf *buf, void *data)
+{
+       const char *text = data;
+       size_t len = strlen(text);
+       size_t orig_alloc = buf->alloc;
+       size_t orig_len = buf->len;
+
+       if (!check(assert_sane_strbuf(buf)))
+               return;
+       strbuf_addstr(buf, text);
+       if (!check(assert_sane_strbuf(buf)))
+               return;
+       if (!(check_uint(buf->len, ==, orig_len + len) &&
+             check_uint(buf->alloc, >=, orig_alloc) &&
+             check_uint(buf->alloc, >, orig_len + len) &&
+             check_char(buf->buf[orig_len + len], ==, '\0')))
+           return;
+       check_str(buf->buf + orig_len, text);
+}
+
+int cmd_main(int argc, const char **argv)
+{
+       if (!TEST(t_static_init(), "static initialization works"))
+               test_skip_all("STRBUF_INIT is broken");
+       TEST(t_dynamic_init(), "dynamic initialization works");
+       TEST(setup(t_addch, "a"), "strbuf_addch adds char");
+       TEST(setup(t_addch, ""), "strbuf_addch adds NUL char");
+       TEST(setup_populated(t_addch, "initial value", "a"),
+            "strbuf_addch appends to initial value");
+       TEST(setup(t_addstr, "hello there"), "strbuf_addstr adds string");
+       TEST(setup_populated(t_addstr, "initial value", "hello there"),
+            "strbuf_addstr appends string to initial value");
+
+       return test_done();
+}
diff --git a/t/unit-tests/test-lib.c b/t/unit-tests/test-lib.c
new file mode 100644 (file)
index 0000000..66d6980
--- /dev/null
@@ -0,0 +1,407 @@
+#include "test-lib.h"
+
+enum result {
+       RESULT_NONE,
+       RESULT_FAILURE,
+       RESULT_SKIP,
+       RESULT_SUCCESS,
+       RESULT_TODO
+};
+
+static struct {
+       enum result result;
+       int count;
+       unsigned failed :1;
+       unsigned lazy_plan :1;
+       unsigned running :1;
+       unsigned skip_all :1;
+       unsigned todo :1;
+} ctx = {
+       .lazy_plan = 1,
+       .result = RESULT_NONE,
+};
+
+/*
+ * Visual C interpolates the absolute Windows path for `__FILE__`,
+ * but we want to see relative paths, as verified by t0080.
+ * There are other compilers that do the same, and are not for
+ * Windows.
+ */
+#include "dir.h"
+
+static const char *make_relative(const char *location)
+{
+       static char prefix[] = __FILE__, buf[PATH_MAX], *p;
+       static size_t prefix_len;
+       static int need_bs_to_fs = -1;
+
+       /* one-time preparation */
+       if (need_bs_to_fs < 0) {
+               size_t len = strlen(prefix);
+               char needle[] = "t\\unit-tests\\test-lib.c";
+               size_t needle_len = strlen(needle);
+
+               if (len < needle_len)
+                       die("unexpected prefix '%s'", prefix);
+
+               /*
+                * The path could be relative (t/unit-tests/test-lib.c)
+                * or full (/home/user/git/t/unit-tests/test-lib.c).
+                * Check the slash between "t" and "unit-tests".
+                */
+               prefix_len = len - needle_len;
+               if (prefix[prefix_len + 1] == '/') {
+                       /* Oh, we're not Windows */
+                       for (size_t i = 0; i < needle_len; i++)
+                               if (needle[i] == '\\')
+                                       needle[i] = '/';
+                       need_bs_to_fs = 0;
+               } else {
+                       need_bs_to_fs = 1;
+               }
+
+               /*
+                * prefix_len == 0 if the compiler gives paths relative
+                * to the root of the working tree.  Otherwise, we want
+                * to see that we did find the needle[] at a directory
+                * boundary.  Again we rely on that needle[] begins with
+                * "t" followed by the directory separator.
+                */
+               if (fspathcmp(needle, prefix + prefix_len) ||
+                   (prefix_len && prefix[prefix_len - 1] != needle[1]))
+                       die("unexpected suffix of '%s'", prefix);
+       }
+
+       /*
+        * Does it not start with the expected prefix?
+        * Return it as-is without making it worse.
+        */
+       if (prefix_len && fspathncmp(location, prefix, prefix_len))
+               return location;
+
+       /*
+        * If we do not need to munge directory separator, we can return
+        * the substring at the tail of the location.
+        */
+       if (!need_bs_to_fs)
+               return location + prefix_len;
+
+       /* convert backslashes to forward slashes */
+       strlcpy(buf, location + prefix_len, sizeof(buf));
+       for (p = buf; *p; p++)
+               if (*p == '\\')
+                       *p = '/';
+       return buf;
+}
+
+static void msg_with_prefix(const char *prefix, const char *format, va_list ap)
+{
+       fflush(stderr);
+       if (prefix)
+               fprintf(stdout, "%s", prefix);
+       vprintf(format, ap); /* TODO: handle newlines */
+       putc('\n', stdout);
+       fflush(stdout);
+}
+
+void test_msg(const char *format, ...)
+{
+       va_list ap;
+
+       va_start(ap, format);
+       msg_with_prefix("# ", format, ap);
+       va_end(ap);
+}
+
+void test_plan(int count)
+{
+       assert(!ctx.running);
+
+       fflush(stderr);
+       printf("1..%d\n", count);
+       fflush(stdout);
+       ctx.lazy_plan = 0;
+}
+
+int test_done(void)
+{
+       assert(!ctx.running);
+
+       if (ctx.lazy_plan)
+               test_plan(ctx.count);
+
+       return ctx.failed;
+}
+
+void test_skip(const char *format, ...)
+{
+       va_list ap;
+
+       assert(ctx.running);
+
+       ctx.result = RESULT_SKIP;
+       va_start(ap, format);
+       if (format)
+               msg_with_prefix("# skipping test - ", format, ap);
+       va_end(ap);
+}
+
+void test_skip_all(const char *format, ...)
+{
+       va_list ap;
+       const char *prefix;
+
+       if (!ctx.count && ctx.lazy_plan) {
+               /* We have not printed a test plan yet */
+               prefix = "1..0 # SKIP ";
+               ctx.lazy_plan = 0;
+       } else {
+               /* We have already printed a test plan */
+               prefix = "Bail out! # ";
+               ctx.failed = 1;
+       }
+       ctx.skip_all = 1;
+       ctx.result = RESULT_SKIP;
+       va_start(ap, format);
+       msg_with_prefix(prefix, format, ap);
+       va_end(ap);
+}
+
+int test__run_begin(void)
+{
+       assert(!ctx.running);
+
+       ctx.count++;
+       ctx.result = RESULT_NONE;
+       ctx.running = 1;
+
+       return ctx.skip_all;
+}
+
+static void print_description(const char *format, va_list ap)
+{
+       if (format) {
+               fputs(" - ", stdout);
+               vprintf(format, ap);
+       }
+}
+
+int test__run_end(int was_run UNUSED, const char *location, const char *format, ...)
+{
+       va_list ap;
+
+       assert(ctx.running);
+       assert(!ctx.todo);
+
+       fflush(stderr);
+       va_start(ap, format);
+       if (!ctx.skip_all) {
+               switch (ctx.result) {
+               case RESULT_SUCCESS:
+                       printf("ok %d", ctx.count);
+                       print_description(format, ap);
+                       break;
+
+               case RESULT_FAILURE:
+                       printf("not ok %d", ctx.count);
+                       print_description(format, ap);
+                       break;
+
+               case RESULT_TODO:
+                       printf("not ok %d", ctx.count);
+                       print_description(format, ap);
+                       printf(" # TODO");
+                       break;
+
+               case RESULT_SKIP:
+                       printf("ok %d", ctx.count);
+                       print_description(format, ap);
+                       printf(" # SKIP");
+                       break;
+
+               case RESULT_NONE:
+                       test_msg("BUG: test has no checks at %s",
+                                make_relative(location));
+                       printf("not ok %d", ctx.count);
+                       print_description(format, ap);
+                       ctx.result = RESULT_FAILURE;
+                       break;
+               }
+       }
+       va_end(ap);
+       ctx.running = 0;
+       if (ctx.skip_all)
+               return 1;
+       putc('\n', stdout);
+       fflush(stdout);
+       ctx.failed |= ctx.result == RESULT_FAILURE;
+
+       return ctx.result != RESULT_FAILURE;
+}
+
+static void test_fail(void)
+{
+       assert(ctx.result != RESULT_SKIP);
+
+       ctx.result = RESULT_FAILURE;
+}
+
+static void test_pass(void)
+{
+       assert(ctx.result != RESULT_SKIP);
+
+       if (ctx.result == RESULT_NONE)
+               ctx.result = RESULT_SUCCESS;
+}
+
+static void test_todo(void)
+{
+       assert(ctx.result != RESULT_SKIP);
+
+       if (ctx.result != RESULT_FAILURE)
+               ctx.result = RESULT_TODO;
+}
+
+int test_assert(const char *location, const char *check, int ok)
+{
+       assert(ctx.running);
+
+       if (ctx.result == RESULT_SKIP) {
+               test_msg("skipping check '%s' at %s", check,
+                        make_relative(location));
+               return 1;
+       }
+       if (!ctx.todo) {
+               if (ok) {
+                       test_pass();
+               } else {
+                       test_msg("check \"%s\" failed at %s", check,
+                                make_relative(location));
+                       test_fail();
+               }
+       }
+
+       return !!ok;
+}
+
+void test__todo_begin(void)
+{
+       assert(ctx.running);
+       assert(!ctx.todo);
+
+       ctx.todo = 1;
+}
+
+int test__todo_end(const char *location, const char *check, int res)
+{
+       assert(ctx.running);
+       assert(ctx.todo);
+
+       ctx.todo = 0;
+       if (ctx.result == RESULT_SKIP)
+               return 1;
+       if (res) {
+               test_msg("todo check '%s' succeeded at %s", check,
+                        make_relative(location));
+               test_fail();
+       } else {
+               test_todo();
+       }
+
+       return !res;
+}
+
+int check_bool_loc(const char *loc, const char *check, int ok)
+{
+       return test_assert(loc, check, ok);
+}
+
+union test__tmp test__tmp[2];
+
+int check_int_loc(const char *loc, const char *check, int ok,
+                 intmax_t a, intmax_t b)
+{
+       int ret = test_assert(loc, check, ok);
+
+       if (!ret) {
+               test_msg("   left: %"PRIdMAX, a);
+               test_msg("  right: %"PRIdMAX, b);
+       }
+
+       return ret;
+}
+
+int check_uint_loc(const char *loc, const char *check, int ok,
+                  uintmax_t a, uintmax_t b)
+{
+       int ret = test_assert(loc, check, ok);
+
+       if (!ret) {
+               test_msg("   left: %"PRIuMAX, a);
+               test_msg("  right: %"PRIuMAX, b);
+       }
+
+       return ret;
+}
+
+static void print_one_char(char ch, char quote)
+{
+       if ((unsigned char)ch < 0x20u || ch == 0x7f) {
+               /* TODO: improve handling of \a, \b, \f ... */
+               printf("\\%03o", (unsigned char)ch);
+       } else {
+               if (ch == '\\' || ch == quote)
+                       putc('\\', stdout);
+               putc(ch, stdout);
+       }
+}
+
+static void print_char(const char *prefix, char ch)
+{
+       printf("# %s: '", prefix);
+       print_one_char(ch, '\'');
+       fputs("'\n", stdout);
+}
+
+int check_char_loc(const char *loc, const char *check, int ok, char a, char b)
+{
+       int ret = test_assert(loc, check, ok);
+
+       if (!ret) {
+               fflush(stderr);
+               print_char("   left", a);
+               print_char("  right", b);
+               fflush(stdout);
+       }
+
+       return ret;
+}
+
+static void print_str(const char *prefix, const char *str)
+{
+       printf("# %s: ", prefix);
+       if (!str) {
+               fputs("NULL\n", stdout);
+       } else {
+               putc('"', stdout);
+               while (*str)
+                       print_one_char(*str++, '"');
+               fputs("\"\n", stdout);
+       }
+}
+
+int check_str_loc(const char *loc, const char *check,
+                 const char *a, const char *b)
+{
+       int ok = (!a && !b) || (a && b && !strcmp(a, b));
+       int ret = test_assert(loc, check, ok);
+
+       if (!ret) {
+               fflush(stderr);
+               print_str("   left", a);
+               print_str("  right", b);
+               fflush(stdout);
+       }
+
+       return ret;
+}
diff --git a/t/unit-tests/test-lib.h b/t/unit-tests/test-lib.h
new file mode 100644 (file)
index 0000000..a8f07ae
--- /dev/null
@@ -0,0 +1,149 @@
+#ifndef TEST_LIB_H
+#define TEST_LIB_H
+
+#include "git-compat-util.h"
+
+/*
+ * Run a test function, returns 1 if the test succeeds, 0 if it
+ * fails. If test_skip_all() has been called then the test will not be
+ * run. The description for each test should be unique. For example:
+ *
+ *  TEST(test_something(arg1, arg2), "something %d %d", arg1, arg2)
+ */
+#define TEST(t, ...)                                   \
+       test__run_end(test__run_begin() ? 0 : (t, 1),   \
+                     TEST_LOCATION(),  __VA_ARGS__)
+
+/*
+ * Print a test plan, should be called before any tests. If the number
+ * of tests is not known in advance test_done() will automatically
+ * print a plan at the end of the test program.
+ */
+void test_plan(int count);
+
+/*
+ * test_done() must be called at the end of main(). It will print the
+ * plan if plan() was not called at the beginning of the test program
+ * and returns the exit code for the test program.
+ */
+int test_done(void);
+
+/* Skip the current test. */
+__attribute__((format (printf, 1, 2)))
+void test_skip(const char *format, ...);
+
+/* Skip all remaining tests. */
+__attribute__((format (printf, 1, 2)))
+void test_skip_all(const char *format, ...);
+
+/* Print a diagnostic message to stdout. */
+__attribute__((format (printf, 1, 2)))
+void test_msg(const char *format, ...);
+
+/*
+ * Test checks are built around test_assert(). checks return 1 on
+ * success, 0 on failure. If any check fails then the test will fail. To
+ * create a custom check define a function that wraps test_assert() and
+ * a macro to wrap that function to provide a source location and
+ * stringified arguments. Custom checks that take pointer arguments
+ * should be careful to check that they are non-NULL before
+ * dereferencing them. For example:
+ *
+ *  static int check_oid_loc(const char *loc, const char *check,
+ *                          struct object_id *a, struct object_id *b)
+ *  {
+ *         int res = test_assert(loc, check, a && b && oideq(a, b));
+ *
+ *         if (!res) {
+ *                 test_msg("   left: %s", a ? oid_to_hex(a) : "NULL";
+ *                 test_msg("  right: %s", b ? oid_to_hex(a) : "NULL";
+ *
+ *         }
+ *         return res;
+ *  }
+ *
+ *  #define check_oid(a, b) \
+ *         check_oid_loc(TEST_LOCATION(), "oideq("#a", "#b")", a, b)
+ */
+int test_assert(const char *location, const char *check, int ok);
+
+/* Helper macro to pass the location to checks */
+#define TEST_LOCATION() TEST__MAKE_LOCATION(__LINE__)
+
+/* Check a boolean condition. */
+#define check(x)                               \
+       check_bool_loc(TEST_LOCATION(), #x, x)
+int check_bool_loc(const char *loc, const char *check, int ok);
+
+/*
+ * Compare two integers. Prints a message with the two values if the
+ * comparison fails. NB this is not thread safe.
+ */
+#define check_int(a, op, b)                                            \
+       (test__tmp[0].i = (a), test__tmp[1].i = (b),                    \
+        check_int_loc(TEST_LOCATION(), #a" "#op" "#b,                  \
+                      test__tmp[0].i op test__tmp[1].i,                \
+                      test__tmp[0].i, test__tmp[1].i))
+int check_int_loc(const char *loc, const char *check, int ok,
+                 intmax_t a, intmax_t b);
+
+/*
+ * Compare two unsigned integers. Prints a message with the two values
+ * if the comparison fails. NB this is not thread safe.
+ */
+#define check_uint(a, op, b)                                           \
+       (test__tmp[0].u = (a), test__tmp[1].u = (b),                    \
+        check_uint_loc(TEST_LOCATION(), #a" "#op" "#b,                 \
+                       test__tmp[0].u op test__tmp[1].u,               \
+                       test__tmp[0].u, test__tmp[1].u))
+int check_uint_loc(const char *loc, const char *check, int ok,
+                  uintmax_t a, uintmax_t b);
+
+/*
+ * Compare two chars. Prints a message with the two values if the
+ * comparison fails. NB this is not thread safe.
+ */
+#define check_char(a, op, b)                                           \
+       (test__tmp[0].c = (a), test__tmp[1].c = (b),                    \
+        check_char_loc(TEST_LOCATION(), #a" "#op" "#b,                 \
+                       test__tmp[0].c op test__tmp[1].c,               \
+                       test__tmp[0].c, test__tmp[1].c))
+int check_char_loc(const char *loc, const char *check, int ok,
+                  char a, char b);
+
+/* Check whether two strings are equal. */
+#define check_str(a, b)                                                        \
+       check_str_loc(TEST_LOCATION(), "!strcmp("#a", "#b")", a, b)
+int check_str_loc(const char *loc, const char *check,
+                 const char *a, const char *b);
+
+/*
+ * Wrap a check that is known to fail. If the check succeeds then the
+ * test will fail. Returns 1 if the check fails, 0 if it
+ * succeeds. For example:
+ *
+ *  TEST_TODO(check(0));
+ */
+#define TEST_TODO(check) \
+       (test__todo_begin(), test__todo_end(TEST_LOCATION(), #check, check))
+
+/* Private helpers */
+
+#define TEST__STR(x) #x
+#define TEST__MAKE_LOCATION(line) __FILE__ ":" TEST__STR(line)
+
+union test__tmp {
+       intmax_t i;
+       uintmax_t u;
+       char c;
+};
+
+extern union test__tmp test__tmp[2];
+
+int test__run_begin(void);
+__attribute__((format (printf, 3, 4)))
+int test__run_end(int, const char *, const char *, ...);
+void test__todo_begin(void);
+int test__todo_end(const char *, const char *, int);
+
+#endif /* TEST_LIB_H */
index 669ebaf68be006ee53911f02da72e56cb5a100f0..3c8ee19975bb74d755fd40d3ee8d27fbaecc0e58 100755 (executable)
@@ -23,7 +23,7 @@ memcheck)
        VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)')
        VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)')
        test 3 -gt "$VALGRIND_MAJOR" ||
-       test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" ||
+       { test 3 -eq "$VALGRIND_MAJOR" && test 4 -gt "$VALGRIND_MINOR"; } ||
        TOOL_OPTIONS="$TOOL_OPTIONS --track-origins=yes"
        ;;
 *)
index ecdebf1afb0d8465717c18409877fe310f980e46..ed88cf84314753443c8c42f0043320957d65d165 100644 (file)
 
 static VOLATILE_LIST_HEAD(tempfile_list);
 
-static void remove_template_directory(struct tempfile *tempfile,
+static int remove_template_directory(struct tempfile *tempfile,
                                      int in_signal_handler)
 {
        if (tempfile->directory) {
                if (in_signal_handler)
-                       rmdir(tempfile->directory);
+                       return rmdir(tempfile->directory);
                else
-                       rmdir_or_warn(tempfile->directory);
+                       return rmdir_or_warn(tempfile->directory);
        }
+
+       return 0;
 }
 
 static void remove_tempfiles(int in_signal_handler)
@@ -353,16 +355,19 @@ int rename_tempfile(struct tempfile **tempfile_p, const char *path)
        return 0;
 }
 
-void delete_tempfile(struct tempfile **tempfile_p)
+int delete_tempfile(struct tempfile **tempfile_p)
 {
        struct tempfile *tempfile = *tempfile_p;
+       int err = 0;
 
        if (!is_tempfile_active(tempfile))
-               return;
+               return 0;
 
-       close_tempfile_gently(tempfile);
-       unlink_or_warn(tempfile->filename.buf);
-       remove_template_directory(tempfile, 0);
+       err |= close_tempfile_gently(tempfile);
+       err |= unlink_or_warn(tempfile->filename.buf);
+       err |= remove_template_directory(tempfile, 0);
        deactivate_tempfile(tempfile);
        *tempfile_p = NULL;
+
+       return err ? -1 : 0;
 }
index d0413af733c81ad895669aab30937435cae0f2af..2d2ae5b657d4a97a7fe7b8e2e84c2062717fdde5 100644 (file)
@@ -269,7 +269,7 @@ int reopen_tempfile(struct tempfile *tempfile);
  * `delete_tempfile()` for a `tempfile` object that has already been
  * deleted or renamed.
  */
-void delete_tempfile(struct tempfile **tempfile_p);
+int delete_tempfile(struct tempfile **tempfile_p);
 
 /*
  * Close the file descriptor and/or file pointer if they are still
index e144712c85c055bcf3248ab342592b440a477062..29ed5ee486a4f07c3f0558101ef8efc46f3d6ab7 100755 (executable)
@@ -28,7 +28,7 @@ if [ "$allownonascii" != "true" ] &&
        # Note that the use of brackets around a tr range is ok here, (it's
        # even required, for portability to Solaris 10's /usr/bin/tr), since
        # the square bracket bytes happen to fall in the designated range.
-       test $(git diff --cached --name-only --diff-filter=A -z $against |
+       test $(git diff-index --cached --name-only --diff-filter=A -z $against |
          LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
 then
        cat <<\EOF
index 5f9074ad1c0b063a0cb906c2dc6182357adcd5ee..3509258be53644973ca2b2b04cc0ec5b27ea96c6 100644 (file)
@@ -6,7 +6,6 @@
 #include "environment.h"
 #include "object-file.h"
 #include "path.h"
-#include "sigchain.h"
 #include "string-list.h"
 #include "strbuf.h"
 #include "strvec.h"
diff --git a/trace.c b/trace.c
index 971a68abe84bf02656bf9cd5eab584833f3da9f7..8669ddfca25e8fe91b57d96875f63214e5700a9e 100644 (file)
--- a/trace.c
+++ b/trace.c
@@ -18,7 +18,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *  along with this program; if not, see <https://www.gnu.org/licenses/>.
  */
 
 #include "git-compat-util.h"
index 6dc74dff4c73205d332a227b0caf2497b71f7538..f894532d05331c48607fc3434b8d31937f951a4b 100644 (file)
--- a/trace2.c
+++ b/trace2.c
@@ -1,12 +1,9 @@
 #include "git-compat-util.h"
 #include "config.h"
-#include "json-writer.h"
-#include "quote.h"
 #include "repository.h"
 #include "run-command.h"
 #include "sigchain.h"
 #include "thread-utils.h"
-#include "version.h"
 #include "trace.h"
 #include "trace2.h"
 #include "trace2/tr2_cfg.h"
@@ -20,6 +17,7 @@
 #include "trace2/tr2_tmr.h"
 
 static int trace2_enabled;
+static int trace2_redact = 1;
 
 static int tr2_next_child_id; /* modify under lock */
 static int tr2_next_exec_id; /* modify under lock */
@@ -227,6 +225,8 @@ void trace2_initialize_fl(const char *file, int line)
        if (!tr2_tgt_want_builtins())
                return;
        trace2_enabled = 1;
+       if (!git_env_bool("GIT_TRACE2_REDACT", 1))
+               trace2_redact = 0;
 
        tr2_sid_get();
 
@@ -247,12 +247,93 @@ int trace2_is_enabled(void)
        return trace2_enabled;
 }
 
+/*
+ * Redacts an argument, i.e. ensures that no password in
+ * https://user:password@host/-style URLs is logged.
+ *
+ * Returns the original if nothing needed to be redacted.
+ * Returns a pointer that needs to be `free()`d otherwise.
+ */
+static const char *redact_arg(const char *arg)
+{
+       const char *p, *colon;
+       size_t at;
+
+       if (!trace2_redact ||
+           (!skip_prefix(arg, "https://", &p) &&
+            !skip_prefix(arg, "http://", &p)))
+               return arg;
+
+       at = strcspn(p, "@/");
+       if (p[at] != '@')
+               return arg;
+
+       colon = memchr(p, ':', at);
+       if (!colon)
+               return arg;
+
+       return xstrfmt("%.*s:<REDACTED>%s", (int)(colon - arg), arg, p + at);
+}
+
+/*
+ * Redacts arguments in an argument list.
+ *
+ * Returns the original if nothing needed to be redacted.
+ * Otherwise, returns a new array that needs to be released
+ * via `free_redacted_argv()`.
+ */
+static const char **redact_argv(const char **argv)
+{
+       int i, j;
+       const char *redacted = NULL;
+       const char **ret;
+
+       if (!trace2_redact)
+               return argv;
+
+       for (i = 0; argv[i]; i++)
+               if ((redacted = redact_arg(argv[i])) != argv[i])
+                       break;
+
+       if (!argv[i])
+               return argv;
+
+       for (j = 0; argv[j]; j++)
+               ; /* keep counting */
+
+       ALLOC_ARRAY(ret, j + 1);
+       ret[j] = NULL;
+
+       for (j = 0; j < i; j++)
+               ret[j] = argv[j];
+       ret[i] = redacted;
+       for (++i; argv[i]; i++) {
+               redacted = redact_arg(argv[i]);
+               ret[i] = redacted ? redacted : argv[i];
+       }
+
+       return ret;
+}
+
+static void free_redacted_argv(const char **redacted, const char **argv)
+{
+       int i;
+
+       if (redacted != argv) {
+               for (i = 0; argv[i]; i++)
+                       if (redacted[i] != argv[i])
+                               free((void *)redacted[i]);
+               free((void *)redacted);
+       }
+}
+
 void trace2_cmd_start_fl(const char *file, int line, const char **argv)
 {
        struct tr2_tgt *tgt_j;
        int j;
        uint64_t us_now;
        uint64_t us_elapsed_absolute;
+       const char **redacted;
 
        if (!trace2_enabled)
                return;
@@ -260,10 +341,14 @@ void trace2_cmd_start_fl(const char *file, int line, const char **argv)
        us_now = getnanotime() / 1000;
        us_elapsed_absolute = tr2tls_absolute_elapsed(us_now);
 
+       redacted = redact_argv(argv);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_start_fl)
                        tgt_j->pfn_start_fl(file, line, us_elapsed_absolute,
-                                           argv);
+                                           redacted);
+
+       free_redacted_argv(redacted, argv);
 }
 
 void trace2_cmd_exit_fl(const char *file, int line, int code)
@@ -348,6 +433,9 @@ void trace2_cmd_name_fl(const char *file, int line, const char *name)
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_command_name_fl)
                        tgt_j->pfn_command_name_fl(file, line, name, hierarchy);
+
+       trace2_cmd_list_config();
+       trace2_cmd_list_env_vars();
 }
 
 void trace2_cmd_mode_fl(const char *file, int line, const char *mode)
@@ -379,17 +467,29 @@ void trace2_cmd_alias_fl(const char *file, int line, const char *alias,
 
 void trace2_cmd_list_config_fl(const char *file, int line)
 {
+       static int emitted = 0;
+
        if (!trace2_enabled)
                return;
 
+       if (emitted)
+               return;
+       emitted = 1;
+
        tr2_cfg_list_config_fl(file, line);
 }
 
 void trace2_cmd_list_env_vars_fl(const char *file, int line)
 {
+       static int emitted = 0;
+
        if (!trace2_enabled)
                return;
 
+       if (emitted)
+               return;
+       emitted = 1;
+
        tr2_list_env_vars_fl(file, line);
 }
 
@@ -409,6 +509,7 @@ void trace2_child_start_fl(const char *file, int line,
        int j;
        uint64_t us_now;
        uint64_t us_elapsed_absolute;
+       const char **orig_argv = cmd->args.v;
 
        if (!trace2_enabled)
                return;
@@ -419,10 +520,24 @@ void trace2_child_start_fl(const char *file, int line,
        cmd->trace2_child_id = tr2tls_locked_increment(&tr2_next_child_id);
        cmd->trace2_child_us_start = us_now;
 
+       /*
+        * The `pfn_child_start_fl` API takes a `struct child_process`
+        * rather than a simple `argv` for the child because some
+        * targets make use of the additional context bits/values. So
+        * temporarily replace the original argv (inside the `strvec`)
+        * with a possibly redacted version.
+        */
+       cmd->args.v = redact_argv(orig_argv);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_child_start_fl)
                        tgt_j->pfn_child_start_fl(file, line,
                                                  us_elapsed_absolute, cmd);
+
+       if (cmd->args.v != orig_argv) {
+               free_redacted_argv(cmd->args.v, orig_argv);
+               cmd->args.v = orig_argv;
+       }
 }
 
 void trace2_child_exit_fl(const char *file, int line, struct child_process *cmd,
@@ -493,6 +608,7 @@ int trace2_exec_fl(const char *file, int line, const char *exe,
        int exec_id;
        uint64_t us_now;
        uint64_t us_elapsed_absolute;
+       const char **redacted;
 
        if (!trace2_enabled)
                return -1;
@@ -502,10 +618,14 @@ int trace2_exec_fl(const char *file, int line, const char *exe,
 
        exec_id = tr2tls_locked_increment(&tr2_next_exec_id);
 
+       redacted = redact_argv(argv);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_exec_fl)
                        tgt_j->pfn_exec_fl(file, line, us_elapsed_absolute,
-                                          exec_id, exe, argv);
+                                          exec_id, exe, redacted);
+
+       free_redacted_argv(redacted, argv);
 
        return exec_id;
 }
@@ -637,13 +757,19 @@ void trace2_def_param_fl(const char *file, int line, const char *param,
 {
        struct tr2_tgt *tgt_j;
        int j;
+       const char *redacted;
 
        if (!trace2_enabled)
                return;
 
+       redacted = redact_arg(value);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_param_fl)
-                       tgt_j->pfn_param_fl(file, line, param, value, kvi);
+                       tgt_j->pfn_param_fl(file, line, param, redacted, kvi);
+
+       if (redacted != value)
+               free((void *)redacted);
 }
 
 void trace2_def_repo_fl(const char *file, int line, struct repository *repo)
index 40d8c2e02a5e50ce4f24bc4bd656498773e0853e..1f0669bbd2d4f0ade2b39960ad89d8e5397cb6b1 100644 (file)
--- a/trace2.h
+++ b/trace2.h
@@ -337,8 +337,8 @@ struct key_value_info;
 void trace2_def_param_fl(const char *file, int line, const char *param,
                         const char *value, const struct key_value_info *kvi);
 
-#define trace2_def_param(param, value) \
-       trace2_def_param_fl(__FILE__, __LINE__, (param), (value))
+#define trace2_def_param(param, value, kvi) \
+       trace2_def_param_fl(__FILE__, __LINE__, (param), (value), (kvi))
 
 /*
  * Tell trace2 about a newly instantiated repo object and assign
index 87cf9034fba4b91b4d569ea4013e13f9d19b4aa9..d3a33715c14b9c83647cc4940da4d1abad30dc63 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "thread-utils.h"
 #include "trace2/tr2_tgt.h"
 #include "trace2/tr2_tls.h"
 #include "trace2/tr2_ctr.h"
index f26ec95ab4d867a278e1aacbf337d6eef986355f..048cdd543830418bfe53957b278ab654ecfdcb66 100644 (file)
@@ -58,7 +58,8 @@ static struct tr2_sysenv_entry tr2_sysenv_settings[] = {
 /* clang-format on */
 
 static int tr2_sysenv_cb(const char *key, const char *value,
-                        const struct config_context *ctx UNUSED, void *d)
+                        const struct config_context *ctx UNUSED,
+                        void *d UNUSED)
 {
        int k;
 
@@ -67,6 +68,8 @@ static int tr2_sysenv_cb(const char *key, const char *value,
 
        for (k = 0; k < ARRAY_SIZE(tr2_sysenv_settings); k++) {
                if (!strcmp(key, tr2_sysenv_settings[k].git_config_name)) {
+                       if (!value)
+                               return config_error_nonbool(key);
                        free(tr2_sysenv_settings[k].value);
                        tr2_sysenv_settings[k].value = xstrdup(value);
                        return 0;
index 53091781eca5dc788e1f9048b0679aae41e6b11a..59910a1a4f7c0f280fb6839873429d9cc877d3cf 100644 (file)
@@ -335,7 +335,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias,
 }
 
 static void fn_child_start_fl(const char *file, int line,
-                             uint64_t us_elapsed_absolute,
+                             uint64_t us_elapsed_absolute UNUSED,
                              const struct child_process *cmd)
 {
        const char *event_name = "child_start";
@@ -367,7 +367,8 @@ static void fn_child_start_fl(const char *file, int line,
 }
 
 static void fn_child_exit_fl(const char *file, int line,
-                            uint64_t us_elapsed_absolute, int cid, int pid,
+                            uint64_t us_elapsed_absolute UNUSED,
+                            int cid, int pid,
                             int code, uint64_t us_elapsed_child)
 {
        const char *event_name = "child_exit";
@@ -388,7 +389,8 @@ static void fn_child_exit_fl(const char *file, int line,
 }
 
 static void fn_child_ready_fl(const char *file, int line,
-                             uint64_t us_elapsed_absolute, int cid, int pid,
+                             uint64_t us_elapsed_absolute UNUSED,
+                             int cid, int pid,
                              const char *ready, uint64_t us_elapsed_child)
 {
        const char *event_name = "child_ready";
@@ -409,7 +411,7 @@ static void fn_child_ready_fl(const char *file, int line,
 }
 
 static void fn_thread_start_fl(const char *file, int line,
-                              uint64_t us_elapsed_absolute)
+                              uint64_t us_elapsed_absolute UNUSED)
 {
        const char *event_name = "thread_start";
        struct json_writer jw = JSON_WRITER_INIT;
@@ -423,7 +425,7 @@ static void fn_thread_start_fl(const char *file, int line,
 }
 
 static void fn_thread_exit_fl(const char *file, int line,
-                             uint64_t us_elapsed_absolute,
+                             uint64_t us_elapsed_absolute UNUSED,
                              uint64_t us_elapsed_thread)
 {
        const char *event_name = "thread_exit";
@@ -439,7 +441,8 @@ static void fn_thread_exit_fl(const char *file, int line,
        jw_release(&jw);
 }
 
-static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,
+static void fn_exec_fl(const char *file, int line,
+                      uint64_t us_elapsed_absolute UNUSED,
                       int exec_id, const char *exe, const char **argv)
 {
        const char *event_name = "exec";
@@ -460,8 +463,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,
 }
 
 static void fn_exec_result_fl(const char *file, int line,
-                             uint64_t us_elapsed_absolute, int exec_id,
-                             int code)
+                             uint64_t us_elapsed_absolute UNUSED,
+                             int exec_id, int code)
 {
        const char *event_name = "exec_result";
        struct json_writer jw = JSON_WRITER_INIT;
@@ -511,7 +514,7 @@ static void fn_repo_fl(const char *file, int line,
 }
 
 static void fn_region_enter_printf_va_fl(const char *file, int line,
-                                        uint64_t us_elapsed_absolute,
+                                        uint64_t us_elapsed_absolute UNUSED,
                                         const char *category,
                                         const char *label,
                                         const struct repository *repo,
@@ -538,7 +541,7 @@ static void fn_region_enter_printf_va_fl(const char *file, int line,
 }
 
 static void fn_region_leave_printf_va_fl(
-       const char *file, int line, uint64_t us_elapsed_absolute,
+       const char *file, int line, uint64_t us_elapsed_absolute UNUSED,
        uint64_t us_elapsed_region, const char *category, const char *label,
        const struct repository *repo, const char *fmt, va_list ap)
 {
index d25ea131643c0b228280b438d2a38ffcd95f9a0d..baef48aa6989cede1d8bf62837388ab3379e9604 100644 (file)
@@ -2,6 +2,7 @@
 #include "config.h"
 #include "repository.h"
 #include "run-command.h"
+#include "strbuf.h"
 #include "quote.h"
 #include "version.h"
 #include "trace2/tr2_dst.h"
@@ -86,7 +87,7 @@ static void fn_version_fl(const char *file, int line)
 }
 
 static void fn_start_fl(const char *file, int line,
-                       uint64_t us_elapsed_absolute, const char **argv)
+                       uint64_t us_elapsed_absolute UNUSED, const char **argv)
 {
        struct strbuf buf_payload = STRBUF_INIT;
 
@@ -215,7 +216,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias,
 }
 
 static void fn_child_start_fl(const char *file, int line,
-                             uint64_t us_elapsed_absolute,
+                             uint64_t us_elapsed_absolute UNUSED,
                              const struct child_process *cmd)
 {
        struct strbuf buf_payload = STRBUF_INIT;
@@ -243,7 +244,8 @@ static void fn_child_start_fl(const char *file, int line,
 }
 
 static void fn_child_exit_fl(const char *file, int line,
-                            uint64_t us_elapsed_absolute, int cid, int pid,
+                            uint64_t us_elapsed_absolute UNUSED,
+                            int cid, int pid,
                             int code, uint64_t us_elapsed_child)
 {
        struct strbuf buf_payload = STRBUF_INIT;
@@ -256,7 +258,8 @@ static void fn_child_exit_fl(const char *file, int line,
 }
 
 static void fn_child_ready_fl(const char *file, int line,
-                             uint64_t us_elapsed_absolute, int cid, int pid,
+                             uint64_t us_elapsed_absolute UNUSED,
+                             int cid, int pid,
                              const char *ready, uint64_t us_elapsed_child)
 {
        struct strbuf buf_payload = STRBUF_INIT;
@@ -268,7 +271,8 @@ static void fn_child_ready_fl(const char *file, int line,
        strbuf_release(&buf_payload);
 }
 
-static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,
+static void fn_exec_fl(const char *file, int line,
+                      uint64_t us_elapsed_absolute UNUSED,
                       int exec_id, const char *exe, const char **argv)
 {
        struct strbuf buf_payload = STRBUF_INIT;
@@ -284,8 +288,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,
 }
 
 static void fn_exec_result_fl(const char *file, int line,
-                             uint64_t us_elapsed_absolute, int exec_id,
-                             int code)
+                             uint64_t us_elapsed_absolute UNUSED,
+                             int exec_id, int code)
 {
        struct strbuf buf_payload = STRBUF_INIT;
 
@@ -321,7 +325,8 @@ static void fn_repo_fl(const char *file, int line,
 }
 
 static void fn_printf_va_fl(const char *file, int line,
-                           uint64_t us_elapsed_absolute, const char *fmt,
+                           uint64_t us_elapsed_absolute UNUSED,
+                           const char *fmt,
                            va_list ap)
 {
        struct strbuf buf_payload = STRBUF_INIT;
index 601c9e5036fb27a7f88957559f03821c2fffa4a2..4f75392952b6a429682d8989fe7146487ce0cb6a 100644 (file)
@@ -1,4 +1,5 @@
 #include "git-compat-util.h"
+#include "strbuf.h"
 #include "thread-utils.h"
 #include "trace.h"
 #include "trace2/tr2_tls.h"
index f9049805d4dcd6eea6550042a1887357ad85d6fd..3dfe6557fc46129edfa7a121522e9a6d54973f28 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef TR2_TLS_H
 #define TR2_TLS_H
 
-#include "strbuf.h"
 #include "trace2/tr2_ctr.h"
 #include "trace2/tr2_tmr.h"
 
index 31d0e4d1bd1220ea0c9d9b204223766235d81e07..51f564b07a4091a24db71b3a756b4730173cae98 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "thread-utils.h"
 #include "trace2/tr2_tgt.h"
 #include "trace2/tr2_tls.h"
 #include "trace2/tr2_tmr.h"
index f408f9b058dbbc33b1360cf36e1e023b7bba1a54..57b4aa7d5acb515b03b2cf123744d8af34d30166 100644 (file)
--- a/trailer.c
+++ b/trailer.c
@@ -5,7 +5,6 @@
 #include "string-list.h"
 #include "run-command.h"
 #include "commit.h"
-#include "tempfile.h"
 #include "trailer.h"
 #include "list.h"
 /*
@@ -145,12 +144,12 @@ static char last_non_space_char(const char *s)
        return '\0';
 }
 
-static void print_tok_val(FILE *outfile, const char *tok, const char *val)
+static void print_tok_val(struct strbuf *out, const char *tok, const char *val)
 {
        char c;
 
        if (!tok) {
-               fprintf(outfile, "%s\n", val);
+               strbuf_addf(out, "%s\n", val);
                return;
        }
 
@@ -158,21 +157,22 @@ static void print_tok_val(FILE *outfile, const char *tok, const char *val)
        if (!c)
                return;
        if (strchr(separators, c))
-               fprintf(outfile, "%s%s\n", tok, val);
+               strbuf_addf(out, "%s%s\n", tok, val);
        else
-               fprintf(outfile, "%s%c %s\n", tok, separators[0], val);
+               strbuf_addf(out, "%s%c %s\n", tok, separators[0], val);
 }
 
-static void print_all(FILE *outfile, struct list_head *head,
-                     const struct process_trailer_options *opts)
+void format_trailers(const struct process_trailer_options *opts,
+                    struct list_head *trailers,
+                    struct strbuf *out)
 {
        struct list_head *pos;
        struct trailer_item *item;
-       list_for_each(pos, head) {
+       list_for_each(pos, trailers) {
                item = list_entry(pos, struct trailer_item, list);
                if ((!opts->trim_empty || strlen(item->value) > 0) &&
                    (!opts->only_trailers || item->token))
-                       print_tok_val(outfile, item->token, item->value);
+                       print_tok_val(out, item->token, item->value);
        }
 }
 
@@ -366,8 +366,8 @@ static int find_same_and_apply_arg(struct list_head *head,
        return 0;
 }
 
-static void process_trailers_lists(struct list_head *head,
-                                  struct list_head *arg_head)
+void process_trailers_lists(struct list_head *head,
+                           struct list_head *arg_head)
 {
        struct list_head *pos, *p;
        struct arg_item *arg_tok;
@@ -507,6 +507,8 @@ static int git_trailer_default_config(const char *conf_key, const char *value,
                                warning(_("unknown value '%s' for key '%s'"),
                                        value, conf_key);
                } else if (!strcmp(trailer_item, "separators")) {
+                       if (!value)
+                               return config_error_nonbool(conf_key);
                        separators = xstrdup(value);
                }
        }
@@ -551,16 +553,22 @@ static int git_trailer_config(const char *conf_key, const char *value,
        case TRAILER_KEY:
                if (conf->key)
                        warning(_("more than one %s"), conf_key);
+               if (!value)
+                       return config_error_nonbool(conf_key);
                conf->key = xstrdup(value);
                break;
        case TRAILER_COMMAND:
                if (conf->command)
                        warning(_("more than one %s"), conf_key);
+               if (!value)
+                       return config_error_nonbool(conf_key);
                conf->command = xstrdup(value);
                break;
        case TRAILER_CMD:
                if (conf->cmd)
                        warning(_("more than one %s"), conf_key);
+               if (!value)
+                       return config_error_nonbool(conf_key);
                conf->cmd = xstrdup(value);
                break;
        case TRAILER_WHERE:
@@ -581,7 +589,7 @@ static int git_trailer_config(const char *conf_key, const char *value,
        return 0;
 }
 
-static void ensure_configured(void)
+void trailer_config_init(void)
 {
        if (configured)
                return;
@@ -711,30 +719,35 @@ static void add_arg_item(struct list_head *arg_head, char *tok, char *val,
        list_add_tail(&new_item->list, arg_head);
 }
 
-static void process_command_line_args(struct list_head *arg_head,
-                                     struct list_head *new_trailer_head)
+void parse_trailers_from_config(struct list_head *config_head)
 {
        struct arg_item *item;
-       struct strbuf tok = STRBUF_INIT;
-       struct strbuf val = STRBUF_INIT;
-       const struct conf_info *conf;
        struct list_head *pos;
 
-       /*
-        * In command-line arguments, '=' is accepted (in addition to the
-        * separators that are defined).
-        */
-       char *cl_separators = xstrfmt("=%s", separators);
-
        /* Add an arg item for each configured trailer with a command */
        list_for_each(pos, &conf_head) {
                item = list_entry(pos, struct arg_item, list);
                if (item->conf.command)
-                       add_arg_item(arg_head,
+                       add_arg_item(config_head,
                                     xstrdup(token_from_item(item, NULL)),
                                     xstrdup(""),
                                     &item->conf, NULL);
        }
+}
+
+void parse_trailers_from_command_line_args(struct list_head *arg_head,
+                                          struct list_head *new_trailer_head)
+{
+       struct strbuf tok = STRBUF_INIT;
+       struct strbuf val = STRBUF_INIT;
+       const struct conf_info *conf;
+       struct list_head *pos;
+
+       /*
+        * In command-line arguments, '=' is accepted (in addition to the
+        * separators that are defined).
+        */
+       char *cl_separators = xstrfmt("=%s", separators);
 
        /* Add an arg item for each trailer on the command line */
        list_for_each(pos, new_trailer_head) {
@@ -762,17 +775,6 @@ static void process_command_line_args(struct list_head *arg_head,
        free(cl_separators);
 }
 
-static void read_input_file(struct strbuf *sb, const char *file)
-{
-       if (file) {
-               if (strbuf_read_file(sb, file, 0) < 0)
-                       die_errno(_("could not read input file '%s'"), file);
-       } else {
-               if (strbuf_read(sb, fileno(stdin), 0) < 0)
-                       die_errno(_("could not read from stdin"));
-       }
-}
-
 static const char *next_line(const char *str)
 {
        const char *nl = strchrnul(str, '\n');
@@ -804,28 +806,55 @@ static ssize_t last_line(const char *buf, size_t len)
 }
 
 /*
- * Return the position of the start of the patch or the length of str if there
- * is no patch in the message.
+ * Find the end of the log message as an offset from the start of the input
+ * (where callers of this function are interested in looking for a trailers
+ * block in the same input). We have to consider two categories of content that
+ * can come at the end of the input which we want to ignore (because they don't
+ * belong in the log message):
+ *
+ * (1) the "patch part" which begins with a "---" divider and has patch
+ * information (like the output of git-format-patch), and
+ *
+ * (2) any trailing comment lines, blank lines like in the output of "git
+ * commit -v", or stuff below the "cut" (scissor) line.
+ *
+ * As a formula, the situation looks like this:
+ *
+ *     INPUT = LOG MESSAGE + IGNORED
+ *
+ * where IGNORED can be either of the two categories described above. It may be
+ * that there is nothing to ignore. Now it may be the case that the LOG MESSAGE
+ * contains a trailer block, but that's not the concern of this function.
  */
-static size_t find_patch_start(const char *str)
+static size_t find_end_of_log_message(const char *input, int no_divider)
 {
+       size_t end;
        const char *s;
 
-       for (s = str; *s; s = next_line(s)) {
-               const char *v;
+       /* Assume the naive end of the input is already what we want. */
+       end = strlen(input);
+
+       /* Optionally skip over any patch part ("---" line and below). */
+       if (!no_divider) {
+               for (s = input; *s; s = next_line(s)) {
+                       const char *v;
 
-               if (skip_prefix(s, "---", &v) && isspace(*v))
-                       return s - str;
+                       if (skip_prefix(s, "---", &v) && isspace(*v)) {
+                               end = s - input;
+                               break;
+                       }
+               }
        }
 
-       return s - str;
+       /* Skip over other ignorable bits. */
+       return end - ignored_log_message_bytes(input, end);
 }
 
 /*
  * Return the position of the first trailer line or len if there are no
  * trailers.
  */
-static size_t find_trailer_start(const char *buf, size_t len)
+static size_t find_trailer_block_start(const char *buf, size_t len)
 {
        const char *s;
        ssize_t end_of_title, l;
@@ -920,12 +949,6 @@ continue_outer_loop:
        return len;
 }
 
-/* Return the position of the end of the trailers. */
-static size_t find_trailer_end(const char *buf, size_t len)
-{
-       return len - ignore_non_trailer(buf, len);
-}
-
 static int ends_with_blank_line(const char *buf, size_t len)
 {
        ssize_t ll = last_line(buf, len);
@@ -961,28 +984,24 @@ static void unfold_value(struct strbuf *val)
        strbuf_release(&out);
 }
 
-static size_t process_input_file(FILE *outfile,
-                                const char *str,
-                                struct list_head *head,
-                                const struct process_trailer_options *opts)
+/*
+ * Parse trailers in "str", populating the trailer info and "head"
+ * linked list structure.
+ */
+void parse_trailers(const struct process_trailer_options *opts,
+                   struct trailer_info *info,
+                   const char *str,
+                   struct list_head *head)
 {
-       struct trailer_info info;
        struct strbuf tok = STRBUF_INIT;
        struct strbuf val = STRBUF_INIT;
        size_t i;
 
-       trailer_info_get(&info, str, opts);
-
-       /* Print lines before the trailers as is */
-       if (!opts->only_trailers)
-               fwrite(str, 1, info.trailer_start - str, outfile);
-
-       if (!opts->only_trailers && !info.blank_line_before_trailer)
-               fprintf(outfile, "\n");
+       trailer_info_get(opts, str, info);
 
-       for (i = 0; i < info.trailer_nr; i++) {
+       for (i = 0; i < info->trailer_nr; i++) {
                int separator_pos;
-               char *trailer = info.trailers[i];
+               char *trailer = info->trailers[i];
                if (trailer[0] == comment_line_char)
                        continue;
                separator_pos = find_separator(trailer, separators);
@@ -1002,113 +1021,34 @@ static size_t process_input_file(FILE *outfile,
                                         strbuf_detach(&val, NULL));
                }
        }
-
-       trailer_info_release(&info);
-
-       return info.trailer_end - str;
 }
 
-static void free_all(struct list_head *head)
+void free_trailers(struct list_head *trailers)
 {
        struct list_head *pos, *p;
-       list_for_each_safe(pos, p, head) {
+       list_for_each_safe(pos, p, trailers) {
                list_del(pos);
                free_trailer_item(list_entry(pos, struct trailer_item, list));
        }
 }
 
-static struct tempfile *trailers_tempfile;
-
-static FILE *create_in_place_tempfile(const char *file)
+void trailer_info_get(const struct process_trailer_options *opts,
+                     const char *str,
+                     struct trailer_info *info)
 {
-       struct stat st;
-       struct strbuf filename_template = STRBUF_INIT;
-       const char *tail;
-       FILE *outfile;
-
-       if (stat(file, &st))
-               die_errno(_("could not stat %s"), file);
-       if (!S_ISREG(st.st_mode))
-               die(_("file %s is not a regular file"), file);
-       if (!(st.st_mode & S_IWUSR))
-               die(_("file %s is not writable by user"), file);
-
-       /* Create temporary file in the same directory as the original */
-       tail = strrchr(file, '/');
-       if (tail)
-               strbuf_add(&filename_template, file, tail - file + 1);
-       strbuf_addstr(&filename_template, "git-interpret-trailers-XXXXXX");
-
-       trailers_tempfile = xmks_tempfile_m(filename_template.buf, st.st_mode);
-       strbuf_release(&filename_template);
-       outfile = fdopen_tempfile(trailers_tempfile, "w");
-       if (!outfile)
-               die_errno(_("could not open temporary file"));
-
-       return outfile;
-}
-
-void process_trailers(const char *file,
-                     const struct process_trailer_options *opts,
-                     struct list_head *new_trailer_head)
-{
-       LIST_HEAD(head);
-       struct strbuf sb = STRBUF_INIT;
-       size_t trailer_end;
-       FILE *outfile = stdout;
-
-       ensure_configured();
-
-       read_input_file(&sb, file);
-
-       if (opts->in_place)
-               outfile = create_in_place_tempfile(file);
-
-       /* Print the lines before the trailers */
-       trailer_end = process_input_file(outfile, sb.buf, &head, opts);
-
-       if (!opts->only_input) {
-               LIST_HEAD(arg_head);
-               process_command_line_args(&arg_head, new_trailer_head);
-               process_trailers_lists(&head, &arg_head);
-       }
-
-       print_all(outfile, &head, opts);
-
-       free_all(&head);
-
-       /* Print the lines after the trailers as is */
-       if (!opts->only_trailers)
-               fwrite(sb.buf + trailer_end, 1, sb.len - trailer_end, outfile);
-
-       if (opts->in_place)
-               if (rename_tempfile(&trailers_tempfile, file))
-                       die_errno(_("could not rename temporary file to %s"), file);
-
-       strbuf_release(&sb);
-}
-
-void trailer_info_get(struct trailer_info *info, const char *str,
-                     const struct process_trailer_options *opts)
-{
-       int patch_start, trailer_end, trailer_start;
+       size_t end_of_log_message = 0, trailer_block_start = 0;
        struct strbuf **trailer_lines, **ptr;
        char **trailer_strings = NULL;
        size_t nr = 0, alloc = 0;
        char **last = NULL;
 
-       ensure_configured();
+       trailer_config_init();
 
-       if (opts->no_divider)
-               patch_start = strlen(str);
-       else
-               patch_start = find_patch_start(str);
-
-       trailer_end = find_trailer_end(str, patch_start);
-       trailer_start = find_trailer_start(str, trailer_end);
+       end_of_log_message = find_end_of_log_message(str, opts->no_divider);
+       trailer_block_start = find_trailer_block_start(str, end_of_log_message);
 
-       trailer_lines = strbuf_split_buf(str + trailer_start,
-                                        trailer_end - trailer_start,
+       trailer_lines = strbuf_split_buf(str + trailer_block_start,
+                                        end_of_log_message - trailer_block_start,
                                         '\n',
                                         0);
        for (ptr = trailer_lines; *ptr; ptr++) {
@@ -1129,9 +1069,9 @@ void trailer_info_get(struct trailer_info *info, const char *str,
        strbuf_list_free(trailer_lines);
 
        info->blank_line_before_trailer = ends_with_blank_line(str,
-                                                              trailer_start);
-       info->trailer_start = str + trailer_start;
-       info->trailer_end = str + trailer_end;
+                                                              trailer_block_start);
+       info->trailer_block_start = trailer_block_start;
+       info->trailer_block_end = end_of_log_message;
        info->trailers = trailer_strings;
        info->trailer_nr = nr;
 }
@@ -1144,22 +1084,13 @@ void trailer_info_release(struct trailer_info *info)
        free(info->trailers);
 }
 
-static void format_trailer_info(struct strbuf *out,
+static void format_trailer_info(const struct process_trailer_options *opts,
                                const struct trailer_info *info,
-                               const struct process_trailer_options *opts)
+                               struct strbuf *out)
 {
        size_t origlen = out->len;
        size_t i;
 
-       /* If we want the whole block untouched, we can take the fast path. */
-       if (!opts->only_trailers && !opts->unfold && !opts->filter &&
-           !opts->separator && !opts->key_only && !opts->value_only &&
-           !opts->key_value_separator) {
-               strbuf_add(out, info->trailer_start,
-                          info->trailer_end - info->trailer_start);
-               return;
-       }
-
        for (i = 0; i < info->trailer_nr; i++) {
                char *trailer = info->trailers[i];
                ssize_t separator_pos = find_separator(trailer, separators);
@@ -1204,13 +1135,25 @@ static void format_trailer_info(struct strbuf *out,
 
 }
 
-void format_trailers_from_commit(struct strbuf *out, const char *msg,
-                                const struct process_trailer_options *opts)
+void format_trailers_from_commit(const struct process_trailer_options *opts,
+                                const char *msg,
+                                struct strbuf *out)
 {
+       LIST_HEAD(trailer_objects);
        struct trailer_info info;
 
-       trailer_info_get(&info, msg, opts);
-       format_trailer_info(out, &info, opts);
+       parse_trailers(opts, &info, msg, &trailer_objects);
+
+       /* If we want the whole block untouched, we can take the fast path. */
+       if (!opts->only_trailers && !opts->unfold && !opts->filter &&
+           !opts->separator && !opts->key_only && !opts->value_only &&
+           !opts->key_value_separator) {
+               strbuf_add(out, msg + info.trailer_block_start,
+                          info.trailer_block_end - info.trailer_block_start);
+       } else
+               format_trailer_info(opts, &info, out);
+
+       free_trailers(&trailer_objects);
        trailer_info_release(&info);
 }
 
@@ -1220,14 +1163,14 @@ void trailer_iterator_init(struct trailer_iterator *iter, const char *msg)
        strbuf_init(&iter->key, 0);
        strbuf_init(&iter->val, 0);
        opts.no_divider = 1;
-       trailer_info_get(&iter->info, msg, &opts);
-       iter->cur = 0;
+       trailer_info_get(&opts, msg, &iter->internal.info);
+       iter->internal.cur = 0;
 }
 
 int trailer_iterator_advance(struct trailer_iterator *iter)
 {
-       while (iter->cur < iter->info.trailer_nr) {
-               char *trailer = iter->info.trailers[iter->cur++];
+       while (iter->internal.cur < iter->internal.info.trailer_nr) {
+               char *trailer = iter->internal.info.trailers[iter->internal.cur++];
                int separator_pos = find_separator(trailer, separators);
 
                if (separator_pos < 1)
@@ -1237,6 +1180,7 @@ int trailer_iterator_advance(struct trailer_iterator *iter)
                strbuf_reset(&iter->val);
                parse_trailer(&iter->key, &iter->val, NULL,
                              trailer, separator_pos);
+               /* Always unfold values during iteration. */
                unfold_value(&iter->val);
                return 1;
        }
@@ -1245,7 +1189,7 @@ int trailer_iterator_advance(struct trailer_iterator *iter)
 
 void trailer_iterator_release(struct trailer_iterator *iter)
 {
-       trailer_info_release(&iter->info);
+       trailer_info_release(&iter->internal.info);
        strbuf_release(&iter->val);
        strbuf_release(&iter->key);
 }
index 795d2fccfd9579500b798ac667feef2ee549f4b4..1d106b6dd403b7755e4c81a1a40c1eea8eeae1d6 100644 (file)
--- a/trailer.h
+++ b/trailer.h
@@ -32,16 +32,16 @@ int trailer_set_if_missing(enum trailer_if_missing *item, const char *value);
 struct trailer_info {
        /*
         * True if there is a blank line before the location pointed to by
-        * trailer_start.
+        * trailer_block_start.
         */
        int blank_line_before_trailer;
 
        /*
-        * Pointers to the start and end of the trailer block found. If there
-        * is no trailer block found, these 2 pointers point to the end of the
-        * input string.
+        * Offsets to the trailer block start and end positions in the input
+        * string. If no trailer block is found, these are both set to the
+        * "true" end of the input (find_end_of_log_message()).
         */
-       const char *trailer_start, *trailer_end;
+       size_t trailer_block_start, trailer_block_end;
 
        /*
         * Array of trailers found.
@@ -81,15 +81,31 @@ struct process_trailer_options {
 
 #define PROCESS_TRAILER_OPTIONS_INIT {0}
 
-void process_trailers(const char *file,
-                     const struct process_trailer_options *opts,
-                     struct list_head *new_trailer_head);
+void parse_trailers_from_config(struct list_head *config_head);
 
-void trailer_info_get(struct trailer_info *info, const char *str,
-                     const struct process_trailer_options *opts);
+void parse_trailers_from_command_line_args(struct list_head *arg_head,
+                                          struct list_head *new_trailer_head);
+
+void process_trailers_lists(struct list_head *head,
+                           struct list_head *arg_head);
+
+void parse_trailers(const struct process_trailer_options *,
+                   struct trailer_info *,
+                   const char *str,
+                   struct list_head *head);
+
+void trailer_info_get(const struct process_trailer_options *,
+                     const char *str,
+                     struct trailer_info *);
 
 void trailer_info_release(struct trailer_info *info);
 
+void trailer_config_init(void);
+void format_trailers(const struct process_trailer_options *,
+                    struct list_head *trailers,
+                    struct strbuf *out);
+void free_trailers(struct list_head *);
+
 /*
  * Format the trailers from the commit msg "msg" into the strbuf "out".
  * Note two caveats about "opts":
@@ -101,8 +117,9 @@ void trailer_info_release(struct trailer_info *info);
  *     only the trailer block itself, even if the "only_trailers" option is not
  *     set.
  */
-void format_trailers_from_commit(struct strbuf *out, const char *msg,
-                                const struct process_trailer_options *opts);
+void format_trailers_from_commit(const struct process_trailer_options *opts,
+                                const char *msg,
+                                struct strbuf *out);
 
 /*
  * An interface for iterating over the trailers found in a particular commit
@@ -119,8 +136,10 @@ struct trailer_iterator {
        struct strbuf val;
 
        /* private */
-       struct trailer_info info;
-       size_t cur;
+       struct {
+               struct trailer_info info;
+               size_t cur;
+       } internal;
 };
 
 /*
index 49811ef176dbc5af5e33fe47cf93cf1f57719f5e..b660b7942f9f9dbfc76193968d3511047b8afd84 100644 (file)
@@ -3,13 +3,11 @@
 #include "quote.h"
 #include "run-command.h"
 #include "commit.h"
-#include "diff.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "object-name.h"
 #include "repository.h"
-#include "revision.h"
 #include "remote.h"
 #include "string-list.h"
 #include "thread-utils.h"
@@ -19,6 +17,7 @@
 #include "refspec.h"
 #include "transport-internal.h"
 #include "protocol.h"
+#include "packfile.h"
 
 static int debug;
 
@@ -434,6 +433,8 @@ static int fetch_with_fetch(struct transport *transport,
                        warning(_("%s unexpectedly said: '%s'"), data->name, buf.buf);
        }
        strbuf_release(&buf);
+
+       reprepare_packed_git(the_repository);
        return 0;
 }
 
@@ -628,7 +629,8 @@ static int process_connect_service(struct transport *transport,
                ret = run_connect(transport, &cmdbuf);
        } else if (data->stateless_connect &&
                   (get_protocol_version_config() == protocol_v2) &&
-                  !strcmp("git-upload-pack", name)) {
+                  (!strcmp("git-upload-pack", name) ||
+                   !strcmp("git-upload-archive", name))) {
                strbuf_addf(&cmdbuf, "stateless-connect %s\n", name);
                ret = run_connect(transport, &cmdbuf);
                if (ret)
@@ -645,6 +647,7 @@ static int process_connect(struct transport *transport,
        struct helper_data *data = transport->data;
        const char *name;
        const char *exec;
+       int ret;
 
        name = for_push ? "git-receive-pack" : "git-upload-pack";
        if (for_push)
@@ -652,7 +655,10 @@ static int process_connect(struct transport *transport,
        else
                exec = data->transport_options.uploadpack;
 
-       return process_connect_service(transport, name, exec);
+       ret = process_connect_service(transport, name, exec);
+       if (ret)
+               do_take_over(transport);
+       return ret;
 }
 
 static int connect_helper(struct transport *transport, const char *name,
@@ -662,14 +668,14 @@ static int connect_helper(struct transport *transport, const char *name,
 
        /* Get_helper so connect is inited. */
        get_helper(transport);
-       if (!data->connect)
-               die(_("operation not supported by protocol"));
 
        if (!process_connect_service(transport, name, exec))
                die(_("can't connect to subservice %s"), name);
 
        fd[0] = data->helper->out;
        fd[1] = data->helper->in;
+
+       do_take_over(transport);
        return 0;
 }
 
@@ -684,10 +690,8 @@ static int fetch_refs(struct transport *transport,
 
        get_helper(transport);
 
-       if (process_connect(transport, 0)) {
-               do_take_over(transport);
+       if (process_connect(transport, 0))
                return transport->vtable->fetch_refs(transport, nr_heads, to_fetch);
-       }
 
        /*
         * If we reach here, then the server, the client, and/or the transport
@@ -1074,7 +1078,7 @@ static int push_refs_with_export(struct transport *transport,
        set_common_push_options(transport, data->name, flags);
        if (flags & TRANSPORT_PUSH_FORCE) {
                if (set_helper_option(transport, "force", "true") != 0)
-                       warning(_("helper %s does not support 'force'"), data->name);
+                       warning(_("helper %s does not support '--force'"), data->name);
        }
 
        helper = get_helper(transport);
@@ -1144,10 +1148,8 @@ static int push_refs(struct transport *transport,
 {
        struct helper_data *data = transport->data;
 
-       if (process_connect(transport, 1)) {
-               do_take_over(transport);
+       if (process_connect(transport, 1))
                return transport->vtable->push_refs(transport, remote_refs, flags);
-       }
 
        if (!remote_refs) {
                fprintf(stderr,
@@ -1188,11 +1190,9 @@ static struct ref *get_refs_list(struct transport *transport, int for_push,
 {
        get_helper(transport);
 
-       if (process_connect(transport, for_push)) {
-               do_take_over(transport);
+       if (process_connect(transport, for_push))
                return transport->vtable->get_refs_list(transport, for_push,
                                                        transport_options);
-       }
 
        return get_refs_list_using_list(transport, for_push);
 }
@@ -1276,10 +1276,8 @@ static int get_bundle_uri(struct transport *transport)
 {
        get_helper(transport);
 
-       if (process_connect(transport, 0)) {
-               do_take_over(transport);
+       if (process_connect(transport, 0))
                return transport->vtable->get_bundle_uri(transport);
-       }
 
        return -1;
 }
index 219af8fd50ed57c0fc0f954965e481b51e7aae72..df518ead70c387dd354dd69a5ee4af8a3ab0d560 100644 (file)
@@ -10,9 +10,7 @@
 #include "remote.h"
 #include "connect.h"
 #include "send-pack.h"
-#include "walker.h"
 #include "bundle.h"
-#include "dir.h"
 #include "gettext.h"
 #include "refs.h"
 #include "refspec.h"
@@ -26,7 +24,6 @@
 #include "transport-internal.h"
 #include "protocol.h"
 #include "object-name.h"
-#include "object-store-ll.h"
 #include "color.h"
 #include "bundle-uri.h"
 
@@ -1470,6 +1467,7 @@ int transport_push(struct repository *r,
        if (porcelain && !push_ret)
                puts("Done");
        else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
+               /* stable plumbing output; do not modify or localize */
                fprintf(stderr, "Everything up-to-date\n");
 
 done:
index 8fc159b86ec02ac54d6c8886351b6c3c0ba058b9..46107772d178f9b3706f288e6055a34a040db00c 100644 (file)
@@ -7,6 +7,7 @@
 #include "hash.h"
 #include "tree.h"
 #include "tree-walk.h"
+#include "environment.h"
 
 /*
  * Some mode bits are also used internally for computations.
@@ -45,7 +46,8 @@
 static struct combine_diff_path *ll_diff_tree_paths(
        struct combine_diff_path *p, const struct object_id *oid,
        const struct object_id **parents_oid, int nparent,
-       struct strbuf *base, struct diff_options *opt);
+       struct strbuf *base, struct diff_options *opt,
+       int depth);
 static void ll_diff_tree_oid(const struct object_id *old_oid,
                             const struct object_id *new_oid,
                             struct strbuf *base, struct diff_options *opt);
@@ -196,7 +198,7 @@ static struct combine_diff_path *path_appendnew(struct combine_diff_path *last,
 static struct combine_diff_path *emit_path(struct combine_diff_path *p,
        struct strbuf *base, struct diff_options *opt, int nparent,
        struct tree_desc *t, struct tree_desc *tp,
-       int imin)
+       int imin, int depth)
 {
        unsigned short mode;
        const char *path;
@@ -302,7 +304,8 @@ static struct combine_diff_path *emit_path(struct combine_diff_path *p,
 
                strbuf_add(base, path, pathlen);
                strbuf_addch(base, '/');
-               p = ll_diff_tree_paths(p, oid, parents_oid, nparent, base, opt);
+               p = ll_diff_tree_paths(p, oid, parents_oid, nparent, base, opt,
+                                      depth + 1);
                FAST_ARRAY_FREE(parents_oid, nparent);
        }
 
@@ -423,12 +426,16 @@ static inline void update_tp_entries(struct tree_desc *tp, int nparent)
 static struct combine_diff_path *ll_diff_tree_paths(
        struct combine_diff_path *p, const struct object_id *oid,
        const struct object_id **parents_oid, int nparent,
-       struct strbuf *base, struct diff_options *opt)
+       struct strbuf *base, struct diff_options *opt,
+       int depth)
 {
        struct tree_desc t, *tp;
        void *ttree, **tptree;
        int i;
 
+       if (depth > max_allowed_tree_depth)
+               die("exceeded maximum allowed tree depth");
+
        FAST_ARRAY_ALLOC(tp, nparent);
        FAST_ARRAY_ALLOC(tptree, nparent);
 
@@ -522,7 +529,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
 
                        /* D += {δ(t,pi) if pi=p[imin];  "+a" if pi > p[imin]} */
                        p = emit_path(p, base, opt, nparent,
-                                       &t, tp, imin);
+                                       &t, tp, imin, depth);
 
                skip_emit_t_tp:
                        /* t↓,  ∀ pi=p[imin]  pi↓ */
@@ -534,7 +541,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
                else if (cmp < 0) {
                        /* D += "+t" */
                        p = emit_path(p, base, opt, nparent,
-                                       &t, /*tp=*/NULL, -1);
+                                       &t, /*tp=*/NULL, -1, depth);
 
                        /* t↓ */
                        update_tree_entry(&t);
@@ -550,7 +557,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
                        }
 
                        p = emit_path(p, base, opt, nparent,
-                                       /*t=*/NULL, tp, imin);
+                                       /*t=*/NULL, tp, imin, depth);
 
                skip_emit_tp:
                        /* ∀ pi=p[imin]  pi↓ */
@@ -572,7 +579,7 @@ struct combine_diff_path *diff_tree_paths(
        const struct object_id **parents_oid, int nparent,
        struct strbuf *base, struct diff_options *opt)
 {
-       p = ll_diff_tree_paths(p, oid, parents_oid, nparent, base, opt);
+       p = ll_diff_tree_paths(p, oid, parents_oid, nparent, base, opt, 0);
 
        /*
         * free pre-allocated last element, if any
index 0b44ec7c75ffeabc217c7e7b04307762a36527ca..6565d9ad993bd830446277cc35a2aa54567cd18f 100644 (file)
@@ -9,6 +9,7 @@
 #include "tree.h"
 #include "pathspec.h"
 #include "json-writer.h"
+#include "environment.h"
 
 static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size, struct strbuf *err)
 {
@@ -89,7 +90,7 @@ void *fill_tree_descriptor(struct repository *r,
        if (oid) {
                buf = read_object_with_reference(r, oid, OBJ_TREE, &size, NULL);
                if (!buf)
-                       die("unable to read tree %s", oid_to_hex(oid));
+                       die(_("unable to read tree (%s)"), oid_to_hex(oid));
        }
        init_tree_desc(desc, oid, buf, size);
        return buf;
@@ -431,22 +432,25 @@ int traverse_trees(struct index_state *istate,
                   int n, struct tree_desc *t,
                   struct traverse_info *info)
 {
-       int error = 0;
-       struct name_entry entry[MAX_TRAVERSE_TREES];
+       int ret = 0;
+       struct name_entry *entry;
        int i;
-       struct tree_desc_x tx[ARRAY_SIZE(entry)];
+       struct tree_desc_x *tx;
        struct strbuf base = STRBUF_INIT;
        int interesting = 1;
        char *traverse_path;
 
+       if (traverse_trees_cur_depth > max_allowed_tree_depth)
+               return error("exceeded maximum allowed tree depth");
+
        traverse_trees_count++;
        traverse_trees_cur_depth++;
 
        if (traverse_trees_cur_depth > traverse_trees_max_depth)
                traverse_trees_max_depth = traverse_trees_cur_depth;
 
-       if (n >= ARRAY_SIZE(entry))
-               BUG("traverse_trees() called with too many trees (%d)", n);
+       ALLOC_ARRAY(entry, n);
+       ALLOC_ARRAY(tx, n);
 
        for (i = 0; i < n; i++) {
                tx[i].d = t[i];
@@ -529,7 +533,7 @@ int traverse_trees(struct index_state *istate,
                if (interesting) {
                        trees_used = info->fn(n, mask, dirmask, entry, info);
                        if (trees_used < 0) {
-                               error = trees_used;
+                               ret = trees_used;
                                if (!info->show_all_errors)
                                        break;
                        }
@@ -541,12 +545,14 @@ int traverse_trees(struct index_state *istate,
        }
        for (i = 0; i < n; i++)
                free_extended_entry(tx + i);
+       free(tx);
+       free(entry);
        free(traverse_path);
        info->traverse_path = NULL;
        strbuf_release(&base);
 
        traverse_trees_cur_depth--;
-       return error;
+       return ret;
 }
 
 struct dir_state {
index cf54d01019e9bcbd169b78aaa95a431b06d924dc..0b1067fbc51affd9ff98ed44fcaad043f9870a22 100644 (file)
@@ -6,8 +6,6 @@
 struct index_state;
 struct repository;
 
-#define MAX_TRAVERSE_TREES 8
-
 /**
  * The tree walking API is used to traverse and inspect trees.
  */
diff --git a/tree.c b/tree.c
index 44bcf728f10abaac759ff90af52c509a5d558305..7973d3f9a83228a70586cf211d8a8eec7b21f639 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -1,20 +1,19 @@
 #include "git-compat-util.h"
-#include "cache-tree.h"
 #include "hex.h"
 #include "tree.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "blob.h"
 #include "commit.h"
-#include "tag.h"
 #include "alloc.h"
 #include "tree-walk.h"
 #include "repository.h"
+#include "environment.h"
 
 const char *tree_type = "tree";
 
 int read_tree_at(struct repository *r,
                 struct tree *tree, struct strbuf *base,
+                int depth,
                 const struct pathspec *pathspec,
                 read_tree_fn_t fn, void *context)
 {
@@ -24,6 +23,9 @@ int read_tree_at(struct repository *r,
        int len, oldlen = base->len;
        enum interesting retval = entry_not_interesting;
 
+       if (depth > max_allowed_tree_depth)
+               return error("exceeded maximum allowed tree depth");
+
        if (parse_tree(tree))
                return -1;
 
@@ -74,7 +76,7 @@ int read_tree_at(struct repository *r,
                strbuf_add(base, entry.path, len);
                strbuf_addch(base, '/');
                retval = read_tree_at(r, lookup_tree(r, &oid),
-                                     base, pathspec,
+                                     base, depth + 1, pathspec,
                                      fn, context);
                strbuf_setlen(base, oldlen);
                if (retval)
@@ -89,7 +91,7 @@ int read_tree(struct repository *r,
              read_tree_fn_t fn, void *context)
 {
        struct strbuf sb = STRBUF_INIT;
-       int ret = read_tree_at(r, tree, &sb, pathspec, fn, context);
+       int ret = read_tree_at(r, tree, &sb, 0, pathspec, fn, context);
        strbuf_release(&sb);
        return ret;
 }
diff --git a/tree.h b/tree.h
index 1b5ecbda6b335b4962ee2150534dfd8c0a73964c..cc6ddf51b3273c2dbeb798b2cb945de29dd28a36 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -44,6 +44,7 @@ typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const c
 
 int read_tree_at(struct repository *r,
                 struct tree *tree, struct strbuf *base,
+                int depth,
                 const struct pathspec *pathspec,
                 read_tree_fn_t fn, void *context);
 
index e15fb0455bbd9d6b5fa113ec9bb5cea4f6b6d375..be5bf8c4f2ff28827507a70846907aeca731d530 100644 (file)
@@ -396,14 +396,13 @@ static const struct interval double_width[] = {
 { 0x2E80, 0x2E99 },
 { 0x2E9B, 0x2EF3 },
 { 0x2F00, 0x2FD5 },
-{ 0x2FF0, 0x2FFB },
-{ 0x3000, 0x303E },
+{ 0x2FF0, 0x303E },
 { 0x3041, 0x3096 },
 { 0x3099, 0x30FF },
 { 0x3105, 0x312F },
 { 0x3131, 0x318E },
 { 0x3190, 0x31E3 },
-{ 0x31F0, 0x321E },
+{ 0x31EF, 0x321E },
 { 0x3220, 0x3247 },
 { 0x3250, 0x4DBF },
 { 0x4E00, 0xA48C },
index 87517364dc0190acb499ca6d2972e69e1a9fe74e..c2b20b80d5a448b7b5c76d2de4ac9358fa596b69 100644 (file)
@@ -2,7 +2,7 @@
 #include "advice.h"
 #include "strvec.h"
 #include "repository.h"
-#include "config.h"
+#include "parse.h"
 #include "dir.h"
 #include "environment.h"
 #include "gettext.h"
@@ -864,8 +864,8 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
        struct unpack_trees_options *o = info->data;
        int i, ret, bottom;
        int nr_buf = 0;
-       struct tree_desc t[MAX_UNPACK_TREES];
-       void *buf[MAX_UNPACK_TREES];
+       struct tree_desc *t;
+       void **buf;
        struct traverse_info newinfo;
        struct name_entry *p;
        int nr_entries;
@@ -902,6 +902,9 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
        newinfo.pathlen = st_add3(newinfo.pathlen, tree_entry_len(p), 1);
        newinfo.df_conflicts |= df_conflicts;
 
+       ALLOC_ARRAY(t, n);
+       ALLOC_ARRAY(buf, n);
+
        /*
         * Fetch the tree from the ODB for each peer directory in the
         * n commits.
@@ -937,6 +940,8 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
 
        for (i = 0; i < nr_buf; i++)
                free(buf[i]);
+       free(buf);
+       free(t);
 
        return ret;
 }
index 9b827c307f6d565fe6becf25839f45f81340b8ce..5867e26e17777483f3fc5df0084deb7a4dd135da 100644 (file)
@@ -7,7 +7,7 @@
 #include "string-list.h"
 #include "tree-walk.h"
 
-#define MAX_UNPACK_TREES MAX_TRAVERSE_TREES
+#define MAX_UNPACK_TREES 8
 
 struct cache_entry;
 struct unpack_trees_options;
index 94751477ab2d1e1ee28c291d3b1aaaa75e5fe3d4..902144b9d3470b9a603a584f7f4207511b15dc2b 100644 (file)
@@ -9,13 +9,10 @@
 #include "repository.h"
 #include "object-store-ll.h"
 #include "oid-array.h"
-#include "tag.h"
 #include "object.h"
 #include "commit.h"
 #include "diff.h"
 #include "revision.h"
-#include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "run-command.h"
 #include "connect.h"
 #include "string-list.h"
 #include "strvec.h"
 #include "trace2.h"
-#include "prio-queue.h"
 #include "protocol.h"
-#include "quote.h"
 #include "upload-pack.h"
-#include "serve.h"
 #include "commit-graph.h"
 #include "commit-reach.h"
 #include "shallow.h"
 #include "write-or-die.h"
+#include "json-writer.h"
+#include "strmap.h"
 
 /* Remember to update object flag allocation in object.h */
 #define THEY_HAVE      (1u << 11)
@@ -66,12 +62,11 @@ struct upload_pack_data {
        struct string_list symref;                              /* v0 only */
        struct object_array want_obj;
        struct object_array have_obj;
-       struct oid_array haves;                                 /* v2 only */
-       struct string_list wanted_refs;                         /* v2 only */
+       struct strmap wanted_refs;                              /* v2 only */
        struct strvec hidden_refs;
 
        struct object_array shallows;
-       struct string_list deepen_not;
+       struct oidset deepen_not;
        struct object_array extra_edge_obj;
        int depth;
        timestamp_t deepen_since;
@@ -118,6 +113,8 @@ struct upload_pack_data {
        unsigned done : 1;                                      /* v2 only */
        unsigned allow_ref_in_want : 1;                         /* v2 only */
        unsigned allow_sideband_all : 1;                        /* v2 only */
+       unsigned seen_haves : 1;                                /* v2 only */
+       unsigned allow_packfile_uris : 1;                       /* v2 only */
        unsigned advertise_sid : 1;
        unsigned sent_capabilities : 1;
 };
@@ -125,13 +122,12 @@ struct upload_pack_data {
 static void upload_pack_data_init(struct upload_pack_data *data)
 {
        struct string_list symref = STRING_LIST_INIT_DUP;
-       struct string_list wanted_refs = STRING_LIST_INIT_DUP;
+       struct strmap wanted_refs = STRMAP_INIT;
        struct strvec hidden_refs = STRVEC_INIT;
        struct object_array want_obj = OBJECT_ARRAY_INIT;
        struct object_array have_obj = OBJECT_ARRAY_INIT;
-       struct oid_array haves = OID_ARRAY_INIT;
        struct object_array shallows = OBJECT_ARRAY_INIT;
-       struct string_list deepen_not = STRING_LIST_INIT_DUP;
+       struct oidset deepen_not = OID_ARRAY_INIT;
        struct string_list uri_protocols = STRING_LIST_INIT_DUP;
        struct object_array extra_edge_obj = OBJECT_ARRAY_INIT;
        struct string_list allowed_filters = STRING_LIST_INIT_DUP;
@@ -142,7 +138,6 @@ static void upload_pack_data_init(struct upload_pack_data *data)
        data->hidden_refs = hidden_refs;
        data->want_obj = want_obj;
        data->have_obj = have_obj;
-       data->haves = haves;
        data->shallows = shallows;
        data->deepen_not = deepen_not;
        data->uri_protocols = uri_protocols;
@@ -160,13 +155,12 @@ static void upload_pack_data_init(struct upload_pack_data *data)
 static void upload_pack_data_clear(struct upload_pack_data *data)
 {
        string_list_clear(&data->symref, 1);
-       string_list_clear(&data->wanted_refs, 1);
+       strmap_clear(&data->wanted_refs, 1);
        strvec_clear(&data->hidden_refs);
        object_array_clear(&data->want_obj);
        object_array_clear(&data->have_obj);
-       oid_array_clear(&data->haves);
        object_array_clear(&data->shallows);
-       string_list_clear(&data->deepen_not, 0);
+       oidset_clear(&data->deepen_not);
        object_array_clear(&data->extra_edge_obj);
        list_objects_filter_release(&data->filter_options);
        string_list_clear(&data->allowed_filters, 0);
@@ -468,7 +462,7 @@ static void create_pack_file(struct upload_pack_data *pack_data,
 
  fail:
        free(output_state);
-       send_client_data(3, abort_msg, sizeof(abort_msg),
+       send_client_data(3, abort_msg, strlen(abort_msg),
                         pack_data->use_sideband);
        die("git upload-pack: %s", abort_msg);
 }
@@ -476,7 +470,9 @@ static void create_pack_file(struct upload_pack_data *pack_data,
 static int do_got_oid(struct upload_pack_data *data, const struct object_id *oid)
 {
        int we_knew_they_have = 0;
-       struct object *o = parse_object(the_repository, oid);
+       struct object *o = parse_object_with_flags(the_repository, oid,
+                                                  PARSE_OBJECT_SKIP_HASH_CHECK |
+                                                  PARSE_OBJECT_DISCARD_TREE);
 
        if (!o)
                die("oops (%s)", oid_to_hex(oid));
@@ -533,8 +529,6 @@ static int get_common_commits(struct upload_pack_data *data,
        int got_other = 0;
        int sent_ready = 0;
 
-       save_commit_buffer = 0;
-
        for (;;) {
                const char *arg;
 
@@ -801,11 +795,12 @@ error:
        for (i = 0; i < data->want_obj.nr; i++) {
                struct object *o = data->want_obj.objects[i].item;
                if (!is_our_ref(o, data->allow_uor)) {
+                       error("git upload-pack: not our ref %s",
+                             oid_to_hex(&o->oid));
                        packet_writer_error(&data->writer,
                                            "upload-pack: not our ref %s",
                                            oid_to_hex(&o->oid));
-                       die("git upload-pack: not our ref %s",
-                           oid_to_hex(&o->oid));
+                       exit(128);
                }
        }
 }
@@ -930,12 +925,13 @@ static int send_shallow_list(struct upload_pack_data *data)
                strvec_push(&av, "rev-list");
                if (data->deepen_since)
                        strvec_pushf(&av, "--max-age=%"PRItime, data->deepen_since);
-               if (data->deepen_not.nr) {
+               if (oidset_size(&data->deepen_not)) {
+                       const struct object_id *oid;
+                       struct oidset_iter iter;
                        strvec_push(&av, "--not");
-                       for (i = 0; i < data->deepen_not.nr; i++) {
-                               struct string_list_item *s = data->deepen_not.items + i;
-                               strvec_push(&av, s->string);
-                       }
+                       oidset_iter_init(&data->deepen_not, &iter);
+                       while ((oid = oidset_iter_next(&iter)))
+                               strvec_push(&av, oid_to_hex(oid));
                        strvec_push(&av, "--not");
                }
                for (i = 0; i < data->want_obj.nr; i++) {
@@ -1011,7 +1007,7 @@ static int process_deepen_since(const char *line, timestamp_t *deepen_since, int
        return 0;
 }
 
-static int process_deepen_not(const char *line, struct string_list *deepen_not, int *deepen_rev_list)
+static int process_deepen_not(const char *line, struct oidset *deepen_not, int *deepen_rev_list)
 {
        const char *arg;
        if (skip_prefix(line, "deepen-not ", &arg)) {
@@ -1019,7 +1015,7 @@ static int process_deepen_not(const char *line, struct string_list *deepen_not,
                struct object_id oid;
                if (expand_ref(the_repository, arg, strlen(arg), &oid, &ref) != 1)
                        die("git upload-pack: ambiguous deepen-not: %s", line);
-               string_list_append(deepen_not, ref);
+               oidset_insert(deepen_not, &oid);
                free(ref);
                *deepen_rev_list = 1;
                return 1;
@@ -1155,7 +1151,9 @@ static void receive_needs(struct upload_pack_data *data,
                        free(client_sid);
                }
 
-               o = parse_object(the_repository, &oid_buf);
+               o = parse_object_with_flags(the_repository, &oid_buf,
+                                           PARSE_OBJECT_SKIP_HASH_CHECK |
+                                           PARSE_OBJECT_DISCARD_TREE);
                if (!o) {
                        packet_writer_error(&data->writer,
                                            "upload-pack: not our ref %s",
@@ -1366,6 +1364,9 @@ static int upload_pack_config(const char *var, const char *value,
                data->allow_ref_in_want = git_config_bool(var, value);
        } else if (!strcmp("uploadpack.allowsidebandall", var)) {
                data->allow_sideband_all = git_config_bool(var, value);
+       } else if (!strcmp("uploadpack.blobpackfileuri", var)) {
+               if (value)
+                       data->allow_packfile_uris = 1;
        } else if (!strcmp("core.precomposeunicode", var)) {
                precomposed_unicode = git_config_bool(var, value);
        } else if (!strcmp("transfer.advertisesid", var)) {
@@ -1389,10 +1390,13 @@ static int upload_pack_protected_config(const char *var, const char *value,
        return 0;
 }
 
-static void get_upload_pack_config(struct upload_pack_data *data)
+static void get_upload_pack_config(struct repository *r,
+                                  struct upload_pack_data *data)
 {
-       git_config(upload_pack_config, data);
+       repo_config(r, upload_pack_config, data);
        git_protected_config(upload_pack_protected_config, data);
+
+       data->allow_sideband_all |= git_env_bool("GIT_TEST_SIDEBAND_ALL", 0);
 }
 
 void upload_pack(const int advertise_refs, const int stateless_rpc,
@@ -1402,7 +1406,7 @@ void upload_pack(const int advertise_refs, const int stateless_rpc,
        struct upload_pack_data data;
 
        upload_pack_data_init(&data);
-       get_upload_pack_config(&data);
+       get_upload_pack_config(the_repository, &data);
 
        data.stateless_rpc = stateless_rpc;
        data.timeout = timeout;
@@ -1472,7 +1476,8 @@ static int parse_want(struct packet_writer *writer, const char *line,
                            "expected to get oid, not '%s'", line);
 
                o = parse_object_with_flags(the_repository, &oid,
-                                           PARSE_OBJECT_SKIP_HASH_CHECK);
+                                           PARSE_OBJECT_SKIP_HASH_CHECK |
+                                           PARSE_OBJECT_DISCARD_TREE);
 
                if (!o) {
                        packet_writer_error(writer,
@@ -1494,14 +1499,13 @@ static int parse_want(struct packet_writer *writer, const char *line,
 }
 
 static int parse_want_ref(struct packet_writer *writer, const char *line,
-                         struct string_list *wanted_refs,
+                         struct strmap *wanted_refs,
                          struct strvec *hidden_refs,
                          struct object_array *want_obj)
 {
        const char *refname_nons;
        if (skip_prefix(line, "want-ref ", &refname_nons)) {
                struct object_id oid;
-               struct string_list_item *item;
                struct object *o = NULL;
                struct strbuf refname = STRBUF_INIT;
 
@@ -1513,8 +1517,11 @@ static int parse_want_ref(struct packet_writer *writer, const char *line,
                }
                strbuf_release(&refname);
 
-               item = string_list_append(wanted_refs, refname_nons);
-               item->util = oiddup(&oid);
+               if (strmap_put(wanted_refs, refname_nons, oiddup(&oid))) {
+                       packet_writer_error(writer, "duplicate want-ref %s",
+                                           refname_nons);
+                       die("duplicate want-ref %s", refname_nons);
+               }
 
                if (!starts_with(refname_nons, "refs/tags/")) {
                        struct commit *commit = lookup_commit_in_graph(the_repository, &oid);
@@ -1536,21 +1543,44 @@ static int parse_want_ref(struct packet_writer *writer, const char *line,
        return 0;
 }
 
-static int parse_have(const char *line, struct oid_array *haves)
+static int parse_have(const char *line, struct upload_pack_data *data)
 {
        const char *arg;
        if (skip_prefix(line, "have ", &arg)) {
                struct object_id oid;
 
-               if (get_oid_hex(arg, &oid))
-                       die("git upload-pack: expected SHA1 object, got '%s'", arg);
-               oid_array_append(haves, &oid);
+               got_oid(data, arg, &oid);
+               data->seen_haves = 1;
                return 1;
        }
 
        return 0;
 }
 
+static void trace2_fetch_info(struct upload_pack_data *data)
+{
+       struct json_writer jw = JSON_WRITER_INIT;
+
+       jw_object_begin(&jw, 0);
+       jw_object_intmax(&jw, "haves", data->have_obj.nr);
+       jw_object_intmax(&jw, "wants", data->want_obj.nr);
+       jw_object_intmax(&jw, "want-refs", strmap_get_size(&data->wanted_refs));
+       jw_object_intmax(&jw, "depth", data->depth);
+       jw_object_intmax(&jw, "shallows", data->shallows.nr);
+       jw_object_bool(&jw, "deepen-since", data->deepen_since);
+       jw_object_intmax(&jw, "deepen-not", oidset_size(&data->deepen_not));
+       jw_object_bool(&jw, "deepen-relative", data->deepen_relative);
+       if (data->filter_options.choice)
+               jw_object_string(&jw, "filter", list_object_filter_config_name(data->filter_options.choice));
+       else
+               jw_object_null(&jw, "filter");
+       jw_end(&jw);
+
+       trace2_data_json("upload-pack", the_repository, "fetch-info", &jw);
+
+       jw_release(&jw);
+}
+
 static void process_args(struct packet_reader *request,
                         struct upload_pack_data *data)
 {
@@ -1566,7 +1596,7 @@ static void process_args(struct packet_reader *request,
                                   &data->hidden_refs, &data->want_obj))
                        continue;
                /* process have line */
-               if (parse_have(arg, &data->haves))
+               if (parse_have(arg, data))
                        continue;
 
                /* process args like thin-pack */
@@ -1618,14 +1648,17 @@ static void process_args(struct packet_reader *request,
                        continue;
                }
 
-               if ((git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
-                    data->allow_sideband_all) &&
+               if (data->allow_sideband_all &&
                    !strcmp(arg, "sideband-all")) {
                        data->writer.use_sideband = 1;
                        continue;
                }
 
-               if (skip_prefix(arg, "packfile-uris ", &p)) {
+               if (data->allow_packfile_uris &&
+                   skip_prefix(arg, "packfile-uris ", &p)) {
+                       if (data->uri_protocols.nr)
+                               send_err_and_die(data,
+                                                "multiple packfile-uris lines forbidden");
                        string_list_split(&data->uri_protocols, p, ',', -1);
                        continue;
                }
@@ -1639,29 +1672,12 @@ static void process_args(struct packet_reader *request,
 
        if (request->status != PACKET_READ_FLUSH)
                die(_("expected flush after fetch arguments"));
-}
-
-static int process_haves(struct upload_pack_data *data, struct oid_array *common)
-{
-       int i;
 
-       /* Process haves */
-       for (i = 0; i < data->haves.nr; i++) {
-               const struct object_id *oid = &data->haves.oid[i];
-
-               if (!repo_has_object_file_with_flags(the_repository, oid,
-                                                    OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
-                       continue;
-
-               oid_array_append(common, oid);
-
-               do_got_oid(data, oid);
-       }
-
-       return 0;
+       if (trace2_is_enabled())
+               trace2_fetch_info(data);
 }
 
-static int send_acks(struct upload_pack_data *data, struct oid_array *acks)
+static int send_acks(struct upload_pack_data *data, struct object_array *acks)
 {
        int i;
 
@@ -1673,7 +1689,7 @@ static int send_acks(struct upload_pack_data *data, struct oid_array *acks)
 
        for (i = 0; i < acks->nr; i++) {
                packet_writer_write(&data->writer, "ACK %s\n",
-                                   oid_to_hex(&acks->oid[i]));
+                                   oid_to_hex(&acks->objects[i].item->oid));
        }
 
        if (!data->wait_for_done && ok_to_give_up(data)) {
@@ -1687,13 +1703,11 @@ static int send_acks(struct upload_pack_data *data, struct oid_array *acks)
 
 static int process_haves_and_send_acks(struct upload_pack_data *data)
 {
-       struct oid_array common = OID_ARRAY_INIT;
        int ret = 0;
 
-       process_haves(data, &common);
        if (data->done) {
                ret = 1;
-       } else if (send_acks(data, &common)) {
+       } else if (send_acks(data, &data->have_obj)) {
                packet_writer_delim(&data->writer);
                ret = 1;
        } else {
@@ -1702,24 +1716,23 @@ static int process_haves_and_send_acks(struct upload_pack_data *data)
                ret = 0;
        }
 
-       oid_array_clear(&data->haves);
-       oid_array_clear(&common);
        return ret;
 }
 
 static void send_wanted_ref_info(struct upload_pack_data *data)
 {
-       const struct string_list_item *item;
+       struct hashmap_iter iter;
+       const struct strmap_entry *e;
 
-       if (!data->wanted_refs.nr)
+       if (strmap_empty(&data->wanted_refs))
                return;
 
        packet_writer_write(&data->writer, "wanted-refs\n");
 
-       for_each_string_list_item(item, &data->wanted_refs) {
+       strmap_for_each_entry(&data->wanted_refs, &iter, e) {
                packet_writer_write(&data->writer, "%s %s\n",
-                                   oid_to_hex(item->util),
-                                   item->string);
+                                   oid_to_hex(e->value),
+                                   e->key);
        }
 
        packet_writer_delim(&data->writer);
@@ -1748,7 +1761,7 @@ enum fetch_state {
        FETCH_DONE,
 };
 
-int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
+int upload_pack_v2(struct repository *r, struct packet_reader *request)
 {
        enum fetch_state state = FETCH_PROCESS_ARGS;
        struct upload_pack_data data;
@@ -1757,7 +1770,7 @@ int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
 
        upload_pack_data_init(&data);
        data.use_sideband = LARGE_PACKET_MAX;
-       get_upload_pack_config(&data);
+       get_upload_pack_config(r, &data);
 
        while (state != FETCH_DONE) {
                switch (state) {
@@ -1773,7 +1786,7 @@ int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
                                 * they didn't want anything.
                                 */
                                state = FETCH_DONE;
-                       } else if (data.haves.nr) {
+                       } else if (data.seen_haves) {
                                /*
                                 * Request had 'have' lines, so lets ACK them.
                                 */
@@ -1816,41 +1829,28 @@ int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
 int upload_pack_advertise(struct repository *r,
                          struct strbuf *value)
 {
-       if (value) {
-               int allow_filter_value;
-               int allow_ref_in_want;
-               int allow_sideband_all_value;
-               char *str = NULL;
+       struct upload_pack_data data;
+
+       upload_pack_data_init(&data);
+       get_upload_pack_config(r, &data);
 
+       if (value) {
                strbuf_addstr(value, "shallow wait-for-done");
 
-               if (!repo_config_get_bool(r,
-                                        "uploadpack.allowfilter",
-                                        &allow_filter_value) &&
-                   allow_filter_value)
+               if (data.allow_filter)
                        strbuf_addstr(value, " filter");
 
-               if (!repo_config_get_bool(r,
-                                        "uploadpack.allowrefinwant",
-                                        &allow_ref_in_want) &&
-                   allow_ref_in_want)
+               if (data.allow_ref_in_want)
                        strbuf_addstr(value, " ref-in-want");
 
-               if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
-                   (!repo_config_get_bool(r,
-                                          "uploadpack.allowsidebandall",
-                                          &allow_sideband_all_value) &&
-                    allow_sideband_all_value))
+               if (data.allow_sideband_all)
                        strbuf_addstr(value, " sideband-all");
 
-               if (!repo_config_get_string(r,
-                                           "uploadpack.blobpackfileuri",
-                                           &str) &&
-                   str) {
+               if (data.allow_packfile_uris)
                        strbuf_addstr(value, " packfile-uris");
-                       free(str);
-               }
        }
 
+       upload_pack_data_clear(&data);
+
        return 1;
 }
diff --git a/url.c b/url.c
index 2e1a9f6feec96b055a9415748eb721937461c07f..282b12495ae7d4af9db51a76017af6065b924d3a 100644 (file)
--- a/url.c
+++ b/url.c
@@ -1,5 +1,5 @@
 #include "git-compat-util.h"
-#include "hex.h"
+#include "hex-ll.h"
 #include "strbuf.h"
 #include "url.h"
 
index 1c45f23adf2c2fe770c147e9bbf0d5a557fcf688..1d0254abacbc3f393062351bc55ccd9bef32051a 100644 (file)
@@ -1,6 +1,6 @@
 #include "git-compat-util.h"
 #include "gettext.h"
-#include "hex.h"
+#include "hex-ll.h"
 #include "strbuf.h"
 #include "urlmatch.h"
 
index e399543823bdf2c0c8f24fb87f7622ac4d8a366b..92ef649c99ef49d1b21688584ad7d3bbbff6b737 100644 (file)
@@ -3,6 +3,7 @@
 #include "userdiff.h"
 #include "attr.h"
 #include "strbuf.h"
+#include "environment.h"
 
 static struct userdiff_driver *drivers;
 static int ndrivers;
@@ -323,8 +324,7 @@ static int userdiff_find_by_namelen_cb(struct userdiff_driver *driver,
 {
        struct find_by_namelen_data *cb_data = priv;
 
-       if (!strncmp(driver->name, cb_data->name, cb_data->len) &&
-           !driver->name[cb_data->len]) {
+       if (!xstrncmpz(driver->name, cb_data->name, cb_data->len)) {
                cb_data->driver = driver;
                return 1; /* tell the caller to stop iterating */
        }
@@ -460,7 +460,8 @@ struct userdiff_driver *userdiff_get_textconv(struct repository *r,
        if (!driver->textconv)
                return NULL;
 
-       if (driver->textconv_want_cache && !driver->textconv_cache) {
+       if (driver->textconv_want_cache && !driver->textconv_cache &&
+           have_git_dir()) {
                struct notes_cache *c = xmalloc(sizeof(*c));
                struct strbuf name = STRBUF_INIT;
 
diff --git a/utf8.c b/utf8.c
index 6a0dd25b0fe414764f89ae48384f68c959dcafe3..6bfaefa28ebbbfd145b30b58fe0e937ea921ec91 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -2,7 +2,7 @@
 #include "strbuf.h"
 #include "utf8.h"
 
-/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */
+/* This code is originally from https://www.cl.cam.ac.uk/~mgk25/ucs/ */
 
 static const char utf16_be_bom[] = {'\xFE', '\xFF'};
 static const char utf16_le_bom[] = {'\xFF', '\xFE'};
diff --git a/utf8.h b/utf8.h
index b68efef6f4398dae9617e6c5eaa81b0ddcebcb6e..35df76086a6c91a414190f7af8d05f0f0042ecda 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -83,7 +83,7 @@ void strbuf_utf8_align(struct strbuf *buf, align_type position, unsigned int wid
  * BOM must not be used [1]. The same applies for the UTF-32 equivalents.
  * The function returns true if this rule is violated.
  *
- * [1] http://unicode.org/faq/utf_bom.html#bom10
+ * [1] https://unicode.org/faq/utf_bom.html#bom10
  */
 int has_prohibited_utf_bom(const char *enc, const char *data, size_t len);
 
@@ -99,8 +99,8 @@ int has_prohibited_utf_bom(const char *enc, const char *data, size_t len);
  * Therefore, strictly requiring a BOM seems to be the safest option for
  * content in Git.
  *
- * [1] http://unicode.org/faq/utf_bom.html#gen6
- * [2] http://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
+ * [1] https://unicode.org/faq/utf_bom.html#gen6
+ * [2] https://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
  *     Section 3.10, D98, page 132
  * [3] https://encoding.spec.whatwg.org/#utf-16le
  */
index b8cf29e6a1587f5cbb2440a83ef5349fe49d0f48..b02a05a74a341157fa8dff7da22936127bebf18e 100644 (file)
 #include "wt-status.h"
 #include "config.h"
 
+void free_worktree(struct worktree *worktree)
+{
+       if (!worktree)
+               return;
+       free(worktree->path);
+       free(worktree->id);
+       free(worktree->head_ref);
+       free(worktree->lock_reason);
+       free(worktree->prune_reason);
+       free(worktree);
+}
+
 void free_worktrees(struct worktree **worktrees)
 {
        int i = 0;
-
-       for (i = 0; worktrees[i]; i++) {
-               free(worktrees[i]->path);
-               free(worktrees[i]->id);
-               free(worktrees[i]->head_ref);
-               free(worktrees[i]->lock_reason);
-               free(worktrees[i]->prune_reason);
-               free(worktrees[i]);
-       }
+       for (i = 0; worktrees[i]; i++)
+               free_worktree(worktrees[i]);
        free (worktrees);
 }
 
@@ -51,7 +56,7 @@ static void add_head_info(struct worktree *wt)
 /**
  * get the main worktree
  */
-static struct worktree *get_main_worktree(void)
+static struct worktree *get_main_worktree(int skip_reading_head)
 {
        struct worktree *worktree = NULL;
        struct strbuf worktree_path = STRBUF_INIT;
@@ -70,11 +75,13 @@ static struct worktree *get_main_worktree(void)
         */
        worktree->is_bare = (is_bare_repository_cfg == 1) ||
                is_bare_repository();
-       add_head_info(worktree);
+       if (!skip_reading_head)
+               add_head_info(worktree);
        return worktree;
 }
 
-static struct worktree *get_linked_worktree(const char *id)
+struct worktree *get_linked_worktree(const char *id,
+                                    int skip_reading_head)
 {
        struct worktree *worktree = NULL;
        struct strbuf path = STRBUF_INIT;
@@ -93,7 +100,8 @@ static struct worktree *get_linked_worktree(const char *id)
        CALLOC_ARRAY(worktree, 1);
        worktree->path = strbuf_detach(&worktree_path, NULL);
        worktree->id = xstrdup(id);
-       add_head_info(worktree);
+       if (!skip_reading_head)
+               add_head_info(worktree);
 
 done:
        strbuf_release(&path);
@@ -118,7 +126,14 @@ static void mark_current_worktree(struct worktree **worktrees)
        free(git_dir);
 }
 
-struct worktree **get_worktrees(void)
+/*
+ * NEEDSWORK: This function exists so that we can look up metadata of a
+ * worktree without trying to access any of its internals like the refdb. It
+ * would be preferable to instead have a corruption-tolerant function for
+ * retrieving worktree metadata that could be used when the worktree is known
+ * to not be in a healthy state, e.g. when creating or repairing it.
+ */
+static struct worktree **get_worktrees_internal(int skip_reading_head)
 {
        struct worktree **list = NULL;
        struct strbuf path = STRBUF_INIT;
@@ -128,7 +143,7 @@ struct worktree **get_worktrees(void)
 
        ALLOC_ARRAY(list, alloc);
 
-       list[counter++] = get_main_worktree();
+       list[counter++] = get_main_worktree(skip_reading_head);
 
        strbuf_addf(&path, "%s/worktrees", get_git_common_dir());
        dir = opendir(path.buf);
@@ -137,7 +152,7 @@ struct worktree **get_worktrees(void)
                while ((d = readdir_skip_dot_and_dotdot(dir)) != NULL) {
                        struct worktree *linked = NULL;
 
-                       if ((linked = get_linked_worktree(d->d_name))) {
+                       if ((linked = get_linked_worktree(d->d_name, skip_reading_head))) {
                                ALLOC_GROW(list, counter + 1, alloc);
                                list[counter++] = linked;
                        }
@@ -151,6 +166,11 @@ struct worktree **get_worktrees(void)
        return list;
 }
 
+struct worktree **get_worktrees(void)
+{
+       return get_worktrees_internal(0);
+}
+
 const char *get_worktree_git_dir(const struct worktree *wt)
 {
        if (!wt)
@@ -395,9 +415,9 @@ int is_worktree_being_bisected(const struct worktree *wt,
 
        memset(&state, 0, sizeof(state));
        found_bisect = wt_status_check_bisect(wt, &state) &&
-                      state.branch &&
+                      state.bisecting_from &&
                       skip_prefix(target, "refs/heads/", &target) &&
-                      !strcmp(state.branch, target);
+                      !strcmp(state.bisecting_from, target);
        wt_status_state_free_buffers(&state);
        return found_bisect;
 }
@@ -581,15 +601,17 @@ static void repair_gitfile(struct worktree *wt,
        strbuf_release(&dotgit);
 }
 
-static void repair_noop(int iserr, const char *path, const char *msg,
-                       void *cb_data)
+static void repair_noop(int iserr UNUSED,
+                       const char *path UNUSED,
+                       const char *msg UNUSED,
+                       void *cb_data UNUSED)
 {
        /* nothing */
 }
 
 void repair_worktrees(worktree_repair_fn fn, void *cb_data)
 {
-       struct worktree **worktrees = get_worktrees();
+       struct worktree **worktrees = get_worktrees_internal(1);
        struct worktree **wt = worktrees + 1; /* +1 skips main worktree */
 
        if (!fn)
index ce45b66de9e82d4d619b6f74e0e77c8bd5ab3f53..f14784a2ff871c69e5b5e28466439201721407b2 100644 (file)
@@ -57,6 +57,13 @@ struct worktree *find_worktree(struct worktree **list,
                               const char *prefix,
                               const char *arg);
 
+/*
+ * Look up the worktree corresponding to `id`, or NULL of no such worktree
+ * exists.
+ */
+struct worktree *get_linked_worktree(const char *id,
+                                    int skip_reading_head);
+
 /*
  * Return the worktree corresponding to `path`, or NULL if no such worktree
  * exists.
@@ -134,6 +141,11 @@ void repair_worktrees(worktree_repair_fn, void *cb_data);
  */
 void repair_worktree_at_path(const char *, worktree_repair_fn, void *cb_data);
 
+/*
+ * Free up the memory for a worktree.
+ */
+void free_worktree(struct worktree *);
+
 /*
  * Free up the memory for worktree(s)
  */
index 5160c9e28de87af79e561db5917d021ad9a3a562..eeac3741cf1a4e90ceab3bef07028aad632ebfb6 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -3,10 +3,8 @@
  */
 #include "git-compat-util.h"
 #include "abspath.h"
-#include "config.h"
+#include "parse.h"
 #include "gettext.h"
-#include "object.h"
-#include "repository.h"
 #include "strbuf.h"
 #include "trace2.h"
 
@@ -632,11 +630,6 @@ int rmdir_or_warn(const char *file)
        return warn_if_unremovable("rmdir", file, rmdir(file));
 }
 
-int remove_or_warn(unsigned int mode, const char *file)
-{
-       return S_ISGITLINK(mode) ? rmdir_or_warn(file) : unlink_or_warn(file);
-}
-
 static int access_error_is_ok(int err, unsigned flag)
 {
        return (is_missing_file_error(err) ||
@@ -819,3 +812,13 @@ int csprng_bytes(void *buf, size_t len)
        return 0;
 #endif
 }
+
+uint32_t git_rand(void)
+{
+       uint32_t result;
+
+       if (csprng_bytes(&result, sizeof(result)) < 0)
+               die(_("unable to get random bytes"));
+
+       return result;
+}
index 79a9c1b5077b4df0bef51538b778abba220740e6..1b2b047ea069272052b13371c31ca06924231cc9 100644 (file)
--- a/wrapper.h
+++ b/wrapper.h
@@ -106,11 +106,6 @@ int unlink_or_msg(const char *file, struct strbuf *err);
  * not exist.
  */
 int rmdir_or_warn(const char *path);
-/*
- * Calls the correct function out of {unlink,rmdir}_or_warn based on
- * the supplied file mode.
- */
-int remove_or_warn(unsigned int mode, const char *path);
 
 /*
  * Call access(2), but warn for any error except "missing file"
@@ -139,4 +134,10 @@ void sleep_millisec(int millisec);
  */
 int csprng_bytes(void *buf, size_t len);
 
+/*
+ * Returns a random uint32_t, uniformly distributed across all possible
+ * values.
+ */
+uint32_t git_rand(void);
+
 #endif /* WRAPPER_H */
index d8355c0c3e36830f8b9dbd9af696ed3917860c9e..01a9a51fa2fcd758b32ffc8f3e75811710804754 100644 (file)
@@ -1,5 +1,5 @@
 #include "git-compat-util.h"
-#include "config.h"
+#include "parse.h"
 #include "run-command.h"
 #include "write-or-die.h"
 
  */
 void maybe_flush_or_die(FILE *f, const char *desc)
 {
-       static int skip_stdout_flush = -1;
-       struct stat st;
-       char *cp;
-
        if (f == stdout) {
-               if (skip_stdout_flush < 0) {
-                       /* NEEDSWORK: make this a normal Boolean */
-                       cp = getenv("GIT_FLUSH");
-                       if (cp)
-                               skip_stdout_flush = (atoi(cp) == 0);
-                       else if ((fstat(fileno(stdout), &st) == 0) &&
-                                S_ISREG(st.st_mode))
-                               skip_stdout_flush = 1;
-                       else
-                               skip_stdout_flush = 0;
+               static int force_flush_stdout = -1;
+
+               if (force_flush_stdout < 0) {
+                       force_flush_stdout = git_env_bool("GIT_FLUSH", -1);
+                       if (force_flush_stdout < 0) {
+                               struct stat st;
+                               if (fstat(fileno(stdout), &st))
+                                       force_flush_stdout = 1;
+                               else
+                                       force_flush_stdout = !S_ISREG(st.st_mode);
+                       }
                }
-               if (skip_stdout_flush && !ferror(f))
+               if (!force_flush_stdout && !ferror(f))
                        return;
        }
        if (fflush(f)) {
index 5b1378965c9aa37505a23cf9c472f1abe4d8503e..2db4bb3a1293bb69e081efcf98489a63ca2d812a 100644 (file)
@@ -675,7 +675,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)
        rev.diffopt.flags.recursive = 1;
 
        copy_pathspec(&rev.prune_data, &s->pathspec);
-       run_diff_index(&rev, 1);
+       run_diff_index(&rev, DIFF_INDEX_CACHED);
        release_revisions(&rev);
 }
 
@@ -739,7 +739,7 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
                        ps.max_depth = -1;
 
                        strbuf_add(&base, ce->name, ce->ce_namelen);
-                       read_tree_at(istate->repo, tree, &base, &ps,
+                       read_tree_at(istate->repo, tree, &base, 0, &ps,
                                     add_file_to_list, s);
                        continue;
                }
@@ -861,6 +861,7 @@ void wt_status_state_free_buffers(struct wt_status_state *state)
        FREE_AND_NULL(state->branch);
        FREE_AND_NULL(state->onto);
        FREE_AND_NULL(state->detached_from);
+       FREE_AND_NULL(state->bisecting_from);
 }
 
 static void wt_longstatus_print_unmerged(struct wt_status *s)
@@ -1092,8 +1093,11 @@ size_t wt_status_locate_end(const char *s, size_t len)
        strbuf_addf(&pattern, "\n%c %s", comment_line_char, cut_line);
        if (starts_with(s, pattern.buf + 1))
                len = 0;
-       else if ((p = strstr(s, pattern.buf)))
-               len = p - s + 1;
+       else if ((p = strstr(s, pattern.buf))) {
+               size_t newlen = p - s + 1;
+               if (newlen < len)
+                       len = newlen;
+       }
        strbuf_release(&pattern);
        return len;
 }
@@ -1106,12 +1110,15 @@ void wt_status_append_cut_line(struct strbuf *buf)
        strbuf_add_commented_lines(buf, explanation, strlen(explanation), comment_line_char);
 }
 
-void wt_status_add_cut_line(FILE *fp)
+void wt_status_add_cut_line(struct wt_status *s)
 {
        struct strbuf buf = STRBUF_INIT;
 
+       if (s->added_cut_line)
+               return;
+       s->added_cut_line = 1;
        wt_status_append_cut_line(&buf);
-       fputs(buf.buf, fp);
+       fputs(buf.buf, s->fp);
        strbuf_release(&buf);
 }
 
@@ -1142,11 +1149,12 @@ static void wt_longstatus_print_verbose(struct wt_status *s)
         * file (and even the "auto" setting won't work, since it
         * will have checked isatty on stdout). But we then do want
         * to insert the scissor line here to reliably remove the
-        * diff before committing.
+        * diff before committing, if we didn't already include one
+        * before.
         */
        if (s->fp != stdout) {
                rev.diffopt.use_color = 0;
-               wt_status_add_cut_line(s->fp);
+               wt_status_add_cut_line(s);
        }
        if (s->verbose > 1 && s->committable) {
                /* print_updated() printed a header, so do we */
@@ -1156,7 +1164,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s)
                rev.diffopt.a_prefix = "c/";
                rev.diffopt.b_prefix = "i/";
        } /* else use prefix as per user config */
-       run_diff_index(&rev, 1);
+       run_diff_index(&rev, DIFF_INDEX_CACHED);
        if (s->verbose > 1 &&
            wt_status_check_worktree_changes(s, &dirty_submodules)) {
                status_printf_ln(s, c,
@@ -1295,26 +1303,32 @@ static char *read_line_from_git_path(const char *filename)
 static int split_commit_in_progress(struct wt_status *s)
 {
        int split_in_progress = 0;
-       char *head, *orig_head, *rebase_amend, *rebase_orig_head;
+       struct object_id head_oid, orig_head_oid;
+       char *rebase_amend, *rebase_orig_head;
+       int head_flags, orig_head_flags;
 
        if ((!s->amend && !s->nowarn && !s->workdir_dirty) ||
            !s->branch || strcmp(s->branch, "HEAD"))
                return 0;
 
-       head = read_line_from_git_path("HEAD");
-       orig_head = read_line_from_git_path("ORIG_HEAD");
+       if (read_ref_full("HEAD", RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
+                         &head_oid, &head_flags) ||
+           read_ref_full("ORIG_HEAD", RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
+                         &orig_head_oid, &orig_head_flags))
+               return 0;
+       if (head_flags & REF_ISSYMREF || orig_head_flags & REF_ISSYMREF)
+               return 0;
+
        rebase_amend = read_line_from_git_path("rebase-merge/amend");
        rebase_orig_head = read_line_from_git_path("rebase-merge/orig-head");
 
-       if (!head || !orig_head || !rebase_amend || !rebase_orig_head)
+       if (!rebase_amend || !rebase_orig_head)
                ; /* fall through, no split in progress */
        else if (!strcmp(rebase_amend, rebase_orig_head))
-               split_in_progress = !!strcmp(head, rebase_amend);
-       else if (strcmp(orig_head, rebase_orig_head))
+               split_in_progress = !!strcmp(oid_to_hex(&head_oid), rebase_amend);
+       else if (strcmp(oid_to_hex(&orig_head_oid), rebase_orig_head))
                split_in_progress = 1;
 
-       free(head);
-       free(orig_head);
        free(rebase_amend);
        free(rebase_orig_head);
 
@@ -1569,10 +1583,10 @@ static void show_revert_in_progress(struct wt_status *s,
 static void show_bisect_in_progress(struct wt_status *s,
                                    const char *color)
 {
-       if (s->state.branch)
+       if (s->state.bisecting_from)
                status_printf_ln(s, color,
                                 _("You are currently bisecting, started from branch '%s'."),
-                                s->state.branch);
+                                s->state.bisecting_from);
        else
                status_printf_ln(s, color,
                                 _("You are currently bisecting."));
@@ -1733,7 +1747,7 @@ int wt_status_check_bisect(const struct worktree *wt,
 
        if (!stat(worktree_git_path(wt, "BISECT_LOG"), &st)) {
                state->bisect_in_progress = 1;
-               state->branch = get_branch(wt, "BISECT_START");
+               state->bisecting_from = get_branch(wt, "BISECT_START");
                return 1;
        }
        return 0;
@@ -2580,8 +2594,8 @@ int has_unstaged_changes(struct repository *r, int ignore_submodules)
        }
        rev_info.diffopt.flags.quick = 1;
        diff_setup_done(&rev_info.diffopt);
-       result = run_diff_files(&rev_info, 0);
-       result = diff_result_code(&rev_info.diffopt, result);
+       run_diff_files(&rev_info, 0);
+       result = diff_result_code(&rev_info.diffopt);
        release_revisions(&rev_info);
        return result;
 }
@@ -2614,8 +2628,8 @@ int has_uncommitted_changes(struct repository *r,
        }
 
        diff_setup_done(&rev_info.diffopt);
-       result = run_diff_index(&rev_info, 1);
-       result = diff_result_code(&rev_info.diffopt, result);
+       run_diff_index(&rev_info, DIFF_INDEX_CACHED);
+       result = diff_result_code(&rev_info.diffopt);
        release_revisions(&rev_info);
        return result;
 }
@@ -2655,8 +2669,12 @@ int require_clean_work_tree(struct repository *r,
        }
 
        if (err) {
-               if (hint)
+               if (hint) {
+                       if (!*hint)
+                               BUG("empty hint passed to require_clean_work_tree();"
+                                   " use NULL instead");
                        error("%s", hint);
+               }
                if (!gently)
                        exit(128);
        }
index ab9cc9d8f032b77fbf6bfd5882c45a801a28fa09..5e99ba47073493aa4ee80a9501dd4375ec903d8f 100644 (file)
@@ -94,6 +94,7 @@ struct wt_status_state {
        char *branch;
        char *onto;
        char *detached_from;
+       char *bisecting_from;
        struct object_id detached_oid;
        struct object_id revert_head_oid;
        struct object_id cherry_pick_head_oid;
@@ -129,6 +130,7 @@ struct wt_status {
        int rename_score;
        int rename_limit;
        enum wt_status_format status_format;
+       unsigned char added_cut_line; /* boolean */
        struct wt_status_state state;
        struct object_id oid_commit; /* when not Initial */
 
@@ -146,7 +148,7 @@ struct wt_status {
 
 size_t wt_status_locate_end(const char *s, size_t len);
 void wt_status_append_cut_line(struct strbuf *buf);
-void wt_status_add_cut_line(FILE *fp);
+void wt_status_add_cut_line(struct wt_status *s);
 void wt_status_prepare(struct repository *r, struct wt_status *s);
 void wt_status_print(struct wt_status *s);
 void wt_status_collect(struct wt_status *s);
index adcea109fa9a54eaa96c67c1b5e8a1689af253af..3162f517434353609e1fa45ab67ea3cf4623f8a3 100644 (file)
@@ -1,4 +1,5 @@
 #include "git-compat-util.h"
+#include "gettext.h"
 #include "config.h"
 #include "hex.h"
 #include "object-store-ll.h"
@@ -6,8 +7,6 @@
 #include "xdiff-interface.h"
 #include "xdiff/xtypes.h"
 #include "xdiff/xdiffi.h"
-#include "xdiff/xemit.h"
-#include "xdiff/xmacros.h"
 #include "xdiff/xutils.h"
 
 struct xdiff_emit_state {
@@ -313,7 +312,7 @@ int git_xmerge_config(const char *var, const char *value,
 {
        if (!strcmp(var, "merge.conflictstyle")) {
                if (!value)
-                       die("'%s' is not a boolean", var);
+                       return config_error_nonbool(var);
                if (!strcmp(value, "diff3"))
                        git_xmerge_style = XDL_MERGE_DIFF3;
                else if (!strcmp(value, "zdiff3"))
@@ -325,8 +324,8 @@ int git_xmerge_config(const char *var, const char *value,
                 * git-completion.bash when you add new merge config
                 */
                else
-                       die("unknown style '%s' given for '%s'",
-                           value, var);
+                       return error(_("unknown style '%s' given for '%s'"),
+                                    value, var);
                return 0;
        }
        return git_default_config(var, value, ctx, cb);